Skip to content

Commit

Permalink
chore: upgrade fuel-core to 0.40.4 (#3626)
Browse files Browse the repository at this point in the history
  • Loading branch information
Torres-ssf authored Jan 29, 2025
1 parent 13064a7 commit 45cc32e
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .changeset/ten-boats-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@internal/fuel-core": patch
"@fuel-ts/versions": patch
"@fuel-ts/account": patch
---

chore: upgrade `fuel-core` to `0.40.4`
2 changes: 1 addition & 1 deletion apps/create-fuels-counter-guide/fuel-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ channel = "testnet"

[components]
forc = "0.66.6"
fuel-core = "0.40.2"
fuel-core = "0.40.4"
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.40.4
33 changes: 32 additions & 1 deletion packages/account/src/providers/fuel-core-schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ enum ContractParametersVersion {
V1
}

type DaCompressedBlock {
bytes: HexString!
}

union DependentCost = LightOperation | HeavyOperation

type DryRunFailureStatus {
Expand Down Expand Up @@ -809,8 +813,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 @@ -1039,7 +1046,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 +1056,12 @@ type Query {
"""
excludedIds: ExcludeInput
): [[CoinType!]!]!
daCompressedBlock(
"""
Height of the block
"""
height: U32!
): DaCompressedBlock
contract(
"""
ID of the Contract
Expand Down Expand Up @@ -1383,6 +1397,23 @@ 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 U16

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

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

query getMessageProof(
$transactionId: TransactionId!
$nonce: Nonce!
Expand Down
27 changes: 26 additions & 1 deletion packages/account/src/providers/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { expectToThrowFuelError, safeExec } from '@fuel-ts/errors/test-utils';
import { BN, bn } from '@fuel-ts/math';
import type { Receipt } from '@fuel-ts/transactions';
import { InputType, OutputType, ReceiptType } from '@fuel-ts/transactions';
import { DateTime, arrayify, sleep } from '@fuel-ts/utils';
import { DateTime, arrayify, hexlify, sleep } from '@fuel-ts/utils';
import { ASSET_A, ASSET_B } from '@fuel-ts/utils/test-utils';
import { versions } from '@fuel-ts/versions';

Expand Down Expand Up @@ -2462,4 +2462,29 @@ describe('Provider', () => {
code: ErrorCode.SCRIPT_REVERTED,
});
});

it('can get compressed block bytes', async () => {
const bytes = hexlify(randomBytes(32));

using launched = await setupTestProviderAndWallets();
const { provider } = launched;

// Should return null when block is not found
let compressed = await provider.daCompressedBlock('1');

expect(compressed).toBeNull();

vi.spyOn(provider, 'daCompressedBlock').mockImplementationOnce(async () =>
Promise.resolve({
bytes,
})
);

const block = await provider.getBlock('latest');
compressed = await provider.daCompressedBlock(String(block?.height));

expect(compressed).toStrictEqual({ bytes });

vi.restoreAllMocks();
});
});
18 changes: 18 additions & 0 deletions packages/account/src/providers/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,24 @@ export default class Provider {
return { transactions, pageInfo };
}

/**
* Fetches a compressed block at the specified height.
*
* @param height - The height of the block to fetch.
* @returns The compressed block if available, otherwise `null`.
*/
async daCompressedBlock(height: string) {
const { daCompressedBlock } = await this.operations.daCompressedBlock({
height,
});

if (!daCompressedBlock) {
return null;
}

return daCompressedBlock;
}

/**
* Get deployed contract with the given ID.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/create-fuels/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('CLI', { timeout: 15_000 }, () => {
expect(toolchain).toEqual({ channel: 'testnet' });
expect(components).toEqual({
forc: '0.66.6',
'fuel-core': '0.40.2',
'fuel-core': '0.40.4',
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/versions/src/lib/getBuiltinVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Versions } from './types';
export function getBuiltinVersions(): Versions {
return {
FORC: '0.66.6',
FUEL_CORE: '0.40.2',
FUEL_CORE: '0.40.4',
FUELS: '0.98.0',
};
}
2 changes: 1 addition & 1 deletion templates/nextjs/fuel-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ channel = "testnet"

[components]
forc = "0.66.6"
fuel-core = "0.40.2"
fuel-core = "0.40.4"
2 changes: 1 addition & 1 deletion templates/vite/fuel-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ channel = "testnet"

[components]
forc = "0.66.6"
fuel-core = "0.40.2"
fuel-core = "0.40.4"

0 comments on commit 45cc32e

Please sign in to comment.