File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,10 @@ impl Adapter for EthereumAdapter {
130
130
}
131
131
132
132
fn verify ( & self , signer : & ValidatorId , state_root : & str , sig : & str ) -> AdapterResult < bool > {
133
- let decoded_signature = hex:: decode ( sig)
133
+ if !sig. starts_with ( "0x" ) {
134
+ return Err ( AdapterError :: Signature ( "not 0x prefixed hex" . to_string ( ) ) ) ;
135
+ }
136
+ let decoded_signature = hex:: decode ( & sig[ 2 ..] )
134
137
. map_err ( |_| AdapterError :: Signature ( "invalid signature" . to_string ( ) ) ) ?;
135
138
let address = Address :: from_slice ( signer. inner ( ) ) ;
136
139
let signature = Signature :: from_electrum ( & decoded_signature) ;
@@ -473,7 +476,7 @@ mod test {
473
476
474
477
// Verify
475
478
let signature =
476
- "ce654de0b3d14d63e1cb3181eee7a7a37ef4a06c9fabc204faf96f26357441b625b1be460fbe8f5278cc02aa88a5d0ac2f238e9e3b8e4893760d33bccf77e47f1b " ;
479
+ "0xce654de0b3d14d63e1cb3181eee7a7a37ef4a06c9fabc204faf96f26357441b625b1be460fbe8f5278cc02aa88a5d0ac2f238e9e3b8e4893760d33bccf77e47f1b " ;
477
480
let verify = eth_adapter
478
481
. verify (
479
482
& ValidatorId :: try_from ( "2bDeAFAE53940669DaA6F519373f686c1f3d3393" )
You can’t perform that action at this time.
0 commit comments