Skip to content

Conversation

@capossele
Copy link
Contributor

@capossele capossele commented Nov 14, 2025

Adds the VerifierLayeredRouter contract.
It also adds a copy of the RiscZeroVerifierRouter as we need to add the virtual property to the methods we override. Can be removed once those changes land to risc0-ethereum (risc0/risc0-ethereum#703)

@github-actions github-actions bot changed the title add VerifierLayeredRouter BM-1900: add VerifierLayeredRouter Nov 14, 2025
Comment on lines +103 to +114
// Expect exactly 2 calls, to verifier A/B with TEST_RECEIPT_x and TEST_MANGLED_RECEIPT_x.
vm.expectCall(address(verifierMockA), new bytes(0), 2);
vm.expectCall(address(verifierMockA), abi.encodeCall(IRiscZeroVerifier.verifyIntegrity, TEST_RECEIPT_A), 1);
vm.expectCall(
address(verifierMockA), abi.encodeCall(IRiscZeroVerifier.verifyIntegrity, TEST_MANGLED_RECEIPT_A), 1
);
vm.expectCall(address(verifierMockB), new bytes(0), 2);
vm.expectCall(address(verifierMockB), abi.encodeCall(IRiscZeroVerifier.verifyIntegrity, TEST_RECEIPT_B), 1);
vm.expectCall(
address(verifierMockB), abi.encodeCall(IRiscZeroVerifier.verifyIntegrity, TEST_MANGLED_RECEIPT_B), 1
);
layeredRouter.verifyIntegrity(TEST_RECEIPT_A);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm finding it hard to follow the expectCall's here and below.

Its hard to map each call to a specific invocation of verifyIntegrity, and it says we expect 2 calls but there are 6 vm.expectCall invocations.

Any way to split the tests or make it clearer somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that, specifically vm.expectCall(address(verifierMockA), new bytes(0), 2); is a trick to assess how many calls to expect for that address, in this case 2; then, we assert the actual calls. It's kept it as is so to match the RiscZeroVerifierRouter on the risc0-ethereum repo.

@capossele capossele merged commit dc9b441 into main Dec 8, 2025
35 of 38 checks passed
@capossele capossele deleted the angelo/verifierLayeredRouter branch December 8, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants