Skip to content

Commit 1366e4d

Browse files
committed
refactor: fix post-merge regressions
1 parent 75135e5 commit 1366e4d

8 files changed

Lines changed: 20 additions & 20 deletions

File tree

tests/benchmark/compute/precompile/test_alt_bn128.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,9 @@ def test_alt_bn128_uncachable(
722722
intrinsic_gas_calculator = fork.transaction_intrinsic_cost_calculator()
723723
gsc = fork.gas_costs()
724724
precompile_cost = (
725-
gsc.GAS_PRECOMPILE_ECMUL
725+
gsc.PRECOMPILE_ECMUL
726726
if precompile_address == 0x07
727-
else gsc.GAS_PRECOMPILE_ECADD
727+
else gsc.PRECOMPILE_ECADD
728728
)
729729
attack_block = Op.POP(
730730
Op.STATICCALL(

tests/benchmark/compute/precompile/test_blake2f.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def test_blake2f_uncachable(
121121
# BLAKE2F costs num_rounds gas.
122122
gsc = fork.gas_costs()
123123
precompile_cost = (
124-
num_rounds * gsc.GAS_PRECOMPILE_BLAKE2F_PER_ROUND
125-
) + gsc.GAS_PRECOMPILE_BLAKE2F_BASE
124+
num_rounds * gsc.PRECOMPILE_BLAKE2F_PER_ROUND
125+
) + gsc.PRECOMPILE_BLAKE2F_BASE
126126

127127
attack_block = Op.POP(
128128
Op.STATICCALL(

tests/benchmark/compute/precompile/test_bls12_381.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@ def test_bls12_pairing_uncachable(
531531
attack_contract_address = pre.deploy_contract(code=code)
532532

533533
precompile_cost = (
534-
gsc.GAS_PRECOMPILE_BLS_PAIRING_BASE
535-
+ gsc.GAS_PRECOMPILE_BLS_PAIRING_PER_PAIR * num_pairs
534+
gsc.PRECOMPILE_BLS_PAIRING_BASE
535+
+ gsc.PRECOMPILE_BLS_PAIRING_PER_PAIR * num_pairs
536536
)
537537

538538
iteration_cost = loop.gas_cost(fork) + precompile_cost
@@ -545,8 +545,8 @@ def test_bls12_pairing_uncachable(
545545
tokens_per_variant = pair_size * 4 # worst case: all non-zero
546546
per_variant_gas = (
547547
iteration_cost
548-
+ tokens_per_variant * gsc.GAS_TX_DATA_TOKEN_FLOOR
549-
+ words_per_variant * (gsc.GAS_COPY + gsc.GAS_MEMORY)
548+
+ tokens_per_variant * gsc.TX_DATA_TOKEN_FLOOR
549+
+ words_per_variant * (gsc.OPCODE_COPY_PER_WORD + gsc.MEMORY_PER_WORD)
550550
)
551551
empty_intrinsic = intrinsic_gas_calculator(
552552
calldata=[],
@@ -579,7 +579,7 @@ def test_bls12_pairing_uncachable(
579579
per_tx_gas
580580
- execution_intrinsic
581581
- setup_cost
582-
- math.ceil(len(calldata) / 32) * gsc.GAS_COPY
582+
- math.ceil(len(calldata) / 32) * gsc.OPCODE_COPY_PER_WORD
583583
- mem_exp(new_bytes=len(calldata) + 32)
584584
)
585585

tests/benchmark/compute/precompile/test_identity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def test_identity_uncachable(
8686

8787
precompile_cost = (
8888
# static cost
89-
gsc.GAS_PRECOMPILE_IDENTITY_BASE
89+
gsc.PRECOMPILE_IDENTITY_BASE
9090
# dynamic cost
91-
+ math.ceil(size / 32) * gsc.GAS_PRECOMPILE_IDENTITY_PER_WORD
91+
+ math.ceil(size / 32) * gsc.PRECOMPILE_IDENTITY_PER_WORD
9292
)
9393

9494
attack_block = Op.MSTORE(

tests/benchmark/compute/precompile/test_p256verify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_p256verify_uncachable(
130130
gsc = fork.gas_costs()
131131
intrinsic_gas_calculator = fork.transaction_intrinsic_cost_calculator()
132132

133-
precompile_cost = gsc.GAS_PRECOMPILE_P256VERIFY
133+
precompile_cost = gsc.PRECOMPILE_P256VERIFY
134134

135135
# h: data[0:32] 32 bytes
136136
# r: data[32:64] 32 bytes

tests/benchmark/compute/precompile/test_point_evaluation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_point_evaluation_uncachable(
113113
gsc = fork.gas_costs()
114114
intrinsic_gas_calculator = fork.transaction_intrinsic_cost_calculator()
115115
mem_exp = fork.memory_expansion_gas_calculator()
116-
precompile_cost = gsc.GAS_PRECOMPILE_POINT_EVALUATION
116+
precompile_cost = gsc.PRECOMPILE_POINT_EVALUATION
117117

118118
# Each iteration: STATICCALL point_evaluation at advancing calldata
119119
# offset, then advance offset at MEM[CALLDATASIZE].
@@ -148,8 +148,8 @@ def test_point_evaluation_uncachable(
148148
words_per_variant = math.ceil(INPUT_SIZE / 32)
149149
per_variant_gas = (
150150
iteration_cost
151-
+ INPUT_SIZE * gsc.GAS_TX_DATA_TOKEN_FLOOR
152-
+ words_per_variant * (gsc.GAS_COPY + gsc.GAS_MEMORY)
151+
+ INPUT_SIZE * gsc.TX_DATA_TOKEN_FLOOR
152+
+ words_per_variant * (gsc.OPCODE_COPY_PER_WORD + gsc.MEMORY_PER_WORD)
153153
)
154154
empty_intrinsic = intrinsic_gas_calculator(
155155
calldata=[], return_cost_deducted_prior_execution=True
@@ -193,7 +193,7 @@ def test_point_evaluation_uncachable(
193193
per_tx_gas
194194
- execution_intrinsic
195195
- setup_cost
196-
- math.ceil(len(calldata) / 32) * gsc.GAS_COPY
196+
- math.ceil(len(calldata) / 32) * gsc.OPCODE_COPY_PER_WORD
197197
- mem_exp(new_bytes=len(calldata) + 32)
198198
)
199199

tests/benchmark/compute/precompile/test_ripemd160.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def test_ripemd160_uncachable(
8686

8787
precompile_cost = (
8888
# static cost
89-
gsc.GAS_PRECOMPILE_RIPEMD160_BASE
89+
gsc.PRECOMPILE_RIPEMD160_BASE
9090
# dynamic cost
91-
+ math.ceil(size / 32) * gsc.GAS_PRECOMPILE_RIPEMD160_PER_WORD
91+
+ math.ceil(size / 32) * gsc.PRECOMPILE_RIPEMD160_PER_WORD
9292
)
9393

9494
attack_block = Op.POP(

tests/benchmark/compute/precompile/test_sha256.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def test_sha256_uncachable(
8686

8787
precompile_cost = (
8888
# static cost
89-
gsc.GAS_PRECOMPILE_SHA256_BASE
89+
gsc.PRECOMPILE_SHA256_BASE
9090
# dynamic cost
91-
+ math.ceil(size / 32) * gsc.GAS_PRECOMPILE_SHA256_PER_WORD
91+
+ math.ceil(size / 32) * gsc.PRECOMPILE_SHA256_PER_WORD
9292
)
9393
attack_block = Op.POP(
9494
Op.STATICCALL(

0 commit comments

Comments
 (0)