Skip to content

Check contract-account debtors when they sign, not at submission - #14

Merged
samjay8 merged 1 commit into
mainfrom
feat/contract-account-debtors
Oct 27, 2026
Merged

samjay8 merged 1 commit into
mainfrom
feat/contract-account-debtors

Conversation

@samjay8

@samjay8 samjay8 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #11.

A debtor that is a contract account (a smart wallet with its own __check_auth) was accepted on trust, so a bad signature only surfaced when the batch was simulated for submission, holding up every debtor in it.

Accept now simulates a batch in enforcing mode as soon as a submission completes it, before recording anything:

  • The request brought a contract account's entry and the network refuses it: the request is refused, 422 with the network's reason. This is the issue's done-when.
  • The request brought only account signatures, which are checked locally: they're kept. The contract accounts' entries are cleared with the reason, now shown as error in GET …/authorizations, so only those parties sign again.
  • The RPC is unreachable: nothing is recorded, and the debtor retries.

A contract account's signature can't be checked while other debtors in its batch are unsigned, because enforcing simulation needs every entry. So the check runs at the moment the batch becomes complete, whoever completes it.

Tests

settletest now models contract accounts whose __check_auth takes an Ed25519 signature as bytes.

  • A wrong-key signature from a wallet is refused when posted, nothing is recorded or sent, and the right key then settles the window.
  • A wallet signs badly first. An account then completes the batch: the account keeps its signature, the wallet's entry is cleared with the reason, and nothing is submitted.

go vet, go test -race ./... and golangci-lint (0 issues) all pass. README, OpenAPI and CHANGELOG are updated, and the roadmap item is done.

A debtor that is a contract account checks its own signature, so its entry
was accepted on trust and a bad one only surfaced when the batch was
simulated for submission, holding up everyone in it.

Accept now simulates a batch in enforcing mode as soon as a submission
completes it, before recording anything. If the request brought a contract
account's entry and the network refuses the batch, the request is refused
with the network's reason. If it brought only account signatures (already
checked locally), those are kept and the contract accounts' entries are
cleared with the reason, shown in GET .../authorizations as error, so only
they sign again. An unreachable RPC records nothing and the debtor retries.

settletest models contract accounts whose __check_auth takes an Ed25519
signature as bytes. Tests cover a bad signature refused at the moment it is
posted, then the right one settling, and a bad signature found when an
account completes the batch.

Closes #11.
@samjay8
samjay8 merged commit d329b6c into main Oct 27, 2026
12 checks 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.

[enhancement]: settle windows whose debtors are contract accounts

1 participant