diff --git a/contracts/src/DeployScript.sol b/contracts/src/DeployScript.sol index 7cdb29abdb..2ed5c078de 100644 --- a/contracts/src/DeployScript.sol +++ b/contracts/src/DeployScript.sol @@ -9,6 +9,7 @@ import {BeefyClient} from "./BeefyClient.sol"; import {IGateway} from "./interfaces/IGateway.sol"; import {GatewayProxy} from "./GatewayProxy.sol"; import {Gateway} from "./Gateway.sol"; +import {GatewayUpgradeMock} from "../test/mocks/GatewayUpgradeMock.sol"; import {Agent} from "./Agent.sol"; import {AgentExecutor} from "./AgentExecutor.sol"; import {ParaID, Config} from "./Types.sol"; @@ -79,6 +80,8 @@ contract DeployScript is Script { payable(bridgeHubAgent).safeNativeTransfer(initialDeposit); payable(assetHubAgent).safeNativeTransfer(initialDeposit); + new GatewayUpgradeMock(); + vm.stopBroadcast(); } } diff --git a/contracts/src/Gateway.sol b/contracts/src/Gateway.sol index 315e3c0797..35d6dfd59d 100644 --- a/contracts/src/Gateway.sol +++ b/contracts/src/Gateway.sol @@ -118,7 +118,7 @@ contract Gateway is IGateway, IInitializable { } // Increment nonce for origin. - // This also prevents the re-entrancy case in which a malicous party tries to re-enter by calling `submitInbound` + // This also prevents the re-entrancy case in which a malicious party tries to re-enter by calling `submitInbound` // again with the same (message, leafProof, headerProof) arguments. channel.inboundNonce++; diff --git a/contracts/test/mocks/GatewayUpgradeMock.sol b/contracts/test/mocks/GatewayUpgradeMock.sol new file mode 100644 index 0000000000..fd7fe44d85 --- /dev/null +++ b/contracts/test/mocks/GatewayUpgradeMock.sol @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2023 Snowfork +pragma solidity 0.8.20; + +import {Channel, InboundMessage, OperatingMode, ParaID, Config, Command} from "../../src/Types.sol"; +import {IGateway} from "../../src/interfaces/IGateway.sol"; +import {IInitializable} from "../../src/interfaces/IInitializable.sol"; +import {Verification} from "../../src/Verification.sol"; + +contract GatewayUpgradeMock is IGateway, IInitializable { + /** + * Getters + */ + + function operatingMode() external pure returns (OperatingMode) { + return OperatingMode.Normal; + } + + function channelOperatingModeOf(ParaID) external pure returns (OperatingMode) { + return OperatingMode.Normal; + } + + function channelFeeRewardOf(ParaID) external pure returns (uint256, uint256) { + return (0, 0); + } + + function channelNoncesOf(ParaID) external pure returns (uint64, uint64) { + return (0, 0); + } + + function agentOf(bytes32) external pure returns (address) { + return address(0); + } + + function implementation() external pure returns (address) { + return address(0); + } + + function submitInbound(InboundMessage calldata, bytes32[] calldata, Verification.Proof calldata) external {} + + function registerToken(address) external payable {} + function sendToken(address, ParaID, bytes32, uint128) external payable {} + function sendToken(address, ParaID, address, uint128) external payable {} + + event Initialized(uint256 d0, uint256 d1); + + function initialize(bytes memory data) external { + // Just decode and exit + (uint256 d0, uint256 d1) = abi.decode(data, (uint256, uint256)); + emit Initialized(d0, d1); + } +} diff --git a/cumulus b/cumulus index bc52d555c3..5f9f6cd8eb 160000 --- a/cumulus +++ b/cumulus @@ -1 +1 @@ -Subproject commit bc52d555c36d2470a3237eab173bdd49c7d68aa2 +Subproject commit 5f9f6cd8eb6d779d8b713dd7f931a9521e93b132 diff --git a/parachain/pallets/control/src/tests.rs b/parachain/pallets/control/src/tests.rs index 07368c70ed..3f8791fd55 100644 --- a/parachain/pallets/control/src/tests.rs +++ b/parachain/pallets/control/src/tests.rs @@ -171,3 +171,74 @@ fn create_agent_with_sibling_chain_account20_origin_yields_success() { })); }); } + +#[test] +fn create_agent_without_root_yields_bad_origin() { + new_test_ext().execute_with(|| { + let origin = RuntimeOrigin::signed(AccountId32::new([0; 32])); + let address: H160 = Default::default(); + let code_hash: H256 = Default::default(); + let params: Option> = None; + + frame_support::assert_noop!( + EthereumControl::upgrade(origin, address, code_hash, params), + BadOrigin + ); + }); +} + +#[test] +fn create_agent_with_root_yields_success() { + new_test_ext().execute_with(|| { + let origin = RuntimeOrigin::root(); + let address: H160 = Default::default(); + let code_hash: H256 = Default::default(); + let params: Option> = None; + let expected_hash = None; + + frame_support::assert_ok!(EthereumControl::upgrade(origin, address, code_hash, params)); + + System::assert_last_event(RuntimeEvent::EthereumControl(crate::Event::Upgrade { + impl_address: address, + impl_code_hash: code_hash, + params_hash: expected_hash, + })); + }); +} + +#[test] +fn create_agent_with_large_params_yields_upgrade_too_large() { + new_test_ext().execute_with(|| { + const MAX_SIZE: usize = MaxUpgradeDataSize::get() as usize; + let origin = RuntimeOrigin::root(); + let address: H160 = Default::default(); + let code_hash: H256 = Default::default(); + let params: Option> = Some([0; MAX_SIZE].into()); + + frame_support::assert_noop!( + EthereumControl::upgrade(origin, address, code_hash, params), + Error::::UpgradeDataTooLarge + ); + }); +} + +#[test] +fn create_agent_with_small_params_yields_success() { + new_test_ext().execute_with(|| { + const MAX_SIZE_LESS_ONE: usize = (MaxUpgradeDataSize::get() - 1) as usize; + let origin = RuntimeOrigin::root(); + let address: H160 = Default::default(); + let code_hash: H256 = Default::default(); + let params: Option> = Some([0; MAX_SIZE_LESS_ONE].into()); + let expected_hash = + Some(H256(hex!("c95ef6b0bf891c06e1318f07b86977998674a0ae996999915c1f5d93359e72a9"))); + + frame_support::assert_ok!(EthereumControl::upgrade(origin, address, code_hash, params)); + + System::assert_last_event(RuntimeEvent::EthereumControl(crate::Event::Upgrade { + impl_address: address, + impl_code_hash: code_hash, + params_hash: expected_hash, + })); + }); +} diff --git a/parachain/pallets/control/src/weights.rs b/parachain/pallets/control/src/weights.rs index fe7dccb91b..10c8f37555 100644 --- a/parachain/pallets/control/src/weights.rs +++ b/parachain/pallets/control/src/weights.rs @@ -42,24 +42,34 @@ pub trait WeightInfo { /// Weights for pallet_template using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { - fn upgrade(_data_size: u32) -> Weight { - Weight::from_parts(9_000_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + fn upgrade(data_size: u32) -> Weight { + Weight::from_parts(30_740_411, 0) + .saturating_add(Weight::from_parts(0, 3517)) + .saturating_add(Weight::from_parts(8_805, 0).saturating_mul(data_size.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) } fn create_agent() -> Weight { - Weight::from_parts(9_000_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + Weight::from_parts(35_000_000, 0) + .saturating_add(Weight::from_parts(0, 3517)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) } } // For backwards compatibility and tests impl WeightInfo for () { - fn upgrade(_data_size: u32) -> Weight { - Weight::from_parts(9_000_000, 0) - .saturating_add(RocksDbWeight::get().writes(1_u64)) + fn upgrade(data_size: u32) -> Weight { + Weight::from_parts(30_740_411, 0) + .saturating_add(Weight::from_parts(0, 3517)) + .saturating_add(Weight::from_parts(8_805, 0).saturating_mul(data_size.into())) + .saturating_add(RocksDbWeight::get().reads(4)) + .saturating_add(RocksDbWeight::get().writes(3)) } fn create_agent() -> Weight { - Weight::from_parts(9_000_000, 0) - .saturating_add(RocksDbWeight::get().writes(1_u64)) + Weight::from_parts(35_000_000, 0) + .saturating_add(Weight::from_parts(0, 3517)) + .saturating_add(RocksDbWeight::get().reads(5)) + .saturating_add(RocksDbWeight::get().writes(4)) } } diff --git a/parachain/pallets/inbound-queue/src/benchmarking/mod.rs b/parachain/pallets/inbound-queue/src/benchmarking/mod.rs index 5c6396948b..a051a3b533 100644 --- a/parachain/pallets/inbound-queue/src/benchmarking/mod.rs +++ b/parachain/pallets/inbound-queue/src/benchmarking/mod.rs @@ -39,7 +39,7 @@ mod benchmarks { // Make sure the sovereign balance is enough. This is a funny number, because // in some cases the minimum balance is really high, in other cases very low. - // e.g. on bridgehub the minium balance is 33333, on test it is 1. So this equation makes + // e.g. on bridgehub the minimum balance is 33333, on test it is 1. So this equation makes // it is at least twice the minimum balance (so as to satisfy the minimum balance // requirement, and then some (in case the minimum balance is very low, even lower // than the relayer reward fee). diff --git a/smoketest/.gitignore b/smoketest/.gitignore index 1fe0613e23..b012d04b95 100644 --- a/smoketest/.gitignore +++ b/smoketest/.gitignore @@ -16,4 +16,6 @@ .local src/parachains/bridgehub.rs +src/parachains/assethub.rs +src/parachains/relaychain.rs src/contracts diff --git a/smoketest/Cargo.lock b/smoketest/Cargo.lock index 1b2f6e3e14..9f8449a233 100644 --- a/smoketest/Cargo.lock +++ b/smoketest/Cargo.lock @@ -72,9 +72,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -109,6 +109,15 @@ version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" +[[package]] +name = "array-init" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23589ecb866b460d3a0f1278834750268c607e8e28a1b982c907219f3178cd72" +dependencies = [ + "nodrop", +] + [[package]] name = "arrayref" version = "0.3.7" @@ -127,15 +136,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - [[package]] name = "async-lock" version = "2.7.0" @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a8c1df849285fbacd587de7818cc7d13be6cd2cbcd47a04fb1801b0e2706e33" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" dependencies = [ "proc-macro-error", "proc-macro2", @@ -254,21 +254,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitflags" version = "1.3.2" @@ -430,9 +415,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.15.3" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07" +checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" dependencies = [ "camino", "cargo-platform", @@ -507,21 +492,19 @@ dependencies = [ [[package]] name = "coins-bip39" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb68f3b6c3fee83828ecd8d463f360a397c32aaeb35bd931c01e5ddf5631c69" +checksum = "84f4d04ee18e58356accd644896aeb2094ddeafb6a713e056cef0c0a8e468c15" dependencies = [ "bitvec 0.17.4", "coins-bip32", "getrandom 0.2.8", - "hex", "hmac 0.12.1", "once_cell", "pbkdf2 0.12.1", "rand 0.8.5", "sha2 0.10.6", "thiserror", - "tracing", ] [[package]] @@ -556,15 +539,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "core-foundation" version = "0.9.3" @@ -626,49 +600,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" -dependencies = [ - "cfg-if", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" -dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "memoffset 0.8.0", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" -dependencies = [ - "cfg-if", -] - [[package]] name = "crunchy" version = "0.2.2" @@ -831,11 +762,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + [[package]] name = "der" -version = "0.7.1" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc906908ea6458456e5eaa160a9c08543ec3d1e6f71e2235cedd660cb65f9df0" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ "const-oid", "zeroize", @@ -863,12 +800,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.8.1" @@ -898,27 +829,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "downcast-rs" version = "1.2.0" @@ -1013,9 +923,9 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.13.2" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea5a92946e8614bb585254898bb7dd1ddad241ace60c52149e3765e34cc039d" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct", "crypto-bigint", @@ -1030,15 +940,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ena" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" -dependencies = [ - "log", -] - [[package]] name = "encoding_rs" version = "0.8.32" @@ -1050,11 +951,11 @@ dependencies = [ [[package]] name = "enr" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb4d5fbf6f56acecd38f5988eb2e4ae412008a2a30268c748c701ec6322f39d4" +checksum = "0be7b2ac146c1f99fe245c02d16af0696450d8e06c135db75e10eeb9e642c20d" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", "bytes", "hex", "k256", @@ -1062,6 +963,7 @@ dependencies = [ "rand 0.8.5", "rlp", "serde", + "serde-hex", "sha3", "zeroize", ] @@ -1176,8 +1078,8 @@ dependencies = [ [[package]] name = "ethers" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -1186,13 +1088,12 @@ dependencies = [ "ethers-middleware", "ethers-providers", "ethers-signers", - "ethers-solc", ] [[package]] name = "ethers-addressbook" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "ethers-core", "once_cell", @@ -1202,13 +1103,14 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "ethers-contract-abigen", "ethers-contract-derive", "ethers-core", "ethers-providers", + "ethers-signers", "futures-util", "hex", "once_cell", @@ -1220,69 +1122,63 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "Inflector", "dunce", "ethers-core", - "ethers-etherscan", "eyre", - "getrandom 0.2.8", "hex", "prettyplease", "proc-macro2", "quote", "regex", - "reqwest", "serde", "serde_json", - "syn 1.0.109", - "tokio", + "syn 2.0.16", "toml", - "url", "walkdir", ] [[package]] name = "ethers-contract-derive" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ + "Inflector", "ethers-contract-abigen", "ethers-core", "hex", "proc-macro2", "quote", - "syn 1.0.109", + "serde_json", + "syn 2.0.16", ] [[package]] name = "ethers-core" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "arrayvec 0.7.2", "bytes", "cargo_metadata", "chrono", - "convert_case", "elliptic-curve", "ethabi", "generic-array 0.14.7", - "getrandom 0.2.8", "hex", "k256", "num_enum", "once_cell", "open-fastrlp", - "proc-macro2", "rand 0.8.5", "rlp", "serde", "serde_json", "strum", - "syn 1.0.109", + "syn 2.0.16", "tempfile", "thiserror", "tiny-keccak", @@ -1291,12 +1187,10 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "ethers-core", - "ethers-solc", - "getrandom 0.2.8", "reqwest", "semver", "serde", @@ -1307,8 +1201,8 @@ dependencies = [ [[package]] name = "ethers-middleware" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "async-trait", "auto_impl", @@ -1333,8 +1227,8 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "async-trait", "auto_impl", @@ -1342,10 +1236,10 @@ dependencies = [ "bytes", "enr", "ethers-core", + "futures-channel", "futures-core", "futures-timer", "futures-util", - "getrandom 0.2.8", "hashers", "hex", "http", @@ -1357,6 +1251,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", + "tokio-tungstenite", "tracing", "tracing-futures", "url", @@ -1368,8 +1263,8 @@ dependencies = [ [[package]] name = "ethers-signers" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" +version = "2.0.8" +source = "git+https://github.com/gakonst/ethers-rs#594627dc1c3b490ba8f513f8f5e23d11448cbcf8" dependencies = [ "async-trait", "coins-bip32", @@ -1384,36 +1279,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "ethers-solc" -version = "2.0.2" -source = "git+https://github.com/gakonst/ethers-rs#e26f42ae3fbf8f5ab611b38ad05d25c3efa16173" -dependencies = [ - "cfg-if", - "dunce", - "ethers-core", - "getrandom 0.2.8", - "glob", - "hex", - "home", - "md-5", - "num_cpus", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver", - "serde", - "serde_json", - "solang-parser", - "thiserror", - "tiny-keccak", - "tokio", - "tracing", - "walkdir", - "yansi", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -1473,12 +1338,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "fnv" version = "1.0.7" @@ -1529,9 +1388,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -1539,9 +1398,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" @@ -1557,9 +1416,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-locks" @@ -1573,26 +1432,26 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.16", ] [[package]] name = "futures-sink" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-timer" @@ -1606,9 +1465,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", @@ -1691,12 +1550,6 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "gloo-timers" version = "0.2.6" @@ -1857,15 +1710,6 @@ dependencies = [ "hmac 0.8.1", ] -[[package]] -name = "home" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" -dependencies = [ - "winapi", -] - [[package]] name = "http" version = "0.2.9" @@ -2079,27 +1923,6 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" -[[package]] -name = "is-terminal" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix 0.37.4", - "windows-sys 0.45.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.6" @@ -2206,9 +2029,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955890845095ccf31ef83ad41a05aabb4d8cc23dc3cac5a9f5c89cf26dd0da75" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", "ecdsa", @@ -2227,38 +2050,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "lalrpop" -version = "0.19.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34313ec00c2eb5c3c87ca6732ea02dcf3af99c3ff7a8fb622ffb99c9d860a87" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools", - "lalrpop-util", - "petgraph", - "pico-args", - "regex", - "regex-syntax", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.19.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c1f7869c94d214466c5fd432dfed12c379fd87786768d36455892d46b18edd" -dependencies = [ - "regex", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -2380,17 +2171,14 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] -name = "md-5" -version = "0.10.5" +name = "maybe-uninit" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" -dependencies = [ - "digest 0.10.6", -] +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" @@ -2416,15 +2204,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" -dependencies = [ - "autocfg", -] - [[package]] name = "memory-db" version = "0.31.0" @@ -2481,10 +2260,10 @@ dependencies = [ ] [[package]] -name = "new_debug_unreachable" -version = "1.0.4" +name = "nodrop" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "nohash-hasher" @@ -2556,23 +2335,23 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.11" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.11" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.16", ] [[package]] @@ -2697,7 +2476,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall 0.2.16", - "smallvec", + "smallvec 1.10.0", "windows-sys 0.45.0", ] @@ -2707,12 +2486,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" -[[package]] -name = "path-slash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" - [[package]] name = "pbkdf2" version = "0.8.0" @@ -2747,16 +2520,6 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" -[[package]] -name = "petgraph" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" -dependencies = [ - "fixedbitset", - "indexmap", -] - [[package]] name = "pharos" version = "0.5.3" @@ -2767,81 +2530,24 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "phf" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" -dependencies = [ - "phf_macros", - "phf_shared 0.11.1", -] - -[[package]] -name = "phf_generator" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" -dependencies = [ - "phf_shared 0.11.1", - "rand 0.8.5", -] - -[[package]] -name = "phf_macros" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92aacdc5f16768709a569e913f7451034034178b05bdc8acda226659a3dccc66" -dependencies = [ - "phf_generator", - "phf_shared 0.11.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pico-args" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" - [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.16", ] [[package]] @@ -2858,9 +2564,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d2820d87d2b008616e5c27212dd9e0e694fb4c6b522de06094106813328cb49" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", @@ -2872,20 +2578,14 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "prettyplease" -version = "0.1.25" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282" dependencies = [ "proc-macro2", - "syn 1.0.109", + "syn 2.0.16", ] [[package]] @@ -2938,9 +2638,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -3046,28 +2746,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rayon" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -3086,17 +2764,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.8", - "redox_syscall 0.2.16", - "thiserror", -] - [[package]] name = "ref-cast" version = "1.0.16" @@ -3119,13 +2786,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-automata 0.3.4", + "regex-syntax 0.7.4", ] [[package]] @@ -3134,7 +2802,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", ] [[package]] @@ -3143,11 +2822,17 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "regex-syntax" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + [[package]] name = "reqwest" -version = "0.11.16" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ "base64 0.21.0", "bytes", @@ -3583,6 +3268,17 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-hex" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca37e3e4d1b39afd7ff11ee4e947efae85adfddf4841787bfa47c470e96dc26d" +dependencies = [ + "array-init", + "serde", + "smallvec 0.6.14", +] + [[package]] name = "serde_derive" version = "1.0.159" @@ -3639,6 +3335,17 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + [[package]] name = "sha2" version = "0.8.2" @@ -3710,12 +3417,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "siphasher" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" - [[package]] name = "slab" version = "0.4.8" @@ -3725,6 +3426,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + [[package]] name = "smallvec" version = "1.10.0" @@ -3740,6 +3450,7 @@ dependencies = [ "hex", "hex-literal", "parity-scale-codec", + "sp-core 16.0.0", "subxt", "tokio", "xcm", @@ -3770,19 +3481,6 @@ dependencies = [ "sha-1", ] -[[package]] -name = "solang-parser" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff87dae6cdccacdbf3b19e99b271083556e808de0f59c74a01482f64fdbc61fc" -dependencies = [ - "itertools", - "lalrpop", - "lalrpop-util", - "phf", - "unicode-xid", -] - [[package]] name = "sp-application-crypto" version = "17.0.0" @@ -4137,7 +3835,7 @@ dependencies = [ "parity-scale-codec", "parking_lot", "rand 0.8.5", - "smallvec", + "smallvec 1.10.0", "sp-core 16.0.0", "sp-externalities 0.17.0", "sp-panic-handler", @@ -4271,7 +3969,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "smallvec", + "smallvec 1.10.0", "sp-arithmetic 6.0.0", "sp-core 7.0.0", "sp-debug-derive 5.0.0", @@ -4287,7 +3985,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "smallvec", + "smallvec 1.10.0", "sp-arithmetic 12.0.0", "sp-core 16.0.0", "sp-debug-derive 6.0.0", @@ -4302,9 +4000,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spki" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0445c905640145c7ea8c1993555957f65e7c46d0535b91ba501bc9bfc85522f" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", @@ -4337,19 +4035,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", -] - [[package]] name = "strsim" version = "0.10.0" @@ -4358,24 +4043,24 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "6069ca09d878a33f883cc06aaa9718ede171841d3832450354410b718b097232" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.16", ] [[package]] @@ -4518,17 +4203,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - [[package]] name = "termcolor" version = "1.2.0" @@ -4650,6 +4324,18 @@ dependencies = [ "webpki", ] +[[package]] +name = "tokio-tungstenite" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec509ac96e9a0c43427c74f003127d953a265737636129424288d27cb5c4b12c" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite", +] + [[package]] name = "tokio-util" version = "0.7.7" @@ -4783,7 +4469,7 @@ dependencies = [ "serde", "serde_json", "sharded-slab", - "smallvec", + "smallvec 1.10.0", "thread_local", "tracing", "tracing-core", @@ -4801,7 +4487,7 @@ dependencies = [ "hashbrown 0.12.3", "log", "rustc-hex", - "smallvec", + "smallvec 1.10.0", ] [[package]] @@ -4819,6 +4505,25 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "tungstenite" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15fba1a6d6bb030745759a9a2a588bfe8490fc8b4751a277db3a0be1c9ebbf67" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.8.5", + "sha1", + "thiserror", + "url", + "utf-8", +] + [[package]] name = "twox-hash" version = "1.6.3" @@ -4827,7 +4532,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", "digest 0.10.6", - "rand 0.8.5", + "rand 0.7.3", "static_assertions", ] @@ -4870,12 +4575,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - [[package]] name = "unicode-width" version = "0.1.10" @@ -4905,6 +4604,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "uuid" version = "0.8.2" @@ -5284,7 +4989,7 @@ dependencies = [ "log", "mach", "memfd", - "memoffset 0.6.5", + "memoffset", "paste", "rand 0.8.5", "rustix 0.36.11", @@ -5308,7 +5013,7 @@ dependencies = [ "log", "mach", "memfd", - "memoffset 0.6.5", + "memoffset", "paste", "rand 0.8.5", "rustix 0.36.11", @@ -5631,12 +5336,6 @@ dependencies = [ "syn 2.0.16", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "yap" version = "0.7.2" diff --git a/smoketest/Cargo.toml b/smoketest/Cargo.toml index bb66d368a7..6dbef4e26b 100644 --- a/smoketest/Cargo.toml +++ b/smoketest/Cargo.toml @@ -12,9 +12,9 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = hex = "0.4.3" hex-literal = "0.4.1" subxt = { git = "https://github.com/paritytech/subxt.git", tag = "v0.27.1" } -ethers = { git = "https://github.com/gakonst/ethers-rs", default-features = false, features = ["abigen"] } - +ethers = { git = "https://github.com/gakonst/ethers-rs", default-features = false, features = ["abigen", "ws"] } [dev-dependencies] xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42" } +sp-core = "16.0.0" hex-literal = "0.4.1" diff --git a/smoketest/README.md b/smoketest/README.md index c813152242..1c6b868fca 100644 --- a/smoketest/README.md +++ b/smoketest/README.md @@ -29,3 +29,12 @@ Send an ethereum transaction to send tokens ``` cargo test --test send_token -- --nocapture ``` + +Send an upgrade transaction via the relaychain. +Tests that the upgrade path works in terms of message routing and abi encoding. +This operation will brick the bridge as it upgrades the gateway to a mock gateway which has no implementation. +Please restart the testnet after running the test. + +``` +cargo test --test upgrade_gateway -- --nocapture +``` \ No newline at end of file diff --git a/smoketest/make-bindings.sh b/smoketest/make-bindings.sh index fec64f99cb..a2391cc779 100755 --- a/smoketest/make-bindings.sh +++ b/smoketest/make-bindings.sh @@ -15,11 +15,14 @@ command -v subxt || cargo install subxt-cli \ --tag $subxt_version \ --root $cargo_dir + # Fetch metadata from BridgeHub and generate client subxt codegen --url ws://localhost:11144 | rustfmt --edition 2021 --emit=stdout > src/parachains/bridgehub.rs +subxt codegen --url ws://localhost:12144 | rustfmt --edition 2021 --emit=stdout > src/parachains/assethub.rs +subxt codegen --url ws://localhost:9944 | rustfmt --edition 2021 --emit=stdout > src/parachains/relaychain.rs # Generate Rust bindings for contracts forge bind --module --overwrite \ - --select 'IGateway|WETH9' \ + --select 'IGateway|WETH9|GatewayUpgradeMock' \ --bindings-path src/contracts \ --root ../contracts diff --git a/smoketest/src/parachains/mod.rs b/smoketest/src/parachains/mod.rs index 47f069a638..0f42f30990 100644 --- a/smoketest/src/parachains/mod.rs +++ b/smoketest/src/parachains/mod.rs @@ -1,2 +1,3 @@ -// TODO: implement smoke tests for Polkadot -> Ethereum -// pub mod bridgehub; +pub mod bridgehub; +pub mod assethub; +pub mod relaychain; diff --git a/smoketest/tests/upgrade_gateway.rs b/smoketest/tests/upgrade_gateway.rs new file mode 100644 index 0000000000..8a05d46d8a --- /dev/null +++ b/smoketest/tests/upgrade_gateway.rs @@ -0,0 +1,219 @@ +use std::{sync::Arc, time::Duration}; + +use ethers::{ + abi::Token, + prelude::*, + providers::{Provider, Ws}, + types::Address, +}; +use futures::StreamExt; +use hex_literal::hex; +use snowbridge_smoketest::{ + contracts::{ + gateway_upgrade_mock::{self, InitializedFilter}, + i_gateway::{self, UpgradedFilter}, + }, + parachains::{ + bridgehub::{self, api::ethereum_control}, + relaychain, + relaychain::api::runtime_types::{ + pallet_xcm::pallet::Call, + rococo_runtime::RuntimeCall, + sp_weights::weight_v2::Weight, + xcm::{ + double_encoded::DoubleEncoded, + v2::OriginKind, + v3::{ + junction::Junction, junctions::Junctions, multilocation::MultiLocation, + Instruction, WeightLimit, Xcm, + }, + VersionedMultiLocation, VersionedXcm, + }, + }, + }, +}; +use sp_core::{blake2_256, sr25519::Pair, Pair as PairT}; +use subxt::{ + tx::{PairSigner, TxPayload}, + OnlineClient, PolkadotConfig, +}; + +const ETHEREUM_API: &str = "ws://localhost:8546"; +const RELAY_CHAIN_WS_URL: &str = "ws://127.0.0.1:9944"; +const BRIDGE_HUB_WS_URL: &str = "ws://127.0.0.1:11144"; +const BRIDGE_HUB_PARA_ID: u32 = 1013; + +const GATEWAY_PROXY_CONTRACT: &str = "0xEDa338E4dC46038493b885327842fD3E301CaB39"; +const GATETWAY_UPGRADE_MOCK_CONTRACT: [u8; 20] = hex!("f8f7758fbcefd546eaeff7de24aff666b6228e73"); +const GATETWAY_UPGRADE_MOCK_CODE_HASH: [u8; 32] = + hex!("c8168aa7d2c90c399ac40b4f069bae8189ad263c8d6a9b1fc681fc05d31c8425"); + +#[tokio::test] +async fn upgrade_gateway() { + let ethereum_provider = Provider::::connect(ETHEREUM_API) + .await + .unwrap() + .interval(Duration::from_millis(10u64)); + + let ethereum_client = Arc::new(ethereum_provider); + + let gateway_addr = GATEWAY_PROXY_CONTRACT.parse::
().unwrap(); + let gateway = i_gateway::IGateway::new(gateway_addr, ethereum_client.clone()); + + let mock_gateway_addr: Address = GATETWAY_UPGRADE_MOCK_CONTRACT.into(); + let mock_gateway = + gateway_upgrade_mock::GatewayUpgradeMock::new(mock_gateway_addr, ethereum_client.clone()); + + let relaychain: OnlineClient = + OnlineClient::from_url(RELAY_CHAIN_WS_URL).await.unwrap(); + let bridgehub: OnlineClient = + OnlineClient::from_url(BRIDGE_HUB_WS_URL).await.unwrap(); + + let sudo: Pair = Pair::from_string("//Alice", None).expect("cannot create sudo keypair"); + + let signer: PairSigner = PairSigner::new(sudo); + + let ethereum_control_api = bridgehub::api::ethereum_control::calls::TransactionApi; + + let d_0 = 99; + let d_1 = 66; + let params = ethers::abi::encode(&[Token::Uint(d_0.into()), Token::Uint(d_1.into())]); + let params_hash = blake2_256(¶ms); + + // The upgrade call + let upgrade_call = ethereum_control_api + .upgrade( + GATETWAY_UPGRADE_MOCK_CONTRACT.into(), + GATETWAY_UPGRADE_MOCK_CODE_HASH.into(), + Some(params), + ) + .encode_call_data(&bridgehub.metadata()) + .expect("encoded call"); + + let weight = 3000000000; + let proof_size = 18000; + + let dest = Box::new(VersionedMultiLocation::V3(MultiLocation { + parents: 0, + interior: Junctions::X1(Junction::Parachain(BRIDGE_HUB_PARA_ID)), + })); + let message = Box::new(VersionedXcm::V3(Xcm(vec![ + Instruction::UnpaidExecution { + weight_limit: WeightLimit::Limited(Weight { + ref_time: weight, + proof_size: proof_size, + }), + check_origin: None, + }, + Instruction::Transact { + origin_kind: OriginKind::Superuser, + require_weight_at_most: Weight { + ref_time: weight, + proof_size: proof_size, + }, + call: DoubleEncoded { + encoded: upgrade_call, + }, + }, + ]))); + + let sudo_api = relaychain::api::sudo::calls::TransactionApi; + let sudo_call = sudo_api.sudo(RuntimeCall::XcmPallet(Call::send { dest, message })); + + let result = relaychain + .tx() + .sign_and_submit_then_watch_default(&sudo_call, &signer) + .await + .expect("send through sudo call.") + .wait_for_finalized_success() + .await + .expect("sudo call success"); + + println!( + "Sudo call issued at relaychain block hash {:?}", + result.block_hash() + ); + + let wait_for_blocks = 4; + let mut blocks = bridgehub + .blocks() + .subscribe_finalized() + .await + .expect("block subscription") + .take(wait_for_blocks); + + let mut upgrade_event_found = false; + while let Some(Ok(block)) = blocks.next().await { + println!( + "Polling bridgehub block {} for upgrade event.", + block.number() + ); + let upgrades = block.events().await.expect("read block events"); + for upgrade in upgrades.find::() { + let upgrade = upgrade.expect("expect upgrade"); + assert_eq!(upgrade.impl_address, GATETWAY_UPGRADE_MOCK_CONTRACT.into()); + assert_eq!( + upgrade.impl_code_hash, + GATETWAY_UPGRADE_MOCK_CODE_HASH.into() + ); + assert_eq!(upgrade.params_hash, Some(params_hash.into())); + println!("Event found at bridgehub block {}.", block.number()); + upgrade_event_found = true; + } + if upgrade_event_found { + break; + } + } + assert!(upgrade_event_found); + + let wait_for_blocks = 30; + let mut stream = ethereum_client + .subscribe_blocks() + .await + .unwrap() + .take(wait_for_blocks); + + let mut upgrade_event_found = false; + let mut initialize_event_found = false; + while let Some(block) = stream.next().await { + println!( + "Polling ethereum block {:?} for upgraded event", + block.number.unwrap() + ); + if let Ok(upgrades) = gateway + .event::() + .at_block_hash(block.hash.unwrap()) + .query() + .await + { + for upgrade in upgrades { + println!("Upgrade event found at ethereum block {:?}", block.number.unwrap()); + assert_eq!( + upgrade.implementation, + GATETWAY_UPGRADE_MOCK_CONTRACT.into() + ); + upgrade_event_found = true; + } + if upgrade_event_found { + if let Ok(initializes) = mock_gateway + .event::() + .at_block_hash(block.hash.unwrap()) + .query() + .await + { + for initialize in initializes { + println!("Initialize event found at ethereum block {:?}", block.number.unwrap()); + assert_eq!(initialize.d_0, d_0.into()); + assert_eq!(initialize.d_1, d_1.into()); + initialize_event_found = true; + } + } + } + } + if upgrade_event_found { + break; + } + } + assert!(upgrade_event_found); + assert!(initialize_event_found); +}