-
Notifications
You must be signed in to change notification settings - Fork 81
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
wallet: do not store deployed contract script inside Contract
account field
#3470
Conversation
3876c43
to
bafc73a
Compare
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 logic of this PR is correct. TestSignMultisigTx
fails because contract's witness (an empty one, actually) is not added to the parameter context and parameter context is not aware of contract witnesses while building the resulting tx witnesses:
neo-go/pkg/smartcontract/context/context.go
Lines 65 to 83 in 0b136c1
// GetCompleteTransaction clears transaction witnesses (if any) and refills them with | |
// signatures from the parameter context. | |
func (c *ParameterContext) GetCompleteTransaction() (*transaction.Transaction, error) { | |
tx, ok := c.Verifiable.(*transaction.Transaction) | |
if !ok { | |
return nil, errors.New("verifiable item is not a transaction") | |
} | |
if len(tx.Scripts) > 0 { | |
tx.Scripts = tx.Scripts[:0] | |
} | |
for i := range tx.Signers { | |
w, err := c.GetWitness(tx.Signers[i].Account) | |
if err != nil { | |
return nil, fmt.Errorf("can't create witness for signer #%d: %w", i, err) | |
} | |
tx.Scripts = append(tx.Scripts, *w) | |
} | |
return tx, nil | |
} |
@roman-khimov, currently we can't use neo-go wallet sign
with contract accounts. We have #2670 for those contracts that have verify
method with arguments. Do you think we need to support at least an empty case of verify
method right now in neo-go wallet sign
? We also need parameter context to still be compatible with the C# behaviour, thus need to check how C# node handles contract witness case in parameter context.
Contract
field
That's not correct, everything is OK with this code, it can properly handle contract witness. @AliceInHunterland, you need to explicitly set account's script to null when importing contract account, otherwise an old value of some real signature account's script will be used:
|
Contract
fieldContract
account field
@AliceInHunterland, add this line, add some comment about it and adjust the commit message. |
bafc73a
to
25d9624
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3470 +/- ##
==========================================
+ Coverage 86.12% 86.16% +0.04%
==========================================
Files 331 331
Lines 38476 38476
==========================================
+ Hits 33137 33153 +16
+ Misses 3809 3798 -11
+ Partials 1530 1525 -5 ☔ View full report in Codecov by Sentry. |
25d9624
to
bb2d060
Compare
`Contract` account field should not contain deployed contract script. Close #3348 Signed-off-by: Ekaterina Pavlova <[email protected]>
bb2d060
to
b4fdf8c
Compare
Close #3348