hashgraph / hashgraph/hedera-forking

[Tech Debt] Align HTS getTokenInfo account address handling between forking and direct Solo paths

Open
#305 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Solidity
Stars
3
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### Description

⚠️
this will be relevant after #303 is done
⚠️

The HTS e2e suite currently compares getTokenInfo(tokenAddress) results between two execution paths:

- anvil/solo, where HTS state is reconstructed from mirror node data by the forking layer
- direct solo, where the call is executed by the consensus node HTS system contract

These paths can now return different account address representations for fields such as `token.treasury`.

The forking path reads `treasury_account_id` from mirror node token data, then resolves the account through mirror node and uses `account.evm_address`. For ECDSA accounts, mirror node may return the EVM alias derived from the ECDSA public key.

The direct Solo path returns the Hedera account id encoded as a long-zero EVM address, for example `0.0.1002 -> 0x000...03ea`, instead of resolving it to the ECDSA alias address.

This mismatch causes equivalence tests around getTokenInfo to fail after upgrading consensus/mirror behavior.

Expected outcome:

1. Decide which representation the forking layer should emulate for HTS getTokenInfo account fields.
2. Either preserve direct consensus behavior by returning long-zero addresses for account-id fields, or update/track consensus behavior if ECDSA alias resolution is expected.
3. Add focused regression coverage for getTokenInfo with ECDSA treasury accounts, covering both long-zero and alias cases if both are valid in different contexts.

Relevant area:
- test/hts.e2e.js
- src/slotmap.js
- contracts/MirrorNode.sol
- contracts/HtsSystemContractJson.sol

### Steps to reproduce

This was a test that showcased the difference between direct solo and forking:

`test/hts.e2e.js`
```
it("should retrieve token's metadata through `getTokenInfo`", async function () {
const tokenInfo = await HTS['getTokenInfo'](tokenAddress);
if (self.tokenInfo === undefined) {
self.tokenInfo = tokenInfo;
} else {
expect(tokenInfo).to.be.deep.equal(self.tokenInfo);
}
});
```

### Additional context

_No response_

### Hedera network

_No response_

### Version

after solo migration

### Operating system

None

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.