@@ -3,11 +3,8 @@ use serde::{Deserialize, Serialize};
33use ssz_derive:: { Decode , Encode } ;
44
55use super :: {
6- blinded_block_body:: { BlindedBeaconBlockBodyDeneb , BlindedBeaconBlockBodyElectra } ,
7- blobs_bundle:: BlobsBundle ,
8- execution_payload:: ExecutionPayload ,
9- spec:: { DenebSpec , ElectraSpec } ,
10- utils:: VersionedResponse ,
6+ blinded_block_body:: BlindedBeaconBlockBodyElectra , blobs_bundle:: BlobsBundle ,
7+ execution_payload:: ExecutionPayload , spec:: ElectraSpec , utils:: VersionedResponse ,
118} ;
129
1310#[ derive( Debug , Default , Clone , Serialize , Deserialize , Encode , Decode ) ]
@@ -21,28 +18,24 @@ impl SignedBlindedBeaconBlock {
2118 pub fn block_hash ( & self ) -> B256 {
2219 match & self . message {
2320 BlindedBeaconBlock :: Electra ( b) => b. body . execution_payload_header . block_hash ,
24- BlindedBeaconBlock :: Deneb ( b) => b. body . execution_payload_header . block_hash ,
2521 }
2622 }
2723
2824 pub fn block_number ( & self ) -> u64 {
2925 match & self . message {
3026 BlindedBeaconBlock :: Electra ( b) => b. body . execution_payload_header . block_number ,
31- BlindedBeaconBlock :: Deneb ( b) => b. body . execution_payload_header . block_number ,
3227 }
3328 }
3429
3530 pub fn parent_hash ( & self ) -> B256 {
3631 match & self . message {
3732 BlindedBeaconBlock :: Electra ( b) => b. body . execution_payload_header . parent_hash ,
38- BlindedBeaconBlock :: Deneb ( b) => b. body . execution_payload_header . parent_hash ,
3933 }
4034 }
4135
4236 pub fn slot ( & self ) -> u64 {
4337 match & self . message {
4438 BlindedBeaconBlock :: Electra ( b) => b. slot ,
45- BlindedBeaconBlock :: Deneb ( b) => b. slot ,
4639 }
4740 }
4841}
@@ -51,27 +44,15 @@ impl SignedBlindedBeaconBlock {
5144#[ serde( untagged) ]
5245#[ ssz( enum_behaviour = "transparent" ) ]
5346pub enum BlindedBeaconBlock {
54- Deneb ( BlindedBeaconBlockDeneb ) ,
5547 Electra ( BlindedBeaconBlockElectra ) ,
5648}
5749
5850impl Default for BlindedBeaconBlock {
5951 fn default ( ) -> Self {
60- Self :: Deneb ( BlindedBeaconBlockDeneb :: default ( ) )
52+ Self :: Electra ( BlindedBeaconBlockElectra :: default ( ) )
6153 }
6254}
6355
64- #[ derive( Debug , Default , Clone , Serialize , Deserialize , Encode , Decode ) ]
65- pub struct BlindedBeaconBlockDeneb {
66- #[ serde( with = "serde_utils::quoted_u64" ) ]
67- pub slot : u64 ,
68- #[ serde( with = "serde_utils::quoted_u64" ) ]
69- pub proposer_index : u64 ,
70- pub parent_root : B256 ,
71- pub state_root : B256 ,
72- pub body : BlindedBeaconBlockBodyDeneb < DenebSpec > ,
73- }
74-
7556#[ derive( Debug , Default , Clone , Serialize , Deserialize , Encode , Decode ) ]
7657pub struct BlindedBeaconBlockElectra {
7758 #[ serde( with = "serde_utils::quoted_u64" ) ]
@@ -84,30 +65,16 @@ pub struct BlindedBeaconBlockElectra {
8465}
8566
8667/// Returned by relay in submit_block
87- pub type SubmitBlindedBlockResponse =
88- VersionedResponse < PayloadAndBlobsDeneb , PayloadAndBlobsElectra > ;
68+ pub type SubmitBlindedBlockResponse = VersionedResponse < PayloadAndBlobsElectra > ;
8969
9070impl SubmitBlindedBlockResponse {
9171 pub fn block_hash ( & self ) -> B256 {
9272 match self {
93- VersionedResponse :: Deneb ( d) => d. block_hash ( ) ,
9473 VersionedResponse :: Electra ( d) => d. block_hash ( ) ,
9574 }
9675 }
9776}
9877
99- #[ derive( Debug , Default , Clone , Serialize , Deserialize , Encode , Decode ) ]
100- pub struct PayloadAndBlobsDeneb {
101- pub execution_payload : ExecutionPayload < DenebSpec > ,
102- pub blobs_bundle : BlobsBundle < DenebSpec > ,
103- }
104-
105- impl PayloadAndBlobsDeneb {
106- pub fn block_hash ( & self ) -> B256 {
107- self . execution_payload . block_hash
108- }
109- }
110-
11178#[ derive( Debug , Default , Clone , Serialize , Deserialize , Encode , Decode ) ]
11279pub struct PayloadAndBlobsElectra {
11380 pub execution_payload : ExecutionPayload < ElectraSpec > ,
@@ -128,23 +95,6 @@ mod tests {
12895 use super :: * ;
12996 use crate :: utils:: { test_encode_decode, test_encode_decode_ssz} ;
13097
131- #[ test]
132- // this is from the builder api spec, but with sync_committee_bits fixed to
133- // deserialize correctly
134- fn test_signed_blinded_block_deneb ( ) {
135- let data = include_str ! ( "testdata/signed-blinded-beacon-block-deneb-2.json" ) ;
136- let block = test_encode_decode :: < SignedBlindedBeaconBlock > ( & data) ;
137- assert ! ( matches!( block. message, BlindedBeaconBlock :: Deneb ( _) ) ) ;
138- }
139-
140- #[ test]
141- // this is from mev-boost test data
142- fn test_signed_blinded_block_fb_deneb ( ) {
143- let data = include_str ! ( "testdata/signed-blinded-beacon-block-deneb.json" ) ;
144- let block = test_encode_decode :: < SignedBlindedBeaconBlock > ( & data) ;
145- assert ! ( matches!( block. message, BlindedBeaconBlock :: Deneb ( _) ) ) ;
146- }
147-
14898 #[ test]
14999 // this is from mev-boost test data
150100 fn test_signed_blinded_block_fb_electra ( ) {
@@ -156,11 +106,11 @@ mod tests {
156106 #[ test]
157107 // this is from the builder api spec, but with blobs fixed to deserialize
158108 // correctly
159- fn test_submit_blinded_block_response_deneb ( ) {
109+ fn test_submit_blinded_block_response_electra ( ) {
160110 let blob = alloy:: primitives:: hex:: encode_prefixed ( [ 1 ; 131072 ] ) ;
161111
162112 let data = json ! ( {
163- "version" : "deneb " ,
113+ "version" : "electra " ,
164114 "data" : {
165115 "execution_payload" : {
166116 "parent_hash" :
@@ -209,7 +159,7 @@ mod tests {
209159 } ) . to_string ( ) ;
210160
211161 let block = test_encode_decode :: < SubmitBlindedBlockResponse > ( & data) ;
212- assert ! ( matches!( block, SubmitBlindedBlockResponse :: Deneb ( _) ) ) ;
162+ assert ! ( matches!( block, SubmitBlindedBlockResponse :: Electra ( _) ) ) ;
213163 }
214164
215165 #[ test]
@@ -230,21 +180,10 @@ mod tests {
230180 #[ test]
231181 // this is dummy data generated with https://github.com/attestantio/go-builder-client
232182 fn test_execution_payload_block_ssz ( ) {
233- let data_json = include_str ! ( "testdata/execution-payload-deneb.json" ) ;
234- let block_json = test_encode_decode :: < PayloadAndBlobsDeneb > ( & data_json) ;
235-
236- let data_ssz = include_bytes ! ( "testdata/execution-payload-deneb.ssz" ) ;
237- let data_ssz = alloy:: primitives:: hex:: decode ( data_ssz) . unwrap ( ) ;
238- test_encode_decode_ssz :: < PayloadAndBlobsDeneb > ( & data_ssz) ;
239-
240- assert_eq ! ( block_json. as_ssz_bytes( ) , data_ssz) ;
241-
242- // electra and deneb have the same execution payload
243-
244- let data_json = include_str ! ( "testdata/execution-payload-deneb.json" ) ;
183+ let data_json = include_str ! ( "testdata/execution-payload-electra.json" ) ;
245184 let block_json = test_encode_decode :: < PayloadAndBlobsElectra > ( & data_json) ;
246185
247- let data_ssz = include_bytes ! ( "testdata/execution-payload-deneb .ssz" ) ;
186+ let data_ssz = include_bytes ! ( "testdata/execution-payload-electra .ssz" ) ;
248187 let data_ssz = alloy:: primitives:: hex:: decode ( data_ssz) . unwrap ( ) ;
249188 test_encode_decode_ssz :: < PayloadAndBlobsElectra > ( & data_ssz) ;
250189
0 commit comments