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(protocol): move prover assignment verification to hook #15208

Merged
merged 351 commits into from
Nov 18, 2023

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Nov 14, 2023

Brecht, David, Dani, I'm trying to prototype this hook idea so more logics can be extracted away from the protocol. Take a look at this, so later we can brainstorm a bit. No rush though.

  • Daniel

Copy link
Contributor

@Brechtpd Brechtpd left a comment

Choose a reason for hiding this comment

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

Looks good, just some small comments.

// Run all hooks.
// Note that address(this).balance has been updated with msg.value,
// prior to any code in this function has been executed.
uint256 ethBalance = address(this).balance - msg.value;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think no ETH is stored in this contract, so this could simply be address(this).balance? Same thing below I think where instead of having to keep track of msgValue, it could always just be address(this).balance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. I added some comments and removed ethBalance

uint256 ethBalance = address(this).balance - msg.value;

// Run hooks
for (uint256 i; i < params.hookCalls.length; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary/useful to support multiple hooks? Seems like only a single hook will probably be used, and even then this single hook itself can call into multiple other smart contracts if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think one hook is good enough for default scenario, but I want to support multiple hooks so proposers, with their imagination, can do extra things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants