Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

feat: add the ability to use console.log from Solidity #3327

Merged
merged 74 commits into from
Jul 11, 2022
Merged

Conversation

davidmurdoch
Copy link
Member

@davidmurdoch davidmurdoch commented Jul 2, 2022

Ganache now supports console.log in Solidity!

More details and how-tos will be written up in Truffle's upcoming console.log release. So stay tuned for that!

@davidmurdoch
Copy link
Member Author

davidmurdoch commented Jul 3, 2022

I still need to figure out if I need to warm the console.sol precompile address (à la https://github.com/ethereumjs/ethereumjs-monorepo/blob/cfd7b7754490b072a035cceaba59c3dfb517effd/packages/vm/src/runTx.ts#L176) for post-berlin blocks and if we really need to add this account to the state tree on start up (this is what is causing the new test case failures, as "activating" it causes the initial state to change) We do not; adding precompile accounts on startup is a gas optimization for the CALL opcode, console.sol uses the STATICCALL opcode so the gas optimization doesn't apply.

@davidmurdoch davidmurdoch changed the title feat: console.log feat: add the ability to use console.log from Solidity Jul 6, 2022
@davidmurdoch davidmurdoch marked this pull request as ready for review July 6, 2022 19:13
@davidmurdoch
Copy link
Member Author

Important note: contracts that use this console.sol implementation won't entirely work in Remix and Hardhat Network until ethereum/remix-project#2589 and NomicFoundation/hardhat#2666 are fixed.

Copy link
Contributor

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review. This is gonna take a while 🙂

src/chains/ethereum/console.log/README.md Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/README.md Show resolved Hide resolved
src/chains/ethereum/console.log/README.md Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/package.json Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/scripts/helpers.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9/25 files viewed

Getting there 😅

Copy link
Contributor

@MicaiahReid MicaiahReid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working through a full review but here's a start.

src/chains/ethereum/console.log/index.ts Show resolved Hide resolved
src/chains/ethereum/console.log/console.sol Show resolved Hide resolved
src/chains/ethereum/console.log/scripts/helpers.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/scripts/helpers.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/scripts/helpers.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/scripts/helpers.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/src/handlers.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/src/handlers.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@MicaiahReid MicaiahReid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not envy whoever has to debug these tests at some point 😅 Suuuuper cool stuff though!

src/chains/ethereum/console.log/src/maybe-get-logs.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/src/maybe-get-logs.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/tests/index.test.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/tests/index.test.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/tests/index.test.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/tests/index.test.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/tests/index.test.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/tests/index.test.ts Outdated Show resolved Hide resolved
src/chains/ethereum/console.log/tests/index.test.ts Outdated Show resolved Hide resolved
davidmurdoch and others added 24 commits July 11, 2022 17:32
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants