Skip to content

Commit cdc39ce

Browse files
committed
Update NEXT -> SIX pricing
1 parent ffcacc5 commit cdc39ce

File tree

14 files changed

+33
-146
lines changed

14 files changed

+33
-146
lines changed

category/execution/ethereum/execute_transaction.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,6 @@ evmc::Result ExecuteTransactionNoValidation<traits>::operator()(
240240
auth_refund = process_authorizations(state, host);
241241
}
242242

243-
if constexpr (!traits::eip_7702_refund_active()) {
244-
// monad doesn't give authorization refunds
245-
auth_refund = 0;
246-
}
247-
248243
// EIP-3651
249244
if constexpr (traits::evm_rev() >= EVMC_SHANGHAI) {
250245
host.access_account(header_.beneficiary);
@@ -357,26 +352,17 @@ Receipt ExecuteTransaction<traits>::execute_final(
357352
tx_,
358353
static_cast<uint64_t>(result.gas_left),
359354
static_cast<uint64_t>(result.gas_refund));
360-
auto const refund_gas_cost =
361-
refund_gas_price<traits>(tx_, header_.base_fee_per_gas.value_or(0));
362-
state.add_to_balance(sender_, refund_gas_cost * gas_refund);
355+
auto const gas_cost =
356+
gas_price<traits>(tx_, header_.base_fee_per_gas.value_or(0));
357+
state.add_to_balance(sender_, gas_cost * gas_refund);
363358

364-
auto gas_used = tx_.gas_limit;
365-
366-
// Monad specification §2.3: Payment Rule for User:
367-
// The storage refund does not reduce the gas consumption of the
368-
// transaction.
369-
if constexpr (traits::should_refund_reduce_gas_used()) {
370-
gas_used -= gas_refund;
371-
}
359+
auto gas_used = tx_.gas_limit - gas_refund;
372360

373361
// EIP-7623
374362
if constexpr (traits::evm_rev() >= EVMC_PRAGUE) {
375363
auto const floor_gas = floor_data_gas(tx_);
376364
if (gas_used < floor_gas) {
377365
auto const delta = floor_gas - gas_used;
378-
auto const gas_cost =
379-
gas_price<traits>(tx_, header_.base_fee_per_gas.value_or(0));
380366
state.subtract_from_balance(sender_, gas_cost * delta);
381367

382368
gas_used = floor_gas;

category/execution/ethereum/execute_transaction_test.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,7 @@ TYPED_TEST(TraitsTest, refunds_delete)
301301
}();
302302
static constexpr auto storage_refund_tx2 = [=] {
303303
if constexpr (TestFixture::is_monad_trait()) {
304-
if constexpr (TestFixture::Trait::monad_rev() >= MONAD_NEXT) {
305-
return 120'000;
306-
}
307-
else if constexpr (TestFixture::Trait::monad_rev() > MONAD_ZERO) {
304+
if constexpr (TestFixture::Trait::monad_rev() > MONAD_ZERO) {
308305
return 0;
309306
}
310307
}
@@ -593,10 +590,6 @@ TYPED_TEST(TraitsTest, refunds_delete_then_set)
593590
static constexpr auto storage_refund = [=] {
594591
if constexpr (TestFixture::is_monad_trait()) {
595592
if constexpr (
596-
TestFixture::Trait::monad_rev() >= MONAD_NEXT) {
597-
return 2800;
598-
}
599-
else if constexpr (
600593
TestFixture::Trait::monad_rev() > MONAD_ZERO) {
601594
return 0;
602595
}

category/execution/ethereum/test/test_monad_chain.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ TYPED_TEST(MonadTraitsTest, compute_gas_refund)
5050
{
5151
uint64_t const refund = compute_gas_refund<typename TestFixture::Trait>(
5252
Transaction{.gas_limit = 21'000}, 20'000, 1'000);
53-
if constexpr (TestFixture::REV >= MONAD_NEXT) {
54-
EXPECT_EQ(refund, 1'000);
55-
}
56-
else if constexpr (TestFixture::REV >= MONAD_ONE) {
53+
if constexpr (TestFixture::REV >= MONAD_ONE) {
5754
EXPECT_EQ(refund, 0);
5855
}
5956
else {

category/execution/ethereum/transaction_gas.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,6 @@ uint64_t compute_gas_refund(
206206

207207
EXPLICIT_EVM_TRAITS(compute_gas_refund);
208208

209-
template <Traits traits>
210-
uint256_t
211-
refund_gas_price(Transaction const &tx, uint256_t const &base_fee_per_gas)
212-
{
213-
return gas_price<traits>(tx, base_fee_per_gas);
214-
}
215-
216-
EXPLICIT_EVM_TRAITS(refund_gas_price);
217-
218209
template <Traits traits>
219210
uint256_t calculate_txn_award(
220211
Transaction const &tx, uint256_t const &base_fee_per_gas,

category/execution/ethereum/transaction_gas.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ template <Traits traits>
5151
uint64_t compute_gas_refund(
5252
Transaction const &, uint64_t gas_remaining, uint64_t refund);
5353

54-
template <Traits traits>
55-
uint256_t
56-
refund_gas_price(Transaction const &, uint256_t const &base_fee_per_gas);
57-
5854
template <Traits traits>
5955
uint256_t calculate_txn_award(
6056
Transaction const &, uint256_t const &base_fee_per_gas,

category/execution/monad/monad_transaction_gas.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ template <Traits traits>
2323
uint64_t compute_gas_refund(
2424
Transaction const &tx, uint64_t const gas_remaining, uint64_t const refund)
2525
{
26-
if constexpr (traits::monad_rev() >= MONAD_NEXT) {
27-
// Monad specification §4.2: Storage Gas Cost and Refunds
28-
return refund;
29-
}
30-
else if constexpr (traits::monad_rev() >= MONAD_ONE) {
26+
if constexpr (traits::monad_rev() >= MONAD_ONE) {
3127
return 0;
3228
}
3329

@@ -36,18 +32,4 @@ uint64_t compute_gas_refund(
3632

3733
EXPLICIT_MONAD_TRAITS(compute_gas_refund);
3834

39-
template <Traits traits>
40-
uint256_t
41-
refund_gas_price(Transaction const &tx, uint256_t const &base_fee_per_gas)
42-
{
43-
if constexpr (traits::monad_rev() >= MONAD_NEXT) {
44-
// Monad specification §4.2: Storage Gas Cost and Refunds
45-
return monad_min_base_fee_wei(traits::monad_rev());
46-
}
47-
48-
return gas_price<traits>(tx, base_fee_per_gas);
49-
}
50-
51-
EXPLICIT_MONAD_TRAITS(refund_gas_price);
52-
5335
MONAD_NAMESPACE_END

category/execution/monad/monad_transaction_gas.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,4 @@ template <Traits traits>
2525
uint64_t compute_gas_refund(
2626
Transaction const &, uint64_t gas_remaining, uint64_t refund);
2727

28-
template <Traits traits>
29-
uint256_t refund_gas_price(Transaction const &, uint256_t const &);
30-
3128
MONAD_NAMESPACE_END

category/rpc/eth_call_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ TEST_F(EthCallFixture, contract_deployment_success)
526526
EXPECT_EQ(returned_code_vec, deployed_code_vec);
527527
EXPECT_EQ(ctx.result->encoded_trace_len, 0);
528528
EXPECT_EQ(ctx.result->gas_refund, 0);
529-
EXPECT_EQ(ctx.result->gas_used, 137'137);
529+
EXPECT_EQ(ctx.result->gas_used, 68'137);
530530

531531
monad_state_override_destroy(state_override);
532532
monad_eth_call_executor_destroy(executor);

category/vm/evm/explicit_traits.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
f<::monad::MonadTraits<MONAD_FOUR>>; \
7070
template decltype(f<::monad::MonadTraits<MONAD_FIVE>>) \
7171
f<::monad::MonadTraits<MONAD_FIVE>>; \
72+
template decltype(f<::monad::MonadTraits<MONAD_SIX>>) \
73+
f<::monad::MonadTraits<MONAD_SIX>>; \
7274
template decltype(f<::monad::MonadTraits<MONAD_NEXT>>) \
7375
f<::monad::MonadTraits<MONAD_NEXT>>;
7476

@@ -102,6 +104,7 @@
102104
template class c<::monad::MonadTraits<MONAD_THREE>>; \
103105
template class c<::monad::MonadTraits<MONAD_FOUR>>; \
104106
template class c<::monad::MonadTraits<MONAD_FIVE>>; \
107+
template class c<::monad::MonadTraits<MONAD_SIX>>; \
105108
template class c<::monad::MonadTraits<MONAD_NEXT>>;
106109

107110
#define EXPLICIT_TRAITS_CLASS(c) \
@@ -167,6 +170,8 @@
167170
id<::monad::MonadTraits<MONAD_FOUR>>; \
168171
template decltype(id<::monad::MonadTraits<MONAD_FIVE>>) \
169172
id<::monad::MonadTraits<MONAD_FIVE>>; \
173+
template decltype(id<::monad::MonadTraits<MONAD_SIX>>) \
174+
id<::monad::MonadTraits<MONAD_SIX>>; \
170175
template decltype(id<::monad::MonadTraits<MONAD_NEXT>>) \
171176
id<::monad::MonadTraits<MONAD_NEXT>>;
172177

category/vm/evm/monad/revision.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ enum monad_revision
2828
MONAD_THREE = 3,
2929
MONAD_FOUR = 4,
3030
MONAD_FIVE = 5,
31-
MONAD_NEXT = 6,
31+
MONAD_SIX = 6,
32+
MONAD_NEXT = 7,
3233
MONAD_COUNT,
3334
};
3435

@@ -47,6 +48,8 @@ inline char const *monad_revision_to_string(enum monad_revision const rev)
4748
return "MONAD_FOUR";
4849
case MONAD_FIVE:
4950
return "MONAD_FIVE";
51+
case MONAD_SIX:
52+
return "MONAD_SIX";
5053
case MONAD_NEXT:
5154
return "MONAD_NEXT";
5255
default:

0 commit comments

Comments
 (0)