From 5b52ae8605f1b88ffd2ebc8970d478a79c7bf1fd Mon Sep 17 00:00:00 2001 From: amarantha-k Date: Thu, 17 Oct 2024 12:59:51 -0700 Subject: [PATCH 1/3] Add ledgerstatefix txn reference and disclaimer --- docs/index.md | 3 ++ docs/ledger-state-fix/index.md | 68 ++++++++++++++++++++++++++ index.page.tsx | 25 ++++++++++ sidebars.yaml | 3 ++ snippets/_ledgerstatefix-disclaimer.md | 4 ++ 5 files changed, 103 insertions(+) create mode 100644 docs/ledger-state-fix/index.md create mode 100644 snippets/_ledgerstatefix-disclaimer.md diff --git a/docs/index.md b/docs/index.md index 074fb1b5..93ce6533 100644 --- a/docs/index.md +++ b/docs/index.md @@ -25,3 +25,6 @@ To learn more about the consensus process and the workflow for features to go fr - [XLS-56d Batch Transactions](xls-56d-batch-transactions/index.md) - [Reference](xls-56d-batch-transactions/reference/reference.md) + +### LedgerStateFix +- [LedgerStateFix](ledger-state-fix/index.md) \ No newline at end of file diff --git a/docs/ledger-state-fix/index.md b/docs/ledger-state-fix/index.md new file mode 100644 index 00000000..c440afd5 --- /dev/null +++ b/docs/ledger-state-fix/index.md @@ -0,0 +1,68 @@ +--- +seo: + description: Repair corruptions to the XRP ledger. +labels: + - Utilities, troubleshooting +--- +# LedgerStateFix +[[Source]](https://github.com/XRPLF/rippled/blob/develop/src/xrpld/app/tx/detail/LedgerStateFix.cpp "Source") + +{% partial file="/snippets/_ledgerstatefix-disclaimer.md" /%} + +`LedgerStateFix` is a general purpose transaction used to fix specific issues affecting the XRP ledger. You submit the transaction with the `LedgerFixType` value set to indicate the particular error state to correct. + +_(Added by the [fixNFTokenPageLinks amendment][].)_ + +## Example LedgerStateFix JSON + +```json +{ + "Account" : "", + "Fee" : "2000000", + "LedgerFixType" : 1, + "Owner" : ", + "SigningPubKey" : "", + "TransactionType" : "LedgerStateFix", + "TxnSignature" : "", +} +``` + + +| Field | Data Type | Required? | Description | +|:------|:-----------|:----------|:------------| +| `TransactionType` | uint16 | Required | Identifies this as a `LedgerStateFix` transaction. | +| `Account` | STAccount | Required | Identifies the account signing and submitting the transaction as well as paying the Fee. | +| `Fee` | STAmount | Required | This transaction is rare and potentially compute intensive. The minimum fee is the same as the fee for an AccountDelete transaction. If the transaction fails with a tec code, the fee is still charged. | +| `Flags` | uint32 | Optional | Not needed for `LedgerFixType` == _1_. Reserved for a future type of ledger fix. | +| `LedgerFixType` | uint16 | Required | Currently the only type is _1_, which fixes the NFToken directory for a single account. | +| `Owner` | STAccount | Optional | Required if `LedgerFixType` == _1_, the account ID that owns the NFToken directory that needs fixing. Need not have any relationship to Account. | + +## LedgerStateFix Flags + +Transactions of the LedgerStateFix type can support additional values in the `Flags` field. Currently, there are no flags defined. A future `LedgerFixType` might require flag settings. + +## Error Cases + +Potential errors are those that can occur for all transactions. {% $frontmatter.seo.title %}. + +## LedgerStateFix Types + +`LedgerStateFix` might sound like a general panacea for all your ledger's ills, but in practice it is a targeted solution for very rare, known, and specific issues. + +### Type 1 + +There are two different transactions that introduced corruptions to NFT directories. In both cases, the following conditions were met: + +- There were at least two NFToken pages in the directory. +- The next-to-last page was completely full, holding 32 NFTokens. +- The very last page of the directory contained only one NFToken. +- The transaction removed the last remaining token from the last page. + +When these conditions were met, the last NFToken page was removed and the next-to-last page was left as the final page in the directory. + +That would be fine, except the NFToken directory has an expectation that the last page has a specific index. The page with that index was just deleted. When an NFToken is added to the directory, and that token has a high enough value that it doesn't belong on the current last page, then a new last page is created that has no links to the previous page, creating a hole in the middle of the list. + +The `fixNFTokenPageLinks` amendment modifies the NFToken page, coalescing code to notice when the very last page of the directory would be removed. In that case, it moves all of the contents of the next lower page into the last page and deletes the next-to-last page. It then fixes up the links. + +New invariant checks also validate aspects of the links on pages, so a similar corruption returns a tecINVARIANT_FAILED transaction result. That will prevent this specific type of corruption going forward. \ No newline at end of file diff --git a/index.page.tsx b/index.page.tsx index b1e4d2c8..50212b32 100644 --- a/index.page.tsx +++ b/index.page.tsx @@ -83,6 +83,31 @@ export default function Page() { + + + A general purpose transaction used to fix specific + issues affecting the XRP ledger. + +
+ +
+
diff --git a/sidebars.yaml b/sidebars.yaml index 0da9bb6d..0176c4d0 100644 --- a/sidebars.yaml +++ b/sidebars.yaml @@ -48,3 +48,6 @@ items: - page: docs/xls-56d-batch-transactions/reference/batch.md - page: docs/xls-56d-batch-transactions/reference/common-fields.md + - group: LedgerStateFix + page: docs/ledger-state-fix/index.md + expanded: false \ No newline at end of file diff --git a/snippets/_ledgerstatefix-disclaimer.md b/snippets/_ledgerstatefix-disclaimer.md new file mode 100644 index 00000000..2ba70ad2 --- /dev/null +++ b/snippets/_ledgerstatefix-disclaimer.md @@ -0,0 +1,4 @@ +{% admonition type="info" name="Attention" %} + +_LedgerStateFix is part of the proposed [fixNFTokenPageLinks](https://github.com/XRPLF/rippled/pull/4945) extension to the XRP Ledger protocol. You can test the transaction on test networks for now, but there isn't an official amendment and the feature is not available on the production Mainnet yet. Until there is an amendment in a stable release, the details documented on these pages are subject to change frequently._ +{% /admonition %} \ No newline at end of file From b89a6c96c14707feae9d233288a062d1e8cc7b0e Mon Sep 17 00:00:00 2001 From: amarantha-k Date: Thu, 17 Oct 2024 13:14:30 -0700 Subject: [PATCH 2/3] Move tile to next line --- index.page.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/index.page.tsx b/index.page.tsx index 50212b32..2d2d4874 100644 --- a/index.page.tsx +++ b/index.page.tsx @@ -83,7 +83,17 @@ export default function Page() { - + + + + - + ); } \ No newline at end of file From 76cff4cf4b973f22c2510c5d398c2d53c7066030 Mon Sep 17 00:00:00 2001 From: Dennis Dawson Date: Thu, 17 Oct 2024 13:34:41 -0700 Subject: [PATCH 3/3] Add the correct link to the amendment info. --- docs/ledger-state-fix/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ledger-state-fix/index.md b/docs/ledger-state-fix/index.md index c440afd5..1081a8e9 100644 --- a/docs/ledger-state-fix/index.md +++ b/docs/ledger-state-fix/index.md @@ -11,7 +11,7 @@ labels: `LedgerStateFix` is a general purpose transaction used to fix specific issues affecting the XRP ledger. You submit the transaction with the `LedgerFixType` value set to indicate the particular error state to correct. -_(Added by the [fixNFTokenPageLinks amendment][].)_ +_(Added by the [NonFungibleTokensV1_1](https://xrpl.org/resources/known-amendments#nonfungibletokensv1_1) amendment. ## Example LedgerStateFix JSON @@ -65,4 +65,4 @@ That would be fine, except the NFToken directory has an expectation that the las The `fixNFTokenPageLinks` amendment modifies the NFToken page, coalescing code to notice when the very last page of the directory would be removed. In that case, it moves all of the contents of the next lower page into the last page and deletes the next-to-last page. It then fixes up the links. -New invariant checks also validate aspects of the links on pages, so a similar corruption returns a tecINVARIANT_FAILED transaction result. That will prevent this specific type of corruption going forward. \ No newline at end of file +New invariant checks also validate aspects of the links on pages, so a similar corruption returns a tecINVARIANT_FAILED transaction result. That will prevent this specific type of corruption going forward.