0xMiden / 0xMiden/miden-proposals

Enable Atomic Composability via User-Defined Batches

未关闭
#7 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
没有语言数据
星标
1
派生
1
PR 合并指标
30 天内没有已合并 PR

描述

## TL;DR

Miden follows the **actor model**: each transaction represents the state transition of a single account. This enables **parallel execution** and **asynchronous transaction processing**, but comes at the cost of **atomic composability** — the ability to modify multiple accounts atomically in one transaction.

Many DeFi use cases (e.g., flash loans, DEX arbitrage, liquidations) rely on atomic multi-account operations. We're looking for a team to research and implement **user-defined batches** as a way to bring atomic composability to Miden without sacrificing its core architectural advantages.

---

## Problem

Miden's actor model processes one account per transaction:
- This allows efficient parallel execution
- It minimizes contention and improves scalability

However, it also **prevents atomic updates across multiple accounts**. For example:
- A flashloan where funds are borrowed, used, and repaid must happen in one atomic operation
- Complex DeFi protocols often require multi-step workflows involving several accounts

On Miden, each account is updated in isolation, so such atomic interactions are not currently possible.

---

## Proposed Direction: User-Defined Batches

Users could construct a **batch** of account updates (transactions) that are:
- Verified together
- Either all succeed or all fail (atomicity)
- Executed sequentially or in a specified order

This introduces a limited form of atomic composability **without breaking the actor model**.

Key considerations:
- Accounts touched by a batch must be **locked** during verification
- Execution remains deterministic and auditable
- Fees, proofs, and constraints must be aggregated and validated coherently

---

## Objectives

We are looking for a team to:

1. **Analyze** the problem and explore multiple solutions
- What are the trade-offs of different batching models?
- How do they fit with Miden's parallel proving and execution design?

2. **Design** a concrete mechanism for user-defined batches
- Define batch structure, verification rules, account locking, etc.
- Evaluate potential DoS or front-running vectors
- Ensure compatibility with note/account model

3. **Implement** the batching feature in the Miden SDK
- Batch builder and validator APIs
- Tooling to simulate and test batch transactions
- Error reporting and debug tooling

4. **Document** and teach
- Write developer-facing documentation
- Publish tutorials or walkthroughs on how to use batch transactions in practice

---

## Deliverables

- Specification document outlining the proposed batching design and rationale
- SDK implementation (batch builder, validator, etc.)
- CLI or testing tools for working with batches
- Documentation and tutorials for developers

Specific milestones and timelines are to be defined.

---

## Desired Expertise

- Familiarity with Miden’s architecture (actor model, off-chain proving, notes/accounts)
- Strong Rust and some MASM expertise

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。