2

I am using the library forge-std/console.sol in a contract for debugging purposes and execute the corresponding functions on a local Anvil network. I use Cast to send the transaction to the network. When I check the log of the Anvil network after the execution of a function that uses console.log, I see several outputs after the RPC method eth_estimateGas. Why is it printed that many times? My expectation was that each log is only printed once after RPC method eth_sendRawTransaction, which it actually does. Can someone explain these multiple logs?

Here is an example of the Anvil logs. In the corresponding function, I invoke console.log as follows: console.log("test").

eth_chainId
eth_getTransactionCount
eth_getBlockByNumber
eth_feeHistory
eth_estimateGas
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
eth_sendRawTransaction
test

    Transaction: 0x2b34a07537cab325612afa9d7f2b5b02c5ff3c39e7a79cc8a0d44bb3619f59dd
    Gas used: 29468

    Block Number: 6
    Block Hash: 0x2c5c2fe53bb48aa2eae42100ac05462b503f9d54e68ef9f021aabd24e50d43a6
    Block Time: "Thu, 31 Aug 2023 08:17:00 +0000"

eth_getTransactionReceipt

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.