Skip to content

Commit 461bf65

Browse files
authored
feat(taiko-client): run tests post Pacaya fork (#19313)
1 parent fe7833b commit 461bf65

File tree

2 files changed

+67
-48
lines changed

2 files changed

+67
-48
lines changed

packages/protocol/script/layer1/based/DeployProtocolOnL1.s.sol

Lines changed: 66 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ contract DeployProtocolOnL1 is DeployCapability {
260260
copyRegister(rollupResolver, _sharedResolver, "signal_service");
261261
copyRegister(rollupResolver, _sharedResolver, "bridge");
262262

263+
// Initializable the proxy for proofVerifier to get the contract address at first.
263264
// Proof verifier
264265
proofVerifier = deployProxy({
265266
name: "proof_verifier",
@@ -272,14 +273,6 @@ contract DeployProtocolOnL1 is DeployCapability {
272273
registerTo: rollupResolver
273274
});
274275

275-
// OP verifier
276-
address opVerifier = deployProxy({
277-
name: "op_verifier",
278-
impl: address(new OpVerifier(rollupResolver)),
279-
data: abi.encodeCall(OpVerifier.init, (owner)),
280-
registerTo: rollupResolver
281-
});
282-
283276
// Inbox
284277
deployProxy({
285278
name: "mainnet_taiko",
@@ -353,28 +346,6 @@ contract DeployProtocolOnL1 is DeployCapability {
353346
uint64 l2ChainId = taikoInbox.pacayaConfig().chainId;
354347
require(l2ChainId != block.chainid, "same chainid");
355348

356-
// Other verifiers
357-
// Initializable the proxy for proofVerifier to get the contract address at first.
358-
(address sgxRethVerifier, address sgxGethVerifier) =
359-
deploySgxVerifier(owner, rollupResolver, l2ChainId, address(taikoInbox), proofVerifier);
360-
361-
(address risc0RethVerifier, address sp1RethVerifier) =
362-
deployZKVerifiers(owner, rollupResolver, l2ChainId);
363-
364-
UUPSUpgradeable(proofVerifier).upgradeTo({
365-
newImplementation: address(
366-
new DevnetVerifier(
367-
taikoInboxAddr,
368-
sgxGethVerifier,
369-
opVerifier,
370-
sgxRethVerifier,
371-
risc0RethVerifier,
372-
sp1RethVerifier
373-
)
374-
)
375-
});
376-
Ownable2StepUpgradeable(proofVerifier).transferOwnership(owner);
377-
378349
// Prover set
379350
deployProxy({
380351
name: "prover_set",
@@ -388,23 +359,32 @@ contract DeployProtocolOnL1 is DeployCapability {
388359
});
389360
}
390361

391-
function deploySgxVerifier(
362+
function deployVerifiers(
392363
address owner,
393364
address rollupResolver,
394-
uint64 l2ChainId,
395-
address taikoInbox,
396-
address taikoProofVerifier
365+
address proofVerifier,
366+
address taikoInboxAddr
397367
)
398368
private
399-
returns (address sgxRethVerifier, address sgxGethVerifier)
400369
{
370+
// OP verifier
371+
address opVerifier = deployProxy({
372+
name: "op_verifier",
373+
impl: address(new OpVerifier(rollupResolver)),
374+
data: abi.encodeCall(OpVerifier.init, (owner)),
375+
registerTo: rollupResolver
376+
});
377+
378+
// Other verifiers
379+
401380
// No need to proxy these, because they are 3rd party. If we want to modify, we simply
402381
// change the registerAddress("automata_dcap_attestation", address(attestation));
403-
P256Verifier p256Verifier = new P256Verifier();
404-
SigVerifyLib sigVerifyLib = new SigVerifyLib(address(p256Verifier));
382+
SigVerifyLib sigVerifyLib = new SigVerifyLib(address(new P256Verifier()));
405383
PEMCertChainLib pemCertChainLib = new PEMCertChainLib();
406384
address automataDcapV3AttestationImpl = address(new AutomataDcapV3Attestation());
407-
385+
// Log addresses for the user to register sgx instance
386+
console2.log("SigVerifyLib", address(sigVerifyLib));
387+
console2.log("PemCertChainLib", address(pemCertChainLib));
408388
address automataProxy = deployProxy({
409389
name: "automata_dcap_attestation",
410390
impl: automataDcapV3AttestationImpl,
@@ -413,26 +393,64 @@ contract DeployProtocolOnL1 is DeployCapability {
413393
),
414394
registerTo: rollupResolver
415395
});
396+
address sgxGethAutomataProxy = deployProxy({
397+
name: "sgx_geth_automata",
398+
impl: automataDcapV3AttestationImpl,
399+
data: abi.encodeCall(
400+
AutomataDcapV3Attestation.init, (owner, address(sigVerifyLib), address(pemCertChainLib))
401+
),
402+
registerTo: rollupResolver
403+
});
404+
405+
TaikoInbox taikoInbox = TaikoInbox(payable(taikoInboxAddr));
406+
uint64 l2ChainId = taikoInbox.pacayaConfig().chainId;
407+
require(l2ChainId != block.chainid, "same chainid");
416408

417-
address sgxImpl =
418-
address(new SgxVerifier(l2ChainId, taikoInbox, taikoProofVerifier, automataProxy));
419-
sgxRethVerifier = deployProxy({
409+
address sgxRethVerifier = deployProxy({
420410
name: "sgx_reth_verifier",
421-
impl: sgxImpl,
411+
impl: address(new SgxVerifier(l2ChainId, taikoInboxAddr, proofVerifier, automataProxy)),
422412
data: abi.encodeCall(SgxVerifier.init, owner),
423413
registerTo: rollupResolver
424414
});
425-
sgxGethVerifier = deployProxy({
415+
address sgxGethVerifier = deployProxy({
426416
name: "sgx_geth_verifier",
427-
impl: sgxImpl,
417+
impl: address(
418+
new SgxVerifier(l2ChainId, taikoInboxAddr, proofVerifier, sgxGethAutomataProxy)
419+
),
428420
data: abi.encodeCall(SgxVerifier.init, owner),
429421
registerTo: rollupResolver
430422
});
431423

432-
// Log addresses for the user to register sgx instance
433-
console2.log("SigVerifyLib", address(sigVerifyLib));
434-
console2.log("PemCertChainLib", address(pemCertChainLib));
435-
console2.log("AutomataDcapVaAttestation", automataProxy);
424+
(address risc0RethVerifier, address sp1RethVerifier) =
425+
deployZKVerifiers(owner, rollupResolver, l2ChainId);
426+
if (vm.envBool("DUMMY_VERIFIERS")) {
427+
UUPSUpgradeable(proofVerifier).upgradeTo({
428+
newImplementation: address(
429+
new DevnetVerifier(
430+
taikoInboxAddr,
431+
opVerifier,
432+
opVerifier,
433+
address(0),
434+
risc0RethVerifier,
435+
sp1RethVerifier
436+
)
437+
)
438+
});
439+
} else {
440+
UUPSUpgradeable(proofVerifier).upgradeTo({
441+
newImplementation: address(
442+
new DevnetVerifier(
443+
taikoInboxAddr,
444+
sgxGethVerifier,
445+
opVerifier,
446+
sgxRethVerifier,
447+
risc0RethVerifier,
448+
sp1RethVerifier
449+
)
450+
)
451+
});
452+
}
453+
Ownable2StepUpgradeable(proofVerifier).transferOwnership(owner);
436454
}
437455

438456
function deployZKVerifiers(

packages/taiko-client/integration_test/l1_env.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export NUM_MIN_MAJORITY_GUARDIANS=6
2424
export NUM_MIN_MINORITY_GUARDIANS=1
2525
export INCLUSION_WINDOW=3
2626
export INCLUSION_FEE_IN_GWEI=10
27+
export DUMMY_VERIFIERS=true
2728

2829
GUARDIAN_PROVERS_ADDRESSES_LIST=(
2930
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"

0 commit comments

Comments
 (0)