Skip to content

feat: generalized transaction primitives (Withdrawal, Deposit, ContractCall, Transfer) - #163

Open
SIDDHANTCOOKIE wants to merge 2 commits into
feature/miner-configurable-fee-assetsfrom
feature/generalized-tx-primitives
Open

SIDDHANTCOOKIE wants to merge 2 commits into
feature/miner-configurable-fee-assetsfrom
feature/generalized-tx-primitives

Conversation

@SIDDHANTCOOKIE

Copy link
Copy Markdown
Member

Summary

This PR implements the first milestone of the generalized transaction model proposed by Bruno as an intermediary step toward a hybrid account/UTXO architecture.

What is included:

  1. Core Primitives:
    • \Withdrawal(sender, amount): Unifies fund withdrawals from an account into the transaction pool.
    • \Deposit(receiver, amount): Unifies fund distribution from the pool to recipients.
    • \ContractCall(caller, address, amount, data): Encapsulates smart contract execution and deployments with callers.
    • \Transfer(sender, receiver, amount): Syntactic sugar shorthand (Option 2) that deterministically expands to \Withdrawal(sender, amount)\ and \Deposit(receiver, amount).
  2. Option 2 Shorthand (Eliminating Duplicate Amounts on Wire):
    • For simple 1-to-1 transfers, transactions can accept a \ ransfers\ list. The amount is written once on the wire/serialized payload, and deserializes/expands canonically into internal withdrawals and deposits.
  3. Multi-Party Signatures & Swaps:
    • Supports multiple senders and callers on a single transaction with \signatures: dict[str, str].
    • \ x.sign(signing_key)\ checks signer identity and accumulates signatures.
    • \ x.verify()\ ensures all required senders/callers have cryptographically signed the canonical hash payload.
  4. Complete Backward Compatibility:
    • Legacy \Transaction(sender, receiver, amount, nonce, ...)\ continues to work with zero breaking changes, internally mapping to the generalized primitives while maintaining legacy properties (\ x.sender, \ x.receiver, \ x.amount, \ x.nonce, \ x.data, \ x.signature).

Test Plan

  • Added \ ests/test_generalized_tx.py\ with 10 unit tests covering primitives, Option 2 shorthand, multi-party atomic swap signing, tamper detection, and legacy backward compatibility.
  • Full test suite passed: 384 passed.

…ctCall, Transfer) and multi-signature support
@coderabbitai

coderabbitai Bot commented Oct 16, 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: d4a6e062-eee0-441e-94f1-c6eecbd1c927

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.

Use dataclasses for primitives, keep legacy and generalized txs on one
verify path, serialize mixed transfers/withdrawals/deposits, add signed
fee_payer, and reject extra signatures or nonces for non-signers.
@SIDDHANTCOOKIE
SIDDHANTCOOKIE added this pull request to stack #158 October 18, 2026 20:15
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