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 #6823

Merged

Conversation

qd-qd
Copy link
Contributor

@qd-qd qd-qd commented Apr 3, 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.

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

eth-bot commented Apr 3, 2023

🛑 eip-review-bot failed for an unknown reason. Please see logs for more details, and report this issue at the eip-review-bot repository.

@eth-bot eth-bot added e-consensus Waiting on editor consensus e-review Waiting on editor to review labels Apr 3, 2023
@qd-qd qd-qd force-pushed the eip6823-token-mapping-slot-retrieval branch from d907714 to 6d93f84 Compare April 3, 2023 16:33
@eth-bot eth-bot changed the base branch from master to eipbot/6823 April 3, 2023 16:33
@github-actions github-actions bot added the w-ci Waiting on CI to pass label Apr 3, 2023
@qd-qd qd-qd force-pushed the eip6823-token-mapping-slot-retrieval branch from 6d93f84 to e08e079 Compare April 3, 2023 16:37
@eth-bot eth-bot changed the title Add EIP: Token Mapping Slot Retrieval Extension Token Mapping Slot Retrieval Extension Apr 3, 2023
@github-actions github-actions bot added w-ci Waiting on CI to pass and removed w-ci Waiting on CI to pass labels Apr 3, 2023
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.
@qd-qd qd-qd force-pushed the eip6823-token-mapping-slot-retrieval branch from e08e079 to bcfce53 Compare April 3, 2023 16:39
@eth-bot eth-bot changed the title Token Mapping Slot Retrieval Extension Add EIP: Token Mapping Slot Retrieval Extension Apr 3, 2023
@github-actions github-actions bot added w-ci Waiting on CI to pass and removed w-ci Waiting on CI to pass labels Apr 3, 2023
@qd-qd qd-qd changed the base branch from eipbot/6823 to master April 3, 2023 19:10
@github-actions github-actions bot removed the w-ci Waiting on CI to pass label Apr 3, 2023
@Pandapip1
Copy link
Member

@eth-bot rerun

@eth-bot eth-bot changed the base branch from master to eipbot/6823 April 4, 2023 01:36
@eth-bot eth-bot merged commit 9125bb3 into ethereum:eipbot/6823 Apr 4, 2023
17 of 20 checks passed
Pandapip1 added a commit that referenced this pull request Apr 4, 2023
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

The commit bcfce53 (as a parent of 9125bb3) contains errors.
Please inspect the Run Summary for details.

@github-actions github-actions bot added the w-ci Waiting on CI to pass label Apr 4, 2023
Pandapip1 added a commit that referenced this pull request Apr 4, 2023
@Pandapip1
Copy link
Member

@qd-qd sorry for the issues with the bot. Feel free to create a new PR.

@qd-qd qd-qd deleted the eip6823-token-mapping-slot-retrieval branch April 4, 2023 09:18
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 w-ci Waiting on CI to pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants