Allow complex contract signature schemes in wallet.Account
#3256
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.
Close #3015
Implement second option from #3015 (comment)
In the first one (interface instead of
wallet.Account
) we still have a problem with network fee calculation: actor modifiers are executed after network fee is calculated and there are no hooks to change invocation script.This implementation disallows providing signature as an argument (though in a backward compatible way).
It is a restriction, but not a sad one: if we have a private key, we can always add a simple signer and provide its address to
verify()
, which can useruntime.CheckWitness
to effectively perform the same check (with proper scopes it could be exactly the same).Also, not sure about the meaning of
CanSign
, so didn't touch it here.TBH I would remove
func
argument in theNewContractSigner
in neotest, it introduces a subtle dependency on the condition order inSignTx
. Other option is to provide an integer but it is also a bit annoying. As an example, there iswallet.NewContractAccount
which can be used instead ofnotary.FakeContractAccount
in complex cases and which could be reused in tests.We have 2 similar usecases for complex
Verify
scenarios, and in every in test we use constant arguments, could be more concise:Initially I wanted to add type-safe
VerifyAccount
constructors to rpcbinding but is doesn't provide much benefit compared to effort taken.