diff --git a/beacon_chain/spec/datatypes/base.nim b/beacon_chain/spec/datatypes/base.nim index c29b43fae..2a955e472 100644 --- a/beacon_chain/spec/datatypes/base.nim +++ b/beacon_chain/spec/datatypes/base.nim @@ -408,6 +408,20 @@ type validator_pubkey*: ValidatorPubKey amount*: Gwei + # https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/beacon-chain.md#blstoexecutionchange + BLSToExecutionChange* = object + validator_index*: uint64 + from_bls_pubkey*: ValidatorPubKey + to_execution_address*: ExecutionAddress + + # https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#signedblstoexecutionchange + SignedBLSToExecutionChange* = object + message*: BLSToExecutionChange + signature*: ValidatorSig + + SignedBLSToExecutionChangeList* = + List[SignedBLSToExecutionChange, Limit MAX_BLS_TO_EXECUTION_CHANGES] + # https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#historicalsummary HistoricalSummary* = object # `HistoricalSummary` matches the components of the phase0 @@ -903,6 +917,19 @@ proc readValue*( func `$`*(v: ExecutionAddress): string = v.data.toHex() +func shortLog*(v: BLSToExecutionChange): auto = + ( + validator_index: v.validator_index, + from_bls_pubkey: shortLog(v.from_bls_pubkey), + to_execution_address: $v.to_execution_address + ) + +func shortLog*(v: SignedBLSToExecutionChange): auto = + ( + bls_to_execution_change: shortLog(v.message), + signature: shortLog(v.signature) + ) + chronicles.formatIt AttestationData: it.shortLog chronicles.formatIt Checkpoint: it.shortLog diff --git a/beacon_chain/spec/datatypes/capella.nim b/beacon_chain/spec/datatypes/capella.nim index f1c0f8fec..93ef7683f 100644 --- a/beacon_chain/spec/datatypes/capella.nim +++ b/beacon_chain/spec/datatypes/capella.nim @@ -36,20 +36,6 @@ const EXECUTION_PAYLOAD_GINDEX* = 25.GeneralizedIndex # execution_payload type - SignedBLSToExecutionChangeList* = - List[SignedBLSToExecutionChange, Limit MAX_BLS_TO_EXECUTION_CHANGES] - - # https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/beacon-chain.md#blstoexecutionchange - BLSToExecutionChange* = object - validator_index*: uint64 - from_bls_pubkey*: ValidatorPubKey - to_execution_address*: ExecutionAddress - - # https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.2/specs/capella/beacon-chain.md#signedblstoexecutionchange - SignedBLSToExecutionChange* = object - message*: BLSToExecutionChange - signature*: ValidatorSig - # https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/beacon-chain.md#executionpayload ExecutionPayload* = object # Execution block header fields @@ -630,19 +616,6 @@ func shortLog*(v: ExecutionPayload): auto = num_withdrawals: len(v.withdrawals) ) -func shortLog*(v: BLSToExecutionChange): auto = - ( - validator_index: v.validator_index, - from_bls_pubkey: shortLog(v.from_bls_pubkey), - to_execution_address: $v.to_execution_address - ) - -func shortLog*(v: SignedBLSToExecutionChange): auto = - ( - bls_to_execution_change: shortLog(v.message), - signature: shortLog(v.signature) - ) - # https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/light-client/sync-protocol.md#get_lc_execution_root func get_lc_execution_root*( header: LightClientHeader, cfg: RuntimeConfig): Eth2Digest =