Skip to content

Commit

Permalink
chore: minor consistency fixes (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam authored Jul 23, 2024
1 parent 17f7b13 commit 44f8b52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
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);
}
}

0 comments on commit 44f8b52

Please sign in to comment.