Skip to content

feat: Directory Contract#6933

Open
jstuczyn wants to merge 22 commits into
developfrom
feat/directory-contract
Open

feat: Directory Contract#6933
jstuczyn wants to merge 22 commits into
developfrom
feat/directory-contract

Conversation

@jstuczyn

@jstuczyn jstuczyn commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new CosmWasm directory contract: the on-chain source of truth for nym-node configuration. It flips node-info distribution from per-node HTTP pulls to a push model - each nym-node pushes ed25519-signed config (keyed by (node_id, label)) to the contract, and consumers read it from chain. An incremental on-chain LtHash digest over all entries makes whole-directory retrieval verifiable.

Scope here is the contract only. The off-chain retrieval/verification client is a separate future change.

What's included

  • nym-directory-contract (contracts/directory) + shared nym-directory-contract-common crate (msg/types/error/constants/helpers).
  • nym-lthash (common/lthash) - homomorphic multiset hash (LtHash16, 2 KB accumulator, blake3 XOF); cosmwasm-check-verified, MSRV-pinned for the contracts workspace.
  • Mixnet wiring - directory_contract_address in ContractState/InstantiateMsg/MigrateMsg + introduce_directory_contract migration; the unbond handler notifies the directory (OnNymNodeUnbond) to clean up an unbonded node's entries.
  • validator-client query + signing traits (DirectoryQueryClient / DirectorySigningClient).
  • Downstream plumbing (network-defaults, mixnet generator, localnet-orchestrator, wallet sandbox) + emitted JSON schema.

Design highlights

  • Auth: writes are authorised by the node's mixnet identity key (ed25519). Replay protection is a per-node gap-free monotonic sequence; the signed payload binds (node_id, label, sequence, data). Empty data is rejected on writes, keeping set/delete signature spaces disjoint.
  • Curated entries: a second, admin-managed entry class for well-known/override entities; an admin-mutable label whitelist governs node writes.
  • Digest: an O(1) incremental LtHash multiset over all entries; the 32-byte digest lets a client recompute and verify the whole directory against chain state.

Deployment notes

  • DIRECTORY_CONTRACT_ADDRESS is a placeholder on mainnet (empty) and sandbox - must be set once the contract is deployed. The mixnet migration requires a valid directory address, so deploy the directory contract before migrating the mixnet.
  • The mixnet→directory unbond call is a hard sub-message by design (the directory must exist in every environment).

Future work

  • Retrieval / verification client (off-chain, separate change): light-client anchoring, two signer tiers (curated nym-apis vs bonded nodes), paranoid vs normal trust routes, digest recompute vs ICS23 proofs.

This change is Reviewable

Summary by CodeRabbit

  • New Features

    • Added an on-chain directory contract for node-owned entries and admin-curated entries, with label allowlisting, paginated queries, and digest/sequence lookups.
    • Enabled directory contract address configuration end-to-end (network defaults, wallet settings, and CLI initialization message generation).
    • Added mixnet-driven unbond cleanup so node directory entries are removed automatically.
  • Tests / Validation

    • Added generated JSON schemas plus typed directory query/signing helpers to support directory request/response flows.

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nym-explorer-v2 Ready Ready Preview, Comment Jul 9, 2026 9:05am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs-nextra Ignored Ignored Preview Jul 9, 2026 9:05am
nym-node-status Ignored Ignored Preview Jul 9, 2026 9:05am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new directory contract and shared directory types, wires directory addresses through mixnet and client code, implements storage, queries, and transactions for node and curated entries, and updates schemas, tests, configuration, and OpenSpec docs.

Changes

Directory Contract Feature

Layer / File(s) Summary
Workspace and crate wiring
Cargo.toml, contracts/Cargo.toml, contracts/directory/*, contracts/mixnet/Cargo.toml, contracts/node-families/Cargo.toml, contracts/performance/Cargo.toml, common/client-libs/validator-client/Cargo.toml
Adds new workspace members, crate manifests, patches, and dependency entries for the directory and LtHash crates.
Shared directory contract types
common/cosmwasm-smart-contracts/directory-contract/*
Defines shared constants, helpers, errors, message schemas, and domain/query-response types for the directory contract and clients.
Contract crate entrypoints
contracts/directory/src/bin/schema.rs, contracts/directory/src/lib.rs, contracts/directory/src/contract.rs
Adds the contract crate root, schema generator binary, and instantiate/execute/query/migrate entry points.
Storage and digest maintenance
contracts/directory/src/storage.rs
Implements the storage facade, per-node sequence tracking, entry stores, and incremental LtHash digest updates.
Transactions and queries
contracts/directory/src/transactions.rs, contracts/directory/src/queries.rs, contracts/directory/src/queued_migrations.rs
Implements node authorization, admin and curated mutations, unbond cleanup, and read-only query handlers.
Directory contract test harness
contracts/directory/src/testing.rs
Adds tester wiring, signing helpers, and dummy entry helpers.
Generated schemas
contracts/directory/schema/*, contracts/mixnet/schema/*
Generates JSON Schema artifacts for the directory contract and updates mixnet schema fields for directory addresses.
Mixnet contract integration
common/cosmwasm-smart-contracts/mixnet-contract/src/*, contracts/mixnet/src/*
Adds directory_contract_address state/config and dispatches OnNymNodeUnbond to the directory contract on node unbond.
Validator-client traits
common/client-libs/validator-client/src/nyxd/*
Adds directory query/signing traits and wires the directory contract address into providers and client config.
Network, CLI, wallet, and orchestrator wiring
common/network-defaults/src/*, common/commands/src/validator/cosmwasm/generators/mixnet.rs, nym-wallet/nym-wallet-types/src/network/sandbox.rs, tools/internal/localnet-orchestrator/src/orchestrator/setup/cosmwasm_contracts.rs
Adds directory contract address constants, environment exports, a CLI flag, wallet sandbox wiring, and orchestrator placeholders.
Sibling contract test wiring
contracts/node-families/src/testing.rs, contracts/performance/src/testing/mod.rs
Updates test harnesses to instantiate the directory contract and set mixnet sibling addresses.

OpenSpec Documentation

Layer / File(s) Summary
Directory contract OpenSpec documents
openspec/changes/archive/2026-07-01-directory-contract/*, openspec/specs/directory-contract/spec.md
Adds design, proposal, task, and spec documents describing the directory-contract feature.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant NodeOwner
  participant MixnetContract
  participant DirectoryContract
  NodeOwner->>MixnetContract: try_remove_nym_node
  MixnetContract->>DirectoryContract: wasm_execute OnNymNodeUnbond(node_id)
  DirectoryContract->>DirectoryContract: remove_all_node_entries, subtract digest leaves
  DirectoryContract-->>MixnetContract: ack
Loading
sequenceDiagram
  participant Node
  participant DirectoryContract
  participant Storage
  Node->>DirectoryContract: SetNodeEntry(node_id, label, data, sequence, signature)
  DirectoryContract->>DirectoryContract: verify identity signature & sequence
  DirectoryContract->>Storage: subtract old leaf, save entry, add new leaf, advance sequence
  DirectoryContract-->>Node: Response(SET_NODE_ENTRY event)
Loading

Possibly related PRs

  • nymtech/nym#6777: Both PRs modify the mixnet unbond flow in contracts/mixnet/src/nodes/transactions.rs by wiring cross-contract wasm_execute calls for sibling cleanup.

Suggested reviewers: simonwicky

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: adding a new directory contract and related wiring.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/directory-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tools/internal/localnet-orchestrator/src/orchestrator/setup/cosmwasm_contracts.rs (1)

113-150: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Instantiate a real directory contract before mixnet init

mixnet_unbond sends a plain wasm_execute to state.directory_contract_address, so the placeholder mixnet_rewarder address stored in mixnet_init_message will break unbonding unless the orchestrator deploys a real directory contract or rewrites that address before first use.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tools/internal/localnet-orchestrator/src/orchestrator/setup/cosmwasm_contracts.rs`
around lines 113 - 150, The mixnet initialization currently uses placeholder
`mixnet_rewarder` addresses in `mixnet_init_message`, which leaves
`directory_contract_address` invalid for later `mixnet_unbond` calls. Update
`mixnet_init_message` in `cosmwasm_contracts.rs` to populate
`directory_contract_address` with the actual directory contract address, or
ensure the orchestrator deploys and wires the real directory contract before
mixnet instantiation. Verify the value used by `mixnet_unbond` matches the
address returned from the setup flow rather than the placeholder.
🧹 Nitpick comments (2)
common/cosmwasm-smart-contracts/directory-contract/src/types.rs (1)

386-407: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

digest_leaf doesn't guard against key/entry namespace mismatch.

EntryKey::digest_leaf(&self, entry: &DirectoryEntry) accepts any DirectoryEntry variant regardless of self's namespace. The provided storage.rs snippet shows call sites manually pairing EntryKey::Node { .. } with DirectoryEntry::NodeEntry(..) rather than always going through the safe DirectoryEntryRecord::new_node/new_curated constructors. A future refactor that accidentally passes a mismatched variant (e.g. EntryKey::Node with DirectoryEntry::CuratedEntry) would silently produce a still-valid-looking but semantically wrong leaf, corrupting the on-chain digest without any compile- or run-time signal — a data-integrity risk for a mechanism whose entire purpose is verifiable digest correctness.

Consider asserting namespace agreement inside digest_leaf, or restricting the public entry point to DirectoryEntryRecord::digest_leaf (already namespace-safe by construction).

🛡️ Example defensive check
     pub fn digest_leaf(&self, entry: &DirectoryEntry) -> Vec<u8> {
+        debug_assert_eq!(
+            self.namespace(),
+            match entry {
+                DirectoryEntry::NodeEntry(_) => Namespace::Node,
+                DirectoryEntry::CuratedEntry(_) => Namespace::Curated,
+            },
+            "digest_leaf called with mismatched key namespace and entry variant"
+        );
         let mut buf = vec![self.namespace().tag()];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@common/cosmwasm-smart-contracts/directory-contract/src/types.rs` around lines
386 - 407, `EntryKey::digest_leaf` currently accepts any `DirectoryEntry` and
can silently hash mismatched key/value namespaces. Add a namespace/variant check
inside `digest_leaf` so `EntryKey::Node` only accepts
`DirectoryEntry::NodeEntry` and `EntryKey::Curated` only accepts
`DirectoryEntry::CuratedEntry`, and fail loudly on mismatch. If possible, make
`DirectoryEntryRecord::digest_leaf` the preferred public path and keep the
`EntryKey` helper namespace-safe by construction.
contracts/directory/src/transactions.rs (1)

78-163: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

try_set_node_entry / try_delete_node_entry never validate attached funds.

Neither entrypoint accepts MessageInfo, and per the contract.rs routing (try_delete_node_entry(deps, node_id, label, sequence, signature)), no funds check happens anywhere in the call path. Since any relayer can submit these (by design, signature-authorised), an operator who mistakenly attaches coins would have them silently absorbed into the contract with no visible way to recover them. Consider threading info through and calling cw_utils::nonpayable(&info)? (already a dependency) to reject unexpected funds explicitly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@contracts/directory/src/transactions.rs` around lines 78 - 163,
`try_set_node_entry` and `try_delete_node_entry` currently accept no
`MessageInfo`, so they never reject unexpected funds and can silently trap
coins. Thread `info` through the call path from the routing in `contract.rs`
into both entrypoints, then use `cw_utils::nonpayable(&info)?` at the start of
`try_set_node_entry` and `try_delete_node_entry` to explicitly fail on attached
funds while leaving the existing signature checks intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@common/cosmwasm-smart-contracts/directory-contract/src/helpers.rs`:
- Around line 19-33: The length-prefix parsing in read_len_prefixed can overflow
on wasm32 when computing the slice end from the u32 prefix. Update
read_len_prefixed to use checked_add when deriving the end offset from the
4-byte header and return DirectoryContractError::MalformedEntryValue if the
addition overflows or if the buffer is still too short, keeping the existing
error path and helper behavior intact.

In `@common/network-defaults/src/network.rs`:
- Around line 46-47: `directory_contract_address` is defined on
`NymNetworkDetails` but not populated from environment variables, so env-based
config always leaves it unset. Add the matching
`with_directory_contract_address` builder to the struct’s fluent API and wire
`get_optional_env(var_names::...)` into `new_from_env()` alongside the existing
`performance_contract_address`, `network_monitors_contract_address`, and
`node_families_contract_address` handling so `DIRECTORY_CONTRACT_ADDRESS` is
honored.

In `@contracts/directory/Cargo.toml`:
- Around line 37-39: Update the stale feature-name comments in the directory
contract manifest so they refer to testable-directory-contract instead of
testable-node-families-contract. Keep the wording aligned with the actual
feature defined in the [features] section and ensure any nearby optional
dependency comments around nym-contracts-common-testing and crate::testing are
corrected consistently.

In `@openspec/changes/archive/2026-07-01-directory-contract/design.md`:
- Line 100: The rollback note is out of date because the mixnet sub-message is
no longer best-effort; update the wording in the design note to reflect that the
mixnet callback is a hard callback and that rollback guidance should assume
failures are not harmless. Adjust the sentence in the archive design document so
it matches the current behavior described by D1 and the push client/read path
fallback story, without changing the rest of the rollback summary.

In `@openspec/changes/archive/2026-07-01-directory-contract/proposal.md`:
- Around line 13-15: The lifecycle bullet in the proposal still describes the
unbond cleanup as best-effort/reply-on-error, which conflicts with the settled
hard callback behavior. Update the wording in the proposal section around the
directory contract lifecycle and unbond handling to reflect the final callback
semantics, or explicitly mark the old text as historical/superseded so it no
longer contradicts the finalized design.

---

Outside diff comments:
In
`@tools/internal/localnet-orchestrator/src/orchestrator/setup/cosmwasm_contracts.rs`:
- Around line 113-150: The mixnet initialization currently uses placeholder
`mixnet_rewarder` addresses in `mixnet_init_message`, which leaves
`directory_contract_address` invalid for later `mixnet_unbond` calls. Update
`mixnet_init_message` in `cosmwasm_contracts.rs` to populate
`directory_contract_address` with the actual directory contract address, or
ensure the orchestrator deploys and wires the real directory contract before
mixnet instantiation. Verify the value used by `mixnet_unbond` matches the
address returned from the setup flow rather than the placeholder.

---

Nitpick comments:
In `@common/cosmwasm-smart-contracts/directory-contract/src/types.rs`:
- Around line 386-407: `EntryKey::digest_leaf` currently accepts any
`DirectoryEntry` and can silently hash mismatched key/value namespaces. Add a
namespace/variant check inside `digest_leaf` so `EntryKey::Node` only accepts
`DirectoryEntry::NodeEntry` and `EntryKey::Curated` only accepts
`DirectoryEntry::CuratedEntry`, and fail loudly on mismatch. If possible, make
`DirectoryEntryRecord::digest_leaf` the preferred public path and keep the
`EntryKey` helper namespace-safe by construction.

In `@contracts/directory/src/transactions.rs`:
- Around line 78-163: `try_set_node_entry` and `try_delete_node_entry` currently
accept no `MessageInfo`, so they never reject unexpected funds and can silently
trap coins. Thread `info` through the call path from the routing in
`contract.rs` into both entrypoints, then use `cw_utils::nonpayable(&info)?` at
the start of `try_set_node_entry` and `try_delete_node_entry` to explicitly fail
on attached funds while leaving the existing signature checks intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6d3a8b80-955f-4d8f-822d-b2927a6bfb11

📥 Commits

Reviewing files that changed from the base of the PR and between ec9bdec and 476397f.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • contracts/Cargo.lock is excluded by !**/*.lock
  • nym-wallet/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (69)
  • Cargo.toml
  • common/client-libs/validator-client/Cargo.toml
  • common/client-libs/validator-client/src/nyxd/contract_traits/directory_query_client.rs
  • common/client-libs/validator-client/src/nyxd/contract_traits/directory_signing_client.rs
  • common/client-libs/validator-client/src/nyxd/contract_traits/mod.rs
  • common/client-libs/validator-client/src/nyxd/mod.rs
  • common/commands/src/validator/cosmwasm/generators/mixnet.rs
  • common/cosmwasm-smart-contracts/directory-contract/Cargo.toml
  • common/cosmwasm-smart-contracts/directory-contract/src/constants.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/error.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/helpers.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/lib.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/msg.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/types.rs
  • common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs
  • common/cosmwasm-smart-contracts/mixnet-contract/src/types.rs
  • common/lthash/Cargo.toml
  • common/lthash/src/lib.rs
  • common/network-defaults/src/mainnet.rs
  • common/network-defaults/src/network.rs
  • common/network-defaults/src/var_names.rs
  • contracts/Cargo.toml
  • contracts/directory/.cargo/config
  • contracts/directory/Cargo.toml
  • contracts/directory/Makefile
  • contracts/directory/schema/nym-directory-contract.json
  • contracts/directory/schema/raw/execute.json
  • contracts/directory/schema/raw/instantiate.json
  • contracts/directory/schema/raw/migrate.json
  • contracts/directory/schema/raw/query.json
  • contracts/directory/schema/raw/response_to_admin.json
  • contracts/directory/schema/raw/response_to_all_curated_entries.json
  • contracts/directory/schema/raw/response_to_all_entries.json
  • contracts/directory/schema/raw/response_to_allowed_labels.json
  • contracts/directory/schema/raw/response_to_config.json
  • contracts/directory/schema/raw/response_to_curated_entries_paged.json
  • contracts/directory/schema/raw/response_to_curated_entry.json
  • contracts/directory/schema/raw/response_to_digest.json
  • contracts/directory/schema/raw/response_to_node_entries.json
  • contracts/directory/schema/raw/response_to_node_entries_paged.json
  • contracts/directory/schema/raw/response_to_node_entry.json
  • contracts/directory/schema/raw/response_to_sequence.json
  • contracts/directory/src/bin/schema.rs
  • contracts/directory/src/contract.rs
  • contracts/directory/src/lib.rs
  • contracts/directory/src/queries.rs
  • contracts/directory/src/queued_migrations.rs
  • contracts/directory/src/storage.rs
  • contracts/directory/src/testing.rs
  • contracts/directory/src/transactions.rs
  • contracts/mixnet/Cargo.toml
  • contracts/mixnet/src/contract.rs
  • contracts/mixnet/src/mixnet_contract_settings/queries.rs
  • contracts/mixnet/src/mixnet_contract_settings/storage.rs
  • contracts/mixnet/src/nodes/transactions.rs
  • contracts/mixnet/src/queued_migrations.rs
  • contracts/mixnet/src/testable_mixnet_contract.rs
  • contracts/node-families/Cargo.toml
  • contracts/node-families/src/testing.rs
  • contracts/performance/Cargo.toml
  • contracts/performance/src/testing/mod.rs
  • nym-wallet/nym-wallet-types/src/network/sandbox.rs
  • openspec/changes/archive/2026-07-01-directory-contract/.openspec.yaml
  • openspec/changes/archive/2026-07-01-directory-contract/design.md
  • openspec/changes/archive/2026-07-01-directory-contract/proposal.md
  • openspec/changes/archive/2026-07-01-directory-contract/specs/directory-contract/spec.md
  • openspec/changes/archive/2026-07-01-directory-contract/tasks.md
  • openspec/specs/directory-contract/spec.md
  • tools/internal/localnet-orchestrator/src/orchestrator/setup/cosmwasm_contracts.rs

Comment thread common/cosmwasm-smart-contracts/directory-contract/src/helpers.rs
Comment thread common/network-defaults/src/network.rs
Comment thread contracts/directory/Cargo.toml Outdated
Comment thread openspec/changes/archive/2026-07-01-directory-contract/design.md Outdated
Comment thread openspec/changes/archive/2026-07-01-directory-contract/proposal.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@contracts/directory/Makefile`:
- Around line 1-5: The helper targets in the Makefile are not marked as phony,
so make may skip them when a same-named file or directory exists. Add a .PHONY
declaration for the wasm and generate-schema targets so they always run, keeping
the existing target names and command bodies unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fd355e59-9acc-42bc-bd43-739ca5014cd5

📥 Commits

Reviewing files that changed from the base of the PR and between 476397f and da45e15.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • contracts/Cargo.lock is excluded by !**/*.lock
  • nym-wallet/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (73)
  • Cargo.toml
  • common/client-libs/validator-client/Cargo.toml
  • common/client-libs/validator-client/src/nyxd/contract_traits/directory_query_client.rs
  • common/client-libs/validator-client/src/nyxd/contract_traits/directory_signing_client.rs
  • common/client-libs/validator-client/src/nyxd/contract_traits/mod.rs
  • common/client-libs/validator-client/src/nyxd/mod.rs
  • common/commands/src/validator/cosmwasm/generators/mixnet.rs
  • common/cosmwasm-smart-contracts/directory-contract/Cargo.toml
  • common/cosmwasm-smart-contracts/directory-contract/src/constants.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/error.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/helpers.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/lib.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/msg.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/types.rs
  • common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs
  • common/cosmwasm-smart-contracts/mixnet-contract/src/types.rs
  • common/lthash/Cargo.toml
  • common/lthash/src/lib.rs
  • common/network-defaults/src/mainnet.rs
  • common/network-defaults/src/network.rs
  • common/network-defaults/src/var_names.rs
  • contracts/Cargo.toml
  • contracts/directory/.cargo/config
  • contracts/directory/Cargo.toml
  • contracts/directory/Makefile
  • contracts/directory/schema/nym-directory-contract.json
  • contracts/directory/schema/raw/execute.json
  • contracts/directory/schema/raw/instantiate.json
  • contracts/directory/schema/raw/migrate.json
  • contracts/directory/schema/raw/query.json
  • contracts/directory/schema/raw/response_to_admin.json
  • contracts/directory/schema/raw/response_to_all_curated_entries.json
  • contracts/directory/schema/raw/response_to_all_entries.json
  • contracts/directory/schema/raw/response_to_allowed_labels.json
  • contracts/directory/schema/raw/response_to_config.json
  • contracts/directory/schema/raw/response_to_curated_entries_paged.json
  • contracts/directory/schema/raw/response_to_curated_entry.json
  • contracts/directory/schema/raw/response_to_digest.json
  • contracts/directory/schema/raw/response_to_node_entries.json
  • contracts/directory/schema/raw/response_to_node_entries_paged.json
  • contracts/directory/schema/raw/response_to_node_entry.json
  • contracts/directory/schema/raw/response_to_sequence.json
  • contracts/directory/src/bin/schema.rs
  • contracts/directory/src/contract.rs
  • contracts/directory/src/lib.rs
  • contracts/directory/src/queries.rs
  • contracts/directory/src/queued_migrations.rs
  • contracts/directory/src/storage.rs
  • contracts/directory/src/testing.rs
  • contracts/directory/src/transactions.rs
  • contracts/mixnet/Cargo.toml
  • contracts/mixnet/schema/nym-mixnet-contract.json
  • contracts/mixnet/schema/raw/instantiate.json
  • contracts/mixnet/schema/raw/migrate.json
  • contracts/mixnet/schema/raw/response_to_get_state.json
  • contracts/mixnet/src/contract.rs
  • contracts/mixnet/src/mixnet_contract_settings/queries.rs
  • contracts/mixnet/src/mixnet_contract_settings/storage.rs
  • contracts/mixnet/src/nodes/transactions.rs
  • contracts/mixnet/src/queued_migrations.rs
  • contracts/mixnet/src/testable_mixnet_contract.rs
  • contracts/node-families/Cargo.toml
  • contracts/node-families/src/testing.rs
  • contracts/performance/Cargo.toml
  • contracts/performance/src/testing/mod.rs
  • nym-wallet/nym-wallet-types/src/network/sandbox.rs
  • openspec/changes/archive/2026-07-01-directory-contract/.openspec.yaml
  • openspec/changes/archive/2026-07-01-directory-contract/design.md
  • openspec/changes/archive/2026-07-01-directory-contract/proposal.md
  • openspec/changes/archive/2026-07-01-directory-contract/specs/directory-contract/spec.md
  • openspec/changes/archive/2026-07-01-directory-contract/tasks.md
  • openspec/specs/directory-contract/spec.md
  • tools/internal/localnet-orchestrator/src/orchestrator/setup/cosmwasm_contracts.rs
✅ Files skipped from review due to trivial changes (12)
  • contracts/directory/schema/raw/response_to_admin.json
  • common/network-defaults/src/var_names.rs
  • contracts/mixnet/Cargo.toml
  • contracts/directory/src/queued_migrations.rs
  • contracts/mixnet/src/mixnet_contract_settings/queries.rs
  • contracts/directory/schema/raw/response_to_curated_entries_paged.json
  • openspec/changes/archive/2026-07-01-directory-contract/.openspec.yaml
  • common/cosmwasm-smart-contracts/directory-contract/src/constants.rs
  • contracts/directory/src/lib.rs
  • contracts/directory/.cargo/config
  • openspec/specs/directory-contract/spec.md
  • openspec/changes/archive/2026-07-01-directory-contract/tasks.md
🚧 Files skipped from review as they are similar to previous changes (54)
  • common/cosmwasm-smart-contracts/directory-contract/Cargo.toml
  • contracts/directory/schema/raw/response_to_node_entries.json
  • contracts/directory/schema/raw/migrate.json
  • contracts/directory/src/bin/schema.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/lib.rs
  • contracts/directory/schema/raw/response_to_config.json
  • common/cosmwasm-smart-contracts/mixnet-contract/src/types.rs
  • common/client-libs/validator-client/Cargo.toml
  • contracts/directory/schema/raw/instantiate.json
  • common/commands/src/validator/cosmwasm/generators/mixnet.rs
  • common/lthash/Cargo.toml
  • contracts/directory/schema/raw/response_to_node_entry.json
  • contracts/directory/schema/raw/response_to_curated_entry.json
  • contracts/mixnet/src/mixnet_contract_settings/storage.rs
  • contracts/directory/schema/raw/response_to_sequence.json
  • common/cosmwasm-smart-contracts/directory-contract/src/error.rs
  • contracts/directory/schema/raw/response_to_allowed_labels.json
  • contracts/directory/schema/raw/response_to_all_curated_entries.json
  • contracts/directory/Cargo.toml
  • common/network-defaults/src/network.rs
  • nym-wallet/nym-wallet-types/src/network/sandbox.rs
  • common/network-defaults/src/mainnet.rs
  • contracts/directory/schema/raw/execute.json
  • contracts/directory/schema/raw/response_to_node_entries_paged.json
  • tools/internal/localnet-orchestrator/src/orchestrator/setup/cosmwasm_contracts.rs
  • contracts/Cargo.toml
  • common/cosmwasm-smart-contracts/directory-contract/src/msg.rs
  • common/client-libs/validator-client/src/nyxd/contract_traits/directory_signing_client.rs
  • contracts/directory/src/queries.rs
  • common/client-libs/validator-client/src/nyxd/mod.rs
  • common/client-libs/validator-client/src/nyxd/contract_traits/mod.rs
  • contracts/mixnet/src/contract.rs
  • contracts/node-families/Cargo.toml
  • common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs
  • contracts/directory/schema/raw/response_to_all_entries.json
  • contracts/directory/src/storage.rs
  • contracts/performance/Cargo.toml
  • contracts/mixnet/src/queued_migrations.rs
  • common/client-libs/validator-client/src/nyxd/contract_traits/directory_query_client.rs
  • contracts/directory/src/transactions.rs
  • common/lthash/src/lib.rs
  • openspec/changes/archive/2026-07-01-directory-contract/specs/directory-contract/spec.md
  • contracts/directory/schema/raw/response_to_digest.json
  • contracts/directory/schema/nym-directory-contract.json
  • contracts/mixnet/src/nodes/transactions.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/helpers.rs
  • common/cosmwasm-smart-contracts/directory-contract/src/types.rs
  • contracts/node-families/src/testing.rs
  • openspec/changes/archive/2026-07-01-directory-contract/proposal.md
  • contracts/performance/src/testing/mod.rs
  • contracts/mixnet/src/testable_mixnet_contract.rs
  • contracts/directory/src/contract.rs
  • contracts/directory/src/testing.rs
  • contracts/directory/schema/raw/query.json

Comment thread contracts/directory/Makefile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
common/network-defaults/src/network.rs (1)

253-297: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

export_to_env doesn't export directory_contract_address.

new_from_env() now reads DIRECTORY_CONTRACT_ADDRESS, but export_to_env() never writes it back out (nor PERFORMANCE_CONTRACT_ADDRESS, a pre-existing gap). This breaks round-tripping: exporting a NymNetworkDetails built with with_directory_contract(...) to env vars and re-loading via new_from_env() will silently lose the directory contract address.

🔧 Proposed fix
             set_optional_var(var_names::COCONUT_DKG_CONTRACT_ADDRESS, self.contracts.coconut_dkg_contract_address);
+            set_optional_var(var_names::DIRECTORY_CONTRACT_ADDRESS, self.contracts.directory_contract_address);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@common/network-defaults/src/network.rs` around lines 253 - 297, export_to_env
is missing round-trip coverage for contract addresses that new_from_env reads
back, so update NetworkDetails::export_to_env to also write
DIRECTORY_CONTRACT_ADDRESS and the existing PERFORMANCE_CONTRACT_ADDRESS using
the same optional export helper pattern used for the other contract fields. Keep
the change alongside the current set_optional_var calls in export_to_env so
values set via with_directory_contract() are preserved when reloaded through
new_from_env().
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@common/network-defaults/src/network.rs`:
- Around line 253-297: export_to_env is missing round-trip coverage for contract
addresses that new_from_env reads back, so update NetworkDetails::export_to_env
to also write DIRECTORY_CONTRACT_ADDRESS and the existing
PERFORMANCE_CONTRACT_ADDRESS using the same optional export helper pattern used
for the other contract fields. Keep the change alongside the current
set_optional_var calls in export_to_env so values set via
with_directory_contract() are preserved when reloaded through new_from_env().

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 50bd35d9-313f-4653-82bd-6ee5f260fb92

📥 Commits

Reviewing files that changed from the base of the PR and between 8df5a5f and 49d4912.

📒 Files selected for processing (12)
  • common/network-defaults/src/network.rs
  • contracts/directory/Cargo.toml
  • contracts/directory/Makefile
  • contracts/ecash/Makefile
  • contracts/mixnet/Makefile
  • contracts/network-monitors/Makefile
  • contracts/node-families/Makefile
  • contracts/nym-pool/Makefile
  • contracts/performance/Makefile
  • contracts/vesting/Makefile
  • openspec/changes/archive/2026-07-01-directory-contract/design.md
  • openspec/changes/archive/2026-07-01-directory-contract/proposal.md
✅ Files skipped from review due to trivial changes (2)
  • contracts/node-families/Makefile
  • openspec/changes/archive/2026-07-01-directory-contract/design.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • contracts/directory/Cargo.toml

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