fix(deploy): preserve devnet state on restart, add ansible user, image versioning, skip redundant init#12
Open
wpank wants to merge 1 commit into
Conversation
…e versioning, skip redundant init - refcell#56: Add --keep-state and --force-clean flags to devnet-run.sh so runtime state (QMDB, archives) is not unconditionally wiped on restart. Default behavior unchanged; use --keep-state to preserve. Ansible gets a devnet_keep_state variable for the same purpose. - #183: Create a dedicated 'kora' service user in the base ansible role. All docker/compose playbooks now use become_user: kora instead of running everything as root. The kora user gets limited sudoers access to docker/systemctl only, with audit logging to /var/log/kora-sudo.log. Provision playbook still runs as root for package installation and user creation. - #191: Add image versioning via git SHA and semver tags. docker-bake.hcl now generates sha-<short>, branch, semver, and latest tags with OCI labels. Dockerfile embeds GIT_SHA/BUILD_TIMESTAMP as env vars and labels. entrypoint.sh logs the image version on startup. Local builds via Justfile and devnet-run.sh auto-detect git metadata. Ansible build role passes git SHA to the bake environment. - #193: Add init-dkg-deal compose service that runs only keygen dkg-deal without re-running keygen setup. When peer config already exists but DKG shares are missing, devnet-run.sh and the ansible devnet role now use this service instead of init-config, avoiding redundant config regeneration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 tasks
wpank
pushed a commit
to wpank/kora
that referenced
this pull request
May 30, 2026
… truncation ordering Fix two related executor issues: 1. BLOCKHASH opcode returns zero during block proposal/verification (Nunchi-trade#12): The `RevmApplication::block_context()` method never populated `recent_block_hashes`, causing all BLOCKHASH queries to return zero during consensus. The finalization replay path correctly populated them via `BlockIndex::recent_block_hashes()`, creating a state root mismatch that would crash the node when any contract used BLOCKHASH. Fix: Add `block_index: Arc<BlockIndex>` to `RevmApplication` and call `.with_recent_block_hashes()` in `block_context()`, matching the finalization path. 2. Block hash truncation uses non-deterministic HashMap ordering (#081): When `with_recent_block_hashes()` received >256 entries, it used `HashMap::into_iter().take(256)` which retains an arbitrary subset due to HashMap's randomized iteration order. Different validators could retain different subsets, causing consensus divergence. Fix: Compute the cutoff as `max_key - 255` and filter to retain only the 256 most recent block numbers. The test is strengthened to verify the correct entries are retained. Closes Nunchi-trade#12 Closes #081 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four deployment/DevOps issues across the Docker devnet scripts and Ansible playbooks:
chore(transport,service): add Debug implementations to network types refcell/kora#56 - devnet-run.sh always clears runtime state: Adds
--keep-stateand--force-cleanflags so operators can preserve QMDB/archive data across restarts. Default behavior is unchanged (clean state). Ansible gets adevnet_keep_statevariable for the same purpose.#183 - Ansible runs as root with no sudo boundary: Creates a dedicated
koraservice user during provisioning. All docker/compose playbooks now usebecome_user: korainstead of running everything as root. The user gets limited sudoers access (docker, systemctl only) with audit logging to/var/log/kora-sudo.log. The provision playbook still runs as root for package installation.#191 - No image versioning or tagging strategy: Adds a comprehensive tagging strategy to
docker-bake.hclusing git SHA, branch name, semver, and OCI labels. The Dockerfile embedsKORA_GIT_SHA/KORA_BUILD_TIMESTAMPas env vars.entrypoint.shlogs the image version on startup. Local builds auto-detect git metadata. The Ansible build role passes git SHA to the bake environment.#193 - devnet-run.sh re-runs init-config when config exists: Adds an
init-dkg-dealcompose service that runs onlykeygen dkg-dealwithout re-runningkeygen setup. When peer config already exists but DKG shares are missing, bothdevnet-run.shand the Ansible devnet role use this service, avoiding redundant config regeneration.Test plan
./scripts/devnet-run.sh(default) -- verify runtime state is cleared (existing behavior preserved)./scripts/devnet-run.sh --keep-state-- verify runtime volumes are NOT wiped./scripts/devnet-run.sh --force-clean-- verify explicit clean message in outputjust buildpassesGIT_SHA/GIT_SHA_SHORT/BUILD_TIMESTAMPto bakedocker inspect kora:localshows OCI labels with git revisioninit-dkg-dealis used instead ofinit-configbaserole creates kora user with docker group membershipdeploy.ymlusesbecome_user: korafor docker operationsansible-playbook playbooks/provision.ymlstill runs as root (no become_user)🤖 Generated with Claude Code