Skip to content

Add custom multisig signature #4695

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

Merged
merged 2 commits into from
Jun 11, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Changed how multisig signatures are added to a tx
([\#4695](https://github.com/anoma/namada/pull/4695))
19 changes: 2 additions & 17 deletions crates/tx/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,21 +818,9 @@ impl Tx {
signatures: BTreeMap::new(),
signer: Signer::PubKeys(vec![]),
};
let mut sections = HashMap::new();
// Put the supplied signatures into the correct sections
for signature in signatures {
if let Some((addr, idx)) = &signature.index {
// Add the signature under the given multisig address
let section =
sections.entry(addr.clone()).or_insert_with(|| {
Authorization {
targets: vec![self.raw_header_hash()],
signatures: BTreeMap::new(),
signer: Signer::Address(addr.clone()),
}
});
section.signatures.insert(*idx, signature.signature);
} else if let Signer::PubKeys(pks) = &mut pk_section.signer {
if let Signer::PubKeys(pks) = &mut pk_section.signer {
// Add the signature under its corresponding public key
pk_section.signatures.insert(
u8::try_from(pks.len())
Expand All @@ -842,10 +830,7 @@ impl Tx {
pks.push(signature.pubkey);
}
}
for section in std::iter::once(pk_section).chain(sections.into_values())
{
self.add_section(Section::Authorization(section));
}
self.add_section(Section::Authorization(pk_section));
self
}

Expand Down
Loading