Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/cargo/serde-1.0.217
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorydemay authored Jan 31, 2025
2 parents e5db672 + 66c27da commit 1447539
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
interval: weekly
time: "01:17"
open-pull-requests-limit: 10
55 changes: 33 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,8 @@ jobs:
cargo clippy -- -D clippy::all -D warnings -A clippy::manual_range_contains
cargo clippy --tests --benches -- -D clippy::all -D warnings -A clippy::manual_range_contains
cargo-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: Install PocketIC server
uses: dfinity/pocketic@main
with:
pocket-ic-server-version: "7.0.0"

- uses: Swatinem/rust-cache@v2

- name: Install Protoc
uses: arduino/setup-protoc@v3

- name: Cargo test
run: unset CI && cargo test -- --test-threads=2

docker-build:
runs-on: ubuntu-latest
reproducible-build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@master
Expand All @@ -65,12 +46,42 @@ jobs:
with:
name: evm_rpc.wasm.gz
path: evm_rpc.wasm.gz
if-no-files-found: error

- name: Add summary
run: |
hash=`sha256sum evm_rpc.wasm.gz`
echo "SHA-256 :hash: ${hash}" >> $GITHUB_STEP_SUMMARY
cargo-test:
needs: [ reproducible-build ]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@master

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: evm_rpc.wasm.gz

- name: Set EVM_RPC_WASM_PATH for load_wasm
run: |
echo "EVM_RPC_WASM_PATH=$GITHUB_WORKSPACE/evm_rpc.wasm.gz" >> "$GITHUB_ENV"
- name: Install PocketIC server
uses: dfinity/pocketic@main
with:
pocket-ic-server-version: "7.0.0"

- uses: Swatinem/rust-cache@v2

- name: Install Protoc
uses: arduino/setup-protoc@v3

- name: Cargo test
run: cargo test -- --test-threads=2 --nocapture

e2e:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -102,6 +113,6 @@ jobs:

- name: Run local examples with Foundry
run: scripts/examples evm_rpc_local 'Number = 0'

- name: Check formatting
run: cargo fmt --all -- --check
42 changes: 25 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ proptest = { workspace = true }
rand = "0.8"

[workspace.dependencies]
candid = { version = "0.10.12" }
candid = { version = "0.10.13" }
candid_parser = {version = "0.1.4"}
ethnum = { version = "1.5.0", features = ["serde"] }
futures = "0.3.31"
Expand All @@ -70,7 +70,7 @@ ic-metrics-encoder = "1.1"
ic-stable-structures = "0.6.7"
minicbor = { version = "0.25.1", features = ["alloc", "derive"] }
num-bigint = "0.4.6"
proptest = "1.5.0"
proptest = "1.6.0"
serde = "1.0"
serde_json = "1.0"
serde_bytes = "0.11.15"
Expand Down
4 changes: 2 additions & 2 deletions src/rpc_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ impl Providers {
];

const DEFAULT_ETH_SEPOLIA_SERVICES: &'static [EthSepoliaService] = &[
EthSepoliaService::Sepolia,
EthSepoliaService::Ankr,
EthSepoliaService::BlockPi,
EthSepoliaService::PublicNode,
];
const NON_DEFAULT_ETH_SEPOLIA_SERVICES: &'static [EthSepoliaService] =
&[EthSepoliaService::Alchemy, EthSepoliaService::Ankr];
&[EthSepoliaService::Alchemy, EthSepoliaService::Sepolia];

const DEFAULT_L2_MAINNET_SERVICES: &'static [L2MainnetService] = &[
L2MainnetService::Llama,
Expand Down
28 changes: 19 additions & 9 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ 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, CallError, ErrorCode, PocketIc, UserError, WasmResult,
};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde_json::json;
use std::sync::Arc;
Expand Down Expand Up @@ -126,18 +128,26 @@ impl EvmRpcSetup {
}

pub fn upgrade_canister(&self, args: InstallArgs) {
self.env.tick();
// Avoid `CanisterInstallCodeRateLimited` error
self.env.advance_time(Duration::from_secs(600));
self.env.tick();
self.env
.upgrade_canister(
for _ in 0..100 {
self.env.tick();
// Avoid `CanisterInstallCodeRateLimited` error
self.env.advance_time(Duration::from_secs(600));
self.env.tick();
match self.env.upgrade_canister(
self.canister_id,
evm_rpc_wasm(),
Encode!(&args).unwrap(),
Some(self.controller),
)
.expect("Error while upgrading canister");
) {
Ok(_) => return,
Err(CallError::UserError(UserError {
code: ErrorCode::CanisterInstallCodeRateLimited,
description: _,
})) => continue,
Err(e) => panic!("Error while upgrading canister: {e:?}"),
}
}
panic!("Failed to upgrade canister after many trials!")
}

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

0 comments on commit 1447539

Please sign in to comment.