From 08258d3bdeda9f56c21a4406718d45a07d48831a Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Fri, 20 Dec 2024 14:39:52 +0100 Subject: [PATCH 1/9] update pocket IC --- .github/workflows/ci.yml | 2 +- Cargo.lock | 114 ++++++++++++++++++++-------------- Cargo.toml | 2 +- tests/tests.rs | 130 +++++++++++++++++++-------------------- 4 files changed, 136 insertions(+), 112 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a92d400..31dad471 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - name: Install PocketIC server uses: dfinity/pocketic@main with: - pocket-ic-server-version: "6.0.0" + pocket-ic-server-version: "7.0.0" - uses: Swatinem/rust-cache@v2 diff --git a/Cargo.lock b/Cargo.lock index 72d44523..6c966fc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -530,9 +530,9 @@ version = "0.1.0" dependencies = [ "candid", "evm_rpc_types", - "ic-cdk 0.16.0", + "ic-cdk", "ic-cdk-bindgen", - "ic-cdk-macros 0.16.0", + "ic-cdk-macros", "ic-certified-map", "serde", "serde_bytes", @@ -721,8 +721,8 @@ dependencies = [ "getrandom", "hex", "ic-canister-log", - "ic-cdk 0.16.0", - "ic-cdk-macros 0.16.0", + "ic-cdk", + "ic-cdk-macros", "ic-certified-map", "ic-crypto-test-utils-reproducible-rng", "ic-ethereum-types", @@ -756,7 +756,7 @@ version = "1.2.0" dependencies = [ "candid", "hex", - "ic-cdk 0.16.0", + "ic-cdk", "num-bigint", "proptest", "serde", @@ -967,6 +967,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + [[package]] name = "hashbrown" version = "0.14.5" @@ -1110,19 +1116,6 @@ dependencies = [ "serde", ] -[[package]] -name = "ic-cdk" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b1da6a25b045f9da3c9459c0cb2b0700ac368ee16382975a17185a23b9c18ab" -dependencies = [ - "candid", - "ic-cdk-macros 0.13.2", - "ic0 0.21.1", - "serde", - "serde_bytes", -] - [[package]] name = "ic-cdk" version = "0.16.0" @@ -1130,8 +1123,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8ecacd682fa05a985253592963306cb9799622d7b1cce4b1edb89c6ec85be1" dependencies = [ "candid", - "ic-cdk-macros 0.16.0", - "ic0 0.23.0", + "ic-cdk-macros", + "ic0", "serde", "serde_bytes", ] @@ -1147,30 +1140,28 @@ dependencies = [ [[package]] name = "ic-cdk-macros" -version = "0.13.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45800053d80a6df839a71aaea5797e723188c0b992618208ca3b941350c7355" +checksum = "0d4d857135deef20cc7ea8f3869a30cd9cfeb1392b3a81043790b2cd82adc3e0" dependencies = [ "candid", "proc-macro2", "quote", "serde", - "serde_tokenstream 0.1.7", - "syn 1.0.109", + "serde_tokenstream", + "syn 2.0.87", ] [[package]] -name = "ic-cdk-macros" -version = "0.16.0" +name = "ic-certification" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4d857135deef20cc7ea8f3869a30cd9cfeb1392b3a81043790b2cd82adc3e0" +checksum = "e64ee3d8b6e81b51f245716d3e0badb63c283c00f3c9fb5d5219afc30b5bf821" dependencies = [ - "candid", - "proc-macro2", - "quote", + "hex", "serde", - "serde_tokenstream 0.2.2", - "syn 2.0.87", + "serde_bytes", + "sha2", ] [[package]] @@ -1240,10 +1231,21 @@ dependencies = [ ] [[package]] -name = "ic0" -version = "0.21.1" +name = "ic-transport-types" +version = "0.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a54b5297861c651551676e8c43df805dad175cc33bc97dbd992edbbb85dcbcdf" +checksum = "875dc4704780383112e8e8b5063a1b98de114321d0c7d3e7f635dcf360a57fba" +dependencies = [ + "candid", + "hex", + "ic-certification", + "leb128", + "serde", + "serde_bytes", + "serde_repr", + "sha2", + "thiserror", +] [[package]] name = "ic0" @@ -1892,25 +1894,31 @@ dependencies = [ [[package]] name = "pocket-ic" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beff607d4dbebff8d003453ced669d2645e905de496ca93713f3d47633357e6c" +checksum = "124a2380ca6f557adf8b02517cbfd2f564113230e14cda6f6aadd3dfe156293c" dependencies = [ "base64 0.13.1", "candid", "hex", - "ic-cdk 0.13.5", + "ic-certification", + "ic-transport-types", "reqwest", "schemars", "serde", "serde_bytes", + "serde_cbor", "serde_json", "sha2", "slog", + "strum", + "strum_macros", + "thiserror", "tokio", "tracing", "tracing-appender", "tracing-subscriber", + "wslpath", ] [[package]] @@ -2518,6 +2526,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.215" @@ -2553,14 +2571,14 @@ dependencies = [ ] [[package]] -name = "serde_tokenstream" -version = "0.1.7" +name = "serde_repr" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "797ba1d80299b264f3aac68ab5d12e5825a561749db4df7cd7c8083900c5d4e9" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", - "serde", - "syn 1.0.109", + "quote", + "syn 2.0.87", ] [[package]] @@ -2921,9 +2939,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -3491,6 +3509,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "wslpath" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04a2ecdf2cc4d33a6a93d71bcfbc00bb1f635cdb8029a2cc0709204a045ec7a3" + [[package]] name = "wyz" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index 2732e4ea..ac28323d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ ic-crypto-test-utils-reproducible-rng = { git = "https://github.com/dfinity/ic", ic-test-utilities-load-wasm = { git = "https://github.com/dfinity/ic", rev = "release-2024-09-26_01-31-base" } itertools = "0.13" maplit = "1" -pocket-ic = "5.0.0" +pocket-ic = "6.0.0" proptest = { workspace = true } rand = "0.8" diff --git a/tests/tests.rs b/tests/tests.rs index 51e5783f..9d3fcff2 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -22,7 +22,7 @@ use ic_test_utilities_load_wasm::load_wasm; use maplit::hashmap; use mock::{MockOutcall, MockOutcallBuilder}; use pocket_ic::common::rest::{CanisterHttpMethod, MockCanisterHttpResponse, RawMessageId}; -use pocket_ic::{CanisterSettings, PocketIc, WasmResult}; +use pocket_ic::{management_canister::CanisterSettings, PocketIc, WasmResult}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::json; use std::sync::Arc; @@ -42,7 +42,7 @@ const MOCK_REQUEST_RESPONSE: &str = r#"{"id":1,"jsonrpc":"2.0","result":"0x00112 const MOCK_REQUEST_RESPONSE_BYTES: u64 = 1000; const MOCK_API_KEY: &str = "mock-api-key"; -const MOCK_TRANSACTION: &str="0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83"; +const MOCK_TRANSACTION: &str = "0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83"; const MOCK_TRANSACTION_HASH: &str = "0x33469b22e9f636356c4160a87eb19df52b7412e8eac32a4a55ffe88ea8350788"; @@ -614,20 +614,20 @@ fn eth_get_logs_should_succeed() { for source in RPC_SERVICES { let setup = EvmRpcSetup::new().mock_api_keys(); let response = setup - .eth_get_logs( - source.clone(), - None, - evm_rpc_types::GetLogsArgs { - addresses: vec!["0xdAC17F958D2ee523a2206206994597C13D831ec7".parse().unwrap()], - from_block: None, - to_block: None, - topics: None, - }, - ) - .mock_http(MockOutcallBuilder::new(200, r#"{"id":0,"jsonrpc":"2.0","result":[{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000a9d1e08c7793af67e9d92fe308d5697fb81d3e43","0x00000000000000000000000078cccfb3d517cd4ed6d045e263e134712288ace2"],"data":"0x000000000000000000000000000000000000000000000000000000003b9c6433","blockNumber":"0x11dc77e","transactionHash":"0xf3ed91a03ddf964281ac7a24351573efd535b80fc460a5c2ad2b9d23153ec678","transactionIndex":"0x65","blockHash":"0xd5c72ad752b2f0144a878594faf8bd9f570f2f72af8e7f0940d3545a6388f629","logIndex":"0xe8","removed":false}]}"#)) - .wait() - .expect_consistent() - .unwrap(); + .eth_get_logs( + source.clone(), + None, + evm_rpc_types::GetLogsArgs { + addresses: vec!["0xdAC17F958D2ee523a2206206994597C13D831ec7".parse().unwrap()], + from_block: None, + to_block: None, + topics: None, + }, + ) + .mock_http(MockOutcallBuilder::new(200, r#"{"id":0,"jsonrpc":"2.0","result":[{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000a9d1e08c7793af67e9d92fe308d5697fb81d3e43","0x00000000000000000000000078cccfb3d517cd4ed6d045e263e134712288ace2"],"data":"0x000000000000000000000000000000000000000000000000000000003b9c6433","blockNumber":"0x11dc77e","transactionHash":"0xf3ed91a03ddf964281ac7a24351573efd535b80fc460a5c2ad2b9d23153ec678","transactionIndex":"0x65","blockHash":"0xd5c72ad752b2f0144a878594faf8bd9f570f2f72af8e7f0940d3545a6388f629","logIndex":"0xe8","removed":false}]}"#)) + .wait() + .expect_consistent() + .unwrap(); assert_eq!( response, vec![evm_rpc_types::LogEntry { @@ -727,7 +727,7 @@ fn eth_get_block_by_number_pre_london_fork_should_succeed() { base_fee_per_gas: None, difficulty: Some(0x400000000_u64.into()), extra_data: "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa".parse().unwrap(), - gas_limit:0x1388_u32.into(), + gas_limit: 0x1388_u32.into(), gas_used: Nat256::ZERO, hash: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3".parse().unwrap(), logs_bloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse().unwrap(), @@ -775,41 +775,41 @@ fn eth_get_block_by_number_should_be_consistent_when_total_difficulty_inconsiste fn eth_get_transaction_receipt_should_succeed() { let test_cases = [ TestCase { - request: "0xdd5d4b18923d7aae953c7996d791118102e889bea37b48a651157a4890e4746f", - raw_body: r#"{"jsonrpc":"2.0","id":2,"result":{"blockHash":"0x5115c07eb1f20a9d6410db0916ed3df626cfdab161d3904f45c8c8b65c90d0be","blockNumber":"0x11a85ab","contractAddress":null,"cumulativeGasUsed":"0xf02aed","effectiveGasPrice":"0x63c00ee76","from":"0x0aa8ebb6ad5a8e499e550ae2c461197624c6e667","gasUsed":"0x7d89","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0x356cfd6e6d0000400000003900b415f80669009e","transactionHash":"0xdd5d4b18923d7aae953c7996d791118102e889bea37b48a651157a4890e4746f","transactionIndex":"0xd9","type":"0x2"}}"#, - expected: evm_rpc_types::TransactionReceipt { - status: Some(0x1_u8.into()), - transaction_hash: "0xdd5d4b18923d7aae953c7996d791118102e889bea37b48a651157a4890e4746f".parse().unwrap(), - contract_address: None, - block_number: 0x11a85ab_u64.into(), - block_hash: "0x5115c07eb1f20a9d6410db0916ed3df626cfdab161d3904f45c8c8b65c90d0be".parse().unwrap(), - effective_gas_price: 0x63c00ee76_u64.into(), - gas_used: 0x7d89_u32.into(), - from: "0x0aa8ebb6ad5a8e499e550ae2c461197624c6e667".parse().unwrap(), - logs: vec![], - logs_bloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse().unwrap(), - to: Some("0x356cfd6e6d0000400000003900b415f80669009e".parse().unwrap()), - transaction_index: 0xd9_u16.into(), - tx_type: "0x2".parse().unwrap(), + request: "0xdd5d4b18923d7aae953c7996d791118102e889bea37b48a651157a4890e4746f", + raw_body: r#"{"jsonrpc":"2.0","id":2,"result":{"blockHash":"0x5115c07eb1f20a9d6410db0916ed3df626cfdab161d3904f45c8c8b65c90d0be","blockNumber":"0x11a85ab","contractAddress":null,"cumulativeGasUsed":"0xf02aed","effectiveGasPrice":"0x63c00ee76","from":"0x0aa8ebb6ad5a8e499e550ae2c461197624c6e667","gasUsed":"0x7d89","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0x356cfd6e6d0000400000003900b415f80669009e","transactionHash":"0xdd5d4b18923d7aae953c7996d791118102e889bea37b48a651157a4890e4746f","transactionIndex":"0xd9","type":"0x2"}}"#, + expected: evm_rpc_types::TransactionReceipt { + status: Some(0x1_u8.into()), + transaction_hash: "0xdd5d4b18923d7aae953c7996d791118102e889bea37b48a651157a4890e4746f".parse().unwrap(), + contract_address: None, + block_number: 0x11a85ab_u64.into(), + block_hash: "0x5115c07eb1f20a9d6410db0916ed3df626cfdab161d3904f45c8c8b65c90d0be".parse().unwrap(), + effective_gas_price: 0x63c00ee76_u64.into(), + gas_used: 0x7d89_u32.into(), + from: "0x0aa8ebb6ad5a8e499e550ae2c461197624c6e667".parse().unwrap(), + logs: vec![], + logs_bloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse().unwrap(), + to: Some("0x356cfd6e6d0000400000003900b415f80669009e".parse().unwrap()), + transaction_index: 0xd9_u16.into(), + tx_type: "0x2".parse().unwrap(), }, }, TestCase { //first transaction after genesis - request: "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060", - raw_body: r#"{"jsonrpc":"2.0","id":1,"result":{"transactionHash":"0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060","blockHash":"0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd","blockNumber":"0xb443","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","gasUsed":"0x5208","root":"0x96a8e009d2b88b1483e6941e6812e32263b05683fac202abc622a3e31aed1957","contractAddress":null,"cumulativeGasUsed":"0x5208","transactionIndex":"0x0","from":"0xa1e4380a3b1f749673e270229993ee55f35663b4","to":"0x5df9b87991262f6ba471f09758cde1c0fc1de734","type":"0x0","effectiveGasPrice":"0x2d79883d2000","logs":[]}}"#, - expected: evm_rpc_types::TransactionReceipt { - status: None, - transaction_hash: "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060".parse().unwrap(), - contract_address: None, - block_number: 0xb443_u64.into(), - block_hash: "0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd".parse().unwrap(), - effective_gas_price: 0x2d79883d2000_u64.into(), - gas_used: 0x5208_u32.into(), - from: "0xa1e4380a3b1f749673e270229993ee55f35663b4".parse().unwrap(), - logs: vec![], - logs_bloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse().unwrap(), - to: Some("0x5df9b87991262f6ba471f09758cde1c0fc1de734".parse().unwrap()), - transaction_index: 0x0_u16.into(), - tx_type: "0x0".parse().unwrap(), + request: "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060", + raw_body: r#"{"jsonrpc":"2.0","id":1,"result":{"transactionHash":"0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060","blockHash":"0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd","blockNumber":"0xb443","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","gasUsed":"0x5208","root":"0x96a8e009d2b88b1483e6941e6812e32263b05683fac202abc622a3e31aed1957","contractAddress":null,"cumulativeGasUsed":"0x5208","transactionIndex":"0x0","from":"0xa1e4380a3b1f749673e270229993ee55f35663b4","to":"0x5df9b87991262f6ba471f09758cde1c0fc1de734","type":"0x0","effectiveGasPrice":"0x2d79883d2000","logs":[]}}"#, + expected: evm_rpc_types::TransactionReceipt { + status: None, + transaction_hash: "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060".parse().unwrap(), + contract_address: None, + block_number: 0xb443_u64.into(), + block_hash: "0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd".parse().unwrap(), + effective_gas_price: 0x2d79883d2000_u64.into(), + gas_used: 0x5208_u32.into(), + from: "0xa1e4380a3b1f749673e270229993ee55f35663b4".parse().unwrap(), + logs: vec![], + logs_bloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse().unwrap(), + to: Some("0x5df9b87991262f6ba471f09758cde1c0fc1de734".parse().unwrap()), + transaction_index: 0x0_u16.into(), + tx_type: "0x0".parse().unwrap(), }, }, TestCase { //contract creation @@ -879,22 +879,22 @@ fn eth_fee_history_should_succeed() { for source in RPC_SERVICES { let setup = EvmRpcSetup::new().mock_api_keys(); let response = setup - .eth_fee_history( - source.clone(), - None, - evm_rpc_types::FeeHistoryArgs { - block_count: 3_u8.into(), - newest_block: evm_rpc_types::BlockTag::Latest, - reward_percentiles: None, - }, - ) - .mock_http(MockOutcallBuilder::new( - 200, - r#"{"id":0,"jsonrpc":"2.0","result":{"oldestBlock":"0x11e57f5","baseFeePerGas":["0x9cf6c61b9","0x97d853982","0x9ba55a0b0","0x9543bf98d"],"reward":[["0x0123"]]}}"#, - )) - .wait() - .expect_consistent() - .unwrap(); + .eth_fee_history( + source.clone(), + None, + evm_rpc_types::FeeHistoryArgs { + block_count: 3_u8.into(), + newest_block: evm_rpc_types::BlockTag::Latest, + reward_percentiles: None, + }, + ) + .mock_http(MockOutcallBuilder::new( + 200, + r#"{"id":0,"jsonrpc":"2.0","result":{"oldestBlock":"0x11e57f5","baseFeePerGas":["0x9cf6c61b9","0x97d853982","0x9ba55a0b0","0x9543bf98d"],"reward":[["0x0123"]]}}"#, + )) + .wait() + .expect_consistent() + .unwrap(); assert_eq!( response, Some(evm_rpc_types::FeeHistory { From 09eb143067e5b3b90ba6b931e727cb2724ef8f91 Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Fri, 20 Dec 2024 14:43:02 +0100 Subject: [PATCH 2/9] update ic-cdk --- Cargo.lock | 8 ++++---- Cargo.toml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c966fc6..5bb09497 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1118,9 +1118,9 @@ dependencies = [ [[package]] name = "ic-cdk" -version = "0.16.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8ecacd682fa05a985253592963306cb9799622d7b1cce4b1edb89c6ec85be1" +checksum = "122efbcb0af5280d408a75a57b7dc6e9d92893bf6ed9cc98fe4dcff51f18b67c" dependencies = [ "candid", "ic-cdk-macros", @@ -1140,9 +1140,9 @@ dependencies = [ [[package]] name = "ic-cdk-macros" -version = "0.16.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4d857135deef20cc7ea8f3869a30cd9cfeb1392b3a81043790b2cd82adc3e0" +checksum = "c792bf0d1621c893ccf2bcdeac4ee70121103a03030a1827031a6b3c60488944" dependencies = [ "candid", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index ac28323d..dd0d66c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,9 +66,9 @@ futures = "0.3.31" getrandom = { version = "0.2", features = ["custom"] } hex = "0.4.3" ic-canister-log = "0.2.0" -ic-cdk = "0.16.0" +ic-cdk = "0.17.1" ic-cdk-bindgen = "0.1" -ic-cdk-macros = "0.16.0" +ic-cdk-macros = "0.17.1" ic-certified-map = "0.4" ic-metrics-encoder = "1.1" ic-stable-structures = "0.6.7" From f350bd58084caf799d89d3ba1c2f55492c7e58f7 Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Fri, 20 Dec 2024 14:44:36 +0100 Subject: [PATCH 3/9] update thiserror --- Cargo.lock | 48 ++++++++++++++++++++++++++++++++++-------------- Cargo.toml | 2 +- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5bb09497..c6321673 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -254,7 +254,7 @@ dependencies = [ "serde", "serde_bytes", "stacker", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -285,7 +285,7 @@ dependencies = [ "logos", "num-bigint", "pretty", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -636,7 +636,7 @@ dependencies = [ "serde", "serde_json", "sha3", - "thiserror", + "thiserror 1.0.69", "uint", ] @@ -693,7 +693,7 @@ dependencies = [ "serde_json", "strum", "tempfile", - "thiserror", + "thiserror 1.0.69", "tiny-keccak", "unicode-xid", ] @@ -761,7 +761,7 @@ dependencies = [ "proptest", "serde", "strum", - "thiserror", + "thiserror 2.0.8", "url", ] @@ -1244,7 +1244,7 @@ dependencies = [ "serde_bytes", "serde_repr", "sha2", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1264,7 +1264,7 @@ dependencies = [ "data-encoding", "serde", "sha2", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1913,7 +1913,7 @@ dependencies = [ "slog", "strum", "strum_macros", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "tracing-appender", @@ -2033,7 +2033,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", ] @@ -2050,7 +2050,7 @@ dependencies = [ "rustc-hash", "rustls", "slab", - "thiserror", + "thiserror 1.0.69", "tinyvec", "tracing", ] @@ -2139,7 +2139,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2852,7 +2852,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f5383f3e0071702bf93ab5ee99b52d26936be9dedd9413067cbdcddcb6141a" +dependencies = [ + "thiserror-impl 2.0.8", ] [[package]] @@ -2866,6 +2875,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "thiserror-impl" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f357fcec90b3caef6623a099691be676d033b40a058ac95d2a6ade6fa0c943" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "thousands" version = "0.2.0" @@ -2985,7 +3005,7 @@ checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f" dependencies = [ "either", "futures-util", - "thiserror", + "thiserror 1.0.69", "tokio", ] @@ -3043,7 +3063,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" dependencies = [ "crossbeam-channel", - "thiserror", + "thiserror 1.0.69", "time", "tracing-subscriber", ] diff --git a/Cargo.toml b/Cargo.toml index dd0d66c3..f716cac9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,7 +80,7 @@ serde = "1.0" serde_json = "1.0" serde_bytes = "0.11.15" strum = { version = "0.26", features = ["derive"] } -thiserror = "1.0.69" +thiserror = "2.0.8" url = "2.5" [workspace] From f090acd17805acc55bc0351188da4181b6803db8 Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Fri, 20 Dec 2024 15:20:39 +0100 Subject: [PATCH 4/9] remove unused dependencies --- Cargo.lock | 15 --------------- Cargo.toml | 5 ----- 2 files changed, 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c6321673..03b9413e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -723,7 +723,6 @@ dependencies = [ "ic-canister-log", "ic-cdk", "ic-cdk-macros", - "ic-certified-map", "ic-crypto-test-utils-reproducible-rng", "ic-ethereum-types", "ic-metrics-encoder", @@ -733,10 +732,7 @@ dependencies = [ "itertools 0.13.0", "maplit", "minicbor 0.25.1", - "minicbor-derive 0.15.3", "num", - "num-bigint", - "num-derive", "num-traits", "pocket-ic", "proptest", @@ -1659,17 +1655,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "num-integer" version = "0.1.46" diff --git a/Cargo.toml b/Cargo.toml index f716cac9..5f366ea9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,14 +29,10 @@ ic-stable-structures = { workspace = true } ic-canister-log = { workspace = true } ic-cdk = { workspace = true } ic-cdk-macros = { workspace = true } -ic-certified-map = { workspace = true } maplit = "1.0" minicbor = { workspace = true } -minicbor-derive = { workspace = true } num = "0.4" -num-bigint = { workspace = true } num-traits = "0.2" -num-derive = "0.4" serde = { workspace = true } serde_bytes = { workspace = true } serde_json = { workspace = true } @@ -73,7 +69,6 @@ ic-certified-map = "0.4" ic-metrics-encoder = "1.1" ic-stable-structures = "0.6.7" minicbor = { version = "0.25.1", features = ["alloc", "derive"] } -minicbor-derive = "0.15.3" num-bigint = "0.4.6" proptest = "1.5.0" serde = "1.0" From ff53d78b1608b8d65bcb023182136f6507acba52 Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Fri, 20 Dec 2024 15:39:18 +0100 Subject: [PATCH 5/9] increase pocket IC request timeout --- tests/tests.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/tests.rs b/tests/tests.rs index 9d3fcff2..4e1c9014 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -22,7 +22,7 @@ use ic_test_utilities_load_wasm::load_wasm; use maplit::hashmap; use mock::{MockOutcall, MockOutcallBuilder}; use pocket_ic::common::rest::{CanisterHttpMethod, MockCanisterHttpResponse, RawMessageId}; -use pocket_ic::{management_canister::CanisterSettings, PocketIc, WasmResult}; +use pocket_ic::{management_canister::CanisterSettings, PocketIc, PocketIcBuilder, WasmResult}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::json; use std::sync::Arc; @@ -98,7 +98,12 @@ impl EvmRpcSetup { } pub fn with_args(args: InstallArgs) -> Self { - let env = Arc::new(PocketIc::new()); + let env = Arc::new( + PocketIcBuilder::new() + .with_application_subnet() + .with_max_request_time_ms(Some(1_000_000)) + .build(), + ); let controller = DEFAULT_CONTROLLER_TEST_ID; let canister_id = env.create_canister_with_settings( From 5d9f73a4490d58ce52d19b4da20752ba2edf82ef Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Wed, 8 Jan 2025 15:09:05 +0100 Subject: [PATCH 6/9] limit parallelism --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31dad471..d1454894 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: uses: arduino/setup-protoc@v3 - name: Cargo test - run: unset CI && cargo test + run: unset CI && cargo test -- --test-threads=1 docker-build: runs-on: ubuntu-latest From 4edf1251d9ff179163c7dc1e571a87df6a72b16a Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Wed, 8 Jan 2025 15:26:05 +0100 Subject: [PATCH 7/9] update itertools --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 03b9413e..b7f7b4d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -729,7 +729,7 @@ dependencies = [ "ic-sha3", "ic-stable-structures", "ic-test-utilities-load-wasm", - "itertools 0.13.0", + "itertools 0.14.0", "maplit", "minicbor 0.25.1", "num", @@ -1338,9 +1338,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] diff --git a/Cargo.toml b/Cargo.toml index 5f366ea9..5cb1d18f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,7 @@ assert_matches = "1.5" candid_parser = { workspace = true } ic-crypto-test-utils-reproducible-rng = { git = "https://github.com/dfinity/ic", rev = "release-2024-09-26_01-31-base" } ic-test-utilities-load-wasm = { git = "https://github.com/dfinity/ic", rev = "release-2024-09-26_01-31-base" } -itertools = "0.13" +itertools = "0.14.0" maplit = "1" pocket-ic = "6.0.0" proptest = { workspace = true } From 2234a17b3d598c9a8f81463b1161b907319aaf82 Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Wed, 8 Jan 2025 16:19:12 +0100 Subject: [PATCH 8/9] undo custom max_request_time_ms in Pocket IC --- tests/tests.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/tests.rs b/tests/tests.rs index 4e1c9014..9d3fcff2 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -22,7 +22,7 @@ use ic_test_utilities_load_wasm::load_wasm; use maplit::hashmap; use mock::{MockOutcall, MockOutcallBuilder}; use pocket_ic::common::rest::{CanisterHttpMethod, MockCanisterHttpResponse, RawMessageId}; -use pocket_ic::{management_canister::CanisterSettings, PocketIc, PocketIcBuilder, WasmResult}; +use pocket_ic::{management_canister::CanisterSettings, PocketIc, WasmResult}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::json; use std::sync::Arc; @@ -98,12 +98,7 @@ impl EvmRpcSetup { } pub fn with_args(args: InstallArgs) -> Self { - let env = Arc::new( - PocketIcBuilder::new() - .with_application_subnet() - .with_max_request_time_ms(Some(1_000_000)) - .build(), - ); + let env = Arc::new(PocketIc::new()); let controller = DEFAULT_CONTROLLER_TEST_ID; let canister_id = env.create_canister_with_settings( From 641c760eee7446fa04e23a329c43f0281e64c41f Mon Sep 17 00:00:00 2001 From: gregorydemay Date: Thu, 9 Jan 2025 11:02:58 +0100 Subject: [PATCH 9/9] limit test threads to 2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1454894..a0bada21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: uses: arduino/setup-protoc@v3 - name: Cargo test - run: unset CI && cargo test -- --test-threads=1 + run: unset CI && cargo test -- --test-threads=2 docker-build: runs-on: ubuntu-latest