3

Does the order of signers keys signing a transaction matter?

While going through the versioned transaction source code, signer_keys and expected_signer_keys vectors are being compared and this throws a KeypairPubkeyMismatch if the order of keys signing the transaction does not match.

impl VersionedTransaction {
    /// Signs a versioned message and if successful, returns a signed
    /// transaction.
    pub fn try_new<T: Signers>(
        message: VersionedMessage,
        keypairs: &T,
    ) -> std::result::Result<Self, SignerError> {
        let static_account_keys = message.static_account_keys();
        if static_account_keys.len() < message.header().num_required_signatures as usize {
            return Err(SignerError::InvalidInput("invalid message".to_string()));
        }

        let signer_keys = keypairs.pubkeys();
        let expected_signer_keys =
            &static_account_keys[0..message.header().num_required_signatures as usize];
        ...
        if signer_keys != expected_signer_keys {
            return Err(SignerError::KeypairPubkeyMismatch);
        }

More at here

1 Answer 1

2

The order does matter. The first signer included in the array of signers is always the one responsible for paying the transactions fees.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.