move `BLSToExecutionChange`, `SignedBLSToExecutionChange` to `base`

Preparation for EIP-7495 SSZ `StableContainer` which can only contain
immutable types in their fields.
This commit is contained in:
Etan Kissling 2024-05-27 13:38:29 +02:00
parent 1384d7ee22
commit ebf285f3dd
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
2 changed files with 27 additions and 27 deletions

View File

@ -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

View File

@ -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 =