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): update PlonkVerifier for new L3 circuits #14023

Merged
merged 11 commits into from
Jun 30, 2023
32 changes: 22 additions & 10 deletions packages/protocol/contracts/L1/libs/LibProving.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AddressResolver } from "../../common/AddressResolver.sol";
import { LibMath } from "../../libs/LibMath.sol";
import { LibUtils } from "./LibUtils.sol";
import { TaikoData } from "../../L1/TaikoData.sol";
import { LibBytesUtils } from "../../thirdparty/LibBytesUtils.sol";

library LibProving {
using LibMath for uint256;
Expand Down Expand Up @@ -212,18 +213,29 @@ library LibProving {
instance := keccak256(inputs, mul(32, 10))
}

if (
!LibBytesUtils.equal(
LibBytesUtils.slice(evidence.proof, 0, 32),
bytes.concat(bytes16(0), bytes16(instance))
)
) {
revert L1_INVALID_PROOF();
}

if (
!LibBytesUtils.equal(
LibBytesUtils.slice(evidence.proof, 32, 32),
bytes.concat(
bytes16(0), bytes16(uint128(uint256(instance)))
)
)
) {
revert L1_INVALID_PROOF();
}

(bool verified, bytes memory ret) = resolver.resolve(
LibUtils.getVerifierName(evidence.verifierId), false
).staticcall(
bytes.concat(
bytes16(0),
bytes16(instance), // left 16 bytes of the given instance
bytes16(0),
bytes16(uint128(uint256(instance))), // right 16 bytes of
// the given instance
evidence.proof
)
);
).staticcall(evidence.proof);

if (
!verified
Expand Down
Loading