Skip to content

Witness rename#109

Merged
On1x merged 10 commits into
masterfrom
witness-rename
May 20, 2026
Merged

Witness rename#109
On1x merged 10 commits into
masterfrom
witness-rename

Conversation

@On1x
Copy link
Copy Markdown
Member

@On1x On1x commented May 20, 2026

No description provided.

On1x added 10 commits May 20, 2026 11:06
…date constants accordingly

- Changed all occurrences of 'witness' to 'validator' in documentation and schemas
- Updated constants such as CHAIN_MAX_WITNESSES to CHAIN_MAX_VALIDATORS
- Replaced witness-related operation names and signatures with validator counterparts
- Modified emergency consensus parameters and related account names to use validator terms
- Adjusted code comments and examples to reflect validator terminology
- Updated penalty and inflation parameter names from witness to validator
- Revised plugin and node documentation to reference validator updates and operations consistently
- Corrected database schema and consensus docs to align with validator nomenclature
- Ensured all translations reflect these changes uniformly across languages
- Rename all functions, variables, comments, and types from "witness" to "validator"
- Update vote handling to use validator_vote_index instead of witness_vote_index
- Adjust schedule update logic to handle validator schedules instead of witness schedules
- Modify emergency consensus handling to refer to validators
- Change logging to display validator information
- Update hardfork and version voting to use validator data
- Ensure code consistency with CHAIN_MAX_VALIDATORS and related constants adjusted for validators
- Maintain original logic while refactoring naming and types related to validators
- Correct misspellings of "witness" to "validator" in variable and function names
- Update function signatures and calls related to witness import and export to validator
- Change all references from witness schedule, witness votes, witness penalty, etc. to validator counterparts
- Modify plugins/snapshot and plugins/validator code to reflect validator terminology and logic
- Adjust log messages, comments, and config options replacing witness terms with validator
- Ensure consistency in naming for active and support validators in database.cpp
- Update emergency master and slot hijack detection checks to use validator instead of witness
- Reflect changes in program options and deprecated flags from witness to validator
- Maintain original functionality while improving clarity and correctness of terminology
- Update code, docs, and comments to use 'validator' instead of 'witness'
- Rename variables, functions, and indices accordingly
- Adjust configuration and constants related to emergency mode and consensus
- Modify documentation and localization files for consistency
- Change data directory naming in examples from 'witness_node_data_dir' to 'node_data_dir'
- Ensure all references to block production and scheduling reflect 'validators'
- Update wallet interface and API plugins to list validators instead of witnesses
… configs

- Deleted LOW_MEMORY_NODE related options and variables from Linux, macOS, MinGW, and MSVC build scripts
- Removed LOW_MEMORY_NODE flag and messages from CMakeLists.txt and Dockerfiles
- Cleaned up configure_build.py by deleting command line options for low memory node
- Simplified build process by removing deprecated low memory node support across all build environments
- Updated default build settings accordingly to no longer mention low memory mode
…relaxed schedule

When a node starts from a snapshot or experiences unclean state recovery,
current_aslot can diverge from the network consensus value. This causes
get_scheduled_validator() to return wrong validators for every slot via:
  shuffled[(current_aslot + slot_num) % num_scheduled_validators]

The fork switch code already handles this by retrying blocks with
skip_validator_schedule_check, allowing the node to follow the chain.
However, the underlying offset was never corrected, causing the error
to repeat on every subsequent block.

Add post-fork-switch auto-correction: after a successful linear extension
where schedule relaxation was used, verify that
shuffled[current_aslot % num] == head_block.validator. If not, compute
the positional delta and adjust current_aslot to restore alignment.

Safety constraints:
- Only triggers for linear extensions (no competing fork ambiguity)
- Only triggers when schedule relaxation was actually used
- Correction is idempotent (no-op if already aligned)
Old snapshots (created before the witness→validator terminology rename)
may contain objects under old key names: "witness", "witness_vote",
"witness_schedule", "witness_penalty_expire". The import logic only
checked for new "validator_*" keys, silently dropping old-format data.

This caused a critical bug: validator_penalty_expire objects were lost
during snapshot import, leaving validators with permanent non-zero
penalty_percent and reduced counted_votes. This permanently swapped
schedule positions for affected validators (id/social), producing
wrong_scheduled_validator_exception on every block.

Changes:
- Add else-if fallbacks for all old "witness_*" top-level keys
- Add "witness"→"validator" field name patching inside vote and
  penalty_expire objects (matching existing pattern in
  import_block_post_validations and import_validator_schedule)
- Add post-import self-healing: detect validators with penalty_percent>0
  but no corresponding expire records, and reset them to zero
@On1x On1x merged commit cedcbd4 into master May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant