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

feat: add support for XLS-38d #417

Merged
merged 137 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 126 commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
7688fa0
update definitions.json
mvadari Jul 11, 2022
1e117cd
add XChainCreateBridge test
mvadari Jul 11, 2022
19589d1
get XChainCreateBridge test working
mvadari Jul 11, 2022
cac0d76
add XChainCreateClaimID tx
mvadari Jul 11, 2022
7a97417
get XChainCommit working
mvadari Jul 11, 2022
9a832d0
add XChainClaim tx
mvadari Jul 11, 2022
5abc9f8
add models
mvadari Jul 11, 2022
34bea91
comment out unwritten txs
mvadari Jul 11, 2022
00b2461
add test for xchain conversion, fix bugs
mvadari Jul 11, 2022
3203549
Update definitions.json
mvadari Jul 12, 2022
057e807
fix typo
mvadari Jul 18, 2022
6629b4b
update to handle XChainAddAttestation (and fix everything else)
mvadari Jul 18, 2022
58a0b02
fix bugs
mvadari Jul 18, 2022
3d34552
fix unused variable
mvadari Jul 18, 2022
1769b10
rename Bridge -> XChainBridge in models
mvadari Jul 18, 2022
cff03e1
add XChainAddAttestation model(s)
mvadari Jul 18, 2022
a7a45fc
fix import
mvadari Jul 18, 2022
4c5c9af
rename file
mvadari Jul 19, 2022
729b20a
fix existing tests w/updated rippled, add AccountCreate test
mvadari Jul 29, 2022
15e298a
add CreateAccount AddAttestation test
mvadari Jul 31, 2022
c35447b
add/update models
mvadari Jul 31, 2022
90dc8ed
export new tx
mvadari Jul 31, 2022
e21ed03
fix XChainCommit
mvadari Aug 2, 2022
bbb09c4
fix XChainAddAttestation
mvadari Aug 2, 2022
c34afed
add XChainModifyBridge tx model
mvadari Aug 2, 2022
1e36a2e
rename field
mvadari Aug 2, 2022
a5b26a4
actually export tx
mvadari Aug 2, 2022
8cfd601
Update definitions.json
mvadari Aug 3, 2022
4863320
add XChainModifyBridge binary codec test
mvadari Aug 3, 2022
573faea
edit changelog
mvadari Aug 3, 2022
98be541
update RPCs
mvadari Aug 15, 2022
ac805d1
make claim attestation destination optional
mvadari Aug 16, 2022
78a2ac3
make signature reward optional for modify bridge
mvadari Aug 18, 2022
c4e591e
update to new rippled changes
mvadari Aug 26, 2022
b31526d
one more fix
mvadari Aug 26, 2022
02d8fc3
Update definitions.json
mvadari Aug 29, 2022
dbd0781
fix spacing
mvadari Aug 29, 2022
eedc445
update definitions.json to avoid conflict with amm
mvadari Aug 30, 2022
d187b3b
Update definitions.json
mvadari Aug 31, 2022
5c0e9a4
more updates
mvadari Aug 31, 2022
7c333ff
fix fixtures
mvadari Aug 31, 2022
75a43ec
update rpcs
mvadari Sep 1, 2022
98b807d
use NestedModel
mvadari Sep 30, 2022
042fb26
make test easier to read
mvadari Sep 30, 2022
677876e
respond to comments
mvadari Sep 30, 2022
fdba19d
fix mypy
mvadari Sep 30, 2022
decdc59
add destination tag to XChainClaim
mvadari Oct 4, 2022
b20d0a7
fix import
mvadari Oct 26, 2022
c500d99
rename IssuedCurrency -> Issue to match rippled
mvadari Nov 8, 2022
debdd23
add xchain bridge to account objects
mvadari Nov 10, 2022
b65f755
fix account objects filters
mvadari Nov 10, 2022
fbdd483
update Issue form
mvadari Nov 16, 2022
1c96853
fix models
mvadari Nov 16, 2022
9eb38c1
fix test
mvadari Nov 16, 2022
6a3d089
add validations for XChainCreateBridge
mvadari Dec 12, 2022
aa1a09e
add validations for XChainModifyBridge
mvadari Dec 12, 2022
02404e9
validate XChainClaim
mvadari Dec 12, 2022
75dfc28
add validations for XChainCreateClaimID
mvadari Dec 12, 2022
a351c92
add validations for XChainAddAttestation
mvadari Dec 12, 2022
6373441
fix tests
mvadari Dec 12, 2022
783c2e2
add validations for XChainAccountCreateCommit
mvadari Dec 12, 2022
3f03f27
fix more Literal["XRP"] issues
mvadari Dec 13, 2022
c113cfb
simplify initializing attestation lists
mvadari Jan 5, 2023
6a0ab4a
fix attestation list creation
mvadari Jan 9, 2023
1694f81
Update definitions.json
mvadari Jan 30, 2023
32152d6
fix tests
mvadari Jan 30, 2023
1a6487b
rename XChainAddAttestation -> XChainAddAttestationBatch
mvadari Jan 30, 2023
cdd474b
add XChainAddClaimAttestation tx
mvadari Jan 30, 2023
ca369d2
add XChainAddAccountCreateAttestation tx
mvadari Jan 30, 2023
c6390ce
Merge branch 'master' into sidechain-2.5
mvadari Jan 30, 2023
d663b30
export new txs
mvadari Jan 30, 2023
b6f19bf
fix types in WasLockingChainSend
mvadari Feb 2, 2023
7ce5b87
Merge branch 'master' into sidechain-2.5
mvadari Feb 2, 2023
cfdf7db
fix typo
mvadari Feb 6, 2023
71d5d6c
remove XChainAddAttestationBatch
mvadari Feb 6, 2023
2377118
fix tests
mvadari Feb 6, 2023
acb5803
update definitions
mvadari Feb 7, 2023
abec1c3
update to latest version of rippled
mvadari Feb 14, 2023
9a49057
Merge branch 'master' into sidechain-2.5
mvadari Feb 14, 2023
167c921
add XChainModifyBridge flag
mvadari Feb 14, 2023
8864f3e
Update definitions.json
mvadari Feb 15, 2023
06500b9
add binary codec tests for new txs
mvadari Feb 15, 2023
a2e2e8d
fix validation for XChainCreateClaimID
mvadari Mar 23, 2023
a49de66
Merge branch 'master' into sidechain-2.5
mvadari Apr 5, 2023
c172803
Merge branch 'master' into sidechain-2.5
mvadari Apr 5, 2023
895058a
add docs
mvadari Apr 5, 2023
fe80522
add bridge to account_objects filters
mvadari Apr 7, 2023
e827e67
Merge branch 'master' into sidechain-2.5
mvadari Apr 11, 2023
9a252a2
Merge branch 'master' into sidechain-2.5
mvadari Apr 11, 2023
1c22a3b
update account_objects filters
mvadari Apr 28, 2023
57432d4
Merge branch 'master' into sidechain-2.5
mvadari May 1, 2023
433e994
fix linter issues
mvadari May 1, 2023
39fcebd
Merge branch 'master' into sidechain-2.5
mvadari May 2, 2023
9eb3441
fix model validation
mvadari May 3, 2023
3e51596
improve types
mvadari May 3, 2023
c61cb5c
Merge branch 'master' into sidechain-2.5
mvadari May 16, 2023
fd99b44
Merge branch 'master' into sidechain-2.5
mvadari May 31, 2023
21bea2a
chore(deps-dev): bump coverage from 7.2.5 to 7.2.7 (#587)
dependabot[bot] Jun 1, 2023
a6f0ae1
chore(deps): bump typing-extensions from 4.5.0 to 4.6.2 (#588)
dependabot[bot] Jun 1, 2023
3675658
chore(deps-dev): bump mypy from 1.2.0 to 1.3.0 (#586)
dependabot[bot] Jun 1, 2023
465015b
chore(deps): bump httpx from 0.24.0 to 0.24.1 (#584)
dependabot[bot] Jun 2, 2023
8ba5669
chore(deps): bump deprecated from 1.2.13 to 1.2.14 (#583)
dependabot[bot] Jun 2, 2023
65e1822
chore(deps-dev): bump sphinx-rtd-theme from 1.2.0 to 1.2.1 (#582)
dependabot[bot] Jun 5, 2023
82a8e5b
fix: improve error message for `tem` errors in relsub (#590)
mvadari Jun 5, 2023
697756b
(WIP) bridge transfer snippet
mvadari Jun 8, 2023
4746be2
fix snippet
mvadari Jun 9, 2023
29617ac
Update bridge_transfer.py
mvadari Jun 12, 2023
116593c
Merge branch 'master' into sidechain-2.5
mvadari Jun 12, 2023
3da897e
Merge branch 'master' into sidechain-2.5
mvadari Jun 20, 2023
a41a2bc
Merge branch 'master' into sidechain-2.5
mvadari Jun 23, 2023
cc4ebc2
Merge branch 'master' into sidechain-2.5
mvadari Jul 6, 2023
3478bbd
Merge branch 'master' into sidechain-2.5
mvadari Jul 6, 2023
ebfc107
fix settings.json
mvadari Jul 6, 2023
9bfda27
Merge branch 'master' into sidechain-2.5
mvadari Jul 10, 2023
7103fd9
Merge branch 'master' into sidechain-2.5
mvadari Jul 11, 2023
6e11a1a
Merge branch 'master' into sidechain-2.5
mvadari Jul 24, 2023
7fa9635
update ledger_entry
mvadari Aug 15, 2023
e1b3b32
add tests
mvadari Aug 15, 2023
386914c
Merge branch 'master' into sidechain-2.5
mvadari Aug 15, 2023
c98a82f
fix tests
mvadari Aug 15, 2023
72160ae
Merge branch 'master' into sidechain-2.5
mvadari Aug 26, 2023
73b79fd
Update definitions.json
mvadari Sep 12, 2023
740c233
Merge branch 'master' into sidechain-2.5
mvadari Sep 12, 2023
6979f67
Update definitions.json
mvadari Sep 14, 2023
b199c14
fix unit tests
mvadari Sep 14, 2023
0e3c81a
Merge branch 'master' into sidechain-2.5
mvadari Sep 14, 2023
45a9301
respond to comments
mvadari Sep 18, 2023
2cc6eeb
Merge branch 'master' into sidechain-2.5
mvadari Sep 18, 2023
3b5ccc9
add getXChainClaimID util
mvadari Sep 21, 2023
2317670
fix error
mvadari Sep 21, 2023
e718723
fix test name
mvadari Sep 25, 2023
7ea61b1
add more comments
mvadari Sep 25, 2023
2d8bfb5
Merge branch 'master' into sidechain-2.5
mvadari Sep 26, 2023
0454b4e
fix changelog
mvadari Sep 26, 2023
b8c287e
respond to comments
mvadari Sep 27, 2023
e80e10b
Merge branch 'master' into sidechain-2.5
mvadari Sep 27, 2023
1740de7
improve ledger entry objects
mvadari Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"python.formatting.provider": "black",
"python.formatting.provider": "none",
JST5000 marked this conversation as resolved.
Show resolved Hide resolved
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
Expand All @@ -13,12 +13,18 @@
"asyncio",
"autofills",
"binarycodec",
"Clawback",
"isnumeric",
"keypair",
"keypairs",
"multisign",
"nftoken",
"rippletest",
"ripplex",
"xaddress"
"xaddress",
"xchain"
],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [2.1.0] - 2023-07-24
### Fixed
- Replaced alias for `classic_address` with separate property to work around this mypy issue:
- Replaced alias for `classic_address` with separate property to work around this mypy issue:
https://github.com/python/mypy/issues/6700

## [2.0.0] - 2023-07-05
Expand Down Expand Up @@ -93,6 +93,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `getNFTokenID` to get the NFTokenID after minting a token.
- Added `LedgerEntryType` enum and added `type` field to `Ledger` and `LedgerData` requests
- Added the algorithm used to encode a wallet's seed to the wallet.
- Support for cross-chain bridge proposal
mvadari marked this conversation as resolved.
Show resolved Hide resolved

### Changed:
- `check_fee` now has a higher limit that is less likely to be hit
Expand Down
100 changes: 100 additions & 0 deletions snippets/bridge_transfer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"""CLI command for setting up a bridge."""

from time import sleep

from xrpl.account import does_account_exist, get_balance
from xrpl.clients import JsonRpcClient
from xrpl.models import (
AccountObjects,
AccountObjectType,
XChainAccountCreateCommit,
XChainBridge,
XChainCommit,
XChainCreateClaimID,
)
from xrpl.transaction import submit_and_wait
from xrpl.utils import xrp_to_drops
from xrpl.wallet import Wallet, generate_faucet_wallet

locking_client = JsonRpcClient("https://sidechain-net1.devnet.rippletest.net:51234")
issuing_client = JsonRpcClient("https://sidechain-net2.devnet.rippletest.net:51234")

locking_chain_door = "rMAXACCrp3Y8PpswXcg3bKggHX76V3F8M4"
bridge_data = locking_client.request(
AccountObjects(account=locking_chain_door, type=AccountObjectType.BRIDGE)
).result["account_objects"][0]
bridge = XChainBridge.from_xrpl(bridge_data["XChainBridge"])
print(bridge)

wallet1 = generate_faucet_wallet(locking_client, debug=True)
wallet2 = Wallet.create()

print(f"Creating {wallet2.classic_address} on the issuing chain via the bridge...")
JST5000 marked this conversation as resolved.
Show resolved Hide resolved

fund_tx = XChainAccountCreateCommit(
account=wallet1.classic_address,
xchain_bridge=bridge,
signature_reward=bridge_data["SignatureReward"],
destination=wallet2.classic_address,
amount=str(int(bridge_data["MinAccountCreateAmount"]) * 2),
)
fund_response = submit_and_wait(fund_tx, locking_client, wallet1)


# wait for the attestation to go through
ledgers_waited = 0
MAX_LEDGERS_WAITED = 5
while ledgers_waited < MAX_LEDGERS_WAITED:
sleep(4)
if does_account_exist(wallet2.classic_address, issuing_client):
print(
f"Destination account {wallet2.classic_address} has been created via the "
"bridge"
)
initial_balance = get_balance(wallet2.classic_address, issuing_client)
break

ledgers_waited += 1
if ledgers_waited == MAX_LEDGERS_WAITED:
raise Exception("Destination account creation via the bridge failed.")

seq_num_tx = XChainCreateClaimID(
account=wallet2.classic_address,
xchain_bridge=bridge,
signature_reward=bridge_data["SignatureReward"],
other_chain_source=wallet1.classic_address,
)
seq_num_result = submit_and_wait(seq_num_tx, issuing_client, wallet2)

# # extract new sequence number from metadata
mvadari marked this conversation as resolved.
Show resolved Hide resolved
nodes = seq_num_result.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"]

# # XChainCommit
mvadari marked this conversation as resolved.
Show resolved Hide resolved

commit_tx = XChainCommit(
account=wallet1.classic_address,
amount=xrp_to_drops(1),
xchain_bridge=bridge,
xchain_claim_id=xchain_claim_id,
other_chain_destination=wallet2.classic_address,
)
submit_and_wait(commit_tx, locking_client, wallet1)

# wait for the attestations to go through
ledgers_waited = 0
while ledgers_waited < MAX_LEDGERS_WAITED:
sleep(4)
current_balance = get_balance(wallet2.classic_address, issuing_client)
if current_balance != initial_balance:
print("Transfer is complete")
break

ledgers_waited += 1
if ledgers_waited == MAX_LEDGERS_WAITED:
raise Exception("Bridge transfer failed.")
183 changes: 183 additions & 0 deletions tests/unit/core/binarycodec/fixtures/data/codec-fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -4450,6 +4450,189 @@
"Sequence": 62
}
},
{
"binary": "1200302200000000240000000168400000000000000A601D40000000000003E8601E400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020744630440220101BCA4B5B5A37C6F44480F9A34752C9AA8B2CDF5AD47E3CB424DEDC21C06DB702206EEB257E82A89B1F46A0A2C7F070B0BD181D980FF86FE4269E369F6FC7A270918114B5F762798A53D543A014CAF8B297CFF8F2F937E8011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
"json": {
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"XChainBridge": {
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
"LockingChainIssue": {"currency": "XRP"},
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
"IssuingChainIssue": {"currency": "XRP"}
},
"Fee": "10",
"Flags": 0,
"MinAccountCreateAmount": "10000",
"Sequence": 1,
"SignatureReward": "1000",
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
"TransactionType": "XChainCreateBridge",
"TxnSignature": "30440220101BCA4B5B5A37C6F44480F9A34752C9AA8B2CDF5AD47E3CB424DEDC21C06DB702206EEB257E82A89B1F46A0A2C7F070B0BD181D980FF86FE4269E369F6FC7A27091"
}
},
{
"binary": "12002F2200000000240000000168400000000000000A601D40000000000003E8601E400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100D2CABC1B0E0635A8EE2E6554F6D474C49BC292C995C5C9F83179F4A60634B04C02205D1DB569D9593136F2FBEA7140010C8F46794D653AFDBEA8D30B8750BA4805E58114B5F762798A53D543A014CAF8B297CFF8F2F937E8011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
"json": {
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"XChainBridge": {
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
"LockingChainIssue": {"currency": "XRP"},
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
"IssuingChainIssue": {"currency": "XRP"}
},
"Fee": "10",
"Flags": 0,
"MinAccountCreateAmount": "10000",
"Sequence": 1,
"SignatureReward": "1000",
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
"TransactionType": "XChainModifyBridge",
"TxnSignature": "3045022100D2CABC1B0E0635A8EE2E6554F6D474C49BC292C995C5C9F83179F4A60634B04C02205D1DB569D9593136F2FBEA7140010C8F46794D653AFDBEA8D30B8750BA4805E5"
}
},
{
"binary": "1200292280000000240000000168400000000000000A601D400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020744630440220247B20A1B9C48E21A374CB9B3E1FE2A7C528151868DF8D307E9FBE15237E531A02207C20C092DDCC525E583EF4AB7CB91E862A6DED19426997D3F0A2C84E2BE8C5DD8114B5F762798A53D543A014CAF8B297CFF8F2F937E8801214AF80285F637EE4AF3C20378F9DFB12511ACB8D27011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
"json": {
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"XChainBridge": {
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
"LockingChainIssue": {"currency": "XRP"},
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
"IssuingChainIssue": {"currency": "XRP"}
},
"Fee": "10",
"Flags": 2147483648,
"OtherChainSource": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
"Sequence": 1,
"SignatureReward": "10000",
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
"TransactionType": "XChainCreateClaimID",
"TxnSignature": "30440220247B20A1B9C48E21A374CB9B3E1FE2A7C528151868DF8D307E9FBE15237E531A02207C20C092DDCC525E583EF4AB7CB91E862A6DED19426997D3F0A2C84E2BE8C5DD"
}
},
{
"binary": "12002A228000000024000000013014000000000000000161400000000000271068400000000000000A73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074453043021F177323F0D93612C82A4393A99B23905A7E675753FD80C52997AFAB13F5F9D002203BFFAF457E90BDA65AABE8F8762BD96162FAD98A0C030CCD69B06EE9B12BBFFE8114B5F762798A53D543A014CAF8B297CFF8F2F937E8011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
"json": {
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"Amount": "10000",
"XChainBridge": {
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
"LockingChainIssue": {"currency": "XRP"},
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
"IssuingChainIssue": {"currency": "XRP"}
},
"Fee": "10",
"Flags": 2147483648,
"Sequence": 1,
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
"TransactionType": "XChainCommit",
"TxnSignature": "3043021F177323F0D93612C82A4393A99B23905A7E675753FD80C52997AFAB13F5F9D002203BFFAF457E90BDA65AABE8F8762BD96162FAD98A0C030CCD69B06EE9B12BBFFE",
"XChainClaimID": "0000000000000001"
}
},
{
"binary": "12002B228000000024000000013014000000000000000161400000000000271068400000000000000A73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020744630440220445F7469FDA401787D9EE8A9B6E24DFF81E94F4C09FD311D2C0A58FCC02C684A022029E2EF34A5EA35F50D5BB57AC6320AD3AE12C13C8D1379B255A486D72CED142E8114B5F762798A53D543A014CAF8B297CFF8F2F937E88314550FC62003E785DC231A1058A05E56E3F09CF4E6011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
"json": {
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"Amount": "10000",
"XChainBridge": {
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
"LockingChainIssue": {"currency": "XRP"},
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
"IssuingChainIssue": {"currency": "XRP"}
},
"Destination": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 1,
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
"TransactionType": "XChainClaim",
"TxnSignature": "30440220445F7469FDA401787D9EE8A9B6E24DFF81E94F4C09FD311D2C0A58FCC02C684A022029E2EF34A5EA35F50D5BB57AC6320AD3AE12C13C8D1379B255A486D72CED142E",
"XChainClaimID": "0000000000000001"
}
},
{
"binary": "12002C228000000024000000016140000000000F424068400000000000000A601D400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402202984DDE7F0B566F081F7953D7212BF031ACBF8860FE114102E9512C4C8768C77022070113F4630B1DC3045E4A98DDD648CEBC31B12774F7B44A1B8123CD2C9F5CF188114B5F762798A53D543A014CAF8B297CFF8F2F937E88314AF80285F637EE4AF3C20378F9DFB12511ACB8D27011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000",
"json": {
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"XChainBridge": {
"LockingChainDoor": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
"LockingChainIssue": {"currency": "XRP"},
"IssuingChainDoor": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
"IssuingChainIssue": {"currency": "XRP"}
},
"Amount": "1000000",
"Fee": "10",
"Flags": 2147483648,
"Destination": "rGzx83BVoqTYbGn7tiVAnFw7cbxjin13jL",
"Sequence": 1,
"SignatureReward": "10000",
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
"TransactionType": "XChainAccountCreateCommit",
"TxnSignature": "304402202984DDE7F0B566F081F7953D7212BF031ACBF8860FE114102E9512C4C8768C77022070113F4630B1DC3045E4A98DDD648CEBC31B12774F7B44A1B8123CD2C9F5CF18"
}
},
{
"binary": "12002E2400000005201B0000000D30150000000000000006614000000000989680684000000000000014601D40000000000000647121ED1F4A024ACFEBDB6C7AA88DEDE3364E060487EA31B14CC9E0D610D152B31AADC27321EDF54108BA2E0A0D3DC2AE3897F8BE0EFE776AE8D0F9FB0D0B9D64233084A8DDD1744003E74AEF1F585F156786429D2FC87A89E5C6B5A56D68BFC9A6A329F3AC67CBF2B6958283C663A4522278CA162C69B23CF75149AF022B410EA0508C16F42058007640EEFCFA3DC2AB4AB7C4D2EBBC168CB621A11B82BABD86534DFC8EFA72439A49662D744073CD848E7A587A95B35162CDF9A69BB237E72C9537A987F5B8C394F30D81145E7A3E3D7200A794FA801C66CE3775B6416EE4128314C15F113E49BCC4B9FFF43CD0366C23ACD82F75638012143FD9ED9A79DEA67CB5D585111FEF0A29203FA0408015145E7A3E3D7200A794FA801C66CE3775B6416EE4120010130101191486F0B1126CE1205E59FDFDD2661A9FB7505CA70F000000000000000000000000000000000000000014B5F762798A53D543A014CAF8B297CFF8F2F937E80000000000000000000000000000000000000000",
"json": {
"Account": "r9cYxdjQsoXAEz3qQJc961SNLaXRkWXCvT",
"Amount": "10000000",
"AttestationRewardAccount": "r9cYxdjQsoXAEz3qQJc961SNLaXRkWXCvT",
"Destination": "rJdTJRJZ6GXCCRaamHJgEqVzB7Zy4557Pi",
"Fee": "20",
"LastLedgerSequence": 13,
"OtherChainSource": "raFcdz1g8LWJDJWJE2ZKLRGdmUmsTyxaym",
"PublicKey": "ED1F4A024ACFEBDB6C7AA88DEDE3364E060487EA31B14CC9E0D610D152B31AADC2",
"Sequence": 5,
"Signature": "EEFCFA3DC2AB4AB7C4D2EBBC168CB621A11B82BABD86534DFC8EFA72439A49662D744073CD848E7A587A95B35162CDF9A69BB237E72C9537A987F5B8C394F30D",
"SignatureReward": "100",
"SigningPubKey": "EDF54108BA2E0A0D3DC2AE3897F8BE0EFE776AE8D0F9FB0D0B9D64233084A8DDD1",
"TransactionType": "XChainAddAccountCreateAttestation",
"TxnSignature": "03E74AEF1F585F156786429D2FC87A89E5C6B5A56D68BFC9A6A329F3AC67CBF2B6958283C663A4522278CA162C69B23CF75149AF022B410EA0508C16F4205800",
"WasLockingChainSend": 1,
"XChainAccountCreateCount": "0000000000000006",
"XChainBridge": {
"IssuingChainDoor": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"IssuingChainIssue": {
"currency": "XRP"
},
"LockingChainDoor": "rDJVtEuDKr4rj1B3qtW7R5TVWdXV2DY7Qg",
"LockingChainIssue": {
"currency": "XRP"
}
}
}
},
{
"binary": "12002D2400000009201B00000013301400000000000000016140000000009896806840000000000000147121ED7541DEC700470F54276C90C333A13CDBB5D341FD43C60CEA12170F6D6D4E11367321ED0406B134786FE0751717226657F7BF8AFE96442C05D28ACEC66FB64852BA604C7440D0423649E48A44F181262CF5FC08A68E7FA5CD9E55843E4F09014B76E602574741E8553383A4B43CABD194BB96713647FC0B885BE248E4FFA068FA3E6994CF0476407C175050B08000AD35EEB2D87E16CD3F95A0AEEBF2A049474275153D9D4DD44528FE99AA50E71660A15B0B768E1B90E609BBD5DC7AFAFD45D9705D72D40EA10C81141F30A4D728AB98B0950EC3B9815E6C8D43A7D5598314C15F113E49BCC4B9FFF43CD0366C23ACD82F75638012143FD9ED9A79DEA67CB5D585111FEF0A29203FA0408015141F30A4D728AB98B0950EC3B9815E6C8D43A7D5590010130101191486F0B1126CE1205E59FDFDD2661A9FB7505CA70F000000000000000000000000000000000000000014B5F762798A53D543A014CAF8B297CFF8F2F937E80000000000000000000000000000000000000000",
"json": {
"Account": "rsqvD8WFFEBBv4nztpoW9YYXJ7eRzLrtc3",
"Amount": "10000000",
"AttestationRewardAccount": "rsqvD8WFFEBBv4nztpoW9YYXJ7eRzLrtc3",
"Destination": "rJdTJRJZ6GXCCRaamHJgEqVzB7Zy4557Pi",
"Fee": "20",
"LastLedgerSequence": 19,
"OtherChainSource": "raFcdz1g8LWJDJWJE2ZKLRGdmUmsTyxaym",
"PublicKey": "ED7541DEC700470F54276C90C333A13CDBB5D341FD43C60CEA12170F6D6D4E1136",
"Sequence": 9,
"Signature": "7C175050B08000AD35EEB2D87E16CD3F95A0AEEBF2A049474275153D9D4DD44528FE99AA50E71660A15B0B768E1B90E609BBD5DC7AFAFD45D9705D72D40EA10C",
"SigningPubKey": "ED0406B134786FE0751717226657F7BF8AFE96442C05D28ACEC66FB64852BA604C",
"TransactionType": "XChainAddClaimAttestation",
"TxnSignature": "D0423649E48A44F181262CF5FC08A68E7FA5CD9E55843E4F09014B76E602574741E8553383A4B43CABD194BB96713647FC0B885BE248E4FFA068FA3E6994CF04",
"WasLockingChainSend": 1,
"XChainBridge": {
"IssuingChainDoor": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"IssuingChainIssue": {
"currency": "XRP"
},
"LockingChainDoor": "rDJVtEuDKr4rj1B3qtW7R5TVWdXV2DY7Qg",
"LockingChainIssue": {
"currency": "XRP"
}
},
"XChainClaimID": "0000000000000001"
}
},
{
"binary": "12002315000A2200000000240015DAE161400000000000271068400000000000000A6BD5838D7EA4C680000000000000000000000000004554480000000000FBEF9A3A2B814E807745FA3D9C32FFD155FA2E8C7321ED7453D2572A2104E7B266A45888C53F503CEB1F11DC4BB3710EB2995238EC65B87440B3154D968314FCEB58001E1B0C3A4CFB33DF9FF6C73207E5EAEB9BD07E2747672168E1A2786D950495C38BD8DEE3391BF45F3008DD36F4B12E7C07D82CA5250E8114F92F27CC5EE2F2760278FE096D0CBE32BDD3653A",
"json": {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/core/binarycodec/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ def test_xaddress_xaddr_and_matching_source_tag(self):


class TestMainFixtures(TestCase):
maxDiff = 1000
maxDiff = None
JST5000 marked this conversation as resolved.
Show resolved Hide resolved

def _check_binary_and_json(self, test):
test_binary = test["binary"]
test_json = test["json"]
with self.subTest(test_binary=test_binary, test_json=test_json):
self.assertEqual(encode(test_json), test_binary)
self.assertEqual(decode(test_binary), test_json)
self.assertEqual(encode(test_json), test_binary)
Comment on lines -340 to +341
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO debugging is easier when the decode test is first


def _check_xaddress_jsons(self, test):
x_json = test["xjson"]
Expand Down
Loading