Skip to content
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

Merged
merged 3 commits into from
Mar 20, 2019

Conversation

mikiquantum
Copy link
Contributor

Issue Link:

Copy link
Member

@xmxanuel xmxanuel left a 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[:])
Copy link
Member

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?

Copy link
Contributor Author

@mikiquantum mikiquantum Mar 19, 2019

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 ?

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.

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

Copy link
Member

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.

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

@@ -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()))
Copy link
Contributor

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
Copy link

codecov bot commented Mar 19, 2019

Codecov Report

Merging #862 into develop will increase coverage by 0.01%.
The diff coverage is 25%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
transactions/txv1/manager.go 70.1% <100%> (+0.31%) ⬆️
nft/ethereum_payment_obligation.go 71.42% <14.28%> (-2.49%) ⬇️
anchors/service.go 51.76% <0%> (-3.94%) ⬇️
testworld/payloads.go 80.85% <0%> (ø) ⬆️
testworld/park.go 77.77% <0%> (+0.1%) ⬆️
documents/purchaseorder/model.go 79.77% <0%> (+1.78%) ⬆️
documents/invoice/model.go 83.08% <0%> (+1.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 835eb75...129a5db. Read the comment docs.

@lucasvo
Copy link
Member

lucasvo commented Mar 19, 2019

Is it possible to add unit tests here for the new code?

@mikiquantum mikiquantum merged commit 0084e37 into centrifuge:develop Mar 20, 2019
@mikiquantum mikiquantum deleted the nft/improvs branch March 20, 2019 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants