-
Notifications
You must be signed in to change notification settings - Fork 27
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
[INDY-2154] Cleanup after req handlers integration #276
Merged
lampkin-diet
merged 16 commits into
sovrin-foundation:master
from
lampkin-diet:public/indy-2154
Jul 9, 2019
Merged
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
018477d
[INDY-2154] first stage
d0b7671
Merge remote-tracking branch 'public/master' into public/indy-2154
b0382db
[INDY-2154] Get rid of old handlers
fc5125f
[INDY-2154] resolve ToDo comments
4d6afdc
Merge remote-tracking branch 'public/master' into public/indy-2154
248ca20
Merge branch 'public/indy-2154' of github.com:anikitinDSR/token-plugi…
60fdbaa
[INDY-2154] fix fixture imports
fdc1c91
[INDY-2154] bump indy-node version
366c4eb
[INDY-2154] fix test
f0cdd44
Merge branch 'master' into public/indy-2154
70b3b02
[INDY-2154] move helper function into class
09da0c0
Merge branch 'public/indy-2154' of github.com:anikitinDSR/token-plugi…
5670fd2
[INDY-2154] fix typo
5f2ea82
[INDY-2154] move to TokenStaticHelper
79b981c
[INDY-2154] move to TokenStaticHelper
280b1c8
Merge remote-tracking branch 'public/master' into public/indy-2154
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...token/test/req_handlers/utxo_cache_batch_handler/test_token_batch_handler_commit_batch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from sovtoken.request_handlers.token_utils import create_state_key | ||
from sovtoken.request_handlers.write_request_handler.xfer_handler import XferHandler | ||
|
||
from storage.kv_in_memory import KeyValueStorageInMemory | ||
|
||
from state.db.persistent_db import PersistentDB | ||
|
||
from sovtoken.token_req_handler import TokenReqHandler | ||
|
||
from common.serializers.serialization import state_roots_serializer | ||
|
||
from plenum.common.constants import STATE_PROOF, PROOF_NODES, ROOT_HASH | ||
|
@@ -48,7 +49,7 @@ def test_state_proof(public_minting, looper, # noqa | |
encoded = {} | ||
outputs = res[OUTPUTS] | ||
for out in outputs: | ||
state_key = TokenReqHandler.create_state_key(out["address"], out["seqNo"]) | ||
state_key = create_state_key(out["address"], out["seqNo"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use a method from |
||
encoded[state_key] = rlp_encode([str(out["amount"])]) | ||
proof_nodes = decode_proof(res[STATE_PROOF][PROOF_NODES]) | ||
client_trie = Trie(PersistentDB(KeyValueStorageInMemory())) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
import pytest | ||
from sovtoken.request_handlers.token_utils import validate_given_inputs_outputs | ||
|
||
from plenum.common.exceptions import InvalidClientMessageException | ||
|
||
from sovtoken.exceptions import ExtraFundsError | ||
from sovtoken.token_req_handler import TokenReqHandler | ||
|
||
|
||
def test_xfer_public_txn_equal(): | ||
TokenReqHandler._validate_xfer_public_txn(None, 1, 1) | ||
TokenReqHandler._validate_xfer_public_txn(None, 10, 10) | ||
TokenReqHandler._validate_xfer_public_txn(None, 100, 100) | ||
TokenReqHandler._validate_xfer_public_txn(None, 100000000000000, 100000000000000) | ||
TokenReqHandler._validate_xfer_public_txn(None, 9223372036854775807, 9223372036854775807) | ||
TokenReqHandler._validate_xfer_public_txn(None, 9223372036854775807000, 9223372036854775807000) | ||
validate_given_inputs_outputs(1, 1, 1, None) | ||
validate_given_inputs_outputs(10, 10, 10, None) | ||
validate_given_inputs_outputs(100, 100, 100, None) | ||
validate_given_inputs_outputs(100000000000000, 100000000000000, 100000000000000, None) | ||
validate_given_inputs_outputs(9223372036854775807, 9223372036854775807, 9223372036854775807, None) | ||
validate_given_inputs_outputs(9223372036854775807000, 9223372036854775807000, 9223372036854775807000, None) | ||
|
||
|
||
def test_xfer_public_txn_inputs_not_greater(): | ||
with pytest.raises(ExtraFundsError): | ||
TokenReqHandler._validate_xfer_public_txn(None, 2, 1) | ||
validate_given_inputs_outputs(2, 1, 1, None) | ||
|
||
with pytest.raises(InvalidClientMessageException): | ||
TokenReqHandler._validate_xfer_public_txn(None, 1, 2) | ||
validate_given_inputs_outputs(1, 2, 2, None) | ||
|
||
with pytest.raises(InvalidClientMessageException): | ||
TokenReqHandler._validate_xfer_public_txn(None, 100000000000000000000000, 100000000000000000000001) | ||
validate_given_inputs_outputs(100000000000000000000000, 100000000000000000000001, 100000000000000000000001, None) |
Oops, something went wrong.
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.
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.
We need some consistency here.
We have already defined this method in https://github.com/sovrin-foundation/token-plugin/blob/master/sovtoken/sovtoken/request_handlers/token_utils.py#L30
We should either use the one in
token_utils.py
either delete it and use only the one here.By the way, this is a utility method and don't see any reason to keep it in this class.