Merge pull request #11761 from ethereum/change-refunds-london

Updated changes in refunds: EIP-3529
This commit is contained in:
chriseth 2021-08-12 15:34:21 +02:00 committed by GitHub
commit e3bec1a8a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,6 +59,10 @@ namespace GasCosts
} }
static unsigned const keccak256Gas = 30; static unsigned const keccak256Gas = 30;
static unsigned const keccak256WordGas = 6; static unsigned const keccak256WordGas = 6;
/// Corresponds to ACCESS_LIST_ADDRESS_COST from EIP-2930
static unsigned const accessListAddressCost = 2400;
/// Corresponds to ACCESS_LIST_STORAGE_COST from EIP-2930
static unsigned const accessListStorageKeyCost = 1900;
/// Corresponds to COLD_SLOAD_COST from EIP-2929 /// Corresponds to COLD_SLOAD_COST from EIP-2929
static unsigned const coldSloadCost = 2100; static unsigned const coldSloadCost = 2100;
/// Corresponds to COLD_ACCOUNT_ACCESS_COST from EIP-2929 /// Corresponds to COLD_ACCOUNT_ACCESS_COST from EIP-2929
@ -80,7 +84,15 @@ namespace GasCosts
static unsigned const sstoreSetGas = 20000; static unsigned const sstoreSetGas = 20000;
/// Corresponds to SSTORE_RESET_GAS from EIP-2929 /// Corresponds to SSTORE_RESET_GAS from EIP-2929
static unsigned const sstoreResetGas = 5000 - coldSloadCost; static unsigned const sstoreResetGas = 5000 - coldSloadCost;
static unsigned const sstoreRefundGas = 15000; /// Corresponds to SSTORE_CLEARS_SCHEDULE from EIP-2200
inline static unsigned sstoreClearsSchedule(langutil::EVMVersion _evmVersion)
{
// Changes from EIP-3529
if (_evmVersion >= langutil::EVMVersion::london())
return sstoreResetGas + accessListStorageKeyCost;
else
return 15000;
}
inline static unsigned totalSstoreSetGas(langutil::EVMVersion _evmVersion) inline static unsigned totalSstoreSetGas(langutil::EVMVersion _evmVersion)
{ {
if (_evmVersion >= langutil::EVMVersion::berlin()) if (_evmVersion >= langutil::EVMVersion::berlin())
@ -144,7 +156,14 @@ namespace GasCosts
else else
return 0; return 0;
} }
static unsigned const selfdestructRefundGas = 24000; inline unsigned selfdestructRefundGas(langutil::EVMVersion _evmVersion)
{
// Changes from EIP-3529
if (_evmVersion >= langutil::EVMVersion::london())
return 0;
else
return 24000;
}
static unsigned const memoryGas = 3; static unsigned const memoryGas = 3;
static unsigned const quadCoeffDiv = 512; static unsigned const quadCoeffDiv = 512;
static unsigned const createDataGas = 200; static unsigned const createDataGas = 200;