@@ -25,17 +25,18 @@ pub struct RecorderAlonzoGovernance;
2525#[ derive( serde:: Serialize , serde:: Deserialize ) ]
2626struct ReplayerGenesisKeyhash ( #[ serde_as( as = "Base64" ) ] GenesisKeyhash ) ;
2727
28+ // key, vote
29+ #[ derive( serde:: Serialize ) ]
30+ struct VoteRecord ( ReplayerGenesisKeyhash , Box < ProtocolParamUpdate > ) ;
31+
32+ // slot, epoch, era (num), new_epoch, [enactment epoch, voting]
33+ #[ derive( serde:: Serialize ) ]
34+ struct BlockRecord ( u64 , u64 , u8 , u8 , Vec < ( u64 , Vec < VoteRecord > ) > ) ;
35+
2836struct BlockRecorder {
2937 cfg : Arc < ReplayerConfig > ,
3038 prefix : String ,
31- // slot, epoch, era (num), new_epoch, [enactment epoch, voting: [key, vote]]
32- list : Vec < (
33- u64 ,
34- u64 ,
35- u8 ,
36- u8 ,
37- Vec < ( u64 , Vec < ( ReplayerGenesisKeyhash , Box < ProtocolParamUpdate > ) > ) > ,
38- ) > ,
39+ list : Vec < BlockRecord > ,
3940}
4041
4142impl BlockRecorder {
@@ -47,22 +48,22 @@ impl BlockRecorder {
4748 }
4849 }
4950
50- pub fn write ( & mut self , block : & BlockInfo , votes : & Vec < AlonzoBabbageUpdateProposal > ) {
51+ pub fn write ( & mut self , block : & BlockInfo , votes : & [ AlonzoBabbageUpdateProposal ] ) {
5152 let file = format ! ( "{}/{}.json" , self . cfg. path, self . prefix) ;
5253
5354 let mut proposals = Vec :: new ( ) ;
5455 for vote in votes. iter ( ) {
5556 let mut votes_indexed = Vec :: new ( ) ;
5657 for ( h, u) in & vote. proposals {
57- votes_indexed. push ( ( ReplayerGenesisKeyhash ( h. clone ( ) ) , u. clone ( ) ) ) ;
58+ votes_indexed. push ( VoteRecord ( ReplayerGenesisKeyhash ( h. clone ( ) ) , u. clone ( ) ) ) ;
5859 }
5960 proposals. push ( ( vote. enactment_epoch , votes_indexed) ) ;
6061 }
6162
62- self . list . push ( (
63+ self . list . push ( BlockRecord (
6364 block. slot ,
6465 block. epoch ,
65- block. era . clone ( ) as u8 ,
66+ block. era as u8 ,
6667 block. new_epoch as u8 ,
6768 proposals,
6869 ) ) ;
0 commit comments