Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multisig order independence #6

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions stackslib/src/chainstate/stacks/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,11 @@ impl TransactionSpendingCondition {

Some(TransactionSpendingCondition::Singlesig(
SinglesigSpendingCondition {
signer: signer_addr.bytes.clone(),
signer: signer_addr.bytes,
nonce: 0,
tx_fee: 0,
hash_mode: SinglesigHashMode::P2PKH,
key_encoding: key_encoding,
key_encoding,
signature: MessageSignature::empty(),
},
))
Expand All @@ -730,7 +730,7 @@ impl TransactionSpendingCondition {

Some(TransactionSpendingCondition::Singlesig(
SinglesigSpendingCondition {
signer: signer_addr.bytes.clone(),
signer: signer_addr.bytes,
nonce: 0,
tx_fee: 0,
hash_mode: SinglesigHashMode::P2WPKH,
Expand All @@ -753,7 +753,7 @@ impl TransactionSpendingCondition {

Some(TransactionSpendingCondition::Multisig(
MultisigSpendingCondition {
signer: signer_addr.bytes.clone(),
signer: signer_addr.bytes,
nonce: 0,
tx_fee: 0,
hash_mode: MultisigHashMode::P2SH,
Expand All @@ -776,7 +776,7 @@ impl TransactionSpendingCondition {

Some(TransactionSpendingCondition::OrderIndependentMultisig(
OrderIndependentMultisigSpendingCondition {
signer: signer_addr.bytes.clone(),
signer: signer_addr.bytes,
nonce: 0,
tx_fee: 0,
hash_mode: OrderIndependentMultisigHashMode::P2SH,
Expand All @@ -799,7 +799,7 @@ impl TransactionSpendingCondition {

Some(TransactionSpendingCondition::OrderIndependentMultisig(
OrderIndependentMultisigSpendingCondition {
signer: signer_addr.bytes.clone(),
signer: signer_addr.bytes,
nonce: 0,
tx_fee: 0,
hash_mode: OrderIndependentMultisigHashMode::P2WSH,
Expand All @@ -822,7 +822,7 @@ impl TransactionSpendingCondition {

Some(TransactionSpendingCondition::Multisig(
MultisigSpendingCondition {
signer: signer_addr.bytes.clone(),
signer: signer_addr.bytes,
nonce: 0,
tx_fee: 0,
hash_mode: MultisigHashMode::P2WSH,
Expand Down
2 changes: 1 addition & 1 deletion stackslib/src/chainstate/stacks/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ impl StacksBlock {
}
}
if !tx.auth.is_supported_in_epoch(epoch_id) {
error!("Order independent multisig transactions not supported before Stacks 3.0");
error!("Authentication mode not supported in Epoch {epoch_id}");
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions stackslib/src/chainstate/stacks/db/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6650,7 +6650,9 @@ impl StacksChainState {
// 1: must parse (done)

// 2: it must be validly signed.
StacksChainState::process_transaction_precheck(&chainstate_config, &tx)
let epoch = clarity_connection.get_epoch().clone();

StacksChainState::process_transaction_precheck(&chainstate_config, &tx, epoch)
.map_err(|e| MemPoolRejection::FailedToValidate(e))?;

// 3: it must pay a tx fee
Expand All @@ -6664,8 +6666,6 @@ impl StacksChainState {
}

// 4: check if transaction is valid in the current epoch
let epoch = clarity_connection.get_epoch().clone();

if !StacksBlock::validate_transactions_static_epoch(&[tx.clone()], epoch) {
return Err(MemPoolRejection::Other(
"Transaction is not supported in this epoch".to_string(),
Expand Down
Loading
Loading