Skip to content

Commit 47b0067

Browse files
committed
put args_size and sha3_len in contract
1 parent b07e05c commit 47b0067

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

tests/frontier/opcodes/test_calldatasize.py

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@
1010
@pytest.mark.parametrize(
1111
"args_size,sha3_len,storage",
1212
[
13-
("0002", "01", 0x02),
14-
("0011", "01", 0x11),
15-
("0021", "01", 0x21),
16-
("0031", "01", 0x31),
17-
("0101", "01", 0x101),
18-
("0002", "02", 0x02),
19-
("0011", "02", 0x11),
20-
("0021", "02", 0x21),
21-
("0031", "02", 0x31),
22-
("0101", "02", 0x101),
23-
("0002", "03", 0x02),
24-
("0011", "03", 0x11),
25-
("0021", "03", 0x21),
26-
("0031", "03", 0x31),
27-
("0101", "03", 0x101),
28-
("0002", "04", 0x02),
29-
("0011", "04", 0x11),
30-
("0021", "04", 0x21),
31-
("0031", "04", 0x31),
32-
("0101", "04", 0x101),
13+
(0x0002, 0x01, 0x02),
14+
(0x0011, 0x01, 0x11),
15+
(0x0021, 0x01, 0x21),
16+
(0x0031, 0x01, 0x31),
17+
(0x0101, 0x01, 0x101),
18+
(0x0002, 0x02, 0x02),
19+
(0x0011, 0x02, 0x11),
20+
(0x0021, 0x02, 0x21),
21+
(0x0031, 0x02, 0x31),
22+
(0x0101, 0x02, 0x101),
23+
(0x0002, 0x03, 0x02),
24+
(0x0011, 0x03, 0x11),
25+
(0x0021, 0x03, 0x21),
26+
(0x0031, 0x03, 0x31),
27+
(0x0101, 0x03, 0x101),
28+
(0x0002, 0x04, 0x02),
29+
(0x0011, 0x04, 0x11),
30+
(0x0021, 0x04, 0x21),
31+
(0x0031, 0x04, 0x31),
32+
(0x0101, 0x04, 0x101),
3333
],
3434
ids=[
3535
"data1_2",
@@ -57,8 +57,8 @@
5757
def test_calldataload(
5858
state_test: StateTestFiller,
5959
fork: Fork,
60-
args_size: str,
61-
sha3_len: str,
60+
args_size: int,
61+
sha3_len: int,
6262
pre: Alloc,
6363
storage: Account,
6464
):
@@ -71,22 +71,20 @@ def test_calldataload(
7171

7272
to = pre.deploy_contract(
7373
code=(
74-
Op.MSTORE(offset=0x0, value=Op.SHA3(offset=0x0, size=Op.CALLDATALOAD(offset=0x24)))
74+
Op.MSTORE(offset=0x0, value=Op.SHA3(offset=0x0, size=sha3_len))
7575
+ Op.CALL(
7676
gas=Op.SUB(Op.GAS(), 0x100),
7777
address=address,
7878
value=0x0,
7979
args_offset=0x0,
80-
args_size=Op.CALLDATALOAD(offset=0x4),
80+
args_size=args_size,
8181
ret_offset=0x0,
8282
ret_size=0x0,
8383
)
8484
)
8585
)
86-
tx_data = bytes.fromhex("1a8451e6" + "00" * 30 + args_size + "00" * 31 + sha3_len)
8786

8887
tx = Transaction(
89-
data=tx_data,
9088
gas_limit=100_000,
9189
protected=fork >= Byzantium,
9290
sender=pre.fund_eoa(),

0 commit comments

Comments
 (0)