Skip to content

Commit

Permalink
Merge branch 'master' into zombienet-usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed Apr 24, 2024
2 parents 377ec73 + a7ee0aa commit e5be96b
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 321 deletions.
9 changes: 5 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sha3 = { version = "0.10", default-features = false }
similar-asserts = { version = "1", default-features = false }
static_assertions = { version = "1", default-features = false }
syn = { version = "2", default-features = false }
thiserror = { version = "1.0.58", default-features = false }
thiserror = { version = "1.0.59", default-features = false }
tiny-bip39 = { version = "1", default-features = false }
tokio = { version = "1", default-features = false }
tracing = { version = "0.1", default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions crates/humanode-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pallet-pot = { path = "../pallet-pot", default-features = false }
pallet-token-claims = { path = "../pallet-token-claims", default-features = false }
pallet-vesting = { path = "../pallet-vesting", default-features = false }
precompile-bioauth = { path = "../precompile-bioauth", default-features = false }
precompile-bls12381 = { path = "../precompile-bls12381", default-features = false }
precompile-currency-swap = { path = "../precompile-currency-swap", default-features = false }
precompile-evm-accounts-mapping = { path = "../precompile-evm-accounts-mapping", default-features = false }
precompile-native-currency = { path = "../precompile-native-currency", default-features = false }
Expand Down Expand Up @@ -193,6 +194,7 @@ std = [
"pallet-utility/std",
"pallet-vesting/std",
"precompile-bioauth/std",
"precompile-bls12381/std",
"precompile-currency-swap/std",
"precompile-evm-accounts-mapping/std",
"precompile-native-currency/std",
Expand Down
42 changes: 42 additions & 0 deletions crates/humanode-runtime/src/frontier_precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ use pallet_evm_precompile_modexp::Modexp;
use pallet_evm_precompile_sha3fips::Sha3FIPS256;
use pallet_evm_precompile_simple::{ECRecover, ECRecoverPublicKey, Identity, Ripemd160, Sha256};
use precompile_bioauth::Bioauth;
use precompile_bls12381::{
Bls12381G1Add, Bls12381G1Mul, Bls12381G1MultiExp, Bls12381G2Add, Bls12381G2Mul,
Bls12381G2MultiExp, Bls12381MapG1, Bls12381MapG2, Bls12381Pairing,
};
use precompile_currency_swap::CurrencySwap;
use precompile_evm_accounts_mapping::EvmAccountsMapping;
use precompile_native_currency::NativeCurrency;
Expand All @@ -28,6 +32,25 @@ pub mod precompiles_constants {
/// `Modexp` precompile constant.
pub const MODEXP: u64 = 5;

/// `Bls12381G1Add` precompile constant.
pub const BLS12381_G1_ADD: u64 = 11;
/// `Bls12381G1Mul` precompile constant.
pub const BLS12381_G1_MUL: u64 = 12;
/// `Bls12381G1MultiExp` precompile constant.
pub const BLS12381_G1_MULTI_EXP: u64 = 13;
/// `Bls12381G2Add` precompile constant.
pub const BLS12381_G2_ADD: u64 = 14;
/// `Bls12381G2Mul` precompile constant.
pub const BLS12381_G2_MUL: u64 = 15;
/// `Bls12381G2MultiExp` precompile constant.
pub const BLS12381_G2_MULTI_EXP: u64 = 16;
/// `Bls12381Pairing` precompile constant.
pub const BLS12381_PAIRING: u64 = 17;
/// `Bls12381MapG1` precompile constant.
pub const BLS12381_MAP_G1: u64 = 18;
/// `Bls12381MapG2` precompile constant.
pub const BLS12381_MAP_G2: u64 = 19;

/// `Sha3FIPS256` precompile constant.
pub const SHA_3_FIPS256: u64 = 1024;
/// `ECRecoverPublicKey` precompile constant.
Expand Down Expand Up @@ -64,6 +87,15 @@ where
RIPEMD_160,
IDENTITY,
MODEXP,
BLS12381_G1_ADD,
BLS12381_G1_MUL,
BLS12381_G1_MULTI_EXP,
BLS12381_G2_ADD,
BLS12381_G2_MUL,
BLS12381_G2_MULTI_EXP,
BLS12381_PAIRING,
BLS12381_MAP_G1,
BLS12381_MAP_G2,
SHA_3_FIPS256,
EC_RECOVER_PUBLIC_KEY,
BIOAUTH,
Expand Down Expand Up @@ -99,6 +131,16 @@ 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)),
// 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)),
a if a == hash(BLS12381_G1_MULTI_EXP) => Some(Bls12381G1MultiExp::execute(handle)),
a if a == hash(BLS12381_G2_ADD) => Some(Bls12381G2Add::execute(handle)),
a if a == hash(BLS12381_G2_MUL) => Some(Bls12381G2Mul::execute(handle)),
a if a == hash(BLS12381_G2_MULTI_EXP) => Some(Bls12381G2MultiExp::execute(handle)),
a if a == hash(BLS12381_PAIRING) => Some(Bls12381Pairing::execute(handle)),
a if a == hash(BLS12381_MAP_G1) => Some(Bls12381MapG1::execute(handle)),
a if a == hash(BLS12381_MAP_G2) => Some(Bls12381MapG2::execute(handle)),
// Non-Frontier specific nor Ethereum precompiles :
a if a == hash(SHA_3_FIPS256) => Some(Sha3FIPS256::execute(handle)),
a if a == hash(EC_RECOVER_PUBLIC_KEY) => Some(ECRecoverPublicKey::execute(handle)),
Expand Down
2 changes: 1 addition & 1 deletion crates/humanode-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 116,
spec_version: 117,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
4 changes: 2 additions & 2 deletions utils/checks/snapshots/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3603,9 +3603,9 @@
features: []
- name: termtree 0.4.1
features: []
- name: thiserror 1.0.58
- name: thiserror 1.0.59
features: []
- name: thiserror-impl 1.0.58
- name: thiserror-impl 1.0.59
features: []
- name: thousands 0.2.0
features: []
Expand Down
2 changes: 1 addition & 1 deletion utils/e2e-tests/bash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"type": "module",
"dependencies": {
"@polkadot/api-cli": "^0.56.6"
"@polkadot/api-cli": "^0.56.7"
}
}
6 changes: 3 additions & 3 deletions utils/e2e-tests/ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"test:ui": "vitest --ui"
},
"dependencies": {
"@polkadot/api": "^10.12.6",
"@polkadot/api": "^10.13.1",
"@types/node": "16.18.96",
"@vitest/expect": "^1.5.0",
"axios": "^1.6.8",
"ethers": "^6.11.1",
"ethers": "^6.12.0",
"typescript": "^5.4.5",
"viem": "^2.9.18",
"viem": "^2.9.25",
"vitest": "^1.5.0"
}
}
Loading

0 comments on commit e5be96b

Please sign in to comment.