Remove most remaining portions of Bellatrix Builder API (#5272)
This commit is contained in:
parent
3e2c0a64df
commit
18061f7991
|
@ -166,8 +166,7 @@ type
|
|||
|
||||
RestBlockTypes* = phase0.BeaconBlock | altair.BeaconBlock |
|
||||
bellatrix.BeaconBlock | capella.BeaconBlock |
|
||||
DenebBlockContents | bellatrix_mev.BlindedBeaconBlock |
|
||||
capella_mev.BlindedBeaconBlock
|
||||
DenebBlockContents | capella_mev.BlindedBeaconBlock
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
|
@ -1154,17 +1153,7 @@ proc readValue*[BlockType: ForkedBlindedBeaconBlock](
|
|||
value = ForkedBlindedBeaconBlock(kind: ConsensusFork.Altair,
|
||||
altairData: res)
|
||||
of ConsensusFork.Bellatrix:
|
||||
let res =
|
||||
try:
|
||||
RestJson.decode(string(data.get()),
|
||||
bellatrix_mev.BlindedBeaconBlock,
|
||||
requireAllFields = true,
|
||||
allowUnknownFields = true)
|
||||
except SerializationError as exc:
|
||||
reader.raiseUnexpectedValue("Incorrect bellatrix block format, [" &
|
||||
exc.formatMsg("BlindedBlock") & "]")
|
||||
value = ForkedBlindedBeaconBlock(kind: ConsensusFork.Bellatrix,
|
||||
bellatrixData: res)
|
||||
reader.raiseUnexpectedValue("Bellatrix blinded block format unsupported")
|
||||
of ConsensusFork.Capella:
|
||||
let res =
|
||||
try:
|
||||
|
@ -3295,14 +3284,8 @@ proc decodeBytes*[T: DecodeConsensysTypes](
|
|||
forked = ForkedBlindedBeaconBlock(
|
||||
kind: ConsensusFork.Capella, capellaData: blck)
|
||||
ok(ProduceBlindedBlockResponse(forked))
|
||||
of ConsensusFork.Bellatrix:
|
||||
let
|
||||
blck = ? readSszResBytes(bellatrix_mev.BlindedBeaconBlock, value)
|
||||
forked = ForkedBlindedBeaconBlock(
|
||||
kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
||||
ok(ProduceBlindedBlockResponse(forked))
|
||||
of ConsensusFork.Altair, ConsensusFork.Phase0:
|
||||
err("Unable to decode blinded block for Altair and Phase0 fork")
|
||||
of ConsensusFork.Bellatrix, ConsensusFork.Altair, ConsensusFork.Phase0:
|
||||
err("Unable to decode blinded block for Bellatrix, Altair, and Phase0 forks")
|
||||
else:
|
||||
err("Unsupported Content-Type")
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ import
|
|||
stew/base10, web3/ethtypes,
|
||||
".."/forks,
|
||||
".."/datatypes/[phase0, altair, bellatrix, deneb],
|
||||
".."/mev/[bellatrix_mev, capella_mev, deneb_mev]
|
||||
".."/mev/[capella_mev, deneb_mev]
|
||||
|
||||
from ".."/datatypes/capella import BeaconBlockBody
|
||||
|
||||
export forks, phase0, altair, bellatrix, capella, bellatrix_mev, capella_mev,
|
||||
deneb_mev, tables
|
||||
export forks, phase0, altair, bellatrix, capella, capella_mev, deneb_mev,
|
||||
tables
|
||||
|
||||
const
|
||||
# https://github.com/ethereum/eth2.0-APIs/blob/master/apis/beacon/states/validator_balances.yaml#L17
|
||||
|
|
|
@ -22,7 +22,7 @@ import
|
|||
export
|
||||
extras, block_id, phase0, altair, bellatrix, capella, deneb,
|
||||
eth2_merkleization, eth2_ssz_serialization, forks_light_client,
|
||||
presets, bellatrix_mev, capella_mev, deneb_mev
|
||||
presets, capella_mev, deneb_mev
|
||||
|
||||
# This file contains helpers for dealing with forks - we have two ways we can
|
||||
# deal with forks:
|
||||
|
@ -415,8 +415,7 @@ func init*(T: type ForkedSignedBlindedBeaconBlock,
|
|||
signature: signature))
|
||||
of ConsensusFork.Bellatrix:
|
||||
T(kind: ConsensusFork.Bellatrix,
|
||||
bellatrixData: bellatrix_mev.SignedBlindedBeaconBlock(message: forked.bellatrixData,
|
||||
signature: signature))
|
||||
bellatrixData: default(bellatrix_mev.SignedBlindedBeaconBlock))
|
||||
of ConsensusFork.Capella:
|
||||
T(kind: ConsensusFork.Capella,
|
||||
capellaData: capella_mev.SignedBlindedBeaconBlock(message: forked.capellaData,
|
||||
|
|
|
@ -7,14 +7,11 @@
|
|||
|
||||
{.push raises: [].}
|
||||
|
||||
import ".."/datatypes/phase0
|
||||
from ../datatypes/base import Eth1Data
|
||||
|
||||
type
|
||||
BlindedBeaconBlock* = object
|
||||
|
||||
SignedBlindedBeaconBlock* = object
|
||||
message*: BlindedBeaconBlock
|
||||
signature*: ValidatorSig
|
||||
|
||||
func shortLog*(v: BlindedBeaconBlock): auto =
|
||||
(
|
||||
|
@ -23,7 +20,7 @@ func shortLog*(v: BlindedBeaconBlock): auto =
|
|||
parent_root: "",
|
||||
state_root: "",
|
||||
eth1data: default(Eth1Data),
|
||||
graffiti: $default(GraffitiBytes),
|
||||
graffiti: "",
|
||||
proposer_slashings_len: 0,
|
||||
attester_slashings_len: 0,
|
||||
attestations_len: 0,
|
||||
|
@ -38,6 +35,6 @@ func shortLog*(v: BlindedBeaconBlock): auto =
|
|||
|
||||
func shortLog*(v: SignedBlindedBeaconBlock): auto =
|
||||
(
|
||||
blck: shortLog(v.message),
|
||||
signature: shortLog(v.signature)
|
||||
blck: shortLog(default(BlindedBeaconBlock)),
|
||||
signature: ""
|
||||
)
|
||||
|
|
|
@ -81,8 +81,7 @@ func compute_block_signing_root*(
|
|||
fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot,
|
||||
blck: Eth2Digest | SomeForkyBeaconBlock | BeaconBlockHeader |
|
||||
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/builder.md#signing
|
||||
bellatrix_mev.BlindedBeaconBlock | capella_mev.BlindedBeaconBlock):
|
||||
Eth2Digest =
|
||||
capella_mev.BlindedBeaconBlock): Eth2Digest =
|
||||
let
|
||||
epoch = epoch(slot)
|
||||
domain = get_domain(
|
||||
|
|
|
@ -434,7 +434,6 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
|||
genesis_validators_root: Eth2Digest, slot: Slot,
|
||||
block_root: Eth2Digest,
|
||||
blck: ForkedBeaconBlock | ForkedBlindedBeaconBlock |
|
||||
bellatrix_mev.BlindedBeaconBlock |
|
||||
capella_mev.BlindedBeaconBlock |
|
||||
deneb_mev.BlindedBeaconBlock
|
||||
): Future[SignatureResult] {.async.} =
|
||||
|
@ -499,20 +498,6 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
|||
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Deneb,
|
||||
data: blck.denebData.toBeaconBlockHeader),
|
||||
proofs)
|
||||
elif blck is bellatrix_mev.BlindedBeaconBlock:
|
||||
case v.data.remoteType
|
||||
of RemoteSignerType.Web3Signer:
|
||||
Web3SignerRequest.init(fork, genesis_validators_root,
|
||||
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Bellatrix,
|
||||
data: blck.toBeaconBlockHeader)
|
||||
)
|
||||
of RemoteSignerType.VerifyingWeb3Signer:
|
||||
let proofs = blockPropertiesProofs(
|
||||
blck.body, bellatrixIndex)
|
||||
Web3SignerRequest.init(fork, genesis_validators_root,
|
||||
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Bellatrix,
|
||||
data: blck.toBeaconBlockHeader),
|
||||
proofs)
|
||||
elif blck is capella_mev.BlindedBeaconBlock:
|
||||
case v.data.remoteType
|
||||
of RemoteSignerType.Web3Signer:
|
||||
|
|
Loading…
Reference in New Issue