Skip to content

Commit

Permalink
Update chain id (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest authored Dec 2, 2022
1 parent 7845ccd commit 15ae806
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 17 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions runtime/crab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pallet-bridge-messages = { default-features = false, git = "https://github.com/d
pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" }

# frontier
fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
Expand All @@ -68,7 +67,8 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith
pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }

# moonbeam
xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" }
precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"}
xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" }

# polkadot
pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }
Expand Down Expand Up @@ -163,7 +163,6 @@ std = [
"pallet-fee-market/std",

# frontier
"fp-evm/std",
"fp-rpc/std",
"fp-self-contained/std",
"pallet-base-fee/std",
Expand All @@ -176,6 +175,7 @@ std = [
"pallet-evm-precompile-simple/std",

# moonbeam
"precompile-utils/std",
"xcm-primitives/std",

# polkadot
Expand Down
12 changes: 10 additions & 2 deletions runtime/crab/src/pallets/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing};
use pallet_evm_precompile_dispatch::Dispatch;
use pallet_evm_precompile_modexp::Modexp;
use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256};
// moonbeam
use precompile_utils::prelude::*;
// substrate
use frame_support::{traits::FindAuthor, ConsensusEngineId};
use sp_core::crypto::ByteArray;
Expand Down Expand Up @@ -124,7 +126,13 @@ where
R: pallet_evm::Config,
{
fn execute(&self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
match handle.code_address() {
let (code_address, caller) = (handle.code_address(), handle.context().caller);
// Filter known precompile addresses except Ethereum officials
if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller {
return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE")));
};

match code_address {
// Ethereum precompiles:
a if a == addr(1) => Some(ECRecover::execute(handle)),
a if a == addr(2) => Some(Sha256::execute(handle)),
Expand Down Expand Up @@ -159,7 +167,7 @@ impl pallet_evm::Config for Runtime {
type BlockGasLimit = BlockGasLimit;
type BlockHashMapping = EthereumBlockHashMapping<Self>;
type CallOrigin = EnsureAddressRoot<AccountId>;
type ChainId = ConstU64<43>;
type ChainId = ConstU64<44>;
type Currency = Balances;
type FeeCalculator = FixedGasPrice;
type FindAuthor = FindAuthorTruncated<Aura>;
Expand Down
6 changes: 3 additions & 3 deletions runtime/darwinia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pallet-bridge-messages = { default-features = false, git = "https://github.com/d
pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" }

# frontier
fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
Expand All @@ -68,7 +67,8 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith
pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }

# moonbeam
xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" }
precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"}
xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" }

# polkadot
pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }
Expand Down Expand Up @@ -163,7 +163,6 @@ std = [
"pallet-fee-market/std",

# frontier
"fp-evm/std",
"fp-rpc/std",
"fp-self-contained/std",
"pallet-base-fee/std",
Expand All @@ -176,6 +175,7 @@ std = [
"pallet-evm-precompile-simple/std",

# moonbeam
"precompile-utils/std",
"xcm-primitives/std",

# polkadot
Expand Down
12 changes: 10 additions & 2 deletions runtime/darwinia/src/pallets/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing};
use pallet_evm_precompile_dispatch::Dispatch;
use pallet_evm_precompile_modexp::Modexp;
use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256};
// moonbeam
use precompile_utils::prelude::*;
// substrate
use frame_support::{traits::FindAuthor, ConsensusEngineId};
use sp_core::crypto::ByteArray;
Expand Down Expand Up @@ -124,7 +126,13 @@ where
R: pallet_evm::Config,
{
fn execute(&self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
match handle.code_address() {
let (code_address, caller) = (handle.code_address(), handle.context().caller);
// Filter known precompile addresses except Ethereum officials
if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller {
return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE")));
};

match code_address {
// Ethereum precompiles:
a if a == addr(1) => Some(ECRecover::execute(handle)),
a if a == addr(2) => Some(Sha256::execute(handle)),
Expand Down Expand Up @@ -159,7 +167,7 @@ impl pallet_evm::Config for Runtime {
type BlockGasLimit = BlockGasLimit;
type BlockHashMapping = EthereumBlockHashMapping<Self>;
type CallOrigin = EnsureAddressRoot<AccountId>;
type ChainId = ConstU64<43>;
type ChainId = ConstU64<46>;
type Currency = Balances;
type FeeCalculator = FixedGasPrice;
type FindAuthor = FindAuthorTruncated<Aura>;
Expand Down
6 changes: 3 additions & 3 deletions runtime/pangolin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pallet-bridge-messages = { default-features = false, git = "https://github.com/d
pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" }

# frontier
fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
Expand All @@ -68,7 +67,8 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith
pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }

# moonbeam
xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" }
precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"}
xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" }

# polkadot
pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }
Expand Down Expand Up @@ -163,7 +163,6 @@ std = [
"pallet-fee-market/std",

# frontier
"fp-evm/std",
"fp-rpc/std",
"fp-self-contained/std",
"pallet-base-fee/std",
Expand All @@ -176,6 +175,7 @@ std = [
"pallet-evm-precompile-simple/std",

# moonbeam
"precompile-utils/std",
"xcm-primitives/std",

# polkadot
Expand Down
10 changes: 9 additions & 1 deletion runtime/pangolin/src/pallets/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing};
use pallet_evm_precompile_dispatch::Dispatch;
use pallet_evm_precompile_modexp::Modexp;
use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256};
// moonbeam
use precompile_utils::prelude::*;
// substrate
use frame_support::{traits::FindAuthor, ConsensusEngineId};
use sp_core::crypto::ByteArray;
Expand Down Expand Up @@ -124,7 +126,13 @@ where
R: pallet_evm::Config,
{
fn execute(&self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
match handle.code_address() {
let (code_address, caller) = (handle.code_address(), handle.context().caller);
// Filter known precompile addresses except Ethereum officials
if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller {
return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE")));
};

match code_address {
// Ethereum precompiles:
a if a == addr(1) => Some(ECRecover::execute(handle)),
a if a == addr(2) => Some(Sha256::execute(handle)),
Expand Down

0 comments on commit 15ae806

Please sign in to comment.