Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update support to fuel-core v0.17.1 (beta-3) #775

Merged
merged 20 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: add retry stratefy on fetch
  • Loading branch information
luizstacio committed Feb 10, 2023
commit 9ff57619b7483c47b35acd0b4cda33e0c415b52d
2 changes: 1 addition & 1 deletion .changeset/green-pugs-give.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"@fuel-ts/wallet": minor
---

BRAKE CHANGE, update support to fuel-core v0.17.1
BREAKING CHANGE, update support to fuel-core v0.17.1
2 changes: 2 additions & 0 deletions .changeset/lemon-scissors-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services-run:
docker compose up -d
docker compose up -d --build

services-clean:
docker ps --filter name=fuels-ts* -aq | xargs docker stop | xargs docker rm -f
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Config } from '@jest/types';
const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
bail: true,
setupFiles: ['./jest.env.ts'],
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
modulePathIgnorePatterns: ['/dist/'],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build:watch": "turbo run build --parallel -- --watch",
"ci:test": "./scripts/ci-test.sh",
"test": "jest --no-cache --runInBand",
"test:watch": "jest --watchAll",
"test:watch": "jest --no-cache --watchAll",
"lint": "run-s lint:check prettier:check",
"lint:check": "eslint . --ext .ts",
"lint:fix": "pnpm lint:check -- --fix",
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-gauge/src/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ describe('Contract', () => {
expect(JSON.stringify(value)).toEqual(JSON.stringify([bn(100), bn(200)]));
});

it.only('Get transaction cost with gasPrice 1', async () => {
it('Get transaction cost with gasPrice 1', async () => {
const contract = await setupContract();
const invocationScope = contract
.multiCall([
Expand Down
5 changes: 0 additions & 5 deletions packages/providers/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,11 @@ export default class Provider {
): Promise<CallResult> {
const transactionRequest = transactionRequestify(transactionRequestLike);
await this.addMissingVariables(transactionRequest);

const chainInfo = await this.operations.getChain();
console.log('Debug values on CI', JSON.stringify(chainInfo, null, 2));

const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
const { dryRun: gqlReceipts } = await this.operations.dryRun({
encodedTransaction,
utxoValidation: utxoValidation || false,
});
console.log('Debug values on CI', JSON.stringify(gqlReceipts, null, 2));
const receipts = gqlReceipts.map(processGqlReceipt);
return {
receipts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,23 @@ export class TransactionResponse {
await this.provider.operations.getTransactionWithReceipts({
transactionId: this.id,
});

// If transactions are not found retry until they are available
// TODO: Implement subscriptions to avoid polling and improve performance
if (!transactionWithReceipts) {
throw new Error('No Transaction was received from the client.');
if (this.attempts > 10) {
throw new Error('No Transaction was received from the client.');
}
this.attempts += 1;
await sleep(
Math.min(STATUS_POLLING_INTERVAL_MIN_MS * this.attempts, STATUS_POLLING_INTERVAL_MAX_MS)
);
return this.fetch<TTransactionType>();
}

// Clean attempts
this.attempts = 0;

const transaction = new TransactionCoder().decode(
arrayify(transactionWithReceipts.rawPayload),
0
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ echo $@

# Run test
if [[ "$*" == *"--coverage"* ]]; then
pnpm test /fuel-gauge/src/contract.test.ts
pnpm test $@
TEST_RESULT=$?
else
pnpm test /fuel-gauge/src/contract.test.ts
pnpm test
TEST_RESULT=$?
fi

Expand Down