From 311654f224b9e5bc6db9f1908de962b1799bd64c Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 5 Nov 2026 16:02:42 +0100 Subject: [PATCH] =?UTF-8?q?node-engine=20client:=20RootContract,=20the=20c?= =?UTF-8?q?ontract=20from=20which=20an=20engine=20judges=20an=20account's?= =?UTF-8?q?=20root=20(B5g;=20ADR=200634=20=C2=A74;=20issue=201966)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i --- go/clients/nodeengineclient/health.go | 4 ++++ go/clients/nodeengineclient/health_test.go | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 go/clients/nodeengineclient/health_test.go diff --git a/go/clients/nodeengineclient/health.go b/go/clients/nodeengineclient/health.go index b893d43..a5d3b56 100644 --- a/go/clients/nodeengineclient/health.go +++ b/go/clients/nodeengineclient/health.go @@ -13,6 +13,10 @@ import ( // a module declares as the engine placed them (the state data, `.`): their layouts are the seat's contract // (seat.HealthByNodeValue, seat.DataByNodeModuleValue); this file is their codec, shared by the engine and its readers. +// RootContract is the statement contract from which an engine judges an account's root: a report whose contract is lower +// judged nothing about root, and a reader must not read its empty root verdicts as healthy (HealthByNodeValue.Contract). +const RootContract = 3 + // EncodeHealth is h as JSON at the current version; it refuses a report naming no node, and a fall back to the old login // that names another node, no login fallen back from, no reason or no time. func EncodeHealth(h seat.HealthByNodeValue) ([]byte, error) { diff --git a/go/clients/nodeengineclient/health_test.go b/go/clients/nodeengineclient/health_test.go new file mode 100644 index 0000000..7dfdf28 --- /dev/null +++ b/go/clients/nodeengineclient/health_test.go @@ -0,0 +1,11 @@ +package nodeengineclient + +import "testing" + +// A report below RootContract judged nothing about root; the number is the one engines have written since the root +// judgement began, so a change of it is a change of what a reader trusts. +func TestRootContractIsTheOneEnginesJudgeRootFrom(t *testing.T) { + if RootContract != 3 { + t.Fatalf("RootContract = %d, the engines write 3", RootContract) + } +}