Skip to content

Integration with Solday's ERC6551 Implementation#133

Merged
LeoHChen merged 5 commits intostoryprotocol:mainfrom
kingster-will:v11/solady6551
Apr 25, 2024
Merged

Integration with Solday's ERC6551 Implementation#133
LeoHChen merged 5 commits intostoryprotocol:mainfrom
kingster-will:v11/solady6551

Conversation

@kingster-will
Copy link
Copy Markdown
Collaborator

@kingster-will kingster-will commented Apr 25, 2024

Description

Overview

This PR introduces integration with Solday's ERC6551 smart contract. Key modifications include the update of the state variable, renaming it from nonce and changing its type from uint256 to hash (bytes32). This adjustment ensures that state is now deterministic, computed from the input parameters of the execute() function.

Modifications

  • Inheritance: IPAccount now extends Solday's ERC6551 contract to utilize its implementation of ERC6551 interfaces including token(), owner(), receiver functions and 1271 signature validation.
  • State/nonce Update: Changed the type of state from uint256 to bytes32 according to Solady 6551, which is hash computed based on execute() inputs. All execute functions execute()', executeBatch()andexecuteWithSig()share the function to update 'state' which calculate hash based on common inputs of execute functions:to, valueanddata`.
  • Method Overrides: Overrode execute() and executeBatch() methods from Solady ERC6551 to include check permissions via AccessController. This ensures that every execution undergoes a permission verification process.

Test Plan

All new added code covered by automation tests.

Related Issue

Closes #83

Comment thread contracts/IPAccountImpl.sol
Copy link
Copy Markdown

@LeoHChen LeoHChen left a comment

Choose a reason for hiding this comment

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

LGTM, needs @Vectorized's review

Comment thread contracts/IPAccountImpl.sol
Comment thread test/foundry/access/AccessController.t.sol
Comment thread test/foundry/access/AccessController.t.sol
@jdubpark
Copy link
Copy Markdown

For tests, it'd be better to use parameterized internal functions for repetitive code, e.g. newState and signatures, to improve readability. Pretty hard to scroll through the test cases without getting confused.

Copy link
Copy Markdown

@Vectorized Vectorized left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown

@Ramarti Ramarti 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

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.

Use Solady's ERC6551 implementation

5 participants