Skip to content

Commit

Permalink
feat: remove sismo-connect-solidity library dependencies (#43)
Browse files Browse the repository at this point in the history
* feat: started removing library dependencies, fix tested for
SismoConnectVerifier

* fix: tests for HydraS3Verifier + remove libs folder

* feat: remove hardhat folder

* feat: remove libraries from the deployment script

* feat: setup to deploy on base network (#44)

* feat: setup to deploy on base network

* feat: add deployment logs on base-goerli for core contracts

* feat: add deployment logs on base for core contracts

* feat: successfully deployed AddressesProvider contract on Base and
BaseGoerli networks

* feat: remove useless `build` functions for testing purposes libraries
(`AuthBuilder`, `ClaimBuilder` and `ProofBuilder`) + keep remaining as
internals
  • Loading branch information
yum0e authored Sep 7, 2023
1 parent ec6dee5 commit 83913e1
Show file tree
Hide file tree
Showing 48 changed files with 1,189 additions and 4,305 deletions.
69 changes: 0 additions & 69 deletions .hardhat/README.md

This file was deleted.

25 changes: 0 additions & 25 deletions .hardhat/package.json

This file was deleted.

14 changes: 14 additions & 0 deletions deployments/base-goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"availableRootsRegistry": "0x32725B00400b799D41c852b6Fd94604e10cb487F",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x797Dd53c383f7819D54D3aDd6b90c7Ba67E89952",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"rootsOwner": "0x8f9c04d7bA132Fd0CbA124eFCE3936328d217458",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x90a7fe1D98303Af175Cb6BD0564D5a643Ba1a3c5"
}
14 changes: 14 additions & 0 deletions deployments/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"availableRootsRegistry": "0xEB2952A4098e15C97E1Ce126FE479f27E2FFB40c",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x43A6b844f52CB2CC3c9dBcAE9D853B21fF05c4bD",
"hydraS3Verifier": "0x39Fcdd48c8EEaa7B0cB918587C22143fE803fAA2",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"rootsOwner": "0x8f9c04d7bA132Fd0CbA124eFCE3936328d217458",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x94E772DBe3ce4BD32274a2053C444C802Bb836A5"
}
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ libs = ["lib"]
fs_permissions = [{ access = "read-write", path = "./"}]

bytecode_hash="none"
solc_version="0.8.19"

[fmt]
ignore = ["test/libs/SimoConnectLib.t.sol"]
Expand Down
93 changes: 10 additions & 83 deletions script/01_DeployAll.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import "src/periphery/CommitmentMapperRegistry.sol";
import {HydraS3Verifier} from "src/verifiers/HydraS3Verifier.sol";

import {SismoConnectVerifier} from "src/SismoConnectVerifier.sol";
import {AuthRequestBuilder} from "src/libs/utils/AuthRequestBuilder.sol";
import {ClaimRequestBuilder} from "src/libs/utils/ClaimRequestBuilder.sol";
import {SignatureBuilder} from "src/libs/utils/SignatureBuilder.sol";
import {RequestBuilder} from "src/libs/utils/RequestBuilder.sol";
import {DeploymentConfig, BaseDeploymentConfig} from "script/BaseConfig.sol";
import {IAddressesProvider} from "src/periphery/interfaces/IAddressesProvider.sol";

Expand All @@ -24,12 +20,6 @@ contract DeployAll is Script, BaseDeploymentConfig {
HydraS3Verifier hydraS3Verifier;
SismoConnectVerifier sismoConnectVerifier;

// external libraries
AuthRequestBuilder authRequestBuilder;
ClaimRequestBuilder claimRequestBuilder;
SignatureBuilder signatureBuilder;
RequestBuilder requestBuilder;

function runFor(
string memory chainName
) public returns (ScriptTypes.DeployAllContracts memory contracts) {
Expand All @@ -52,30 +42,21 @@ contract DeployAll is Script, BaseDeploymentConfig {
);
sismoConnectVerifier = _deploySismoConnectVerifier(msg.sender);

sismoConnectVerifier.registerVerifier(
hydraS3Verifier.HYDRA_S3_VERSION(),
address(hydraS3Verifier)
);
// only register and transfer ownership if the sismoConnectVerifier contract is not already deployed
if (config.sismoConnectVerifier == address(0)) {
sismoConnectVerifier.registerVerifier(
hydraS3Verifier.HYDRA_S3_VERSION(),
address(hydraS3Verifier)
);

sismoConnectVerifier.transferOwnership(config.owner);
sismoConnectVerifier.transferOwnership(config.owner);
}

contracts.availableRootsRegistry = availableRootsRegistry;
contracts.commitmentMapperRegistry = commitmentMapperRegistry;
contracts.hydraS3Verifier = hydraS3Verifier;
contracts.sismoConnectVerifier = sismoConnectVerifier;

// external libraries

authRequestBuilder = _deployAuthRequestBuilder();
claimRequestBuilder = _deployClaimRequestBuilder();
signatureBuilder = _deploySignatureBuilder();
requestBuilder = _deployRequestBuilder();

contracts.authRequestBuilder = authRequestBuilder;
contracts.claimRequestBuilder = claimRequestBuilder;
contracts.signatureBuilder = signatureBuilder;
contracts.requestBuilder = requestBuilder;

DeploymentConfig memory newDeploymentConfig = DeploymentConfig({
proxyAdmin: config.proxyAdmin,
owner: config.owner,
Expand All @@ -85,11 +66,7 @@ contract DeployAll is Script, BaseDeploymentConfig {
availableRootsRegistry: address(availableRootsRegistry),
commitmentMapperRegistry: address(commitmentMapperRegistry),
hydraS3Verifier: address(hydraS3Verifier),
sismoConnectVerifier: address(sismoConnectVerifier),
authRequestBuilder: address(authRequestBuilder),
claimRequestBuilder: address(claimRequestBuilder),
signatureBuilder: address(signatureBuilder),
requestBuilder: address(requestBuilder)
sismoConnectVerifier: address(sismoConnectVerifier)
});

_saveDeploymentConfig(chainName, newDeploymentConfig);
Expand Down Expand Up @@ -172,6 +149,7 @@ contract DeployAll is Script, BaseDeploymentConfig {
address sismoConnectVerifierAddress = config.sismoConnectVerifier;
if (sismoConnectVerifierAddress != address(0)) {
console.log("Using existing sismoConnectVerifier:", sismoConnectVerifierAddress);
console.log("Be careful to register the new HydraS3Verifier contract if there is one!");
return SismoConnectVerifier(sismoConnectVerifierAddress);
}
SismoConnectVerifier sismoConnectVerifierImplem = new SismoConnectVerifier(owner);
Expand All @@ -186,52 +164,6 @@ contract DeployAll is Script, BaseDeploymentConfig {
return SismoConnectVerifier(address(proxy));
}

// External libraries

function _deployAuthRequestBuilder() private returns (AuthRequestBuilder) {
address authRequestBuilderAddress = config.authRequestBuilder;
if (authRequestBuilderAddress != address(0)) {
console.log("Using existing authrequestBuilder:", authRequestBuilderAddress);
return AuthRequestBuilder(authRequestBuilderAddress);
}
authRequestBuilder = new AuthRequestBuilder();
console.log("authRequestBuilder Deployed:", address(authRequestBuilder));
return authRequestBuilder;
}

function _deployClaimRequestBuilder() private returns (ClaimRequestBuilder) {
address claimRequestBuilderAddress = config.claimRequestBuilder;
if (claimRequestBuilderAddress != address(0)) {
console.log("Using existing claimRequestBuilder:", claimRequestBuilderAddress);
return ClaimRequestBuilder(claimRequestBuilderAddress);
}
claimRequestBuilder = new ClaimRequestBuilder();
console.log("claimRequestBuilder Deployed:", address(claimRequestBuilder));
return claimRequestBuilder;
}

function _deploySignatureBuilder() private returns (SignatureBuilder) {
address signatureBuilderAddress = config.signatureBuilder;
if (signatureBuilderAddress != address(0)) {
console.log("Using existing signatureBuilder:", signatureBuilderAddress);
return SignatureBuilder(signatureBuilderAddress);
}
signatureBuilder = new SignatureBuilder();
console.log("signatureBuilder Deployed:", address(signatureBuilder));
return signatureBuilder;
}

function _deployRequestBuilder() private returns (RequestBuilder) {
address requestBuilderAddress = config.requestBuilder;
if (requestBuilderAddress != address(0)) {
console.log("Using existing requestBuilder:", requestBuilderAddress);
return RequestBuilder(requestBuilderAddress);
}
requestBuilder = new RequestBuilder();
console.log("requestBuilder Deployed:", address(requestBuilder));
return requestBuilder;
}

function run() public returns (ScriptTypes.DeployAllContracts memory contracts) {
string memory chainName = vm.envString("CHAIN_NAME");
return runFor(chainName);
Expand All @@ -248,10 +180,5 @@ library ScriptTypes {
CommitmentMapperRegistry commitmentMapperRegistry;
HydraS3Verifier hydraS3Verifier;
SismoConnectVerifier sismoConnectVerifier;
// external libraries
AuthRequestBuilder authRequestBuilder;
ClaimRequestBuilder claimRequestBuilder;
SignatureBuilder signatureBuilder;
RequestBuilder requestBuilder;
}
}
Loading

0 comments on commit 83913e1

Please sign in to comment.