diff --git a/Cargo.lock b/Cargo.lock index b7893fc64a5..539a65af042 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1585,6 +1585,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -2564,10 +2575,11 @@ dependencies = [ [[package]] name = "fuel-tx" -version = "0.20.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e6e4b2fb996102f086dd40f2d3f4f173aac03f2998a865d8b2248e76bb04c7f" +checksum = "d91e0ec3248f8ffb639653489219ca3be9fb938b93f0c7c142fef4f150ce4224" dependencies = [ + "derivative", "fuel-asm", "fuel-crypto", "fuel-merkle", @@ -2608,9 +2620,9 @@ dependencies = [ [[package]] name = "fuel-vm" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12bc62660875a8942476f7bf934d97825e0c57b98eacd9e9194570224c609d47" +checksum = "d764a72b195e8b152377e20c61021aca3a4744d6de056e6c889fe8ab785cde7d" dependencies = [ "anyhow", "fuel-asm", @@ -2621,7 +2633,6 @@ dependencies = [ "fuel-types", "itertools", "rand 0.8.5", - "secp256k1", "serde", "sha3", "tai64", diff --git a/fuel-client/Cargo.toml b/fuel-client/Cargo.toml index e968b297bb8..1ff0490c780 100644 --- a/fuel-client/Cargo.toml +++ b/fuel-client/Cargo.toml @@ -20,7 +20,7 @@ chrono = { version = "0.4", features = ["serde"] } clap = { version = "3.1", features = ["derive"] } cynic = { version = "1.0", features = ["surf"] } derive_more = { version = "0.99" } -fuel-vm = { version = "0.18", features = ["serde"] } +fuel-vm = { version = "0.19", features = ["serde"] } futures = "0.3" futures-timer = "3.0" hex = "0.4" diff --git a/fuel-client/assets/schema.sdl b/fuel-client/assets/schema.sdl index 68be956e63c..7b2897ee689 100644 --- a/fuel-client/assets/schema.sdl +++ b/fuel-client/assets/schema.sdl @@ -485,6 +485,7 @@ type Receipt { sender: Address recipient: Address nonce: Bytes32 + contractId: ContractId } enum ReceiptType { diff --git a/fuel-client/src/client/schema/snapshots/fuel_gql_client__client__schema__tx__tests__dry_run_tx_gql_output.snap b/fuel-client/src/client/schema/snapshots/fuel_gql_client__client__schema__tx__tests__dry_run_tx_gql_output.snap index 954396e8089..bf0fe5424c0 100644 --- a/fuel-client/src/client/schema/snapshots/fuel_gql_client__client__schema__tx__tests__dry_run_tx_gql_output.snap +++ b/fuel-client/src/client/schema/snapshots/fuel_gql_client__client__schema__tx__tests__dry_run_tx_gql_output.snap @@ -1,12 +1,41 @@ --- source: fuel-client/src/client/schema/tx.rs -assertion_line: 324 expression: query.query - --- mutation Mutation($_0: HexString!, $_1: Boolean) { dryRun(tx: $_0, utxoValidation: $_1) { - rawPayload + param1 + param2 + amount + assetId + gas + digest + contract { + id + } + is + pc + ptr + ra + rb + rc + rd + reason + receiptType + to { + id + } + toAddress + val + len + result + gasUsed + data + messageId + sender + recipient + nonce + contractId } } diff --git a/fuel-client/src/client/schema/snapshots/fuel_gql_client__client__schema__tx__tests__transparent_transaction_by_id_query_gql_output.snap b/fuel-client/src/client/schema/snapshots/fuel_gql_client__client__schema__tx__tests__transparent_transaction_by_id_query_gql_output.snap index 5ef8ce9116b..b25c5249f15 100644 --- a/fuel-client/src/client/schema/snapshots/fuel_gql_client__client__schema__tx__tests__transparent_transaction_by_id_query_gql_output.snap +++ b/fuel-client/src/client/schema/snapshots/fuel_gql_client__client__schema__tx__tests__transparent_transaction_by_id_query_gql_output.snap @@ -141,6 +141,7 @@ query Query($_0: TransactionId!) { sender recipient nonce + contractId } script scriptData diff --git a/fuel-client/src/client/schema/tx.rs b/fuel-client/src/client/schema/tx.rs index 595956afb2d..d33fdb80795 100644 --- a/fuel-client/src/client/schema/tx.rs +++ b/fuel-client/src/client/schema/tx.rs @@ -23,6 +23,9 @@ use std::convert::{ TryInto, }; +pub mod transparent_receipt; +pub mod transparent_tx; + #[derive(cynic::FragmentArguments, Debug)] pub struct TxIdArgs { pub id: TransactionId, @@ -260,7 +263,7 @@ pub struct DryRunArg { )] pub struct DryRun { #[arguments(tx = &args.tx, utxo_validation = &args.utxo_validation)] - pub dry_run: Vec, + pub dry_run: Vec, } #[derive(cynic::QueryFragment, Debug)] @@ -280,9 +283,6 @@ pub mod tests { use crate::client::schema::Bytes; use fuel_vm::fuel_types::bytes::SerializableVec; - pub mod transparent_receipt; - pub mod transparent_tx; - #[test] fn transparent_transaction_by_id_query_gql_output() { use cynic::QueryBuilder; diff --git a/fuel-client/src/client/schema/tx/tests/transparent_receipt.rs b/fuel-client/src/client/schema/tx/transparent_receipt.rs similarity index 99% rename from fuel-client/src/client/schema/tx/tests/transparent_receipt.rs rename to fuel-client/src/client/schema/tx/transparent_receipt.rs index 887db7134c6..ddd15b74aa6 100644 --- a/fuel-client/src/client/schema/tx/tests/transparent_receipt.rs +++ b/fuel-client/src/client/schema/tx/transparent_receipt.rs @@ -4,6 +4,7 @@ use crate::client::schema::{ Address, AssetId, Bytes32, + ContractId, ConversionError, ConversionError::MissingField, HexString, @@ -42,6 +43,7 @@ pub struct Receipt { pub sender: Option
, pub recipient: Option
, pub nonce: Option, + pub contract_id: Option, } #[derive(cynic::Enum, Clone, Copy, Debug)] @@ -173,6 +175,7 @@ impl TryFrom for fuel_vm::prelude::Receipt { .is .ok_or_else(|| MissingField("is".to_string()))? .into(), + contract_id: schema.contract_id.map(Into::into), }, ReceiptType::Revert => fuel_vm::prelude::Receipt::Revert { id: schema diff --git a/fuel-client/src/client/schema/tx/tests/transparent_tx.rs b/fuel-client/src/client/schema/tx/transparent_tx.rs similarity index 99% rename from fuel-client/src/client/schema/tx/tests/transparent_tx.rs rename to fuel-client/src/client/schema/tx/transparent_tx.rs index 43b8b34bec6..0183d8e9253 100644 --- a/fuel-client/src/client/schema/tx/tests/transparent_tx.rs +++ b/fuel-client/src/client/schema/tx/transparent_tx.rs @@ -2,7 +2,7 @@ use crate::client::schema::{ contract::ContractIdFragment, schema, tx::{ - tests::transparent_receipt::Receipt, + transparent_receipt::Receipt, TransactionStatus, TxIdArgs, }, diff --git a/fuel-core-interfaces/Cargo.toml b/fuel-core-interfaces/Cargo.toml index fb69ff12d35..c80f0624786 100644 --- a/fuel-core-interfaces/Cargo.toml +++ b/fuel-core-interfaces/Cargo.toml @@ -15,7 +15,7 @@ anyhow = "1.0" async-trait = "0.1" chrono = { version = "0.4" } derive_more = { version = "0.99" } -fuel-vm = { version = "0.18", default-features = false, features = ["random"] } +fuel-vm = { version = "0.19", default-features = false, features = ["random"] } futures = "0.3" lazy_static = "1.4" parking_lot = "0.12" diff --git a/fuel-core/src/executor.rs b/fuel-core/src/executor.rs index bce2cde5ca1..9cff3009e95 100644 --- a/fuel-core/src/executor.rs +++ b/fuel-core/src/executor.rs @@ -44,6 +44,7 @@ use fuel_core_interfaces::{ }, }, prelude::StorageInspect, + state::StateTransition, }, db::{ Coins, @@ -315,13 +316,13 @@ impl Executor { sub_db_view.clone(), self.config.chain_conf.transaction_parameters, ); - let vm_result = vm + let vm_result: StateTransition = vm .transact(checked_tx) .map_err(|error| Error::VmExecution { error, transaction_id: tx_id, })? - .into_owned(); + .into(); // only commit state changes if execution was a success if !vm_result.should_revert() { diff --git a/fuel-core/src/schema/tx/receipt.rs b/fuel-core/src/schema/tx/receipt.rs index bb224ce63f7..fd600fa7762 100644 --- a/fuel-core/src/schema/tx/receipt.rs +++ b/fuel-core/src/schema/tx/receipt.rs @@ -4,6 +4,7 @@ use crate::schema::{ Address, AssetId, Bytes32, + ContractId, HexString, MessageId, U64, @@ -141,6 +142,10 @@ impl Receipt { async fn nonce(&self) -> Option { self.0.nonce().copied().map(Bytes32) } + + async fn contract_id(&self) -> Option { + self.0.contract_id().map(|id| ContractId(*id)) + } } impl From<&fuel_tx::Receipt> for Receipt { diff --git a/fuel-tests/tests/tx/utxo_validation.rs b/fuel-tests/tests/tx/utxo_validation.rs index 2a81d133c8c..181cb7e5c4a 100644 --- a/fuel-tests/tests/tx/utxo_validation.rs +++ b/fuel-tests/tests/tx/utxo_validation.rs @@ -39,7 +39,7 @@ async fn submit_utxo_verified_tx_with_min_gas_price() { Opcode::RET(REG_ONE).to_bytes().into_iter().collect(), vec![], ) - .gas_limit(100) + .gas_limit(10000) .gas_price(1) .add_unsigned_coin_input( SecretKey::random(&mut rng), @@ -144,7 +144,7 @@ async fn dry_run_override_utxo_validation() { Opcode::RET(REG_ONE).to_bytes().into_iter().collect(), vec![], ) - .gas_limit(1000) + .gas_limit(10000) .add_input(Input::coin_signed( rng.gen(), rng.gen(),