From b7824ddf94780b4d0852a0c7a2fa999622d9164b Mon Sep 17 00:00:00 2001 From: J-Dog Date: Sat, 17 Oct 2026 13:55:43 -0700 Subject: [PATCH 1/2] test: add validator wire action conformance Compare encoder validator action names, formats, and corpus verdicts against the indexer consensus copy. --- ...validator_wire_actions_conformance.test.js | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 test/unit/protocol/validator_wire_actions_conformance.test.js diff --git a/test/unit/protocol/validator_wire_actions_conformance.test.js b/test/unit/protocol/validator_wire_actions_conformance.test.js new file mode 100644 index 0000000..0b91975 --- /dev/null +++ b/test/unit/protocol/validator_wire_actions_conformance.test.js @@ -0,0 +1,67 @@ +// Copyright © 2025–2026 Dankest, LLC +// Based on XChain Platform by Dankest, LLC – https://dankest.llc +// +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This file is part of XChain Platform. Licensed under the GNU Affero +// General Public License v3.0 or later; see LICENSE.md. A commercial +// license (without AGPL source-disclosure terms) is available - +// contact legal@dankest.llc. + +'use strict'; + +const assert = require('assert'); +const path = require('path'); +const local = require('../../../src/protocol/validator_wire_actions.js'); +const { siblingCheckout, skipOrFail } = require('../../helpers/sibling_checkout.js'); + +const INDEXER_DIR = process.env.XCHAIN_INDEXER_DIR || path.join(__dirname, '../../../../xchain-indexer'); +const CANON = path.join(INDEXER_DIR, 'src', 'consensus', 'gates', 'validator_wire_actions.js'); + +function corpusNames(canon) { + const names = new Set([...Object.keys(canon.VALIDATOR_WIRE_FORMATS), ...Object.keys(local.VALIDATOR_WIRE_FORMATS)]); + for (const n of ['STAKE', 'UNSTAKE', 'DELEGATE', 'SLASH', 'SEND', 'toString', '__proto__']) names.add(n); + return [...names]; +} + +const FORMATS = [undefined, '', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '"1"', "'0'", ' 3 ', + '01', '255', '256', '-1', '1.0', '0x1', 'x']; + +function corpus(canon) { + const out = ['', '|', 'ANCHOR|', '|0', null, undefined, 7, {}]; + for (const name of corpusNames(canon)) { + for (const spelled of [name, name.toLowerCase(), ' ' + name + ' ']) { + for (const f of FORMATS) out.push(f === undefined ? spelled : spelled + '|' + f + '|x'); + } + } + return out; +} + +describe('validator wire actions conformance with the indexer consensus copy @regression', function () { + before(function () { + const indexer = siblingCheckout(__dirname, CANON); + if (!indexer.usable) + skipOrFail(this, indexer, 'the prelaunch validator wire-format conformance guard'); + }); + + it('lists the same names and formats as xchain-indexer', function () { + const canon = require(CANON); + assert.deepStrictEqual(local.VALIDATOR_WIRE_FORMATS, canon.VALIDATOR_WIRE_FORMATS, + 'the encoder validator wire set drifted from xchain-indexer src/consensus/gates/validator_wire_actions.js'); + assert.strictEqual(local.ATTEST_BATCH_HEAD_VERSION, canon.ATTEST_BATCH_HEAD_VERSION); + assert.strictEqual(local.ATTEST_BATCH_CONTINUATION_VERSION, canon.ATTEST_BATCH_CONTINUATION_VERSION); + }); + + it('returns the indexer verdict on every corpus input', function () { + const canon = require(CANON); + const inputs = corpus(canon); + let admitted = 0; + for (const data of inputs) { + const expected = canon.isValidatorWireAction(data); + assert.strictEqual(local.isValidatorWireAction(data), expected, + 'encoder and indexer disagree on ' + JSON.stringify(data)); + if (expected) admitted++; + } + assert.ok(admitted > 0 && admitted < inputs.length, 'corpus admitted ' + admitted + ' of ' + inputs.length); + }); +}); From f3ea4631bc47a87223caca852c06387aaeee0fde Mon Sep 17 00:00:00 2001 From: J-Dog Date: Sun, 18 Oct 2026 13:37:58 -0700 Subject: [PATCH 2/2] Release v0.25.0 --- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a522ee3..8912d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.25.0] - 2026-10-18 + +### Changed +- Added validator wire action conformance tests, with no runtime change. + ## [0.24.0] - 2026-10-17 ### Added diff --git a/package-lock.json b/package-lock.json index dd3902f..8d8a9b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "xchain-encoder", - "version": "0.24.0", + "version": "0.25.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "xchain-encoder", - "version": "0.24.0", + "version": "0.25.0", "license": "AGPL-3.0-or-later", "dependencies": { "axios": "^1.20.0", diff --git a/package.json b/package.json index 21eebbd..4b292ec 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "xchain-encoder", "description": "xchain-encoder encodes XChain Platform ACTION commands into blockchain transactions.", - "version": "0.24.0", + "version": "0.25.0", "license": "AGPL-3.0-or-later", "repository": { "type": "git",