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

chore: upgrade fuel-core to 0.41.0 #3590

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
24a2a10
using fuel core 0.41.0
Torres-ssf Jan 15, 2025
a2baaf8
update fuel-core schema
Torres-ssf Jan 15, 2025
a2c8588
add new scalars
Torres-ssf Jan 15, 2025
1514020
made getBalances support pagination
Torres-ssf Jan 15, 2025
c9fe8b4
made balance related queries use amount128 instead of amount
Torres-ssf Jan 15, 2025
3ead231
add todo test
Torres-ssf Jan 15, 2025
7675278
update return type of getMessageProof
Torres-ssf Jan 15, 2025
0e8a7be
add maxGas and txPoolStats to nodeInfoFragment
Torres-ssf Jan 15, 2025
90a0fdd
add TODO
Torres-ssf Jan 15, 2025
fcc5b5d
implement query for getAssetDetails
Torres-ssf Jan 15, 2025
ceb8d25
implement getAssetDetails method
Torres-ssf Jan 15, 2025
4563216
implement daCompressedBlock method
Torres-ssf Jan 15, 2025
cd7daa6
add new expiration policy
Torres-ssf Jan 15, 2025
4b4c49b
fix var name
Torres-ssf Jan 15, 2025
85ffa1a
fix test description
Torres-ssf Jan 15, 2025
f2f3ca9
add tests for new expiration policy
Torres-ssf Jan 15, 2025
73f4361
add expiration policy to TransactionRequest
Torres-ssf Jan 15, 2025
e5374ae
support expiration policy on BaseInvocationScope
Torres-ssf Jan 15, 2025
468f54b
adjust policies order
Torres-ssf Jan 15, 2025
c30108c
add e2e test for new expiration policy
Torres-ssf Jan 15, 2025
99e6a1b
unify 2 errors to conform with fuel core changes
Torres-ssf Jan 16, 2025
bca1a27
adjust tests
Torres-ssf Jan 16, 2025
757a692
fix test
Torres-ssf Jan 16, 2025
2a6990d
fix error message
Torres-ssf Jan 16, 2025
985bfc3
fix test
Torres-ssf Jan 16, 2025
5872e8d
adjusting test
Torres-ssf Jan 16, 2025
af5b9a8
fix test case
Torres-ssf Jan 16, 2025
4158f84
adjust test
Torres-ssf Jan 16, 2025
d550e44
fix test
Torres-ssf Jan 16, 2025
821ebdc
unset cached resources as soon as the TX is processed
Torres-ssf Jan 16, 2025
d2d176e
Merge branch 'master' into st/chore/upgrade-fuel-core@0.41.0
Torres-ssf Jan 16, 2025
7701bad
document new expiration policy
Torres-ssf Jan 16, 2025
85a87bf
reverting breaking changes
Torres-ssf Jan 17, 2025
04c02f5
remove unused imports
Torres-ssf Jan 17, 2025
33902b8
add changeset
Torres-ssf Jan 17, 2025
ea88409
Merge branch 'master' into st/chore/upgrade-fuel-core@0.41.0
Torres-ssf Jan 17, 2025
5590af0
adjusting errors messages from master
Torres-ssf Jan 17, 2025
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
11 changes: 11 additions & 0 deletions .changeset/real-schools-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@fuel-ts/transactions": patch
"@internal/fuel-core": patch
"@fuel-ts/versions": patch
"@fuel-ts/account": patch
"@fuel-ts/program": patch
"@fuel-ts/recipes": patch
"@fuel-ts/errors": patch
---

chore: upgrade `fuel-core` to `0.41.0`
2 changes: 1 addition & 1 deletion apps/demo-bun-fuels/src/bun.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('ExampleContract', () => {
() => contractInstance.functions.return_input(1337).simulate(),
new FuelError(
ErrorCode.NOT_ENOUGH_FUNDS,
`The account(s) sending the transaction don't have enough funds to cover the transaction.`
`Insufficient funds or too many small value coins. Consider combining UTXOs.`
)
);
});
Expand Down
2 changes: 1 addition & 1 deletion apps/demo-fuels/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('ExampleContract', () => {
() => contractInstance.functions.return_input(1337).simulate(),
new FuelError(
ErrorCode.NOT_ENOUGH_FUNDS,
`The account(s) sending the transaction don't have enough funds to cover the transaction.`
`Insufficient funds or too many small value coins. Consider combining UTXOs.`
)
);
});
Expand Down
2 changes: 1 addition & 1 deletion apps/demo-typegen/src/demo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ it('should throw when simulating via contract factory with wallet with no resour
() => contractInstance.functions.return_input(1337).simulate(),
new FuelError(
ErrorCode.NOT_ENOUGH_FUNDS,
`The account(s) sending the transaction don't have enough funds to cover the transaction.`
`Insufficient funds or too many small value coins. Consider combining UTXOs.`
)
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const { error } = await safeExec(async () =>
);

// #region send-and-spend-funds-from-predicates-6
const errorMessage = `The account(s) sending the transaction don't have enough funds to cover the transaction.`;
const errorMessage = `Insufficient funds or too many small value coins. Consider combining UTXOs.`;
// #endregion send-and-spend-funds-from-predicates-6

const actualErrorMessage = (<Error>error).message;
Expand Down
12 changes: 9 additions & 3 deletions apps/docs/src/guide/transactions/adding-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Transaction parameters allow you to configure various aspects of your blockchain

All available parameters are shown below:

<<< @./snippets/transaction-parameters.ts#transaction-parameters-6{ts:line-numbers}
<<< @./snippets/transaction-parameters.ts#transaction-parameters-7{ts:line-numbers}

## Gas Limit

Expand Down Expand Up @@ -38,6 +38,12 @@ The maximum byte length allowed for the transaction witnesses array. For instanc

<<< @./snippets/transaction-parameters.ts#transaction-parameters-5{ts:line-numbers}

## Expiration

The block number after which the transaction can no longer be included in the blockchain. For example, if you set the expiration block for your transaction to 200, and the transaction remains in the queue waiting to be processed when block 200 is created, the transaction will be rejected.

<<< @./snippets/transaction-parameters.ts#transaction-parameters-6{ts:line-numbers}

## Variable Outputs

The number of variable outputs that should be added to the transaction request. You can read more about it on this [guide](../contracts/variable-outputs.md)
Expand All @@ -48,11 +54,11 @@ The number of variable outputs that should be added to the transaction request.

To set the transaction parameters, you have access to the `txParams` method on a transaction request.

<<< @./snippets/transaction-parameters.ts#transaction-parameters-7{ts:line-numbers}
<<< @./snippets/transaction-parameters.ts#transaction-parameters-8{ts:line-numbers}

The same method is also accessible within a function invocation scope, so it can also be used when calling contract functions.

<<< @./snippets/transaction-parameters.ts#transaction-parameters-8{ts:line-numbers}
<<< @./snippets/transaction-parameters.ts#transaction-parameters-9{ts:line-numbers}

> **Note:** When performing an action that results in a transaction (e.g. contract deployment, contract call with `.call()`, asset transfer), the SDK will automatically estimate the fee based on the gas limit and the transaction's byte size. This estimation is used when building the transaction. As a side effect, your wallet must own at least one coin of the base asset, regardless of the amount.

Expand Down
4 changes: 4 additions & 0 deletions apps/docs/src/guide/transactions/adding-policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ The number of blocks that must pass before the transaction can be included in a

The maximum amount you're willing to pay for the transaction using the base asset.

### Expiration

Block number after which the transaction can no longer be included in the blockchain.

## Setting Transaction Policies

The following snippet shows which transaction parameters correspond to which policies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const deploy = await CounterFactory.deploy(wallet);

const { contract } = await deploy.waitForResult();

// #region transaction-parameters-6
// #region transaction-parameters-7
const txParams: TxParams = {
// #region transaction-parameters-1
gasLimit: bn(70935),
Expand All @@ -30,17 +30,20 @@ const txParams: TxParams = {
// #region transaction-parameters-5
witnessLimit: bn(5000),
// #endregion transaction-parameters-5
// #region transaction-parameters-6
expiration: 200,
// #endregion transaction-parameters-6
};
// #endregion transaction-parameters-6
// #endregion transaction-parameters-7

// #region transaction-parameters-7
// #region transaction-parameters-8
const transactionRequest = new ScriptTransactionRequest({
script: ScriptSum.bytecode,
gasLimit: 100,
});
// #endregion transaction-parameters-7
// #endregion transaction-parameters-8

// #region transaction-parameters-8
// #region transaction-parameters-9
const { waitForResult } = await contract.functions
.increment_count(15) //
.txParams(txParams)
Expand All @@ -55,5 +58,5 @@ console.log('Transaction request', transactionRequest);
console.log('Transaction status', isStatusSuccess);
console.log('Transaction value', value);

// #endregion transaction-parameters-8
// #endregion transaction-parameters-9
// #endregion full
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const transactionRequest = new ScriptTransactionRequest({
tip: bn(10),
witnessLimit: 900,
maxFee: bn(2000),
expiration: 200,
});

// Set the script main function arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const transactionRequest = new ScriptTransactionRequest({
witnessLimit: bn(1), // Sets the witness limit policy
maturity: 1, // Sets the maturity policy
maxFee: bn(1), // Sets the max fee policy
expiration: 200, // Sets the block after which the transaction cannot be included.
});
// #endregion transaction-policies-1

Expand Down
2 changes: 1 addition & 1 deletion internal/fuel-core/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.40.2
0.41.0
4 changes: 3 additions & 1 deletion packages/account/codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"U16": "string",
"U32": "string",
"U64": "string",
"UtxoId": "string"
"U128": "string",
"UtxoId": "string",
"SubId": "string"
},
"useTypeImports": true,
"dedupeOperationSuffix": true,
Expand Down
7 changes: 3 additions & 4 deletions packages/account/src/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ describe('Account', () => {
() => user.getResourcesToSpend([[1, ASSET_A, 500_000]], { utxos: [assetAUTXO.id] }),
new FuelError(
ErrorCode.NOT_ENOUGH_FUNDS,
`The account(s) sending the transaction don't have enough funds to cover the transaction.`
`Insufficient funds or too many small value coins. Consider combining UTXOs.`
)
);
});
Expand Down Expand Up @@ -969,9 +969,8 @@ describe('Account', () => {
request.addCoinOutput(wallet.address, 30_000, await provider.getBaseAssetId());

await expectToThrowFuelError(() => request.estimateAndFund(wallet), {
code: ErrorCode.MAX_COINS_REACHED,
message:
'The account retrieving coins has exceeded the maximum number of coins per asset. Please consider combining your coins into a single UTXO.',
code: ErrorCode.NOT_ENOUGH_FUNDS,
message: 'Insufficient funds or too many small value coins. Consider combining UTXOs.',
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/account/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { assembleTransferToContractScript } from './utils/formatTransferToContra

export type TxParamsType = Pick<
ScriptTransactionRequestLike,
'gasLimit' | 'tip' | 'maturity' | 'maxFee' | 'witnessLimit'
'gasLimit' | 'tip' | 'maturity' | 'maxFee' | 'witnessLimit' | 'expiration'
>;

export type TransferParams = {
Expand Down
55 changes: 53 additions & 2 deletions packages/account/src/providers/fuel-core-schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ scalar Address

scalar AssetId

type AssetInfoDetails {
contractId: ContractId!
subId: SubId!
totalSupply: U128!
}

type Balance {
owner: Address!
amount: U64!
amountU128: U128!
assetId: AssetId!
}

Expand Down Expand Up @@ -314,6 +321,10 @@ enum ContractParametersVersion {
V1
}

type DaCompressedBlock {
bytes: HexString!
}

union DependentCost = LightOperation | HeavyOperation

type DryRunFailureStatus {
Expand Down Expand Up @@ -468,6 +479,7 @@ type GasCosts {
wqmm: U64!
xor: U64!
xori: U64!
ecop: U64
alocDependentCost: DependentCost!
bldd: DependentCost
bsiz: DependentCost
Expand All @@ -492,6 +504,7 @@ type GasCosts {
smo: DependentCost!
srwq: DependentCost!
swwq: DependentCost!
epar: DependentCost
contractRoot: DependentCost!
stateRoot: DependentCost!
vmInitialization: DependentCost!
Expand Down Expand Up @@ -809,8 +822,11 @@ type NodeInfo {
utxoValidation: Boolean!
vmBacktrace: Boolean!
maxTx: U64!
maxGas: U64!
maxSize: U64!
maxDepth: U64!
nodeVersion: String!
txPoolStats: TxPoolStats!
peers: [PeerInfo!]!
}

Expand Down Expand Up @@ -921,6 +937,13 @@ type ProgramState {
}

type Query {
assetDetails(
"""
ID of the Asset
"""
id: AssetId!
): AssetInfoDetails!

"""
Read register value by index.
"""
Expand Down Expand Up @@ -1039,7 +1062,8 @@ type Query {
"""
The list of requested assets` coins with asset ids, `target` amount the user
wants to reach, and the `max` number of coins in the selection. Several
entries with the same asset id are not allowed.
entries with the same asset id are not allowed. The result can't contain
more coins than `max_inputs`.
"""
queryPerAsset: [SpendQueryElementInput!]!

Expand All @@ -1048,6 +1072,12 @@ type Query {
"""
excludedIds: ExcludeInput
): [[CoinType!]!]!
daCompressedBlock(
"""
Height of the block
"""
height: U32!
): DaCompressedBlock
contract(
"""
ID of the Contract
Expand Down Expand Up @@ -1091,7 +1121,7 @@ type Query {
nonce: Nonce!
commitBlockId: BlockId
commitBlockHeight: U32
): MessageProof
): MessageProof!
messageStatus(nonce: Nonce!): MessageStatus!
relayedTransactionStatus(
"""
Expand Down Expand Up @@ -1232,6 +1262,8 @@ type StateTransitionPurpose {
root: Bytes32!
}

scalar SubId

type SubmittedStatus {
time: Tai64Timestamp!
}
Expand Down Expand Up @@ -1383,6 +1415,25 @@ enum TxParametersVersion {

scalar TxPointer

type TxPoolStats {
"""
The number of transactions in the pool
"""
txCount: U64!

"""
The total size of the transactions in the pool
"""
totalSize: U64!

"""
The total gas of the transactions in the pool
"""
totalGas: U64!
}

scalar U128

scalar U16

scalar U32
Expand Down
14 changes: 14 additions & 0 deletions packages/account/src/providers/operations.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,20 @@ query getRelayedTransactionStatus(
}
}

query getAssetDetails($assetId: AssetId!) {
assetDetails(id: $assetId) {
subId
contractId
totalSupply
}
}

query daCompressedBlock($height: U32!) {
daCompressedBlock(height: $height) {
bytes
}
}

mutation dryRun(
$encodedTransactions: [HexString!]!
$utxoValidation: Boolean
Expand Down
Loading
Loading