Skip to content

Commit

Permalink
chore: upgrading fuel-core to 0.22 (#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
arboleya authored Dec 13, 2023
1 parent 3f0c18f commit a9be936
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .changeset/swift-dancers-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@fuel-ts/fuel-core": minor
"@fuel-ts/providers": minor
"@fuel-ts/versions": minor
---

Upgrading `fuel-core` to `0.22`
2 changes: 1 addition & 1 deletion packages/fuel-core/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.21.0
0.22.0
38 changes: 37 additions & 1 deletion packages/providers/fuel-core-schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ type ChainInfo {
name: String!
latestBlock: Block!
daHeight: U64!
peerCount: Int!
consensusParameters: ConsensusParameters!
gasCosts: GasCosts!
}
Expand Down Expand Up @@ -280,10 +279,12 @@ input ExcludeInput {
}

type FailureStatus {
transactionId: TransactionId!
block: Block!
time: Tai64Timestamp!
reason: String!
programState: ProgramState
receipts: [Receipt!]!
}

type FeeParameters {
Expand Down Expand Up @@ -641,6 +642,7 @@ type NodeInfo {
maxTx: U64!
maxDepth: U64!
nodeVersion: String!
peers: [PeerInfo!]!
}

scalar Nonce
Expand Down Expand Up @@ -686,6 +688,38 @@ type PageInfo {
endCursor: String
}

type PeerInfo {
"""
The libp2p peer id
"""
id: String!

"""
The advertised multi-addrs that can be used to connect to this peer
"""
addresses: [String!]!

"""
The self-reported version of the client the peer is using
"""
clientVersion: String

"""
The last reported height of the peer
"""
blockHeight: U32

"""
The last heartbeat from this peer in unix epoch time ms
"""
lastHeartbeatMs: U64!

"""
The internal fuel p2p reputation of this peer
"""
appScore: Float!
}

type PoAConsensus {
"""
Gets the signature of the block produced by `PoA` consensus.
Expand Down Expand Up @@ -995,9 +1029,11 @@ type Subscription {
}

type SuccessStatus {
transactionId: TransactionId!
block: Block!
time: Tai64Timestamp!
programState: ProgramState
receipts: [Receipt!]!
}

scalar Tai64Timestamp
Expand Down
9 changes: 8 additions & 1 deletion packages/providers/src/operations.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ fragment chainInfoFragment on ChainInfo {
...blockFragment
}
daHeight
peerCount
consensusParameters {
...consensusParametersFragment
}
Expand Down Expand Up @@ -419,6 +418,14 @@ fragment nodeInfoFragment on NodeInfo {
maxTx
maxDepth
nodeVersion
peers {
id
addresses
clientVersion
blockHeight
lastHeartbeatMs
appScore
}
}

query getNodeInfo {
Expand Down
7 changes: 4 additions & 3 deletions packages/providers/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
GqlChainInfoFragmentFragment,
GqlGasCosts,
GqlGetBlocksQueryVariables,
GqlPeerInfo,
} from './__generated__/operations';
import type { Coin } from './coin';
import type { CoinQuantity, CoinQuantityLike } from './coin-quantity';
Expand Down Expand Up @@ -95,7 +96,6 @@ type ConsensusParameters = {
export type ChainInfo = {
name: string;
baseChainHeight: BN;
peerCount: number;
consensusParameters: ConsensusParameters;
gasCosts: GqlGasCosts;
latestBlock: {
Expand All @@ -116,6 +116,7 @@ export type NodeInfo = {
maxTx: BN;
maxDepth: BN;
nodeVersion: string;
peers: GqlPeerInfo[];
};

export type NodeInfoAndConsensusParameters = {
Expand All @@ -142,15 +143,14 @@ export type TransactionCost = {
// #endregion cost-estimation-1

const processGqlChain = (chain: GqlChainInfoFragmentFragment): ChainInfo => {
const { name, daHeight, peerCount, consensusParameters, latestBlock } = chain;
const { name, daHeight, consensusParameters, latestBlock } = chain;

const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } =
consensusParameters;

return {
name,
baseChainHeight: bn(daHeight),
peerCount,
consensusParameters: {
contractMaxSize: bn(contractParams.contractMaxSize),
maxInputs: bn(txParams.maxInputs),
Expand Down Expand Up @@ -445,6 +445,7 @@ export default class Provider {
nodeVersion: nodeInfo.nodeVersion,
utxoValidation: nodeInfo.utxoValidation,
vmBacktrace: nodeInfo.vmBacktrace,
peers: nodeInfo.peers,
};

Provider.nodeInfoCache[this.url] = processedNodeInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { bn } from '@fuel-ts/math';
import { describe } from 'node:test';

import { MOCK_CHAIN } from '../../test/fixtures/chain';
import {
Expand Down
1 change: 0 additions & 1 deletion packages/providers/test/fixtures/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const MOCK_CHAIN: GqlChainInfoFragmentFragment = {
__typename: 'ChainInfo',
name: 'local_testnet',
daHeight: '234',
peerCount: 0,
consensusParameters: {
__typename: 'ConsensusParameters',
txParams: {
Expand Down
3 changes: 2 additions & 1 deletion packages/providers/test/fixtures/nodeInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export const MOCK_NODE_INFO: GqlNodeInfoFragmentFragment = {
minGasPrice: '0',
maxTx: '4064',
maxDepth: '10',
nodeVersion: '0.21.0',
nodeVersion: '0.22.0',
peers: [],
};
2 changes: 1 addition & 1 deletion packages/providers/test/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('Provider', () => {

const version = await provider.getVersion();

expect(version).toEqual('0.21.0');
expect(version).toEqual('0.22.0');
});

it('can call()', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/versions/src/lib/getBuiltinVersions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function getBuiltinVersions() {
return {
FORC: '0.48.1',
FUEL_CORE: '0.21.0',
FUEL_CORE: '0.22.0',
FUELS: '0.69.1',
};
}

0 comments on commit a9be936

Please sign in to comment.