Skip to content

Commit

Permalink
feat: avoid fetching code for console.log address (#183)
Browse files Browse the repository at this point in the history
Signed-off-by: Luis Mastrangelo <[email protected]>
  • Loading branch information
acuarica authored Jan 10, 2025
1 parent 65df65a commit fc1dc2c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/forwarder/json-rpc-forwarder.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ const eth = {
debug(c.yellow('loading HTS Code at address %s'), address);
return getHtsCode();
}
// Don't try to fetch token for Hardhat's `console.log`
// https://github.com/NomicFoundation/hardhat/blob/e4e2b86776791840299db76cb13f7cecb6640c06/packages/hardhat-core/console.sol#L6
// See issue https://github.com/hashgraph/hedera-forking/issues/182.
// Given this address is expected to not have any bytecode, it's safe to return `0x`.
if (address.toLowerCase() === '0x000000000000000000636f6e736f6c652e6c6f67') {
return '0x';
}
if (address.startsWith(LONG_ZERO_PREFIX)) {
const tokenId = `0.0.${parseInt(address, 16)}`;
const token = await mirrorNodeClient.getTokenById(tokenId, Number(blockNumber));
Expand Down

0 comments on commit fc1dc2c

Please sign in to comment.