Skip to content

Commit

Permalink
bump addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed May 14, 2024
1 parent 50c6601 commit 6bc738e
Show file tree
Hide file tree
Showing 27 changed files with 141 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_modexp(state_test: StateTestFiller, input: ModExpInput, output: Expecte
env = Environment()
pre = {TestAddress: Account(balance=1000000000000000000000)}

account = Address(0x100)
account = Address(0x1000)

pre[account] = Account(
code=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

pytestmark = [pytest.mark.valid_from("Cancun")]

code_address = 0x100
code_address = 0xC0DE


def test_transient_storage_unset_values(state_test: StateTestFiller):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
pytestmark = [pytest.mark.valid_from("Cancun")]

# the address that creates the contract with create/create2
creator_address = 0x100
creator_address = 0x1000


@unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
pytestmark = [pytest.mark.valid_from("Cancun")]

# Address used to call the test bytecode on every test case.
caller_address = 0x100
caller_address = 0x1000

# Address of the callee contract
callee_address = 0x200
callee_address = 0x2000

PUSH_OPCODE_COST = 3

Expand Down Expand Up @@ -143,7 +143,7 @@ def __new__(cls, name, bases, classdict): # noqa: D102
+ Op.SSTORE(1, Op.TLOAD(0))
+ Op.SSTORE(2, Op.TLOAD(1))
),
"callee_bytecode": Op.TSTORE(1),
"callee_bytecode": Op.TSTORE(1, unchecked=True),
"expected_caller_storage": {0: 0, 1: 420, 2: 420},
"expected_callee_storage": {},
}
Expand Down Expand Up @@ -182,13 +182,9 @@ def __new__(cls, name, bases, classdict): # noqa: D102

gas_limit = Spec.TSTORE_GAS_COST + (PUSH_OPCODE_COST * 2) - 1
if opcode == Op.DELEGATECALL:
contract_call = opcode(
opcode(gas_limit, callee_address, 0, 0, 0, 0),
)
contract_call = opcode(gas_limit, callee_address, 0, 0, 0, 0)
elif opcode in [Op.CALL, Op.CALLCODE]:
contract_call = opcode(
opcode(gas_limit, callee_address, 0, 0, 0, 0, 0),
)
contract_call = opcode(gas_limit, callee_address, 0, 0, 0, 0, 0)
else:
raise ValueError("Unexpected opcode.")
classdict[f"{opcode._name_}_WITH_OUT_OF_GAS"] = {
Expand All @@ -199,18 +195,7 @@ def __new__(cls, name, bases, classdict): # noqa: D102
"caller_bytecode": (
Op.TSTORE(0, 420)
+ Op.TSTORE(1, 420)
+ Op.SSTORE(
0,
opcode(
Spec.TSTORE_GAS_COST + (PUSH_OPCODE_COST * 2) - 1,
callee_address,
0,
0,
0,
0,
0,
),
)
+ Op.SSTORE(0, contract_call)
+ Op.SSTORE(1, Op.TLOAD(0))
+ Op.SSTORE(2, Op.TLOAD(1))
),
Expand Down Expand Up @@ -286,7 +271,9 @@ class CallContextTestCases(PytestParameterEnum, metaclass=DynamicCallContextTest
+ Op.SSTORE(0, Op.STATICCALL(0xFFFF, callee_address, 0, 0, 0, 0)) # limit gas
+ Op.SSTORE(1, Op.TLOAD(0))
),
"callee_bytecode": Op.TSTORE(0), # calling with stack underflow still fails
"callee_bytecode": Op.TSTORE(
0, unchecked=True
), # calling with stack underflow still fails
"expected_caller_storage": {0: 0, 1: 420},
"expected_callee_storage": {},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
pytestmark = [pytest.mark.valid_from("Cancun")]

# Address of the callee contract
callee_address = 0x200
callee_address = 0x2000

SETUP_CONDITION: bytes = Op.EQ(Op.CALLDATALOAD(0), 0x01)
REENTRANT_CALL: bytes = Op.MSTORE(0, 2) + Op.SSTORE(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
pytestmark = [pytest.mark.valid_from("Cancun")]

# Addresses
caller_address = 0x100
copy_from_initcode_address = 0x200
caller_address = 0x1000
copy_from_initcode_address = 0x2000
callee_address = compute_create_address(caller_address, 1)

CREATE_CODE = Op.EXTCODECOPY(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def call_gas() -> int: # noqa: D103

@pytest.fixture
def caller_address() -> Address: # noqa: D103
return Address(0x100)
return Address(0x1000)


@pytest.fixture
Expand Down
21 changes: 11 additions & 10 deletions src/GeneralStateTestsFiller/Pyspecs/cancun/eip4844_blobs/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Common constants, classes & functions local to EIP-4844 tests.
"""

from dataclasses import dataclass
from typing import List, Literal, Tuple, Union

Expand Down Expand Up @@ -100,14 +101,14 @@ class BlobhashContext:

yul_compiler: Union[YulCompiler, None] = None
addresses = {
"blobhash_sstore": Address(0x100),
"blobhash_return": Address(0x600),
"call": Address(0x200),
"delegatecall": Address(0x300),
"callcode": Address(0x800),
"staticcall": Address(0x700),
"create": Address(0x400),
"create2": Address(0x500),
"blobhash_sstore": Address(0x1000),
"blobhash_return": Address(0x6000),
"call": Address(0x2000),
"delegatecall": Address(0x3000),
"callcode": Address(0x8000),
"staticcall": Address(0x7000),
"create": Address(0x4000),
"create2": Address(0x5000),
}

@staticmethod
Expand Down Expand Up @@ -173,15 +174,15 @@ def code(cls, context_name):
"""
{
calldatacopy(0, 0, calldatasize())
pop(call(gas(), 0x100, 0, 0, calldatasize(), 0, 0))
pop(call(gas(), 0x1000, 0, 0, calldatasize(), 0, 0))
}
""" # noqa: E272, E201, E202
),
"delegatecall": cls.yul_compiler(
"""
{
calldatacopy(0, 0, calldatasize())
pop(delegatecall(gas(), 0x100, 0, calldatasize(), 0, 0))
pop(delegatecall(gas(), 0x1000, 0, calldatasize(), 0, 0))
}
""" # noqa: E272, E201, E202
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Pytest (plugin) definitions local to EIP-4844 tests.
"""

import pytest

from ethereum_test_tools import Address, Block, Hash, TestPrivateKey2, Transaction, add_kzg_version
Expand Down Expand Up @@ -41,7 +42,7 @@ def non_zero_blob_gas_used_genesis_block(
Transaction(
ty=Spec.BLOB_TX_TYPE,
nonce=0,
to=Address(0x200),
to=Address(0x2000),
value=1,
gas_limit=21000,
max_fee_per_gas=tx_max_fee_per_gas,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
@pytest.fixture
def destination_account() -> Address:
"""Default destination account for the blob transactions."""
return Address(0x100)
return Address(0x1000)


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Test full blob type transactions for [EIP-4844: Shard Blob Transactions](https://eips.ethereum.org/EIPS/eip-4844).
""" # noqa: E501

from typing import Dict, List, Optional

import pytest
Expand Down Expand Up @@ -30,7 +31,7 @@
@pytest.fixture
def destination_account() -> Address:
"""Default destination account for the blob transactions."""
return Address(0x100)
return Address(0x1000)


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,36 +287,36 @@ def test_blobhash_multiple_txs_in_block(
**pre,
**{
Address(address): Account(code=blobhash_bytecode)
for address in range(0x100, 0x500, 0x100)
for address in range(0x1000, 0x5000, 0x1000)
},
}
blocks = [
Block(
txs=[
blob_tx(address=Address(0x100), type=3, nonce=0),
blob_tx(address=Address(0x100), type=2, nonce=1),
blob_tx(address=Address(0x1000), type=3, nonce=0),
blob_tx(address=Address(0x1000), type=2, nonce=1),
]
),
Block(
txs=[
blob_tx(address=Address(0x200), type=2, nonce=2),
blob_tx(address=Address(0x200), type=3, nonce=3),
blob_tx(address=Address(0x2000), type=2, nonce=2),
blob_tx(address=Address(0x2000), type=3, nonce=3),
]
),
Block(
txs=[
blob_tx(address=Address(0x300), type=2, nonce=4),
blob_tx(address=Address(0x400), type=3, nonce=5),
blob_tx(address=Address(0x3000), type=2, nonce=4),
blob_tx(address=Address(0x4000), type=3, nonce=5),
],
),
]
post = {
Address(address): Account(
storage={i: random_blob_hashes[i] for i in range(SpecHelpers.max_blobs_per_block())}
)
if address in (0x200, 0x400)
if address in (0x2000, 0x4000)
else Account(storage={i: 0 for i in range(SpecHelpers.max_blobs_per_block())})
for address in range(0x100, 0x500, 0x100)
for address in range(0x1000, 0x5000, 0x1000)
}
blockchain_test(
pre=pre,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def destination_account_bytecode() -> bytes: # noqa: D103

@pytest.fixture
def destination_account() -> Address: # noqa: D103
return Address(0x100)
return Address(0x1000)


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def blob_count_per_block() -> int:

@pytest.fixture
def destination_account() -> Address: # noqa: D103
return Address(0x100)
return Address(0x1000)


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
cases.
""" # noqa: E501

import glob
import json
import os
Expand Down Expand Up @@ -157,7 +158,7 @@ def precompile_caller_address() -> Address:
"""
Address of the precompile caller account.
"""
return Address(0x100)
return Address(0x1000)


@pytest.fixture
Expand Down Expand Up @@ -589,7 +590,7 @@ def test_point_evaluation_precompile_before_fork(
0,
),
)
precompile_caller_address = Address(0x100)
precompile_caller_address = Address(0x1000)

pre = {
TestAddress: Account(
Expand Down Expand Up @@ -648,7 +649,7 @@ def test_point_evaluation_precompile_during_fork(
0,
),
)
precompile_caller_address = Address(0x100)
precompile_caller_address = Address(0x1000)

pre = {
TestAddress: Account(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Test gas usage on point evaluation precompile for [EIP-4844: Shard Blob Transactions](https://eips.ethereum.org/EIPS/eip-4844).
""" # noqa: E501

from typing import Dict, Literal

import pytest
Expand Down Expand Up @@ -128,7 +129,7 @@ def precompile_caller_address() -> Address:
"""
Address of the precompile caller account.
"""
return Address(0x100)
return Address(0x1000)


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Test copy operations of [EIP-5656: MCOPY - Memory copying instruction](https://eips.ethereum.org/EIPS/eip-5656)
""" # noqa: E501

from typing import Mapping, Tuple

import pytest
Expand All @@ -21,7 +22,7 @@
from .common import REFERENCE_SPEC_GIT_PATH, REFERENCE_SPEC_VERSION, mcopy

# Code address used to call the test bytecode on every test case.
code_address = 0x100
code_address = 0xC0DE

REFERENCE_SPEC_GIT_PATH = REFERENCE_SPEC_GIT_PATH
REFERENCE_SPEC_VERSION = REFERENCE_SPEC_VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Test memory copy under different call contexts [EIP-5656: MCOPY - Memory copying instruction](https://eips.ethereum.org/EIPS/eip-5656)
""" # noqa: E501

from itertools import cycle, islice
from typing import List, Mapping, Tuple

Expand All @@ -21,10 +22,10 @@
from .common import REFERENCE_SPEC_GIT_PATH, REFERENCE_SPEC_VERSION

# Code address used to call the test bytecode on every test case.
code_address = 0x100
code_address = 0xC0DE

# Code address of the callee contract
callee_address = 0x200
callee_address = 0x2000


REFERENCE_SPEC_GIT_PATH = REFERENCE_SPEC_GIT_PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
that produce a memory expansion, and potentially an out-of-gas error.
""" # noqa: E501

from typing import Mapping, Tuple

import pytest
Expand All @@ -21,10 +22,10 @@
from .common import REFERENCE_SPEC_GIT_PATH, REFERENCE_SPEC_VERSION

# Code address used to call the test bytecode on every test case.
caller_address = 0x100
caller_address = 0x1000

# Code address used to perform the memory expansion.
memory_expansion_address = 0x200
memory_expansion_address = 0x2000

REFERENCE_SPEC_GIT_PATH = REFERENCE_SPEC_GIT_PATH
REFERENCE_SPEC_VERSION = REFERENCE_SPEC_VERSION
Expand Down
Loading

0 comments on commit 6bc738e

Please sign in to comment.