Skip to content

Expose stateOverlay on quote (quote3 / IRaindexV7) #60

@thedavidmeister

Description

@thedavidmeister

Ask

quote must accept a stateOverlay parameter.

The interpreter's eval4 takes a stateOverlay, and post-H01 the on-chain calculate path (RaindexV6.calculateOrderIO(..., stateOverlay)) does too. But the interface's quote entrypoint IRaindexV6.quote2(QuoteV2) has no stateOverlay — the raindex impl is forced to pass new bytes32[](0), so quotes can only ever be evaluated against fresh/empty store state. Callers should be able to pass a stateOverlay to quote and simulate an order's calculate against arbitrary interpreter state.

Shape

Breaking interface addition → new interface version IRaindexV7 (coexists with IRaindexV6):

  • quote3(QuoteV3 quoteConfig) where QuoteV3 adds a bytes32[] stateOverlay field, or
  • quote3(QuoteV2 quoteConfig, bytes32[] stateOverlay).

Overlay format matches the interpreter's: [key0, val0, key1, val1, …] (identical to the calculate kvs). The raindex impl already threads stateOverlay internally — quote3 just forwards the caller-supplied one instead of new bytes32[](0).

Motivation (one example, not the only use)

The H01 fix (rainlanguage/raindex#2627, audit rainlanguage/raindex#2617) threads same-owner calculate writes within a takeOrders4 batch via stateOverlay. quote2 (empty overlay) can't reproduce that, so it over-states availability for a later same-owner order in a batch. With a stateOverlay on quote, a caller can pass the accumulated state and quote accurately. More generally, exposing the overlay lets callers simulate against any state.

References

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions