Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eth/chains/goerli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
from eth_utils import decode_hex

from .constants import (
ISTANBUL_GOERLI_BLOCK,
PETERSBURG_GOERLI_BLOCK,
)

from eth import constants

from eth.rlp.headers import BlockHeader
from eth.vm.forks import (
IstanbulVM,
PetersburgVM,
)

GOERLI_VM_CONFIGURATION = (
(PETERSBURG_GOERLI_BLOCK, PetersburgVM),
(ISTANBUL_GOERLI_BLOCK, IstanbulVM),
)


Expand Down
2 changes: 2 additions & 0 deletions eth/chains/goerli/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
# Petersburg
#
PETERSBURG_GOERLI_BLOCK = BlockNumber(0)

ISTANBUL_GOERLI_BLOCK = BlockNumber(1561651)
4 changes: 4 additions & 0 deletions eth/chains/mainnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .constants import (
MAINNET_CHAIN_ID,
BYZANTIUM_MAINNET_BLOCK,
ISTANBUL_MAINNET_BLOCK,
PETERSBURG_MAINNET_BLOCK,
TANGERINE_WHISTLE_MAINNET_BLOCK,
HOMESTEAD_MAINNET_BLOCK,
Expand All @@ -34,6 +35,7 @@
ByzantiumVM,
FrontierVM,
HomesteadVM,
IstanbulVM,
PetersburgVM,
SpuriousDragonVM,
TangerineWhistleVM,
Expand Down Expand Up @@ -80,6 +82,7 @@ class MainnetHomesteadVM(MainnetDAOValidatorVM):
SPURIOUS_DRAGON_MAINNET_BLOCK,
BYZANTIUM_MAINNET_BLOCK,
PETERSBURG_MAINNET_BLOCK,
ISTANBUL_MAINNET_BLOCK,
)
MAINNET_VMS = (
FrontierVM,
Expand All @@ -88,6 +91,7 @@ class MainnetHomesteadVM(MainnetDAOValidatorVM):
SpuriousDragonVM,
ByzantiumVM,
PetersburgVM,
IstanbulVM,
)

MAINNET_VM_CONFIGURATION = tuple(zip(MAINNET_FORK_BLOCKS, MAINNET_VMS))
Expand Down
2 changes: 2 additions & 0 deletions eth/chains/mainnet/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@
# Petersburg Block
#
PETERSBURG_MAINNET_BLOCK = BlockNumber(7280000)

ISTANBUL_MAINNET_BLOCK = BlockNumber(9069000)
1 change: 1 addition & 0 deletions newsfragments/1839.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Istanbul block number to chain configuration for Mainnet and Goerli
10 changes: 5 additions & 5 deletions scripts/benchmark/checks/deploy_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
)

FIRST_TX_GAS_LIMIT = 367724
SECOND_TX_GAS_LIMIT = 62050
THIRD_TX_GAS_LIMIT = 104789
SECOND_TX_GAS_LIMIT = 120000
THIRD_TX_GAS_LIMIT = 200000
FORTH_TX_GAS_LIMIT = 21272
FIFTH_TX_GAS_LIMIT = 21272

Expand Down Expand Up @@ -153,7 +153,7 @@ def deploy_dos_contract(self, chain: MiningChain) -> None:
block, receipt, computation = chain.apply_transaction(tx)
self.deployed_contract_address = computation.msg.storage_address

assert computation.is_success
computation.raise_if_error()

# Interact with the deployed contract by calling the totalSupply() API ?????
self.dos_contract = self.w3.eth.contract(
Expand All @@ -176,7 +176,7 @@ def sstore_uint64(self, chain: MiningChain) -> None:

block, receipt, computation = chain.apply_transaction(tx2)

assert computation.is_success
computation.raise_if_error()

def create_empty_contract(self, chain: MiningChain) -> None:
w3_tx3 = self.dos_contract.functions.createEmptyContract().buildTransaction(W3_TX_DEFAULTS)
Expand All @@ -193,7 +193,7 @@ def create_empty_contract(self, chain: MiningChain) -> None:

block, receipt, computation = chain.apply_transaction(tx3)

assert computation.is_success
computation.raise_if_error()

def sstore_uint64_revert(self, chain: MiningChain) -> None:
w3_tx4 = self.dos_contract.functions.storageEntropyRevert().buildTransaction(W3_TX_DEFAULTS)
Expand Down
12 changes: 8 additions & 4 deletions scripts/benchmark/checks/erc20_interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def _deploy_simple_token(self, chain: MiningChain) -> None:
# Keep track of deployed contract address
self.deployed_contract_address = computation.msg.storage_address

assert computation.is_success
computation.raise_if_error()

# Keep track of simple_token object
self.simple_token = self.w3.eth.contract(
address=Web3.toChecksumAddress(encode_hex(self.deployed_contract_address)),
Expand All @@ -174,7 +175,8 @@ def _erc_transfer(self, addr: str, chain: MiningChain) -> None:

block, receipt, computation = chain.apply_transaction(tx)

assert computation.is_success
computation.raise_if_error()

assert to_int(computation.output) == 1

def _erc_approve(self, addr2: str, chain: MiningChain) -> None:
Expand All @@ -195,7 +197,8 @@ def _erc_approve(self, addr2: str, chain: MiningChain) -> None:

block, receipt, computation = chain.apply_transaction(tx)

assert computation.is_success
computation.raise_if_error()

assert to_int(computation.output) == 1

def _erc_transfer_from(self, addr1: str, addr2: str, chain: MiningChain) -> None:
Expand All @@ -218,7 +221,8 @@ def _erc_transfer_from(self, addr1: str, addr2: str, chain: MiningChain) -> None

block, receipt, computation = chain.apply_transaction(tx)

assert computation.is_success
computation.raise_if_error()

assert to_int(computation.output) == 1


Expand Down
4 changes: 2 additions & 2 deletions tests/core/chain-object/test_build_block_incrementally.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_building_block_incrementally_with_single_transaction(
private_key=funded_address_private_key,
)
_, _, computation = chain.apply_transaction(tx)
assert computation.is_success
computation.raise_if_error()

# test that the *latest* block hasn't changed
assert chain.get_canonical_head().hash == head_hash
Expand All @@ -57,7 +57,7 @@ def test_building_block_incrementally_with_multiple_transactions(
)
txns.append(tx)
_, _, computation = chain.apply_transaction(tx)
assert computation.is_success
computation.raise_if_error()

# test that the pending block has the expected number of transactions
vm = chain.get_vm()
Expand Down
4 changes: 2 additions & 2 deletions tests/core/chain-object/test_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def test_import_block(chain, tx):
if hasattr(chain, 'apply_transaction'):
# working on a Mining chain which can directly apply transactions
new_block, _, computation = chain.apply_transaction(tx)
assert computation.is_success
computation.raise_if_error()
else:
# working on a non-mining chain, so we have to build the block to apply manually
new_block, receipts, computations = chain.build_block_with_transactions([tx])
assert computations[0].is_success
computations[0].raise_if_error()

block, _, _ = chain.import_block(new_block)

Expand Down
24 changes: 22 additions & 2 deletions tests/core/tester/test_generate_vm_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Forks(enum.Enum):
Byzantium = 'Byzantium'
Constantinople = 'Constantinople'
Petersburg = 'Petersburg'
Istanbul = 'Istanbul'


class CustomFrontierVM(FrontierVM):
Expand All @@ -29,7 +30,7 @@ class CustomFrontierVM(FrontierVM):
(
tuple(),
{},
((0, Forks.Petersburg),),
((0, Forks.Istanbul),),
),
(
((0, 'tangerine-whistle'), (1, 'spurious-dragon')),
Expand Down Expand Up @@ -116,7 +117,7 @@ class CustomFrontierVM(FrontierVM):
(1, 'homestead'),
(2, 'tangerine-whistle'),
(3, 'byzantium'),
(5, 'petersburg')
(5, 'petersburg'),
),
{},
(
Expand All @@ -127,6 +128,25 @@ class CustomFrontierVM(FrontierVM):
(5, Forks.Petersburg),
),
),
(
(
(0, 'frontier'),
(1, 'homestead'),
(2, 'tangerine-whistle'),
(3, 'byzantium'),
(5, 'petersburg'),
(7, 'istanbul'),
),
{},
(
(0, Forks.Frontier),
(1, Forks.Homestead),
(2, Forks.TangerineWhistle),
(3, Forks.Byzantium),
(5, Forks.Petersburg),
(7, Forks.Istanbul),
),
),
),
)
def test_generate_vm_configuration(args, kwargs, expected):
Expand Down
2 changes: 1 addition & 1 deletion tests/database/test_eth1_chaindb.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_chaindb_get_receipt_by_index(
private_key=funded_address_private_key,
)
new_block, tx_receipt, computation = chain.apply_transaction(tx)
assert computation.is_success
computation.raise_if_error()

if (block_number + 1) == REQUIRED_BLOCK_NUMBER and tx_index == REQUIRED_RECEIPT_INDEX:
actual_receipt = tx_receipt
Expand Down