Skip to content

Commit

Permalink
feat(protocol): validate instance the old way (#14639)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com>
  • Loading branch information
2 people authored and 2manslkh committed Sep 14, 2023
1 parent 7da90de commit f42bda0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
33 changes: 16 additions & 17 deletions packages/protocol/contracts/L1/ProofVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,23 @@ contract ProofVerifier is EssentialContract, IProofVerifier {
if (instance == 0) return;

// Validate the instance using bytes utilities.
// TODO(david & yue): we need to fix the code below
// if (
// !LibBytesUtils.equal(
// LibBytesUtils.slice(blockProofs, 2, 32),
// bytes.concat(bytes16(0), bytes16(instance))
// )
// ) {
// revert L1_INVALID_PROOF();
// }
if (
!LibBytesUtils.equal(
LibBytesUtils.slice(blockProofs, 2, 32),
bytes.concat(bytes16(0), bytes16(instance))
)
) {
revert L1_INVALID_PROOF();
}

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

// Extract verifier ID from the proof.
uint16 verifierId = uint16(bytes2(blockProofs[0:2]));
Expand Down
1 change: 0 additions & 1 deletion packages/protocol/test/L1/TaikoL1TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ abstract contract TaikoL1TestBase is TestBase {
bytes32 instance = LibProving.getInstance(evidence);
uint16 verifierId = 100;

// TODO(daniel & yue): we need to fix here
evidence.proofs = bytes.concat(
bytes2(verifierId),
bytes16(0),
Expand Down

0 comments on commit f42bda0

Please sign in to comment.