fix: transaction duplicate counting - #172
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| eventLog.save(); | ||
|
|
||
| // create "processPieceDeletions" transaction | ||
| const transactionCreated = getOrCreateTransaction( |
There was a problem hiding this comment.
shouldn't this exist in the pdpVerifier abi?
or maybe this should be nextProvingPeriod? Since the existing dataset-status test says PiecesRemoved is emitted as part of nextProvingPeriod.
There was a problem hiding this comment.
This doesn't need to be in the verifier abi unless we configure a handler for that method.
Also, in this PDPVerifier update, PiecesRemoved was moved out of nextProvingPeriod and is now emitted from processPieceDeletions. I've updated the handling to attribute it to the method it is actually emitted from.
To keep the ABI from becoming stale, we can implement something like https://github.com/FIL-Builders/fwss-subgraph/blob/d6da072ac778addf4f69f03d9f9db8013b530add/scripts/utils/config-loader.ts#L82.
| event: ethereum.Event, | ||
| method: string, | ||
| ): boolean { | ||
| if (Transaction.loadInBlock(transactionEntityId) != null) { |
There was a problem hiding this comment.
The ID is only the tx hash, so if a router/batch transaction touches two datasets, the first dataset creates the Transaction and the second one returns false. That means the second dataset won’t increment totalTransactions, and its event log points to a Transaction linked to the first dataset. Could we scope this by tx hash + set ID, or add a dataset-transaction entity? A same-hash, cross-dataset test would catch this.
There was a problem hiding this comment.
I thought about this earlier but couldn't come up with a solution that handled the different batching cases cleanly. I gave it some more thought today and changed the transaction ID to txHash + setID + methodSig.
methodSig was added so we can keep each Transaction entity immutable instead of changing transaction.method into a mutable array. This also allows the ui to represent the same tx hash as separate tx entries when it contains multiple method calls.
This covers:
- different methods on the same dataset,
- the same method on different datasets, and
- different methods on different datasets within the same transaction.
No description provided.