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 fuel-core v0.13 #563

Merged
merged 20 commits into from
Nov 3, 2022
8 changes: 8 additions & 0 deletions .changeset/smooth-garlics-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@fuel-ts/contract": patch
"@fuel-ts/providers": patch
"@fuel-ts/transactions": patch
"@fuel-ts/wallet": patch
---

update fuel version
7 changes: 0 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ jobs:
run: |
pnpm lint

- name: Setup Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checking PR Number
uses: jwalton/gh-find-current-pr@v1
id: findPr
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config: Config.InitialOptions = {
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
modulePathIgnorePatterns: ['/dist/'],
coveragePathIgnorePatterns: ['/dist/'],
testTimeout: 15000,
};

export default config;
1 change: 0 additions & 1 deletion packages/contract/src/contracts/multicall/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ license = "Apache-2.0"
name = "multicall"

[dependencies]
std = { path = "/Users/luizstacio/fuels/sway/sway-lib-std" }
2 changes: 1 addition & 1 deletion packages/forc-bin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"forc": "./forc.js"
},
"config": {
"forcVersion": "0.28.1"
"forcVersion": "0.30.0"
},
"dependencies": {
"node-fetch": "^2.6.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-gauge/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for PROJECT_DIR in ./test-projects/* ;
do
BIN_DIR="$PROJECT_DIR/out/debug"

forc build -p $PROJECT_DIR --print-finalized-asm
pnpm forc build -p $PROJECT_DIR --print-finalized-asm
if [[ $PROJECT_DIR == *"predicate-"* ]]; then
pnpm exec ts-node scripts/process-predicate.ts $PROJECT_DIR
fi
Expand Down
3 changes: 2 additions & 1 deletion packages/fuel-gauge/src/contract-factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ describe('Contract Factory', () => {

expect(contact.interface).toBeInstanceOf(Interface);

await contact.functions.initialize_counter(41).call();
const { value: valueInitial } = await contact.functions.initialize_counter(41).call();
expect(valueInitial.toHex()).toEqual(toHex(41));

const { value } = await contact.functions.increment_counter(1).call();
expect(value.toHex()).toEqual(toHex(42));
Expand Down
22 changes: 12 additions & 10 deletions packages/fuel-gauge/src/coverage-contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { BN, Message, Contract } from 'fuels';
import {
zeroPad,
arrayify,
NativeAssetId,
bn,
toHex,
Expand Down Expand Up @@ -353,7 +355,9 @@ describe('Coverage Contract', () => {
amount: bn(1),
sender: WALLET_B.address,
recipient: WALLET_A.address,
data: [8, 7, 6, 5, 4],
data: arrayify(
'0x00000000000000080000000000000007000000000000000600000000000000050000000000000004'
),
nonce: bn(1),
daHeight: bn(0),
},
Expand All @@ -363,7 +367,7 @@ describe('Coverage Contract', () => {
amount: bn('12704439083013451934'),
sender: WALLET_A.address,
recipient: WALLET_B.address,
data: [7],
data: arrayify('0x0000000000000007'),
nonce: bn('1017517292834129547'),
daHeight: bn('3684546456337077810'),
},
Expand All @@ -388,19 +392,17 @@ describe('Coverage Contract', () => {
amount: bn(900),
sender: sender.address,
recipient: receiver.address,
data: [12, 13, 14],
data: zeroPad([12, 13, 14], 8),
nonce: bn(823),
daHeight: bn(0),
},
];

request.addMessages(messages);
const response = await sender.sendTransaction(request);

await response.wait();
await response.waitForResult();
const receiverMessages = await receiver.getMessages();

expect(receiverMessages).toStrictEqual(messages);
expect(receiverMessages).toEqual(messages);
});

it('should test sending input messages [3]', async () => {
Expand All @@ -415,23 +417,23 @@ describe('Coverage Contract', () => {
amount: bn(111),
sender: sender.address,
recipient: receiver.address,
data: [11, 11, 11],
data: zeroPad([11, 11, 11], 8),
nonce: bn(100),
daHeight: bn(0),
},
{
amount: bn(222),
sender: sender.address,
recipient: receiver.address,
data: [22, 22, 22],
data: zeroPad([22, 22, 22], 8),
nonce: bn(200),
daHeight: bn(0),
},
{
amount: bn(333),
sender: sender.address,
recipient: receiver.address,
data: [33, 33, 33],
data: zeroPad([33, 33, 33], 8),
nonce: bn(300),
daHeight: bn(0),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
contract;

use std::logging::log;
use std::context::{*, call_frames::*, registers::context_gas};
use std::context::*;
use std::call_frames::*;
use std::registers::context_gas;
use std::contract_id::ContractId;

enum TestB256Enum {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl CoverageContract for Contract {

fn get_contract_id() -> ContractId {
let id = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
~ContractId::from(id)
ContractId::from(id)
}

fn get_some_option_u8() -> Option<u8> {
Expand Down
111 changes: 97 additions & 14 deletions packages/providers/fuel-core-schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ input BalanceFilterInput {

type Block {
id: BlockId!
height: U64!
header: Header!
camsjams marked this conversation as resolved.
Show resolved Hide resolved
transactions: [Transaction!]!
time: DateTime!
producer: Address!
}

type BlockConnection {
Expand Down Expand Up @@ -281,6 +279,58 @@ type FailureStatus {
programState: ProgramState
}

type Header {
"""
Hash of the header
"""
id: BlockId!

"""
The layer 1 height of messages and events to include since the last layer 1 block number.
"""
daHeight: U64!

"""
Number of transactions in this block.
"""
transactionsCount: U64!

"""
Number of output messages in this block.
"""
outputMessagesCount: U64!

"""
Merkle root of transactions.
"""
transactionsRoot: Bytes32!

"""
Merkle root of messages in this block.
"""
outputMessagesRoot: Bytes32!

"""
Fuel block height.
"""
height: U64!

"""
Merkle root of all previous block header hashes.
"""
prevRoot: Bytes32!

"""
The block producer time.
"""
time: DateTime!

"""
Hash of the application header.
"""
applicationHash: Bytes32!
}

scalar HexString

union Input = InputCoin | InputContract | InputMessage
Expand Down Expand Up @@ -323,7 +373,7 @@ type Message {
sender: Address!
recipient: Address!
nonce: U64!
data: [Int!]!
data: HexString!
daHeight: U64!
fuelBlockSpend: U64
}
Expand Down Expand Up @@ -367,6 +417,18 @@ type MessageOutput {
amount: U64!
}

type MessageProof {
proofSet: [Bytes32!]!
proofIndex: U64!
sender: Address!
recipient: Address!
nonce: Bytes32!
amount: U64!
data: HexString!
signature: Signature!
header: Header!
}

type Mutation {
startSession: ID!
endSession(id: ID!): Boolean!
Expand All @@ -386,12 +448,11 @@ type Mutation {
Submits transaction to the txpool
"""
submit(tx: HexString!): Transaction!
produceBlocks(blocksToProduce: U64!): U64!
produceBlocks(blocksToProduce: U64!, time: TimeParameters): U64!
}

type NodeInfo {
utxoValidation: Boolean!
predicates: Boolean!
vmBacktrace: Boolean!
minGasPrice: U64!
maxTx: U64!
Expand Down Expand Up @@ -542,6 +603,10 @@ type Query {
last: Int
before: String
): MessageConnection!
messageProof(
transactionId: TransactionId!
messageId: MessageId!
): MessageProof

"""
For each `query_per_asset`, get some spendable resources(of asset specified by the query) owned by
Expand Down Expand Up @@ -603,6 +668,7 @@ type Receipt {
sender: Address
recipient: Address
nonce: Bytes32
contractId: ContractId
}

enum ReceiptType {
Expand Down Expand Up @@ -650,6 +716,8 @@ enum RunState {

scalar Salt

scalar Signature

input SpendQueryElementInput {
"""
Identifier of the asset to spend.
Expand All @@ -674,20 +742,35 @@ type SubmittedStatus {
type SuccessStatus {
block: Block!
time: DateTime!
programState: ProgramState!
programState: ProgramState
}

input TimeParameters {
"""
The time to set on the first block
"""
startTime: U64!

"""
The time interval between subsequent blocks
"""
blockTimeInterval: U64!
}

type Transaction {
id: TransactionId!
inputAssetIds: [AssetId!]!
inputContracts: [Contract!]!
gasPrice: U64!
gasLimit: U64!
maturity: U64!
inputAssetIds: [AssetId!]
inputContracts: [Contract!]
gasPrice: U64
gasLimit: U64
maturity: U64
txPointer: TxPointer
isScript: Boolean!
inputs: [Input!]!
isCreate: Boolean!
isMint: Boolean!
inputs: [Input!]
outputs: [Output!]!
witnesses: [HexString!]!
witnesses: [HexString!]
receiptsRoot: Bytes32
status: TransactionStatus
receipts: [Receipt!]
Expand Down
3 changes: 2 additions & 1 deletion packages/providers/src/message.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { BytesLike } from '@ethersproject/bytes';
import type { AbstractAddress } from '@fuel-ts/interfaces';
import type { BN } from '@fuel-ts/math';

Expand All @@ -8,7 +9,7 @@ export type Message = {
amount: BN;
sender: AbstractAddress;
recipient: AbstractAddress;
data: number[];
data: BytesLike;
daHeight: BN;
nonce: BN;
};
7 changes: 4 additions & 3 deletions packages/providers/src/operations.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ fragment receiptFragment on Receipt {

fragment blockFragment on Block {
id
height
producer
header {
height
time
}
transactions {
id
}
time
}

fragment coinFragment on Coin {
Expand Down
4 changes: 2 additions & 2 deletions packages/providers/src/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Provider', () => {

const version = await provider.getVersion();

expect(version).toEqual('0.11.2');
expect(version).toEqual('0.13.2');
});

it('can call()', async () => {
Expand Down Expand Up @@ -55,7 +55,7 @@ describe('Provider', () => {
{
type: ReceiptType.ScriptResult,
result: bn(0),
gasUsed: bn(0x2c),
gasUsed: bn(0x86b),
},
];

Expand Down
Loading