From 428247ddb44d73f6c4096a2585b7341da59811bd Mon Sep 17 00:00:00 2001 From: Phu Pham Date: Wed, 1 Jul 2026 16:35:01 -0400 Subject: [PATCH] adjust amendment retired/obsolete status --- public/locales/ca-CA/translations.json | 3 +- public/locales/en-US/translations.json | 3 +- public/locales/es-ES/translations.json | 3 +- public/locales/fr-FR/translations.json | 3 +- public/locales/ja-JP/translations.json | 3 +- public/locales/ko-KR/translations.json | 3 +- public/locales/my-MM/translations.json | 3 +- .../Amendment/test/mockVotingAmendment.json | 3 +- src/containers/Amendments/AmendmentsTable.tsx | 26 ++++++++--- .../Amendments/amendmentsTable.scss | 5 ++- .../Amendments/test/amendmentsTable.test.js | 44 +++++++++++++++++++ .../Amendments/test/mockAmendments.json | 12 +++-- .../Validators/test/mock_data/amendments.json | 12 +++-- src/containers/shared/vhsTypes.ts | 3 +- 14 files changed, 101 insertions(+), 25 deletions(-) diff --git a/public/locales/ca-CA/translations.json b/public/locales/ca-CA/translations.json index 0f97a1a6f..fb7e53131 100644 --- a/public/locales/ca-CA/translations.json +++ b/public/locales/ca-CA/translations.json @@ -370,7 +370,8 @@ "on_tx": "en la (tx)", "yes": "Sí", "no": "No", - "deprecated": "obsolet", + "retired": null, + "obsolete": null, "domain": "domini", "unl": "unl", "fee": "comissió", diff --git a/public/locales/en-US/translations.json b/public/locales/en-US/translations.json index bf49cd4b1..99aaef028 100644 --- a/public/locales/en-US/translations.json +++ b/public/locales/en-US/translations.json @@ -371,7 +371,8 @@ "on_tx": "on (tx)", "yes": "Yes", "no": "No", - "deprecated": "deprecated", + "retired": "retired", + "obsolete": "obsolete", "domain": "domain", "unl": "unl", "fee": "fee", diff --git a/public/locales/es-ES/translations.json b/public/locales/es-ES/translations.json index 2970d7e49..4c9b47b10 100644 --- a/public/locales/es-ES/translations.json +++ b/public/locales/es-ES/translations.json @@ -371,7 +371,8 @@ "on_tx": null, "yes": null, "no": null, - "deprecated": null, + "retired": null, + "obsolete": null, "domain": "dominio", "unl": "unl", "fee": "comisión", diff --git a/public/locales/fr-FR/translations.json b/public/locales/fr-FR/translations.json index f68c80ccb..5c5c9a171 100644 --- a/public/locales/fr-FR/translations.json +++ b/public/locales/fr-FR/translations.json @@ -371,7 +371,8 @@ "on_tx": null, "yes": null, "no": null, - "deprecated": null, + "retired": null, + "obsolete": null, "domain": "domaine", "unl": "unl", "fee": "frais", diff --git a/public/locales/ja-JP/translations.json b/public/locales/ja-JP/translations.json index 27359a32f..704d93496 100644 --- a/public/locales/ja-JP/translations.json +++ b/public/locales/ja-JP/translations.json @@ -371,7 +371,8 @@ "on_tx": null, "yes": "はい", "no": "いいえ", - "deprecated": "非推奨", + "retired": null, + "obsolete": null, "domain": "ドメイン", "unl": "unl", "fee": "手数料", diff --git a/public/locales/ko-KR/translations.json b/public/locales/ko-KR/translations.json index 33b9df6f0..f4c973009 100644 --- a/public/locales/ko-KR/translations.json +++ b/public/locales/ko-KR/translations.json @@ -371,7 +371,8 @@ "on_tx": null, "yes": null, "no": null, - "deprecated": null, + "retired": null, + "obsolete": null, "domain": "도메인", "unl": "unl", "fee": "수수료", diff --git a/public/locales/my-MM/translations.json b/public/locales/my-MM/translations.json index 5a597442e..f92c57ae2 100644 --- a/public/locales/my-MM/translations.json +++ b/public/locales/my-MM/translations.json @@ -371,7 +371,8 @@ "on_tx": "on (tx)", "yes": "Yes", "no": "No", - "deprecated": "မသုံးတော့", + "retired": null, + "obsolete": null, "domain": "domain", "unl": "unl", "fee": "အခကြေးငွေ", diff --git a/src/containers/Amendment/test/mockVotingAmendment.json b/src/containers/Amendment/test/mockVotingAmendment.json index d498725d2..743d616be 100644 --- a/src/containers/Amendment/test/mockVotingAmendment.json +++ b/src/containers/Amendment/test/mockVotingAmendment.json @@ -3,7 +3,8 @@ "id": "mock-amendment-id", "name": "mock-name", "rippled_version": "1.12.0", - "deprecated": false, + "retired": false, + "obsolete": false, "threshold": "3/4", "consensus": "25%", "voted": { diff --git a/src/containers/Amendments/AmendmentsTable.tsx b/src/containers/Amendments/AmendmentsTable.tsx index 455adb387..6372e5d2b 100644 --- a/src/containers/Amendments/AmendmentsTable.tsx +++ b/src/containers/Amendments/AmendmentsTable.tsx @@ -69,15 +69,21 @@ export const AmendmentsTable: FC<{ return DEFAULT_EMPTY_VALUE } - const renderName = (name: string, id: string, deprecated: boolean) => - deprecated ? ( -
+ const renderName = ( + name: string, + id: string, + retired: boolean, + obsolete: boolean, + ) => + retired || obsolete ? ( +
{name} - {t('deprecated')} + {retired && {t('retired')}} + {obsolete && {t('obsolete')}}
) : ( @@ -112,7 +118,12 @@ export const AmendmentsTable: FC<{ {amendment.id} - {renderName(amendment.name, amendment.id, amendment.deprecated)} + {renderName( + amendment.name, + amendment.id, + amendment.retired, + amendment.obsolete, + )} {getVoter(amendment.voted)} @@ -122,7 +133,10 @@ export const AmendmentsTable: FC<{ {amendment.consensus ?? DEFAULT_EMPTY_VALUE} - {renderEnabled(!amendment.deprecated && amendment.voted === undefined)} + {/* Retired amendments have been enabled for 2+ years and are baked into + the protocol, so they are enabled. Obsolete amendments were never + passed, so they are not. */} + {renderEnabled(!amendment.obsolete && amendment.voted === undefined)} {renderOnTx(amendment)} diff --git a/src/containers/Amendments/amendmentsTable.scss b/src/containers/Amendments/amendmentsTable.scss index 1c14d683a..914227866 100644 --- a/src/containers/Amendments/amendmentsTable.scss +++ b/src/containers/Amendments/amendmentsTable.scss @@ -68,7 +68,7 @@ } } - .name-deprecated { + .name-with-badge { display: flex; overflow: hidden; align-items: center; @@ -85,7 +85,8 @@ text-overflow: ellipsis; } - .deprecated { + .retired, + .obsolete { overflow: hidden; max-width: 60%; font-size: 12px; diff --git a/src/containers/Amendments/test/amendmentsTable.test.js b/src/containers/Amendments/test/amendmentsTable.test.js index b31f6cbe7..0f5a2b699 100644 --- a/src/containers/Amendments/test/amendmentsTable.test.js +++ b/src/containers/Amendments/test/amendmentsTable.test.js @@ -28,4 +28,48 @@ describe('Amendments table', () => { amendmentsRaw.amendments.length + 1, ) }) + + it('renders a retired badge and marks retired amendments as enabled', () => { + const { container } = renderAmendmentsTable({ + amendments: [ + { + id: 'RETIRED_ID', + name: 'RetiredAmendment', + rippled_version: '1.10.0', + retired: true, + obsolete: false, + date: null, + }, + ], + }) + const badge = container.querySelector('.name .retired.badge') + expect(badge).not.toBeNull() + expect(badge.textContent).toBe('retired') + expect(container.querySelector('.name .obsolete.badge')).toBeNull() + // Retired amendments are baked into the protocol, so they are enabled. + expect(container.querySelector('.enabled .badge').className).toContain( + 'yes', + ) + }) + + it('renders an obsolete badge and marks obsolete amendments as not enabled', () => { + const { container } = renderAmendmentsTable({ + amendments: [ + { + id: 'OBSOLETE_ID', + name: 'ObsoleteAmendment', + rippled_version: '1.10.0', + retired: false, + obsolete: true, + date: null, + }, + ], + }) + const badge = container.querySelector('.name .obsolete.badge') + expect(badge).not.toBeNull() + expect(badge.textContent).toBe('obsolete') + expect(container.querySelector('.name .retired.badge')).toBeNull() + // Obsolete amendments were never passed, so they are not enabled. + expect(container.querySelector('.enabled .badge').className).toContain('no') + }) }) diff --git a/src/containers/Amendments/test/mockAmendments.json b/src/containers/Amendments/test/mockAmendments.json index 959078694..3fd073a9a 100644 --- a/src/containers/Amendments/test/mockAmendments.json +++ b/src/containers/Amendments/test/mockAmendments.json @@ -7,7 +7,8 @@ "date": "2023-08-21T05:59:11.000Z", "name": "fixUniversalNumber", "rippled_version": "1.10.0", - "deprecated": false + "retired": false, + "obsolete": false }, { "id": "75A7E01C505DD5A179DFE3E000A9B6F1EDDEB55A12F95579A23E15B15DC8BE5A", @@ -16,13 +17,15 @@ "date": "2023-08-21T05:59:11.000Z", "name": "ImmediateOfferKilled", "rippled_version": "1.10.0", - "deprecated": false + "retired": false, + "obsolete": false }, { "id": "8CC0774A3BF66D1D22E76BBDA8E8A232E6B6313834301B3B23E8601196AE6455", "name": "AMM", "rippled_version": "1.12.0", - "deprecated": false, + "retired": false, + "obsolete": false, "threshold": "28/35", "consensus": "2.86%", "voted": { @@ -85,7 +88,8 @@ "id": "56B241D7A43D40354D02A9DC4C8DF5C7A1F930D92A9035C4E12291B3CA3E1C2B", "name": "Clawback", "rippled_version": "1.12.0", - "deprecated": false, + "retired": false, + "obsolete": false, "threshold": "28/35", "consensus": "11.43%", "voted": { diff --git a/src/containers/Validators/test/mock_data/amendments.json b/src/containers/Validators/test/mock_data/amendments.json index 6fe9a71d2..0398766c7 100644 --- a/src/containers/Validators/test/mock_data/amendments.json +++ b/src/containers/Validators/test/mock_data/amendments.json @@ -7,7 +7,8 @@ "date": "2023-08-21T05:59:11.000Z", "name": "fixUniversalNumber", "rippled_version": "1.10.0", - "deprecated": false + "retired": false, + "obsolete": false }, { "id": "75A7E01C505DD5A179DFE3E000A9B6F1EDDEB55A12F95579A23E15B15DC8BE5A", @@ -16,13 +17,15 @@ "date": "2023-08-21T05:59:11.000Z", "name": "ImmediateOfferKilled", "rippled_version": "1.10.0", - "deprecated": false + "retired": false, + "obsolete": false }, { "id": "8CC0774A3BF66D1D22E76BBDA8E8A232E6B6313834301B3B23E8601196AE6455", "name": "AMM", "rippled_version": "1.12.0", - "deprecated": false, + "retired": false, + "obsolete": false, "voted": { "count": 6, "validators": [ @@ -57,7 +60,8 @@ "id": "56B241D7A43D40354D02A9DC4C8DF5C7A1F930D92A9035C4E12291B3CA3E1C2B", "name": "Clawback", "rippled_version": "1.12.0", - "deprecated": false, + "retired": false, + "obsolete": false, "voted": { "count": 15, "validators": [ diff --git a/src/containers/shared/vhsTypes.ts b/src/containers/shared/vhsTypes.ts index e2b37f0f4..0026696a3 100644 --- a/src/containers/shared/vhsTypes.ts +++ b/src/containers/shared/vhsTypes.ts @@ -118,7 +118,8 @@ export interface AmendmentData { name: string threshold?: string consensus?: string - deprecated: boolean + retired: boolean + obsolete: boolean date: string | null tx_hash?: string ledger_index?: number