Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
186 commits
Select commit Hold shift + click to select a range
ce79cb5
chore[client_circuit]:updated the circuits to accept two nf_token_id
SwatiEY Feb 20, 2026
a9ae77d
chore[client]: updated the client to select commitments on the basis …
SwatiEY Feb 20, 2026
b3229ab
chore[test_toml]: updated the nightfall_test.toml to test the changes
SwatiEY Feb 20, 2026
2f25650
Merge branch 'master' into swati/erc3525
SwatiEY Mar 5, 2026
f8c12eb
chore: merged master and added domain separation in nf_toke_id, nf_sl…
SwatiEY Apr 16, 2026
ecb1491
chore: added test changes for erc3525
SwatiEY Apr 16, 2026
0df6ff6
fix: added changes for proposer mempool fix and ownership fix
SwatiEY Apr 16, 2026
919917d
Merge branch 'master' into swati/erc3525
SwatiEY Apr 20, 2026
61a6fd6
Merge branch 'master' into swati/ownership_fix
SwatiEY Apr 20, 2026
7d740f0
chore: contract changes for nftokenId and slotId
SwatiEY Apr 21, 2026
2f02624
chore: fixed the slot_id computation
SwatiEY Apr 22, 2026
73953a3
chore: added unit tests and updated code so that txs are not duplicat…
SwatiEY Apr 22, 2026
8e4689f
merge master
SwatiEY Apr 22, 2026
913f3fd
Merge branch 'master' into swati/ownership_fix
SwatiEY Apr 24, 2026
4ec78fb
chore: merge master
SwatiEY Apr 24, 2026
84b532b
chore: fixed clippy
SwatiEY Apr 24, 2026
9e47e81
chore: fixed proposer error and pending block fix
SwatiEY Apr 29, 2026
8e47672
resolve merge conflicts
SwatiEY Apr 30, 2026
da55b69
merge master
SwatiEY Apr 30, 2026
249ef3c
merge master
SwatiEY Apr 30, 2026
f2633fc
Merge pull request #492 from EYBlockchain/seb/wallet-api
jiajieey May 6, 2026
f83c29c
refactor: replace get_signer() with Local/Azure wallet dispatch acros…
Apr 8, 2026
e91b1bb
refactor(nightfall_client): dispatch token_contracts and nightfall_co…
Apr 8, 2026
16e5e4a
refactor(nightfall_proposer): dispatch nightfall_contract and propose…
Apr 8, 2026
7679725
feat: introduce WalletRole for explicit per-role wallet dispatch
Apr 14, 2026
3adf4ec
fix: enforce explicit per-role Azure key name resolution
Apr 14, 2026
8808a91
refactor: replace match WalletType with polymorphic wallet abstraction
Apr 14, 2026
136c684
chore: wire azure wallet mode through docker compose
Apr 15, 2026
ac50d42
refactor: extract build_certificate_possession_preimage helper
Apr 15, 2026
66c0f62
refactor: introduce CertificateSigner trait with LocalCertificateSigner
Apr 15, 2026
f9b3db8
feat: add AzureRsaCertificateSigner for X.509 proof-of-possession
Apr 15, 2026
d93d86d
feat: wire CertificateSigner dispatch by role in /v1/certification ha…
Apr 15, 2026
2adfc99
fix: introduce per-role blockchain client connection singletons
Apr 15, 2026
5839b7b
docs: update Azure signing configuration documentation
Apr 15, 2026
27b86b3
chore: stop tracking local env and add env example
Apr 15, 2026
63c3ca2
test: isolate checksum validation from local wallet env
Apr 16, 2026
7c9966c
chore: keep .env tracked for CI compatibility
Apr 17, 2026
9f1b4eb
test with my real azure key
Apr 17, 2026
58620a2
Fix Azure X509 signer digest encoding and cert/signature validation
May 6, 2026
547c80f
Fix Azure Key Vault signing and X509 configuration handling
May 6, 2026
17ddfb9
fix: address Azure config follow-ups
May 7, 2026
4ac8433
fix: patch rust-openssl advisory
jiajieey May 7, 2026
5024410
fix: restore local test config and client2 wiring
May 7, 2026
2c699a3
Merge pull request #512 from EYBlockchain/kahina/KeyClient_Azure
jiajieey May 7, 2026
49c4017
infra(proposer): enable single-node MongoDB replica set
May 10, 2026
4afe740
feat(proposer): make block application atomic with MongoDB transactions
May 10, 2026
23179ca
feat(proposer): persist sync_state in block apply transaction
May 10, 2026
aaa826e
test(proposer): run MongoDB testcontainer as single-node replica set
May 10, 2026
01aae41
feat(proposer): restore startup sync state before block assembly
May 10, 2026
931766a
fix(proposer): clean up mismatched block state atomically
May 10, 2026
2d7e882
feat(proposer): narrow listener replay start from sync_state
May 11, 2026
2c40688
test(client): initialize Mongo replica set in api_stateful setup
May 11, 2026
359ca73
Merge branch 'master' into fix_openssl
SwatiEY May 12, 2026
c6cf0bd
feat(receipts): add receipt-specific KEM-DEM primitives
AdarshRon Apr 22, 2026
42e01a1
feat(receipts): add proposer receipt model and db persistence
AdarshRon Apr 22, 2026
3b4af39
feat(receipts): add proposer transfer receipt REST endpoints
AdarshRon Apr 22, 2026
ff8c843
test(receipts): add receipt helper generation and api client helpers
AdarshRon Apr 22, 2026
afb51d5
test(receipts): add end-to-end transfer receipt integration coverage
AdarshRon Apr 22, 2026
c924676
fix(receipts): prioritize existing receipt conflicts over version val…
AdarshRon Apr 22, 2026
8ddad17
feat: refactor transfer receipt handling and improve test coverage
AdarshRon Apr 27, 2026
ed9c4ce
chore: remove .venv from .dockerignore to streamline build context
AdarshRon Apr 28, 2026
310dbf9
chore: reorder use statements for consistency and clarity across mult…
AdarshRon Apr 28, 2026
1b3ab80
chore: reverted unwanted code formatting
AdarshRon Apr 29, 2026
457590e
chore: fixed rebasing issues
AdarshRon Apr 29, 2026
08679c8
feat: add transfer receipts documentation and API details
AdarshRon Apr 29, 2026
21dc40e
feat: handle default deposit data in create_deposit_proof method
AdarshRon May 6, 2026
ad5e048
fix: close block implementation before defining TransferReceiptStatus…
AdarshRon May 6, 2026
8a61acb
feat: update TransferReceipt status derivation to use lifecycle data
AdarshRon May 6, 2026
6c49b2f
chore: refactor settings and client operation code for clarity and co…
AdarshRon May 14, 2026
b8274a3
feat: enhance error handling in transfer receipt database operations …
AdarshRon May 14, 2026
dd21966
fix: improve logging format for transfer receipt query errors
AdarshRon May 14, 2026
c589c17
feat: add tx_hash field to Request struct and implement database upda…
AdarshRon May 15, 2026
8c6d08e
feat: update tx_hash type to String and enhance validation in transfe…
AdarshRon May 15, 2026
4f408c2
feat: remove link_path from CreateTransferReceiptResponse and related…
AdarshRon May 15, 2026
3a38607
feat: refresh status for existing transfer receipts on conflict resol…
AdarshRon May 18, 2026
dd8cd25
Merge remote-tracking branch 'origin/master' into swati/ownership_fix
SwatiEY May 18, 2026
f4bb85e
feat(proposer): add restore journal entity and DB API
May 18, 2026
8797420
test(proposer): tighten restore journal and rename spike coverage
May 18, 2026
c4d37d7
fix(proposer): avoid listCollections inside snapshot transaction
May 18, 2026
51e9fab
chore(proposer): expose snapshot module
May 18, 2026
89977bb
docs: add proposer snapshot restore design note
May 18, 2026
4b86222
style: apply rustfmt to workspace files
May 18, 2026
642c3ed
feat(proposer): load validated snapshots into shadow collections
May 18, 2026
acfcde1
feat(proposer): swap shadow snapshot state into live collections
May 18, 2026
a237488
feat(proposer): finalize snapshot restore cleanup phase
May 18, 2026
6d34175
feat(proposer): wire restore_journal recovery into bootstrap
May 18, 2026
7b82eb5
fix: the broadcast unknown error fix
SwatiEY May 18, 2026
c7a6014
Merge remote-tracking branch 'origin/master' into swati/erc3525
SwatiEY May 18, 2026
4043699
feat(proposer): wire snapshot restore into desync recovery flow
May 18, 2026
2b3e2bf
infra(proposer): persist snapshot directory in docker compose
May 18, 2026
f56f89b
chore: ignore local proposer snapshot data
May 18, 2026
5dfe21e
test: make Mongo testcontainer port lookup retryable
May 18, 2026
c5aec2d
feat(proposer): schedule automatic proposer snapshots
May 18, 2026
29a7981
test: make Mongo testcontainer startup more resilient
May 18, 2026
6641fc1
feat: add receipt_token field for transfer receipt authorization and …
AdarshRon May 19, 2026
4407f49
feat: refactor receipt KEM-DEM handling to use ReceiptEncryptInput st…
AdarshRon May 19, 2026
de43bc8
feat: enhance documentation for transfer receipt workflow
AdarshRon May 19, 2026
f71c889
chore: added some changes due new master changes for swaps
SwatiEY May 19, 2026
71d8f97
chore: added some new tests due new master changes for swaps
SwatiEY May 19, 2026
bf3d2c9
test(proposer): add snapshot restore crash failpoints and recovery co…
May 19, 2026
67f6993
fix(proposer): clean orphaned snapshot temp dirs at scheduler startup
May 19, 2026
74593fc
chore: added some new tests due new master changes for swaps
SwatiEY May 20, 2026
eba5b04
fix: refactored transfer receipt submission and validation
AdarshRon May 21, 2026
66abf47
doc: update transfer receipt documentation with status lifecycle and …
AdarshRon May 21, 2026
010ff75
doc: add detailed fields to TransferReceipt struct
AdarshRon May 21, 2026
615a537
fix: improve error handling formatting in transfer receipt submission
AdarshRon May 21, 2026
1482ca9
test: enhance receipt ciphertext size validation with encryption checks
AdarshRon May 21, 2026
3d9fb0a
Merge pull request #521 from EYBlockchain/adarsh/transfer-reciept
SwatiEY May 21, 2026
13d7ea0
merge master
SwatiEY May 21, 2026
804c0bb
merge master and fix clippy
SwatiEY May 21, 2026
527154a
merge master and fix clippy
SwatiEY May 21, 2026
e324eeb
feat(proposer): harden snapshot restore crash recovery
May 22, 2026
62d7470
Merge branch 'master' into kahina/snapshot-based-recovery
May 22, 2026
d67316a
Merge pull request #514 from EYBlockchain/swati/ownership_fix
SwatiEY May 22, 2026
43cad2d
Merge branch 'master' into swati/erc3525
SwatiEY May 22, 2026
988c275
fix(proposer): harden snapshot recovery edge cases
May 22, 2026
4925433
fix(proposer): harden automatic snapshot scheduling and retention
May 22, 2026
02258c0
fix(proposer): harden snapshot restore validation and scheduling
May 22, 2026
3bf7e5f
test: align recovery fixtures and harden Mongo testcontainer startup
May 22, 2026
50a18ce
fix(proposer): harden recovery, replay, and snapshot restore
May 22, 2026
4939bd9
Merge master into kahina/snapshot-based-recovery
May 22, 2026
8b855ee
Harden proposer snapshot recovery and backfill legacy tx lifecycle
May 23, 2026
7e5c552
fix(proposer): harden snapshot scheduler and startup validation
May 23, 2026
9b28897
fix(proposer): make delete_all_pending_blocks_with_session fail expli…
May 23, 2026
93d0f53
refactor(lib): remove unreachable mutable tree cache check
May 23, 2026
67b2e57
refactor(proposer): require session-aware block deletes
May 23, 2026
0d18cc1
refactor(proposer): split startup initialisation module
May 23, 2026
4650240
Harden proposer snapshot restore recovery
May 23, 2026
f1873cd
fix(proposer): use resume cursor during historical replay
May 25, 2026
63dd97a
chore: fix clippy warnings
jtcoolen May 25, 2026
0b1a543
ci: clean stale proposer snapshots before checkout
May 25, 2026
79f379f
fix(proposer): make destructive replay recover from genesis
May 25, 2026
d201121
fix(proposer): preserve canonical selected txs on startup
May 25, 2026
dee8b84
fix(proposer): stay desynchronised until replay catches up
May 26, 2026
f9093dd
fix(proposer): require exact historic root progress
May 26, 2026
4e8dbe2
fix(proposer): isolate snapshot roots per proposer
May 26, 2026
0fc801d
test(proposer): align nightfall event fixtures with historic root checks
May 26, 2026
83258c8
fix(proposer): satisfy clippy after recovery changes
May 26, 2026
87d6d03
fix(proposer): preserve canonical selected txs after snapshot restore
May 26, 2026
7247bfe
fix(proposer): preserve canonical selected txs after snapshot restore
May 26, 2026
c20897a
fix(proposer): keep proposer desynchronised until replay completes
May 26, 2026
37c14d4
docs(proposer): document tree consistency follow-up
May 26, 2026
68677f6
fix(proposer): reconcile orphaned selected txs after catch-up
May 26, 2026
9213109
Merge branch 'master' into fix_openssl
SwatiEY May 26, 2026
2a5cdfa
docs(proposer): add restore design invariants
May 26, 2026
b87dc83
fix(proposer): make swap-complete cleanup crash-idempotent
May 26, 2026
e745df7
fix(proposer): continue from recovered snapshot state after restore f…
May 26, 2026
ea89d89
chore: addressed the comments
SwatiEY May 26, 2026
e9d4c74
chore: addressed the comments
SwatiEY May 26, 2026
d0a7d1d
fix(proposer): validate recovered snapshot state before reuse
May 26, 2026
efe8268
chore: added a comment
SwatiEY May 26, 2026
fc79b93
ci: ensure self-hosted runner cleanup after tests
May 26, 2026
8348c45
Merge pull request #459 from EYBlockchain/swati/erc3525
SwatiEY May 26, 2026
8d1c09d
Merge branch 'master' into fix_openssl
SwatiEY May 26, 2026
50cca33
docs(proposer): add recovery fail-closed invariants
May 26, 2026
cc4960b
fix(proposer): fail closed when restore recovery remains incomplete
May 26, 2026
2a71160
fix(proposer): clean first pending startup state without sync_state
May 26, 2026
92dc97d
ci: isolate proposer snapshots from self-hosted runner workspace
May 26, 2026
a6151ab
fix(proposer): do not backfill legacy withdrawals as Included without…
May 26, 2026
eca4265
Merge pull request #524 from EYBlockchain/fix_openssl
SwatiEY May 26, 2026
e2b5b45
fix(proposer): reconcile active client transaction lifecycle after re…
May 26, 2026
573ed46
fix(proposer): keep block apply and mismatch cleanup coherent
May 26, 2026
59cdd2e
fix(config): normalize proposer snapshot root dir
May 26, 2026
425bd77
fix(proposer): make session-aware DB defaults fail closed
May 26, 2026
69a0ec4
fix(proposer): use proposer listener retry settings consistently
May 26, 2026
12adeba
fix(proposer): ignore temporary snapshot dirs during restore discovery
May 26, 2026
6d06abd
Merge branch 'master' of github.com:EYBlockchain/nightfall_4_PV into …
May 26, 2026
bdf0342
fix(proposer): recover safely from speculative startup tree state
May 26, 2026
14459c5
fix(proposer): harden listener recovery and durable L2 progress
May 26, 2026
1eef023
fix(proposer): reconcile restored tx state and harden snapshots
May 26, 2026
f092bcb
chore(proposer): align snapshot paths and CI cleanup safety
May 26, 2026
ce9a81b
fix(proposer): retry listener catch-up and fail on lifecycle write er…
May 26, 2026
65ceb53
doc(proposer): specify crash-resumable startup replay reset
May 26, 2026
9edbe09
fix(proposer): retry listener catch-up and fail on lifecycle write er…
May 26, 2026
dfe16a6
fix(proposer): make listener failures recoverable and respawnable
May 26, 2026
04b67bd
fix(proposer): only mark synchronised after durable block apply
May 26, 2026
0664e2f
fix(proposer): keep pending recovery state until lifecycle cleanup su…
May 26, 2026
d63562d
fix(proposer): journal startup replay reset for crash-safe recovery
May 26, 2026
3734809
fix(ci): move proposer snapshot test artifacts out of workspace
May 26, 2026
eb91e86
fix(proposer): harden recovery fallback and listener supervision
May 26, 2026
3cab724
fix(proposer): harden restore cleanup and listener supervision
May 26, 2026
c0d8c71
test(proposer): harden replay-reset and restore failpoint coverage
May 27, 2026
3b52a34
doc(proposer): defer replay cleanup and local snapshot mount follow-ups
May 27, 2026
3dac604
style(test): format run_tests
May 27, 2026
d204919
refactor(test): reuse shared snapshot test lock
May 27, 2026
4b0b202
fix(ci): use stable temp paths for proposer snapshots
May 27, 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
13 changes: 11 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@ NIGHTFALL_ADDRESS="0x68B1D87F95878fE05B998F19b66F4baba5De1aed" # Contract(0)
WEBHOOK_URL=
# Azure Key Vault configuration
AZURE_KEY_NAME=ethereum-signing-key
AZURE_VAULT_URL=https://nightfall-kv-1760976507.vault.azure.net/
AZURE_VAULT_URL=https://nightfall-certificate.vault.azure.net/
CLIENT_SIGNING_KEY_NAME=ethereum-signing-key
CLIENT2_SIGNING_KEY_NAME=ethereum-signing-key
DEPLOYER_SIGNING_KEY_NAME=ethereum-signing-key
PROPOSER_SIGNING_KEY_NAME=ethereum-signing-key
PROPOSER_2_SIGNING_KEY_NAME=ethereum-signing-key

# Azure Authentication (KEEP THESE SECRET!)
AZURE_CLIENT_ID=your-client-id-here
AZURE_CLIENT_SECRET=your-client-secret-her
AZURE_CLIENT_SECRET=your-client-secret-here
AZURE_TENANT_ID=your-tenant-id-here
NF4_NIGHTFALL_CLIENT2__WALLET_TYPE=local
NF4_NIGHTFALL_CLIENT__WALLET_TYPE=local
NF4_NIGHTFALL_CLIENT__X509_SIGNER_TYPE=local
NF4_NIGHTFALL_CLIENT2__X509_SIGNER_TYPE=local
CLIENT_X509_SIGNING_KEY_NAME=user-1-cert-key
CLIENT2_X509_SIGNING_KEY_NAME=your-client2-x509-key-name-here
NF4_NIGHTFALL_PROPOSER__WALLET_TYPE=local
NF4_NIGHTFALL_PROPOSER__X509_SIGNER_TYPE=local
56 changes: 46 additions & 10 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ jobs:
name: Check + Lint
runs-on: self-hosted
environment: DEV
env:
NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR: /tmp/proposer_snapshots/build
steps:
- name: Cleanup stale proposer snapshots
shell: bash
run: |
set -euo pipefail
test -n "${NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR:-}"
rm -rf "$NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR"
- name: Checkout
uses: actions/checkout@v4
# Add Node so npx exists for OZ upgrades validation
Expand Down Expand Up @@ -42,33 +50,44 @@ jobs:
env:
RUST_BACKTRACE: "1"
RUST_MIN_STACK: "8388608"
- name: Cleanup snapshots after tests
if: always()
shell: bash
run: |
set -euo pipefail
test -n "${NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR:-}"
rm -rf "$NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR"
resync:
name: Synchronisation Test with Mock Prover
needs: [build]
runs-on: self-hosted
env:
NF4_MOCK_PROVER: "true"
NF4_CONTRACTS__DEPLOY_CONTRACTS: "true"
NF4_PROPOSER_SNAPSHOT_MOUNT: proposer_snapshots_data
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clear previous run
run: docker compose --profile sync_test down -v
run: docker compose --profile sync_test down -v --remove-orphans
- name: Build
run: cargo build
- name: Generate keys
run: cargo run --release --bin key_generation
- name: Build Docker Image
run: docker compose --profile sync_test build
- name: Run Integration Test
run: docker compose --profile sync_test run test
run: docker compose --profile sync_test run --rm test
- name: Print logs
run: docker compose --profile sync_test logs
if: always()
run: docker compose --profile sync_test logs || true
- name: Remove databases
run: docker compose --profile sync_test rm -fvs client client2 proposer db_client db_client2 db_proposer
if: always()
run: docker compose --profile sync_test rm -fvs client client2 proposer db_client db_client2 db_proposer || true
- name: Shut Down Containers
if: always()
run: |
docker compose --profile sync_test down -v
docker compose --profile sync_test down -v --remove-orphans || true

rollup-prover:
name: Rollup prover integration Test
Expand All @@ -79,6 +98,7 @@ jobs:
env:
NF4_MOCK_PROVER: "false"
NF4_CONTRACTS__DEPLOY_CONTRACTS: "true"
NF4_PROPOSER_SNAPSHOT_MOUNT: proposer_snapshots_data
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -143,7 +163,7 @@ jobs:
ls -l "$CACHE_FILE" "$TARGET"
fi
- name: Clear previous run
run: docker compose --profile sync_test down -v
run: docker compose --profile sync_test down -v --remove-orphans
- name: Build
run: cargo build
- name: Generate keys
Expand Down Expand Up @@ -177,19 +197,35 @@ jobs:
- name: Build Docker Image
run: docker compose --profile sync_test build
- name: Run Integration Test
run: docker compose --profile development run test
run: docker compose --profile sync_test run --rm test
- name: Print logs
run: docker compose --profile development logs
if: always()
run: docker compose --profile sync_test logs || true
- name: Shut Down Containers
if: always()
run: |
docker compose --profile sync_test down -v

docker compose --profile sync_test down -v --remove-orphans || true
forge:
name: Smart Contract Unit Tests
needs: [build]
runs-on: self-hosted
env:
NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR: /tmp/proposer_snapshots/forge
steps:
- name: Cleanup stale proposer snapshots
shell: bash
run: |
set -euo pipefail
test -n "${NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR:-}"
rm -rf "$NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR"
- name: Checkout
uses: actions/checkout@v4
- name: Run Forge Tests
run: forge test
- name: Cleanup snapshots after tests
if: always()
shell: bash
run: |
set -euo pipefail
test -n "${NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR:-}"
rm -rf "$NF4_NIGHTFALL_PROPOSER__SNAPSHOT_ROOT_DIR"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ soljson*
configuration/toml
remappings.txt
local.env
/data/proposer_snapshots/
/nightfall_proposer/data/
temp/
11 changes: 6 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,26 @@ Nightfall_4 is a ZK rollup build around the ZK Privacy of Nightfall. It enables

Please note that this software should be treated as experimental. It should not be used to make significant value transactions.

## Proposer MongoDB

For Docker-based development and sync testing, proposer MongoDB runs as a single-node replica set so the proposer can later use MongoDB transactions safely.

- `db_proposer` uses replica set `nf4-rs-proposer`
- `db_proposer2` uses replica set `nf4-rs-proposer2`
- proposer MongoDB URIs should include both `replicaSet=...` and `directConnection=true`

Examples:

```text
mongodb://nf4_db_proposer:27017/?replicaSet=nf4-rs-proposer&directConnection=true
mongodb://nf4_db_proposer2:27017/?replicaSet=nf4-rs-proposer2&directConnection=true
```

Quick verification:

```bash
docker exec nf4_db_proposer mongosh --quiet --eval 'rs.status()'
docker exec nf4_db_proposer2 mongosh --quiet --eval 'rs.status()'
```

This change is proposer-only. `db_client` and `db_client2` remain standalone for now and client-side MongoDB replica set conversion is intentionally deferred to a separate task.
4 changes: 2 additions & 2 deletions blockchain_assets/contracts/Nightfall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,15 @@ contract Nightfall is
uint256 secretHash,
TokenType token_type
) external payable virtual onlyCertified nonReentrant {
uint256 nfTokenId = sha256_and_shift(abi.encode(ercAddress, tokenId));
uint256 nfTokenId = sha256_and_shift(abi.encode(ercAddress, 0, tokenId));
tokenIdMapping[nfTokenId] = TokenIdValue(ercAddress, tokenId, token_type);

uint256 nativeSlotId = tokenId;
uint256 nfSlotId = nfTokenId;
if (token_type == TokenType.ERC3525) {
nativeSlotId = IERC3525(ercAddress).slotOf(tokenId);
nfSlotId = uint256(
keccak256(abi.encode(ercAddress, nativeSlotId))
keccak256(abi.encode(ercAddress, 1, nativeSlotId))
) >> 4;
}
slotIdMapping[nfSlotId] = SlotIdValue(ercAddress, nativeSlotId, token_type);
Expand Down
22 changes: 22 additions & 0 deletions configuration/src/addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,16 @@ mod tests {
use serial_test::serial;

#[tokio::test]
#[serial]
async fn test_checksum_validation() {
let tmp_run_mode = std::env::var("NF4_RUN_MODE").ok();
let tmp_client_wallet_type = std::env::var("NF4_NIGHTFALL_CLIENT__WALLET_TYPE").ok();
let tmp_proposer_wallet_type = std::env::var("NF4_NIGHTFALL_PROPOSER__WALLET_TYPE").ok();

std::env::set_var("NF4_RUN_MODE", "development");
std::env::set_var("NF4_NIGHTFALL_CLIENT__WALLET_TYPE", "local");
std::env::set_var("NF4_NIGHTFALL_PROPOSER__WALLET_TYPE", "local");

let settings = Settings::new().expect("Could not load settings");
// checksummed address (valid)
let valid_address = "0x52908400098527886E0F7030069857D2E4169EE7";
Expand All @@ -525,6 +534,19 @@ mod tests {
};

addresses.ensure_nonzero(settings.mock_prover).unwrap();

match tmp_run_mode {
Some(val) => std::env::set_var("NF4_RUN_MODE", val),
None => std::env::remove_var("NF4_RUN_MODE"),
}
match tmp_client_wallet_type {
Some(val) => std::env::set_var("NF4_NIGHTFALL_CLIENT__WALLET_TYPE", val),
None => std::env::remove_var("NF4_NIGHTFALL_CLIENT__WALLET_TYPE"),
}
match tmp_proposer_wallet_type {
Some(val) => std::env::set_var("NF4_NIGHTFALL_PROPOSER__WALLET_TYPE", val),
None => std::env::remove_var("NF4_NIGHTFALL_PROPOSER__WALLET_TYPE"),
}
}
#[tokio::test]
#[serial]
Expand Down
Loading