Commit 530e44a
feat(offer): make Offer entity immutable and idempotent
The Offer entity was previously mutable with "latest offer hash wins"
semantics, which didn't match how the entity is actually used. For a
given agreementId, the RCA identifying fields (payer, dataService,
serviceProvider, deadline, nonce) are fixed by the id derivation, so
any duplicate OfferStored event for the same id carries the same
offerHash by construction. There is nothing meaningful to overwrite.
Switch the entity to @entity(immutable: true) and early-return from
handleOfferStored when an entity with the same id already exists.
Writing twice to an immutable entity would halt the subgraph, so the
guard is load-bearing against dipper crash-recovery re-submissions and
chain reorg re-emissions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b180a5d commit 530e44a
2 files changed
Lines changed: 21 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
0 commit comments