refactor: add prettier plugin for solidity#1054
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds Prettier Solidity plugin and includes .sol in formatting scripts; applies widespread formatting to Solidity fixtures/docs/templates; and introduces full implementations for MockCRISPProgram and MyProgram with new public state, errors, events, and validate/validateInput/verify flows. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller as Client
participant Program as ProgramContract
participant Enclave as Enclave (IEnclave)
participant Verifier as RiscZeroVerifier
Caller->>Program: validate(e3Id, seed, e3ProgramParams, computeProviderParams)
Program-->>Program: check authorization/initialization, store paramsHash
Program->>Enclave: call validate (initiate enclave run)
Enclave-->>Program: returns ciphertextOutputHash
Program->>Verifier: verify(ciphertextOutputHash, proof) [journal = ciphertextHash|paramsHash|inputRoot]
Verifier-->>Program: verification result (bool)
Program-->>Caller: returns encryptionSchemeId / verification outcome
Note right of Program: validateInput invoked separately to extract/persist input
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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)
package.json (1)
72-72: Update prettier-plugin-solidity to v2.x for Prettier 3.x compatibility.Version 1.2.0 is incompatible with Prettier 3.1.1. Prettier 3.x introduced breaking plugin API changes; the v1 series was built for Prettier 2.x. Update to the latest v2.1.0 (or minimum v2.0.0) which supports Prettier 3.x:
"prettier-plugin-solidity": "^2.1.0",
🧹 Nitpick comments (1)
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockCRISPProgram.sol (1)
112-114: Consider validating_imageIdis non-zero.Unlike
setVerifier, this setter doesn't validate the input. If a zeroimageIdwould cause verification failures, consider adding a validation check for consistency.function setImageId(bytes32 _imageId) external onlyOwner { + require(_imageId != bytes32(0), "Invalid image ID"); imageId = _imageId; }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
.prettierrc.json(1 hunks)crates/evm-helpers/tests/fixtures/emit_logs.sol(1 hunks)crates/evm-helpers/tests/fixtures/fake_enclave.sol(1 hunks)crates/evm/tests/fixtures/emit_logs.sol(1 hunks)crates/indexer/tests/fixtures/emit_logs.sol(1 hunks)crates/indexer/tests/fixtures/fake_enclave.sol(1 hunks)crates/support/contracts/ImageID.sol(1 hunks)crates/support/tests/Elf.sol(1 hunks)docs/pages/building-with-enclave.mdx(3 hunks)docs/pages/computation-flow.mdx(2 hunks)docs/pages/write-e3-contract.mdx(3 hunks)examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockCRISPProgram.sol(1 hunks)examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.sol(1 hunks)examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockRISC0Verifier.sol(1 hunks)examples/CRISP/packages/crisp-contracts/contracts/Mocks/RiscZeroGroth16Verifier.sol(1 hunks)package.json(1 hunks)templates/default/contracts/Mocks/MockRISC0Verifier.sol(1 hunks)templates/default/contracts/MyProgram.sol(1 hunks)
🧰 Additional context used
🧠 Learnings (10)
📚 Learning: 2024-10-01T02:51:17.718Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 119
File: packages/evm/contracts/test/MockE3Program.sol:15-17
Timestamp: 2024-10-01T02:51:17.718Z
Learning: In mock contracts used for testing, it's acceptable for functions to lack access control since they do not pose security risks.
Applied to files:
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.soltemplates/default/contracts/Mocks/MockRISC0Verifier.solexamples/CRISP/packages/crisp-contracts/contracts/Mocks/MockRISC0Verifier.sol
📚 Learning: 2025-09-19T11:16:53.825Z
Learnt from: cedoor
Repo: gnosisguild/enclave PR: 752
File: packages/enclave-contracts/contracts/Enclave.sol:15-17
Timestamp: 2025-09-19T11:16:53.825Z
Learning: The Enclave contract in the gnosisguild/enclave repository has not been deployed yet as of September 2025, so storage layout considerations for upgradeable contracts don't apply to current changes.
Applied to files:
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.soldocs/pages/building-with-enclave.mdx
📚 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/contracts/Mocks/MockEnclave.solcrates/indexer/tests/fixtures/fake_enclave.solcrates/evm-helpers/tests/fixtures/fake_enclave.sol
📚 Learning: 2025-11-12T10:08:30.720Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 996
File: examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol:144-169
Timestamp: 2025-11-12T10:08:30.720Z
Learning: In the CRISP program (examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol), there are plans to move the merkle tree from the Enclave contract to the program contract itself in the future, which would allow direct calls to validateInput to be stored in the merkle tree.
Applied to files:
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.soldocs/pages/building-with-enclave.mdxtemplates/default/contracts/MyProgram.solexamples/CRISP/packages/crisp-contracts/contracts/Mocks/MockCRISPProgram.sol
📚 Learning: 2024-11-03T10:47:35.993Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 170
File: packages/ciphernode/evm/tests/fixtures/emit_logs.sol:7-11
Timestamp: 2024-11-03T10:47:35.993Z
Learning: In the `emit_logs.sol` Solidity contract, explicit visibility modifiers for state variables are not required.
Applied to files:
crates/indexer/tests/fixtures/emit_logs.solcrates/evm-helpers/tests/fixtures/emit_logs.solcrates/evm/tests/fixtures/emit_logs.sol
📚 Learning: 2024-11-03T11:00:21.089Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 170
File: packages/ciphernode/evm/tests/evm_reader.rs:14-18
Timestamp: 2024-11-03T11:00:21.089Z
Learning: The `emit_logs.json` fixture file in `packages/ciphernode/evm/tests/fixtures/` is generated during the build process and is not committed to the repository.
Applied to files:
crates/indexer/tests/fixtures/emit_logs.solcrates/evm-helpers/tests/fixtures/emit_logs.sol
📚 Learning: 2024-11-05T06:49:46.285Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/enclave_node/src/datastore.rs:14-16
Timestamp: 2024-11-05T06:49:46.285Z
Learning: In `packages/ciphernode/enclave_node/src/datastore.rs`, for internal functions like `get_in_mem_store`, adding extensive documentation and error handling may not be necessary if they are not client-facing.
Applied to files:
docs/pages/building-with-enclave.mdx
📚 Learning: 2024-11-05T06:48:58.177Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/config/src/app_config.rs:13-21
Timestamp: 2024-11-05T06:48:58.177Z
Learning: In the `packages/ciphernode/config/src/app_config.rs` file, for the `Contract` enum, the team prefers to use `String` type for `address` fields, relying on parsing to handle validation, instead of using the `Address` type.
Applied to files:
docs/pages/building-with-enclave.mdx
📚 Learning: 2024-11-05T06:56:49.157Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/enclave_node/src/aggregator.rs:0-0
Timestamp: 2024-11-05T06:56:49.157Z
Learning: `RegistryFilterSol` does not have a reader and does not require a repository reader or deploy block when calling `RegistryFilterSol::attach` in `packages/ciphernode/enclave_node/src/aggregator.rs`.
Applied to files:
docs/pages/building-with-enclave.mdx
📚 Learning: 2024-10-22T03:39:29.448Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/evm/src/enclave_sol_reader.rs:87-89
Timestamp: 2024-10-22T03:39:29.448Z
Learning: In the `ciphernode` project, specifically in `packages/ciphernode/evm/src/enclave_sol_reader.rs`, the method `EnclaveSolReader::attach` should be retained even if it directly calls `EvmEventReader::attach` without additional processing. Avoid suggesting its removal in future reviews.
Applied to files:
docs/pages/building-with-enclave.mdxcrates/indexer/tests/fixtures/fake_enclave.solcrates/evm-helpers/tests/fixtures/fake_enclave.sol
⏰ 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). (11)
- GitHub Check: build_enclave_cli
- GitHub Check: test_net
- GitHub Check: integration_prebuild
- GitHub Check: build_sdk
- GitHub Check: build_e3_support_dev
- GitHub Check: test_contracts
- GitHub Check: rust_integration
- GitHub Check: build_e3_support_risc0
- GitHub Check: rust_unit
- GitHub Check: crisp_rust_unit
- GitHub Check: Build & Push Image
🔇 Additional comments (27)
package.json (1)
16-17: LGTM! Solidity file support added to formatting scripts.The addition of
.solto the format and format:check scripts correctly enables Prettier formatting for Solidity files across the repository.crates/support/tests/Elf.sol (1)
22-23: LGTM! Formatting adjustment applied.The indentation and line wrapping have been adjusted according to the Prettier Solidity plugin rules. The file is auto-generated (as noted in line 17), so the machine-specific path is expected.
crates/evm-helpers/tests/fixtures/emit_logs.sol (1)
10-33: LGTM! Formatting applied consistently.All changes are formatting-only: event and function declarations have been collapsed to single lines where appropriate, and the empty string literal has been normalized from
""to''per the Prettier configuration'ssingleQuote: truesetting. No functional changes detected..prettierrc.json (1)
12-12: LGTM! Prettier Solidity plugin configured.The addition of the
prettier-plugin-solidityplugin correctly enables Solidity-aware formatting across the repository, which is the core objective of this PR.crates/support/contracts/ImageID.sol (1)
22-22: LGTM! Indentation normalized.The indentation has been adjusted from 4 spaces to 2 spaces, aligning with the
tabWidth: 2setting in.prettierrc.json. No functional changes.examples/CRISP/packages/crisp-contracts/contracts/Mocks/RiscZeroGroth16Verifier.sol (1)
8-12: LGTM! Import and constructor formatting applied.The import statements have been normalized to use single quotes and adjusted spacing, and the constructor has been collapsed to a single line. All changes are formatting-only with no functional impact.
docs/pages/computation-flow.mdx (2)
65-65: LGTM! Function signature formatting improved.The function signature has been collapsed to a single line for improved readability in the documentation.
79-83: LGTM! Function signature formatting improved.The function signature line breaks have been adjusted for better readability in the documentation.
templates/default/contracts/Mocks/MockRISC0Verifier.sol (1)
8-13: LGTM! Import and function formatting applied.The import statement has been normalized to use single quotes with adjusted spacing, and function declarations have been collapsed to single lines. All changes are formatting-only with no functional impact.
docs/pages/building-with-enclave.mdx (1)
22-37: LGTM - documentation formatting update.The formatting changes to the Solidity code examples are consistent and improve readability.
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockRISC0Verifier.sol (1)
8-13: LGTM - formatting changes only.The import statement and function declarations have been reformatted consistently. No functional changes detected.
templates/default/contracts/MyProgram.sol (1)
8-12: Formatting looks good overall.The import statements and contract structure formatting are consistent, aside from the string literal issue noted separately.
Also applies to: 15-16, 19-112
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.sol (1)
8-10: LGTM on formatting changes.The import statements and function formatting are consistent, aside from the string literal syntax issues noted separately.
Also applies to: 13-13, 15-17, 19-29, 32-37
crates/indexer/tests/fixtures/fake_enclave.sol (2)
10-14: Approve formatting changes pending syntax fix.The event declarations, function formatting, and struct layout changes are consistent with Prettier configuration, once the string literal syntax is corrected.
Also applies to: 17-40, 42-48, 62-76
49-56: Critical: Multiple invalid string literal syntax errors.Lines 49-56 contain multiple string literals using single quotes (
'), which is invalid Solidity syntax. String literals must use double quotes ("). This will cause compilation failures.Apply this diff to fix all string literals:
- encryptionSchemeId: bytes32(keccak256('AES-256-GCM')), + encryptionSchemeId: bytes32(keccak256("AES-256-GCM")), e3Program: 0x7F3E4df648B8Cb96C1D343be976b91B97CaD5c21, decryptionVerifier: 0x4B0D8c2E5f7a6c832f8b16d3aB0e7F5d9E9B24b1, - e3ProgramParams: abi.encode(42, 'testParams'), - customParams: abi.encode('custom_params'), - committeePublicKey: bytes32(keccak256('committee_public_key')), - ciphertextOutput: bytes32(keccak256('encrypted_data')), - plaintextOutput: abi.encode('decrypted_result') + e3ProgramParams: abi.encode(42, "testParams"), + customParams: abi.encode("custom_params"), + committeePublicKey: bytes32(keccak256("committee_public_key")), + ciphertextOutput: bytes32(keccak256("encrypted_data")), + plaintextOutput: abi.encode("decrypted_result")Likely an incorrect or invalid review comment.
docs/pages/write-e3-contract.mdx (1)
26-31: LGTM - documentation formatting improvements.The Solidity code examples have been reformatted consistently and remain syntactically correct.
Also applies to: 52-56, 82-85
crates/evm/tests/fixtures/emit_logs.sol (1)
10-14: Approve formatting changes.The event declaration and function formatting are consistent with the Prettier configuration.
Also applies to: 16-16, 20-28
crates/indexer/tests/fixtures/emit_logs.sol (1)
10-10: Based on my verification, I can now provide the rewritten review comment.
Formatting changes look good. Solidity compilation will be validated automatically by CI.
The Prettier indentation adjustments are consistent with the project's configuration. Since the CI workflow (
ci.yml) installssolcand runscargo test, the Solidity file compilation will be validated automatically during the test execution via thebuild_fixtures.shscript. No manual verification is needed—just ensure the PR passes CI checks.crates/evm-helpers/tests/fixtures/fake_enclave.sol (2)
10-58: LGTM! Formatting changes only.The events, emitter functions, and
getE3function have been reformatted for consistent styling. No functional changes detected.
61-76: Formatting looks good.The
E3struct fields are reformatted without any semantic changes.examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockCRISPProgram.sol (7)
17-96: PR claims formatting-only but this file contains substantial new logic.The PR objective states this is a formatting change (Prettier Solidity plugin), but this file introduces significant new functionality: state variables, mappings, errors, events, constructor validation, and multiple new functions. This inconsistency should be clarified in the PR description.
86-96: Constructor validation looks good.Proper zero-address checks for critical contract dependencies. The enclave is correctly added to
authorizedContracts.
102-108: LGTM!The single-use guard pattern is correctly implemented.
133-139: LGTM!Authorization and re-initialization guards are properly implemented.
141-148: LGTM!The empty data check and decoding logic are appropriate. Note that
abi.decodewill revert naturally if the data format doesn't match the expected tuple structure.
192-203: LGTM!The existence check and journal construction appear correct. The function properly reverts via the verifier if proof verification fails.
209-215: LGTM!The encoding correctly places length prefix and hash bytes at 4-byte intervals, matching the expected RISC Zero journal format. Each encoded segment uses exactly 132 bytes.
14b8151 to
308253c
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockCRISPProgram.sol (1)
154-186: Potential underflow iftally.length < 56.This issue was previously identified: if the decoded
tallyarray has fewer than 56 elements (2 ×HALF_LARGEST_MINIMUM_DEGREE), the subtractions at lines 164-165 will underflow in Solidity versions prior to 0.8.0, or revert due to automatic overflow checking in 0.8.0+.Add a bounds check before computing the indices:
uint256[] memory tally = abi.decode(e3.plaintextOutput, (uint256[])); + require(tally.length >= HALF_LARGEST_MINIMUM_DEGREE * 2, "Tally too short"); uint256 halfD = tally.length / 2;
🧹 Nitpick comments (2)
templates/default/contracts/MyProgram.sol (2)
22-24: Consider making constructor-set variablesimmutable.
enclave,verifier, andimageIdare only assigned in the constructor and never modified. Declaring them asimmutablesaves gas on reads and signals intent.- IEnclave public enclave; - IRiscZeroVerifier public verifier; - bytes32 public imageId; + IEnclave public immutable enclave; + IRiscZeroVerifier public immutable verifier; + bytes32 public immutable imageId;
106-111: Minor: Inline the offset for clarity.The
startIndex += 4modifies a local copy, which works but is slightly confusing. Consider inlining the offset in the loop for clarity.function encodeLengthPrefixAndHash(bytes memory journal, uint256 startIndex, bytes32 hashVal) internal pure { journal[startIndex] = 0x20; - startIndex += 4; for (uint256 i = 0; i < 32; i++) { - journal[startIndex + i * 4] = hashVal[i]; + journal[startIndex + 4 + i * 4] = hashVal[i]; } }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
.prettierrc.json(1 hunks)crates/evm-helpers/tests/fixtures/emit_logs.sol(1 hunks)crates/evm-helpers/tests/fixtures/fake_enclave.sol(1 hunks)crates/evm/tests/fixtures/emit_logs.sol(1 hunks)crates/indexer/tests/fixtures/emit_logs.sol(1 hunks)crates/indexer/tests/fixtures/fake_enclave.sol(1 hunks)crates/support/contracts/ImageID.sol(1 hunks)crates/support/tests/Elf.sol(1 hunks)docs/pages/building-with-enclave.mdx(3 hunks)docs/pages/computation-flow.mdx(2 hunks)docs/pages/write-e3-contract.mdx(3 hunks)examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol(2 hunks)examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockCRISPProgram.sol(1 hunks)examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.sol(1 hunks)examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockRISC0Verifier.sol(1 hunks)examples/CRISP/packages/crisp-contracts/contracts/Mocks/RiscZeroGroth16Verifier.sol(1 hunks)package.json(1 hunks)templates/default/contracts/Mocks/MockRISC0Verifier.sol(1 hunks)templates/default/contracts/MyProgram.sol(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol
- crates/support/contracts/ImageID.sol
🚧 Files skipped from review as they are similar to previous changes (9)
- docs/pages/computation-flow.mdx
- templates/default/contracts/Mocks/MockRISC0Verifier.sol
- crates/indexer/tests/fixtures/emit_logs.sol
- crates/support/tests/Elf.sol
- crates/evm-helpers/tests/fixtures/fake_enclave.sol
- crates/evm-helpers/tests/fixtures/emit_logs.sol
- package.json
- crates/evm/tests/fixtures/emit_logs.sol
- crates/indexer/tests/fixtures/fake_enclave.sol
🧰 Additional context used
🧠 Learnings (9)
📚 Learning: 2025-11-12T10:08:30.720Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 996
File: examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol:144-169
Timestamp: 2025-11-12T10:08:30.720Z
Learning: In the CRISP program (examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol), there are plans to move the merkle tree from the Enclave contract to the program contract itself in the future, which would allow direct calls to validateInput to be stored in the merkle tree.
Applied to files:
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.solexamples/CRISP/packages/crisp-contracts/contracts/Mocks/MockCRISPProgram.soldocs/pages/building-with-enclave.mdxtemplates/default/contracts/MyProgram.sol
📚 Learning: 2024-10-01T02:51:17.718Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 119
File: packages/evm/contracts/test/MockE3Program.sol:15-17
Timestamp: 2024-10-01T02:51:17.718Z
Learning: In mock contracts used for testing, it's acceptable for functions to lack access control since they do not pose security risks.
Applied to files:
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.solexamples/CRISP/packages/crisp-contracts/contracts/Mocks/MockRISC0Verifier.sol
📚 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/contracts/Mocks/MockEnclave.soltemplates/default/contracts/MyProgram.sol
📚 Learning: 2024-10-08T19:45:18.209Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: packages/ciphernode/sortition/src/distance.rs:1-1
Timestamp: 2024-10-08T19:45:18.209Z
Learning: In `packages/ciphernode/core/src/events.rs`, the import statements use the correct and updated `alloy::primitives` module.
Applied to files:
docs/pages/building-with-enclave.mdx
📚 Learning: 2025-09-19T11:16:53.825Z
Learnt from: cedoor
Repo: gnosisguild/enclave PR: 752
File: packages/enclave-contracts/contracts/Enclave.sol:15-17
Timestamp: 2025-09-19T11:16:53.825Z
Learning: The Enclave contract in the gnosisguild/enclave repository has not been deployed yet as of September 2025, so storage layout considerations for upgradeable contracts don't apply to current changes.
Applied to files:
docs/pages/building-with-enclave.mdx
📚 Learning: 2024-11-05T06:49:46.285Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/enclave_node/src/datastore.rs:14-16
Timestamp: 2024-11-05T06:49:46.285Z
Learning: In `packages/ciphernode/enclave_node/src/datastore.rs`, for internal functions like `get_in_mem_store`, adding extensive documentation and error handling may not be necessary if they are not client-facing.
Applied to files:
docs/pages/building-with-enclave.mdx
📚 Learning: 2024-11-05T06:48:58.177Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/config/src/app_config.rs:13-21
Timestamp: 2024-11-05T06:48:58.177Z
Learning: In the `packages/ciphernode/config/src/app_config.rs` file, for the `Contract` enum, the team prefers to use `String` type for `address` fields, relying on parsing to handle validation, instead of using the `Address` type.
Applied to files:
docs/pages/building-with-enclave.mdx
📚 Learning: 2024-11-05T06:56:49.157Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/enclave_node/src/aggregator.rs:0-0
Timestamp: 2024-11-05T06:56:49.157Z
Learning: `RegistryFilterSol` does not have a reader and does not require a repository reader or deploy block when calling `RegistryFilterSol::attach` in `packages/ciphernode/enclave_node/src/aggregator.rs`.
Applied to files:
docs/pages/building-with-enclave.mdx
📚 Learning: 2024-10-22T03:39:29.448Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/evm/src/enclave_sol_reader.rs:87-89
Timestamp: 2024-10-22T03:39:29.448Z
Learning: In the `ciphernode` project, specifically in `packages/ciphernode/evm/src/enclave_sol_reader.rs`, the method `EnclaveSolReader::attach` should be retained even if it directly calls `EvmEventReader::attach` without additional processing. Avoid suggesting its removal in future reviews.
Applied to files:
docs/pages/building-with-enclave.mdx
⏰ 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: build_enclave_cli
- GitHub Check: test_net
- GitHub Check: test_contracts
- GitHub Check: build_sdk
- GitHub Check: integration_prebuild
- GitHub Check: crisp_rust_unit
- GitHub Check: rust_integration
- GitHub Check: rust_unit
- GitHub Check: Build & Push Image
🔇 Additional comments (14)
.prettierrc.json (1)
12-25: LGTM! Prettier Solidity plugin configuration is correct.The addition of the Prettier Solidity plugin and the override for
.solfiles to use double quotes aligns with Solidity's syntax requirements for string literals.examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockRISC0Verifier.sol (1)
8-13: LGTM! Formatting changes applied consistently.The formatting adjustments to import statements and function signatures align with the Prettier Solidity plugin configuration. No functional changes detected.
examples/CRISP/packages/crisp-contracts/contracts/Mocks/RiscZeroGroth16Verifier.sol (1)
8-12: LGTM! Formatting changes applied consistently.Import statement spacing and constructor indentation have been adjusted to match the configured Prettier standards. No functional changes.
examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockEnclave.sol (1)
8-37: LGTM! Formatting changes applied correctly.The formatting adjustments to import statements, indentation, and multi-line return statements align with the Prettier Solidity plugin configuration. The string literals correctly use double quotes as required by Solidity syntax.
docs/pages/building-with-enclave.mdx (3)
22-36: LGTM! Documentation code examples formatted consistently.The state variable declarations have been reformatted for consistency with the Prettier Solidity plugin standards.
124-124: LGTM! Function signature formatted consistently.The
validateInputfunction signature has been reformatted to a single line, consistent with Prettier formatting.
140-146: LGTM! Event declarations formatted consistently.The event declarations have been reformatted to single-line format, aligning with the Prettier Solidity plugin configuration.
docs/pages/write-e3-contract.mdx (3)
26-31: LGTM! Function signature formatted consistently.The
validatefunction signature has been reformatted to align with the Prettier Solidity plugin standards.
52-56: LGTM! Function signature formatted consistently.The
verifyfunction signature has been reformatted to match Prettier formatting conventions.
82-85: LGTM! Code example formatted consistently.The indentation and formatting of the
validateInputexample function body align with the configured Prettier standards.templates/default/contracts/MyProgram.sol (3)
57-65: LGTM!The validation logic correctly checks authorization, prevents re-initialization, stores the params hash, and initializes the input tree.
89-100: LGTM!The verification logic correctly validates E3 existence, constructs the journal with the expected encoding, and delegates to the RISC Zero verifier.
71-83: Add access control tovalidateInputor clarify the security model.The
validateInputfunction lacks authorization checks whilevalidate()strictly restricts access toauthorizedContractsorowner(). SincevalidateInputmodifies state (inserting into the input tree), it should either enforce similar access control or document why it's intentionally open. Additionally, thesenderparameter is unused despite being passed and documented—consider whether it should be used for validation logic as the interface suggests.examples/CRISP/packages/crisp-contracts/contracts/Mocks/MockCRISPProgram.sol (1)
192-203: Invalid syntax: custom errors cannot be used withrequire().Line 193 uses a custom error with
require(), which is invalid Solidity syntax.Apply this diff to fix the syntax:
function verify(uint256 e3Id, bytes32 ciphertextOutputHash, bytes memory proof) external view override returns (bool) { - require(paramsHashes[e3Id] != bytes32(0), E3DoesNotExist()); + if (paramsHashes[e3Id] == bytes32(0)) revert E3DoesNotExist(); bytes32 inputRoot = bytes32(votes[e3Id]._root(TREE_DEPTH));⛔ Skipped due to learnings
Learnt from: ctrlc03 Repo: gnosisguild/enclave PR: 766 File: packages/enclave-contracts/contracts/registry/BondingRegistry.sol:320-367 Timestamp: 2025-10-07T09:12:52.812Z Learning: Solidity 0.8.26+ supports using custom errors with require statements in the format `require(condition, CustomError())`. This feature was introduced in 0.8.26 for the IR pipeline and expanded to the legacy pipeline in 0.8.27. Projects using pragma solidity >=0.8.26 (IR) or >=0.8.27 (legacy) can safely use this pattern.
Adds the Prettier Solidity plugin and formats Solidity files across the codebase. Updates
.prettierrc.jsonand formats contract files incrates/,examples/CRISP, andtemplates/for consistent formatting.Summary by CodeRabbit
Chores
Style
New Features
✏️ Tip: You can customize this high-level summary in your review settings.