Add genesis settings section

This commit is contained in:
Mikhail Kalinin 2021-07-30 16:10:33 +06:00
parent 5d5a9e392b
commit d58ffc7dfc
3 changed files with 19 additions and 4 deletions

View File

@ -12,6 +12,8 @@
- [Custom types](#custom-types)
- [Constants](#constants)
- [Execution](#execution)
- [Configuration](#configuration)
- [Genesis settings](#genesis-settings)
- [Containers](#containers)
- [Extended containers](#extended-containers)
- [`BeaconBlockBody`](#beaconblockbody)
@ -66,6 +68,17 @@ This patch adds transaction execution to the beacon chain as part of the Merge f
| `BASE_FEE_MAX_CHANGE_DENOMINATOR` | `uint64(2**3)` (= 8) |
| `ELASTICITY_MULTIPLIER` | `uint64(2**1)` (= 2) |
## Configuration
### Genesis 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` | `uint64(1000000000)` (= 1,000,000,000) |
## Containers
### Extended containers
@ -380,7 +393,8 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Bytes32,
state.latest_execution_payload_header.block_hash = eth1_block_hash
state.latest_execution_payload_header.timestamp = eth1_timestamp
state.latest_execution_payload_header.random = eth1_block_hash
state.latest_execution_payload_header.gas_limit = MIN_GAS_LIMIT
state.latest_execution_payload_header.gas_limit = GENESIS_GAS_LIMIT
state.latest_execution_payload_header.base_fee_per_gas = GENESIS_BASE_FEE_PER_GAS
return state
```

View File

@ -17,14 +17,14 @@ def build_empty_execution_payload(spec, state, randao_mix=None):
logs_bloom=spec.ByteVector[spec.BYTES_PER_LOGS_BLOOM](), # TODO: zeroed logs bloom for empty logs ok?
block_number=latest.block_number + 1,
random=randao_mix,
gas_limit=max(latest.gas_limit, spec.MIN_GAS_LIMIT),
gas_limit=latest.gas_limit, # retain same limit
gas_used=0, # empty block, 0 gas
timestamp=timestamp,
base_fee_per_gas=spec.uint64(0),
block_hash=spec.Hash32(),
transactions=empty_txs,
)
payload.base_fee_per_gas = spec.compute_base_fee_per_gas(latest, payload)
payload.base_fee_per_gas = spec.compute_base_fee_per_gas(payload, latest)
# TODO: real RLP + block hash logic would be nice, requires RLP and keccak256 dependency however.
payload.block_hash = spec.Hash32(spec.hash(payload.hash_tree_root() + b"FAKE RLP HASH"))

View File

@ -78,6 +78,7 @@ def create_genesis_state(spec, validator_balances, activation_threshold):
# 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.random = eth1_block_hash
state.latest_execution_payload_header.gas_limit = spec.MIN_GAS_LIMIT
state.latest_execution_payload_header.gas_limit = spec.GENESIS_GAS_LIMIT
state.latest_execution_payload_header.base_fee_per_gas = spec.GENESIS_BASE_FEE_PER_GAS
return state