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

EIP-3198: BASEFEE opcode #248

Merged
merged 5 commits into from
May 30, 2021
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
34 changes: 34 additions & 0 deletions cmd/consensus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,23 @@ static const std::map<std::string, silkworm::ChainConfig> kNetworkConfig{
},
0, // muir_glacier_block
}},
{"London",
{
1, // chain_id
SealEngineType::kNoProof,
{
0, // homestead_block
0, // tangerine_whistle_block
0, // spurious_dragon_block
0, // byzantium_block
0, // constantinople_block
0, // petersburg_block
0, // istanbul_block
0, // berlin_block
0, // london_block
},
0, // muir_glacier_block
}},
{"FrontierToHomesteadAt5",
{
1, // chain_id
Expand Down Expand Up @@ -216,6 +233,23 @@ static const std::map<std::string, silkworm::ChainConfig> kNetworkConfig{
5, // petersburg_block
},
}},
{"BerlinToLondonAt5",
{
1, // chain_id
SealEngineType::kNoProof,
{
0, // homestead_block
0, // tangerine_whistle_block
0, // spurious_dragon_block
0, // byzantium_block
0, // constantinople_block
0, // petersburg_block
0, // istanbul_block
0, // berlin_block
5, // london_block
},
0, // muir_glacier_block
}},
{"EIP2384",
{
1, // chain_id
Expand Down
14 changes: 8 additions & 6 deletions core/silkworm/execution/evm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,17 +480,19 @@ evmc::result EvmHost::call(const evmc_message& message) noexcept {
}

evmc_tx_context EvmHost::get_tx_context() const noexcept {
const BlockHeader& header{evm_.block_.header};
evmc_tx_context context;
const intx::uint256 base_fee_per_gas{evm_.block_.header.base_fee_per_gas.value_or(0)};
const intx::uint256 base_fee_per_gas{header.base_fee_per_gas.value_or(0)};
const intx::uint256 effective_gas_price{evm_.txn_->effective_gas_price(base_fee_per_gas)};
intx::be::store(context.tx_gas_price.bytes, effective_gas_price);
context.tx_origin = *evm_.txn_->from;
context.block_coinbase = evm_.block_.header.beneficiary;
context.block_number = evm_.block_.header.number;
context.block_timestamp = evm_.block_.header.timestamp;
context.block_gas_limit = evm_.block_.header.gas_limit;
intx::be::store(context.block_difficulty.bytes, evm_.block_.header.difficulty);
context.block_coinbase = header.beneficiary;
context.block_number = header.number;
context.block_timestamp = header.timestamp;
context.block_gas_limit = header.gas_limit;
intx::be::store(context.block_difficulty.bytes, header.difficulty);
intx::be::store(context.chain_id.bytes, intx::uint256{evm_.config().chain_id});
intx::be::store(context.block_base_fee.bytes, base_fee_per_gas);
return context;
}

Expand Down