Skip to content
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

feat(protocol): enable two dimensional circuit/verifier lookup. #13066

Merged
merged 5 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/protocol/contracts/L1/libs/LibProving.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ library LibProving {
TaikoData.BlockMetadata meta;
BlockHeader header;
address prover;
bytes[] proofs; // The first zkProofsPerBlock are ZKPs
bytes[] proofs; // The first zkProofsPerBlock are ZKPs, followed by MKPs.
uint8[] circuits; // THe circuits IDs (size === zkProofsPerBlock)
}

bytes32 public constant INVALIDATE_BLOCK_LOG_TOPIC =
Expand Down Expand Up @@ -58,6 +59,7 @@ library LibProving {
// Check and decode inputs
require(inputs.length == 3, "L1:inputs:size");
Evidence memory evidence = abi.decode(inputs[0], (Evidence));

bytes calldata anchorTx = inputs[1];
bytes calldata anchorReceipt = inputs[2];

Expand All @@ -69,6 +71,10 @@ library LibProving {
evidence.proofs.length == 2 + zkProofsPerBlock,
"L1:proof:size"
);
require(
evidence.circuits.length == zkProofsPerBlock,
"L1:circuits:size"
);

{
// Check anchor tx is valid
Expand Down Expand Up @@ -256,7 +262,12 @@ library LibProving {
require(
proofVerifier.verifyZKP({
verifierId: string(
abi.encodePacked("plonk_verifier_", i)
abi.encodePacked(
"plonk_verifier_",
i,
"_",
evidence.circuits[i]
)
),
zkproof: evidence.proofs[i],
blockHash: blockHash,
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/tasks/deploy_L1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ export async function deployContracts(hre: any) {
`${chainId}.${Buffer.from(
ethers.utils.arrayify(
ethers.utils.solidityPack(
["string", "uint256"],
["plonk_verifier_", 0]
["string", "uint256", "string", "uint8"],
["plonk_verifier_", 0, "_", 0]
)
)
).toString()}`,
Expand Down