Skip to content

Commit

Permalink
change substrate sig verify
Browse files Browse the repository at this point in the history
  • Loading branch information
tpkeeper committed Sep 17, 2021
1 parent fa50a36 commit ca74900
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion node/pallets/general/signature/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ use frame_system::offchain::AppCrypto;

pub fn verify_signature(symbol: RSymbol, pubkey: &Vec<u8>, signature: &Vec<u8>, message: &Vec<u8>) -> SigVerifyResult {
match symbol.chain_type() {
ChainType::Substrate => substrate_verify(&pubkey, &signature, &message),
ChainType::Substrate => {
let mut pre = b"<Bytes>".to_vec();
let mut end = b"</Bytes>".to_vec();
pre.append(&mut message.clone());
pre.append(&mut end);
substrate_verify(&pubkey, &signature, &pre)
},
ChainType::Tendermint => tendermint_verify(&pubkey, &signature, &message),
ChainType::Solana => {
let use_message = to_ascii_hex(message);
Expand Down
8 changes: 7 additions & 1 deletion node/pallets/rtoken/series/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ use frame_system::offchain::AppCrypto;

pub fn verify_signature(symbol: RSymbol, pubkey: &Vec<u8>, signature: &Vec<u8>, message: &Vec<u8>) -> SigVerifyResult {
match symbol.chain_type() {
ChainType::Substrate => substrate_verify(&pubkey, &signature, &message),
ChainType::Substrate => {
let mut pre = b"<Bytes>".to_vec();
let mut end = b"</Bytes>".to_vec();
pre.append(&mut message.clone());
pre.append(&mut end);
substrate_verify(&pubkey, &signature, &pre)
},
ChainType::Tendermint => tendermint_verify(&pubkey, &signature, &message),
ChainType::Solana => {
let use_message = to_ascii_hex(message);
Expand Down

0 comments on commit ca74900

Please sign in to comment.