-
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
fix: logging with multiple(external) logs #751
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.
Can you confirm whether I understood this correctly:
If we had a script calling a contract which was logging some variables our decode would fail. This was because we could not find the logId in our LogDecoder.
Is this the case where we load a (foreign-non-SDK-generated) script binary and execute it but it turns out the script bytecode had called a contract that logged something but we can't decode it since we don't have the contract's abi-json?
If so, do we have a test covering this scenario?
Yes that was the case. We would have a That said, it would be cool if we could use your shared types PR, where we can simultaneously load several contracts and scripts, to combine all |
Tnx for the clarification. We filter out/ignore log receipts for which we do not know the type. And the only way that could happen is by running foreign contract calling scripts.
I'm not sure what you wanted to say. We must filter out precisely because we don't have the mapping for those
It has naught to do with clarity. We have behavior where we're willing to ignore invalid/stray log receipts but we're (possibly) not testing it. So this fix will not have any protection against regression. |
Makes sense. I will add a unit test for this. |
At the end I decided to add a e2e test as we do not have any test where a script is calling a contract. |
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.
Very nice!
Fixes two bugs we had with decoding logs from
RevertTransactionError
:Take the last log instead of the first log.
If we had several log statements before the require we would take the first one and that would be wrong. The last log should be the log from the
require
statement.If we had a script calling a contract which was logging some variables our decode would fail. This was because we could not find the
logId
in ourLogDecoder
. Now we just do afilter_map
and take only the logs we have in ourLogDecoder
.Added test:
logs
beforerequire