Repository navigation
feat: add mutable protocol-level multisig account support - #27
digitalSloth wants to merge 1 commit into
Conversation
digitalSloth
commented
Jul 2, 2026
- src/model/primitives/address.ts, index.ts, src/index.ts: add Address.multisigByte/isMultisig/fromMultisigCreation and the MULTISIG_ADDRESS vanity constant.
- src/model/nom/accountBlock.ts: add optional multisigAuth field to AccountBlockTemplate/AccountBlock with base64 JSON round-trip; omitted entirely from toJson when unset.
- src/utilities/block.ts: comment-only note in getTxHash documenting that multisigAuth is excluded from the consensus preimage (INV-1); extract validateReceiveBlock out of checkAndSetFields (behavior-preserving, INV-2); add new exported freezeBlock/signBlock/assembleMultisigAuth primitives for both send and receive multisig blocks.
- src/embedded/multisig.ts, src/model/embedded/multisig.ts, src/api/embedded/multisig.ts: new 12th embedded contract (CreateMultisig/ ChangePolicy ABI, MultisigPolicyInfo/MultisigRecordInfo models, MultisigApi with getPolicy/createMultisig/changePolicy), wired into src/embedded/index.ts, src/model/embedded/index.ts, src/api/embedded/embedded.ts and src/index.ts (MultisigContract only, matching the htlc precedent — MultisigApi is not surfaced top-level).
- src/client/nodeErrors.ts (new) + src/client/index.ts: central typed node-error registry (mapNodeError) and a flat Znn...Exception hierarchy rooted at ZnnEmbeddedContractException extends ZnnClientException.
- src/client/http.ts, src/client/websocket.ts, src/api/ledger.ts: route both RPC-error channels and the publishRawTransaction non-null-result channel through mapNodeError.
- test/api/ledger.spec.ts: update the publish-error assertion to match the new typed-error shape (was asserting the old NETWORK_ERROR message).
93b4def to
ff41873
Compare
- src/model/primitives/address.ts, index.ts, src/index.ts: add Address.multisigByte/isMultisigAddress/fromMultisigCreation and the MULTISIG_ADDRESS vanity constant. - src/model/nom/accountBlock.ts: add optional multisigAuth field to AccountBlockTemplate/AccountBlock with base64 JSON round-trip; omitted entirely from toJson when unset. - src/utilities/block.ts: document that multisigAuth is excluded from the consensus preimage in getTxHash; extract validateReceiveBlock out of checkAndSetFields; add exported freezeBlock/signBlock/assembleMultisigAuth primitives for send and receive multisig blocks. - src/embedded/multisig.ts, src/model/embedded/multisig.ts, src/api/embedded/multisig.ts: new embedded contract (CreateMultisig/ ChangePolicy ABI, MultisigPolicyInfo/MultisigRecordInfo models, MultisigApi with getPolicy/createMultisig/changePolicy), wired into src/embedded/index.ts, src/model/embedded/index.ts, src/api/embedded/embedded.ts and src/index.ts. - src/api/embedded/constants.ts: add MULTISIG_CREATION_FEE_IN_ZNN; createMultisig burns this fee instead of 0n, takes a required creator address, and throws MultisigCreatorMustBeSingleSigException if the creator is itself a multisig address. - src/client/nodeErrors.ts (new) + src/client/index.ts, src/index.ts: central typed node-error registry (mapNodeError) and a flat Znn...Exception hierarchy rooted at ZnnEmbeddedContractException extends ZnnClientException, covering multisig policy/threshold/authority errors and account-block auth errors. - src/client/http.ts, src/client/websocket.ts, src/api/ledger.ts: route RPC errors and the publishRawTransaction non-null-result channel through mapNodeError. - docs/multisig.md, docs/api-overview.md: document address derivation, account creation (including the balance precondition for the burn), cross-machine signing, signature-collection timing, and error handling. - test/api/embedded/multisig.spec.ts, test/client/errors.spec.ts, test/api/ledger.spec.ts: cover the new contract templates, error mappings, and the typed-error publish path.
ff41873 to
f1b6e0f
Compare
|
Reviewed at The three-phase pipeline (freeze → sign → assemble) is the right shape. Freezing before collecting signatures means every signer signs the identical hash, including across the The hash-invariance tests are the important ones. They pin that One doc mismatch with the node side: in go-zenon#72, — mr.stockholm.Z |