Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.

Commit 31b2ab1

Browse files
Update gas to weight radio
1 parent 2a65020 commit 31b2ab1

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

bin/node/runtime/pangolin/src/pallets/evm_.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,14 @@ where
7272
}
7373
}
7474

75-
pub struct DarwiniaGasWeightMapping;
76-
impl GasWeightMapping for DarwiniaGasWeightMapping {
77-
fn gas_to_weight(gas: u64) -> Weight {
78-
gas * 1_000 as Weight
79-
}
80-
fn weight_to_gas(weight: Weight) -> u64 {
81-
weight / 1_000
82-
}
83-
}
84-
8575
frame_support::parameter_types! {
8676
pub const ChainId: u64 = 43;
8777
pub BlockGasLimit: U256 = u32::max_value().into();
8878
}
8979

9080
impl Config for Runtime {
9181
type FeeCalculator = dvm_dynamic_fee::Pallet<Self>;
92-
type GasWeightMapping = DarwiniaGasWeightMapping;
82+
type GasWeightMapping = ();
9383
type CallOrigin = EnsureAddressTruncated<Self::AccountId>;
9484
type AddressMapping = ConcatAddressMapping<Self::AccountId>;
9585
type FindAuthor = EthereumFindAuthor<Babe>;

frame/evm/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,13 @@ pub trait GasWeightMapping {
448448
fn gas_to_weight(gas: u64) -> Weight;
449449
fn weight_to_gas(weight: Weight) -> u64;
450450
}
451+
// The radio of gas to weight comes from benchmark test
451452
impl GasWeightMapping for () {
452453
fn gas_to_weight(gas: u64) -> Weight {
453-
gas as Weight
454+
gas * 16_000 as Weight
454455
}
455456
fn weight_to_gas(weight: Weight) -> u64 {
456-
weight
457+
weight / 16_000
457458
}
458459
}
459460

0 commit comments

Comments
 (0)