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

[ETHEREUM-CONTRACTS] proposed changes for the macro forwarder #1828

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

d10r
Copy link
Collaborator

@d10r d10r commented Feb 13, 2024

Proposed changes:

  • rename TrustedMacrosVanilla to MacroForwarder. Reasoning: trusted is a property not inherent to the contract, but coming into effect by registering it as trusted by gov. Vanilla isn't self-explanatory, I find it unnecessary. If we add a 712 variant, we can simply add 712 to the name. Plural -> singular because the use of a variable trustedMacros for an instance in the test seemed odd.
  • Removal of simulateMacro: Initially I tried to find a better name (_simulate_ to me suggests that it would simulate the actual execution, not just retrieve the operations), but I came to the conclusion that it's more confusing than helpful and should instead be removed. It doesn't really add anything, because it just delegates to macro.buildBatchOperations()`
  • Added test case using StatefulMacro: [ETHEREUM-CONTRACTS] TrustedMacros: A TrustedForwarder that rules them all #1782 states: A user-defined macro is stateless ... - I think that's a mistake. The macro may very well have state if that helps to reduce the calldata size of the macro call. It just can't modify state in buildBatchOperations(). This test case exemplifies that, reducing the calldata to the minimum, which currently is the macro address.

Copy link

Changelog Reminder

Reminder to update the CHANGELOG.md for any of the modified packages in this PR.

  • CHANGELOG.md modified
  • Double check before merge

@hellwolf
Copy link
Contributor

hellwolf commented Feb 13, 2024

rename TrustedMacrosVanilla to MacroForwarder. Reasoning: trusted is a property not inherent to the contract, but coming into effect by registering it as trusted by gov. Vanilla isn't self-explanatory, I find it unnecessary. If we add a 712 variant, we can simply add 712 to the name. Plural -> singular because the use of a variable trustedMacros for an instance in the test seemed odd.

okay.

Removal of simulateMacro: Initially, I tried to find a better name (simulate to me suggests that it would simulate the actual execution, not just retrieve the operations), but I came to the conclusion that it's more confusing than helpful and should instead be removed. It doesn't really add anything, because it just delegates to macro.buildBatchOperations()`

I should probably still expose it, just for the merit of being able to get those batch operations call data. But it wouldn't work if it became stateful.

Added test case using StatefulMacro: #1782 states: A user-defined macro is stateless ... - I think that's a mistake. The macro may very well have state if that helps to reduce the calldata size of the macro call. It just can't modify state in buildBatchOperations(). This test case exemplifies that, reducing the calldata to the minimum, which currently is the macro address.

Not necessarily a mistake, but it was a conscious and defensive choice.

However, we can rethink here: was the defensiveness justified?

Let me think a bit.

@hellwolf hellwolf merged commit 072c4fb into feature-trusted-macros Feb 13, 2024
18 checks passed
@hellwolf hellwolf deleted the feature-trusted-macros-pp branch February 13, 2024 10:56
Copy link

XKCD Comic Relif

Link: https://xkcd.com/1828
https://xkcd.com/1828

github-merge-queue bot pushed a commit that referenced this pull request Feb 16, 2024
* wip prototype

* Split EIP-712 support from TrustedMacrosVanilla & added a test case

* update ethereum-contracts changelog

* TrustedMacros: added more comments

* trusted macro to use solc 0.8.23

* [ETHEREUM-CONTRACTS] proposed changes for the macro forwarder (#1828)

* proposed changes for the macro forwarder

* added deploy script for MacroForwarder

* bring back the buildBatchOperations wrapper

* add msgSender to buildBatchOperations() and a test case using it

* add IUserDefinedMacro to bundled abis

* added some diagrams

* update to CODEOWNERS

---------

Co-authored-by: Didi <[email protected]>
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.

2 participants