Fix publishBlockV1() and publishBlockV2() SSZ decoding process. (#6408)
This commit is contained in:
parent
0dc2447a58
commit
85c2850971
|
@ -3536,7 +3536,9 @@ proc decodeBody*(
|
||||||
of ConsensusFork.Phase0:
|
of ConsensusFork.Phase0:
|
||||||
let blck =
|
let blck =
|
||||||
try:
|
try:
|
||||||
SSZ.decode(body.data, phase0.SignedBeaconBlock)
|
var res = SSZ.decode(body.data, phase0.SignedBeaconBlock)
|
||||||
|
res.root = hash_tree_root(res.message)
|
||||||
|
res
|
||||||
except SerializationError as exc:
|
except SerializationError as exc:
|
||||||
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
||||||
[version, exc.formatMsg("<data>")]))
|
[version, exc.formatMsg("<data>")]))
|
||||||
|
@ -3548,7 +3550,9 @@ proc decodeBody*(
|
||||||
of ConsensusFork.Altair:
|
of ConsensusFork.Altair:
|
||||||
let blck =
|
let blck =
|
||||||
try:
|
try:
|
||||||
SSZ.decode(body.data, altair.SignedBeaconBlock)
|
var res = SSZ.decode(body.data, altair.SignedBeaconBlock)
|
||||||
|
res.root = hash_tree_root(res.message)
|
||||||
|
res
|
||||||
except SerializationError as exc:
|
except SerializationError as exc:
|
||||||
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
||||||
[version, exc.formatMsg("<data>")]))
|
[version, exc.formatMsg("<data>")]))
|
||||||
|
@ -3560,7 +3564,9 @@ proc decodeBody*(
|
||||||
of ConsensusFork.Bellatrix:
|
of ConsensusFork.Bellatrix:
|
||||||
let blck =
|
let blck =
|
||||||
try:
|
try:
|
||||||
SSZ.decode(body.data, bellatrix.SignedBeaconBlock)
|
var res = SSZ.decode(body.data, bellatrix.SignedBeaconBlock)
|
||||||
|
res.root = hash_tree_root(res.message)
|
||||||
|
res
|
||||||
except SerializationError as exc:
|
except SerializationError as exc:
|
||||||
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
||||||
[version, exc.formatMsg("<data>")]))
|
[version, exc.formatMsg("<data>")]))
|
||||||
|
@ -3572,7 +3578,9 @@ proc decodeBody*(
|
||||||
of ConsensusFork.Capella:
|
of ConsensusFork.Capella:
|
||||||
let blck =
|
let blck =
|
||||||
try:
|
try:
|
||||||
SSZ.decode(body.data, capella.SignedBeaconBlock)
|
var res = SSZ.decode(body.data, capella.SignedBeaconBlock)
|
||||||
|
res.root = hash_tree_root(res.message)
|
||||||
|
res
|
||||||
except SerializationError as exc:
|
except SerializationError as exc:
|
||||||
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
||||||
[version, exc.formatMsg("<data>")]))
|
[version, exc.formatMsg("<data>")]))
|
||||||
|
@ -3584,7 +3592,9 @@ proc decodeBody*(
|
||||||
of ConsensusFork.Deneb:
|
of ConsensusFork.Deneb:
|
||||||
let blckContents =
|
let blckContents =
|
||||||
try:
|
try:
|
||||||
SSZ.decode(body.data, DenebSignedBlockContents)
|
var res = SSZ.decode(body.data, DenebSignedBlockContents)
|
||||||
|
res.signed_block.root = hash_tree_root(res.signed_block.message)
|
||||||
|
res
|
||||||
except SerializationError as exc:
|
except SerializationError as exc:
|
||||||
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
||||||
[version, exc.formatMsg("<data>")]))
|
[version, exc.formatMsg("<data>")]))
|
||||||
|
@ -3596,7 +3606,9 @@ proc decodeBody*(
|
||||||
of ConsensusFork.Electra:
|
of ConsensusFork.Electra:
|
||||||
let blckContents =
|
let blckContents =
|
||||||
try:
|
try:
|
||||||
SSZ.decode(body.data, ElectraSignedBlockContents)
|
var res = SSZ.decode(body.data, ElectraSignedBlockContents)
|
||||||
|
res.signed_block.root = hash_tree_root(res.signed_block.message)
|
||||||
|
res
|
||||||
except SerializationError as exc:
|
except SerializationError as exc:
|
||||||
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
return err(RestErrorMessage.init(Http400, UnableDecodeError,
|
||||||
[version, exc.formatMsg("<data>")]))
|
[version, exc.formatMsg("<data>")]))
|
||||||
|
|
Loading…
Reference in New Issue