From 1ae86d4cb0ce2abdc91ee22798e9c89f6cd8762c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFs?= Date: Fri, 30 Aug 2024 13:26:59 +0200 Subject: [PATCH 01/11] update frontier pin --- Cargo.lock | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 424652aae4..de20d61101 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3389,7 +3389,7 @@ dependencies = [ [[package]] name = "fc-api" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "async-trait", "fp-storage", @@ -3401,7 +3401,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "async-trait", "fp-consensus", @@ -3417,7 +3417,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "async-trait", "ethereum", @@ -3447,7 +3447,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "fc-db", "fc-storage", @@ -3470,7 +3470,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "ethereum", "ethereum-types", @@ -3524,7 +3524,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "ethereum", "ethereum-types", @@ -3539,7 +3539,7 @@ dependencies = [ [[package]] name = "fc-storage" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "ethereum", "ethereum-types", @@ -3733,7 +3733,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "hex", "impl-serde 0.4.0", @@ -3751,7 +3751,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "ethereum", "parity-scale-codec", @@ -3762,7 +3762,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "ethereum", "ethereum-types", @@ -3774,7 +3774,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "evm", "frame-support", @@ -3789,7 +3789,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "ethereum", "ethereum-types", @@ -3805,7 +3805,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "frame-support", "parity-scale-codec", @@ -3817,7 +3817,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "parity-scale-codec", "serde", @@ -8732,7 +8732,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "environmental", "ethereum", @@ -8788,7 +8788,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "environmental", "evm", @@ -8813,7 +8813,7 @@ dependencies = [ [[package]] name = "pallet-evm-chain-id" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "frame-support", "frame-system", @@ -8908,7 +8908,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "fp-evm", ] @@ -8916,7 +8916,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "fp-evm", "sp-core", @@ -9048,7 +9048,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "fp-evm", "frame-support", @@ -9125,7 +9125,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "fp-evm", "num", @@ -9371,7 +9371,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "fp-evm", "tiny-keccak", @@ -9380,7 +9380,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "fp-evm", "ripemd", @@ -9390,7 +9390,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-storage-cleaner" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "fp-evm", "frame-support", @@ -12151,7 +12151,7 @@ dependencies = [ [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "derive_more", "environmental", @@ -12180,7 +12180,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#45d16ae4c8b32e26fdab8353b704fd59ea0ddb8c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" dependencies = [ "case", "num_enum 0.7.2", From 4215ec90062039bbb83c61b4eea1445c220a0849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFs?= Date: Fri, 30 Aug 2024 13:27:09 +0200 Subject: [PATCH 02/11] add RPC method moon_getFrontierSyncBlockRange --- client/rpc/finality/src/lib.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/client/rpc/finality/src/lib.rs b/client/rpc/finality/src/lib.rs index 988d8d316c..843a050eed 100644 --- a/client/rpc/finality/src/lib.rs +++ b/client/rpc/finality/src/lib.rs @@ -37,9 +37,9 @@ pub trait MoonbeamFinalityApi { #[method(name = "moon_isTxFinalized")] async fn is_tx_finalized(&self, tx_hash: H256) -> RpcResult; - /// Gets the latest block hash that is fully indexed in frontier's backend. - #[method(name = "moon_getLatestBlockHash")] - async fn get_latest_block_hash(&self) -> RpcResult; + /// Gets the range of blocks that are fully indexed in frontier's backend. + #[method(name = "moon_getFrontierSyncBlockRange")] + async fn get_frontier_sync_block_range(&self) -> RpcResult<(H256, H256)>; } pub struct MoonbeamFinality { @@ -88,11 +88,18 @@ where } } - async fn get_latest_block_hash(&self) -> RpcResult { - let res = self.backend.deref().latest_block_hash().await; - match res { - Ok(val) => Ok(val), - Err(e) => Err(ErrorObject::owned( + async fn get_frontier_sync_block_range(&self) -> RpcResult<(H256, H256)> { + match ( + self.backend.deref().first_block_hash().await, + self.backend.deref().latest_block_hash().await, + ) { + (Ok(first), Ok(last)) => Ok((first, last)), + (Err(e), _) => Err(ErrorObject::owned( + jsonrpsee::types::error::UNKNOWN_ERROR_CODE, + "No synced block", + Some(e), + )), + (_, Err(e)) => Err(ErrorObject::owned( jsonrpsee::types::error::UNKNOWN_ERROR_CODE, "No synced block", Some(e), From 93de9e5dda18577de25313fdb9e9bdd71de8747b Mon Sep 17 00:00:00 2001 From: Andrea Giacobino Date: Wed, 4 Sep 2024 15:53:24 +0200 Subject: [PATCH 03/11] Use Eth instead of Frontier in method name --- client/rpc/finality/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/rpc/finality/src/lib.rs b/client/rpc/finality/src/lib.rs index 843a050eed..32ad0ca012 100644 --- a/client/rpc/finality/src/lib.rs +++ b/client/rpc/finality/src/lib.rs @@ -38,7 +38,7 @@ pub trait MoonbeamFinalityApi { async fn is_tx_finalized(&self, tx_hash: H256) -> RpcResult; /// Gets the range of blocks that are fully indexed in frontier's backend. - #[method(name = "moon_getFrontierSyncBlockRange")] + #[method(name = "moon_getEthSyncBlockRange")] async fn get_frontier_sync_block_range(&self) -> RpcResult<(H256, H256)>; } From a3aefc54a454fa7ed4581771d0a4e0842299bcc2 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Mon, 9 Sep 2024 14:24:56 +0100 Subject: [PATCH 04/11] update frontier pin --- Cargo.lock | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3e9e2e0e72..1fb64c7fbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3389,7 +3389,7 @@ dependencies = [ [[package]] name = "fc-api" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "async-trait", "fp-storage", @@ -3401,7 +3401,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "async-trait", "fp-consensus", @@ -3417,7 +3417,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "async-trait", "ethereum", @@ -3447,7 +3447,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "fc-db", "fc-storage", @@ -3470,7 +3470,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "ethereum", "ethereum-types", @@ -3524,7 +3524,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "ethereum", "ethereum-types", @@ -3539,7 +3539,7 @@ dependencies = [ [[package]] name = "fc-storage" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "ethereum", "ethereum-types", @@ -3733,7 +3733,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "hex", "impl-serde 0.4.0", @@ -3751,7 +3751,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "ethereum", "parity-scale-codec", @@ -3762,7 +3762,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "ethereum", "ethereum-types", @@ -3774,7 +3774,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "evm", "frame-support", @@ -3789,7 +3789,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "ethereum", "ethereum-types", @@ -3805,7 +3805,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "frame-support", "parity-scale-codec", @@ -3817,7 +3817,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "parity-scale-codec", "serde", @@ -8740,7 +8740,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "environmental", "ethereum", @@ -8796,7 +8796,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "environmental", "evm", @@ -8821,7 +8821,7 @@ dependencies = [ [[package]] name = "pallet-evm-chain-id" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "frame-support", "frame-system", @@ -8916,7 +8916,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "fp-evm", ] @@ -8924,7 +8924,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "fp-evm", "sp-core", @@ -9056,7 +9056,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "fp-evm", "frame-support", @@ -9133,7 +9133,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "fp-evm", "num", @@ -9379,7 +9379,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "fp-evm", "tiny-keccak", @@ -9388,7 +9388,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "fp-evm", "ripemd", @@ -9398,7 +9398,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-storage-cleaner" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "fp-evm", "frame-support", @@ -12159,7 +12159,7 @@ dependencies = [ [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "derive_more", "environmental", @@ -12188,7 +12188,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#0f88ab0c41048e7e2b2a4a8ea89bc73b6ff565c6" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" dependencies = [ "case", "num_enum 0.7.2", From 7bc935db23ddffa68f27c61f557d857d829e6f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFs?= Date: Thu, 5 Sep 2024 11:31:44 +0200 Subject: [PATCH 05/11] fix rust tests --- precompiles/proxy/src/tests.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/precompiles/proxy/src/tests.rs b/precompiles/proxy/src/tests.rs index 8597a7ac3d..031be2c5e2 100644 --- a/precompiles/proxy/src/tests.rs +++ b/precompiles/proxy/src/tests.rs @@ -579,6 +579,13 @@ fn fails_if_called_by_smart_contract() { .execute_with(|| { // Set code to Alice address as it if was a smart contract. pallet_evm::AccountCodes::::insert(H160::from(Alice), vec![10u8]); + pallet_evm::AccountCodesMetadata::::insert( + H160::from(Alice), + pallet_evm::CodeMetadata { + size: 10, + hash: H256::default(), + }, + ); PrecompilesValue::get() .prepare_test( @@ -777,7 +784,21 @@ fn proxy_proxy_should_fail_if_called_by_smart_contract_for_a_non_eoa_account() { .execute_with(|| { // Set code to Alice & Bob addresses as if they are smart contracts. pallet_evm::AccountCodes::::insert(H160::from(Alice), vec![10u8]); + pallet_evm::AccountCodesMetadata::::insert( + H160::from(Alice), + pallet_evm::CodeMetadata { + size: 10, + hash: H256::default(), + }, + ); pallet_evm::AccountCodes::::insert(H160::from(Bob), vec![10u8]); + pallet_evm::AccountCodesMetadata::::insert( + H160::from(Bob), + pallet_evm::CodeMetadata { + size: 10, + hash: H256::default(), + }, + ); // Bob allows Alice to make calls on his behalf assert_ok!(RuntimeCall::Proxy(ProxyCall::add_proxy { From c3d0b1d68c010751f781b75d66b8cd1448a99179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFs?= Date: Thu, 5 Sep 2024 14:30:43 +0200 Subject: [PATCH 06/11] fix rust tests --- precompiles/xcm-utils/src/tests.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/precompiles/xcm-utils/src/tests.rs b/precompiles/xcm-utils/src/tests.rs index 861078690d..01e211101c 100644 --- a/precompiles/xcm-utils/src/tests.rs +++ b/precompiles/xcm-utils/src/tests.rs @@ -244,6 +244,13 @@ fn execute_fails_if_called_by_smart_contract() { .execute_with(|| { // Set code to Alice address as it if was a smart contract. pallet_evm::AccountCodes::::insert(H160::from(Alice), vec![10u8]); + pallet_evm::AccountCodesMetadata::::insert( + H160::from(Alice), + pallet_evm::CodeMetadata { + size: 10, + hash: sp_core::H256::default(), + }, + ); let xcm_to_execute = VersionedXcm::<()>::V4(Xcm(vec![ClearOrigin])).encode(); From a459ffc7bbd454e0e6037b90d7ce264102bbef18 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Mon, 9 Sep 2024 16:44:08 +0100 Subject: [PATCH 07/11] tests: add codeMetadata key --- test/helpers/assets.ts | 21 +++++++++++++++++++-- test/helpers/contracts.ts | 20 +++++++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/test/helpers/assets.ts b/test/helpers/assets.ts index c4b47f6a7b..942d885f4e 100644 --- a/test/helpers/assets.ts +++ b/test/helpers/assets.ts @@ -4,9 +4,13 @@ import { BN, hexToU8a, u8aToHex } from "@polkadot/util"; import { expect, DevModeContext } from "@moonwall/cli"; import { blake2AsU8a, xxhashAsU8a } from "@polkadot/util-crypto"; import { KeyringPair } from "@polkadot/keyring/types"; -import type { PalletAssetsAssetAccount, PalletAssetsAssetDetails } from "@polkadot/types/lookup"; +import type { + PalletAssetsAssetAccount, + PalletAssetsAssetDetails, + PalletEvmCodeMetadata, +} from "@polkadot/types/lookup"; import type { AccountId20 } from "@polkadot/types/interfaces/runtime"; -import { encodeFunctionData, parseAbi } from "viem"; +import { encodeFunctionData, keccak256, parseAbi } from "viem"; export const EVM_FOREIGN_ASSETS_PALLET_ACCOUNT = "0x6d6f646c666f7267617373740000000000000000"; export const ARBITRARY_ASSET_ID = 42259045809535163221576417993425387648n; @@ -237,6 +241,18 @@ export async function mockOldAssetBalance( const assetKey = xxhashAsU8a(new TextEncoder().encode("Asset"), 128); const overallAssetKey = new Uint8Array([...module, ...assetKey, ...blake2concatAssetId]); const evmCodeAssetKey = api.query.evm.accountCodes.key("0xFfFFfFff" + assetId.toHex().slice(2)); + const evmCodesMetadataAssetKey = api.query.evm.accountCodesMetadata.key( + "0xFfFFfFff" + assetId.toHex().slice(2) + ); + + const codeSize = DUMMY_REVERT_BYTECODE.slice(2).length / 2; + const codeMetadataHash = keccak256(DUMMY_REVERT_BYTECODE); + const mockPalletEvmCodeMetadata: PalletEvmCodeMetadata = context + .polkadotJs() + .createType("PalletEvmCodeMetadata", { + size: codeSize, + hash: codeMetadataHash, + }); await context.createBlock( api.tx.sudo @@ -250,6 +266,7 @@ export async function mockOldAssetBalance( .toString(16) .padStart(2)}${DUMMY_REVERT_BYTECODE.slice(2)}`, ], + [evmCodesMetadataAssetKey, u8aToHex(mockPalletEvmCodeMetadata.toU8a())], ]) ) .signAsync(sudoAccount) diff --git a/test/helpers/contracts.ts b/test/helpers/contracts.ts index dac654068a..afb9b36cbc 100644 --- a/test/helpers/contracts.ts +++ b/test/helpers/contracts.ts @@ -1,5 +1,8 @@ import { DevModeContext } from "@moonwall/cli"; import { ALITH_ADDRESS, alith } from "@moonwall/util"; +import { PalletEvmCodeMetadata } from "@polkadot/types/lookup"; +import { u8aToHex } from "@polkadot/util"; +import { keccak256 } from "viem"; export interface HeavyContract { deployed: boolean; @@ -22,6 +25,7 @@ export const deployHeavyContracts = async (context: DevModeContext, first = 6000 deployed: false, account, key: context.polkadotJs().query.evm.accountCodes.key(account), + codesMetadataKey: context.polkadotJs().query.evm.accountCodesMetadata.key(account), }; }) ); @@ -38,13 +42,27 @@ export const deployHeavyContracts = async (context: DevModeContext, first = 6000 .polkadotJs() .registry.createType("Compact", `0x${BigInt((evmCode.length + 1) * 2).toString(16)}`) .toHex(true)}${evmCode}`; + const codeSize = evmCode.length / 2; + const codeMetadataHash = keccak256(("0x" + evmCode) as `0x${string}`); + const mockPalletEvmCodeMetadata: PalletEvmCodeMetadata = context + .polkadotJs() + .createType("PalletEvmCodeMetadata", { + size: codeSize, + hash: codeMetadataHash, + }); // Create the batchs of contracts to deploy const batchs = contracts .reduce( (acc, value) => { if (acc[acc.length - 1].length >= 30) acc.push([]); - if (!value.deployed) acc[acc.length - 1].push([value.key, storageData]); + if (!value.deployed) { + acc[acc.length - 1].push([value.key, storageData]); + acc[acc.length - 1].push([ + value.codesMetadataKey, + u8aToHex(mockPalletEvmCodeMetadata.toU8a()), + ]); + } return acc; }, [[]] as [string, string][][] From 941a41430e1bf3e8ad0652f3af4af22150e9b803 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Mon, 9 Sep 2024 22:32:36 +0100 Subject: [PATCH 08/11] update frontier pin --- Cargo.lock | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1fb64c7fbf..9b0317ed94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3389,7 +3389,7 @@ dependencies = [ [[package]] name = "fc-api" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "async-trait", "fp-storage", @@ -3401,7 +3401,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "async-trait", "fp-consensus", @@ -3417,7 +3417,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "async-trait", "ethereum", @@ -3447,7 +3447,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "fc-db", "fc-storage", @@ -3470,7 +3470,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "ethereum", "ethereum-types", @@ -3524,7 +3524,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "ethereum", "ethereum-types", @@ -3539,7 +3539,7 @@ dependencies = [ [[package]] name = "fc-storage" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "ethereum", "ethereum-types", @@ -3733,7 +3733,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "hex", "impl-serde 0.4.0", @@ -3751,7 +3751,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "ethereum", "parity-scale-codec", @@ -3762,7 +3762,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "ethereum", "ethereum-types", @@ -3774,7 +3774,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "evm", "frame-support", @@ -3789,7 +3789,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "ethereum", "ethereum-types", @@ -3805,7 +3805,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "frame-support", "parity-scale-codec", @@ -3817,7 +3817,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "parity-scale-codec", "serde", @@ -8740,7 +8740,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "environmental", "ethereum", @@ -8796,7 +8796,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "environmental", "evm", @@ -8821,7 +8821,7 @@ dependencies = [ [[package]] name = "pallet-evm-chain-id" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "frame-support", "frame-system", @@ -8916,7 +8916,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "fp-evm", ] @@ -8924,7 +8924,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "fp-evm", "sp-core", @@ -9056,7 +9056,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "fp-evm", "frame-support", @@ -9133,7 +9133,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "fp-evm", "num", @@ -9379,7 +9379,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "fp-evm", "tiny-keccak", @@ -9388,7 +9388,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "fp-evm", "ripemd", @@ -9398,7 +9398,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-storage-cleaner" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "fp-evm", "frame-support", @@ -12159,7 +12159,7 @@ dependencies = [ [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "derive_more", "environmental", @@ -12188,7 +12188,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a74ea7ae476886a6e840196e5603c411444c31c" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.11.0#9a91f3d2369c3a9380ef53bdf26fab2679069e52" dependencies = [ "case", "num_enum 0.7.2", From 45c9b5845f12f10e0004f9d2a11701653bb8d0d5 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Tue, 10 Sep 2024 09:42:18 +0100 Subject: [PATCH 09/11] fix tests --- test/helpers/contracts.ts | 15 --------------- .../dev/moonbase/test-moon/test-moon-rpc.ts | 6 ++++-- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/test/helpers/contracts.ts b/test/helpers/contracts.ts index afb9b36cbc..96da9912de 100644 --- a/test/helpers/contracts.ts +++ b/test/helpers/contracts.ts @@ -1,8 +1,5 @@ import { DevModeContext } from "@moonwall/cli"; import { ALITH_ADDRESS, alith } from "@moonwall/util"; -import { PalletEvmCodeMetadata } from "@polkadot/types/lookup"; -import { u8aToHex } from "@polkadot/util"; -import { keccak256 } from "viem"; export interface HeavyContract { deployed: boolean; @@ -42,14 +39,6 @@ export const deployHeavyContracts = async (context: DevModeContext, first = 6000 .polkadotJs() .registry.createType("Compact", `0x${BigInt((evmCode.length + 1) * 2).toString(16)}`) .toHex(true)}${evmCode}`; - const codeSize = evmCode.length / 2; - const codeMetadataHash = keccak256(("0x" + evmCode) as `0x${string}`); - const mockPalletEvmCodeMetadata: PalletEvmCodeMetadata = context - .polkadotJs() - .createType("PalletEvmCodeMetadata", { - size: codeSize, - hash: codeMetadataHash, - }); // Create the batchs of contracts to deploy const batchs = contracts @@ -58,10 +47,6 @@ export const deployHeavyContracts = async (context: DevModeContext, first = 6000 if (acc[acc.length - 1].length >= 30) acc.push([]); if (!value.deployed) { acc[acc.length - 1].push([value.key, storageData]); - acc[acc.length - 1].push([ - value.codesMetadataKey, - u8aToHex(mockPalletEvmCodeMetadata.toU8a()), - ]); } return acc; }, diff --git a/test/suites/dev/moonbase/test-moon/test-moon-rpc.ts b/test/suites/dev/moonbase/test-moon/test-moon-rpc.ts index cfd45d7ba8..d32ee383c9 100644 --- a/test/suites/dev/moonbase/test-moon/test-moon-rpc.ts +++ b/test/suites/dev/moonbase/test-moon/test-moon-rpc.ts @@ -161,8 +161,10 @@ describeSuite({ title: "should return latest synced block", test: async function () { const expected = await context.createBlock([], { finalize: true }); - const resp = await customDevRpcRequest("moon_getLatestBlockHash", []); - expect(resp, "Latest block hash").toBe(expected.block.hash); + const firstBlockHash = (await context.polkadotJs().rpc.chain.getBlockHash(0)).toHex(); + const resp = await customDevRpcRequest("moon_getEthSyncBlockRange", []); + expect(resp[0], "First block hash").toBe(firstBlockHash); + expect(resp[1], "Latest block hash").toBe(expected.block.hash); }, }); }, From d968d91380af271e7f320a51446fb6e0505a9e41 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Tue, 10 Sep 2024 10:02:32 +0100 Subject: [PATCH 10/11] remove unused code --- test/helpers/contracts.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/helpers/contracts.ts b/test/helpers/contracts.ts index 96da9912de..dac654068a 100644 --- a/test/helpers/contracts.ts +++ b/test/helpers/contracts.ts @@ -22,7 +22,6 @@ export const deployHeavyContracts = async (context: DevModeContext, first = 6000 deployed: false, account, key: context.polkadotJs().query.evm.accountCodes.key(account), - codesMetadataKey: context.polkadotJs().query.evm.accountCodesMetadata.key(account), }; }) ); @@ -45,9 +44,7 @@ export const deployHeavyContracts = async (context: DevModeContext, first = 6000 .reduce( (acc, value) => { if (acc[acc.length - 1].length >= 30) acc.push([]); - if (!value.deployed) { - acc[acc.length - 1].push([value.key, storageData]); - } + if (!value.deployed) acc[acc.length - 1].push([value.key, storageData]); return acc; }, [[]] as [string, string][][] From 9c93d63342a6e9cbd6570e13a15aa018368cff57 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Tue, 10 Sep 2024 13:28:59 +0100 Subject: [PATCH 11/11] test: fix gas in test-randomness --- .../moonbase/test-randomness/test-randomness-babe-lottery2.ts | 2 +- .../moonbase/test-randomness/test-randomness-vrf-lottery5.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/suites/dev/moonbase/test-randomness/test-randomness-babe-lottery2.ts b/test/suites/dev/moonbase/test-randomness/test-randomness-babe-lottery2.ts index aaab75412c..98b9664e3b 100644 --- a/test/suites/dev/moonbase/test-randomness/test-randomness-babe-lottery2.ts +++ b/test/suites/dev/moonbase/test-randomness/test-randomness-babe-lottery2.ts @@ -41,7 +41,7 @@ describeSuite({ functionName: "fulfillRequest", args: [0], rawTxOnly: true, - gas: 500_000n, + gas: 700_000n, // TODO: estimate gas and snapshot the estimation privateKey: BALTATHAR_PRIVATE_KEY, }); diff --git a/test/suites/dev/moonbase/test-randomness/test-randomness-vrf-lottery5.ts b/test/suites/dev/moonbase/test-randomness/test-randomness-vrf-lottery5.ts index ba53085240..f4db007ec1 100644 --- a/test/suites/dev/moonbase/test-randomness/test-randomness-vrf-lottery5.ts +++ b/test/suites/dev/moonbase/test-randomness/test-randomness-vrf-lottery5.ts @@ -44,7 +44,7 @@ describeSuite({ precompileName: "Randomness", functionName: "fulfillRequest", args: [0], - gas: 500_000n, + gas: 700_000n, // TODO: estimate gas and snapshot the estimation rawTxOnly: true, }); const { result } = await context.createBlock(rawTxn);