mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-09 21:24:01 +00:00
final portion of non-trivial v1.3.0 bumps (#4927)
* final portion of non-trivial v1.3.0 bumps Updates unchanged logic to latest v1.3.0 consensus-specs refs, and cleans up surrounding sections / syncs comments, and so on. ``` https://github.com/ethereum/consensus-specs/(blob|tree)/(?!v1\.3\.0/) ``` * lint * linebreak
This commit is contained in:
parent
d3929cbb45
commit
322429b191
@ -283,16 +283,17 @@ type
|
|||||||
withdrawal_credentials*: Eth2Digest
|
withdrawal_credentials*: Eth2Digest
|
||||||
amount*: Gwei
|
amount*: Gwei
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#depositdata
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#depositdata
|
||||||
DepositData* = object
|
DepositData* = object
|
||||||
pubkey*: ValidatorPubKey
|
pubkey*: ValidatorPubKey
|
||||||
withdrawal_credentials*: Eth2Digest
|
withdrawal_credentials*: Eth2Digest
|
||||||
amount*: Gwei
|
amount*: Gwei
|
||||||
# Cannot use TrustedSig here as invalid signatures are possible and determine
|
# Cannot use TrustedSig here as invalid signatures are possible and determine
|
||||||
# if the deposit should be added or not during processing
|
# if the deposit should be added or not during processing
|
||||||
signature*: ValidatorSig # Signing over DepositMessage
|
signature*: ValidatorSig
|
||||||
|
## Signing over DepositMessage
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#voluntaryexit
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#voluntaryexit
|
||||||
VoluntaryExit* = object
|
VoluntaryExit* = object
|
||||||
epoch*: Epoch
|
epoch*: Epoch
|
||||||
## Earliest epoch when voluntary exit can be processed
|
## Earliest epoch when voluntary exit can be processed
|
||||||
@ -340,9 +341,9 @@ type
|
|||||||
exit_epoch*: Epoch
|
exit_epoch*: Epoch
|
||||||
|
|
||||||
withdrawable_epoch*: Epoch
|
withdrawable_epoch*: Epoch
|
||||||
## When validator can withdraw or transfer funds
|
## When validator can withdraw funds
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#pendingattestation
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#pendingattestation
|
||||||
PendingAttestation* = object
|
PendingAttestation* = object
|
||||||
aggregation_bits*: CommitteeValidatorsBits
|
aggregation_bits*: CommitteeValidatorsBits
|
||||||
data*: AttestationData
|
data*: AttestationData
|
||||||
@ -432,7 +433,7 @@ type
|
|||||||
branch*: array[DEPOSIT_CONTRACT_TREE_DEPTH, Eth2Digest]
|
branch*: array[DEPOSIT_CONTRACT_TREE_DEPTH, Eth2Digest]
|
||||||
deposit_count*: array[32, byte] # Uint256
|
deposit_count*: array[32, byte] # Uint256
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#validator
|
||||||
ValidatorStatus* = object
|
ValidatorStatus* = object
|
||||||
# This is a validator without the expensive, immutable, append-only parts
|
# This is a validator without the expensive, immutable, append-only parts
|
||||||
# serialized. They're represented in memory to allow in-place SSZ reading
|
# serialized. They're represented in memory to allow in-place SSZ reading
|
||||||
@ -441,7 +442,7 @@ type
|
|||||||
pubkey* {.dontSerialize.}: ValidatorPubKey
|
pubkey* {.dontSerialize.}: ValidatorPubKey
|
||||||
|
|
||||||
withdrawal_credentials* {.dontSerialize.}: Eth2Digest
|
withdrawal_credentials* {.dontSerialize.}: Eth2Digest
|
||||||
## Commitment to pubkey for withdrawals and transfers
|
## Commitment to pubkey for withdrawals
|
||||||
|
|
||||||
effective_balance*: Gwei
|
effective_balance*: Gwei
|
||||||
## Balance at stake
|
## Balance at stake
|
||||||
@ -456,9 +457,9 @@ type
|
|||||||
exit_epoch*: Epoch
|
exit_epoch*: Epoch
|
||||||
|
|
||||||
withdrawable_epoch*: Epoch
|
withdrawable_epoch*: Epoch
|
||||||
## When validator can withdraw or transfer funds
|
## When validator can withdraw funds
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#validator
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#validator
|
||||||
ValidatorStatusCapella* = object
|
ValidatorStatusCapella* = object
|
||||||
# This is a validator without the expensive, immutable, append-only parts
|
# This is a validator without the expensive, immutable, append-only parts
|
||||||
# serialized. They're represented in memory to allow in-place SSZ reading
|
# serialized. They're represented in memory to allow in-place SSZ reading
|
||||||
@ -467,7 +468,7 @@ type
|
|||||||
pubkey* {.dontSerialize.}: ValidatorPubKey
|
pubkey* {.dontSerialize.}: ValidatorPubKey
|
||||||
|
|
||||||
withdrawal_credentials*: Eth2Digest
|
withdrawal_credentials*: Eth2Digest
|
||||||
## Commitment to pubkey for withdrawals and transfers
|
## Commitment to pubkey for withdrawals
|
||||||
|
|
||||||
effective_balance*: Gwei
|
effective_balance*: Gwei
|
||||||
## Balance at stake
|
## Balance at stake
|
||||||
@ -482,7 +483,7 @@ type
|
|||||||
exit_epoch*: Epoch
|
exit_epoch*: Epoch
|
||||||
|
|
||||||
withdrawable_epoch*: Epoch
|
withdrawable_epoch*: Epoch
|
||||||
## When validator can withdraw or transfer funds
|
## When validator can withdraw funds
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#eth2-field
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#eth2-field
|
||||||
ENRForkID* = object
|
ENRForkID* = object
|
||||||
|
@ -47,13 +47,17 @@ type
|
|||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#executionpayload
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#executionpayload
|
||||||
ExecutionPayload* = object
|
ExecutionPayload* = object
|
||||||
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
fee_recipient*: ExecutionAddress
|
||||||
|
## 'beneficiary' in the yellow paper
|
||||||
state_root*: Eth2Digest
|
state_root*: Eth2Digest
|
||||||
receipts_root*: Eth2Digest # 'receipts root' in the yellow paper
|
receipts_root*: Eth2Digest
|
||||||
logs_bloom*: BloomLogs
|
logs_bloom*: BloomLogs
|
||||||
prev_randao*: Eth2Digest # 'difficulty' in the yellow paper
|
prev_randao*: Eth2Digest
|
||||||
block_number*: uint64 # 'number' in the yellow paper
|
## 'difficulty' in the yellow paper
|
||||||
|
block_number*: uint64
|
||||||
|
## 'number' in the yellow paper
|
||||||
gas_limit*: uint64
|
gas_limit*: uint64
|
||||||
gas_used*: uint64
|
gas_used*: uint64
|
||||||
timestamp*: uint64
|
timestamp*: uint64
|
||||||
@ -61,7 +65,8 @@ type
|
|||||||
base_fee_per_gas*: UInt256
|
base_fee_per_gas*: UInt256
|
||||||
|
|
||||||
# Extra payload fields
|
# Extra payload fields
|
||||||
block_hash*: Eth2Digest # Hash of execution block
|
block_hash*: Eth2Digest
|
||||||
|
## Hash of execution block
|
||||||
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
||||||
|
|
||||||
ExecutionPayloadForSigning* = object
|
ExecutionPayloadForSigning* = object
|
||||||
@ -70,6 +75,7 @@ type
|
|||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#executionpayloadheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#executionpayloadheader
|
||||||
ExecutionPayloadHeader* = object
|
ExecutionPayloadHeader* = object
|
||||||
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress
|
fee_recipient*: ExecutionAddress
|
||||||
state_root*: Eth2Digest
|
state_root*: Eth2Digest
|
||||||
@ -84,7 +90,8 @@ type
|
|||||||
base_fee_per_gas*: UInt256
|
base_fee_per_gas*: UInt256
|
||||||
|
|
||||||
# Extra payload fields
|
# Extra payload fields
|
||||||
block_hash*: Eth2Digest # Hash of execution block
|
block_hash*: Eth2Digest
|
||||||
|
## Hash of execution block
|
||||||
transactions_root*: Eth2Digest
|
transactions_root*: Eth2Digest
|
||||||
|
|
||||||
ExecutePayload* = proc(
|
ExecutePayload* = proc(
|
||||||
|
@ -65,13 +65,17 @@ type
|
|||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#executionpayload
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#executionpayload
|
||||||
ExecutionPayload* = object
|
ExecutionPayload* = object
|
||||||
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
fee_recipient*: ExecutionAddress
|
||||||
|
## 'beneficiary' in the yellow paper
|
||||||
state_root*: Eth2Digest
|
state_root*: Eth2Digest
|
||||||
receipts_root*: Eth2Digest # 'receipts root' in the yellow paper
|
receipts_root*: Eth2Digest
|
||||||
logs_bloom*: BloomLogs
|
logs_bloom*: BloomLogs
|
||||||
prev_randao*: Eth2Digest # 'difficulty' in the yellow paper
|
prev_randao*: Eth2Digest
|
||||||
block_number*: uint64 # 'number' in the yellow paper
|
## 'difficulty' in the yellow paper
|
||||||
|
block_number*: uint64
|
||||||
|
## 'number' in the yellow paper
|
||||||
gas_limit*: uint64
|
gas_limit*: uint64
|
||||||
gas_used*: uint64
|
gas_used*: uint64
|
||||||
timestamp*: uint64
|
timestamp*: uint64
|
||||||
@ -79,9 +83,11 @@ type
|
|||||||
base_fee_per_gas*: UInt256
|
base_fee_per_gas*: UInt256
|
||||||
|
|
||||||
# Extra payload fields
|
# Extra payload fields
|
||||||
block_hash*: Eth2Digest # Hash of execution block
|
block_hash*: Eth2Digest
|
||||||
|
## Hash of execution block
|
||||||
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
transactions*: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
||||||
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD] # [New in Capella]
|
withdrawals*: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
|
||||||
|
## [New in Capella]
|
||||||
|
|
||||||
ExecutionPayloadForSigning* = object
|
ExecutionPayloadForSigning* = object
|
||||||
executionPayload*: ExecutionPayload
|
executionPayload*: ExecutionPayload
|
||||||
@ -89,6 +95,7 @@ type
|
|||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#executionpayloadheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/beacon-chain.md#executionpayloadheader
|
||||||
ExecutionPayloadHeader* = object
|
ExecutionPayloadHeader* = object
|
||||||
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress
|
fee_recipient*: ExecutionAddress
|
||||||
state_root*: Eth2Digest
|
state_root*: Eth2Digest
|
||||||
@ -103,9 +110,11 @@ type
|
|||||||
base_fee_per_gas*: UInt256
|
base_fee_per_gas*: UInt256
|
||||||
|
|
||||||
# Extra payload fields
|
# Extra payload fields
|
||||||
block_hash*: Eth2Digest # Hash of execution block
|
block_hash*: Eth2Digest
|
||||||
|
## Hash of execution block
|
||||||
transactions_root*: Eth2Digest
|
transactions_root*: Eth2Digest
|
||||||
withdrawals_root*: Eth2Digest # [New in Capella]
|
withdrawals_root*: Eth2Digest
|
||||||
|
## [New in Capella]
|
||||||
|
|
||||||
ExecutePayload* = proc(
|
ExecutePayload* = proc(
|
||||||
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
|
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
|
||||||
@ -369,7 +378,8 @@ type
|
|||||||
execution_payload*: ExecutionPayload
|
execution_payload*: ExecutionPayload
|
||||||
|
|
||||||
# Capella operations
|
# Capella operations
|
||||||
bls_to_execution_changes*: SignedBLSToExecutionChangeList # [New in Capella]
|
bls_to_execution_changes*: SignedBLSToExecutionChangeList
|
||||||
|
## [New in Capella]
|
||||||
|
|
||||||
SigVerifiedBeaconBlockBody* = object
|
SigVerifiedBeaconBlockBody* = object
|
||||||
## A BeaconBlock body with signatures verified
|
## A BeaconBlock body with signatures verified
|
||||||
|
@ -30,15 +30,15 @@ from ../../vendor/nim-kzg4844/kzg4844 import KzgCommitment, KzgProof
|
|||||||
export json_serialization, base, kzg4844
|
export json_serialization, base, kzg4844
|
||||||
|
|
||||||
const
|
const
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/polynomial-commitments.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/polynomial-commitments.md#constants
|
||||||
BYTES_PER_FIELD_ELEMENT = 32
|
BYTES_PER_FIELD_ELEMENT = 32
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#blob
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#blob
|
||||||
BLOB_TX_TYPE* = 0x03'u8
|
BLOB_TX_TYPE* = 0x03'u8
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/polynomial-commitments.md#constants
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/polynomial-commitments.md#constants
|
||||||
BLS_MODULUS* = "52435875175126190479447740508185965837690552500527637822603658699938581184513".u256
|
BLS_MODULUS* = "52435875175126190479447740508185965837690552500527637822603658699938581184513".u256
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/p2p-interface.md#configuration
|
||||||
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS* = 4096'u64
|
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS* = 4096'u64
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -49,7 +49,7 @@ type
|
|||||||
# current spec doesn't ever SSZ-serialize it or hash_tree_root it
|
# current spec doesn't ever SSZ-serialize it or hash_tree_root it
|
||||||
VersionedHash* = array[32, byte]
|
VersionedHash* = array[32, byte]
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/beacon-chain.md#custom-types
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#custom-types
|
||||||
BlobIndex* = uint64
|
BlobIndex* = uint64
|
||||||
|
|
||||||
Blob* = array[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB, byte]
|
Blob* = array[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB, byte]
|
||||||
@ -61,36 +61,43 @@ type
|
|||||||
blobs*: Blobs
|
blobs*: Blobs
|
||||||
kzg_aggregated_proof*: KzgProof
|
kzg_aggregated_proof*: KzgProof
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/p2p-interface.md#blobsidecar
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/p2p-interface.md#blobsidecar
|
||||||
BlobSidecar* = object
|
BlobSidecar* = object
|
||||||
block_root*: Eth2Digest
|
block_root*: Eth2Digest
|
||||||
index*: BlobIndex # Index of blob in block
|
index*: BlobIndex
|
||||||
|
## Index of blob in block
|
||||||
slot*: Slot
|
slot*: Slot
|
||||||
block_parent_root*: Eth2Digest # Proposer shuffling determinant
|
block_parent_root*: Eth2Digest
|
||||||
|
## Proposer shuffling determinant
|
||||||
proposer_index*: uint64
|
proposer_index*: uint64
|
||||||
blob*: Blob
|
blob*: Blob
|
||||||
kzg_commitment*: KzgCommitment
|
kzg_commitment*: KzgCommitment
|
||||||
kzg_proof*: KzgProof # Allows for quick verification of kzg_commitment
|
kzg_proof*: KzgProof
|
||||||
|
## Allows for quick verification of kzg_commitment
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/p2p-interface.md#signedblobsidecar
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/p2p-interface.md#signedblobsidecar
|
||||||
SignedBlobSidecar* = object
|
SignedBlobSidecar* = object
|
||||||
message*: BlobSidecar
|
message*: BlobSidecar
|
||||||
signature*: ValidatorSig
|
signature*: ValidatorSig
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/p2p-interface.md#blobidentifier
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/p2p-interface.md#blobidentifier
|
||||||
BlobIdentifier* = object
|
BlobIdentifier* = object
|
||||||
block_root*: Eth2Digest
|
block_root*: Eth2Digest
|
||||||
index*: BlobIndex
|
index*: BlobIndex
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/beacon-chain.md#executionpayload
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#executionpayload
|
||||||
ExecutionPayload* = object
|
ExecutionPayload* = object
|
||||||
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress # 'beneficiary' in the yellow paper
|
fee_recipient*: ExecutionAddress
|
||||||
|
## 'beneficiary' in the yellow paper
|
||||||
state_root*: Eth2Digest
|
state_root*: Eth2Digest
|
||||||
receipts_root*: Eth2Digest # 'receipts root' in the yellow paper
|
receipts_root*: Eth2Digest
|
||||||
logs_bloom*: BloomLogs
|
logs_bloom*: BloomLogs
|
||||||
prev_randao*: Eth2Digest # 'difficulty' in the yellow paper
|
prev_randao*: Eth2Digest
|
||||||
block_number*: uint64 # 'number' in the yellow paper
|
## 'difficulty' in the yellow paper
|
||||||
|
block_number*: uint64
|
||||||
|
## 'number' in the yellow paper
|
||||||
gas_limit*: uint64
|
gas_limit*: uint64
|
||||||
gas_used*: uint64
|
gas_used*: uint64
|
||||||
timestamp*: uint64
|
timestamp*: uint64
|
||||||
@ -109,8 +116,9 @@ type
|
|||||||
kzgs*: KzgCommitments
|
kzgs*: KzgCommitments
|
||||||
blobs*: Blobs
|
blobs*: Blobs
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/deneb/beacon-chain.md#executionpayloadheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/beacon-chain.md#executionpayloadheader
|
||||||
ExecutionPayloadHeader* = object
|
ExecutionPayloadHeader* = object
|
||||||
|
# Execution block header fields
|
||||||
parent_hash*: Eth2Digest
|
parent_hash*: Eth2Digest
|
||||||
fee_recipient*: ExecutionAddress
|
fee_recipient*: ExecutionAddress
|
||||||
state_root*: Eth2Digest
|
state_root*: Eth2Digest
|
||||||
@ -125,15 +133,17 @@ type
|
|||||||
base_fee_per_gas*: UInt256
|
base_fee_per_gas*: UInt256
|
||||||
|
|
||||||
# Extra payload fields
|
# Extra payload fields
|
||||||
block_hash*: Eth2Digest # Hash of execution block
|
block_hash*: Eth2Digest
|
||||||
|
## Hash of execution block
|
||||||
transactions_root*: Eth2Digest
|
transactions_root*: Eth2Digest
|
||||||
withdrawals_root*: Eth2Digest
|
withdrawals_root*: Eth2Digest
|
||||||
excess_data_gas*: UInt256 # [New in Deneb]
|
excess_data_gas*: UInt256
|
||||||
|
## [New in Deneb]
|
||||||
|
|
||||||
ExecutePayload* = proc(
|
ExecutePayload* = proc(
|
||||||
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
|
execution_payload: ExecutionPayload): bool {.gcsafe, raises: [Defect].}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/capella/light-client/sync-protocol.md#modified-lightclientheader
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/capella/light-client/sync-protocol.md#modified-lightclientheader
|
||||||
LightClientHeader* = object
|
LightClientHeader* = object
|
||||||
beacon*: BeaconBlockHeader
|
beacon*: BeaconBlockHeader
|
||||||
## Beacon block header
|
## Beacon block header
|
||||||
|
@ -167,11 +167,14 @@ type
|
|||||||
state_root*: Eth2Digest
|
state_root*: Eth2Digest
|
||||||
body*: TrustedBeaconBlockBody
|
body*: TrustedBeaconBlockBody
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/beacon-chain.md#beaconblockbody
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#beaconblockbody
|
||||||
BeaconBlockBody* = object
|
BeaconBlockBody* = object
|
||||||
randao_reveal*: ValidatorSig
|
randao_reveal*: ValidatorSig
|
||||||
eth1_data*: Eth1Data
|
eth1_data*: Eth1Data
|
||||||
|
## Eth1 data vote
|
||||||
|
|
||||||
graffiti*: GraffitiBytes
|
graffiti*: GraffitiBytes
|
||||||
|
## Arbitrary data
|
||||||
|
|
||||||
# Operations
|
# Operations
|
||||||
proposer_slashings*: List[ProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
|
proposer_slashings*: List[ProposerSlashing, Limit MAX_PROPOSER_SLASHINGS]
|
||||||
|
@ -68,9 +68,10 @@ proc verify_block_signature(
|
|||||||
|
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function
|
||||||
func verifyStateRoot(
|
func verifyStateRoot(
|
||||||
state: ForkyBeaconState, blck: ForkyBeaconBlock | ForkySigVerifiedBeaconBlock):
|
state: ForkyBeaconState,
|
||||||
|
blck: ForkyBeaconBlock | ForkySigVerifiedBeaconBlock):
|
||||||
Result[void, cstring] =
|
Result[void, cstring] =
|
||||||
# This is inlined in state_transition(...) in spec.
|
# This is inlined in state_transition(...) in spec.
|
||||||
let state_root = hash_tree_root(state)
|
let state_root = hash_tree_root(state)
|
||||||
@ -136,6 +137,7 @@ proc advance_slot(
|
|||||||
|
|
||||||
info.clear()
|
info.clear()
|
||||||
|
|
||||||
|
# Process epoch on the start slot of the next epoch
|
||||||
let is_epoch_transition = (state.slot + 1).is_epoch
|
let is_epoch_transition = (state.slot + 1).is_epoch
|
||||||
if is_epoch_transition:
|
if is_epoch_transition:
|
||||||
# Note: Genesis epoch = 0, no need to test if before Genesis
|
# Note: Genesis epoch = 0, no need to test if before Genesis
|
||||||
@ -447,10 +449,9 @@ template partialBeaconBlock*(
|
|||||||
voluntary_exits: validator_changes.voluntary_exits,
|
voluntary_exits: validator_changes.voluntary_exits,
|
||||||
sync_aggregate: sync_aggregate,
|
sync_aggregate: sync_aggregate,
|
||||||
execution_payload: execution_payload.executionPayload,
|
execution_payload: execution_payload.executionPayload,
|
||||||
bls_to_execution_changes: validator_changes.bls_to_execution_changes
|
bls_to_execution_changes: validator_changes.bls_to_execution_changes))
|
||||||
))
|
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/merge/validator.md#block-proposal
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/validator.md#constructing-the-beaconblockbody
|
||||||
template partialBeaconBlock*(
|
template partialBeaconBlock*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
state: var deneb.HashedBeaconState,
|
state: var deneb.HashedBeaconState,
|
||||||
@ -480,8 +481,7 @@ template partialBeaconBlock*(
|
|||||||
sync_aggregate: sync_aggregate,
|
sync_aggregate: sync_aggregate,
|
||||||
execution_payload: execution_payload.executionPayload,
|
execution_payload: execution_payload.executionPayload,
|
||||||
bls_to_execution_changes: validator_changes.bls_to_execution_changes,
|
bls_to_execution_changes: validator_changes.bls_to_execution_changes,
|
||||||
blob_kzg_commitments: execution_payload.kzgs
|
blob_kzg_commitments: execution_payload.kzgs))
|
||||||
))
|
|
||||||
|
|
||||||
proc makeBeaconBlock*(
|
proc makeBeaconBlock*(
|
||||||
cfg: RuntimeConfig,
|
cfg: RuntimeConfig,
|
||||||
|
@ -269,11 +269,12 @@ func get_beacon_committee*(
|
|||||||
withState(state):
|
withState(state):
|
||||||
get_beacon_committee(forkyState.data, slot, index, cache)
|
get_beacon_committee(forkyState.data, slot, index, cache)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#get_beacon_committee
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#get_beacon_committee
|
||||||
func get_beacon_committee_len*(
|
func get_beacon_committee_len*(
|
||||||
state: ForkyBeaconState, slot: Slot, index: CommitteeIndex,
|
state: ForkyBeaconState, slot: Slot, index: CommitteeIndex,
|
||||||
cache: var StateCache): uint64 =
|
cache: var StateCache): uint64 =
|
||||||
# Return the number of members in the beacon committee at ``slot`` for ``index``.
|
## Return the number of members in the beacon committee at ``slot``
|
||||||
|
## for ``index``.
|
||||||
let
|
let
|
||||||
epoch = epoch(slot)
|
epoch = epoch(slot)
|
||||||
committees_per_slot = get_committee_count_per_slot(state, epoch, cache)
|
committees_per_slot = get_committee_count_per_slot(state, epoch, cache)
|
||||||
@ -392,9 +393,10 @@ func get_beacon_proposer_index*(
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/beacon-chain.md#get_beacon_proposer_index
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#get_beacon_proposer_index
|
||||||
func get_beacon_proposer_index*(state: ForkyBeaconState, cache: var StateCache):
|
func get_beacon_proposer_index*(state: ForkyBeaconState, cache: var StateCache):
|
||||||
Opt[ValidatorIndex] =
|
Opt[ValidatorIndex] =
|
||||||
|
## Return the beacon proposer index at the current slot.
|
||||||
get_beacon_proposer_index(state, cache, state.slot)
|
get_beacon_proposer_index(state, cache, state.slot)
|
||||||
|
|
||||||
func get_beacon_proposer_index*(state: ForkedHashedBeaconState,
|
func get_beacon_proposer_index*(state: ForkedHashedBeaconState,
|
||||||
@ -403,10 +405,9 @@ func get_beacon_proposer_index*(state: ForkedHashedBeaconState,
|
|||||||
withState(state):
|
withState(state):
|
||||||
get_beacon_proposer_index(forkyState.data, cache, slot)
|
get_beacon_proposer_index(forkyState.data, cache, slot)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/specs/phase0/validator.md#aggregation-selection
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/validator.md#aggregation-selection
|
||||||
func is_aggregator*(committee_len: uint64, slot_signature: ValidatorSig): bool =
|
func is_aggregator*(committee_len: uint64, slot_signature: ValidatorSig): bool =
|
||||||
let
|
let modulo = max(1'u64, committee_len div TARGET_AGGREGATORS_PER_COMMITTEE)
|
||||||
modulo = max(1'u64, committee_len div TARGET_AGGREGATORS_PER_COMMITTEE)
|
|
||||||
bytes_to_uint64(eth2digest(
|
bytes_to_uint64(eth2digest(
|
||||||
slot_signature.toRaw()).data.toOpenArray(0, 7)) mod modulo == 0
|
slot_signature.toRaw()).data.toOpenArray(0, 7)) mod modulo == 0
|
||||||
|
|
||||||
|
@ -476,12 +476,13 @@ p2pProtocol BeaconSync(version = 1,
|
|||||||
debug "Blob root request done",
|
debug "Blob root request done",
|
||||||
peer, roots = blobIds.len, count, found
|
peer, roots = blobIds.len, count, found
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/p2p-interface.md#blobsidecarsbyrange-v1
|
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/p2p-interface.md#blobsidecarsbyrange-v1
|
||||||
proc blobSidecarsByRange(
|
proc blobSidecarsByRange(
|
||||||
peer: Peer,
|
peer: Peer,
|
||||||
startSlot: Slot,
|
startSlot: Slot,
|
||||||
reqCount: uint64,
|
reqCount: uint64,
|
||||||
response: MultipleChunksResponse[ref BlobSidecar, Limit(MAX_REQUEST_BLOB_SIDECARS)])
|
response: MultipleChunksResponse[
|
||||||
|
ref BlobSidecar, Limit(MAX_REQUEST_BLOB_SIDECARS)])
|
||||||
{.async, libp2pProtocol("blob_sidecars_by_range", 1).} =
|
{.async, libp2pProtocol("blob_sidecars_by_range", 1).} =
|
||||||
# TODO This code is more complicated than it needs to be, since the type
|
# TODO This code is more complicated than it needs to be, since the type
|
||||||
# of the multiple chunks response is not actually used in this server
|
# of the multiple chunks response is not actually used in this server
|
||||||
|
Loading…
x
Reference in New Issue
Block a user