Skip to content
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

feat: payments v1 #514

Merged
merged 38 commits into from
May 7, 2024
Merged

feat: payments v1 #514

merged 38 commits into from
May 7, 2024

Conversation

8sunyuan
Copy link
Collaborator

PaymentCoordinator Contract w/ unit tests and deploy scripts for Holesky
Will need to add documentation to /docs/core to followup.

* feat: payments w tests and deploy script

* chore: remove activatedAt and add require

checks payForRange startTimestamp
is multiple of calculationIntervalSeconds

* chore: uint32 for timestamps

* fix: storage off by one
* feat: payments w tests and deploy script (#512)

* feat: payments w tests and deploy script

* chore: remove activatedAt and add require

checks payForRange startTimestamp
is multiple of calculationIntervalSeconds

* chore: uint32 for timestamps

* fix: storage off by one

* chore: additional natspec
wadealexc

This comment was marked as resolved.

Copy link
Collaborator

@wadealexc wadealexc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome! Great work - super clean code.

I'm going to request one additional test: for the index bounds check added to _verifyEarnerClaimProof and _verifyTokenClaimProof, I'd just like us to verify that a claim using a leaf at exactly the maximum size for the tree in question is in fact claimable. Just to sanity check that the bound check is correct!

Approving the PR as everything else looks good :)

@8sunyuan
Copy link
Collaborator Author

@wadealexc


Unit test for the max earnerIndex and max tokenIndex for full binary tree of 8 leaves for both earners and token leaves.

claim.earnerIndex = claim.earnerIndex | uint32(1 << (numShift + proofLength / 32));

Unit test for reverting on larger indexes that could pass the proofs before the added require

@8sunyuan 8sunyuan added the payments-v1 related to upcoming MVP payments release label May 2, 2024
8sunyuan and others added 6 commits May 2, 2024 13:59
* docs: paymentCoord docs

* docs: clean up payment docs

* docs: tree structure png
* fix comment

* docs: update single recipient addr

* docs: tweak payment docs for clarity and brevity

---------

Co-authored-by: wadealexc <[email protected]>
also make cumulativeEarnings check strictly gt
ypatil12 and others added 2 commits May 6, 2024 15:38
* feat: add offchain assumptions to docs; Add offchain variables & token requirement

* docs: simplify off-chain calculcation description

* fix: doc ref

* fix: heading typo

* refactor: make offchain constants internal

* docs: fix typos
@8sunyuan
Copy link
Collaborator Author

8sunyuan commented May 7, 2024

PaymentCoordinator looking good to merge right now as part of the MVP release. Looking to go ahead with audits shortly after

@8sunyuan 8sunyuan merged commit 3eec97d into dev May 7, 2024
14 of 15 checks passed
@8sunyuan 8sunyuan deleted the payments branch May 7, 2024 16:04
wadealexc added a commit that referenced this pull request May 20, 2024
* feat: payments w tests and deploy script (#512)

* feat: payments w tests and deploy script

* chore: remove activatedAt and add require

checks payForRange startTimestamp
is multiple of calculationIntervalSeconds

* chore: uint32 for timestamps

* fix: storage off by one

* chore: additional natspec (#519)

* feat: payments w tests and deploy script (#512)

* feat: payments w tests and deploy script

* chore: remove activatedAt and add require

checks payForRange startTimestamp
is multiple of calculationIntervalSeconds

* chore: uint32 for timestamps

* fix: storage off by one

* chore: additional natspec

* chore: requested changes and fixes

* chore: pragmas

* refactor: reuse state read and clean up logic

* fix: relative paths

* chore: update event and tests

* fix: comments and add tests

* test: paused submitRoot flag

* chore: contract organization and added view fn

* chore: require comment

* chore: natspec

* feat: token receiver addresses

* chore: natspec with tokenReceivers

* fix: integration tests

* fix: integration tests

* chore: constants and immutables

* test: additional unit test for max index

* chore: deployed new test contract

* chore: update deployment address

* chore: add single recipient addr

* chore: upgrade payment impl

* chore: upgrade payment impl

* feat: ipfs hashes in distributionRoot

* fix: use CID instead of hash

* chore: remove ipfs

* docs: missing natspec param

* feat: update script to deploy/upgrade

* chore: make calc interval secs to immutable

* fix: add required interfaces

* docs: paymentCoordinator docs (#527)

* docs: paymentCoord docs

* docs: clean up payment docs

* docs: tree structure png
* fix comment

* docs: update single recipient addr

* docs: tweak payment docs for clarity and brevity

---------

Co-authored-by: wadealexc <[email protected]>

* refactor: small refactor for readability to surface token transfer and isolate input validation (#530)

* fix payment deploy

* fix: allow verifyInclusion for 0 len proof

also make cumulativeEarnings check strictly gt

* fix: preprod deploy

* fix: merkle diagram and docs

* feat: add payments off-chain assumptions (#533)

* feat: add offchain assumptions to docs; Add offchain variables & token requirement

* docs: simplify off-chain calculcation description

* fix: doc ref

* fix: heading typo

* refactor: make offchain constants internal

* docs: fix typos

* test: single token/earner leaves (#537)

---------

Co-authored-by: wadealexc <[email protected]>
Co-authored-by: Alex <[email protected]>
Co-authored-by: gpsanant <[email protected]>
Co-authored-by: Yash Patil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
payments-v1 related to upcoming MVP payments release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants