-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse logged types #582
Parse logged types #582
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
Co-authored-by: Halil Beglerović <hal3e.git@gmail.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Co-authored-by: Halil Beglerović <hal3e.git@gmail.com>
Co-authored-by: Halil Beglerović <hal3e.git@gmail.com>
Co-authored-by: Halil Beglerović <hal3e.git@gmail.com>
Co-authored-by: Halil Beglerović <hal3e.git@gmail.com>
Co-authored-by: Halil Beglerović <hal3e.git@gmail.com>
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks amazing. I have one issue with the semantics, though. Whenever I call something with print
in it, I expect it to automatically print something to stdout/stderr.
print_logs()
doesn't print anything; it returns a Vec<String>
. The name/behavior is misleading.
I propose we rename print_logs()
to fetch_logs()
/get_logs()
/resolve_logs()
and keep the same behavior (return a Vec<String>
and let the user decide what to do with it.)
|
||
Ok(()) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good
Closes #562
This PR adds
_logs_with_type::<T>()
to the existing contract instance methods. It requires receipts and returns aVec<T>
containing all the logged values of typeT
.It also adds
_print_logs()
for outputting all the logged values to stdout.The feature flag
--generate-logged-types
is added to the build test script so that we can test, but needs to be removed as soon as forc starts generating logged types without it.As mentioned in the issue, ABI support for logging generic types is limited. However, it is likely that once added, it will work on the SDK side with little to no changes.
Another future upgrade we can expect is to further filter the logs based on the name of the logged variables once they are included in the ABI.
I will add the follow-up issues once we agree on the changes.