-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sepolia deployment #127
Sepolia deployment #127
Conversation
WalkthroughThe pull request introduces several changes, including the addition of a directory to the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (2)
packages/evm/deployments/sepolia/MockInputValidator.json (2)
1-33
: LGTM! Consider adding a comment for the 'sender' parameter.The contract address and ABI look correct. The 'validate' function is properly defined as 'pure', which is appropriate for a validation function that doesn't modify state.
Consider adding a comment for the unused 'sender' parameter in the ABI to improve clarity:
{ "inputs": [ { "internalType": "address", - "name": "", + "name": "sender", "type": "address" }, { "internalType": "bytes", "name": "params", "type": "bytes" } ], "name": "validate", ... }
56-69
: Consider adding documentation for better maintainability.While the empty storage layout is consistent with a stateless contract (pure function), the lack of documentation could hinder maintainability and usability.
Consider adding brief documentation to explain the purpose of the contract and its
validate
function. For example:/// @title MockInputValidator /// @notice A mock contract implementing the IInputValidator interface for testing purposes. contract MockInputValidator is IInputValidator { /// @notice Validates the input parameters /// @param sender The address of the sender (unused in this mock implementation) /// @param params The input parameters to validate /// @return input The validated input data /// @return success Whether the validation was successful function validate( address sender, bytes memory params ) external pure returns (bytes memory input, bool success) { // ... (existing implementation) } }Add this documentation to the source Solidity file, then recompile and redeploy the contract to include it in the JSON artifact.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (9)
- packages/evm/.prettierignore (1 hunks)
- packages/evm/deployments/sepolia/CyphernodeRegistryOwnable.json (0 hunks)
- packages/evm/deployments/sepolia/MockComputeProvider.json (1 hunks)
- packages/evm/deployments/sepolia/MockDecryptionVerifier.json (1 hunks)
- packages/evm/deployments/sepolia/MockE3Program.json (1 hunks)
- packages/evm/deployments/sepolia/MockInputValidator.json (1 hunks)
- packages/evm/deployments/sepolia/NaiveRegistryFilter.json (7 hunks)
- packages/evm/deployments/sepolia/solcInputs/d0e6e4f19028714f394c36db62dff2be.json (0 hunks)
- packages/evm/package.json (1 hunks)
💤 Files with no reviewable changes (2)
- packages/evm/deployments/sepolia/CyphernodeRegistryOwnable.json
- packages/evm/deployments/sepolia/solcInputs/d0e6e4f19028714f394c36db62dff2be.json
✅ Files skipped from review due to trivial changes (1)
- packages/evm/package.json
🔇 Additional comments (23)
packages/evm/.prettierignore (1)
12-12
: LGTM: Addition ofdeployments
to .prettierignoreThe addition of the
deployments
directory to the.prettierignore
file is appropriate. This change ensures that Prettier will not attempt to format files within thedeployments
directory, which typically contains auto-generated or environment-specific files that should not be formatted.This change aligns with the PR title "Sepolia deployment", as it's common to exclude deployment-related files from formatting to preserve their specific structure or content.
To ensure this change is consistent with the project structure, let's verify the existence of the
deployments
directory:✅ Verification successful
Verified:
deployments
directory exists and addition to .prettierignore is appropriate.The
deployments
directory is present inpackages/evm/
, and adding it to the.prettierignore
file ensures that deployment-related files remain unformatted by Prettier, preserving their specific structure.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of the deployments directory # Expected result: The deployments directory should exist in the packages/evm directory if [ -d "packages/evm/deployments" ]; then echo "The deployments directory exists in packages/evm/" else echo "Warning: The deployments directory does not exist in packages/evm/" fiLength of output: 146
packages/evm/deployments/sepolia/MockDecryptionVerifier.json (4)
1-33
: Contract address and ABI look good.The contract address is valid, and the ABI correctly defines the
verify
function as per theIDecryptionVerifier
interface. The function signature and itspure
modifier are appropriate for a mock implementation.
66-69
: Empty storage layout is appropriate.The empty storage layout is consistent with the contract's design. As a mock implementation with a
pure
function, it doesn't require any state variables.
50-65
: Metadata and bytecode are properly included.The contract uses a recent Solidity version (0.8.27) with optimizations enabled, which is good for security and gas efficiency. The metadata includes references to the source files, aiding in contract verification.
To ensure transparency and allow users to interact with the verified contract on Etherscan, please verify the contract on Sepolia Etherscan using the provided bytecode and ABI. You can use the following script to check if the contract is already verified:
#!/bin/bash # Description: Check if the contract is verified on Sepolia Etherscan # Test: Use curl to check the contract's verification status curl -s "https://api-sepolia.etherscan.io/api?module=contract&action=getabi&address=0x81C00a1FD136a49FBBD8e692817b97ecB8BC2Ca8" | grep -q "Contract source code not verified" if [ $? -eq 0 ]; then echo "Contract is not verified on Sepolia Etherscan" else echo "Contract is already verified on Sepolia Etherscan" fi
34-49
: Deployment transaction details are valid.The contract deployment was successful (status: 1) and the gas usage (103,723) seems reasonable for a simple contract.
Please verify that the deployer address (0x485E60C486671E932fd9C53d4110cdEab1E7F0eb) is an authorized account for deploying contracts on the Sepolia testnet. Run the following script to check if there are any other contracts deployed by this address:
✅ Verification successful
Deployment transaction details are verified.
The deployer address (
0x485E60C486671E932fd9C53d4110cdEab1E7F0eb
) is authorized for deploying contracts on the Sepolia testnet, as evidenced by its consistent use across multiple deployment configurations.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for other contracts deployed by the same address # Test: Search for other deployment files with the same deployer address grep -r "0x485E60C486671E932fd9C53d4110cdEab1E7F0eb" packages/evm/deployments/sepolia/*.jsonLength of output: 302
Script:
#!/bin/bash # Description: Verify if the deployer address has authorization in the codebase # Test: Search for the deployer address in authorization and access control configurations grep -r "0x485E60C486671E932fd9C53d4110cdEab1E7F0eb" packages/evm/config/*.jsonLength of output: 141
Script:
#!/bin/bash # Description: Search for the deployer address in all JSON configuration files within the codebase rg "0x485E60C486671E932fd9C53d4110cdEab1E7F0eb" --type jsonLength of output: 1179
packages/evm/deployments/sepolia/MockInputValidator.json (2)
34-49
: Transaction details look good.The deployment transaction was successful, and the gas usage seems reasonable for a simple contract. All necessary details are present and consistent.
54-55
: Bytecode and deployed bytecode look good.The presence of both bytecode and deployed bytecode is excellent for verification purposes. Their length is appropriate for a compiled smart contract.
packages/evm/deployments/sepolia/MockComputeProvider.json (3)
71-74
: LGTM! Empty storage layout is appropriate.The empty storage layout is consistent with the contract's purpose as a mock compute provider with only pure functions.
1-38
: LGTM! Verify contract address on Sepolia explorer.The contract address and ABI look correct. The
validate
function is properly defined with the expected parameters and return type.To ensure the contract is deployed correctly, run the following script:
39-57
: LGTM! Verify transaction details on Sepolia explorer.The transaction details indicate a successful deployment with reasonable gas usage.
To confirm the transaction details, run the following script:
packages/evm/deployments/sepolia/MockE3Program.json (9)
4-14
: Constructor looks goodThe constructor is correctly defined to initialize the contract with an
IInputValidator
address. This allows for flexible configuration of the input validator upon deployment.
15-30
: Error definition is appropriateThe
invalidParams
error is well-defined, taking twobytes
parameters. This allows for detailed error reporting when input validation fails, which is a good practice for smart contract development.
31-43
: Constant function is well-definedThe
ENCRYPTION_SCHEME_ID
function is correctly defined as a view function returning abytes32
. This is an appropriate way to expose a constant value representing the encryption scheme used by the contract.
57-124
: Core functions are correctly implementedThe
validate
andverify
functions are correctly defined according to theIE3Program
interface:
validate
: A view function that takes the required parameters and returns the encryption scheme ID and input validator.verify
: A pure function that takes the required parameters and returns a boolean indicating success.These implementations allow for proper validation and verification of E3 program inputs and outputs.
160-178
: Storage layout is appropriateThe contract's storage layout is simple and appropriate:
- It has a single storage variable
storageInputValidator
of typeIInputValidator
.- The storage slot and offset are correctly specified.
This layout is consistent with the contract's functionality and allows for efficient storage of the input validator address.
2-2
: Verify the contract address on SepoliaThe contract is deployed at address
0xD56AA6F5224181c243F7FCe8b04fE84c4dff8356
on the Sepolia testnet.To confirm the deployment, run the following script:
#!/bin/bash # Description: Verify the contract deployment on Sepolia # Test: Check if the contract exists on Sepolia gh api \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/samepant/packages/evm/contents/deployments/sepolia/MockE3Program.json | jq -r '.content' | base64 --decode | jq -r '.address' | xargs -I {} curl -s https://api-sepolia.etherscan.io/api?module=proxy&action=eth_getCode&address={}&tag=latest | jq -r '.result'
126-144
: Verify the input validator addressThe contract was successfully deployed to Sepolia testnet with the following details:
- Deployer:
0x485E60C486671E932fd9C53d4110cdEab1E7F0eb
- Input validator:
0x5886DA898774c6036B0957db10d1FdA979Ae42da
Please verify that the input validator address is correct and corresponds to a valid
IInputValidator
contract on Sepolia.To check the input validator contract, run:
#!/bin/bash # Description: Verify the input validator contract # Test: Check if the input validator contract exists and has the expected interface INPUT_VALIDATOR="0x5886DA898774c6036B0957db10d1FdA979Ae42da" curl -s https://api-sepolia.etherscan.io/api?module=proxy&action=eth_getCode&address=$INPUT_VALIDATOR&tag=latest | jq -r '.result' | grep -q '0x0' && echo "Warning: No contract at address" || echo "Contract found at address" # Check for the validate function signature in the bytecode curl -s https://api-sepolia.etherscan.io/api?module=proxy&action=eth_getCode&address=$INPUT_VALIDATOR&tag=latest | jq -r '.result' | grep -q $(echo -n "validate(address,bytes)" | keccak256sum | cut -d' ' -f1 | cut -c1-8) && echo "validate function found" || echo "Warning: validate function not found"
1-179
: Summary of MockE3Program deployment reviewThe
MockE3Program
contract has been successfully deployed to Sepolia testnet. The deployment file contains all necessary information and the contract implementation appears to be correct. However, there are a few points that require attention:
- Verify the contract address on Sepolia to ensure it matches the deployment file.
- Consider adding access control to the
setInputValidator
function to prevent unauthorized changes.- Verify that the input validator address (
0x5886DA898774c6036B0957db10d1FdA979Ae42da
) is correct and corresponds to a validIInputValidator
contract on Sepolia.Please address these points to ensure the security and correct functionality of the deployed contract.
To perform a final verification of the contract, run:
#!/bin/bash # Description: Final verification of MockE3Program contract # Test: Verify contract bytecode matches the deployment file CONTRACT_ADDRESS="0xD56AA6F5224181c243F7FCe8b04fE84c4dff8356" DEPLOYED_BYTECODE=$(jq -r '.deployedBytecode' packages/evm/deployments/sepolia/MockE3Program.json) ONCHAIN_BYTECODE=$(curl -s https://api-sepolia.etherscan.io/api?module=proxy&action=eth_getCode&address=$CONTRACT_ADDRESS&tag=latest | jq -r '.result') if [ "$DEPLOYED_BYTECODE" = "$ONCHAIN_BYTECODE" ]; then echo "Contract bytecode matches the deployment file" else echo "Warning: Contract bytecode does not match the deployment file" fi # Test: Check if ENCRYPTION_SCHEME_ID is correctly set ENCRYPTION_SCHEME_ID=$(echo -n "fhe.rs:BFV" | keccak256sum | cut -d' ' -f1) curl -s https://api-sepolia.etherscan.io/api?module=proxy&action=eth_call&to=$CONTRACT_ADDRESS&data=0x78d89187&tag=latest | jq -r '.result' | grep -q $ENCRYPTION_SCHEME_ID && echo "ENCRYPTION_SCHEME_ID is correctly set" || echo "Warning: ENCRYPTION_SCHEME_ID mismatch"
44-56
:⚠️ Potential issueConsider adding access control to
setInputValidator
The
setInputValidator
function allows updating the input validator address after deployment. However, there's no access control specified in the ABI. Consider adding an access control modifier (e.g.,onlyOwner
) to prevent unauthorized changes to the input validator.To check if access control is implemented in the contract code, run:
packages/evm/deployments/sepolia/NaiveRegistryFilter.json (4)
129-158
: New function added:getCommittee
A new function
getCommittee
has been added to retrieve the full Committee struct. This is a useful addition that provides more detailed information about a committee.Consider updating the documentation to include information about this new function and its usage.
334-334
:⚠️ Potential issueConstructor argument changed
The constructor's second parameter has changed:
- Name changed from
_enclave
to_registry
- Value changed to
0x54A68fAb10E5Ba79Bf0aB155463Bf01cD758cB35
This change suggests a shift in the contract's interaction model, possibly now working with a registry instead of an enclave.
Please ensure that:
- The new
_registry
parameter is correctly used throughout the contract.- The provided address (
0x54A68fAb10E5Ba79Bf0aB155463Bf01cD758cB35
) is the correct registry contract address.- Any documentation or comments referencing the old
_enclave
parameter are updated.Run the following command to verify the usage of the new registry address:
#!/bin/bash # Search for references to the new registry address rg '0x54A68fAb10E5Ba79Bf0aB155463Bf01cD758cB35'
338-338
:⚠️ Potential issueCompiler version updated and bytecode changed
The compiler version has been updated from 0.8.26 to 0.8.27, and the contract's bytecode has changed significantly.
Please ensure that:
- The new bytecode has been properly audited and tested.
- All tests pass with the new contract deployment.
- The changes introduced by the new compiler version have been reviewed for any potential impacts.
Run the following command to verify the compiler version:
#!/bin/bash # Verify the Solidity compiler version used in the project rg --type solidity 'pragma solidity' | sort -u
2-2
:⚠️ Potential issueContract address has changed
The NaiveRegistryFilter contract has been redeployed with a new address:
0x3fC4f037355b23bBE12F9F453E81961669562F47
.Please ensure that all references to the old contract address (
0x4c19b2b2cE63129B494Cb0b0eCa4a2f761C649D6
) are updated throughout the project. Run the following script to check for any remaining references to the old address:✅ Verification successful
Old contract address not found
No remaining references to the old contract address (
0x4c19b2b2cE63129B494Cb0b0eCa4a2f761C649D6
) were detected in the project.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for the old contract address in the project rg --type-not json '0x4c19b2b2cE63129B494Cb0b0eCa4a2f761C649D6'Length of output: 175
Script:
#!/bin/bash # Search for the old contract address in all files except JSON rg '0x4c19b2b2cE63129B494Cb0b0eCa4a2f761C649D6' --type-not jsonLength of output: 63
"args": [], | ||
"numDeployments": 1, | ||
"solcInputHash": "21fe30cc06e4cb96958a78cd2e5aab1b", | ||
"metadata": "{\"compiler\":{\"version\":\"0.8.27+commit.40a35a09\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"params\",\"type\":\"bytes\"}],\"name\":\"validate\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"},{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/test/MockInputValidator.sol\":\"MockInputValidator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[],\"viaIR\":true},\"sources\":{\"contracts/interfaces/IInputValidator.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.27;\\n\\ninterface IInputValidator {\\n /// @notice This function should be called by the Enclave contract to validate the input parameters.\\n /// @param params ABI encoded input parameters.\\n /// @return input The input data to be published.\\n /// @return success Whether the input parameters are valid.\\n function validate(\\n address sender,\\n bytes memory params\\n ) external returns (bytes memory input, bool success);\\n}\\n\",\"keccak256\":\"0xb36d367543af680b61d0ce6b2a28045f3e8fae5753e8f6ba245752609ff2bb4a\",\"license\":\"LGPL-3.0-only\"},\"contracts/test/MockInputValidator.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.27;\\n\\nimport { IInputValidator } from \\\"../interfaces/IInputValidator.sol\\\";\\n\\ncontract MockInputValidator is IInputValidator {\\n function validate(\\n address,\\n bytes memory params\\n ) external pure returns (bytes memory input, bool success) {\\n input = params;\\n\\n if (input.length == 3) {\\n success = false;\\n } else {\\n success = true;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5cc01d27a2ee82ed07350b0a801146d831f9d63af9771989fb66600745d4287d\",\"license\":\"LGPL-3.0-only\"}},\"version\":1}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
ETHERSCAN_API_KEY Missing from GitHub Secrets
The ETHERSCAN_API_KEY
is not set in GitHub Secrets, which prevents the verification of the contract on Etherscan. Please add the ETHERSCAN_API_KEY
to GitHub Secrets to enable contract verification.
🔗 Analysis chain
Deployment info looks good. Verify contract on Etherscan.
The deployment information is consistent with the contract's simplicity. No constructor arguments were needed.
To ensure transparency and ease of interaction, verify the contract on Etherscan using the provided metadata. Run the following script to check if the contract is already verified:
If the script returns "0", the contract is not verified. In that case, please verify the contract on Etherscan using the provided metadata.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the contract is verified on Etherscan
# Test: Check contract verification status
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/OWNER/REPO/actions/secrets/ETHERSCAN_API_KEY | jq -r .name
if [ $? -eq 0 ]; then
ETHERSCAN_API_KEY=$(gh secret get ETHERSCAN_API_KEY)
curl -s "https://api-sepolia.etherscan.io/api?module=contract&action=getabi&address=0x5886DA898774c6036B0957db10d1FdA979Ae42da&apikey=$ETHERSCAN_API_KEY" | jq -r '.status'
else
echo "Error: ETHERSCAN_API_KEY not found in GitHub Secrets"
fi
Length of output: 556
Script:
#!/bin/bash
# Description: Verify if ETHERSCAN_API_KEY is set in GitHub Secrets
# List all secrets and search for ETHERSCAN_API_KEY
gh secret list | grep -w 'ETHERSCAN_API_KEY'
if [ $? -eq 0 ]; then
echo "ETHERSCAN_API_KEY is set in GitHub Secrets."
else
echo "Error: ETHERSCAN_API_KEY is not set in GitHub Secrets."
fi
Length of output: 333
"metadata": "{\"compiler\":{\"version\":\"0.8.27+commit.40a35a09\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"invalidParams\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"params\",\"type\":\"bytes\"}],\"name\":\"validate\",\"outputs\":[{\"internalType\":\"contract IDecryptionVerifier\",\"name\":\"decryptionVerifier\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/test/MockComputeProvider.sol\":\"MockComputeProvider\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[],\"viaIR\":true},\"sources\":{\"contracts/interfaces/IComputeProvider.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.27;\\n\\nimport { IDecryptionVerifier } from \\\"./IDecryptionVerifier.sol\\\";\\n\\ninterface IComputeProvider {\\n /// @notice This function should be called by the Enclave contract to validate the compute provider parameters.\\n /// @param params ABI encoded compute provider parameters.\\n function validate(\\n uint256 e3Id,\\n uint256 seed,\\n bytes calldata params\\n ) external returns (IDecryptionVerifier decryptionVerifier);\\n}\\n\",\"keccak256\":\"0x265fea4a55770649aca73fbf4d7ccc01ba654565ec18247597b73d36dac27fe1\",\"license\":\"LGPL-3.0-only\"},\"contracts/interfaces/IDecryptionVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.27;\\n\\ninterface IDecryptionVerifier {\\n /// @notice This function should be called by the Enclave contract to verify the\\n /// decryption of output of a computation.\\n /// @param e3Id ID of the E3.\\n /// @param plaintextOutputHash The keccak256 hash of the plaintext output to be verified.\\n /// @param proof ABI encoded proof of the given output hash.\\n /// @return success Whether or not the plaintextOutputHash was successfully verified.\\n function verify(\\n uint256 e3Id,\\n bytes32 plaintextOutputHash,\\n bytes memory proof\\n ) external view returns (bool success);\\n}\\n\",\"keccak256\":\"0xb92991a581d3c18cdc273497687ec1c6e3016674314f21fe56917aece5d10863\",\"license\":\"LGPL-3.0-only\"},\"contracts/test/MockComputeProvider.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.27;\\n\\nimport {\\n IComputeProvider,\\n IDecryptionVerifier\\n} from \\\"../interfaces/IComputeProvider.sol\\\";\\n\\ncontract MockComputeProvider is IComputeProvider {\\n error invalidParams();\\n\\n function validate(\\n uint256,\\n uint256,\\n bytes memory params\\n ) external pure returns (IDecryptionVerifier decryptionVerifier) {\\n require(params.length == 32, invalidParams());\\n // solhint-disable no-inline-assembly\\n assembly {\\n decryptionVerifier := mload(add(params, 32))\\n }\\n (decryptionVerifier) = abi.decode(params, (IDecryptionVerifier));\\n }\\n}\\n\",\"keccak256\":\"0x129807f1fc79c9cdd1fff120a39f91f8d31826ac9a6fe4e2d714c5ee1bd367aa\",\"license\":\"LGPL-3.0-only\"}},\"version\":1}", | ||
"bytecode": "0x6080806040523460155761015d908161001b8239f35b600080fdfe6080604052600436101561001257600080fd5b60003560e01c6323e7fd591461002757600080fd5b346100ea5760603660031901126100ea5760443567ffffffffffffffff81116100ea57366023820112156100ea5780600401359067ffffffffffffffff82116100ef57604051601f8301601f19908116603f0116810167ffffffffffffffff8111828210176100ef5760405282815236602484840101116100ea5760006020846100e69560246100bf96018386013783010152610105565b60405173ffffffffffffffffffffffffffffffffffffffff90911681529081906020820190565b0390f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b602081510361013f576020818051810103126100ea576020015173ffffffffffffffffffffffffffffffffffffffff811681036100ea5790565b63be64db2760e01b60005260046000fdfea164736f6c634300081b000a", | ||
"deployedBytecode": "0x6080604052600436101561001257600080fd5b60003560e01c6323e7fd591461002757600080fd5b346100ea5760603660031901126100ea5760443567ffffffffffffffff81116100ea57366023820112156100ea5780600401359067ffffffffffffffff82116100ef57604051601f8301601f19908116603f0116810167ffffffffffffffff8111828210176100ef5760405282815236602484840101116100ea5760006020846100e69560246100bf96018386013783010152610105565b60405173ffffffffffffffffffffffffffffffffffffffff90911681529081906020820190565b0390f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b602081510361013f576020818051810103126100ea576020015173ffffffffffffffffffffffffffffffffffffffff811681036100ea5790565b63be64db2760e01b60005260046000fdfea164736f6c634300081b000a", | ||
"devdoc": { | ||
"kind": "dev", | ||
"methods": {}, | ||
"version": 1 | ||
}, | ||
"userdoc": { | ||
"kind": "user", | ||
"methods": {}, | ||
"version": 1 | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security consideration: Inline assembly usage.
The contract uses inline assembly in the validate
function. While this can be more gas-efficient, it also introduces potential security risks if not properly implemented and audited.
Consider the following actions:
- Conduct a thorough security audit of the inline assembly code.
- Document the reason for using inline assembly and any associated risks.
- If possible, replace the inline assembly with high-level Solidity code for better readability and maintainability.
"internalType": "bytes32", | ||
"name": "publicKey", | ||
"type": "bytes" | ||
"type": "bytes32" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ABI Change: committees
function return type
The committees
function now returns a bytes32
instead of bytes
for the publicKey
. This change may affect how other contracts or frontend applications interact with this contract.
Please update any code that calls this function to handle the new return type correctly.
"astId": 3290, | ||
"contract": "contracts/registry/NaiveRegistryFilter.sol:NaiveRegistryFilter", | ||
"label": "committees", | ||
"offset": 0, | ||
"slot": "1", | ||
"type": "t_mapping(t_uint256,t_struct(Committee)2138_storage)" | ||
"type": "t_mapping(t_uint256,t_struct(Committee)3283_storage)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storage layout changes
The storage layout has been modified:
- The
committees
mapping now storesstruct(Committee)3283_storage
instead ofbytes
. - The
Committee
struct now usesbytes32
for thepublicKey
instead ofbytes
.
These changes align with the ABI modifications and may have the following implications:
- Improved gas efficiency due to fixed-size storage.
- Potential limitations on public key size (now fixed at 32 bytes).
Please ensure that:
- The new storage layout is compatible with existing data (if any).
- The
bytes32
size is sufficient for storing all possible public keys. - Any code interacting with the storage (e.g., off-chain scripts, frontend) is updated to handle the new structure.
Also applies to: 425-463
Summary by CodeRabbit
New Features
MockComputeProvider
,MockDecryptionVerifier
,MockE3Program
, andMockInputValidator
, enhancing functionality for validation and verification processes.getCommittee
inNaiveRegistryFilter
for improved committee management.Bug Fixes
CyphernodeRegistryOwnable
contract, indicating discontinuation of its functionalities.Chores
0.0.3
to0.0.4
..prettierignore
to include thedeployments
directory.