Skip to content

test_data_section_succeed()

Documentation for tests/osaka/eip7692_eof_v1/eip7480_data_section/test_data_opcodes.py::test_data_section_succeed@83970623.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip7480_data_section/test_data_opcodes.py::test_data_section_succeed --fork Osaka

Test simple contracts that simply expect data section to succeed.

Source code in tests/osaka/eip7692_eof_v1/eip7480_data_section/test_data_opcodes.py
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
@pytest.mark.parametrize(
    ["offset", "datasize"],
    [
        pytest.param(0, 0, id="empty_zero"),
        pytest.param(0, 2, id="short_zero"),
        pytest.param(0, 32, id="exact_zero"),
        pytest.param(0, 64, id="large_zero"),
        pytest.param(32, 0, id="empty_32"),
        pytest.param(32, 34, id="short_32"),
        pytest.param(32, 64, id="exact_32"),
        pytest.param(32, 96, id="large_32"),
        pytest.param(0x5BFE, 0, id="empty_23k"),
        pytest.param(0x5BFE, 0x5C00, id="short_23k"),
        pytest.param(0x5BE0, 0x5D00, id="exact_23k"),
        pytest.param(0x2345, 0x5C00, id="large_23k"),
        pytest.param(2**16 - 1, 32, id="u16_max"),
        pytest.param(2**16, 32, id="u16_max_plus_1"),
        pytest.param(2**32 - 1, 32, id="u32_max"),
        pytest.param(2**32, 32, id="u32_max_plus_1"),
        pytest.param(2**64 - 1, 32, id="u64_max"),
        pytest.param(2**64, 32, id="u64_max_plus_1"),
    ],
)
def test_data_section_succeed(
    state_test: StateTestFiller,
    pre: Alloc,
    offset: int,
    datasize: int,
):
    """Test simple contracts that simply expect data section to succeed."""
    env = Environment()

    (container, expected_storage) = create_data_test(offset, datasize)
    callee_contract = pre.deploy_contract(code=container)
    entry_point = pre.deploy_contract(
        code=Op.SSTORE(0, Op.DELEGATECALL(Op.GAS, callee_contract, 0, 0, 0, 0)) + Op.STOP()
    )
    sender = pre.fund_eoa()

    tx = Transaction(
        to=entry_point,
        gas_limit=50000000,
        gas_price=10,
        protected=False,
        data="",
        sender=sender,
    )

    post = {entry_point: Account(storage=expected_storage)}

    state_test(
        env=env,
        pre=pre,
        post=post,
        tx=tx,
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) offset datasize
...fork_Osaka-blockchain_test-empty_zero 0 0
...fork_Osaka-blockchain_test-short_zero 0 2
...fork_Osaka-blockchain_test-exact_zero 0 32
...fork_Osaka-blockchain_test-large_zero 0 64
...fork_Osaka-blockchain_test-empty_32 32 0
...fork_Osaka-blockchain_test-short_32 32 34
...fork_Osaka-blockchain_test-exact_32 32 64
...fork_Osaka-blockchain_test-large_32 32 96
...fork_Osaka-blockchain_test-empty_23k 23550 0
...fork_Osaka-blockchain_test-short_23k 23550 23552
...fork_Osaka-blockchain_test-exact_23k 23520 23808
...fork_Osaka-blockchain_test-large_23k 9029 23552
...fork_Osaka-blockchain_test-u16_max 65535 32
...fork_Osaka-blockchain_test-u16_max_plus_1 65536 32
...fork_Osaka-blockchain_test-u32_max 4294967295 32
...fork_Osaka-blockchain_test-u32_max_plus_1 4294967296 32
...fork_Osaka-blockchain_test-u64_max 18446744073709551615 32
...fork_Osaka-blockchain_test-u64_max_plus_1 18446744073709551616 32
...fork_Osaka-state_test-empty_zero 0 0
...fork_Osaka-state_test-short_zero 0 2
...fork_Osaka-state_test-exact_zero 0 32
...fork_Osaka-state_test-large_zero 0 64
...fork_Osaka-state_test-empty_32 32 0
...fork_Osaka-state_test-short_32 32 34
...fork_Osaka-state_test-exact_32 32 64
...fork_Osaka-state_test-large_32 32 96
...fork_Osaka-state_test-empty_23k 23550 0
...fork_Osaka-state_test-short_23k 23550 23552
...fork_Osaka-state_test-exact_23k 23520 23808
...fork_Osaka-state_test-large_23k 9029 23552
...fork_Osaka-state_test-u16_max 65535 32
...fork_Osaka-state_test-u16_max_plus_1 65536 32
...fork_Osaka-state_test-u32_max 4294967295 32
...fork_Osaka-state_test-u32_max_plus_1 4294967296 32
...fork_Osaka-state_test-u64_max 18446744073709551615 32
...fork_Osaka-state_test-u64_max_plus_1 18446744073709551616 32