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: SP1VerifierGateway #7

Merged
merged 19 commits into from
Jun 20, 2024
Merged

feat: SP1VerifierGateway #7

merged 19 commits into from
Jun 20, 2024

Conversation

mattstam
Copy link
Contributor

@mattstam mattstam commented Jun 17, 2024

Routes proofs to the correct verifier.

Tests

Ran 12 tests for test/SP1VerifierGateway.t.sol:SP1VerifierGatewayTest
[PASS] test_AddRoute() (gas: 46689)
[PASS] test_FreezeRoute() (gas: 54417)
[PASS] test_RevertAddRoute_WhenAlreadyExists() (gas: 47858)
[PASS] test_RevertAddRoute_WhenNotOwner() (gas: 17060)
[PASS] test_RevertAddRoute_WhenNotSP1Verifier() (gas: 17578)
[PASS] test_RevertFreezeRoute_WhenNoRoute() (gas: 21208)
[PASS] test_RevertFreezeRoute_WhenNotOwner() (gas: 20102)
[PASS] test_RevertFreezeRoute_WhenRouteIsFrozen() (gas: 48662)
[PASS] test_RevertVerifyProof_WhenNoRoute() (gas: 17900)
[PASS] test_RevertVerifyProof_WhenRouteIsFrozen() (gas: 49339)
[PASS] test_SetUp() (gas: 31244)
[PASS] test_VerifyProof() (gas: 80359)
Suite result: ok. 12 passed; 0 failed; 0 skipped; finished in 7.59ms (7.00ms CPU time)

Ran 1 test suite in 161.33ms (7.59ms CPU time): 12 tests passed, 0 failed, 0 skipped (12 total tests)

@@ -1,22 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
pragma solidity ^0.8.20;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: using sol 0.8.20 because that's what the OZ lib is on


/// @notice Hashes the public values to a field elements inside Bn254.
/// @param publicValues The public values.
function hashPublicValues(bytes calldata publicValues) public pure returns (bytes32) {
Copy link
Member

Choose a reason for hiding this comment

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

btw changes to this file and possibly others also need to be done in sp1/recursion/gnark-ffi/assets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bytes calldata publicValues,
bytes calldata proofBytes
) external view;
}

interface ISP1VerifierWithHash is ISP1Verifier {
/// @notice Returns the hash of the verifier.
Copy link
Member

Choose a reason for hiding this comment

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

Should note that this is autogenerated by taking sha256 of the vkey file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@mattstam mattstam merged commit fe26dea into main Jun 20, 2024
1 check passed
@mattstam mattstam deleted the chris/gateway branch June 20, 2024 02:45
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.

2 participants