Remove the unused stub constants

This commit is contained in:
Hsiao-Wei Wang 2021-10-04 00:30:01 +08:00
parent e235aa8296
commit f1f082fbe7
No known key found for this signature in database
GPG Key ID: 1111A8A81778319E
3 changed files with 27 additions and 28 deletions

View File

@ -13,7 +13,6 @@
- [Constants](#constants) - [Constants](#constants)
- [Execution](#execution) - [Execution](#execution)
- [Configuration](#configuration) - [Configuration](#configuration)
- [Genesis testing settings](#genesis-testing-settings)
- [Transition settings](#transition-settings) - [Transition settings](#transition-settings)
- [Containers](#containers) - [Containers](#containers)
- [Extended containers](#extended-containers) - [Extended containers](#extended-containers)
@ -71,15 +70,6 @@ This patch adds transaction execution to the beacon chain as part of the Merge f
## Configuration ## Configuration
### Genesis testing settings
*Note*: These configuration settings do not apply to the mainnet and are utilized only by pure Merge testing.
| Name | Value |
| - | - |
| `GENESIS_GAS_LIMIT` | `uint64(30000000)` (= 30,000,000) |
| `GENESIS_BASE_FEE_PER_GAS` | `Bytes32('0x00ca9a3b00000000000000000000000000000000000000000000000000000000')` (= 1,000,000,000) |
### Transition settings ### Transition settings
| Name | Value | | Name | Value |

View File

@ -20,6 +20,25 @@ def build_mock_validator(spec, i: int, balance: int):
) )
def get_sample_genesis_execution_payload_header(spec,
eth1_block_hash=None):
if eth1_block_hash is None:
eth1_block_hash = b'\x55' * 32
return spec.ExecutionPayloadHeader(
parent_hash=b'\x30' * 32,
coinbase=b'\x42' * 20,
state_root=b'\x20' * 32,
receipt_root=b'\x20' * 32,
logs_bloom=b'\x35' * spec.BYTES_PER_LOGS_BLOOM,
random=eth1_block_hash,
block_number=0,
gas_limit=30000000,
base_fee_per_gas=spec.Bytes32('0x00ca9a3b00000000000000000000000000000000000000000000000000000000'),
block_hash=eth1_block_hash,
transactions_root=spec.Root(b'\x56' * 32),
)
def create_genesis_state(spec, validator_balances, activation_threshold): def create_genesis_state(spec, validator_balances, activation_threshold):
deposit_root = b'\x42' * 32 deposit_root = b'\x42' * 32
@ -76,9 +95,9 @@ def create_genesis_state(spec, validator_balances, activation_threshold):
if spec.fork not in FORKS_BEFORE_MERGE: if spec.fork not in FORKS_BEFORE_MERGE:
# Initialize the execution payload header (with block number and genesis time set to 0) # Initialize the execution payload header (with block number and genesis time set to 0)
state.latest_execution_payload_header.block_hash = eth1_block_hash state.latest_execution_payload_header = get_sample_genesis_execution_payload_header(
state.latest_execution_payload_header.random = eth1_block_hash spec,
state.latest_execution_payload_header.gas_limit = spec.GENESIS_GAS_LIMIT eth1_block_hash=eth1_block_hash,
state.latest_execution_payload_header.base_fee_per_gas = spec.GENESIS_BASE_FEE_PER_GAS )
return state return state

View File

@ -10,6 +10,9 @@ from eth2spec.test.helpers.constants import MINIMAL
from eth2spec.test.helpers.deposits import ( from eth2spec.test.helpers.deposits import (
prepare_full_genesis_deposits, prepare_full_genesis_deposits,
) )
from eth2spec.test.helpers.genesis import (
get_sample_genesis_execution_payload_header,
)
def eth1_init_data(eth1_block_hash, eth1_timestamp): def eth1_init_data(eth1_block_hash, eth1_timestamp):
@ -104,20 +107,7 @@ def test_initialize_post_transition(spec):
# initialize beacon_state *with* an execution_payload_header # initialize beacon_state *with* an execution_payload_header
yield 'execution_payload_header', 'meta', True yield 'execution_payload_header', 'meta', True
genesis_execution_payload_header = spec.ExecutionPayloadHeader( genesis_execution_payload_header = get_sample_genesis_execution_payload_header(spec)
parent_hash=b'\x30' * 32,
coinbase=b'\x42' * 20,
state_root=b'\x20' * 32,
receipt_root=b'\x20' * 32,
logs_bloom=b'\x35' * spec.BYTES_PER_LOGS_BLOOM,
random=b'\x55' * 32,
block_number=0,
gas_limit=30000000,
base_fee_per_gas=b'\x10' * 32,
block_hash=b'\x99' * 32,
transactions_root=spec.Root(b'\x56' * 32),
)
state = spec.initialize_beacon_state_from_eth1( state = spec.initialize_beacon_state_from_eth1(
eth1_block_hash, eth1_block_hash,
eth1_timestamp, eth1_timestamp,