diff --git a/Cargo.lock b/Cargo.lock index 56001b25f..3b3085329 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4126,6 +4126,7 @@ dependencies = [ "pallet-evm", "pallet-evm-accounts-mapping", "pallet-evm-balances", + "pallet-evm-precompile-blake2", "pallet-evm-precompile-modexp", "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", @@ -6506,6 +6507,14 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-evm-precompile-blake2" +version = "2.0.0-dev" +source = "git+https://github.com/humanode-network/frontier?branch=locked/polkadot-v0.9.40#ac5c3415f47adf126419579924052daff07301e1" +dependencies = [ + "fp-evm", +] + [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" diff --git a/Cargo.toml b/Cargo.toml index 4512a39dc..d739cc5fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -157,6 +157,7 @@ fp-storage = { git = "https://github.com/humanode-network/frontier", branch = "l pallet-ethereum = { git = "https://github.com/humanode-network/frontier", branch = "locked/polkadot-v0.9.40", default-features = false } pallet-evm = { git = "https://github.com/humanode-network/frontier", branch = "locked/polkadot-v0.9.40", default-features = false } pallet-evm-balances = { git = "https://github.com/humanode-network/frontier", branch = "locked/polkadot-v0.9.40", default-features = false } +pallet-evm-precompile-blake2 = { git = "https://github.com/humanode-network/frontier", branch = "locked/polkadot-v0.9.40", default-features = false } pallet-evm-precompile-modexp = { git = "https://github.com/humanode-network/frontier", branch = "locked/polkadot-v0.9.40", default-features = false } pallet-evm-precompile-sha3fips = { git = "https://github.com/humanode-network/frontier", branch = "locked/polkadot-v0.9.40", default-features = false } pallet-evm-precompile-simple = { git = "https://github.com/humanode-network/frontier", branch = "locked/polkadot-v0.9.40", default-features = false } diff --git a/crates/humanode-runtime/Cargo.toml b/crates/humanode-runtime/Cargo.toml index 0e937312e..3a8c1090d 100644 --- a/crates/humanode-runtime/Cargo.toml +++ b/crates/humanode-runtime/Cargo.toml @@ -64,6 +64,7 @@ pallet-balances = { workspace = true } pallet-ethereum = { workspace = true } pallet-evm = { workspace = true } pallet-evm-balances = { workspace = true } +pallet-evm-precompile-blake2 = { workspace = true } pallet-evm-precompile-modexp = { workspace = true } pallet-evm-precompile-sha3fips = { workspace = true } pallet-evm-precompile-simple = { workspace = true } @@ -173,6 +174,7 @@ std = [ "pallet-ethereum-chain-id/std", "pallet-ethereum/std", "pallet-evm-accounts-mapping/std", + "pallet-evm-precompile-blake2/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-sha3fips/std", "pallet-evm-precompile-simple/std", diff --git a/crates/humanode-runtime/src/frontier_precompiles.rs b/crates/humanode-runtime/src/frontier_precompiles.rs index fb6da6c68..51057aac2 100644 --- a/crates/humanode-runtime/src/frontier_precompiles.rs +++ b/crates/humanode-runtime/src/frontier_precompiles.rs @@ -2,6 +2,7 @@ use frame_support::traits::Currency; use pallet_evm::{ IsPrecompileResult, Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, }; +use pallet_evm_precompile_blake2::Blake2F; use pallet_evm_precompile_modexp::Modexp; use pallet_evm_precompile_sha3fips::Sha3FIPS256; use pallet_evm_precompile_simple::{ECRecover, ECRecoverPublicKey, Identity, Ripemd160, Sha256}; @@ -31,6 +32,8 @@ pub mod precompiles_constants { pub const IDENTITY: u64 = 4; /// `Modexp` precompile constant. pub const MODEXP: u64 = 5; + /// `Blake2F` precompile constant. + pub const BLAKE2F: u64 = 9; /// `Bls12381G1Add` precompile constant. pub const BLS12381_G1_ADD: u64 = 11; @@ -87,6 +90,7 @@ where RIPEMD_160, IDENTITY, MODEXP, + BLAKE2F, BLS12381_G1_ADD, BLS12381_G1_MUL, BLS12381_G1_MULTI_EXP, @@ -131,6 +135,7 @@ where a if a == hash(RIPEMD_160) => Some(Ripemd160::execute(handle)), a if a == hash(IDENTITY) => Some(Identity::execute(handle)), a if a == hash(MODEXP) => Some(Modexp::execute(handle)), + a if a == hash(BLAKE2F) => Some(Blake2F::execute(handle)), // BLS12-381 precompiles: a if a == hash(BLS12381_G1_ADD) => Some(Bls12381G1Add::execute(handle)), a if a == hash(BLS12381_G1_MUL) => Some(Bls12381G1Mul::execute(handle)),