Skip to content

Commit 8996db6

Browse files
authored
Merge branch 'main' into dependabot/cargo/thiserror-2.0.11
2 parents 9217438 + f7e8218 commit 8996db6

File tree

6 files changed

+60
-39
lines changed

6 files changed

+60
-39
lines changed

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ updates:
33
- package-ecosystem: cargo
44
directory: "/"
55
schedule:
6-
interval: daily
6+
interval: weekly
77
time: "01:17"
88
open-pull-requests-limit: 10

.github/workflows/ci.yml

+33-22
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,8 @@ jobs:
3131
cargo clippy -- -D clippy::all -D warnings -A clippy::manual_range_contains
3232
cargo clippy --tests --benches -- -D clippy::all -D warnings -A clippy::manual_range_contains
3333
34-
cargo-test:
35-
runs-on: ubuntu-latest
36-
steps:
37-
- name: Checkout
38-
uses: actions/checkout@master
39-
40-
- name: Install PocketIC server
41-
uses: dfinity/pocketic@main
42-
with:
43-
pocket-ic-server-version: "7.0.0"
44-
45-
- uses: Swatinem/rust-cache@v2
46-
47-
- name: Install Protoc
48-
uses: arduino/setup-protoc@v3
49-
50-
- name: Cargo test
51-
run: unset CI && cargo test -- --test-threads=2
52-
53-
docker-build:
54-
runs-on: ubuntu-latest
34+
reproducible-build:
35+
runs-on: ubuntu-22.04
5536
steps:
5637
- name: Checkout
5738
uses: actions/checkout@master
@@ -65,12 +46,42 @@ jobs:
6546
with:
6647
name: evm_rpc.wasm.gz
6748
path: evm_rpc.wasm.gz
49+
if-no-files-found: error
6850

6951
- name: Add summary
7052
run: |
7153
hash=`sha256sum evm_rpc.wasm.gz`
7254
echo "SHA-256 :hash: ${hash}" >> $GITHUB_STEP_SUMMARY
7355
56+
cargo-test:
57+
needs: [ reproducible-build ]
58+
runs-on: ubuntu-22.04
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@master
62+
63+
- name: Download Artifacts
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: evm_rpc.wasm.gz
67+
68+
- name: Set EVM_RPC_WASM_PATH for load_wasm
69+
run: |
70+
echo "EVM_RPC_WASM_PATH=$GITHUB_WORKSPACE/evm_rpc.wasm.gz" >> "$GITHUB_ENV"
71+
72+
- name: Install PocketIC server
73+
uses: dfinity/pocketic@main
74+
with:
75+
pocket-ic-server-version: "7.0.0"
76+
77+
- uses: Swatinem/rust-cache@v2
78+
79+
- name: Install Protoc
80+
uses: arduino/setup-protoc@v3
81+
82+
- name: Cargo test
83+
run: cargo test -- --test-threads=2 --nocapture
84+
7485
e2e:
7586
runs-on: ubuntu-latest
7687
steps:
@@ -102,6 +113,6 @@ jobs:
102113

103114
- name: Run local examples with Foundry
104115
run: scripts/examples evm_rpc_local 'Number = 0'
105-
116+
106117
- name: Check formatting
107118
run: cargo fmt --all -- --check

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ proptest = { workspace = true }
5555
rand = "0.8"
5656

5757
[workspace.dependencies]
58-
candid = { version = "0.10.10" }
58+
candid = { version = "0.10.13" }
5959
candid_parser = {version = "0.1.4"}
6060
ethnum = { version = "1.5.0", features = ["serde"] }
6161
futures = "0.3.31"

src/rpc_client/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ impl Providers {
7272
];
7373

7474
const DEFAULT_ETH_SEPOLIA_SERVICES: &'static [EthSepoliaService] = &[
75-
EthSepoliaService::Sepolia,
75+
EthSepoliaService::Ankr,
7676
EthSepoliaService::BlockPi,
7777
EthSepoliaService::PublicNode,
7878
];
7979
const NON_DEFAULT_ETH_SEPOLIA_SERVICES: &'static [EthSepoliaService] =
80-
&[EthSepoliaService::Alchemy, EthSepoliaService::Ankr];
80+
&[EthSepoliaService::Alchemy, EthSepoliaService::Sepolia];
8181

8282
const DEFAULT_L2_MAINNET_SERVICES: &'static [L2MainnetService] = &[
8383
L2MainnetService::Llama,

tests/tests.rs

+19-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ use ic_test_utilities_load_wasm::load_wasm;
2222
use maplit::hashmap;
2323
use mock::{MockOutcall, MockOutcallBuilder};
2424
use pocket_ic::common::rest::{CanisterHttpMethod, MockCanisterHttpResponse, RawMessageId};
25-
use pocket_ic::{management_canister::CanisterSettings, PocketIc, WasmResult};
25+
use pocket_ic::{
26+
management_canister::CanisterSettings, CallError, ErrorCode, PocketIc, UserError, WasmResult,
27+
};
2628
use serde::{de::DeserializeOwned, Deserialize, Serialize};
2729
use serde_json::json;
2830
use std::sync::Arc;
@@ -126,18 +128,26 @@ impl EvmRpcSetup {
126128
}
127129

128130
pub fn upgrade_canister(&self, args: InstallArgs) {
129-
self.env.tick();
130-
// Avoid `CanisterInstallCodeRateLimited` error
131-
self.env.advance_time(Duration::from_secs(600));
132-
self.env.tick();
133-
self.env
134-
.upgrade_canister(
131+
for _ in 0..100 {
132+
self.env.tick();
133+
// Avoid `CanisterInstallCodeRateLimited` error
134+
self.env.advance_time(Duration::from_secs(600));
135+
self.env.tick();
136+
match self.env.upgrade_canister(
135137
self.canister_id,
136138
evm_rpc_wasm(),
137139
Encode!(&args).unwrap(),
138140
Some(self.controller),
139-
)
140-
.expect("Error while upgrading canister");
141+
) {
142+
Ok(_) => return,
143+
Err(CallError::UserError(UserError {
144+
code: ErrorCode::CanisterInstallCodeRateLimited,
145+
description: _,
146+
})) => continue,
147+
Err(e) => panic!("Error while upgrading canister: {e:?}"),
148+
}
149+
}
150+
panic!("Failed to upgrade canister after many trials!")
141151
}
142152

143153
/// Shorthand for deriving an `EvmRpcSetup` with the caller as the canister controller.

0 commit comments

Comments
 (0)