Skip to content

feat: update submission deadline task#1102

Merged
ctrlc03 merged 1 commit into
mainfrom
feat/update-submission-deadline-task
Dec 11, 2025
Merged

feat: update submission deadline task#1102
ctrlc03 merged 1 commit into
mainfrom
feat/update-submission-deadline-task

Conversation

@ctrlc03

@ctrlc03 ctrlc03 commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator

add task to update submission deadline from admin

Summary by CodeRabbit

  • New Features

    • Added submission window update functionality, allowing users to dynamically configure submission window parameters through a new dedicated command-line interface.
  • Chores

    • Enhanced contract deployment workflow with improved configuration options and mock verifier support capabilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@ctrlc03 ctrlc03 requested review from 0xjei and hmzakhalid December 11, 2025 18:55
@vercel

vercel Bot commented Dec 11, 2025

Copy link
Copy Markdown

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
crisp Skipped Skipped Dec 11, 2025 6:55pm
enclave-docs Skipped Skipped Dec 11, 2025 6:55pm

@coderabbitai

coderabbitai Bot commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This PR introduces a new Hardhat task updateSubmissionWindow for managing the sortition submission window parameter. The task dynamically deploys necessary contracts and calls setSortitionSubmissionWindow(). Changes include task implementation, configuration updates, and npm script additions across multiple packages.

Changes

Cohort / File(s) Change Summary
Task Implementation & Configuration
packages/enclave-contracts/tasks/ciphernode.ts, packages/enclave-contracts/hardhat.config.ts, packages/enclave-contracts/package.json
New Hardhat task updateSubmissionWindow (command: ciphernode:window) added to dynamically deploy contracts and update the sortition submission window. Task imported and exposed in Hardhat config. Corresponding npm script added for easy invocation.
CRISP Package Sync
examples/CRISP/packages/crisp-contracts/hardhat.config.ts, examples/CRISP/packages/crisp-contracts/package.json
Task imported and exposed in example package config to match main package. New npm script added. Additionally, deploy:contracts:full script updated to include USE_MOCK_VERIFIER=true environment variable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Task implementation (ciphernode.ts): Review contract deployment logic, parameter validation, and error handling for the new updateSubmissionWindow task
  • Script configuration changes: Verify consistency between both package configurations and correctness of the new deploy script flag

Possibly related PRs

  • chore: crisp packages publishing #963: Modifies the same package manifests (examples/CRISP/packages/crisp-contracts/package.json) with script and configuration changes, indicating concurrent tooling or workflow updates.

Suggested reviewers

  • hmzakhalid
  • 0xjei
  • cedoor

Poem

🐰 A window of submission time,
Now updated with tasks so fine!
Hardhat tasks hop, contracts deploy,
Registry updated with rabbit joy!
✨ Configuration scripts align,
Making sortition work divine!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: update submission deadline task' accurately captures the main purpose of the changeset, which is to add a new task for updating the submission deadline.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/update-submission-deadline-task

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 and usage tips.

@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: 0

🧹 Nitpick comments (3)
packages/enclave-contracts/tasks/ciphernode.ts (1)

536-573: Consider validating newWindow and double-checking deploy helper semantics

The task wiring and flow look good: you obtain PoseidonT3, get the ciphernodeRegistry via the existing deploy helper, then call setSortitionSubmissionWindow(newWindow) and wait for confirmation.

Two points worth tightening up:

  1. Guard against invalid newWindow values

Right now, newWindow is an unvalidated INT. A negative or zero value could cause an unexpected revert or underflow in the contract, depending on how setSortitionSubmissionWindow is implemented. Adding a quick check before calling the contract would make the task safer for admins:

   .setAction(async () => ({
     default: async ({ newWindow }, hre) => {
+      if (newWindow <= 0) {
+        throw new Error("newWindow must be a positive integer (e.g. number of blocks).");
+      }
+
       const { deployAndSaveCiphernodeRegistryOwnable } = await import(
         "../scripts/deployAndSave/ciphernodeRegistryOwnable"
       );
  1. Confirm that deployAndSaveCiphernodeRegistryOwnable won’t redeploy unintentionally

Here you call:

const { ciphernodeRegistry } =
  await deployAndSaveCiphernodeRegistryOwnable({
    hre,
    poseidonT3Address: poseidonT3,
  });

Given that deployAndSaveCiphernodeRegistryOwnable compares enclaveAddress, owner, and submissionWindow with stored values to decide whether to redeploy, please double-check that omitting those arguments here will only attach to the existing proxy and not trigger a redeploy with defaulted values. If it can redeploy, you may want a dedicated “attach-only” helper (or explicitly pass the stored args) so calling this admin task doesn’t accidentally wipe/replace registry state.

examples/CRISP/packages/crisp-contracts/package.json (1)

36-40: Deployment and window-update scripts look consistent with the core package

  • Updating deploy:contracts:full to also set USE_MOCK_VERIFIER=true keeps the example aligned with the deployment expectations in this repo.
  • The new updateSubmissionWindow script mirrors the enclave-contracts package and should invoke the same Hardhat task.

Only caveat: like the existing export-based scripts, this is POSIX-shell–oriented; if you ever need Windows support, a cross-platform env setter (or npm cross-env) would be needed, but that’s consistent with the rest of the current setup.

packages/enclave-contracts/hardhat.config.ts (1)

21-22: Core Hardhat config correctly registers updateSubmissionWindow

Adding updateSubmissionWindow to the ciphernode imports and including it in the tasks array cleanly exposes the new admin task in the main contracts workspace. Functionally this is solid.

If you care about readability, you might consider grouping updateSubmissionWindow next to the other ciphernode tasks in the array (e.g., right after ciphernodeSiblings) rather than after cleanDeploymentsTask, but that’s purely organizational.

Also applies to: 91-106

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e9e92e and 6be541f.

📒 Files selected for processing (5)
  • examples/CRISP/packages/crisp-contracts/hardhat.config.ts (2 hunks)
  • examples/CRISP/packages/crisp-contracts/package.json (1 hunks)
  • packages/enclave-contracts/hardhat.config.ts (2 hunks)
  • packages/enclave-contracts/package.json (1 hunks)
  • packages/enclave-contracts/tasks/ciphernode.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-11T13:21:31.031Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 677
File: packages/enclave-contracts/tasks/utils.ts:7-8
Timestamp: 2025-09-11T13:21:31.031Z
Learning: In Hardhat v3, the task API syntax has changed significantly from v2. The new syntax uses:
- `.addOption({ name, description, defaultValue, type })` instead of `.addOptionalParam()`
- `.setAction(async () => ({ default: (args, hre) => { ... } }))` instead of direct `.setAction((args, hre) => { ... })`
- `.build()` is required to finalize task definitions
- `ArgumentType.STRING` is used for option types instead of `types.string`

Applied to files:

  • examples/CRISP/packages/crisp-contracts/hardhat.config.ts
  • packages/enclave-contracts/hardhat.config.ts
  • packages/enclave-contracts/tasks/ciphernode.ts
📚 Learning: 2025-10-10T12:56:40.538Z
Learnt from: 0xjei
Repo: gnosisguild/enclave PR: 830
File: templates/default/README.md:123-128
Timestamp: 2025-10-10T12:56:40.538Z
Learning: In the Enclave repository, the hard-coded Hardhat development private key `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` is acceptable in template README files and documentation for local testing/interaction purposes.

Applied to files:

  • examples/CRISP/packages/crisp-contracts/package.json
🧬 Code graph analysis (2)
packages/enclave-contracts/hardhat.config.ts (1)
packages/enclave-contracts/tasks/ciphernode.ts (1)
  • updateSubmissionWindow (537-573)
packages/enclave-contracts/tasks/ciphernode.ts (3)
packages/enclave-contracts/scripts/deployAndSave/poseidonT3.ts (1)
  • deployAndSavePoseidonT3 (19-66)
packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts (1)
  • deployAndSaveCiphernodeRegistryOwnable (31-129)
crates/net/src/net_interface.rs (1)
  • tx (106-108)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: crisp_unit
  • GitHub Check: test_contracts
  • GitHub Check: test_net
  • GitHub Check: rust_integration
  • GitHub Check: build_enclave_cli
  • GitHub Check: build_ciphernode_image
  • GitHub Check: build_sdk
  • GitHub Check: integration_prebuild
  • GitHub Check: rust_unit
🔇 Additional comments (3)
packages/enclave-contracts/package.json (1)

173-175: Scripts wiring for verification and window update looks consistent

verify:contracts and updateSubmissionWindow correctly map to existing Hardhat entry points and follow the existing naming pattern for scripts. No issues from a contracts/tooling perspective.

packages/enclave-contracts/tasks/ciphernode.ts (1)

9-9: ArgumentType import aligns with existing Hardhat v3 task style

Bringing in ArgumentType for typed options matches the pattern used in other tasks in this repo; nothing to change here.

examples/CRISP/packages/crisp-contracts/hardhat.config.ts (1)

9-9: CRISP Hardhat config correctly exposes the new task

Importing updateSubmissionWindow and adding it to the tasks array keeps the CRISP example in sync with the core enclave-contracts config. This should make hardhat ciphernode:window available out of the box for the example project.

Also applies to: 66-67

@ctrlc03 ctrlc03 enabled auto-merge (squash) December 11, 2025 18:58
@ctrlc03 ctrlc03 merged commit 35f7687 into main Dec 11, 2025
25 checks passed
@ctrlc03 ctrlc03 deleted the feat/update-submission-deadline-task branch December 11, 2025 20:46
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.

2 participants