[Hardhat] Avoid fetching code for the `console.log` address
acuarica opened this issue · comments
When a contract uses Hardhat's console.log
, the following "error" message appears in the standard output
Error fetching data from tokens/0.0.1.2020987628128114e+26?timestamp=1729289813.891806000
Error: Request failed with status 400: Bad Request
This is not strictly an error, it's more of a no-op. Nevertheless, the output suggests than something went wrong, when in reality that is not the case. We should remove this message to avoid confusion.
The token id in question comes from the address 0x000000000000000000636f6e736f6c652e6c6f67
, which is the address of Hardhat's console.log
. Given this address has a long zero prefix, the JSON-RPC Forwarder assumes it corresponds to a token address. It converts it to account id 0.0.x
format, leading to 0.0.1.2020987628128114e+26
, and tries to fetch the token from the Mirror Node to determine whether the code is the proxy bytecode contract. This in turn leads to the aforementioned error message.
To remove this message from displaying, the JSON-RPC Forwarder should skip fetching code when the address is the console.log
address.
Note
The address 0x000000000000000000636f6e736f6c652e6c6f67
is the hex representation of console.log
.
$ cast to-utf8 0x000000000000000000636f6e736f6c652e6c6f67
console.log