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 EIP: Token Mapping Slot Retrieval Extension #6830

Merged
merged 3 commits into from May 30, 2023
Merged

Conversation

qd-qd
Copy link
Contributor

@qd-qd qd-qd commented Apr 4, 2023

This proposal suggests an approach to improving the accuracy of off-chain transaction simulations that involve contracts that comply with the ERC-20/ERC-721/ERC-1155 standards. The proposal provides a standardized entry point to obtain the reserved storage slot of a mapping responsible for tracking ownership of tokens in a contract. This approach not only helps capture state changes more precisely but also enables external tools and services to do so without requiring expertise in specific implementation details.

Due to the unique storage layout for different contracts, it is challenging to simulate transactions that involve smart contracts, specifically due to the use of mappings. The storage location of a value in a mapping depends on a specific storage slot, which can only be determined through knowledge of the contract’s implementation. This prevents external platforms and tools from capturing/validating changes made to a contract’s state with certainty.

This proposal introduces a function named getTokenLocationRoot as an extension to ERC-20/ERC-721/ERC-1155 contracts, allowing off-chain callers to retrieve the reserved storage slot for the mapping type. This approach eliminates the reliance on events, enhances the precision of data access from storage, and improves the accuracy of off-chain simulations.


Reopen as suggested here due to a problem with the bot.

@qd-qd qd-qd requested a review from eth-bot as a code owner April 4, 2023 09:19
@github-actions github-actions bot added c-new Creates a brand new proposal s-draft This EIP is a Draft t-erc labels Apr 4, 2023
@eth-bot
Copy link
Collaborator

eth-bot commented Apr 4, 2023

✅ All reviewers have approved.

@eth-bot eth-bot added e-consensus Waiting on editor consensus e-review Waiting on editor to review labels Apr 4, 2023
@qd-qd
Copy link
Contributor Author

qd-qd commented Apr 4, 2023

Not sure I understand why @eth-bot failed, do you have any clues?

cynic-1
cynic-1 previously approved these changes Apr 9, 2023
Copy link

@cynic-1 cynic-1 left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added s-review This EIP is in Review and removed s-draft This EIP is a Draft labels May 4, 2023
@qd-qd
Copy link
Contributor Author

qd-qd commented May 4, 2023

Moved the EIP from the draft status to review. As I understand it, it was my responsibility to make this change.

qd-qd added 2 commits May 5, 2023 17:13
This proposal suggests an extension to the ERC-20/ERC-721/ERC-1155 standards
that allows retrieving the reserved storage slot of the mapping responsible
for tracking ownership of compliant tokens. The proposed extension enables
accurate off-chain simulations, eliminates the reliance on events, and
enhances the precision of data access from storage. The proposed extension
is a single function named getTokenLocationRoot() that returns the reserved
storage slot for the mapping type in any ERC-20/ERC-721/ERC-1155 compliant
smart-contract implementation. The proposed extension does not have any additional
cost for the caller, and there is a negligible increase in the deployment cost
of the contract.
EIPS/eip-6823.md Outdated Show resolved Hide resolved
@github-actions github-actions bot added s-draft This EIP is a Draft and removed s-review This EIP is in Review labels May 30, 2023
@eth-bot eth-bot enabled auto-merge (squash) May 30, 2023 15:28
Copy link
Collaborator

@eth-bot eth-bot left a comment

Choose a reason for hiding this comment

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

All Reviewers Have Approved; Performing Automatic Merge...

@eth-bot eth-bot merged commit b2353a8 into ethereum:master May 30, 2023
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-new Creates a brand new proposal e-consensus Waiting on editor consensus e-review Waiting on editor to review s-draft This EIP is a Draft t-erc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants