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

Update ERC-7201: Fix solidity formula #201

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

RenanSouza2
Copy link
Contributor

This PR fixes one formula in the ERC7201, I am not one of the authors

@eip-review-bot
Copy link
Collaborator

eip-review-bot commented Jan 12, 2024

File ERCS/erc-7201.md

Requires 2 more reviewers from @axic, @gcolvin, @lightclient, @SamWilsn

@eip-review-bot eip-review-bot changed the title FIx solidity formula Update ERC-7201: FIx solidity formula Jan 12, 2024
@Amxx
Copy link
Contributor

Amxx commented Jan 15, 2024

I don't think this change is needed. If id is a string, you can call keccak256(id) directly.

I was able to confirm (in remix) that

bytes32 public constant MAIN_STORAGE_LOCATION =
    keccak256(abi.encode(uint256(keccak256("example.main")) - 1)) & ~bytes32(uint256(0xff));

does compile (tested with 0.8.7)

@RenanSouza2 RenanSouza2 changed the title Update ERC-7201: FIx solidity formula Update ERC-7201: Fix solidity formula Jan 15, 2024
@RenanSouza2
Copy link
Contributor Author

I don't think this change is needed. If id is a string, you can call keccak256(id) directly.

I was able to confirm (in remix) that

bytes32 public constant MAIN_STORAGE_LOCATION =
    keccak256(abi.encode(uint256(keccak256("example.main")) - 1)) & ~bytes32(uint256(0xff));

does compile (tested with 0.8.7)

it works with hardcoded string like "example.main" but not with a variable type string memory

Copy link
Contributor

@ernestognw ernestognw left a comment

Choose a reason for hiding this comment

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

it works with hardcoded string like "example.main" but not with a variable type string memory

Yea I can confirm.

Copy link
Collaborator

@SamWilsn SamWilsn left a comment

Choose a reason for hiding this comment

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

Copy link

github-actions bot commented Apr 3, 2024

There has been no activity on this pull request for 2 weeks. It will be closed after 3 months of inactivity. If you would like to move this PR forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

@github-actions github-actions bot removed the w-stale label Apr 4, 2024
Copy link

There has been no activity on this pull request for 2 weeks. It will be closed after 3 months of inactivity. If you would like to move this PR forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

@SamWilsn SamWilsn merged commit e88153d into ethereum:master Apr 23, 2024
25 of 26 checks passed
@RenanSouza2 RenanSouza2 deleted the fix-erc7201-formula branch June 14, 2024 18:06
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.

5 participants