-
Notifications
You must be signed in to change notification settings - Fork 157
feat: implement Indexing Agreements #1134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: horizon
Are you sure you want to change the base?
Conversation
feat: implement Indexing Agreements
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
b0f7e7f
to
ae910c4
Compare
b53a31a
to
d0a4db2
Compare
32252c4
to
de6b7a1
Compare
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
f4ea27a
to
8776a18
Compare
753442f
to
7ba3dd1
Compare
65f7f1d
to
ef651a6
Compare
packages/subgraph-service/contracts/libraries/IndexingAgreement.sol
Outdated
Show resolved
Hide resolved
packages/horizon/contracts/data-service/utilities/ProvisionManager.sol
Outdated
Show resolved
Hide resolved
packages/horizon/contracts/payments/collectors/RecurringCollector.sol
Outdated
Show resolved
Hide resolved
packages/horizon/contracts/payments/collectors/RecurringCollector.sol
Outdated
Show resolved
Hide resolved
packages/horizon/contracts/payments/collectors/RecurringCollector.sol
Outdated
Show resolved
Hide resolved
packages/horizon/contracts/payments/collectors/RecurringCollector.sol
Outdated
Show resolved
Hide resolved
packages/horizon/contracts/payments/collectors/RecurringCollector.sol
Outdated
Show resolved
Hide resolved
packages/horizon/contracts/payments/collectors/RecurringCollector.sol
Outdated
Show resolved
Hide resolved
wrapper.collectorAgreement.serviceProvider, | ||
address(_getSubgraphService()) | ||
); | ||
require(provision.tokens != 0, DisputeManagerZeroTokens()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check means we can't slash delegators (if delegation slashing is enabled some day) in a case of multiple disputes where the indexer is already fully slashed. So maybe use a different check or check if there's nonzero delegation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is also present in _createQueryDisputeWithAttestation
and _createIndexingDisputeWithAllocation
. Should we fix those instances as well?
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds reasonable. I looked at previous audits to see if this was discussed but did not find anything.
Fixed it for Indexing and query fee disputes here: d89440a
(#1183)
Going to include it in the fix review OZ is going to do for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll port the fix...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase on top of Tommy's fix, port fix to indexing feees and let Trust know about this change.
|
||
import { IndexingAgreement } from "./IndexingAgreement.sol"; | ||
|
||
library UnsafeDecoder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it unsafe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I'm not sure I see the benefit of implementing these separately from Decoder.sol, is there a size/performance improvement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming could use some improvement. It's "unsafe" in the sense that it reverts with a generic error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decoder
and UnsafeDecoder
are two separate libs, because:
Decoder
is a lib to reduce size in the service.try / catch
can only be used on external function call.- A lib can't call itself externally.
All of these together resulted in the two separate implementations. Maybe there is a better way to do it that I'm missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im confused by this as well, cant we put everything into a Decoder library that has only external functions?
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the benefit of catching and re throwing is that we can be more descriptive with the error. iirc abi.decode tends to fail with Reverted without reason
. I don't mind either approach but I think if we try/catch we could combine both libraries into a single one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can't combine both libraries into one. As I mentioned before try / catch
needs to call an external function and a library can't call it's own external functions. I'd prefer to keep the custom errors because the amount of time I spent debugging Reverted without reason
dwarfs the added complexity of having two libs. Would be very happy to find a better name for either lib though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Find a new name. Decoder is too generic. Unsafe sounds dangerous. Maybe IndexingAgreementDecoder
packages/subgraph-service/contracts/libraries/IndexingAgreement.sol
Outdated
Show resolved
Hide resolved
ef651a6
to
aac9682
Compare
5ebb424
to
7dee19f
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
6765c56
to
f0d158f
Compare
ok, NatSpec added, |
Included in the changes is a markdown file with a TODO
Additional reading: Indexing Payments technical specification v0.1