From 8dff7e99efe71bcca555e0b9a145c4b08a6aad91 Mon Sep 17 00:00:00 2001 From: ktechmidas <9920871+ktechmidas@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:50:41 +0300 Subject: [PATCH 1/2] feat(deploy): devnet upgrades start at four nodes at once Both upgrade forms defaulted to one node at a time, so every rollout was serial unless the operator changed it; no operation has yet run with more. A devnet is owned outright and disposable: its forms now start at four. The engine still trims a batch to what the observed quorum can spare. Testnet and every other network keep the serial default, and an API request that omits the policy is unchanged. Co-Authored-By: Claude Fable 5.2 --- docs/rollout-options.md | 4 ++++ src/pages/Deploy.jsx | 6 ++++-- src/pages/Network.jsx | 4 ++-- src/releases.js | 6 ++++++ src/releases.test.js | 8 +++++++- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/docs/rollout-options.md b/docs/rollout-options.md index 3eca36b..fcd7495 100644 --- a/docs/rollout-options.md +++ b/docs/rollout-options.md @@ -6,6 +6,10 @@ toggle. The toggle stages a policy; it does not stop anything while editing or reviewing a plan. Review shows the plan-bound maximum and exact mining hosts. Mining automatically resumes on success, failure and cancellation. +The forms start at four nodes at once on a devnet and at one (serial) on +Testnet; either can be changed before the plan is prepared. An API request +that omits the policy keeps the old serial behavior. + Legacy Testnet controls the two discovered, tagged, instance-pinned `miner-1` and `miner-2` services. Native devnets use the mining host in their deployment plan; Core handles it last, on its own. An unsafe validator batch is reduced to diff --git a/src/pages/Deploy.jsx b/src/pages/Deploy.jsx index 2a59913..d8ec0ce 100644 --- a/src/pages/Deploy.jsx +++ b/src/pages/Deploy.jsx @@ -2,7 +2,7 @@ import RolloutOptions from '../RolloutOptions.jsx'; import { useEffect, useMemo, useState } from 'react'; import { api, canOperate, navigate, useResource, useSession, ROLE_LABEL, ago } from '../lib.js'; import { Dot, Empty, Err, Link, Section } from '../ui.jsx'; -import { COMPONENTS, OPERABLE, REPOS, cmp, helperFor, imageTag, newestRelease, reported } from '../releases.js'; +import { COMPONENTS, OPERABLE, REPOS, cmp, defaultConcurrency, helperFor, imageTag, newestRelease, reported } from '../releases.js'; // Plain-language actions; the dashnet command runs underneath (shown in the header). const ACTIONS = [ @@ -22,7 +22,9 @@ export default function Deploy({ name }) { const [picked, setPicked] = useState(params.get('nodes') ? new Set(params.get('nodes').split(',').filter(Boolean)) : null); const [components, setComponents] = useState(new Set(params.get('components')?.split(',').filter(Boolean) || [])); const [images, setImages] = useState({}); - const [concurrency, setConcurrency] = useState(1); + // No explicit choice yet means the network's default, known once it loads. + const [chosenConcurrency, setConcurrency] = useState(null); + const concurrency = chosenConcurrency ?? defaultConcurrency(n); const [pauseMining, setPauseMining] = useState(false); const [window, setWindow] = useState(''); const [timeout, setTimeoutValue] = useState(''); diff --git a/src/pages/Network.jsx b/src/pages/Network.jsx index 30f1a5d..b894c67 100644 --- a/src/pages/Network.jsx +++ b/src/pages/Network.jsx @@ -3,7 +3,7 @@ import { Fragment, useEffect, useMemo, useState } from 'react'; import { ago, api, bytes, canOperate, canSee, clock, dash, duration, navigate, num, short, span, useNow, useResource, useSession, ROLE_LABEL } from '../lib.js'; import { Delta, Dot, Empty, EndpointDot, Err, Level, Link, Meter, Section, Stat } from '../ui.jsx'; import Operations from './Operations.jsx'; -import { cmp, COMPONENTS, helperFor, imageTag, newestRelease, OPERABLE, reported, REPOS } from '../releases.js'; +import { cmp, COMPONENTS, defaultConcurrency, helperFor, imageTag, newestRelease, OPERABLE, reported, REPOS } from '../releases.js'; import Connect from './Connect.jsx'; const ROLE_ORDER = ['validator', 'masternode', 'seed', 'fullnode', 'web', 'wallet', 'miner', 'mixer', 'quorums', 'metrics', 'logs', 'vpn', 'other']; @@ -420,7 +420,7 @@ function Updates({ n }) { const [state, setState] = useState({ network: null, updates: [] }); const [error, setError] = useState(null); const [busy, setBusy] = useState(false); - const [concurrency, setConcurrency] = useState(1); + const [concurrency, setConcurrency] = useState(() => defaultConcurrency(n)); const [pauseMining, setPauseMining] = useState(false); const native = n.kind === 'dashnet'; const hosts = n.hosts.filter((h) => OPERABLE.includes(h.role) && !h.duplicate && h.state === 'running' && h.level !== 'unreachable'); diff --git a/src/releases.js b/src/releases.js index 26df57a..9b8f6c2 100644 --- a/src/releases.js +++ b/src/releases.js @@ -2,6 +2,12 @@ export const COMPONENTS = ['core', 'drive', 'tenderdash', 'dapi', 'gateway', 'helper']; export const REPOS = { core: 'dashpay/dashd', drive: 'dashpay/drive', tenderdash: 'dashpay/tenderdash', dapi: 'dashpay/rs-dapi', gateway: 'dashpay/envoy', helper: 'dashpay/dashmate-helper' }; export const OPERABLE = ['validator', 'masternode', 'seed']; + +// Nodes replaced together unless the operator chooses otherwise. A devnet is +// owned outright and disposable, so it starts at several; the engine still +// trims any batch to what the observed quorum can spare. Testnet stays serial. +export const DEVNET_CONCURRENCY = 4; +export const defaultConcurrency = (network) => (network?.chainType === 'devnet' ? DEVNET_CONCURRENCY : 1); // Running release per component, from what the nodes report. const SEMVER = /^v?(\d+)\.(\d+)\.(\d+)(?:-([a-z]+)\.(\d+))?$/; export function reported(h, c) { diff --git a/src/releases.test.js b/src/releases.test.js index cd53a4c..0868831 100644 --- a/src/releases.test.js +++ b/src/releases.test.js @@ -1,6 +1,12 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import { newestRelease, reported } from './releases.js'; +import { defaultConcurrency, newestRelease, reported } from './releases.js'; + +test('a devnet rolls several nodes at once by default; every other network stays serial', () => { + assert.equal(defaultConcurrency({ chainType: 'devnet', kind: 'dashnet' }), 4); + assert.equal(defaultConcurrency({ chainType: 'devnet' }), 4); + for (const network of [{ chainType: 'testnet' }, { chainType: 'mainnet' }, {}, null, undefined]) assert.equal(defaultConcurrency(network), 1); +}); const tags = (...names) => names.map((name) => ({ name })); From 52086524a4510d3f4e432ece39bbc216aaf47bb8 Mon Sep 17 00:00:00 2001 From: ktechmidas <9920871+ktechmidas@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:50:41 +0300 Subject: [PATCH 2/2] feat(devnets): adopt a newer dashnet that accepts the devnet's recipes A devnet moves to a newer dashnet only when the build reports the same node and bootstrap recipes as the devnet's plans. The engine also operates the immediately preceding node and upgrade recipes, but the console could not know that, so a devnet created before the last recipe change never adopted a newer build and its binary had to be copied by hand. `dashnet recipes` now lists the earlier recipes a build accepts (nodeAccepts, upgradeAccepts; dashpay/dash-network-go#36). Adoption, and the move to a newer build on resume, honour those lists. A build that predates the fields lists none, so the exact-match rule is unchanged for it. The bootstrap and mining recipes must still be the same, and a build is still adopted only when strictly newer. Co-Authored-By: Claude Fable 5.2 --- agent/agent.test.js | 30 ++++++++++++++++++++++++++++++ agent/devnets.js | 26 +++++++++++++++++++------- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/agent/agent.test.js b/agent/agent.test.js index 0de9c9b..25cc5e1 100644 --- a/agent/agent.test.js +++ b/agent/agent.test.js @@ -424,6 +424,32 @@ test('a devnet moves to a newer dashnet only when its plans bind the same node a writeFileSync(join(root, 'current'), fake(V('20260927T000000Z', 'd'), 'n1'), { mode: 0o755 }); await d.doctor(r).catch(() => {}); assert.match(readFileSync(join(dir, 'dashnet'), 'utf8'), /20260928T120000Z/, 'no downgrade'); + // A newer build on another node recipe that lists this devnet's as accepted + // operates its plans: adopt it. The bootstrap recipe must still be the same. + const accepting = (version, bootstrap) => `#!/bin/sh\ncase "$1" in version) echo ${version};; recipes) echo '{"node":"n2","nodeAccepts":"n0,n1","bootstrap":"${bootstrap}"}';; upgrade-plan) echo 'or core (Core only, every node)' >&2;; *) exit 0;; esac\n`; + writeFileSync(join(root, 'current'), accepting(V('20260930T000000Z', 'e'), 'other'), { mode: 0o755 }); + await d.doctor(r).catch(() => {}); + assert.match(readFileSync(join(dir, 'dashnet'), 'utf8'), /20260928T120000Z/, 'another bootstrap recipe not adopted'); + writeFileSync(join(root, 'current'), accepting(V('20260930T000000Z', 'e'), 'b'), { mode: 0o755 }); + await d.doctor(r).catch(() => {}); + assert.match(readFileSync(join(dir, 'dashnet'), 'utf8'), /20260930T000000Z/, 'accepting newer binary adopted'); + assert.ok(logs.some((l) => /accepts this devnet's node recipe/.test(l))); + assert.match(JSON.parse(readFileSync(join(root, 'devnets.json'), 'utf8'))['devnet-x'].dashnet, /^20260930T000000Z/); +}); + +test('a recipe is accepted when it is the build\'s own or one the build lists', async () => { + const { recipeAccepted } = await import('./devnets.js'); + const rec = { node: 'n2', nodeAccepts: 'n0,n1', upgrade: 'u2', upgradeAccepts: '' }; + assert.equal(recipeAccepted(rec, 'node', 'n2'), true); + assert.equal(recipeAccepted(rec, 'node', 'n1'), true); + assert.equal(recipeAccepted(rec, 'node', 'n3'), false); + assert.equal(recipeAccepted(rec, 'upgrade', 'u2'), true); + // An empty list accepts nothing, and neither does a missing or malformed one. + for (const digest of ['u1', '', undefined, null]) assert.equal(recipeAccepted(rec, 'upgrade', digest), false); + assert.equal(recipeAccepted({ node: 'n2' }, 'node', 'n1'), false); + assert.equal(recipeAccepted({ node: 'n2', nodeAccepts: ['n1'] }, 'node', 'n1'), false); + assert.equal(recipeAccepted({ node: 'n2', nodeAccepts: 'n1' }, 'node', 'n'), false); + assert.equal(recipeAccepted(null, 'node', 'n1'), false); }); test('a resumed upgrade moves to a newer dashnet only when the reviewed plan still accepts it', async () => { @@ -452,6 +478,10 @@ test('a resumed upgrade moves to a newer dashnet only when the reviewed plan sti writeFileSync(binary, fake(V('20260929T000000Z', 'b'), 'u1'), { mode: 0o755 }); await d.executeUpgrade(r()); assert.match(used.pop(), /20260929T000000Z/); + // A still newer build on another upgrade recipe that lists the plan's as accepted. + writeFileSync(binary, `#!/bin/sh\ncase "$1" in version) echo ${V('20260930T000000Z', 'c')};; recipes) echo '{"node":"n1","bootstrap":"b","upgrade":"u3","upgradeAccepts":"u1"}';; *) exit 0;; esac\n`, { mode: 0o755 }); + await d.executeUpgrade(r()); + assert.match(used.pop(), /20260930T000000Z/); }); test('service images are prebuilt on the wallet host without the chain, best effort', async () => { diff --git a/agent/devnets.js b/agent/devnets.js index 767b989..6f431c4 100644 --- a/agent/devnets.js +++ b/agent/devnets.js @@ -38,6 +38,16 @@ export { shortName }; // dash-network-go devnets whose services each release's dashmate renders; the // helper image is then that dashmate, and Platform upgrades re-render with it. export const DASHMATE_PROFILE = 'devnet-dashmate-compose'; + +// A build operates plans that bind its own recipe, and any earlier recipe it +// lists as accepted (`dashnet recipes`: nodeAccepts, upgradeAccepts, comma- +// separated). The rule is the engine's; a build that predates those fields +// lists none, and then only the same recipe is compatible. +export function recipeAccepted(recipes, kind, digest) { + if (recipes?.[kind] === digest) return true; + const accepted = recipes?.[`${kind}Accepts`]; + return typeof digest === 'string' && digest !== '' && typeof accepted === 'string' && accepted.split(',').includes(digest); +} // The images a devnet runs now: its network file after any upgrade. export function imagesOf(yaml) { const out = {}; @@ -173,39 +183,41 @@ export function createDevnets({ ctx, dirs, key, pool, getSettings, region, log = return /or core \(Core only/.test(`${p.stdout}${p.stderr}`) ? ['platform', 'tenderdash', 'core'] : ['platform', 'tenderdash']; } // An upgrade runs with the binary that planned it, but a resume may move to a - // strictly newer build whose recipes the plans still accept (same upgrade - // and node recipes), e.g. to pick up a runner fix. + // strictly newer build whose recipes the plans still accept (the same upgrade + // and node recipes, or ones that build lists as accepted), e.g. to pick up a + // runner fix. function refreshSnapshot(r, dir, plan) { const dep = readJSON(join(dir, 'deployment.json')); if (!binary || !existsSync(binary) || !r.artifacts.bin || !dep) return; const p = spawnSync(binary, ['recipes'], { encoding: 'utf8', timeout: 10_000 }); let rec; try { rec = JSON.parse(p.stdout); } catch { return; } - if (rec.upgrade !== plan.recipeSha256 || rec.node !== dep.recipeSha256 || (plan.rollout?.miningRecipe && rec.mining !== plan.rollout.miningRecipe)) return; + if (!recipeAccepted(rec, 'upgrade', plan.recipeSha256) || !recipeAccepted(rec, 'node', dep.recipeSha256) || (plan.rollout?.miningRecipe && rec.mining !== plan.rollout.miningRecipe)) return; const [was, now] = [versionOf(r.artifacts.bin), versionOf(binary)]; if (!dated(now) || (dated(was) && dated(was) >= dated(now))) return; copyFileSync(binary, `${r.artifacts.bin}.next`); chmodSync(`${r.artifacts.bin}.next`, 0o700); renameSync(`${r.artifacts.bin}.next`, r.artifacts.bin); - write(r.id, `resuming with dashnet ${now.slice(0, 16)} (same upgrade and node recipes as the reviewed plan)`); + write(r.id, `resuming with dashnet ${now.slice(0, 16)} (${rec.upgrade === plan.recipeSha256 && rec.node === dep.recipeSha256 ? 'same upgrade and node recipes as' : 'accepts the upgrade and node recipes of'} the reviewed plan)`); } const versionOf = (bin) => spawnSync(bin, ['version'], { encoding: 'utf8', timeout: 10_000 }).stdout.trim(); const dated = (v) => /^(\d{8}T\d{6}Z)-[0-9a-f]{40}$/.exec(v || '')?.[1]; // A devnet is pinned to the dashnet that created it: its plans bind that // binary's recipes. A newer binary reporting the same node and bootstrap - // recipes (dashnet recipes) can operate it, so fixes reach existing devnets. + // recipes (dashnet recipes), or listing the devnet's node recipe as one it + // accepts, can operate it, so fixes reach existing devnets. function adoptCompatible(r, name) { const dir = join(dirs.private, 'devnets', name), pinned = join(dir, 'dashnet'); const dep = readJSON(join(dir, 'deployment.json')), boot = readJSON(join(dir, 'bootstrap-plan.json')); if (!binary || !existsSync(binary) || !existsSync(pinned) || !dep || !boot) return; const p = spawnSync(binary, ['recipes'], { encoding: 'utf8', timeout: 10_000 }); let rec; try { rec = JSON.parse(p.stdout); } catch { return; } - if (rec.node !== dep.recipeSha256 || rec.bootstrap !== boot.recipeSha256) return; + if (!recipeAccepted(rec, 'node', dep.recipeSha256) || rec.bootstrap !== boot.recipeSha256) return; // Versions are -; adopt only a strictly newer build // (never downgrade on an agent rollback; undated pins are older). const [was, now] = [versionOf(pinned), versionOf(binary)]; if (!dated(now) || (dated(was) && dated(was) >= dated(now))) return; copyFileSync(binary, `${pinned}.next`); chmodSync(`${pinned}.next`, 0o700); renameSync(`${pinned}.next`, pinned); register(name, { upgradeScopes: upgradeScopes(name), dashnet: now }); - write(r.id, `dashnet ${was.slice(0, 12)} -> ${now.slice(0, 12)} for ${name} (same node and bootstrap recipes)`); + write(r.id, `dashnet ${was.slice(0, 12)} -> ${now.slice(0, 12)} for ${name} (${rec.node === dep.recipeSha256 ? 'same node and bootstrap recipes' : 'accepts this devnet\'s node recipe; same bootstrap recipe'})`); } // Current images, and whether dashmate renders the devnet, for the console.