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

OC + AP payments contract #495

Merged
merged 58 commits into from
Jun 1, 2022
Merged

OC + AP payments contract #495

merged 58 commits into from
Jun 1, 2022

Conversation

maurolacy
Copy link
Contributor

@maurolacy maurolacy commented May 12, 2022

Closes #491.

Publishing as Draft for early review.

TODO:

  • Send the rest of the funds to the tg4-engagement contract for distribution. (done)
  • Don't pay if not enough funds for all members (prioritises engagement point holders). (done)
  • Complete missing payments since last payment? (no)
  • Queries.
    • Config. (done)
    • Payments. (done)
  • Unit-tests. (done)
    • Basic init. (done)
    • Happy path. (done)
    • No funds -> nothing happens. (done)
    • Not enough funds -> pay engagement only. (done)
    • Pay twice test -> nothing happens. (done)
    • Try to pay after hours -> nothing happens. (done)
    • Empty OC / AP members. (done)
  • Update Admin / UpdateConfig (through proposal?) ([tgrade-tc-payments] Add UpdateAdmin and UpdateConfig entry points #496).

@maurolacy maurolacy force-pushed the 491-oc-remuneration branch from f8aa217 to ce813ef Compare May 13, 2022 08:52
@maurolacy maurolacy force-pushed the 491-oc-remuneration branch from 659429e to 8c193fd Compare May 17, 2022 15:33
@maurolacy maurolacy force-pushed the 491-oc-remuneration branch from 8c193fd to 0b69d1c Compare May 17, 2022 15:34
@maurolacy maurolacy marked this pull request as ready for review May 18, 2022 07:47
Copy link
Contributor

@hashedone hashedone left a comment

Choose a reason for hiding this comment

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

In general - I don't see any problems with code, but I don't like tests (very literal and difficult to read IMHO), and I am not sure about the batch sending approach. I get that cw2222 does not apply here (but being perfectly honest - it would work without major changes), but it can be simplified and perfectly applicable here. For my approval, I have to wait on someone's opinion at least for this batch looping to be confident.

contracts/tgrade-tc-payments/README.md Show resolved Hide resolved
contracts/tgrade-tc-payments/README.md Show resolved Hide resolved
contracts/tgrade-tc-payments/examples/schema.rs Outdated Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Outdated Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Outdated Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Outdated Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Outdated Show resolved Hide resolved
@maurolacy maurolacy force-pushed the 491-oc-remuneration branch from 13e5f77 to 792d058 Compare May 31, 2022 09:13
Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Interesting use of real dates.

I am also a little hesitant of these batch queries and pushing out potentially 100s of messages. At some point, the message JSON will be more than 256kB and the VM will reject it (consider it an attack vector).

But... this should work fine up to 100 or 200 members in OC and AP combined. It may end up as 1s or so then, maybe 2s. But it is amortised over a whole day/month.

Also, there is no real attack vector to add infinite number of these accounts to slow the chain. If you can control the majority of the OC, you can do much worse things already. Maybe you gain the majority of the AP and then add 10.000 new members to clog up the blockchain??? Very unlikely and since this is not some permissionless entry point, I find it safe enough.

That said, I do see room for improvement/optimization, which should be tracked in an issue, but this is good enough as is for mainnet launch.

contracts/tgrade-tc-payments/README.md Show resolved Hide resolved
contracts/tgrade-tc-payments/src/payment.rs Show resolved Hide resolved
contracts/tgrade-tc-payments/src/state.rs Show resolved Hide resolved
contracts/tgrade-tc-payments/src/state.rs Outdated Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Outdated Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Show resolved Hide resolved
contracts/tgrade-tc-payments/src/contract.rs Outdated Show resolved Hide resolved
@maurolacy maurolacy merged commit 54fee51 into main Jun 1, 2022
@maurolacy maurolacy deleted the 491-oc-remuneration branch June 1, 2022 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Oversight Community & Arbiter Pool member Renumeration
3 participants