mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11435 from ethereum/reset-warm-access
Clears EIP-2929 account and storage access indicator on new blocks.
This commit is contained in:
commit
e1ef16251e
@ -168,6 +168,16 @@ void EVMHost::reset()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EVMHost::resetWarmAccess()
|
||||||
|
{
|
||||||
|
// Clear EIP-2929 account access indicator
|
||||||
|
recorded_account_accesses.clear();
|
||||||
|
// Clear EIP-2929 storage access indicator
|
||||||
|
for (auto& [address, account]: accounts)
|
||||||
|
for (auto& [slot, value]: account.storage)
|
||||||
|
value.access_status = EVMC_ACCESS_COLD;
|
||||||
|
}
|
||||||
|
|
||||||
void EVMHost::transfer(evmc::MockedAccount& _sender, evmc::MockedAccount& _recipient, u256 const& _value) noexcept
|
void EVMHost::transfer(evmc::MockedAccount& _sender, evmc::MockedAccount& _recipient, u256 const& _value) noexcept
|
||||||
{
|
{
|
||||||
assertThrow(u256(convertFromEVMC(_sender.balance)) >= _value, Exception, "Insufficient balance for transfer");
|
assertThrow(u256(convertFromEVMC(_sender.balance)) >= _value, Exception, "Insufficient balance for transfer");
|
||||||
|
@ -56,11 +56,14 @@ public:
|
|||||||
explicit EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm);
|
explicit EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm);
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
/// Clears EIP-2929 account and storage access indicator
|
||||||
|
void resetWarmAccess();
|
||||||
void newBlock()
|
void newBlock()
|
||||||
{
|
{
|
||||||
tx_context.block_number++;
|
tx_context.block_number++;
|
||||||
tx_context.block_timestamp += 15;
|
tx_context.block_timestamp += 15;
|
||||||
recorded_logs.clear();
|
recorded_logs.clear();
|
||||||
|
resetWarmAccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @returns contents of storage at @param _addr.
|
/// @returns contents of storage at @param _addr.
|
||||||
|
Loading…
Reference in New Issue
Block a user