diff --git a/.env.example b/.env.example index 5ae4798..b3733aa 100644 --- a/.env.example +++ b/.env.example @@ -47,6 +47,7 @@ MINIMUM_PROPOSER_VOTING_POWER="1" # Micro committee COMMITTEE_SIZE="0" +# Insecure params (testing only) +PARAM_SET="0" -CRISP_PROGRAM_PARAMS="0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000ffffee0010000000000000000000000000000000000000000000000000000000ffffc400100000000000000000000000000000000000000000000000000000000000000013300000000000000000000000000000000000000000000000000000000000000" COMPUTE_PROVIDER_PARAMS="0x7b226e616d65223a225249534330222c22706172616c6c656c223a66616c73652c2262617463685f73697a65223a347d" \ No newline at end of file diff --git a/script/DeploySimple.s.sol b/script/DeploySimple.s.sol index b69821b..1746d13 100644 --- a/script/DeploySimple.s.sol +++ b/script/DeploySimple.s.sol @@ -124,8 +124,8 @@ contract CrispVotingScript is Script { token: address(0), enclave: crispEnvVariables.enclave, committeeSize: crispEnvVariables.committeeSize, + paramSet: crispEnvVariables.paramSet, crispProgramAddress: crispEnvVariables.crispProgramAddress, - crispProgramParams: crispEnvVariables.crispProgramParams, computeProviderParams: crispEnvVariables.computeProviderParams }); } diff --git a/script/Utils.sol b/script/Utils.sol index 8b0cb90..3dbde54 100644 --- a/script/Utils.sol +++ b/script/Utils.sol @@ -21,7 +21,7 @@ library Utils { ICrispVoting.VotingSettings votingSettings; IPlugin.TargetConfig targetConfig; IEnclave.CommitteeSize committeeSize; - bytes crispProgramParams; + uint8 paramSet; bytes computeProviderParams; } @@ -38,8 +38,8 @@ library Utils { }); crispEnvVariables.targetConfig = defaultTargetConfig; crispEnvVariables.committeeSize = IEnclave.CommitteeSize(uint8(VM.envUint("COMMITTEE_SIZE"))); - crispEnvVariables.crispProgramParams = VM.envBytes("CRISP_PROGRAM_PARAMS"); crispEnvVariables.computeProviderParams = VM.envBytes("COMPUTE_PROVIDER_PARAMS"); + crispEnvVariables.paramSet = uint8(VM.envUint("PARAM_SET")); } function getGovernanceTokenAndMintSettings() diff --git a/src/CrispVoting.sol b/src/CrispVoting.sol index 4afc1f0..6f1bed3 100644 --- a/src/CrispVoting.sol +++ b/src/CrispVoting.sol @@ -59,10 +59,10 @@ contract CrispVoting is PluginUUPSUpgradeable, ProposalUpgradeable, ICrispVoting /// @notice The ciphernode threshold IEnclave.CommitteeSize private committeeSize; + /// @notice The parameter set to use + uint8 private paramSet; /// @notice The address of the E3 Program address private crispProgramAddress; - /// @notice The ABI encoded program parameters - bytes private crispProgramParams; /// @notice The ABI encoded compute provider parameters bytes private computeProviderParams; @@ -85,8 +85,8 @@ contract CrispVoting is PluginUUPSUpgradeable, ProposalUpgradeable, ICrispVoting votingToken = IVotesUpgradeable(_params.token); enclaveFeeToken = IERC20(enclave.feeToken()); committeeSize = _params.committeeSize; + paramSet = _params.paramSet; crispProgramAddress = _params.crispProgramAddress; - crispProgramParams = _params.crispProgramParams; computeProviderParams = _params.computeProviderParams; } @@ -152,7 +152,7 @@ contract CrispVoting is PluginUUPSUpgradeable, ProposalUpgradeable, ICrispVoting computeProviderParams: computeProviderParams, customParams: customParams, proofAggregationEnabled: false, - paramSet: 0 + paramSet: paramSet }); // calculate the E3 fee diff --git a/src/ICrispVoting.sol b/src/ICrispVoting.sol index e77b940..af14d35 100644 --- a/src/ICrispVoting.sol +++ b/src/ICrispVoting.sol @@ -73,6 +73,7 @@ interface ICrispVoting { /// @param token The token contract address /// @param enclave The enclave contract address /// @param committeeSize The size of the committee. + /// @param paramSet The parameter set to use. /// @param e3Program The address of the E3 Program. /// @param e3ProgramParams The ABI encoded computation parameters. struct PluginInitParams { @@ -80,8 +81,8 @@ interface ICrispVoting { address token; address enclave; IEnclave.CommitteeSize committeeSize; + uint8 paramSet; address crispProgramAddress; - bytes crispProgramParams; bytes computeProviderParams; } diff --git a/src/IPkVerifier.sol b/src/IPkVerifier.sol index 41c8561..f4d38d5 100644 --- a/src/IPkVerifier.sol +++ b/src/IPkVerifier.sol @@ -16,8 +16,5 @@ interface IPkVerifier { /// @param foldProof ABI-encoded fold proof (bytes, bytes32[]) or empty to skip. /// @return pkCommitment The aggregate public key commitment (last public input). /// @dev Reverts if the proof is invalid. - function verify( - bytes memory proof, - bytes memory foldProof - ) external view returns (bytes32 pkCommitment); + function verify(bytes memory proof, bytes memory foldProof) external view returns (bytes32 pkCommitment); } diff --git a/test/builders/SimpleBuilder.sol b/test/builders/SimpleBuilder.sol index 9956ad9..9c11dc8 100644 --- a/test/builders/SimpleBuilder.sol +++ b/test/builders/SimpleBuilder.sol @@ -61,8 +61,6 @@ contract SimpleBuilder is TestBase { address crispProgramAddress = 0x0b75A4d93c686103a903091a91C869aD9ad9CB7B; address enclaveAddress = 0x95bC90fcb37684bfbAA3ffA2CbF4067fA404c4AA; - bytes memory crispProgramParams = - "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000ffffee0010000000000000000000000000000000000000000000000000000000ffffc400100000000000000000000000000000000000000000000000000000000000000013300000000000000000000000000000000000000000000000000000000000000"; bytes memory computeProviderParams = "0x7b226e616d65223a225249534330222c22706172616c6c656c223a66616c73652c2262617463685f73697a65223a347d"; @@ -72,7 +70,7 @@ contract SimpleBuilder is TestBase { enclave: enclaveAddress, committeeSize: committeeSize, crispProgramAddress: crispProgramAddress, - crispProgramParams: crispProgramParams, + paramSet: 0, computeProviderParams: computeProviderParams }); diff --git a/test/crispVoting.t.sol b/test/crispVoting.t.sol index 2a36a72..9fc2d16 100644 --- a/test/crispVoting.t.sol +++ b/test/crispVoting.t.sol @@ -20,8 +20,6 @@ contract MyPluginTest is TestBase { address crispProgramAddress = 0x67d269191c92Caf3cD7723F116c85e6E9bf55933; address enclaveAddress = 0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0; - bytes crispProgramParams = - "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000ffffee0010000000000000000000000000000000000000000000000000000000ffffc400100000000000000000000000000000000000000000000000000000000000000013300000000000000000000000000000000000000000000000000000000000000"; bytes computeProviderParams = "0x7b226e616d65223a225249534330222c22706172616c6c656c223a66616c73652c2262617463685f73697a65223a347d"; @@ -31,7 +29,7 @@ contract MyPluginTest is TestBase { enclave: enclaveAddress, committeeSize: IEnclave.CommitteeSize(0), crispProgramAddress: crispProgramAddress, - crispProgramParams: crispProgramParams, + paramSet: 0, computeProviderParams: computeProviderParams }); diff --git a/test/fork-tests/crisp.t.sol b/test/fork-tests/crisp.t.sol index 65aeb68..10fa03b 100644 --- a/test/fork-tests/crisp.t.sol +++ b/test/fork-tests/crisp.t.sol @@ -21,8 +21,6 @@ contract MyPluginTestFork is TestBase { address enclaveAddress = 0x95bC90fcb37684bfbAA3ffA2CbF4067fA404c4AA; address enclaveFeeToken = 0x80C5504A6704359C40B88777b1639096d3453804; - bytes crispProgramParams = - "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000ffffee0010000000000000000000000000000000000000000000000000000000ffffc400100000000000000000000000000000000000000000000000000000000000000013300000000000000000000000000000000000000000000000000000000000000"; bytes computeProviderParams = "0x7b226e616d65223a225249534330222c22706172616c6c656c223a66616c73652c2262617463685f73697a65223a347d"; @@ -32,7 +30,7 @@ contract MyPluginTestFork is TestBase { enclave: enclaveAddress, committeeSize: IEnclave.CommitteeSize(0), crispProgramAddress: crispProgramAddress, - crispProgramParams: crispProgramParams, + paramSet: 0, computeProviderParams: computeProviderParams });