8000 Require rewards - partial: Updates to contracts and clients by voltrevo · Pull Request #137 · getwax/bls-wallet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Require rewards - partial: Updates to contracts and clients #137

Merged
merged 6 commits into from
Feb 22, 2022

Conversation

voltrevo
Copy link
Collaborator
@voltrevo voltrevo commented Feb 11, 2022

What is this PR doing?

This PR contributes to the larger work to require rewards in the aggregator.

That work is built on top of these changes to contracts, and clients - most importantly the new Utilities contract and its bindings.

That's not everything though, so here's a list:

  • Add Utilities contract with two methods
    • performSequence which takes a sequence of functions to call and returns all their results. This will allow the aggregator to test a sequence of bundles and figure out the rewards for each bundle resulting from executing in that sequence.
    • ethBalanceOf returns the eth balance of a contract to allow this to be represented as a function call so you can use it with performSequence. (For tokens, you can use the function call already, but there isn't one for eth).
  • Export ERC20 typechain definitions
    • Also use this to replace the abi copies in aggregator project and manual MockErc20 wrapper
  • Implement callStaticSequence and callStaticSequenceWithMeasure in EthereumService which provides an additional layer around performSequence allowing decoded types to be extracted (rather than the byte arrays that are actually returned by performSequence
  • Fix handling of empty bundles when aggregating and verifying (hubbleBls rejects zero signatures, but they ought to be valid and are useful when building up bundles in the aggregator (similar to the way the number zero is a useful thing))
  • Improve detail when wrapping errors in the aggregator Fixture

How can these changes be manually tested?

Does this PR resolve or contribute to any issues?

Contributes to #133.

Checklist

  • I have manually tested these changes
  • Post a link to the PR in the group chat

Guidelines

  • If your PR is not ready, mark it as a draft
  • The resolve conversation button is for reviewers, not authors
    • (But add a 'done' comment or similar)

@github-actions github-actions bot added aggregator Aggregator backend related clients contracts Smart contract related labels Feb 11, 2022
@voltrevo voltrevo marked this pull request as ready for review February 11, 2022 03:11
Copy link
Collaborator
@jacque006 jacque006 left a comment

Choose a reason for hiding this comment

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

Nice start!

pragma solidity >=0.8.0 <0.9.0;
pragma abicoder v2;

contract Utilities {
Copy link
Collaborator

Choose a reason for hiding this comment

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

No a huge fan of this name, very generic. Maybe Functions, FunctionsUtilities instead?

We could also add this to an existing contract such as VerificationGateway or BLSExpander so we can avoid another contract deploy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm. They're very generic utilities though. In fact I'm kinda hoping this already exists in some form and we can use that instead of this.

Anyway, I renamed it to AggregatorUtilities. Wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could also add this to an existing contract such as VerificationGateway or BLSExpander so we can avoid another contract deploy.

Adding to VerificationGateway would increase the audit burden (and complexity that may be considered by users) though.

For BLSExpander, it really doesn't fit. That contract is about compressing calldata for processBundle.

Also, this may be out of date, but I believe there was some concern about the maximum allowed size of a contract and pushing up against that limit.

Is there much benefit in avoiding a contract deploy? Is it more efficient to deploy A+B functions into one contract than A functions into contract A and B functions into contract B?

bytes returnValue;
}

function performSequence(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be good to have NatSpec comments/docs for this function and contract. Can do this as follow up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@jacque006 jacque006 merged commit b2a7ffc into main Feb 22, 2022
@jacque006 jacque006 deleted the bw-133-require-rewards--partial-contracts-clients branch February 22, 2022 22:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
aggregator Aggregator backend related clients contracts Smart contract related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0