You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem Statement
A user submitting N swaps in an atomic batch currently pays roughly
N× the per-swap cost because every swap re-runs KYC, fee math,
cache invalidation, and event emission. The "atomic" semantic requires
all-or-nothing rollback, which today is implemented by cloning the
entire Portfolio (see Issue #70).
(The historical title called this "Layer-2" — that framing implied
rollup / optimistic semantics that do not apply here. Retitled.)
Expected Outcome
Build on Issue #70's delta snapshot machinery so that pre-settlement
state can be cheaply rebuilt, and amortize the fixed costs of KYC,
rate limits, cache invalidation, and event emission across N swaps in
a single batch.
Acceptance Criteria
Established by measurement: run the existing execute_batch_atomic
on a 100-swap fixture and capture baseline gas; the implementation
target is "≤ baseline minus amortized fixed-cost overhead" — i.e.
no worse than the current implementation, with N swaps paying one
KYC check, one cache flush, and one batched event.
Problem Statement
A user submitting N swaps in an atomic batch currently pays roughly
N× the per-swap cost because every swap re-runs KYC, fee math,
cache invalidation, and event emission. The "atomic" semantic requires
all-or-nothing rollback, which today is implemented by cloning the
entire
Portfolio(see Issue #70).(The historical title called this "Layer-2" — that framing implied
rollup / optimistic semantics that do not apply here. Retitled.)
Expected Outcome
Build on Issue #70's delta snapshot machinery so that pre-settlement
state can be cheaply rebuilt, and amortize the fixed costs of KYC,
rate limits, cache invalidation, and event emission across N swaps in
a single batch.
Acceptance Criteria
execute_batch_atomicon a 100-swap fixture and capture baseline gas; the implementation
target is "≤ baseline minus amortized fixed-cost overhead" — i.e.
no worse than the current implementation, with N swaps paying one
KYC check, one cache flush, and one batched event.
Portfoliofor atomic batch #70).Files Affected
peerx-contracts/counter/src/lib.rs,batch.rs.Dependency Issue #70.
Difficulty / Effort 🥑 / XL
Labels
feature,performance,priority/medium