Skip to content

Commit 98b59fa

Browse files
committed
docs: add changeset
1 parent 45d42fa commit 98b59fa

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

.changeset/rude-toes-relax.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
"@evolution-sdk/devnet": patch
3+
"@evolution-sdk/evolution": patch
4+
---
5+
6+
Add deferred redeemer construction for dynamic index resolution
7+
8+
**RedeemerBuilder module** (`RedeemerBuilder.ts`):
9+
- `IndexedInput` type: `{ index: number, utxo: UTxO }` - provides the final sorted index and original UTxO after coin selection
10+
- Three modes for redeemer construction:
11+
- `Static`: Direct Data value when index not needed
12+
- `Self`: Per-input function `(input: IndexedInput) => Data` for single UTxO index
13+
- `Batch`: Multi-input function `(inputs: IndexedInput[]) => Data` for stake validator coordinator pattern
14+
- Type guards: `isSelfFn`, `isBatchBuilder`, `isStaticData`
15+
- Internal types: `DeferredRedeemer`, `toDeferredRedeemer`
16+
17+
**Evaluation phase updates**:
18+
- Add `resolveDeferredRedeemers` to convert deferred redeemers after coin selection
19+
- Build `refToIndex` and `refToUtxo` mappings from sorted inputs
20+
- Invoke Self/Batch callbacks with resolved `IndexedInput` objects
21+
22+
**Operations updates**:
23+
- `collectFrom` and `mintTokens` now accept `RedeemerArg` (Data | SelfRedeemerFn | BatchRedeemerBuilder)
24+
- Store deferred redeemers in `state.deferredRedeemers` for later resolution
25+
26+
**Test coverage** (`TxBuilder.RedeemerBuilder.test.ts`):
27+
- Tests for all three modes with mint_multi_validator.ak spec
28+
29+
**Architecture docs** (`redeemer-indexing.mdx`):
30+
- Document the circular dependency problem and deferred construction solution
31+
- Explain stake validator coordinator pattern with O(1) index lookup

packages/evolution-devnet/test/TxBuilder.Scripts.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ describe("TxBuilder Script Handling", () => {
198198
expect(redeemer.tag).toBe("spend")
199199
expect(redeemer.exUnits.mem).toBeGreaterThan(0n) // mem > 0
200200
expect(redeemer.exUnits.steps).toBeGreaterThan(0n) // steps > 0
201-
202-
// Note: Inline datums don't require plutusData in witness set
203-
// The datum is already stored on-chain in the UTxO
204201
})
205202
it("should handle collateral inputs with multiassets and return excess to user as collateral return", async () => {
206203
const alwaysSucceedsScript = makePlutusV2Script(ALWAYS_SUCCEED_SCRIPT_CBOR)

0 commit comments

Comments
 (0)