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

Calls to HTS contracts are not properly propagated in reusable services #9862

Open
kselveliev opened this issue Dec 3, 2024 · 0 comments · May be fixed by #9863
Open

Calls to HTS contracts are not properly propagated in reusable services #9862

kselveliev opened this issue Dec 3, 2024 · 0 comments · May be fixed by #9863
Assignees
Labels
bug Type: Something isn't working web3 Area: Web3 API
Milestone

Comments

@kselveliev
Copy link
Contributor

Description

Specifically, contract calls that interact with HTS ERC functions like name, decimals, or totalSupply (which take a token address as a parameter) fail with CONTRACT_REVERT_EXECUTED.

For example, in the following method:

function name(address token) public view returns (string memory) {
    return IERC20Metadata(token).name();
}

When executing such calls, services tries to find the token in the method ->
DispatchingEvmFrameState.getMutableAccount(Address address).
This method searches for the token address in two stages:

Account Lookup:
Calls nativeOperations.getAccount(accountID) which checks AccountReadableKVState.
If the account is found, it is returned.

Token Lookup (if the account isn’t found):
Calls nativeOperations.getToken(number) which checks TokenReadableKVState.
If the token is found, it is returned.

The issue arises because AccountReadableKVState does not filter by entity type. If the token address is mistakenly treated as an account and returned from the account state, execution fails.

Steps to reproduce

Explained in the description of the issue

Additional context

No response

Hedera network

other

Version

v0.118.0

Operating system

macOS

@kselveliev kselveliev added bug Type: Something isn't working web3 Area: Web3 API labels Dec 3, 2024
@kselveliev kselveliev self-assigned this Dec 3, 2024
@kselveliev kselveliev linked a pull request Dec 3, 2024 that will close this issue
2 tasks
@steven-sheehy steven-sheehy added this to the 0.120.0 milestone Dec 3, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Mirror Node Dec 3, 2024
@steven-sheehy steven-sheehy moved this from 📋 Backlog to 👷 In progress in Mirror Node Dec 3, 2024
@steven-sheehy steven-sheehy moved this from 👷 In progress to 👀 In review in Mirror Node Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Something isn't working web3 Area: Web3 API
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

2 participants