Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update evm config to shanghai #1068

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/frame/evm.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ any Ethereum transaction into a transaction compatible with this
module.

The gas configurations are configurable. Right now, a pre-defined
London hard fork configuration option is provided.
Shanghai hard fork configuration option is provided.
2 changes: 1 addition & 1 deletion frame/ethereum/src/tests/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ fn transaction_should_generate_correct_gas_used() {
let (pairs, mut ext) = new_test_ext(1);
let alice = &pairs[0];

let expected_gas = U256::from(893928);
let expected_gas = U256::from(894198);

ext.execute_with(|| {
let t = eip1559_erc20_creation_transaction(alice);
Expand Down
2 changes: 1 addition & 1 deletion frame/ethereum/src/tests/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ fn transaction_should_generate_correct_gas_used() {
let (pairs, mut ext) = new_test_ext(1);
let alice = &pairs[0];

let expected_gas = U256::from(893928);
let expected_gas = U256::from(894198);

ext.execute_with(|| {
let t = eip2930_erc20_creation_transaction(alice);
Expand Down
2 changes: 1 addition & 1 deletion frame/ethereum/src/tests/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ fn transaction_should_generate_correct_gas_used() {
let (pairs, mut ext) = new_test_ext(1);
let alice = &pairs[0];

let expected_gas = U256::from(893928);
let expected_gas = U256::from(894198);

ext.execute_with(|| {
let t = legacy_erc20_creation_transaction(alice);
Expand Down
4 changes: 2 additions & 2 deletions frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub mod pallet {

/// EVM config used in the module.
fn config() -> &'static EvmConfig {
&LONDON_CONFIG
&SHANGHAI_CONFIG
}
}

Expand Down Expand Up @@ -694,7 +694,7 @@ impl<T: Config> GasWeightMapping for FixedGasWeightMapping<T> {
}
}

static LONDON_CONFIG: EvmConfig = EvmConfig::london();
static SHANGHAI_CONFIG: EvmConfig = EvmConfig::shanghai();

impl<T: Config> Pallet<T> {
/// Check whether an account is empty.
Expand Down
4 changes: 2 additions & 2 deletions primitives/evm/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ mod tests {
InvalidChainId,
}

static LONDON_CONFIG: evm::Config = evm::Config::london();
static SHANGHAI_CONFIG: evm::Config = evm::Config::shanghai();

impl From<InvalidEvmTransactionError> for TestError {
fn from(e: InvalidEvmTransactionError) -> Self {
Expand Down Expand Up @@ -293,7 +293,7 @@ mod tests {
} = input;
CheckEvmTransaction::<TestError>::new(
CheckEvmTransactionConfig {
evm_config: &LONDON_CONFIG,
evm_config: &SHANGHAI_CONFIG,
block_gas_limit: blockchain_gas_limit,
base_fee: blockchain_base_fee,
chain_id: blockchain_chain_id,
Expand Down
4 changes: 2 additions & 2 deletions ts-tests/tests/test-execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describeWithFrontier("Frontier RPC (RPC execution)", (context) => {
},
]);

expect(result.result).to.be.equal("0x3043a");
expect(result.result).to.be.equal("0x30464");
});

step("should estimateGas with gas limit up to 10x block gas limit", async function () {
Expand All @@ -170,7 +170,7 @@ describeWithFrontier("Frontier RPC (RPC execution)", (context) => {
},
]);

expect(result.result).to.be.equal("0x3043a");
expect(result.result).to.be.equal("0x30464");
});

step("shouldn't estimateGas with gas limit up higher than 10x block gas limit", async function () {
Expand Down
2 changes: 1 addition & 1 deletion ts-tests/tests/test-fee-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describeWithFrontier("Frontier RPC (Fee History)", (context) => {
// baseFeePerGas is always the requested block range + 1 (the next derived base fee).
expect(result.baseFeePerGas.length).to.be.eq(blockCount + 1);
// gasUsedRatio for the requested block range.
expect(result.gasUsedRatio).to.be.deep.eq(Array(blockCount).fill(0.03575712));
expect(result.gasUsedRatio).to.be.deep.eq(Array(blockCount).fill(0.03576792));
// two-dimensional reward list for the requested block range.
expect(result.reward.length).to.be.eq(blockCount);
// each block has a reward list which's size is the requested percentile list.
Expand Down
8 changes: 4 additions & 4 deletions ts-tests/tests/test-gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describeWithFrontier("Frontier RPC (Gas)", (context) => {

it("eth_estimateGas for contract creation", async function () {
// The value returned as an estimation by the evm with estimate mode ON.
let oneOffEstimation = 196657;
let oneOffEstimation = 196701;
let binarySearchEstimation = binarySearch(oneOffEstimation);
// Sanity check expect a variance of 10%.
expect(estimationVariance(binarySearchEstimation, oneOffEstimation)).to.be.lessThan(1);
Expand Down Expand Up @@ -105,7 +105,7 @@ describeWithFrontier("Frontier RPC (Gas)", (context) => {
it("eth_estimateGas should handle AccessList alias", async function () {
// The value returned as an estimation by the evm with estimate mode ON.
// 4300 == 1900 for one key and 2400 for one storage.
let oneOffEstimation = 196657 + 4300;
let oneOffEstimation = 196701 + 4300;
let binarySearchEstimation = binarySearch(oneOffEstimation);
// Sanity check expect a variance of 10%.
expect(estimationVariance(binarySearchEstimation, oneOffEstimation)).to.be.lessThan(1);
Expand All @@ -132,12 +132,12 @@ describeWithFrontier("Frontier RPC (Gas)", (context) => {
data: Test.bytecode,
gasPrice: "0x0",
});
expect(result).to.equal(197690);
expect(result).to.equal(197732);
result = await context.web3.eth.estimateGas({
from: GENESIS_ACCOUNT,
data: Test.bytecode,
});
expect(result).to.equal(197690);
expect(result).to.equal(197732);
});

it("tx gas limit below ETH_BLOCK_GAS_LIMIT", async function () {
Expand Down