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

Fix console.log when presenting BigInts #5933

Merged
merged 1 commit into from
Feb 24, 2023
Merged

Fix console.log when presenting BigInts #5933

merged 1 commit into from
Feb 24, 2023

Conversation

cds-amal
Copy link
Member

@cds-amal cds-amal commented Feb 24, 2023

This is necessary because JSON.stringify cannot serialize BigInt, which is a possible type from ganache and solidity logs. Special thanks to @MicaiahReid for the Rubber duck support! 🙇

PR description

This PR fixes an error @emilyJLin95 discovered. If you have a contract that logs a UINT* as the only argument (console.log(100)), then truffle develop would crash when the log is presented.

Testing instructions

Write a contract that with console.log(some-int) and invoke the method to present the log. Truffle develop should not crash, and present the log. One way to do this is to introduce a console.log in MetaCoin's constructor and run truffle test from the console.

Documentation

  • No docs required

Breaking changes and new features

  • No breaking changes

This is necessary because JSON.stringify cannot serialize BigInt, which
is a possible type from ganache and solidity logs.

Co-authored-by: MicaiahReid <[email protected]>
Copy link
Member

@davidmurdoch davidmurdoch left a comment

Choose a reason for hiding this comment

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

It'd be nice to have tests :-)

@cds-amal cds-amal merged commit 1addc15 into develop Feb 24, 2023
@cds-amal cds-amal deleted the log-boom branch February 24, 2023 17:05
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.

2 participants