-
Notifications
You must be signed in to change notification settings - Fork 94
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
test: add integration tests for sidechain transactions #571
Conversation
adc6dac
to
792c934
Compare
6d58773
to
9ca7f0a
Compare
4800772
to
a42327c
Compare
7c23abf
to
6e251c8
Compare
42cc378
to
77534d0
Compare
77534d0
to
877df54
Compare
15ee97c
to
cc123c0
Compare
cc123c0
to
d4c98b0
Compare
d4c98b0
to
92cc566
Compare
92cc566
to
c039240
Compare
4912251
to
5f0d788
Compare
5f0d788
to
fa3aff0
Compare
for node in created_nodes | ||
if node["LedgerEntryType"] == "XChainOwnedClaimID" | ||
] | ||
assert len(claim_ids_ledger_entries) == 1, len(claim_ids_ledger_entries) |
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.
Why is this using a different assert than the rest of the testing framework?
claim_id_hash = ( | ||
claim_id_response.result.get("tx_json") or claim_id_response.result | ||
)["hash"] | ||
claim_id_tx_response = await client.request(Tx(transaction=claim_id_hash)) | ||
|
||
nodes = claim_id_tx_response.result["meta"]["AffectedNodes"] | ||
created_nodes = [ | ||
node["CreatedNode"] for node in nodes if "CreatedNode" in node.keys() | ||
] | ||
claim_ids_ledger_entries = [ | ||
node | ||
for node in created_nodes | ||
if node["LedgerEntryType"] == "XChainOwnedClaimID" | ||
] | ||
assert len(claim_ids_ledger_entries) == 1, len(claim_ids_ledger_entries) | ||
xchain_claim_id = claim_ids_ledger_entries[0]["NewFields"]["XChainClaimID"] |
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.
These variables are a bit hard to read because they all start with a long prefix. I'd recommend simplifying the names by removing that prefix (claim_id_...
), and potentially adding a comment near the top for // Claim ID Data
so that the variable's purposes can be more easily sight-read.
I've been having this problem a lot when reviewing sidechain PRs (since there's a lot of XChain... variables as well - so I'd recommend trying to apply this change more broadly.
claim_id_hash = ( | |
claim_id_response.result.get("tx_json") or claim_id_response.result | |
)["hash"] | |
claim_id_tx_response = await client.request(Tx(transaction=claim_id_hash)) | |
nodes = claim_id_tx_response.result["meta"]["AffectedNodes"] | |
created_nodes = [ | |
node["CreatedNode"] for node in nodes if "CreatedNode" in node.keys() | |
] | |
claim_ids_ledger_entries = [ | |
node | |
for node in created_nodes | |
if node["LedgerEntryType"] == "XChainOwnedClaimID" | |
] | |
assert len(claim_ids_ledger_entries) == 1, len(claim_ids_ledger_entries) | |
xchain_claim_id = claim_ids_ledger_entries[0]["NewFields"]["XChainClaimID"] | |
hash = ( | |
claim_id_response.result.get("tx_json") or claim_id_response.result | |
)["hash"] | |
tx_response = await client.request(Tx(transaction=hash)) | |
nodes = tx_response.result["meta"]["AffectedNodes"] | |
created_nodes = [ | |
node["CreatedNode"] for node in nodes if "CreatedNode" in node.keys() | |
] | |
ledger_entries = [ | |
node | |
for node in created_nodes | |
if node["LedgerEntryType"] == "XChainOwnedClaimID" | |
] | |
assert len(ledger_entries) == 1, len(ledger_entries) | |
xchain_claim_id = ledger_entries[0]["NewFields"]["XChainClaimID"] |
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.
I'd rather keep the variables more descriptive.
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 - Just a variable name style comment to take or leave :)
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
High Level Overview of Change
Title says it all.
Context of Change
Integration tests for #417. These tests are in a separate PR to make it easier to review and because tests won't pass in CI yet (since the amendment isn't a part of the Docker container yet), and will be merged into the feature branch prior to merging into
main
. Any bugfixes that were caught by these tests were moved to #417.Type of Change
Test Plan
Passes locally when running a version of rippled with the amendment enabled.