[INFO] fetching crate fuels-core 0.4.0... [INFO] testing fuels-core-0.4.0 against 1.59.0 for beta-1.60-1 [INFO] extracting crate fuels-core 0.4.0 into /workspace/builds/worker-5/source [INFO] validating manifest of crates.io crate fuels-core 0.4.0 on toolchain 1.59.0 [INFO] running `Command { std: "/workspace/cargo-home/bin/cargo" "+1.59.0" "metadata" "--manifest-path" "Cargo.toml" "--no-deps", kill_on_drop: false }` [INFO] started tweaking crates.io crate fuels-core 0.4.0 [INFO] finished tweaking crates.io crate fuels-core 0.4.0 [INFO] tweaked toml for crates.io crate fuels-core 0.4.0 written to /workspace/builds/worker-5/source/Cargo.toml [INFO] running `Command { std: "/workspace/cargo-home/bin/cargo" "+1.59.0" "generate-lockfile" "--manifest-path" "Cargo.toml" "-Zno-index-update", kill_on_drop: false }` [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] running `Command { std: "/workspace/cargo-home/bin/cargo" "+1.59.0" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-5/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-5/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:0cd99ca24d8e8c98e67c542213511d985b8778b5bdcbb160e038429496686047" "/opt/rustwide/cargo-home/bin/cargo" "+1.59.0" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] 81fe719f9f7dae81dc4f0e0c31b6e4d7876b35efec127d5b61d2d6b00d38b25a [INFO] running `Command { std: "docker" "start" "-a" "81fe719f9f7dae81dc4f0e0c31b6e4d7876b35efec127d5b61d2d6b00d38b25a", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "81fe719f9f7dae81dc4f0e0c31b6e4d7876b35efec127d5b61d2d6b00d38b25a", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "81fe719f9f7dae81dc4f0e0c31b6e4d7876b35efec127d5b61d2d6b00d38b25a", kill_on_drop: false }` [INFO] [stdout] 81fe719f9f7dae81dc4f0e0c31b6e4d7876b35efec127d5b61d2d6b00d38b25a [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-5/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-5/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=warn" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:0cd99ca24d8e8c98e67c542213511d985b8778b5bdcbb160e038429496686047" "/opt/rustwide/cargo-home/bin/cargo" "+1.59.0" "build" "--frozen" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 9e1dd87fc66384db34722936e2933b742462540318dc9c9b851a5e6b88e5c476 [INFO] running `Command { std: "docker" "start" "-a" "9e1dd87fc66384db34722936e2933b742462540318dc9c9b851a5e6b88e5c476", kill_on_drop: false }` [INFO] [stderr] Compiling proc-macro2 v1.0.36 [INFO] [stderr] Compiling unicode-xid v0.2.2 [INFO] [stderr] Compiling syn v1.0.86 [INFO] [stderr] Compiling version_check v0.9.4 [INFO] [stderr] Compiling typenum v1.15.0 [INFO] [stderr] Compiling libc v0.2.119 [INFO] [stderr] Compiling block-padding v0.2.1 [INFO] [stderr] Compiling opaque-debug v0.3.0 [INFO] [stderr] Compiling cpufeatures v0.2.1 [INFO] [stderr] Compiling cc v1.0.73 [INFO] [stderr] Compiling serde_derive v1.0.136 [INFO] [stderr] Compiling fuel-types v0.1.0 [INFO] [stderr] Compiling either v1.6.1 [INFO] [stderr] Compiling serde v1.0.136 [INFO] [stderr] Compiling anyhow v1.0.55 [INFO] [stderr] Compiling serde_json v1.0.79 [INFO] [stderr] Compiling regex-syntax v0.6.25 [INFO] [stderr] Compiling keccak v0.1.0 [INFO] [stderr] Compiling bytes v1.1.0 [INFO] [stderr] Compiling hex v0.4.3 [INFO] [stderr] Compiling pin-project-lite v0.2.8 [INFO] [stderr] Compiling unicode-segmentation v1.9.0 [INFO] [stderr] Compiling fuel-storage v0.1.0 [INFO] [stderr] Compiling ryu v1.0.9 [INFO] [stderr] Compiling itoa v1.0.1 [INFO] [stderr] Compiling strum v0.21.0 [INFO] [stderr] Compiling sway-utils v0.1.9 [INFO] [stderr] Compiling tracing-core v0.1.22 [INFO] [stderr] Compiling aho-corasick v0.7.18 [INFO] [stderr] Compiling itertools v0.10.3 [INFO] [stderr] Compiling fuel-asm v0.1.0 [INFO] [stderr] Compiling generic-array v0.14.5 [INFO] [stderr] Compiling heck v0.3.3 [INFO] [stderr] Compiling quote v1.0.15 [INFO] [stderr] Compiling secp256k1-sys v0.4.2 [INFO] [stderr] Compiling getrandom v0.2.5 [INFO] [stderr] Compiling rand_core v0.6.3 [INFO] [stderr] Compiling regex v1.5.4 [INFO] [stderr] Compiling rand_chacha v0.3.1 [INFO] [stderr] Compiling digest v0.9.0 [INFO] [stderr] Compiling block-buffer v0.9.0 [INFO] [stderr] Compiling rand v0.8.5 [INFO] [stderr] Compiling sha2 v0.9.9 [INFO] [stderr] Compiling sha3 v0.9.1 [INFO] [stderr] Compiling fuel-tx v0.5.0 [INFO] [stderr] Compiling secp256k1 v0.20.3 [INFO] [stderr] Compiling fuel-tx v0.1.0 [INFO] [stderr] Compiling Inflector v0.11.4 [INFO] [stderr] Compiling thiserror-impl v1.0.30 [INFO] [stderr] Compiling tracing-attributes v0.1.19 [INFO] [stderr] Compiling strum_macros v0.21.1 [INFO] [stderr] Compiling tracing v0.1.31 [INFO] [stderr] Compiling thiserror v1.0.30 [INFO] [stderr] Compiling fuel-merkle v0.1.1 [INFO] [stderr] Compiling fuel-vm v0.4.1 [INFO] [stderr] Compiling sway-types v0.1.9 [INFO] [stderr] Compiling fuels-core v0.4.0 (/opt/rustwide/workdir) [INFO] [stderr] Finished dev [unoptimized + debuginfo] target(s) in 40.83s [INFO] running `Command { std: "docker" "inspect" "9e1dd87fc66384db34722936e2933b742462540318dc9c9b851a5e6b88e5c476", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "9e1dd87fc66384db34722936e2933b742462540318dc9c9b851a5e6b88e5c476", kill_on_drop: false }` [INFO] [stdout] 9e1dd87fc66384db34722936e2933b742462540318dc9c9b851a5e6b88e5c476 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-5/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-5/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=warn" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:0cd99ca24d8e8c98e67c542213511d985b8778b5bdcbb160e038429496686047" "/opt/rustwide/cargo-home/bin/cargo" "+1.59.0" "test" "--frozen" "--no-run" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 353d08eb7f59213801beaef80f7215d0aa8cebca6050f9f23db9ea3ccc12ea39 [INFO] running `Command { std: "docker" "start" "-a" "353d08eb7f59213801beaef80f7215d0aa8cebca6050f9f23db9ea3ccc12ea39", kill_on_drop: false }` [INFO] [stderr] Compiling fuels-core v0.4.0 (/opt/rustwide/workdir) [INFO] [stderr] Finished test [unoptimized + debuginfo] target(s) in 35.76s [INFO] running `Command { std: "docker" "inspect" "353d08eb7f59213801beaef80f7215d0aa8cebca6050f9f23db9ea3ccc12ea39", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "353d08eb7f59213801beaef80f7215d0aa8cebca6050f9f23db9ea3ccc12ea39", kill_on_drop: false }` [INFO] [stdout] 353d08eb7f59213801beaef80f7215d0aa8cebca6050f9f23db9ea3ccc12ea39 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-5/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-5/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=warn" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:0cd99ca24d8e8c98e67c542213511d985b8778b5bdcbb160e038429496686047" "/opt/rustwide/cargo-home/bin/cargo" "+1.59.0" "test" "--frozen", kill_on_drop: false }` [INFO] [stdout] 3fe57607e2311df203c6f4ee0bc60cfbff841f7aa82c6d12190c6ab4de70cb62 [INFO] running `Command { std: "docker" "start" "-a" "3fe57607e2311df203c6f4ee0bc60cfbff841f7aa82c6d12190c6ab4de70cb62", kill_on_drop: false }` [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] [stderr] Finished test [unoptimized + debuginfo] target(s) in 0.17s [INFO] [stderr] Running unittests (/opt/rustwide/target/debug/deps/fuels_core-07e6295e44778b05) [INFO] [stdout] [INFO] [stdout] running 72 tests [INFO] [stdout] test abi_decoder::tests::decode_bool ... ok [INFO] [stdout] test abi_decoder::tests::decode_array ... ok [INFO] [stdout] test abi_decoder::tests::decode_int ... ok [INFO] [stdout] test abi_decoder::tests::decode_b256 ... ok [INFO] [stdout] test abi_decoder::tests::decode_multiple_int ... ok [INFO] [stdout] test abi_decoder::tests::decode_enum ... ok [INFO] [stdout] test abi_decoder::tests::decode_nested_struct ... ok [INFO] [stdout] test abi_decoder::tests::decode_comprehensive ... ok [INFO] [stdout] test abi_decoder::tests::decode_string ... ok [INFO] [stdout] test abi_decoder::tests::decode_struct ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_signature ... ok [INFO] [stdout] test abi_encoder::tests::encode_comprehensive_function ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_array_type ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_bool_type ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_bits256_type ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_enum ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_byte_type ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_nested_structs ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_two_different_type ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_string_type ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_struct ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_u32_type ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_u32_type_multiple_args ... ok [INFO] [stdout] test abi_encoder::tests::encode_function_with_u64_type ... ok [INFO] [stdout] test code_gen::abigen::tests::generates_bindings_two_args ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_extract_custom_type_name_from_abi_property ... ok [INFO] [stdout] test code_gen::abigen::tests::multiple_custom_types ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_extract_struct_name_from_abi_property_wrong_type ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_fn_outputs_no_components ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_extract_custom_type_name_from_abi_property_bad_data ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_fn_outputs_zero_one_arg ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_fn_outputs_two_more_components ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_function_argument_empty_fourth ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_function_arguments ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_function_arguments_primitive ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_input_name ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_input_param_array ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_input_param_primitive ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_function_simple ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_input_param_struct_with_enum_name ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_input_param_struct_wrong_name ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_selector ... ok [INFO] [stdout] test json_abi::tests::array_encode_and_decode ... ok [INFO] [stdout] test json_abi::tests::b256_and_single_byte_encode_and_decode ... ok [INFO] [stdout] test json_abi::tests::enum_encode_and_decode ... ok [INFO] [stdout] test json_abi::tests::fn_selector_custom_type ... ok [INFO] [stdout] test json_abi::tests::compiler_generated_abi_test ... ok [INFO] [stdout] test json_abi::tests::fn_selector_multiple_primitives ... ok [INFO] [stdout] test json_abi::tests::fn_selector_nested_custom_type ... ok [INFO] [stdout] test json_abi::tests::fn_selector_single_primitive ... ok [INFO] [stdout] test json_abi::tests::nested_array_encode_and_decode ... ok [INFO] [stdout] test json_abi::tests::simple_encode_and_decode ... ok [INFO] [stdout] test json_abi::tests::simple_encode_and_decode_no_selector ... ok [INFO] [stdout] test json_abi::tests::nested_struct_encode_and_decode ... ok [INFO] [stdout] test json_abi::tests::struct_and_primitive_encode_and_decode ... ok [INFO] [stdout] test json_abi::tests::string_encode_and_decode ... ok [INFO] [stdout] test json_abi::tests::tokenize_array ... ok [INFO] [stdout] test json_abi::tests::struct_encode_and_decode ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_expand_internal_struct_with_enum - should panic ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_input_param_struct_name ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_expand_internal_struct_with_struct ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_function_complex ... ok [INFO] [stdout] test code_gen::functions_gen::tests::test_expand_function_arguments_composite ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_expand_internal_enum_with_enum - should panic ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_expand_internal_struct ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_expand_internal_enum_with_struct - should panic ... ok [INFO] [stdout] test code_gen::custom_types_gen::tests::test_expand_internal_enum ... ok [INFO] [stderr] error: 'rustfmt' is not installed for the toolchain '1.59.0-x86_64-unknown-linux-gnu' [INFO] [stderr] To install, run `rustup component add rustfmt --toolchain 1.59.0-x86_64-unknown-linux-gnu` [INFO] [stdout] pub use test_mod :: * ; # [allow (clippy :: too_many_arguments)] mod test_mod { # ! [allow (clippy :: enum_variant_names)] # ! [allow (dead_code)] # ! [allow (unused_imports)] use fuels_contract :: contract :: { Contract , ContractCall , CompiledContract } ; use fuel_gql_client :: client :: FuelClient ; use fuels_core :: { EnumSelector , ParamType , Tokenizable , Token } ; pub struct test { compiled : CompiledContract , fuel_client : FuelClient } impl test { pub fn new (compiled : CompiledContract , fuel_client : FuelClient) -> Self { Self { compiled , fuel_client } } # [doc = "Calls the contract's `takes_u32_returns_bool` (0x000000000f8219f9) function"] pub fn takes_u32_returns_bool (& self , arg : u32) -> ContractCall < bool > { Contract :: method_hash (& self . fuel_client , & self . compiled , [0 , 0 , 0 , 0 , 15 , 130 , 25 , 249] , & [ParamType :: Bool] , & [arg . into_token () ,]) . expect ("method not found (this should never happen)") } } }test code_gen::abigen::tests::generates_bindings ... ok [INFO] [stderr] error: 'rustfmt' is not installed for the toolchain '1.59.0-x86_64-unknown-linux-gnu' [INFO] [stderr] To install, run `rustup component add rustfmt --toolchain 1.59.0-x86_64-unknown-linux-gnu` [INFO] [stdout] pub use custom_mod :: * ; # [allow (clippy :: too_many_arguments)] mod custom_mod { # ! [allow (clippy :: enum_variant_names)] # ! [allow (dead_code)] # ! [allow (unused_imports)] use fuels_contract :: contract :: { Contract , ContractCall , CompiledContract } ; use fuel_gql_client :: client :: FuelClient ; use fuels_core :: { EnumSelector , ParamType , Tokenizable , Token } ; pub struct custom { compiled : CompiledContract , fuel_client : FuelClient } impl custom { pub fn new (compiled : CompiledContract , fuel_client : FuelClient) -> Self { Self { compiled , fuel_client } } # [doc = "Calls the contract's `takes_struct` (0x0000000087e388fd) function"] pub fn takes_struct (& self , value : MyStruct) -> ContractCall < () > { Contract :: method_hash (& self . fuel_client , & self . compiled , [0 , 0 , 0 , 0 , 135 , 227 , 136 , 253] , & [] , & [value . into_token () ,]) . expect ("method not found (this should never happen)") } } # [derive (Clone , Debug , Default , Eq , PartialEq)] pub struct MyStruct { pub foo : u8 , pub bar : bool } impl MyStruct { pub fn param_types () -> Vec < ParamType > { let mut types = Vec :: new () ; types . push (ParamType :: U8) ; types . push (ParamType :: Bool) ; types } pub fn into_token (self) -> Token { let mut tokens = Vec :: new () ; tokens . push (Token :: U8 (self . foo)) ; tokens . push (Token :: Bool (self . bar)) ; Token :: Struct (tokens) } pub fn new_from_tokens (tokens : & [Token]) -> Self { Self { foo : < u8 > :: from_token (tokens [0usize] . clone ()) . expect ("Failed to run `new_from_tokens()` for custom struct, make sure to pass tokens in the right order and right types") , bar : < bool > :: from_token (tokens [1usize] . clone ()) . expect ("Failed to run `new_from_tokens()` for custom struct, make sure to pass tokens in the right order and right types") } } } impl fuels_core :: Detokenize for MyStruct { fn from_tokens (mut tokens : Vec < Token >) -> Result < Self , fuels_core :: InvalidOutputType > { let token = match tokens . len () { 0 => Token :: Struct (vec ! []) , 1 => tokens . remove (0) , _ => Token :: Struct (tokens) , } ; Ok (MyStruct :: new_from_tokens (& [token])) } } }test code_gen::abigen::tests::custom_struct ... ok [INFO] [stderr] error: 'rustfmt' is not installed for the toolchain '1.59.0-x86_64-unknown-linux-gnu' [INFO] [stderr] To install, run `rustup component add rustfmt --toolchain 1.59.0-x86_64-unknown-linux-gnu` [INFO] [stdout] pub use custom_mod :: * ; # [allow (clippy :: too_many_arguments)] mod custom_mod { # ! [allow (clippy :: enum_variant_names)] # ! [allow (dead_code)] # ! [allow (unused_imports)] use fuels_contract :: contract :: { Contract , ContractCall , CompiledContract } ; use fuel_gql_client :: client :: FuelClient ; use fuels_core :: { EnumSelector , ParamType , Tokenizable , Token } ; pub struct custom { compiled : CompiledContract , fuel_client : FuelClient } impl custom { pub fn new (compiled : CompiledContract , fuel_client : FuelClient) -> Self { Self { compiled , fuel_client } } # [doc = "Calls the contract's `takes_enum` (0x0000000085dab9fc) function"] pub fn takes_enum (& self , my_enum : MyEnum) -> ContractCall < () > { Contract :: method_hash (& self . fuel_client , & self . compiled , [0 , 0 , 0 , 0 , 133 , 218 , 185 , 252] , & [] , & [my_enum . into_token () ,]) . expect ("method not found (this should never happen)") } } # [derive (Clone , Debug , Eq , PartialEq)] pub enum MyEnum { X (u32) , Y (bool) } impl MyEnum { pub fn into_token (self) -> Token { let (dis , tok) = match self { MyEnum :: X (value) => (0usize as u8 , Token :: U32 (value)) , MyEnum :: Y (value) => (1usize as u8 , Token :: Bool (value)) , } ; let selector = (dis , tok) ; Token :: Enum (Box :: new (selector)) } } }test code_gen::abigen::tests::custom_enum ... ok [INFO] [stderr] error: 'rustfmt' is not installed for the toolchain '1.59.0-x86_64-unknown-linux-gnu' [INFO] [stderr] To install, run `rustup component add rustfmt --toolchain 1.59.0-x86_64-unknown-linux-gnu` [INFO] [stderr] error: 'rustfmt' is not installed for the toolchain '1.59.0-x86_64-unknown-linux-gnu' [INFO] [stderr] To install, run `rustup component add rustfmt --toolchain 1.59.0-x86_64-unknown-linux-gnu` [INFO] [stdout] pub use custom_mod :: * ; # [allow (clippy :: too_many_arguments)] mod custom_mod { # ! [allow (clippy :: enum_variant_names)] # ! [allow (dead_code)] # ! [allow (unused_imports)] use fuels_contract :: contract :: { Contract , ContractCall , CompiledContract } ; use fuel_gql_client :: client :: FuelClient ; use fuels_core :: { EnumSelector , ParamType , Tokenizable , Token } ; pub struct custom { compiled : CompiledContract , fuel_client : FuelClient } impl custom { pub fn new (compiled : CompiledContract , fuel_client : FuelClient) -> Self { Self { compiled , fuel_client } } # [doc = "Calls the contract's `takes_nested_struct` (0x0000000074c481ed) function"] pub fn takes_nested_struct (& self , top_value : MyNestedStruct) -> ContractCall < () > { Contract :: method_hash (& self . fuel_client , & self . compiled , [0 , 0 , 0 , 0 , 116 , 196 , 129 , 237] , & [] , & [top_value . into_token () ,]) . expect ("method not found (this should never happen)") } } # [derive (Clone , Debug , Default , Eq , PartialEq)] pub struct MyNestedStruct { pub x : u16 , pub foo : InnerStruct } impl MyNestedStruct { pub fn param_types () -> Vec < ParamType > { let mut types = Vec :: new () ; types . push (ParamType :: U16) ; types . push (ParamType :: Struct (InnerStruct :: param_types ())) ; types } pub fn into_token (self) -> Token { let mut tokens = Vec :: new () ; tokens . push (Token :: U16 (self . x)) ; tokens . push (self . foo . into_token ()) ; Token :: Struct (tokens) } pub fn new_from_tokens (tokens : & [Token]) -> Self { Self { x : < u16 > :: from_token (tokens [0usize] . clone ()) . expect ("Failed to run `new_from_tokens()` for custom struct, make sure to pass tokens in the right order and right types") , foo : InnerStruct :: new_from_tokens (& tokens [1usize ..]) } } } impl fuels_core :: Detokenize for MyNestedStruct { fn from_tokens (mut tokens : Vec < Token >) -> Result < Self , fuels_core :: InvalidOutputType > { let token = match tokens . len () { 0 => Token :: Struct (vec ! []) , 1 => tokens . remove (0) , _ => Token :: Struct (tokens) , } ; Ok (MyNestedStruct :: new_from_tokens (& [token])) } } # [derive (Clone , Debug , Default , Eq , PartialEq)] pub struct InnerStruct { pub a : bool } impl InnerStruct { pub fn param_types () -> Vec < ParamType > { let mut types = Vec :: new () ; types . push (ParamType :: Bool) ; types } pub fn into_token (self) -> Token { let mut tokens = Vec :: new () ; tokens . push (Token :: Bool (self . a)) ; Token :: Struct (tokens) } pub fn new_from_tokens (tokens : & [Token]) -> Self { Self { a : < bool > :: from_token (tokens [0usize] . clone ()) . expect ("Failed to run `new_from_tokens()` for custom struct, make sure to pass tokens in the right order and right types") } } } impl fuels_core :: Detokenize for InnerStruct { fn from_tokens (mut tokens : Vec < Token >) -> Result < Self , fuels_core :: InvalidOutputType > { let token = match tokens . len () { 0 => Token :: Struct (vec ! []) , 1 => tokens . remove (0) , _ => Token :: Struct (tokens) , } ; Ok (InnerStruct :: new_from_tokens (& [token])) } } }test code_gen::abigen::tests::single_nested_struct ... ok [INFO] [stdout] pub use custom_mod :: * ; # [allow (clippy :: too_many_arguments)] mod custom_mod { # ! [allow (clippy :: enum_variant_names)] # ! [allow (dead_code)] # ! [allow (unused_imports)] use fuels_contract :: contract :: { Contract , ContractCall , CompiledContract } ; use fuel_gql_client :: client :: FuelClient ; use fuels_core :: { EnumSelector , ParamType , Tokenizable , Token } ; pub struct custom { compiled : CompiledContract , fuel_client : FuelClient } impl custom { pub fn new (compiled : CompiledContract , fuel_client : FuelClient) -> Self { Self { compiled , fuel_client } } # [doc = "Calls the contract's `takes_enum` (0x00000000fc207d83) function"] pub fn takes_enum (& self , value : MyStruct) -> ContractCall < MyStruct > { Contract :: method_hash (& self . fuel_client , & self . compiled , [0 , 0 , 0 , 0 , 252 , 32 , 125 , 131] , & [ParamType :: Struct (vec ! [ParamType :: String (4) , ParamType :: Array (Box :: new (ParamType :: U8) , 2) , ParamType :: Bool])] , & [value . into_token () ,]) . expect ("method not found (this should never happen)") } } # [derive (Clone , Debug , Default , Eq , PartialEq)] pub struct MyStruct { pub a : String , pub foo : :: std :: vec :: Vec < u8 > , pub bar : bool } impl MyStruct { pub fn param_types () -> Vec < ParamType > { let mut types = Vec :: new () ; types . push (ParamType :: String (4)) ; types . push (ParamType :: Array (Box :: new (ParamType :: U8) , 2)) ; types . push (ParamType :: Bool) ; types } pub fn into_token (self) -> Token { let mut tokens = Vec :: new () ; tokens . push (Token :: String (self . a)) ; tokens . push (Token :: Array (vec ! [self . foo . into_token ()])) ; tokens . push (Token :: Bool (self . bar)) ; Token :: Struct (tokens) } pub fn new_from_tokens (tokens : & [Token]) -> Self { Self { a : < String > :: from_token (tokens [0usize] . clone ()) . expect ("Failed to run `new_from_tokens()` for custom struct, make sure to pass tokens in the right order and right types") , foo : < :: std :: vec :: Vec < u8 > > :: from_token (tokens [1usize] . clone ()) . expect ("Failed to run `new_from_tokens()` for custom struct, make sure to pass tokens in the right order and right types") , bar : < bool > :: from_token (tokens [2usize] . clone ()) . expect ("Failed to run `new_from_tokens()` for custom struct, make sure to pass tokens in the right order and right types") } } } impl fuels_core :: Detokenize for MyStruct { fn from_tokens (mut tokens : Vec < Token >) -> Result < Self , fuels_core :: InvalidOutputType > { let token = match tokens . len () { 0 => Token :: Struct (vec ! []) , 1 => tokens . remove (0) , _ => Token :: Struct (tokens) , } ; Ok (MyStruct :: new_from_tokens (& [token])) } } }test code_gen::abigen::tests::output_types ... ok [INFO] [stdout] [INFO] [stdout] test result: ok. 72 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.82s [INFO] [stdout] [INFO] [stderr] Doc-tests fuels-core [INFO] [stdout] [INFO] [stdout] running 2 tests [INFO] [stdout] test src/json_abi.rs - json_abi::ABIParser::encode_with_function_selector (line 100) ... ok [INFO] [stdout] test src/json_abi.rs - json_abi::ABIParser::encode (line 31) ... ok [INFO] [stdout] [INFO] [stdout] test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.45s [INFO] [stdout] [INFO] running `Command { std: "docker" "inspect" "3fe57607e2311df203c6f4ee0bc60cfbff841f7aa82c6d12190c6ab4de70cb62", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "3fe57607e2311df203c6f4ee0bc60cfbff841f7aa82c6d12190c6ab4de70cb62", kill_on_drop: false }` [INFO] [stdout] 3fe57607e2311df203c6f4ee0bc60cfbff841f7aa82c6d12190c6ab4de70cb62