-
Notifications
You must be signed in to change notification settings - Fork 35
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 nft owner check + tx error log #862
Conversation
mikiquantum
commented
Mar 19, 2019
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.
LGTM
@@ -204,6 +204,17 @@ func (s *ethereumPaymentObligation) minter(ctx context.Context, tokenID TokenID, | |||
return | |||
} | |||
|
|||
// Check if tokenID exists in registry and owner is deposit address | |||
owner, err := s.OwnerOf(req.RegistryAddress, tokenID[:]) |
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.
Just out of curiosity.
What happens if the user passes an invalid address as depositAddress?
Would it fail?
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 question, I think there must be a test case in truffle project that should verify that. @rdinicut ?
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.
What does invalid mean? There is a check for a valid ETH address.
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.
Valid means it passes a checksum test
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.
There are no checksum tests for addresses, the checksum is only in capitalization which is not really enforced outside of user input. Theoretically any 20 byte value is correct.
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.
Yes, but you can also enforce the checksum to have some extra validation. Web3 does that for example
transactions/txv1/manager.go
Outdated
@@ -92,6 +92,7 @@ func (s *manager) ExecuteWithinTX(ctx context.Context, accountID identity.DID, e | |||
if e == nil && transactions.TxIDEqual(existingTxID, transactions.NilTxID()) { | |||
tempTx.Status = transactions.Success | |||
} else if e != nil { | |||
tempTx.Logs = append(tempTx.Logs, transactions.NewLog(desc, e.Error())) |
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.
could you add something here that says log was added by manager
?
Codecov Report
@@ Coverage Diff @@
## develop #862 +/- ##
===========================================
+ Coverage 57.24% 57.26% +0.01%
===========================================
Files 110 110
Lines 7967 7970 +3
===========================================
+ Hits 4561 4564 +3
+ Misses 2869 2864 -5
- Partials 537 542 +5
Continue to review full report at Codecov.
|
Is it possible to add unit tests here for the new code? |