-
Notifications
You must be signed in to change notification settings - Fork 261
feat: localnet v2 #6277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jstuczyn
wants to merge
2
commits into
develop
Choose a base branch
from
feature/localnet-v2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: localnet v2 #6277
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
1bb50da to
57950dc
Compare
abc175e to
1e9fdef
Compare
1e9fdef to
2aa87f1
Compare
Bits and bobs to make everything work Title MacOS setup instructions Docker/Container localnet
2aa87f1 to
814db6b
Compare
cargo fmt fixes to localnet purge provide path in the error message output args log failed exec print based on tty check-prerequisites cmd checked iptables update basic kernel features check enable ipv6 rules add forwarding rules squashing localnet-v2 commits additional changes propagate custom-dns flag to all run containers remove is_mock from EcashManager another localnet squash unused import chore: remove redundant testnet manager missing impl additional linux fixes command to rebuild container image wait for at least 2 blocks additional node startup fixes added --custom-dns flag to nym node setup add gateway probe + wait for DKG magic file fixed localnet down on linux container ls re-enable state resync additional feature locking macos adjustments working nyxd startup on linux wip linux box wip separating network inspect betweewn macos and linux initial linux feature locking moved all container commands into a single location finally working initial node performance squashing orchestrator commits cleanup fixed condition for naive rearrangement added cache of cosmwasm contracts for speed up on subsequent runs 'down' command refreshing described cache after nodes are bonded nym nodes setup + wip on nym api refresh nodes setup WIP first pass cleanup placeholder for nym-node setup bypassing the dkg further progress on nym-api setup wip: api setup up/down/purge placeholders persisting contract setup data fix contract upload by forcing amd64 container platform wip: contracts setup4 wip: contracts setup3 wip: contracts setup2 wip: contracts setup include network setup init and spawn nyxd build nyxd image in dedicated orchestrator build nyxd image
814db6b to
d38c42c
Compare
jstuczyn
added a commit
that referenced
this pull request
Dec 18, 2025
This includes: - mixnet contract cache - described nodes cache - nodes annotations cache (performance) those changes include taking some code developed for the purposes of #6277
jstuczyn
added a commit
that referenced
this pull request
Dec 19, 2025
This includes: - mixnet contract cache - described nodes cache - nodes annotations cache (performance) those changes include taking some code developed for the purposes of #6277
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.
Localnet:
Result of marrying @durch
localnet.shscript and the oldTestnet Manager. It allows to run a complete Nym mixnet test environment on Apple'scontainerruntime or on Linuxcontainerd(vianerdctland kata shim).It results in creation of the following containers:
nyxdnym-apinym-node-1(gateway)nym-node-2(mixnode)nym-node-3(mixnode)nym-node-4(mixnode)which run on a custom brige network (
nym-localnet-network) with dynamic IP assignment:it also embeddeds
nym-gateway-probebinary in the container image for easy testing.Prerequisites
MacOS
brew install --cask containercontainerand hasCONFIG_TUN=ykernel flaghttps://github.com/kata-containers/kata-containers/releases/download/3.20.0/kata-static-3.20.0-arm64.tar.xzcontainer system kernel set --tar kata-static-3.20.0-arm64.tar.xz --binary opt/kata/share/kata-containers/vmlinux-6.12.42-162Linux
The following dependencies must be installed:
newuidmapandnewgidmapwhich can be installed viauidmappackagecontainerdwhich will probably come with your distronerdctl,kata-runtimeandcontainerd-shim-kata-v2. they can be either installed manually or viakata-manager.shscript: https://github.com/kata-containers/kata-containers/blob/main/utils/README.md#kata-manager. it is recommended to run it with the-Nflag to install it alongsidenerdctlQuick Start
Startup flow
The startup is separated into 4 main steps (which can also be run individually as separate commands)
initialise-nyxdnyxddocker image from https://github.com/nymtech/nyxd.git and imports it into thecontainerruntimegenesis.jsonof the localnet chain and saves it to a shared volumenyxdcontainer using the shared volume datainitialise-contractscosmwasm/optimizerimageinitialise-nym-apinym-binariesdocker image and imports it into thecontainerruntime. note: its version tag is based on the current version of thenym-nodebinarynym-apinym-apidata and starts its container using a shared volumedkgandgroupcontracts by forcing the just creatednym-apiinstance to be a valid zk-nym issuerinitialise-nym-nodesnym-node --init-only: 3 mixnodes and 1 gatewaynym-apicontainer to make sure all nodes have valid performance metrics and force refreshes the relevant cacheCommands
build-infoShow build information of the localnet orchestrator binary
initialise-nyxdInitialise new nyxd instance as described above
Relevant arguments:
nyxd-tagto allow using non-default nyxd repo branchinitialise-contractsUpload and initialise all Nym cosmwasm contracts as described above
Relevant arguments:
monorepo-root- specify path to the monorepo root if the current working directory is different from the rootreproducible-builds- ensure contract builds are fully reproducible by removing additional source of non-determinism. note that this slows down the build process significantlyci-build-branch- use prebuilt contracts from thebuild.ci.nymte.chservercosmwasm-optimizer-image- cosmwasm optimizer image used for building and optimising the contractsallow-cached-build- allow using pre-built contracts from previous localnet runsinitialise-nym-apiInitialise instance of nym api and adjust the DKG contract to allow it to immediately start issuing zk-nyms as described above
Relevant arguments:
monorepo-root- specify path to the monorepo root if the current working directory is different from the rootcosmwasm-optimizer-image- cosmwasm optimizer image used for building and optimising the contractsallow-cached-build- allow using pre-built contracts from previous localnet runscustom-dns- allows specifying custom nameserver to be used by all spawned containersinitialise-nym-nodesInitialise nym nodes to start serving mixnet (and wireguard) traffic. this involves bonding them in the contract and starting the containers as described above
Relevant arguments:
monorepo-root- specify path to the monorepo root if the current working directory is different from the rootopen-proxy- allow internal service providers to run in open proxy modecustom-dns- allows specifying custom nameserver to be used by all spawned containersrun-gateway-probe-testRun a gateway probe against the running localnet
Relevant arguments:
monorepo-root- specify path to the monorepo root if the current working directory is different from the rootprove-args- allows specifying additional flags to be passed to the gateway proberebuild-binaries-imageRebuild the docker and container image used for running the nym binaries
Relevant arguments:
monorepo-root- specify path to the monorepo root if the current working directory is different from the rootcustom-tag- custom image tag for the new imageupSingle command to start up localnet with minimal configuration
Relevant arguments:
refer to arguments of
initialise-nyxd,initialise-contracts,initialise-nym-apiandinitialise-nym-nodesas the same ones are availabledownStop the localnet (stops and removes all containers using
localnet-*imagepurgeRemove all localnet information, including any containers and images
Relevant arguments:
monorepo-root- specify path to the monorepo root if the current working directory is different from the rootremove-cache(default: true) - specify whether the cache data should be removedremove-images(default: true) - specify whether the built images should be removedStorage
All the localnet data is saved, by default, under
~/.nym/localnet-orchestrator/directory and further split into the following:network-data.sqlite(by default~/.nym/localnet-orchestrator/network-data.sqlite) which contains basic network metadata - it was easier than jugling random .json files around~/.nym/localnet-orchestrator/group-key/nym-api)~/.nym/localnet-orchestrator/group-key/nyxd)~/.nym/localnet-orchestrator/group-key/nym-node-1)~/.nym/localnet-orchestrator/group-key/nym-node-2)~/.nym/localnet-orchestrator/group-key/nym-node-3)~/.nym/localnet-orchestrator/group-key/nym-node-4)~/.nym/localnet-orchestrator/.cachewhich contains intermediate build data that can be reused between runs to speed up the deployment process. currently it only containscontractsdirectory for built cosmwasm contractsCurrent Limitations:
nyxdinstance exposes port26657to the host. this was to speed up development to allow easier chain interaction by being able to use rust client directly from the orchestrator host. in the future this should get modifiedOther changes
to allow the localnet to work some additional changes were made in the other parts of the repo:
Nym Api:
/v1/utilityroutes that allow interacting with internal cache states. note that they are not exposed if explicit bearer token is not set/v1/utility/refresh-mixnet/cache- allows to (once every 5min) force refresh the state of the mixnet cache/v1/utility/mixnet-cache-timestamp- returns timestamp of when the mixnet cache has last been refreshed/v1/utility/refresh-node-annotations-cache- allows to (once every 5min) force refresh the state of the node annotations cache (performance information)/v1/utility/node-annotations-cache-timestamp- returns timestamp of when the annotations cache has last been refreshedNym Node:
NetworkRefreshernow starts before spawning gateway specific tasks - this allows it to retrieve valid network before startupobtain_initial_network()inNetworkRefresherwill now use a configurablemax_startup_waiting_periodto obtain valid initial topology as opposed to being able to continue even with invalid network view--wireguard-userspaceflag to run userspace wireguard. requireswireguard-goto be available within the$PATHIPR:
open_proxyflag to mirror the network requester settingsClient:
wait_for_initial_topologyflag that works similarly towait_for_gateway- theTopologyRefreshertask will optionally block for a maximum (configurable) amount of time until it gets a minimum working topology2024and as a result also fixed a few clippy issues (if let chains)Other:
connect_with_mnemonic_and_network_detailstoNyxdClientto createDirectSigningHttpRpcNyxdClientwithout having to create an intermediateConfiginstanceChainDetails::mainnet()for more convenient creation of mainnet instance of chain details (i.e. prefix and denoms)This change is