@@ -17,11 +17,6 @@ const VOTE_CAST_TAG: u8 = 11;
1717/// INPUT-ACCOUNT = %xff VALUE UNTAG-ACCOUNT-ID
1818const INPUT_ACCOUNT : u8 = 255 ;
1919
20- /// Block epoch + slot
21- /// This is redundant as time checks have been removed
22- const EPOCH : u32 = 0 ;
23- const SLOT : u32 = 0 ;
24-
2520/// Only 1 input (subsequently 1 witness), no output
2621/// VoteCast TX should have only 1 input, 0 output and 1 witness (signature).
2722const INPUT : u8 = 1 ;
@@ -51,6 +46,8 @@ pub fn generate_vote_fragment(
5146 proof : Vec < u8 > ,
5247 proposal : u8 ,
5348 vote_plan_id : & [ u8 ] ,
49+ epoch : u32 ,
50+ slot : u32 ,
5451) -> Result < Vec < u8 > , Box < dyn error:: Error > > {
5552 let mut vote_cast = Codec :: new ( Vec :: new ( ) ) ;
5653
@@ -62,7 +59,8 @@ pub fn generate_vote_fragment(
6259
6360 let data_to_sign = vote_cast. into_inner ( ) . clone ( ) ;
6461
65- let ( inputs, witness) = compose_inputs_and_witnesses ( keypair, data_to_sign. clone ( ) ) ?;
62+ let ( inputs, witness) =
63+ compose_inputs_and_witnesses ( keypair, data_to_sign. clone ( ) , epoch, slot) ?;
6664
6765 let mut vote_cast = Codec :: new ( Vec :: new ( ) ) ;
6866 vote_cast. put_bytes ( & data_to_sign) ?;
@@ -85,11 +83,13 @@ pub fn generate_vote_fragment(
8583fn compose_inputs_and_witnesses (
8684 keypair : Keypair ,
8785 data_to_sign : Vec < u8 > ,
86+ epoch : u32 ,
87+ slot : u32 ,
8888) -> Result < ( Vec < u8 > , Vec < u8 > ) , Box < dyn error:: Error > > {
8989 let mut inputs = Codec :: new ( Vec :: new ( ) ) ;
9090
91- inputs. put_be_u32 ( EPOCH ) ?;
92- inputs. put_be_u32 ( SLOT ) ?;
91+ inputs. put_be_u32 ( epoch ) ?;
92+ inputs. put_be_u32 ( slot ) ?;
9393 inputs. put_u8 ( INPUT ) ?;
9494 inputs. put_u8 ( OUTPUT ) ?;
9595
@@ -219,6 +219,8 @@ mod tests {
219219 proof,
220220 5 ,
221221 & hex:: decode ( vote_plan_id. clone ( ) ) . unwrap ( ) ,
222+ 0 ,
223+ 0 ,
222224 )
223225 . unwrap ( ) ;
224226
0 commit comments