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

chore: minor consistency fixes #18

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions contracts/src/Fibonacci.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ contract Fibonacci {
address public verifier;

/// @notice The verification key for the fibonacci program.
bytes32 public fibonacciProgramVkey;
bytes32 public fibonacciProgramVKey;

constructor(address _verifier, bytes32 _fibonacciProgramVkey) {
constructor(address _verifier, bytes32 _fibonacciProgramVKey) {
verifier = _verifier;
fibonacciProgramVkey = _fibonacciProgramVkey;
fibonacciProgramVKey = _fibonacciProgramVKey;
}

/// @notice The entrypoint for verifying the proof of a fibonacci number.
/// @param proof The encoded proof.
/// @param publicValues The encoded public values.
function verifyFibonacciProof(bytes calldata proof, bytes calldata publicValues)
/// @param _proofBytes The encoded proof.
/// @param _publicValues The encoded public values.
function verifyFibonacciProof(bytes calldata _publicValues, bytes calldata _proofBytes)
public
view
returns (uint32, uint32, uint32)
{
ISP1Verifier(verifier).verifyProof(fibonacciProgramVkey, publicValues, proof);
(uint32 n, uint32 a, uint32 b) = abi.decode(publicValues, (uint32, uint32, uint32));
ISP1Verifier(verifier).verifyProof(fibonacciProgramVKey, _publicValues, _proofBytes);
(uint32 n, uint32 a, uint32 b) = abi.decode(_publicValues, (uint32, uint32, uint32));
return (n, a, b);
}
}
4 changes: 2 additions & 2 deletions contracts/test/Fibonacci.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract FibonacciTest is Test {

vm.mockCall(verifier, abi.encodeWithSelector(SP1VerifierGateway.verifyProof.selector), abi.encode(true));

(uint32 n, uint32 a, uint32 b) = fibonacci.verifyFibonacciProof(fixture.proof, fixture.publicValues);
(uint32 n, uint32 a, uint32 b) = fibonacci.verifyFibonacciProof(fixture.publicValues, fixture.proof);
assert(n == fixture.n);
assert(a == fixture.a);
assert(b == fixture.b);
Expand All @@ -53,6 +53,6 @@ contract FibonacciTest is Test {
// Create a fake proof.
bytes memory fakeProof = new bytes(fixture.proof.length);

fibonacci.verifyFibonacciProof(fakeProof, fixture.publicValues);
fibonacci.verifyFibonacciProof(fixture.publicValues, fakeProof);
}
}