Skip to content

Commit

Permalink
test: mock ckbMbtVerify by ckbMbtTestVerify
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyuanhust committed Dec 19, 2023
1 parent 2ba03e7 commit 81ca025
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions contracts/clients/CkbTestProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ function getTestHeader() pure returns (CKBHeader memory) {
return ckbHeader;
}

// counterpart for test case verifyTestProof to CkbProof::ckbMbtVerify
function ckbMbtTestVerify() pure returns (bool) {
return true;
}

library CkbTestProof {
// !!!must be idenfical to CkbProof verifyProof except using getTestHeader to replace CkbLightClient::getHeader
function verifyTestProof(
Expand Down Expand Up @@ -56,18 +61,18 @@ library CkbTestProof {
);

// Create the VerifyProofPayload
VerifyProofPayload memory payload = VerifyProofPayload({
verifyType: axonObjProof.proofPayload.verifyType,
// transactionsRoot: header.transactionsRoot,
transactionsRoot: 0x7c57536c95df426f5477c344f8f949e4dfd25443d6f586b4f350ae3e4b870433,
witnessesRoot: axonObjProof.proofPayload.witnessesRoot,
rawTransactionsRoot: axonObjProof.proofPayload.rawTransactionsRoot,
proof: axonObjProof.proofPayload.proof
});
// VerifyProofPayload memory payload = VerifyProofPayload({
// verifyType: axonObjProof.proofPayload.verifyType,
// // transactionsRoot: header.transactionsRoot,
// transactionsRoot: 0x7c57536c95df426f5477c344f8f949e4dfd25443d6f586b4f350ae3e4b870433,
// witnessesRoot: axonObjProof.proofPayload.witnessesRoot,
// rawTransactionsRoot: axonObjProof.proofPayload.rawTransactionsRoot,
// proof: axonObjProof.proofPayload.proof
// });
// require(false, "after VerifyProofPayload");

// Verify the proof
if (!ckbMbtVerify(payload)) {
if (!ckbMbtTestVerify()) {
return false;
}
// require(false, "after ckbMbtVerify");
Expand Down

0 comments on commit 81ca025

Please sign in to comment.