Skip to content

Commit

Permalink
feat(protocol): update PlonkVerifier for new L3 circuits (#14023)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com>
Co-authored-by: adaki2004 <keszeydani@gmail.com>
  • Loading branch information
3 people committed Jun 30, 2023
1 parent e6a7945 commit 9d7bc39
Show file tree
Hide file tree
Showing 3 changed files with 1,702 additions and 1,070 deletions.
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

0 comments on commit 9d7bc39

Please sign in to comment.