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 encoding user input in failed transaction message #1376
Fix encoding user input in failed transaction message #1376
Conversation
…-input-in-failed-transaction-message
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 test is a tad elaborate, I'm impressed you went through the trouble! Thanks!
@@ -262,7 +263,8 @@ func (e *AccountKeyHandler) AddEncodedAccountKey(address runtime.Address, encode | |||
|
|||
publicKey, err = flow.DecodeRuntimeAccountPublicKey(encodedPublicKey, 0) | |||
if err != nil { | |||
err = errors.NewValueErrorf(string(encodedPublicKey), "invalid encoded public key value: %w", err) | |||
hexEncodedPublicKey := hex.EncodeToString(encodedPublicKey) | |||
err = errors.NewValueErrorf(hexEncodedPublicKey, "invalid encoded public key value: %w", err) |
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.
nit: In so far as we're using a NewValueErrorf
already, could we just interpolate with "%x"?
…ransaction-message
Codecov Report
@@ Coverage Diff @@
## master #1376 +/- ##
==========================================
- Coverage 55.39% 55.37% -0.03%
==========================================
Files 510 510
Lines 31857 31858 +1
==========================================
- Hits 17648 17640 -8
- Misses 11834 11842 +8
- Partials 2375 2376 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Looks good to me. Though, I don't think I have enough background to reliably find subtle edge cases.
Style suggestion:
would be great to document in the godoc of method
flow-go/fvm/handler/accountKey.go
Line 250 in 71c36cf
func (e *AccountKeyHandler) AddEncodedAccountKey(address runtime.Address, encodedPublicKey []byte) (err error) { |
what specific error types it returns under which conditions (at least
AccountNotFoundError
and ValueError
)
require.NoError(t, err) | ||
|
||
err = akh.AddEncodedAccountKey(runtime.Address(address), encodedPublicKey) | ||
require.Error(t, err) |
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.
lets check the specific error type here, you are expecting to return
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.
Done and done
…n-failed-transaction-message' into m4ksio/fix-encoidng-user-input-in-failed-transaction-message
Add extra check for error type in a test
…ransaction-message
…ransaction-message
…ransaction-message
bors merge |
No description provided.