Skip to content

Commit

Permalink
forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
austinabell committed Jul 16, 2024
1 parent 7d8b576 commit 5b3e430
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions contracts/src/Blobstream0.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ contract Blobstream0 is IDAOracle {
/// @param endBlock The end block of the block range.
/// @param dataCommitment The data commitment for the block range.
event DataCommitmentStored(
uint256 proofNonce,
uint64 indexed startBlock,
uint64 indexed endBlock,
bytes32 indexed dataCommitment
uint256 proofNonce, uint64 indexed startBlock, uint64 indexed endBlock, bytes32 indexed dataCommitment
);

/// @notice Emits event with the new head update.
Expand Down Expand Up @@ -74,11 +71,7 @@ contract Blobstream0 is IDAOracle {
mapping(uint256 => bytes32) merkleRoots;

/// @notice Initialize the contract, binding it to a specified RISC Zero verifier.
constructor(
IRiscZeroVerifier _verifier,
bytes32 _trustedHash,
uint64 _trustedHeight
) {
constructor(IRiscZeroVerifier _verifier, bytes32 _trustedHash, uint64 _trustedHeight) {
verifier = _verifier;
latestBlockHash = _trustedHash;
latestHeight = _trustedHeight;
Expand All @@ -87,10 +80,7 @@ contract Blobstream0 is IDAOracle {
}

/// @notice Validate a proof of a new header range, update state.
function updateRange(
RangeCommitment memory _commit,
bytes calldata _seal
) external {
function updateRange(RangeCommitment memory _commit, bytes calldata _seal) external {
if (_commit.newHeight <= latestHeight) {
revert InvalidTargetHeight();
}
Expand Down Expand Up @@ -118,22 +108,18 @@ contract Blobstream0 is IDAOracle {
/// @param _tuple Data root tuple to prove inclusion of.
/// @param _proof Binary Merkle tree proof that `tuple` is in the root at `_tupleRootNonce`.
/// @return `true` is proof is valid, `false` otherwise.
function verifyAttestation(
uint256 _proofNonce,
DataRootTuple memory _tuple,
BinaryMerkleProof memory _proof
) external view returns (bool) {
function verifyAttestation(uint256 _proofNonce, DataRootTuple memory _tuple, BinaryMerkleProof memory _proof)
external
view
returns (bool)
{
if (_proofNonce == 0 || _proofNonce >= proofNonce) {
return false;
}

bytes32 root = merkleRoots[_proofNonce];

(bool isProofValid, ) = BinaryMerkleTree.verify(
root,
_proof,
abi.encode(_tuple)
);
(bool isProofValid,) = BinaryMerkleTree.verify(root, _proof, abi.encode(_tuple));

return isProofValid;
}
Expand Down

0 comments on commit 5b3e430

Please sign in to comment.