mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 06:46:10 +00:00
remove some debugRaiseAsserts and fill in Electra functionality (#6178)
This commit is contained in:
parent
06894dd2f6
commit
0d534224b3
@ -409,8 +409,11 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||
withBlck(message.blck):
|
||||
let data =
|
||||
when consensusFork >= ConsensusFork.Electra:
|
||||
debugRaiseAssert "validator API, electra"
|
||||
default(phase0.BeaconBlock)
|
||||
let blobsBundle = message.blobsBundleOpt.get()
|
||||
electra.BlockContents(
|
||||
`block`: forkyBlck,
|
||||
kzg_proofs: blobsBundle.proofs,
|
||||
blobs: blobsBundle.blobs)
|
||||
elif consensusFork >= ConsensusFork.Deneb:
|
||||
let blobsBundle = message.blobsBundleOpt.get()
|
||||
deneb.BlockContents(
|
||||
|
@ -70,6 +70,7 @@ RestJson.useDefaultSerializationFor(
|
||||
DepositReceipt,
|
||||
DepositTreeSnapshot,
|
||||
DistributedKeystoreInfo,
|
||||
ElectraSignedBlockContents,
|
||||
EmptyBody,
|
||||
Eth1Data,
|
||||
EventBeaconBlockObject,
|
||||
@ -245,6 +246,7 @@ RestJson.useDefaultSerializationFor(
|
||||
electra.BeaconBlock,
|
||||
electra.BeaconState,
|
||||
electra.BeaconBlockBody,
|
||||
electra.BlockContents,
|
||||
electra.ExecutionPayload,
|
||||
electra.ExecutionPayloadHeader,
|
||||
electra.SignedBeaconBlock,
|
||||
@ -2299,7 +2301,7 @@ proc writeValue*(
|
||||
writer.writeField("data", value.denebData)
|
||||
of ConsensusFork.Electra:
|
||||
writer.writeField("version", "electra")
|
||||
debugRaiseAssert "writeValue RestJson Electra ForkedSignedBaconBlock"
|
||||
writer.writeField("data", value.electraData)
|
||||
writer.endRecord()
|
||||
|
||||
# ForkedHashedBeaconState is used where a `ForkedBeaconState` normally would
|
||||
@ -3616,8 +3618,17 @@ proc decodeBody*(
|
||||
ok(RestPublishedSignedBlockContents(
|
||||
kind: ConsensusFork.Deneb, denebData: blckContents))
|
||||
of ConsensusFork.Electra:
|
||||
debugRaiseAssert "electra"
|
||||
return err(RestErrorMessage.init(Http400, UnexpectedDecodeError))
|
||||
let blckContents =
|
||||
try:
|
||||
SSZ.decode(body.data, ElectraSignedBlockContents)
|
||||
except SerializationError as exc:
|
||||
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
||||
[version, exc.formatMsg("<data>")]))
|
||||
except CatchableError as exc:
|
||||
return err(RestErrorMessage.init(Http400, UnexpectedDecodeError,
|
||||
[version, $exc.msg]))
|
||||
ok(RestPublishedSignedBlockContents(
|
||||
kind: ConsensusFork.Electra, electraData: blckContents))
|
||||
else:
|
||||
err(RestErrorMessage.init(Http415, "Invalid content type",
|
||||
[version, $body.contentType]))
|
||||
@ -3748,9 +3759,24 @@ proc decodeBodyJsonOrSsz*(
|
||||
ok(RestPublishedSignedBlockContents(
|
||||
kind: ConsensusFork.Deneb, denebData: blckContents))
|
||||
of ConsensusFork.Electra:
|
||||
debugRaiseAssert "electra"
|
||||
let blckContents =
|
||||
try:
|
||||
RestJson.decode(body.data, ElectraSignedBlockContents,
|
||||
requireAllFields = true,
|
||||
allowUnknownFields = true)
|
||||
except SerializationError as exc:
|
||||
debug "Failed to decode JSON data",
|
||||
err = exc.formatMsg("<data>"),
|
||||
data = string.fromBytes(body.data)
|
||||
return err(
|
||||
RestErrorMessage.init(Http400, UnexpectedDecodeError))
|
||||
RestErrorMessage.init(Http400, UnableDecodeError,
|
||||
[version, exc.formatMsg("<data>")]))
|
||||
except CatchableError as exc:
|
||||
return err(
|
||||
RestErrorMessage.init(Http400, UnexpectedDecodeError,
|
||||
[version, $exc.msg]))
|
||||
ok(RestPublishedSignedBlockContents(
|
||||
kind: ConsensusFork.Electra, electraData: blckContents))
|
||||
else:
|
||||
err(RestErrorMessage.init(Http415, "Invalid content type",
|
||||
[version, $body.contentType]))
|
||||
|
@ -536,8 +536,7 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
||||
let web3signerRequest =
|
||||
when blck is ForkedBlindedBeaconBlock:
|
||||
case blck.kind
|
||||
of ConsensusFork.Phase0 .. ConsensusFork.Capella, ConsensusFork.Electra:
|
||||
debugRaiseAssert "move electra case out"
|
||||
of ConsensusFork.Phase0 .. ConsensusFork.Capella:
|
||||
return SignatureResult.err("Invalid blinded beacon block fork")
|
||||
of ConsensusFork.Deneb:
|
||||
case v.data.remoteType
|
||||
@ -552,6 +551,19 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
|
||||
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Deneb,
|
||||
data: blck.denebData.toBeaconBlockHeader),
|
||||
proofs)
|
||||
of ConsensusFork.Electra:
|
||||
case v.data.remoteType
|
||||
of RemoteSignerType.Web3Signer:
|
||||
Web3SignerRequest.init(fork, genesis_validators_root,
|
||||
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Electra,
|
||||
data: blck.electraData.toBeaconBlockHeader))
|
||||
of RemoteSignerType.VerifyingWeb3Signer:
|
||||
let proofs = blockPropertiesProofs(
|
||||
blck.electraData.body, electraIndex)
|
||||
Web3SignerRequest.init(fork, genesis_validators_root,
|
||||
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Electra,
|
||||
data: blck.electraData.toBeaconBlockHeader),
|
||||
proofs)
|
||||
elif blck is deneb_mev.BlindedBeaconBlock:
|
||||
case v.data.remoteType
|
||||
of RemoteSignerType.Web3Signer:
|
||||
|
@ -275,8 +275,8 @@ proc cmdBench(conf: DbConf, cfg: RuntimeConfig) =
|
||||
blocks[4].add dag.db.getBlock(
|
||||
blck.root, deneb.TrustedSignedBeaconBlock).get()
|
||||
of ConsensusFork.Electra:
|
||||
debugRaiseAssert ""
|
||||
let x = 5
|
||||
blocks[5].add dag.db.getBlock(
|
||||
blck.root, electra.TrustedSignedBeaconBlock).get()
|
||||
|
||||
let stateData = newClone(dag.headState)
|
||||
|
||||
|
@ -130,9 +130,7 @@ proc loadOps(
|
||||
SSZ, consensusFork.SignedBeaconBlock)
|
||||
|
||||
blobData =
|
||||
when consensusFork >= ConsensusFork.Electra:
|
||||
debugRaiseAssert "no electra support in fc test"
|
||||
elif consensusFork >= ConsensusFork.Deneb:
|
||||
when consensusFork >= ConsensusFork.Deneb:
|
||||
if step.hasKey"blobs":
|
||||
numExtraFields += 2
|
||||
Opt.some BlobData(
|
||||
|
@ -82,8 +82,8 @@ proc getTestStates*(
|
||||
cfg.CAPELLA_FORK_EPOCH = 3.Epoch
|
||||
if consensusFork >= ConsensusFork.Deneb:
|
||||
cfg.DENEB_FORK_EPOCH = 4.Epoch
|
||||
|
||||
debugRaiseAssert "ELECTRA_FORK_EPOCH"
|
||||
if consensusFork >= ConsensusFork.Electra:
|
||||
cfg.ELECTRA_FORK_EPOCH = 5.Epoch
|
||||
|
||||
for i, epoch in stateEpochs:
|
||||
let slot = epoch.Epoch.start_slot
|
||||
|
Loading…
x
Reference in New Issue
Block a user