33/// Tests the complete slot lifecycle end-to-end:
44/// bid → beacon block → envelope → PTC → fork choice
55
6+ use blst:: min_pk:: SecretKey ;
67use eip_7732:: {
78 beacon_chain:: {
89 containers:: ExecutionPayload ,
@@ -15,15 +16,23 @@ use eip_7732::{
1516 guide:: HonestBuilder ,
1617 } ,
1718 fork_choice:: { handlers as fc, store:: { EpbsStore , SlotPayloadStatus } } ,
19+ utils:: crypto,
1820} ;
1921
20- fn dummy_signer ( _: & [ u8 ] ) -> Result < [ u8 ; 96 ] , String > { Ok ( [ 0u8 ; 96 ] ) }
22+ fn test_secret_key ( ) -> SecretKey {
23+ SecretKey :: from_bytes ( & [ 9u8 ; 32 ] ) . expect ( \" valid sk\" )
24+ }
25+
26+ fn bls_signer ( msg : & [ u8 ] ) -> Result < [ u8 ; 96 ] , String > {
27+ Ok ( crypto:: bls_sign ( & test_secret_key ( ) , msg) )
28+ }
2129
2230struct SimpleState {
2331 balance : u64 ,
2432 payments : Vec < eip_7732:: beacon_chain:: containers:: BuilderPendingPayment > ,
2533 slot : u64 ,
2634 latest_hash : [ u8 ; 32 ] ,
35+ pubkey : BLSPubkey ,
2736}
2837
2938impl BeaconStateMut for SimpleState {
@@ -34,6 +43,7 @@ impl BeaconStateMut for SimpleState {
3443 }
3544 fn current_slot ( & self ) -> u64 { self . slot }
3645 fn latest_block_hash ( & self ) -> [ u8 ; 32 ] { self . latest_hash }
46+ fn builder_pubkey ( & self , _: u64 ) -> Option < BLSPubkey > { Some ( self . pubkey ) }
3747}
3848
3949#[ test]
@@ -60,7 +70,7 @@ fn full_slot_happy_path() {
6070 execution_payment : 0 ,
6171 blob_kzg_commitments : vec ! [ ] ,
6272 } ,
63- dummy_signer ,
73+ bls_signer ,
6474 ) . unwrap ( ) ;
6575
6676 // 2. Beacon state processes bid
@@ -69,6 +79,7 @@ fn full_slot_happy_path() {
6979 payments : vec ! [ ] ,
7080 slot,
7181 latest_hash : parent_hash,
82+ pubkey : test_secret_key ( ) . sk_to_pk ( ) . to_bytes ( ) ,
7283 } ;
7384 process_execution_payload_bid ( & mut state, & bid) . unwrap ( ) ;
7485 assert_eq ! ( state. payments. len( ) , 1 ) ;
@@ -104,7 +115,7 @@ fn full_slot_happy_path() {
104115 committed_hash,
105116 expected_withdrawals : vec ! [ ] ,
106117 } ,
107- dummy_signer ,
118+ bls_signer ,
108119 ) . unwrap ( ) ;
109120
110121 // 5. Fork choice records payload
@@ -133,4 +144,4 @@ fn empty_slot_builder_not_paid() {
133144
134145 assert_eq ! ( store. slot_status( slot) , SlotPayloadStatus :: Empty ) ;
135146 assert ! ( store. check_reveal_safety( slot) == false ) ; // no reveal safety issue — builder just didn't reveal
136- }
147+ }
0 commit comments