Skip to content

Commit

Permalink
Merge branch 'master' into polkadot-v0.9.42
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed Apr 23, 2024
2 parents ba746ec + 0a02310 commit 775427e
Show file tree
Hide file tree
Showing 9 changed files with 197 additions and 346 deletions.
59 changes: 30 additions & 29 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: 2 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ignore = [
"RUSTSEC-2022-0093",
# TODO(#742): vulnerable webpki.
"RUSTSEC-2023-0052",
# TODO(#1013): vulnerable rustls.
"RUSTSEC-2024-0336",
]

[licenses]
Expand Down
6 changes: 3 additions & 3 deletions utils/checks/snapshots/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,7 @@
- quote
- visit
- visit-mut
- name: syn 2.0.59
- name: syn 2.0.60
features:
- clone-impls
- default
Expand Down Expand Up @@ -3532,9 +3532,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 775427e

Please sign in to comment.