Skip to content

Commit 239997e

Browse files
committed
NODE-131, fix: add verifiers to signature (#76)
* NODE-131, fix: add pool_round to signature * NODE-131, fix: add SigDomain * NODE-131, fix: use concatenated bytes * NODE-131, fix: use remove :?
1 parent 8846acf commit 239997e

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pallets/btc-registration-pool/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ pub struct SetRefundState {
104104
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
105105
/// The payload used for public key submission.
106106
pub struct VaultKeyPreSubmission<AccountId> {
107+
/// The authority Ethereum address. (Relay executive)
107108
pub authority_id: AccountId,
109+
/// The public keys. (all in 33 bytes)
108110
pub pub_keys: Vec<Public>,
111+
/// The pool round.
112+
pub pool_round: PoolRound,
109113
}

pallets/btc-socket-queue/src/pallet/mod.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,8 @@ pub mod pallet {
902902
Self::verify_authority(authority_id)?;
903903

904904
// verify if the signature was originated from the authority_id.
905-
if !signature.verify(psbt.as_ref(), authority_id) {
905+
let message = [keccak_256("UnsignedPsbt".as_bytes()).as_slice(), psbt].concat();
906+
if !signature.verify(&*message, authority_id) {
906907
return InvalidTransaction::BadProof.into();
907908
}
908909

@@ -921,7 +922,9 @@ pub mod pallet {
921922
}
922923

923924
// verify if the signature was originated from the authority.
924-
if !signature.verify(signed_psbt.as_ref(), authority_id) {
925+
let message =
926+
[keccak_256("SignedPsbt".as_bytes()).as_slice(), signed_psbt].concat();
927+
if !signature.verify(&*message, authority_id) {
925928
return InvalidTransaction::BadProof.into();
926929
}
927930

@@ -936,7 +939,9 @@ pub mod pallet {
936939
Self::verify_authority(authority_id)?;
937940

938941
// verify if the signature was originated from the authority_id.
939-
if !signature.verify(txid.as_ref(), authority_id) {
942+
let message =
943+
[keccak_256("ExecutedPsbt".as_bytes()).as_slice(), txid.as_ref()].concat();
944+
if !signature.verify(&*message, authority_id) {
940945
return InvalidTransaction::BadProof.into();
941946
}
942947

@@ -955,7 +960,9 @@ pub mod pallet {
955960
}
956961

957962
// verify if the signature was originated from the authority_id.
958-
if !signature.verify(txid.as_ref(), authority_id) {
963+
let message =
964+
[keccak_256("RollbackPoll".as_bytes()).as_slice(), txid.as_ref()].concat();
965+
if !signature.verify(&*message, authority_id) {
959966
return InvalidTransaction::BadProof.into();
960967
}
961968

0 commit comments

Comments
 (0)