Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add GM for base asset ID #700
Add GM for base asset ID #700
Changes from all commits
4eac596
9acd5e2
758e812
013ba34
b78c16c
3fe06ca
778d34f
896fdae
6bf7acc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Before we were returning an
ExpectedInternalContext
error in the case of the internal context. Do we need to do the same?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 catch. The new behavior is what the specs say. I see no reason to disallow internal contexts here.
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.
The specification says that it is allowed only in the context of the predicate:
And in our codebase predicate context is external context:
So it looks like we need ti check that it is external context=)
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.
But the code already performs the check: The
context.predicate()
returnsNone
outside predicate contexts, leading toTransactionValidity
panic. Previously callinggm/GetVerifyingPredicate
panicked withExpectedInternalContext
which was definitely incorrect. Now if we check with something likethen the only additional check we're actually performing is that
Call
contexts returnExpectedExternalContext
instead ofTransactionValidity
. Is the issue just returning a wrong panic reason? Am I missing something here?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.
Ohh, I missed the moment that
predicate
already is doing this check inside=D Hmm, maybe using of another error will make more sense, becauseTransactionValidity
is a strange choiceThere 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.
I'm going to merge this as-is, since
TransactionValidity
is (only) used for this kind of things currently. We can do a rename in a separate PR if needed.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.
So, I'd say that the SUT of this test is
op::gm_args
and the condition isGMArgs::BaseAssetId
. It's confusing since we can't callgm_args
natively and instead we calltransact
, so you could also say thattransact
is the SUT in that sense.Either way, I think the structure of the test should reflect what the SUT is. In this case I include it in a
gm_args_script
method, so it's a little indirect but cleans up the test in a good way IMO:So the name of the test could be something like
gm_args__base_asset_id_retrieves_value_in_params
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.
I think doing that would make the test case less readable. Note how this is already an integration test, not a unit test, and it still has minimal indirection which is quite nice. I experimented a bit with something like
run_script_and_get_logged_data
and going that way seems to lead essentially duplicatingTransactionBuilder
if we want to make it reusable.