Skip to content

fix(factory): wrap treasury init failures in TreasuryInitFailed - #8

Merged
K1NGD4VID merged 1 commit into
mainfrom
fix/factory-wrap-treasury-init-errors
Sep 15, 2026
Merged

K1NGD4VID merged 1 commit into
mainfrom
fix/factory-wrap-treasury-init-errors

Conversation

@K1NGD4VID

Copy link
Copy Markdown
Contributor

deploy_treasury called the new treasury's initialize directly, so a treasury failure (e.g. InvalidThreshold #8) propagated with the treasury's own error code. Treasury and factory codes overlap with different meanings, so clients could decode it as the wrong factory error.

Call try_initialize and raise the new Error::TreasuryInitFailed = 5 on any failure (contract, auth or host error). The panic reverts the whole deploy, so no treasury or org record is left behind.

Tests: threshold 3 with 2 approvers returns TreasuryInitFailed with org count 0; threshold 0 panics with Error(Contract, #5). Documented in the README error table.

deploy_treasury called the new treasury's initialize directly, so a
treasury failure (e.g. InvalidThreshold #8) propagated with the
treasury's own error code. Treasury and factory codes overlap with
different meanings, so clients could decode it as the wrong factory
error.

Call try_initialize and raise the new Error::TreasuryInitFailed = 5 on
any failure (contract, auth or host error). The panic reverts the whole
deploy, so no treasury or org record is left behind.

Tests: threshold 3 with 2 approvers returns TreasuryInitFailed with org
count 0; threshold 0 panics with Error(Contract, #5). Documented in the
README error table.
@K1NGD4VID
K1NGD4VID merged commit a50fa49 into main Sep 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants