This repository was archived by the owner on Apr 8, 2022. It is now read-only.
This repository was archived by the owner on Apr 8, 2022. It is now read-only.
Witness signature should be versioned with the signature algorithm #131
Open
Description
Looking at this code from utxo/lib.src
:
pub fn sign(
mut self,
utxos: &[TransactionOutput<AccountId>],
index: usize,
pk: &sr25519::Public,
) -> Option<Self> {
let msg = crate::sign::TransactionSigMsg::construct(
Default::default(),
&self,
utxos,
index as u64,
u32::MAX,
);
self.inputs[index].witness =
crypto::sr25519_sign(SR25519, pk, &msg.encode())?.0.to_vec();
Some(self)
}
And given that we may use a different signature algorithm in the future, it may be wise to use a serialization mechanism that can detect the signature algorithm. A simple way of doing this is: Instead of using Vec as type for the witness, we use an enum that has SR25519 as one arm with Vec as underlying type, and we just support adding more in the future. Scalecodec can take care of the serialization.
PS: Whether we're gonna remove the witness from inputs is a different discussion.
Metadata
Metadata
Assignees
Labels
No labels