Skip to content

feat: state validation and execution engine for generalized transactions - #164

Open
SIDDHANTCOOKIE wants to merge 3 commits into
feature/generalized-tx-primitivesfrom
feature/generalized-tx-state
Open

SIDDHANTCOOKIE wants to merge 3 commits into
feature/generalized-tx-primitivesfrom
feature/generalized-tx-state

Conversation

@SIDDHANTCOOKIE

Copy link
Copy Markdown
Member

Summary

This is PR 2 of the generalized transaction roadmap (stacked on PR #163). It implements the state validation and execution engine for generalized transactions in \minichain/state.py.

Key Features:

  1. Balance Pool Conservation Law:
    • Enforces that the transaction pool is strictly conserved: for every asset, total withdrawals must cover total deposits and contract call endowments (unless minted by the asset creator under \ALLOW_MINT).
  2. Multi-Signer Solvency & Nonce Validation:
    • Verifies that all participating senders in \withdrawals\ have sufficient balances for their debits (plus gas cost for the primary fee payer).
    • Validates nonces for all required signers against their on-chain account nonces.
  3. Atomic Multi-Party Execution & Rollback:
    • Processes withdrawals (debiting senders) and deposits (crediting receivers) atomically across accounts.
    • Executes contract deployments and calls within the transaction, with support for \ ransfer_out\ and proper gas metering/refunds.
    • If any call fails, rolls back the entire state journal while charging gas used and advancing signers' nonces to prevent replay.
  4. Minting & Burning Compliance:
    • Seamlessly integrates with \ALLOW_MINT\ (creators minting supply into the pool) and \ALLOW_BURN\ (depositing to \BURN_ADDRESS).
  5. Zero Breaking Changes:
    • Preserves existing legacy execution paths for single-sender transactions and deployments.

Test Plan

  • Added \ ests/test_generalized_state.py\ with 9 tests covering transfers shorthand execution, multi-party atomic swaps, pool deficit rejection, insufficient balance rejection, nonce mismatch rejection, minting, burning, and contract deployment/calls.
  • Full test suite: 393 passed.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 2
  • main
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: StabilityNexus/MiniChain/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: afe443bd-deea-4c65-9628-8341b8254773

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Legacy transactions now run through the generalized engine. Fixes the
generalized deploy address (nonce-1, same-tx collisions), charges gas for
minters paying in their own token, caps component count, and stops
validation from creating empty accounts.
@SIDDHANTCOOKIE
SIDDHANTCOOKIE force-pushed the feature/generalized-tx-state branch from 53c53d8 to f2d694d Compare October 18, 2026 19:27
Withdrawals must equal deposits plus call amounts per asset, so burns
must be explicit deposits to the burn address with ALLOW_BURN.
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.

1 participant