@Revinand Thank you, they should, and the draft gets this case wrong as it stands. “Late facts” orders a pre-allocation against the first public purchase “by block number and then log index”, so in your sequence K’s AllocationDeclared, emitted in the callback, comes before Swap and counts as disclosed. Log index orders the events inside a transaction. It does not say what the buyer could read, and the buyer’s transaction was signed before that declaration existed.
The boundary is the start of the transaction that makes the first public purchase. A pre-allocation counts as disclosed at launch only if its AllocationDeclared event is emitted in an earlier transaction, by block number and then by the transaction’s index in its block. One emitted anywhere in the purchase’s own transaction is late, whatever its log index: in a v3 swap callback, in a v4 beforeSwap hook (PoolManager.swap calls it before _swap emits Swap), or in a bonding curve’s buy function before its own trade event. A fact declared in an earlier transaction is in the state the purchase transaction starts from, so a check the buyer’s transaction makes before it buys can read it; nothing written during that transaction was there to be read. Between transactions this is the line #11 drew, and it now also holds within one.
Why not the purchase event or a venue event. Inside a purchase, log order follows the code the purchase runs through, and the venue writes part of that code, so whichever event a detector took as the purchase, the venue could declare ahead of it. v3 shows that the choice changes the answer: the pool transfers the bought tokens before it calls back (the lines you link), so a declaration made in the callback comes after the token’s Transfer and before Swap. A venue-specific event comes wherever the venue puts it, ERC-8376’s included, since only the venue calls recordPurchase, and keying the rule to one would need a definition per venue. The start of purchase execution, after a router’s earlier calls or partway through a batch, is marked by no log, so a detector would need traces to find it. Every log carries its transaction’s index, as it carries its log index.
Evidence is unchanged: an ERC-8376 evidence leaf commits to blockNumber and txHash, and a transaction hash fixes the transaction’s index in its block, so a detector still commits the order it found, and a contract still takes the classification from a report (“Use by ERC-8376 detectors”).
Worked example, added to Test Cases after the first. All in one block: in the first transaction the venue opens the declaration, sends 10% of supply to H and 5% to K, declares H’s 10% and seeds a v3 pool; in the second a buyer makes the first public purchase through the venue, which calls the pool’s swap and, in uniswapV3SwapCallback, pays the pool and declares K’s 5%. K’s AllocationDeclared has a lower log index than Swap, and K’s 5% still counts as undisclosed, because it was declared in the purchase’s transaction. It counts the same if the venue declares it in a beforeSwap hook, or before its own purchase event. H’s 10% was disclosed at launch.
The launch transaction itself. A purchase the launch transaction makes, such as a creator’s initial buy, is supply allocated before public trading opened, declared like any other allocation, and not the first public purchase. The rule is strict inside a transaction on purpose: a bundler that packs several users’ operations into one transaction, as an ERC-4337 bundle does, can run a venue’s launch and then a buyer’s purchase. That buyer’s checks could read the launch’s declarations, yet they count as late, since telling the two cases apart takes a trace. So a venue SHOULD keep public purchases out of the transaction that declares its allocations: a bonding curve can refuse every purchase but its launch call’s own while a transient-storage flag that call set is still set (EIP-1153 storage clears when the transaction ends), and a venue that seeds a pool it does not control can declare in an earlier transaction.
These are in #2106 now (5d91e6bf): “Late facts”, the declaredAt paragraph of “Amendment and supersession”, “Use by ERC-8376 detectors” and Test Cases.