Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions substrate/frame/revive/src/tests/sol/block_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn gaslimit_works(fixture_type: FixtureType) {
/// Tests that the basefee opcode works as expected.
#[test_case(FixtureType::Solc)]
#[test_case(FixtureType::Resolc)]
fn basefee_works(fixture_type: FixtureType) {
fn base_fee_works(fixture_type: FixtureType) {
let (code, _) = compile_module_with_type("BlockInfo", fixture_type).unwrap();
ExtBuilder::default().build().execute_with(|| {
let _ = <Test as Config>::Currency::set_balance(&ALICE, 100_000_000_000);
Expand All @@ -148,7 +148,7 @@ fn basefee_works(fixture_type: FixtureType) {
.data(BlockInfo::BlockInfoCalls::basefee(BlockInfo::basefeeCall {}).abi_encode())
.build_and_unwrap_result();
let decoded = BlockInfo::basefeeCall::abi_decode_returns(&result.data).unwrap();
assert_eq!(0u64, decoded);
assert_eq!(<crate::Pallet<Test>>::evm_gas_price().as_u64(), decoded);
});
}

Expand Down
6 changes: 0 additions & 6 deletions substrate/frame/revive/src/vm/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::{
vm::{evm::instructions::exec_instruction, BytecodeType, ExecResult, Ext},
weights::WeightInfo,
AccountIdOf, CodeInfo, Config, ContractBlob, DispatchError, Error, Weight, H256, LOG_TARGET,
U256,
};
use alloc::vec::Vec;
use core::{convert::Infallible, ops::ControlFlow};
Expand Down Expand Up @@ -48,11 +47,6 @@ mod util;
/// opcode. The value is aligned with the difficulty hardcoded for PVM contracts.
pub(crate) const DIFFICULTY: u64 = 2500000000000000_u64;

/// The base fee per gas used in the network as defined by EIP-1559.
///
/// For `pallet-revive`, this is hardcoded to 0
pub(crate) const BASE_FEE: U256 = U256::zero();

/// Cost for a single unit of EVM gas.
#[derive(Eq, PartialEq, Debug, Clone, Copy)]
pub struct EVMGas(u64);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use crate::{
vm::{
evm::{interpreter::Halt, EVMGas, Interpreter, BASE_FEE, DIFFICULTY},
evm::{interpreter::Halt, EVMGas, Interpreter, DIFFICULTY},
Ext,
},
Error, RuntimeCosts,
Expand Down Expand Up @@ -85,7 +85,7 @@ pub fn gaslimit<E: Ext>(interpreter: &mut Interpreter<E>) -> ControlFlow<Halt> {
/// EIP-3198: BASEFEE opcode
pub fn basefee<E: Ext>(interpreter: &mut Interpreter<E>) -> ControlFlow<Halt> {
interpreter.ext.charge_or_halt(RuntimeCosts::BaseFee)?;
interpreter.stack.push(BASE_FEE)?;
interpreter.stack.push(crate::Pallet::<E::T>::evm_gas_price())?;
Copy link
Copy Markdown
Contributor Author

@pgherveou pgherveou Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evm_gas_price is confusing it should be renamed evm_basefee or is that not supposed to be the same thing as block.basefee in solidity? @athei

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it is the same. We should probably rename, yes.

ControlFlow::Continue(())
}

Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/revive/src/vm/pvm/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ pub mod env {
Ok(self.write_fixed_sandbox_output(
memory,
out_ptr,
&U256::zero().to_little_endian(),
&Pallet::<E::T>::evm_gas_price().to_little_endian(),
false,
already_charged,
)?)
Expand Down
Loading