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

add getter, add comment and add field in event #13376

Merged
merged 4 commits into from
Jun 11, 2024
Merged

add getter, add comment and add field in event #13376

merged 4 commits into from
Jun 11, 2024

Conversation

shileiwill
Copy link
Contributor

As title, minor improvements on both registry and registrar

Copy link
Contributor

@RyanRHall RyanRHall left a comment

Choose a reason for hiding this comment

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

One small suggestion

Comment on lines +134 to +135
uint96 amount,
IERC20 billingToken
Copy link
Contributor

Choose a reason for hiding this comment

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

since we have to change this event anyway.. I think we could better "future proof" it by changing it to just include the whole RegistrationParams struct. wdyt?

event RegistrationRequested(
    bytes32 indexed hash,
    RegistrationParams registrationParams
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using registrationParams is far neater, I like it! Pasting it here for reference:

  struct RegistrationParams {
    address upkeepContract;
    uint96 amount;
    // 1 word full
    address adminAddress;
    uint32 gasLimit;
    uint8 triggerType;
    // 7 bytes left in 2nd word
    IERC20 billingToken;
    // 12 bytes left in 3rd word
    string name;
    bytes encryptedEmail;
    bytes checkData;
    bytes triggerConfig;
    bytes offchainConfig;
  }

I confirmed registrationParams contains exactly the same the params needed, except hash, which we will add.

For an Event (RegistrationRequested) which has a Struct (RegistrationParams), the hash will be just listing all the fields in the struct, so keccak(bytes32,address upkeepContract,uint96 amount,address....)?

I believe that is how it works, but double confirm @RyanRHall ?
We will need to function signature in atlas, hence confirming, but I dont think using the RegistrationParams will require any other changes except the hash. cc @cmalec

Copy link
Contributor

Choose a reason for hiding this comment

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

ya for new versions of the event we will just need to decode RegistrationParams but should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to myself, the event signature is now:

  • RegistrationRequested(bytes32,address,uint96,address,uint32,uint8,address,string,bytes,bytes,bytes,bytes)
  • 0x72319f308e224802c7dc5f4bad21a9b46070f765d25eedf39a25f04bf39eb632

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 realized that we introduced some side effects bc of this change. Given that we dont change the params in the event often, I reverted this change. More details in the other comment.

@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

RyanRHall
RyanRHall previously approved these changes Jun 4, 2024
Copy link
Contributor

@RyanRHall RyanRHall left a comment

Choose a reason for hiding this comment

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

LGTM 👍

bytes32 indexed hash,
string name,
bytes encryptedEmail,
address indexed upkeepContract,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @RyanRHall / @FelixFan1992 : this refactoring results in a feature change. This upkeepContract is indexed and address is recommended to be indexed, but when we wrap the params with the RegistrationParams struct, we lose this indexed address.

Not a strong opinion but I would recommend keeping the original structure to have the contract indexed and this old structure can also make the atlas changes easier/cleaner (have to replicate the struct in test).

@shileiwill shileiwill enabled auto-merge June 10, 2024 22:23
@shileiwill shileiwill added this pull request to the merge queue Jun 11, 2024
Merged via the queue into develop with commit bb40d51 Jun 11, 2024
110 checks passed
@shileiwill shileiwill deleted the events branch June 11, 2024 00:51
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.

4 participants