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

Chore: Optimize "contribute_with_vote" CU usage #12

Open
joeymeere opened this issue Mar 12, 2024 · 0 comments
Open

Chore: Optimize "contribute_with_vote" CU usage #12

joeymeere opened this issue Mar 12, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@joeymeere
Copy link
Collaborator

The "contribute_with_vote" instruction is intended to to three things:

  • Validate that the relayer partial signed the transaction, or the caller has a valid Civic Pass
  • Reallocate project shares via the quadratic funding algorithm
  • Conduct the token transfer and corresponding account mutations

As you can probably imagine, this is very compute heavy. With a small sample size of projects and voters, this is not a huge issue. With priority fees prepended to the transaction, it has few problems landing in a block. The problem comes in rounds with larger sample sizes. Since there are more votes to account in the calculation, the compute unit usage will quickly escalate to the 1.4m bound. That being said, there are ways to optimize the instruction and its helpers to alleviate this bottleneck.

Instead of one pool account, this should likely be redesigned to use a network of PDAs, and doing this is on the table if you're looking to attack this issue

@joeymeere joeymeere added enhancement New feature or request help wanted Extra attention is needed labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant