Skip to content

Commit

Permalink
feat: add support for current sidechain design (#2039)
Browse files Browse the repository at this point in the history
* Update definitions.json

* add new st types

* add tests

* add XChainClaim tx

* add XChainCommit tx

* add XChainCreateBridge tx

* add XChainCreateClaimID tx

* update definitions.json

* rename Bridge -> XChainBridge in binary codec, fix tests

* rename Bridge -> XChainBridge in models

* add codec support for XChainAddAttestation

* add XChainAddAttestation model

* undo debugging change

* fix linting issues

* update definitions.json for new rippled code, add new tests/update old tests

* add/update models

* update history

* update binary-codec

* add XChainModifyBridge model

* update RPCs

* update to latest rippled

* more fixes

* fix definitions.json

* fix spacing

* update definitions.json to avoid conflict with amm

* update definitions.json to resolve amm conflicts

* audit code

* more updates

* update rpcs

* switch to beta version

* add destination tag to XChainClaim

* rename IssuedCurrency -> Issue to match rippled

* update Issue form

* fix account object filters

* fix issue from typing

* fix LedgerEntry types

* fix attestation destination type

* Update definitions.json

* rename XChainAddAttestation -> XChainAddAttestationBatch

* add XChainAddClaimAttestation

* add XChainAddAccountCreateAttestation

* remove XChainAddAttestationBatch

* update definitions

* fix attestation txns

* fix attestation object

* add validate for new txs

* add Bridge ledger object

* add XChainOwnedClaimID ledger object

* add XChainOwnedCreateAccountClaimID ledger object

* update account_objects

* update models to latest rippled

* fix minor issues

* fix bridge ledger_entry

* add XChainModifyBridge flag

* Update definitions.json

* add rbc tests for the new txs

* update validateXChainModifyBridge

* add validate methods to other xchain txs

* fix isXChainBridge

* fix isIssue typing

* fix model types

* update changelog

* switch prepare to prepublishOnly

* add docs

* fix AccountObjectsType filter

* export common types

* fix account_objects filter

* update LedgerEntry

* add sidechain faucet info

* add snippet

* improve snippet

* fix spacing issues

* update ledger_entry

* remove AMMDelete tests for now

* Update definitions.json

* fix unit tests

* convert createValidate script to JS
* remove unneeded linter ignores

* respond to comments

* more snippet fixes

* make validate functions more readable

* add getXChainClaimID method to parse metadata

* re-add linter rules

* clean up common

* fix getXChainClaimID test

* return undefined for failed tx

* test: add model tests for new sidechain transactions (#2059)

* add XChainAddAttestation tests, fix model

* add XChainClaim model tests

* add XChainCommit model tests, fix typo

* add XChainCreateBridge model tests

* add XChainCreateClaimID model tests

* add XChainModifyBridge tests

* update to most recent version of code

* remove XChainAddAttestationBatch tests

* add more validation tests

* switch createValidateTests to JS
  • Loading branch information
mvadari committed Sep 26, 2023
1 parent d7323a5 commit 91e7369
Show file tree
Hide file tree
Showing 50 changed files with 4,341 additions and 295 deletions.
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
{
"editor.tabSize": 2,
"cSpell.words": [
"altnet",
"Autofills",
"Clawback",
"hostid",
"keypair",
"keypairs",
"multisign",
"multisigned",
"multisigning",
"preauthorization",
"rippletest",
"secp256k1",
"Setf"
"Setf",
"Sidechains",
"xchain"
],
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand Down
2 changes: 2 additions & 0 deletions packages/ripple-binary-codec/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ripple-binary-codec Release History

## Unreleased
### Added
- Support for the XChainBridge amendment.

## 1.9.0 (2023-08-24)

Expand Down
249 changes: 248 additions & 1 deletion packages/ripple-binary-codec/src/enums/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"UInt384": 22,
"UInt512": 23,
"Issue": 24,
"XChainBridge": 25,
"Transaction": 10001,
"LedgerEntry": 10002,
"Validation": 10003,
Expand All @@ -35,8 +36,11 @@
"Ticket": 84,
"SignerList": 83,
"Offer": 111,
"Bridge": 105,
"LedgerHashes": 104,
"Amendments": 102,
"XChainOwnedClaimID": 113,
"XChainOwnedCreateAccountClaimID": 116,
"FeeSettings": 115,
"Escrow": 117,
"PayChannel": 120,
Expand Down Expand Up @@ -233,6 +237,16 @@
"type": "UInt8"
}
],
[
"WasLockingChainSend",
{
"nth": 19,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt8"
}
],
[
"LedgerEntryType",
{
Expand Down Expand Up @@ -983,6 +997,36 @@
"type": "UInt64"
}
],
[
"XChainClaimID",
{
"nth": 20,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt64"
}
],
[
"XChainAccountCreateCount",
{
"nth": 21,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt64"
}
],
[
"XChainAccountClaimCount",
{
"nth": 22,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "UInt64"
}
],
[
"EmailHash",
{
Expand Down Expand Up @@ -1583,6 +1627,26 @@
"type": "Amount"
}
],
[
"SignatureReward",
{
"nth": 29,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"MinAccountCreateAmount",
{
"nth": 30,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Amount"
}
],
[
"LPTokenBalance",
{
Expand Down Expand Up @@ -1933,6 +1997,66 @@
"type": "AccountID"
}
],
[
"OtherChainSource",
{
"nth": 18,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"OtherChainDestination",
{
"nth": 19,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"AttestationSignerAccount",
{
"nth": 20,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"AttestationRewardAccount",
{
"nth": 21,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"LockingChainDoor",
{
"nth": 22,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"IssuingChainDoor",
{
"nth": 23,
"isVLEncoded": true,
"isSerialized": true,
"isSigningField": true,
"type": "AccountID"
}
],
[
"Indexes",
{
Expand Down Expand Up @@ -1983,6 +2107,26 @@
"type": "PathSet"
}
],
[
"LockingChainIssue",
{
"nth": 1,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Issue"
}
],
[
"IssuingChainIssue",
{
"nth": 2,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "Issue"
}
],
[
"Asset",
{
Expand All @@ -2003,6 +2147,16 @@
"type": "Issue"
}
],
[
"XChainBridge",
{
"nth": 1,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "XChainBridge"
}
],
[
"TransactionMetaData",
{
Expand Down Expand Up @@ -2243,6 +2397,46 @@
"type": "STObject"
}
],
[
"XChainClaimProofSig",
{
"nth": 28,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"XChainCreateAccountProofSig",
{
"nth": 29,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"XChainClaimAttestationCollectionElement",
{
"nth": 30,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"XChainCreateAccountAttestationCollectionElement",
{
"nth": 31,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STObject"
}
],
[
"Signers",
{
Expand Down Expand Up @@ -2393,6 +2587,26 @@
"type": "STArray"
}
],
[
"XChainClaimAttestations",
{
"nth": 21,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STArray"
}
],
[
"XChainCreateAccountAttestations",
{
"nth": 22,
"isVLEncoded": false,
"isSerialized": true,
"isSigningField": true,
"type": "STArray"
}
],
[
"AuthAccounts",
{
Expand Down Expand Up @@ -2461,6 +2675,12 @@
"temSEQ_AND_TICKET": -263,
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
"temBAD_AMM_TOKENS": -261,
"temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
"temXCHAIN_BAD_PROOF": -259,
"temXCHAIN_BRIDGE_BAD_ISSUES": -258,
"temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
"temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,

"tefFAILURE": -199,
"tefALREADY": -198,
Expand Down Expand Up @@ -2497,6 +2717,7 @@
"terQUEUED": -89,
"terPRE_TICKET": -88,
"terNO_AMM": -87,
"terSUBMITTED": -86,

"tesSUCCESS": 0,

Expand Down Expand Up @@ -2538,6 +2759,7 @@
"tecKILLED": 150,
"tecHAS_OBLIGATIONS": 151,
"tecTOO_SOON": 152,
"tecHOOK_ERROR": 153,
"tecMAX_SEQUENCE_REACHED": 154,
"tecNO_SUITABLE_NFTOKEN_PAGE": 155,
"tecNFTOKEN_BUY_SELL_MISMATCH": 156,
Expand All @@ -2553,7 +2775,24 @@
"tecAMM_EMPTY": 166,
"tecAMM_NOT_EMPTY": 167,
"tecAMM_ACCOUNT": 168,
"tecINCOMPLETE": 169
"tecINCOMPLETE": 169,
"tecXCHAIN_BAD_TRANSFER_ISSUE": 170,
"tecXCHAIN_NO_CLAIM_ID": 171,
"tecXCHAIN_BAD_CLAIM_ID": 172,
"tecXCHAIN_CLAIM_NO_QUORUM": 173,
"tecXCHAIN_PROOF_UNKNOWN_KEY": 174,
"tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE": 175,
"tecXCHAIN_WRONG_CHAIN": 176,
"tecXCHAIN_REWARD_MISMATCH": 177,
"tecXCHAIN_NO_SIGNERS_LIST": 178,
"tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 179,
"tecXCHAIN_INSUFF_CREATE_AMOUNT": 180,
"tecXCHAIN_ACCOUNT_CREATE_PAST": 181,
"tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 182,
"tecXCHAIN_PAYMENT_FAILED": 183,
"tecXCHAIN_SELF_COMMIT": 184,
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 185,
"tecXCHAIN_CREATE_ACCOUNT_DISABLED": 186
},
"TRANSACTION_TYPES": {
"Invalid": -1,
Expand Down Expand Up @@ -2592,6 +2831,14 @@
"AMMVote": 38,
"AMMBid": 39,
"AMMDelete": 40,
"XChainCreateClaimID": 41,
"XChainCommit": 42,
"XChainClaim": 43,
"XChainAccountCreateCommit": 44,
"XChainAddClaimAttestation": 45,
"XChainAddAccountCreateAttestation": 46,
"XChainModifyBridge": 47,
"XChainCreateBridge": 48,
"EnableAmendment": 100,
"SetFee": 101,
"UNLModify": 102
Expand Down
Loading

0 comments on commit 91e7369

Please sign in to comment.