Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
1ccbd3e
refine version proposal system
miloridenour Jun 27, 2026
4e823d4
nodes reindex when updating late to a version
miloridenour Jun 27, 2026
00295e8
Fix reindex startup panic; add restart/reindex devnet coverage
miloridenour Jun 29, 2026
b890b0e
consensus halt fixes: fail invalid offchain ops atomically (F4/F9/F13…
miloridenour Jun 30, 2026
6c0cd06
feat(consensus): add 0.4.0 version gates
miloridenour Jun 30, 2026
c4be493
fix(consensus): reject sub-MinMembers elections before scheduling (GV…
miloridenour Jun 30, 2026
5ca6433
fix(ledger): offchain unstake_hbd releases stake, gated on 0.4.0 (F14)
miloridenour Jun 30, 2026
5b0d5ee
feat(consensus): per-delegator consensus stake/unstake (gated on 0.5.0)
tibfox Jun 17, 2026
d7e2061
feat(consensus): pro-rata slashing for delegated stake (Q1 resolved)
tibfox Jun 17, 2026
61601f8
feat(gql): getConsensusDelegation query for delegation edges
tibfox Jun 17, 2026
58e659f
feat(consensus): wire one-time delegation-edge migration at 0.2.0 act…
tibfox Jun 18, 2026
1d793ba
test(devnet): delegated consensus stake/unstake at 0.5.0 (5-node)
tibfox Jun 18, 2026
e5c2974
fix(consensus): two pre-0.2.0 determinism bugs in delegated stake/uns…
tibfox Jun 18, 2026
70430ad
feat(consensus): delegator pendulum rewards + operator opt-in delegat…
tibfox Jun 22, 2026
f34109b
timelock on delegation-mode downgrade
miloridenour Jul 3, 2026
2b7f55d
fix(consensus): fail-stop delegation DB reads; GQL mode returns null …
miloridenour Jul 6, 2026
0b2f06e
log divergent settlement fields (diagnostic)
miloridenour Jul 9, 2026
5642fde
guard to skip re-derivation of settlements until block 4769770
miloridenour Jul 14, 2026
932c6e5
checkpoint(tss-rotation): Month-1 containment M1.1a+M1.2+M1.3 (brick …
Jul 7, 2026
027a1d9
harden(tss-rotation): M1.3 council fixes — split-brain guard, gate-of…
Jul 7, 2026
3437d5c
feat(tss-rotation): M1.4 dormant share-zeroization (defence-in-depth)
Jul 7, 2026
abbb6b4
harden(tss-rotation): Month-1 pruned-methodology fixes (7-lens audit)
Jul 7, 2026
fa7dfdf
feat(tss-rotation): S3 NN#1 node output-scoped retiring-key signing +…
Jul 8, 2026
22a85fc
fix(tss-rotation): S3 council — fail-CLOSED on a corrupt vault regist…
Jul 8, 2026
a44c267
fix(tss-rotation): S3 methodology — reject duplicate-generation regis…
Jul 8, 2026
4c8f88b
docs(tss-rotation): S3 methodology — record deploy-ordering precondit…
Jul 8, 2026
8072101
docs(tss-rotation): brick council — lock the permanent-loss preventer…
Jul 8, 2026
1dce11b
fix(tss-rotation): brick council BRK-5/8 — freeze deprecation under s…
Jul 8, 2026
993c254
docs(tss-rotation): brick-fix methodology — deploy-ordering (k) + mar…
Jul 8, 2026
a773630
S2 BRK-1 deploy-gate: mark precondition (f) DONE, add (l) dust-escape…
Jul 8, 2026
0ce7da7
feat(tss-rotation): BRK-2 check-SIGNATURE-before-activate (Option A',…
Jul 8, 2026
3e98e28
fix(tss-rotation): BRK-2 council L-1 — gate WithVaultRotationV2 in th…
Jul 8, 2026
71e511c
feat(tss-rotation): BRK-3 / V-A — bond-locked retiring-gen signing el…
Jul 8, 2026
0e2f155
fix(tss-rotation): BRK-3 / V-A council — A3 DoS-amplification + comme…
Jul 8, 2026
ff147f1
feat(tss-rotation): #11 bond-lock-until-drained (consensus unstake ga…
Jul 9, 2026
c51261f
fix(tss-rotation): #11 council — F1 dead-gate namespace fix + F2 fork…
Jul 9, 2026
339f4b0
fix(tss-rotation): #11 F2 — fail-STOP the bond-lock consensus reads (…
Jul 9, 2026
01dad90
feat(tss-rotation): #11 F4 — hold a front-run unstake's payout until …
Jul 9, 2026
1af5381
fix(btcvault): mirror contract VaultEntrySize 87→91 (S5 InactiveHeigh…
Jul 9, 2026
f715ee3
feat(tss): M1.1b node side — mirror the contract theft-halt flag into…
Jul 9, 2026
45caf55
fix(tss): 2 latent determinism/correctness bugs in the blame/ban mech…
Jul 9, 2026
fffeac7
harden vault-rotation-v2: close FULL-PRUNED findings (L1-L10, council…
Jul 9, 2026
7281261
test(tss): BTC vault-rotation-v2 devnet harness + genesis-activation fix
Jul 10, 2026
a06486f
feat(mapping-bot): drive the BTC vault-rotation migration lifecycle
tibfox Jul 14, 2026
2e149ca
test(devnet): vault-rotation drain, operator, writeOffDust, redrive +…
tibfox Jul 14, 2026
7e4684a
feat(mapping-bot): auto re-drive a stuck migration sweep
tibfox Jul 14, 2026
245195c
test(devnet): adversarial operator bounds — a compromised operator ca…
tibfox Jul 14, 2026
252776a
test(devnet): bond-lock consensus-unstake gate (#11)
tibfox Jul 14, 2026
755fad4
test(devnet): emergency tss_halt op plumbing + fix countHaltFlag coll…
tibfox Jul 14, 2026
0bf7118
fix(tss-rotation): never reshare a PURGED (retired) vault key
tibfox Jul 14, 2026
41b51f8
feat(poa): seat registry + consensus-version gates (S0-S2)
Jul 20, 2026
5be7d0c
feat(poa): seat gate, flat seat-weight, churn cap, exit-halt (S3,S5,S…
Jul 20, 2026
3149348
feat(poa): vsc.admit_vote — seat admission by 2/3 of seats (S4)
Jul 20, 2026
22f28cd
fix(poa): eight defects found by the PRUNED pass on this build
Jul 20, 2026
036a1f2
fix(poa): two more silent bson/query mismatches — the halt never armed
Jul 20, 2026
76ec9d2
fix(poa): normalise account case before stripping the hive: prefix
Jul 20, 2026
43c5090
fix(poa): batch was permanently dead code; churn cap could stall the …
Jul 20, 2026
d752118
audit(poa): retract the inflated threshold finding; add the miner har…
Jul 20, 2026
f526093
refactor(poa): code-quality pass — typed dup errors, drop dead return
Jul 20, 2026
6fbba74
test(poa): failure-state suite + RG-1 characterization
Jul 20, 2026
061fb5c
fix(poa): close RG-1 — arm the collateral exit-halt from admission
Jul 21, 2026
a7866d1
fix(poa): complete RG-1 close — hold the bond while the operator is e…
Jul 21, 2026
4f09444
fix(poa): close RG-1c — hold on recent witness activity, not just poi…
lordbutterfly-hive Jul 23, 2026
bf8b5c8
se: reindex performance profiling
techcoderx Aug 11, 2026
2bfb0e5
feat: lru cache implementation
techcoderx Jul 7, 2026
56f90ff
optimizations 1
techcoderx Aug 12, 2026
fbe9dd0
dids: bls pubkey lru cache
techcoderx Aug 12, 2026
801da70
wasm: parsed bytecode lru cache
techcoderx Aug 12, 2026
dbc24b7
fix: missing threadsafe, state processing tests
techcoderx Aug 12, 2026
192ea59
se: ignore c7-a log for now
techcoderx Aug 13, 2026
a6d4803
fix: advance last epoch after find success
techcoderx Aug 14, 2026
d93dc51
fix: regex in GetLedgersByTxId
techcoderx Aug 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ go run github.com/99designs/gqlgen generate # Regenerate GraphQL code

`make test` skips the slow packages listed in `SLOW_PACKAGES` in the Makefile
(libp2p clusters, docker devnet, zk proving, multi-second suites) and the
non-host-runnable ones (`modules/wasm/e2e/go_wasm*` wasm guests,
`modules/oracle/price` WIP). New packages are quick by default — add genuinely
slow ones to `SLOW_PACKAGES`.
non-host-runnable `modules/wasm/e2e/go_wasm*` wasm guests (their nested go.mod
excludes them from host builds). New packages are quick by default — add
genuinely slow ones to `SLOW_PACKAGES`.

`make test-regression` runs the single `TestFullNetworkRegression` (in
`tests/devnet`) with a 130m timeout (TSS stages wait on ~5-min epoch boundaries
Expand Down
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ install: all
# picked up by `make test` automatically.
#
# NON_HOST_PACKAGES never run under either target: the wasm-guest packages under
# modules/wasm/e2e/go_wasm are built for the wasm target (build-excluded on the
# host) and modules/oracle/price is WIP that does not compile.
# modules/wasm/e2e/go_wasm are built for the wasm target (their own nested
# go.mod excludes them on the host).

empty :=
space := $(empty) $(empty)
Expand All @@ -103,13 +103,11 @@ SLOW_PACKAGES := \
modules/hive/streamer \
modules/block-producer \
modules/state-processing \
modules/wasm/e2e \
modules/e2e \
cmd/mapping-bot/mapper \
cmd/zk-tx-signer

NON_HOST_PACKAGES := \
modules/oracle/price
NON_HOST_PACKAGES :=

# --- Known-failing exclusions (TEMPORARY — remove each entry once fixed) --------
# These currently fail and are excluded from BOTH `make test` and `make test-full`
Expand Down Expand Up @@ -171,6 +169,16 @@ LIST_TEST_PKGS := go list -e -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPa
# `ok` could reflect a stale run — undesirable for a deliberate test invocation.
GO_TEST := go test -count=1

# On macOS the `go` tool strips DYLD_LIBRARY_PATH from test binaries, so a
# cgo-linked test binary cannot locate libwasmedge at runtime unless the rpath
# is embedded at link time. Add it when a local WasmEdge install exists.
WASMEDGE_LIB_DIR := $(HOME)/.wasmedge/lib
ifeq ($(wildcard $(WASMEDGE_LIB_DIR)/libwasmedge.dylib),)
GO_TEST := $(GO_TEST)
else
GO_TEST := CGO_LDFLAGS="-Wl,-rpath,$(WASMEDGE_LIB_DIR)" $(GO_TEST)
endif

# Quick unit tests across the whole repo. Intended to stay under ~5 minutes.
test:
@echo "==> Quick tests (target < 5 min)"
Expand Down
9 changes: 9 additions & 0 deletions cmd/contract-deployer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ func main() {
p2pConf := p2pInterface.NewConfig(args.dataDir)
sysConfig := systemconfig.FromNetwork(args.network)
if args.sysconfigPath != "" {
// L8-03 (FULL-PRUNED 2026-07-09): a -sysconfig override rewrites ConsensusParams/
// OracleParams, which the node repo requires to be network-baked and identical on
// every node (params.go:118-129). Restrict it to devnet/mocknet — the SAME guard as
// cmd/vsc-node/main.go — so a production -sysconfig can't silently redirect a deploy
// to the wrong contract id / gateway.
if args.network != "devnet" && args.network != "mocknet" {
fmt.Println("Error: sysconfig overrides only allowed on devnet/mocknet, not", args.network)
os.Exit(1)
}
if err := sysConfig.LoadOverrides(args.sysconfigPath); err != nil {
fmt.Println("Error loading sysconfig overrides:", err)
os.Exit(1)
Expand Down
8 changes: 8 additions & 0 deletions cmd/devnet-setup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"
"vsc-node/modules/aggregate"
"vsc-node/modules/common"
"vsc-node/modules/common/delegationmode"
"vsc-node/modules/common/params"
systemconfig "vsc-node/modules/common/system-config"
"vsc-node/modules/db"
Expand Down Expand Up @@ -116,6 +117,13 @@ func main() {
})
idConf.SetUsername(witnessName)
idConf.SetActiveKey(args.wif)
// Consensus 0.5.0: nodes must opt in to receive third-party consensus
// delegation (default is Deactivated). Devnet nodes announce "custom" so
// the delegation stake/unstake paths are exercisable; "custom" keeps
// pendulum rewards at the node account, so reward-distribution devnet
// tests stay byte-identical to the pre-feature behaviour (only "share"
// splits to delegators). Use delegationmode.Share to exercise the split.
idConf.SetDelegationMode(delegationmode.Custom)

// Devnet integration-test hook (gated): when DEVNET_DETERMINISTIC_BLS=1,
// override the randomly-generated BLS seed with a DETERMINISTIC per-witness
Expand Down
9 changes: 9 additions & 0 deletions cmd/genesis-elector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ func main() {
electionDb := elections.New(vscDb)
sysConfig := systemconfig.FromNetwork(args.network)
if args.sysconfigPath != "" {
// L8-03 (FULL-PRUNED 2026-07-09): a -sysconfig override rewrites ConsensusParams/
// OracleParams, which the node repo requires to be network-baked and identical on
// every node (params.go:118-129). Restrict it to devnet/mocknet — the SAME guard as
// cmd/vsc-node/main.go — so a production -sysconfig can't silently fork this binary's
// view of consensus params off the network.
if args.network != "devnet" && args.network != "mocknet" {
fmt.Println("Error: sysconfig overrides only allowed on devnet/mocknet, not", args.network)
os.Exit(1)
}
if err := sysConfig.LoadOverrides(args.sysconfigPath); err != nil {
fmt.Println("Error loading sysconfig overrides:", err)
os.Exit(1)
Expand Down
18 changes: 18 additions & 0 deletions cmd/mapping-bot/contract-interface/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,21 @@ const LastHeightKey = "h"

const PrimaryPublicKeyStateKey = "pubkey"
const BackupPublicKeyStateKey = "backupkey"

// ---------------------------------------------------------------------------
// BTC vault-rotation-v2 (must stay byte-identical to the contract's
// btc-mapping-contract/contract/constants: a mismatch silently reads the wrong
// state key and the rotation driver goes blind).
// ---------------------------------------------------------------------------

// VaultRegistryKey holds the packed vault-generation registry (the "v" list).
// Absent/empty on a non-vault contract and on a pre-rotation deploy — the
// rotation driver treats both as "nothing to do".
const VaultRegistryKey = "v"

// MigrationSweepPrefix keys the per-sweep migration record ("ms-<txid>"). Its
// presence means a migration sweep is in flight and not yet settled.
const MigrationSweepPrefix = "ms" + DirPathDelimiter

// PendingUnmapPrefix keys the per-unmap record ("us-<txid>", delete-at-confirm).
const PendingUnmapPrefix = "us" + DirPathDelimiter
15 changes: 15 additions & 0 deletions cmd/mapping-bot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ func main() {

sysConfig := systemconfig.FromNetwork(args.network)
if args.sysconfigPath != "" {
// L8-03 (FULL-PRUNED 2026-07-09): a -sysconfig override rewrites ConsensusParams/
// OracleParams, which the node repo requires to be network-baked and identical on
// every node (params.go:118-129). Restrict it to devnet/mocknet — the SAME guard as
// cmd/vsc-node/main.go — so a production -sysconfig can't silently misdirect this
// privileged oracle binary (its BTC L1 endpoint / target contract id).
if args.network != "devnet" && args.network != "mocknet" {
fmt.Println("Error: sysconfig overrides only allowed on devnet/mocknet, not", args.network)
os.Exit(1)
}
if err := sysConfig.LoadOverrides(args.sysconfigPath); err != nil {
fmt.Println("Error loading sysconfig overrides:", err)
os.Exit(1)
Expand Down Expand Up @@ -187,6 +196,7 @@ func main() {
// At head — still run unmap/confirmations, then sleep before checking again
bot.HandleUnmap()
bot.HandleConfirmations()
bot.HandleVaultRotation()
releaseBlockLease(bot, blockHeight, instanceID)
time.Sleep(chainCfg.SleepInterval)
cancel()
Expand Down Expand Up @@ -219,6 +229,11 @@ func main() {
defer wg.Done()
bot.HandleUnmap()
bot.HandleConfirmations()
// Drive the vault-rotation lifecycle (build the next migration tranche /
// write off an un-sweepable residual / advance retire→purge). Runs after
// confirmations so a sweep that just settled is seen as settled. No-op on a
// contract with no vault registry, and internally rate-limited.
bot.HandleVaultRotation()
}()
wg.Wait()
releaseBlockLease(bot, blockHeight, instanceID)
Expand Down
4 changes: 3 additions & 1 deletion cmd/mapping-bot/mapper/call_contract_l2.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func (b *Bot) callContractL2(
return "", fmt.Errorf("fetch L2 nonce: %w", err)
}

rcLimit := b.BotConfig.RcLimit()
// Per-action: the vault-rotation ops need a far higher ceiling than the bot's
// configured default, which every other action keeps unchanged (see rcLimitFor).
rcLimit := b.rcLimitFor(action)
call := &transactionpool.VscContractCall{
ContractId: b.BotConfig.ContractId(),
Action: action,
Expand Down
Loading