Skip to content

Commit

Permalink
chore!: upgrade fuel core to 0.28.0 (#2491)
Browse files Browse the repository at this point in the history
* chore: bumped versions

* chore: added devnet URL

* ci: removed redundant env

* chore: removed redundant `FUEL_TESTNET_NETWORK_URL` e2e env

* chore: removed redundant `TEST_WALLET_ADDRESS`

* chore: allowed for two networks in the e2e's

* chore: updates operations

* chore: added alocDependentCost

* chore: added version to Header

* chore: fix incorrect test network

* chore: ensure we don't connect to the live network

* chore: added Block.version

* chore: added `gasPrice` to the dryRun

* chore: point e2e test to devnet

* chore: changeset

* ci: added missing envs

* chore: removed `FUEL_` prefix from network urls

* chore: removed type from network urls

* chore: added ability to run e2e against multiple networks

* chore: revert back to skipping when private key missing

* chore: linting

* chore: reconfigured the e2e transaction tests

* chore: address el nits

* chore: added `txIds` for `testnet`

* chore: combine e2e assets and script

* chore: added all network URLS

* chore: removed redundant env

Co-authored-by: Daniel Bate <[email protected]>

* chore: fixed chain config

* chore: added missing testnet test case

Co-authored-by: Anderson Arboleya <[email protected]>

---------

Co-authored-by: Daniel Bate <[email protected]>
Co-authored-by: Sérgio Torres <[email protected]>
Co-authored-by: Anderson Arboleya <[email protected]>
  • Loading branch information
4 people authored Jun 14, 2024
1 parent e9720df commit e165e37
Show file tree
Hide file tree
Showing 20 changed files with 211 additions and 108 deletions.
7 changes: 7 additions & 0 deletions .changeset/breezy-hounds-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@fuel-ts/versions": patch
"@fuel-ts/account": minor
"fuels": minor
---

chore!: upgrade fuel core to `0.28.0`
6 changes: 6 additions & 0 deletions .fuel-core/configs/chainConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@
"wqmm": 10,
"xor": 2,
"xori": 2,
"alocDependentCost": {
"LightOperation": {
"base": "2",
"unitsPerGas": "214"
}
},
"call": {
"LightOperation": {
"base": 18190,
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ jobs:
- name: Run Isolated Tests
run: pnpm test:e2e
env:
FUEL_NETWORK_URL: https://testnet.fuel.network/v1/graphql
FUEL_TESTNET_NETWORK_URL: https://testnet.fuel.network/v1/graphql
TEST_WALLET_PVT_KEY: ${{ secrets.TEST_WALLET_PVT_KEY }}
TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }}
TESTNET_WALLET_PVT_KEY: ${{ secrets.TESTNET_WALLET_PVT_KEY }}
DEVNET_WALLET_PVT_KEY: ${{ secrets.DEVNET_WALLET_PVT_KEY }}
PUBLISHED_NPM_VERSION: ${{ steps.release.outputs.published_version }}

create-fuels-template-integration:
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ And changing the below variables:
```sh
FUEL_NETWORK_URL=https://testnet.fuel.network/v1/graphql
TEST_WALLET_PVT_KEY=0x...
TEST_WALLET_ADDRESS=fuel...
```

<!-- TODO: add/fix block explorer URL after testnet support- Checking Wallet Balance: https://fuellabs.github.io/block-explorer-v2/beta-5/?#/address/fuel1x33ajpj0jy5p2wcqqu45e32r75zrwfeh6hwqfv5un670rv4p0mns58enjg -->
Expand Down
17 changes: 6 additions & 11 deletions apps/docs-snippets/src/guide/introduction/getting-started.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import {
FUEL_NETWORK_URL,
FUEL_TESTNET_NETWORK_URL,
Provider,
Wallet,
WalletUnlocked,
} from 'fuels';
import { FUEL_NETWORK_URL, TESTNET_NETWORK_URL, Provider, Wallet, WalletUnlocked } from 'fuels';

/**
* @group node
* @group browser
*/
describe('Getting started', () => {
beforeAll(() => {
beforeAll(async () => {
// Avoids using the actual network.
vi.spyOn(Provider, 'create').mockImplementationOnce(() => Provider.create(FUEL_NETWORK_URL));
const mockProvider = await Provider.create(FUEL_NETWORK_URL);
vi.spyOn(Provider, 'create').mockResolvedValue(mockProvider);
});

it('can connect to a local network', async () => {
Expand All @@ -37,10 +32,10 @@ describe('Getting started', () => {

it('can connect to testnet', async () => {
// #region connecting-to-the-testnet
// #import { Provider, Wallet, FUEL_TESTNET_NETWORK_URL };
// #import { Provider, Wallet, TESTNET_NETWORK_URL };

// Create a provider, with the Latest Testnet URL.
const provider = await Provider.create(FUEL_TESTNET_NETWORK_URL);
const provider = await Provider.create(TESTNET_NETWORK_URL);

// Create our wallet (with a private key).
const PRIVATE_KEY = 'a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import type { WalletLocked, WalletUnlocked } from 'fuels';
import { FUEL_NETWORK_URL, HDWallet, Provider, Wallet } from 'fuels';
import { FUEL_NETWORK_URL, TESTNET_NETWORK_URL, HDWallet, Provider, Wallet } from 'fuels';

/**
* @group node
*/
describe(__filename, () => {
beforeAll(async () => {
// Avoids using the actual network.
const mockProvider = await Provider.create(FUEL_NETWORK_URL);
vi.spyOn(Provider, 'create').mockResolvedValue(mockProvider);
});

it('should generate a new wallet just fine', () => {
// #region instantiating-wallets-1
const unlockedWallet: WalletUnlocked = Wallet.generate();
Expand Down Expand Up @@ -100,7 +106,7 @@ describe(__filename, () => {
const myWallet = Wallet.fromAddress(address);

// #region instantiating-wallets-9
const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');
const provider = await Provider.create(TESTNET_NETWORK_URL);

myWallet.connect(provider);
// #endregion instantiating-wallets-9
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.27.0
0.28.0
14 changes: 12 additions & 2 deletions packages/account/src/configs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ describe('Configs', () => {
expect(configs.FUEL_NETWORK_URL).toBe('http://127.0.0.1:4000/v1/graphql');
});

it('exports FUEL_TESTNET_NETWORK_URL', async () => {
it('exports LOCAL_NETWORK_URL', async () => {
const configs = await import('./configs');
expect(configs.FUEL_TESTNET_NETWORK_URL).toBe('https://testnet.fuel.network/v1/graphql');
expect(configs.LOCAL_NETWORK_URL).toBe('http://127.0.0.1:4000/v1/graphql');
});

it('exports DEVNET_NETWORK_URL', async () => {
const configs = await import('./configs');
expect(configs.DEVNET_NETWORK_URL).toBe('https://devnet.fuel.network/v1/graphql');
});

it('exports TESTNET_NETWORK_URL', async () => {
const configs = await import('./configs');
expect(configs.TESTNET_NETWORK_URL).toBe('https://testnet.fuel.network/v1/graphql');
});
});

Expand Down
13 changes: 8 additions & 5 deletions packages/account/src/configs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export const LOCAL_NETWORK_URL = 'http://127.0.0.1:4000/v1/graphql';
export const DEVNET_NETWORK_URL = 'https://devnet.fuel.network/v1/graphql';
export const TESTNET_NETWORK_URL = 'https://testnet.fuel.network/v1/graphql';
// TODO: replace placeholder with mainnet network url
// export const NETWORK_URL = '';

export const FUEL_NETWORK_URL: string =
typeof process !== 'undefined'
? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql'
: 'http://127.0.0.1:4000/v1/graphql';

export const FUEL_DEVNET_NETWORK_URL: string = 'https://devnet.fuel.network/v1/graphql';
export const FUEL_TESTNET_NETWORK_URL: string = 'https://testnet.fuel.network/v1/graphql';
? process?.env?.FUEL_NETWORK_URL || LOCAL_NETWORK_URL
: LOCAL_NETWORK_URL;
16 changes: 16 additions & 0 deletions packages/account/src/providers/fuel-core-schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ input BalanceFilterInput {
}

type Block {
version: BlockVersion!
id: BlockId!
height: U32!
header: Header!
Expand Down Expand Up @@ -89,6 +90,10 @@ type BlockEdge {

scalar BlockId

enum BlockVersion {
V1
}

"""
Breakpoint, defined as a tuple of contract ID and relative PC offset inside it
"""
Expand Down Expand Up @@ -436,6 +441,7 @@ type GasCosts {
wqmm: U64!
xor: U64!
xori: U64!
alocDependentCost: DependentCost!
call: DependentCost!
ccp: DependentCost!
croo: DependentCost!
Expand Down Expand Up @@ -493,6 +499,11 @@ type Genesis {
}

type Header {
"""
Version of the header
"""
version: HeaderVersion!

"""
Hash of the header
"""
Expand Down Expand Up @@ -559,6 +570,10 @@ type Header {
applicationHash: Bytes32!
}

enum HeaderVersion {
V1
}

type HeavyOperation {
base: U64!
gasPerUnit: U64!
Expand Down Expand Up @@ -739,6 +754,7 @@ type Mutation {
dryRun(
txs: [HexString!]!
utxoValidation: Boolean
gasPrice: U64
): [DryRunTransactionExecutionStatus!]!

"""
Expand Down
17 changes: 15 additions & 2 deletions packages/account/src/providers/operations.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ fragment messageProofFragment on MessageProof {
proofIndex
}
messageBlockHeader {
version
id
daHeight
consensusParametersVersion
Expand All @@ -227,6 +228,7 @@ fragment messageProofFragment on MessageProof {
applicationHash
}
commitBlockHeader {
version
id
daHeight
consensusParametersVersion
Expand Down Expand Up @@ -393,6 +395,9 @@ fragment GasCostsFragment on GasCosts {
wqmm
xor
xori
alocDependentCost {
...DependentCostFragment
}
call {
...DependentCostFragment
}
Expand Down Expand Up @@ -775,8 +780,16 @@ query getRelayedTransactionStatus(
}
}

mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) {
dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) {
mutation dryRun(
$encodedTransactions: [HexString!]!
$utxoValidation: Boolean
$gasPrice: U64
) {
dryRun(
txs: $encodedTransactions
utxoValidation: $utxoValidation
gasPrice: $gasPrice
) {
...dryRunTransactionExecutionStatusFragment
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/account/src/providers/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Provider', () => {

const version = await provider.getVersion();

expect(version).toEqual('0.27.0');
expect(version).toEqual('0.28.0');
});

it('can call()', async () => {
Expand Down
5 changes: 5 additions & 0 deletions packages/account/test/fixtures/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ export const MOCK_CHAIN: GqlChainInfoFragment = {
wqmm: '3',
xor: '1',
xori: '1',
alocDependentCost: {
type: 'LightOperation',
base: '2',
unitsPerGas: '214',
},
call: {
type: 'LightOperation',
base: '144',
Expand Down
7 changes: 6 additions & 1 deletion packages/account/test/fixtures/messageProof.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Address } from '@fuel-ts/address';
import { bn } from '@fuel-ts/math';

import type { GqlGetMessageProofQuery } from '../../src/providers/__generated__/operations';
import {
GqlHeaderVersion,
type GqlGetMessageProofQuery,
} from '../../src/providers/__generated__/operations';
import type { MessageProof } from '../../src/providers/message';

export const MESSAGE_PROOF_RAW_RESPONSE: GqlGetMessageProofQuery['messageProof'] = {
Expand All @@ -20,6 +23,7 @@ export const MESSAGE_PROOF_RAW_RESPONSE: GqlGetMessageProofQuery['messageProof']
proofIndex: '432',
},
messageBlockHeader: {
version: GqlHeaderVersion.V1,
id: '0x864b55089878bf7009d2ff64cbeeeeb75fcd73768785dcb75d54180e7fbaab7b',
daHeight: '0',
transactionsCount: '2',
Expand All @@ -35,6 +39,7 @@ export const MESSAGE_PROOF_RAW_RESPONSE: GqlGetMessageProofQuery['messageProof']
messageOutboxRoot: '0x8817eb3173bc39ae465def50f978153fd84ea4badbe3a4e26486ba7f1bcd0579',
},
commitBlockHeader: {
version: GqlHeaderVersion.V1,
id: '0xe4dfe8fc1b5de2c669efbcc5e4c0a61db175d1b2f03e3cd46ed4396e76695c5b',
daHeight: '0',
transactionsCount: '2',
Expand Down
10 changes: 8 additions & 2 deletions packages/fuel-gauge/src/doc-examples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
Signer,
ZeroBytes32,
FUEL_NETWORK_URL,
FUEL_TESTNET_NETWORK_URL,
TESTNET_NETWORK_URL,
} from 'fuels';

import { FuelGaugeProjectsEnum, getFuelGaugeForcProject } from '../test/fixtures';
Expand Down Expand Up @@ -60,6 +60,12 @@ const ADDRESS_BYTES = new Uint8Array([
describe('Doc Examples', () => {
let baseAssetId: string;

beforeAll(async () => {
// Avoids using the actual network.
const mockProvider = await Provider.create(FUEL_NETWORK_URL);
vi.spyOn(Provider, 'create').mockResolvedValue(mockProvider);
});

beforeAll(async () => {
const provider = await Provider.create(FUEL_NETWORK_URL);
baseAssetId = provider.getBaseAssetId();
Expand Down Expand Up @@ -239,7 +245,7 @@ describe('Doc Examples', () => {
});

it('can connect to testnet', async () => {
const provider = await Provider.create(FUEL_TESTNET_NETWORK_URL);
const provider = await Provider.create(TESTNET_NETWORK_URL);
const PRIVATE_KEY = 'a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568';
const wallet = Wallet.fromPrivateKey(PRIVATE_KEY, provider);

Expand Down
60 changes: 0 additions & 60 deletions packages/fuel-gauge/src/e2e-assets.test.ts

This file was deleted.

Loading

0 comments on commit e165e37

Please sign in to comment.