From c7f444be4f2d9524697c86c4bc0eab8c51e3aa3a Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Mon, 4 May 2026 12:52:15 +0400 Subject: [PATCH] document empty-kvs short-circuit in LibFlow.flow NatSpec `LibFlow.flow` skips the `interpreterStore.set` call entirely when `kvs.length == 0` as a gas optimisation. NatSpec now states this so custom stores cannot incorrectly assume `set` is invoked on every flow. Closes #307. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/lib/LibFlow.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/LibFlow.sol b/src/lib/LibFlow.sol index 3212d63d..bb5ef753 100644 --- a/src/lib/LibFlow.sol +++ b/src/lib/LibFlow.sol @@ -137,6 +137,9 @@ library LibFlow { /// interpreter store. Then processes the ERC20, ERC721 and ERC1155 transfers /// in the flow. Guarantees ordering of the transfers but DOES NOT prevent /// reentrancy attacks. This is the responsibility of the caller. + /// `set` is skipped entirely when `kvs.length == 0`. Stores that need to + /// observe every flow invocation (e.g. for audit logging) cannot rely on + /// `set` being called for empty kvs. /// @param flowTransfer The `FlowTransferV1` to process. /// @param interpreterStore The `IInterpreterStoreV1` to set state on. /// @param kvs The key value pairs to set on the interpreter store.