using deneb_mev for Deneb is less incorrect than using capella_mev (#5516)

This commit is contained in:
tersec 2023-10-20 01:39:47 +00:00 committed by GitHub
parent 769316d909
commit a986a1bcd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -5,6 +5,8 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
{.push raises: [].}
import std/[typetraits, strutils] import std/[typetraits, strutils]
import stew/[assign2, results, base10, byteutils, endians2], presto/common, import stew/[assign2, results, base10, byteutils, endians2], presto/common,
libp2p/peerid, serialization, json_serialization, libp2p/peerid, serialization, json_serialization,
@ -162,9 +164,8 @@ type
RestBlockTypes* = phase0.BeaconBlock | altair.BeaconBlock | RestBlockTypes* = phase0.BeaconBlock | altair.BeaconBlock |
bellatrix.BeaconBlock | capella.BeaconBlock | bellatrix.BeaconBlock | capella.BeaconBlock |
DenebBlockContents | capella_mev.BlindedBeaconBlock DenebBlockContents | capella_mev.BlindedBeaconBlock |
deneb_mev.BlindedBeaconBlock
{.push raises: [].}
proc prepareJsonResponse*(t: typedesc[RestApiResponse], d: auto): seq[byte] = proc prepareJsonResponse*(t: typedesc[RestApiResponse], d: auto): seq[byte] =
let res = let res =
@ -1223,7 +1224,7 @@ proc readValue*[BlockType: ForkedBlindedBeaconBlock](
let res = let res =
try: try:
RestJson.decode(string(data.get()), RestJson.decode(string(data.get()),
capella_mev.BlindedBeaconBlock, deneb_mev.BlindedBeaconBlock,
requireAllFields = true, requireAllFields = true,
allowUnknownFields = true) allowUnknownFields = true)
except SerializationError as exc: except SerializationError as exc:
@ -3483,7 +3484,7 @@ proc decodeBytes*[T: DecodeConsensysTypes](
case fork case fork
of ConsensusFork.Deneb: of ConsensusFork.Deneb:
let let
blck = ? readSszResBytes(capella_mev.BlindedBeaconBlock, value) blck = ? readSszResBytes(deneb_mev.BlindedBeaconBlock, value)
forked = ForkedBlindedBeaconBlock( forked = ForkedBlindedBeaconBlock(
kind: ConsensusFork.Deneb, denebData: blck) kind: ConsensusFork.Deneb, denebData: blck)
ok(ProduceBlindedBlockResponse(forked)) ok(ProduceBlindedBlockResponse(forked))

View File

@ -155,7 +155,7 @@ type
of ConsensusFork.Altair: altairData*: altair.BeaconBlock of ConsensusFork.Altair: altairData*: altair.BeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix_mev.BlindedBeaconBlock of ConsensusFork.Bellatrix: bellatrixData*: bellatrix_mev.BlindedBeaconBlock
of ConsensusFork.Capella: capellaData*: capella_mev.BlindedBeaconBlock of ConsensusFork.Capella: capellaData*: capella_mev.BlindedBeaconBlock
of ConsensusFork.Deneb: denebData*: capella_mev.BlindedBeaconBlock of ConsensusFork.Deneb: denebData*: deneb_mev.BlindedBeaconBlock
ForkedTrustedBeaconBlock* = object ForkedTrustedBeaconBlock* = object
case kind*: ConsensusFork case kind*: ConsensusFork
@ -191,7 +191,7 @@ type
of ConsensusFork.Altair: altairData*: altair.SignedBeaconBlock of ConsensusFork.Altair: altairData*: altair.SignedBeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix_mev.SignedBlindedBeaconBlock of ConsensusFork.Bellatrix: bellatrixData*: bellatrix_mev.SignedBlindedBeaconBlock
of ConsensusFork.Capella: capellaData*: capella_mev.SignedBlindedBeaconBlock of ConsensusFork.Capella: capellaData*: capella_mev.SignedBlindedBeaconBlock
of ConsensusFork.Deneb: denebData*: capella_mev.SignedBlindedBeaconBlock of ConsensusFork.Deneb: denebData*: deneb_mev.SignedBlindedBeaconBlock
ForkySigVerifiedSignedBeaconBlock* = ForkySigVerifiedSignedBeaconBlock* =
phase0.SigVerifiedSignedBeaconBlock | phase0.SigVerifiedSignedBeaconBlock |
@ -562,7 +562,7 @@ func init*(T: type ForkedSignedBlindedBeaconBlock,
signature: signature)) signature: signature))
of ConsensusFork.Deneb: of ConsensusFork.Deneb:
T(kind: ConsensusFork.Deneb, T(kind: ConsensusFork.Deneb,
denebData: capella_mev.SignedBlindedBeaconBlock(message: forked.denebData, denebData: deneb_mev.SignedBlindedBeaconBlock(message: forked.denebData,
signature: signature)) signature: signature))
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: phase0.MsgTrustedSignedBeaconBlock): T = template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: phase0.MsgTrustedSignedBeaconBlock): T =