Skip to content

Commit

Permalink
Testnet verifier
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed May 8, 2024
1 parent c46a948 commit aa879bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
era_chain_id = 9
owner_address = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
testnet_verifier = true

[contracts]
governance_security_council_address = "0x0000000000000000000000000000000000000000"
Expand All @@ -22,6 +23,8 @@ diamond_init_max_pubdata_per_batch = 120000
diamond_init_max_l2_gas_per_batch = 80000000
diamond_init_priority_tx_max_pubdata = 99000
diamond_init_minimal_l2_gas_price = 250000000
bootloader_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"
default_aa_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"

[tokens]
token_weth_address = "0x0000000000000000000000000000000000000000"
19 changes: 16 additions & 3 deletions l1-contracts-foundry/script/DeployL1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transpa
import {Utils} from "./Utils.sol";
import {Multicall3} from "contracts/dev-contracts/Multicall3.sol";
import {Verifier} from "contracts/state-transition/Verifier.sol";
import {TestnetVerifier} from "contracts/state-transition/TestnetVerifier.sol";
import {VerifierParams, IVerifier} from "contracts/state-transition/chain-interfaces/IVerifier.sol";
import {DefaultUpgrade} from "contracts/upgrades/DefaultUpgrade.sol";
import {Governance} from "contracts/governance/Governance.sol";
Expand Down Expand Up @@ -80,6 +81,7 @@ contract DeployL1Script is Script {
uint256 eraChainId;
address deployerAddress;
address ownerAddress;
bool testnetVerifier;
ContractsConfig contracts;
TokensConfig tokens;
}
Expand Down Expand Up @@ -107,6 +109,8 @@ contract DeployL1Script is Script {
uint256 governanceMinDelay;
uint256 maxNumberOfHyperchains;
bytes diamondCutData;
bytes32 bootloaderHash;
bytes32 defaultAAHash;
}

struct TokensConfig {
Expand Down Expand Up @@ -162,6 +166,7 @@ contract DeployL1Script is Script {
// https://book.getfoundry.sh/cheatcodes/parse-toml
config.eraChainId = toml.readUint("$.era_chain_id");
config.ownerAddress = toml.readAddress("$.owner_address");
config.testnetVerifier = toml.readBool("$.testnet_verifier");

config.contracts.governanceSecurityCouncilAddress = toml.readAddress(
"$.contracts.governance_security_council_address"
Expand Down Expand Up @@ -197,6 +202,8 @@ contract DeployL1Script is Script {
"$.contracts.diamond_init_priority_tx_max_pubdata"
);
config.contracts.diamondInitMinimalL2GasPrice = toml.readUint("$.contracts.diamond_init_minimal_l2_gas_price");
config.contracts.defaultAAHash = toml.readBytes32("$.contracts.default_aa_hash");
config.contracts.bootloaderHash = toml.readBytes32("$.contracts.bootloader_hash");

config.tokens.tokenWethAddress = toml.readAddress("$.tokens.token_weth_address");
}
Expand Down Expand Up @@ -236,7 +243,13 @@ contract DeployL1Script is Script {
}

function deployVerifier() internal {
address contractAddress = deployViaCreate2(type(Verifier).creationCode);
bytes memory code;
if (config.testnetVerifier) {
code = type(TestnetVerifier).creationCode;
} else {
code = type(Verifier).creationCode;
}
address contractAddress = deployViaCreate2(code);
console.log("Verifier deployed at:", contractAddress);
addresses.stateTransition.verifier = contractAddress;
}
Expand Down Expand Up @@ -400,8 +413,8 @@ contract DeployL1Script is Script {
DiamondInitializeDataNewChain memory initializeData = DiamondInitializeDataNewChain({
verifier: IVerifier(addresses.stateTransition.verifier),
verifierParams: verifierParams,
l2BootloaderBytecodeHash: bytes32(Utils.getBatchBootloaderBytecodeHash()),
l2DefaultAccountBytecodeHash: bytes32(Utils.readSystemContractsBytecode("DefaultAccount")),
l2BootloaderBytecodeHash: config.contracts.bootloaderHash,
l2DefaultAccountBytecodeHash: config.contracts.defaultAAHash,
priorityTxMaxGasLimit: config.contracts.priorityTxMaxGasLimit,
feeParams: feeParams,
blobVersionedHashRetriever: addresses.blobVersionedHashRetriever
Expand Down

0 comments on commit aa879bc

Please sign in to comment.