Skip to content

Commit be06ec7

Browse files
committed
adjustement for filling
Signed-off-by: Ignacio Hagopian <[email protected]>
1 parent 4645bd7 commit be06ec7

File tree

11 files changed

+105
-91
lines changed

11 files changed

+105
-91
lines changed

tests/verkle/eip4762_verkle_gas_witness/test_calls.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ethereum_test_tools import (
1111
Account,
1212
Address,
13+
Alloc,
1314
Block,
1415
Bytecode,
1516
BlockchainTestFiller,
@@ -86,6 +87,7 @@ def test_calls_warm(blockchain_test: BlockchainTestFiller, fork: str, call_instr
8687

8788
# TODO(verkle): update to Osaka when t8n supports the fork.
8889
@pytest.mark.valid_from("Verkle")
90+
@pytest.mark.skip("Pending TBD gas limits")
8991
@pytest.mark.parametrize(
9092
"call_instruction, gas_limit",
9193
[
@@ -159,7 +161,7 @@ def _generic_call(
159161
TestAddress: Account(balance=1000000000000000000000),
160162
TestAddress2: Account(code=Op.ADD(1, 2)),
161163
caller_address: Account(
162-
balance=2000000000000000000000, code=caller_code * 2 if warm else 1
164+
balance=2000000000000000000000, code=caller_code * (2 if warm else 1)
163165
),
164166
precompile_address: Account(balance=3000000000000000000000),
165167
system_contract_address: Account(balance=4000000000000000000000),
@@ -210,9 +212,9 @@ def _generic_call(
210212
"call_instruction, gas_limit, enough_gas_account_creation",
211213
[
212214
(Op.CALL, 100000000, True),
213-
(Op.CALL, 1042, False),
215+
(Op.CALL, 21_042, False),
214216
(Op.CALLCODE, 100000000, True),
215-
(Op.CALLCODE, 1042, False),
217+
(Op.CALLCODE, 21_042, False),
216218
],
217219
)
218220
def test_call_non_existent_account(
@@ -253,10 +255,13 @@ def test_call_non_existent_account(
253255
)
254256
blocks = [Block(txs=[tx])]
255257

258+
post: Alloc = Alloc()
256259
if enough_gas_account_creation:
257-
post = {
258-
TestAddress2: Account(balance=call_value),
259-
}
260+
post = Alloc(
261+
{
262+
TestAddress2: Account(balance=call_value),
263+
}
264+
)
260265

261266
# witness = Witness()
262267
# witness.add_account_full(env.fee_recipient, None)

tests/verkle/eip4762_verkle_gas_witness/test_coinbase_fees.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Transaction,
1919
)
2020

21-
from ..temp_verkle_helpers import Witness
21+
# from ..temp_verkle_helpers import Witness
2222

2323
# TODO(verkle): Update reference spec version
2424
REFERENCE_SPEC_GIT_PATH = "EIPS/eip-4762.md"
@@ -57,15 +57,15 @@ def test_coinbase_fees(blockchain_test: BlockchainTestFiller, fork: str, priorit
5757
# TODO(verkle): change value when filling
5858
post = {} if priority_fee == 0 else {coinbase_addr: Account(balance=0x42)}
5959

60-
witness = Witness()
61-
witness.add_account_full(coinbase_addr, None)
62-
witness.add_account_full(TestAddress, pre[TestAddress])
63-
witness.add_account_full(TestAddress2, pre[TestAddress2])
60+
# witness = Witness()
61+
# witness.add_account_full(coinbase_addr, None)
62+
# witness.add_account_full(TestAddress, pre[TestAddress])
63+
# witness.add_account_full(TestAddress2, pre[TestAddress2])
6464

6565
blockchain_test(
6666
genesis_environment=env,
6767
pre=pre,
6868
post=post,
6969
blocks=blocks,
70-
witness=witness,
70+
# witness=witness,
7171
)

tests/verkle/eip4762_verkle_gas_witness/test_creates.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Block,
1313
BlockchainTestFiller,
1414
Environment,
15+
Opcode,
1516
Bytecode,
1617
Initcode,
1718
TestAddress,
@@ -57,7 +58,7 @@
5758
],
5859
)
5960
def test_create(
60-
blockchain_test: BlockchainTestFiller, fork: str, create_instruction, value, code_size
61+
blockchain_test: BlockchainTestFiller, fork: str, create_instruction: Opcode, value, code_size
6162
):
6263
"""
6364
Test tx contract creation and *CREATE witness.
@@ -71,12 +72,12 @@ def test_create(
7172
)
7273

7374
num_code_chunks = (len(contract_code) + 30) // 31
74-
code_chunks = vkt_chunkify(contract_code.bytecode)
75+
code_chunks = vkt_chunkify(contract_code)
7576

7677
witness_extra = Witness()
77-
witness_extra.add_account_full(contract_address, None)
78-
for i in range(num_code_chunks):
79-
witness_extra.add_code_chunk(contract_address, i, code_chunks[i])
78+
# witness_extra.add_account_full(contract_address, None)
79+
# for i in range(num_code_chunks):
80+
# witness_extra.add_code_chunk(contract_address, i, code_chunks[i])
8081

8182
_create(
8283
blockchain_test,
@@ -90,6 +91,7 @@ def test_create(
9091

9192
# TODO(verkle): update to Osaka when t8n supports the fork.
9293
@pytest.mark.valid_from("Verkle")
94+
@pytest.mark.skip("Pending TBD gas limits")
9395
@pytest.mark.parametrize(
9496
"create_instruction",
9597
[
@@ -157,6 +159,7 @@ def test_create_insufficient_gas(
157159

158160
# TODO(verkle): update to Osaka when t8n supports the fork.
159161
@pytest.mark.valid_from("Verkle")
162+
@pytest.mark.skip("Pending TBD gas limits")
160163
@pytest.mark.parametrize(
161164
"create_instruction, gas_limit",
162165
[
@@ -258,7 +261,7 @@ def test_big_calldata(
258261
def _create(
259262
blockchain_test: BlockchainTestFiller,
260263
fork: str,
261-
create_instruction,
264+
create_instruction: Opcode | None,
262265
witness_extra: Witness,
263266
contract_code,
264267
value=1,
@@ -280,7 +283,7 @@ def _create(
280283
deploy_code = Initcode(
281284
initcode_prefix=Op.STOP if initcode_stop_prefix else Bytecode(), deploy_code=contract_code
282285
)
283-
if create_instruction == Op.CREATE:
286+
if create_instruction is not None and create_instruction.int() == Op.CREATE.int():
284287
pre[TestAddress2] = Account(
285288
code=Op.CALLDATACOPY(0, 0, len(deploy_code)) + Op.CREATE(value, 0, len(deploy_code))
286289
)
@@ -290,7 +293,7 @@ def _create(
290293
if generate_collision:
291294
contract_address = compute_create_address(TestAddress, 0)
292295
pre[contract_address] = Account(nonce=1)
293-
elif create_instruction == Op.CREATE2:
296+
elif create_instruction is not None and create_instruction.int() == Op.CREATE2.int():
294297
pre[TestAddress2] = Account(
295298
code=Op.CALLDATACOPY(0, 0, len(deploy_code))
296299
+ Op.CREATE2(value, 0, len(deploy_code), 0xDEADBEEF)
@@ -321,17 +324,17 @@ def _create(
321324
)
322325
blocks = [Block(txs=[tx])]
323326

324-
witness = Witness()
325-
witness.add_account_full(env.fee_recipient, None)
326-
witness.add_account_full(TestAddress, pre[TestAddress])
327-
if tx_target is not None:
328-
witness.add_account_full(tx_target, pre[tx_target])
329-
witness.merge(witness_extra)
327+
# witness = Witness()
328+
# witness.add_account_full(env.fee_recipient, None)
329+
# witness.add_account_full(TestAddress, pre[TestAddress])
330+
# if tx_target is not None:
331+
# witness.add_account_full(tx_target, pre[tx_target])
332+
# witness.merge(witness_extra)
330333

331334
blockchain_test(
332335
genesis_environment=env,
333336
pre=pre,
334337
post={},
335338
blocks=blocks,
336-
witness=witness,
339+
# witness=witness,
337340
)

tests/verkle/eip4762_verkle_gas_witness/test_extcodehash.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def test_extcodehash_warm(blockchain_test: BlockchainTestFiller, fork: str):
8686

8787
# TODO(verkle): update to Osaka when t8n supports the fork.
8888
@pytest.mark.valid_from("Verkle")
89+
@pytest.mark.skip("Pending TBD gas limits")
8990
@pytest.mark.parametrize(
9091
"gas_limit, witness_assert_basic_data, witness_assert_codehash",
9192
[
@@ -155,16 +156,16 @@ def _extcodehash(
155156
# TODO(verkle): assign correct storage slot value when filling
156157
post[TestAddress2] = Account(code=pre[TestAddress2].code, storage={0: 0x424242})
157158

158-
witness = Witness()
159-
witness.add_account_full(env.fee_recipient, None)
160-
witness.add_account_full(TestAddress, pre[TestAddress])
161-
witness.add_account_full(TestAddress2, pre[TestAddress2])
162-
witness.merge(extra_witness)
159+
# witness = Witness()
160+
# witness.add_account_full(env.fee_recipient, None)
161+
# witness.add_account_full(TestAddress, pre[TestAddress])
162+
# witness.add_account_full(TestAddress2, pre[TestAddress2])
163+
# witness.merge(extra_witness)
163164

164165
blockchain_test(
165166
genesis_environment=env,
166167
pre=pre,
167168
post=post,
168169
blocks=blocks,
169-
witness=witness,
170+
# witness=witness,
170171
)

tests/verkle/eip4762_verkle_gas_witness/test_extcodesize.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_extcodesize_insufficient_gas(blockchain_test: BlockchainTestFiller, for
7474
TestAddress2,
7575
Op.PUSH0 * 1000,
7676
Witness(),
77-
gas_limit=1_042,
77+
gas_limit=53_540,
7878
fails=True,
7979
)
8080

@@ -134,15 +134,15 @@ def _extcodesize(
134134
contract_address = compute_create_address(TestAddress, tx.nonce)
135135
post[contract_address] = Account(storage={0: len(bytecode)})
136136

137-
witness = Witness()
138-
witness.add_account_full(env.fee_recipient, None)
139-
witness.add_account_full(TestAddress, pre[TestAddress])
140-
witness.merge(extra_witness)
137+
# witness = Witness()
138+
# witness.add_account_full(env.fee_recipient, None)
139+
# witness.add_account_full(TestAddress, pre[TestAddress])
140+
# witness.merge(extra_witness)
141141

142142
blockchain_test(
143143
genesis_environment=env,
144144
pre=pre,
145145
post={},
146146
blocks=blocks,
147-
witness=witness,
147+
# witness=witness,
148148
)

tests/verkle/eip4762_verkle_gas_witness/test_selfdestruct.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from ethereum_test_tools import (
1111
Account,
12+
Alloc,
1213
Address,
1314
Block,
1415
BlockchainTestFiller,
@@ -76,6 +77,7 @@ def test_self_destruct(
7677

7778
# TODO(verkle): update to Osaka when t8n supports the fork.
7879
@pytest.mark.valid_from("Verkle")
80+
@pytest.mark.skip("TBD gas limit")
7981
@pytest.mark.parametrize(
8082
"gas_limit, beneficiary_must_exist, beneficiary_add_basic_data, beneficiary_add_codehash",
8183
[
@@ -152,15 +154,16 @@ def _selfdestruct(
152154
)
153155
blocks = [Block(txs=[tx])]
154156

155-
witness = Witness()
156-
witness.add_account_full(env.fee_recipient, None)
157-
witness.add_account_full(TestAddress, pre[TestAddress])
158-
witness.add_account_full(TestAddress2, pre[TestAddress2])
159-
if beneficiary_add_basic_data:
160-
witness.add_account_basic_data(beneficiary, pre.get(beneficiary))
161-
if beneficiary_add_codehash:
162-
witness.add_account_codehash(beneficiary, None)
157+
# witness = Witness()
158+
# witness.add_account_full(env.fee_recipient, None)
159+
# witness.add_account_full(TestAddress, pre[TestAddress])
160+
# witness.add_account_full(TestAddress2, pre[TestAddress2])
161+
# if beneficiary_add_basic_data:
162+
# witness.add_account_basic_data(beneficiary, pre.get(beneficiary))
163+
# if beneficiary_add_codehash:
164+
# witness.add_account_codehash(beneficiary, None)
163165

166+
post: Alloc = {}
164167
if not fail and contract_balance > 0 and beneficiary != TestAddress2:
165168
beneficiary_account = pre.get(beneficiary)
166169
beneficiary_balance = 0 if beneficiary_account is None else beneficiary_account.balance
@@ -175,5 +178,5 @@ def _selfdestruct(
175178
pre=pre,
176179
post=post,
177180
blocks=blocks,
178-
witness=witness,
181+
# witness=witness,
179182
)

tests/verkle/eip4762_verkle_gas_witness/test_sload.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_sload_insufficient_gas(blockchain_test: BlockchainTestFiller, fork: str
7070
for slot in [1000, 1001]:
7171
witness.add_storage_slot(TestAddress2, slot, TestAddress2Storage.get(slot))
7272

73-
_sload(blockchain_test, fork, [1000, 1001, 1002, 1003], witness, gas_limit=1_024)
73+
_sload(blockchain_test, fork, [1000, 1001, 1002, 1003], witness, gas_limit=21_024)
7474

7575

7676
def _sload(
@@ -109,16 +109,16 @@ def _sload(
109109
)
110110
blocks = [Block(txs=[tx])]
111111

112-
witness = Witness()
113-
witness.add_account_full(env.fee_recipient, None)
114-
witness.add_account_full(TestAddress, pre[TestAddress])
115-
witness.add_account_full(TestAddress2, pre[TestAddress2])
116-
witness.merge(extra_witness)
112+
# witness = Witness()
113+
# witness.add_account_full(env.fee_recipient, None)
114+
# witness.add_account_full(TestAddress, pre[TestAddress])
115+
# witness.add_account_full(TestAddress2, pre[TestAddress2])
116+
# witness.merge(extra_witness)
117117

118118
blockchain_test(
119119
genesis_environment=env,
120120
pre=pre,
121121
post={},
122122
blocks=blocks,
123-
witness=witness,
123+
# witness=witness,
124124
)

tests/verkle/eip4762_verkle_gas_witness/test_sstore.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def test_sstore(blockchain_test: BlockchainTestFiller, fork: str, storage_slot_w
6666

6767
# TODO(verkle): update to Osaka when t8n supports the fork.
6868
@pytest.mark.valid_from("Verkle")
69+
@pytest.mark.skip("TBD gas limit")
6970
@pytest.mark.parametrize(
7071
"gas_limit, must_be_in_witness",
7172
[
@@ -150,16 +151,16 @@ def _sstore(
150151
),
151152
}
152153

153-
witness = Witness()
154-
witness.add_account_full(env.fee_recipient, None)
155-
witness.add_account_full(TestAddress, pre[TestAddress])
156-
witness.add_account_full(TestAddress2, pre[TestAddress2])
157-
witness.merge(extra_witness)
154+
# witness = Witness()
155+
# witness.add_account_full(env.fee_recipient, None)
156+
# witness.add_account_full(TestAddress, pre[TestAddress])
157+
# witness.add_account_full(TestAddress2, pre[TestAddress2])
158+
# witness.merge(extra_witness)
158159

159160
blockchain_test(
160161
genesis_environment=env,
161162
pre=pre,
162163
post=post,
163164
blocks=blocks,
164-
witness=witness,
165+
# witness=witness,
165166
)

tests/verkle/eip4762_verkle_gas_witness/test_transfer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,16 @@ def test_transfer(blockchain_test: BlockchainTestFiller, fork: str, target, valu
7878
target: post_account,
7979
}
8080

81-
witness = Witness()
82-
witness.add_account_full(env.fee_recipient, None)
83-
witness.add_account_full(TestAddress, pre[TestAddress])
84-
if target != precompile_address and target != system_contract_address:
85-
witness.add_account_full(target, pre.get(target))
81+
# witness = Witness()
82+
# witness.add_account_full(env.fee_recipient, None)
83+
# witness.add_account_full(TestAddress, pre[TestAddress])
84+
# if target != precompile_address and target != system_contract_address:
85+
# witness.add_account_full(target, pre.get(target))
8686

8787
blockchain_test(
8888
genesis_environment=env,
8989
pre=pre,
9090
post=post,
9191
blocks=blocks,
92-
witness=witness,
92+
# witness=witness,
9393
)

0 commit comments

Comments
 (0)