Skip to content

Commit e3bec1a

Browse files
authored
Merge pull request #11761 from ethereum/change-refunds-london
Updated changes in refunds: EIP-3529
2 parents ccdc11e + 11b80dc commit e3bec1a

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

libevmasm/GasMeter.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ namespace GasCosts
5959
}
6060
static unsigned const keccak256Gas = 30;
6161
static unsigned const keccak256WordGas = 6;
62+
/// Corresponds to ACCESS_LIST_ADDRESS_COST from EIP-2930
63+
static unsigned const accessListAddressCost = 2400;
64+
/// Corresponds to ACCESS_LIST_STORAGE_COST from EIP-2930
65+
static unsigned const accessListStorageKeyCost = 1900;
6266
/// Corresponds to COLD_SLOAD_COST from EIP-2929
6367
static unsigned const coldSloadCost = 2100;
6468
/// Corresponds to COLD_ACCOUNT_ACCESS_COST from EIP-2929
@@ -80,7 +84,15 @@ namespace GasCosts
8084
static unsigned const sstoreSetGas = 20000;
8185
/// Corresponds to SSTORE_RESET_GAS from EIP-2929
8286
static unsigned const sstoreResetGas = 5000 - coldSloadCost;
83-
static unsigned const sstoreRefundGas = 15000;
87+
/// Corresponds to SSTORE_CLEARS_SCHEDULE from EIP-2200
88+
inline static unsigned sstoreClearsSchedule(langutil::EVMVersion _evmVersion)
89+
{
90+
// Changes from EIP-3529
91+
if (_evmVersion >= langutil::EVMVersion::london())
92+
return sstoreResetGas + accessListStorageKeyCost;
93+
else
94+
return 15000;
95+
}
8496
inline static unsigned totalSstoreSetGas(langutil::EVMVersion _evmVersion)
8597
{
8698
if (_evmVersion >= langutil::EVMVersion::berlin())
@@ -144,7 +156,14 @@ namespace GasCosts
144156
else
145157
return 0;
146158
}
147-
static unsigned const selfdestructRefundGas = 24000;
159+
inline unsigned selfdestructRefundGas(langutil::EVMVersion _evmVersion)
160+
{
161+
// Changes from EIP-3529
162+
if (_evmVersion >= langutil::EVMVersion::london())
163+
return 0;
164+
else
165+
return 24000;
166+
}
148167
static unsigned const memoryGas = 3;
149168
static unsigned const quadCoeffDiv = 512;
150169
static unsigned const createDataGas = 200;

0 commit comments

Comments
 (0)