fix: wasn't able to decode Electra Era BeaconBlock + invalid request_hash() generated#1820
Conversation
morph-dev
left a comment
There was a problem hiding this comment.
... but NetworkSpec currently doesn't store CL fork data (it will in the future) so we can update that code then
This is not true. We use CL fork data in several places already. In this case, we could do something like this:
network_spec().is_ethereum_fork_active_at_timestamp(
EthereumHardfork::Prague,
network_spec().slot_to_timestamp(slot),
)Probably better option would be to add is_ethereum_fork_active_at_slot directly inside NetworkSpec.
I don't think that this should block this PR, I just wanted to point out that it's possible at the moment, just not very elegant.
| use crate::consensus::{pubkey::PubKey, signature::BlsSignature}; | ||
|
|
||
| #[test] | ||
| fn test_requests_hash() { |
There was a problem hiding this comment.
I tried, and this specific test would pass with the old code, so it doesn't really test the regression that well :)
I think it would be better if you would use the real mainnet data (the one that it failed for). You would of course mention the slot / block number, so it doesn't appear just like random data.
There was a problem hiding this comment.
I don't think real test data matters in this case, but sure I can use real testdata
Not all CL forks happened at the same time as EL forks, so the idea above only works for the last 2 CL forks, but there is no guarantee it will work in the future as well. To do this properly we need to explicitly load the CL fork data into the NetworkSpec |

What was wrong?
I was trying to generate E2HS files from ElectraBeaconBlock's and
ElectraBeaconBlockrequest_hash()wrong.How was it fixed?
get_beacon_fork, in the future we should use NetworkSpec instead, but NetworkSpec currently doesn't store CL fork data (it will in the future) so we can update that code thenrequest_hash()you are supposed to convert the whole list of X objects to ssz, not do it individuallyAfter I added these fixes I was able to generate E2HS files from ElectraBeaconBlocks.
I added a test case for
requests_hash()to prevent regressions.