Skip to content

Commit

Permalink
Add Mock StreamVerifierProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Fletch153 committed Dec 18, 2023
1 parent d7a88e9 commit 8647ede
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 7 deletions.
3 changes: 2 additions & 1 deletion contracts/scripts/native_solc_compile_all_llo-feeds
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ compileContract llo-feeds/test/mocks/ErroredVerifier.sol
compileContract llo-feeds/test/mocks/ExposedVerifier.sol

# Streams
compileContract llo-feeds/dev/StreamConfigStore.sol
compileContract llo-feeds/dev/ChannelConfigStore.sol
compileContract llo-feeds/dev/ChannelVerifierProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
pragma solidity ^0.8.16;

import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol";
import {IStreamConfigStore} from "./interfaces/IStreamConfigStore.sol";
import {IChannelConfigStore} from "./interfaces/IChannelConfigStore.sol";
import {TypeAndVersionInterface} from "../../interfaces/TypeAndVersionInterface.sol";

contract StreamConfigStore is ConfirmedOwner, IStreamConfigStore, TypeAndVersionInterface {
contract ChannelConfigStore is ConfirmedOwner, IChannelConfigStore, TypeAndVersionInterface {

mapping(bytes32 => ChannelDefinition) private s_channelDefinitions;

Expand Down Expand Up @@ -97,11 +97,11 @@ contract StreamConfigStore is ConfirmedOwner, IStreamConfigStore, TypeAndVersion
}

function typeAndVersion() external override pure returns (string memory) {
return "StreamConfigStore 0.0.0";
return "ChannelConfigStore 0.0.0";
}

function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
return interfaceId == type(IStreamConfigStore).interfaceId;
return interfaceId == type(IChannelConfigStore).interfaceId;
}
}

50 changes: 50 additions & 0 deletions contracts/src/v0.8/llo-feeds/dev/ChannelVerifierProxy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol";
import {TypeAndVersionInterface} from "../../interfaces/TypeAndVersionInterface.sol";
import {IChannelVerifierProxy} from "./interfaces/IChannelVerifierProxy.sol";

contract ChannelVerifierProxy is IChannelVerifierProxy, ConfirmedOwner, TypeAndVersionInterface {

error AccessForbidden();

constructor() ConfirmedOwner(msg.sender) {
}

/// @inheritdoc TypeAndVersionInterface
function typeAndVersion() external pure override returns (string memory) {
return "ChannelVerifierProxy 0.0.0";
}

/// @inheritdoc IChannelVerifierProxy
function verify(
bytes calldata payload,
bytes calldata parameterPayload
) external payable returns (bytes memory) {
_verify(payload, parameterPayload);

return new bytes(0);
}

/// @inheritdoc IChannelVerifierProxy
function verifyBulk(
bytes[] calldata payloads,
bytes calldata parameterPayload
) external payable returns (bytes[] memory verifiedReports) {
verifiedReports = new bytes[](payloads.length);
for (uint256 i; i < payloads.length; ++i) {
_verify(payloads[i], parameterPayload);
}

return new bytes[](0);
}

function _verify(bytes calldata payload, bytes calldata parameterPayload) internal pure returns (bytes memory, bytes memory) {
return (payload, parameterPayload);
}

function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
return interfaceId == type(IChannelVerifierProxy).interfaceId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.16;

import {IERC165} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/interfaces/IERC165.sol";

interface IStreamConfigStore is IERC165 {
interface IChannelConfigStore is IERC165 {

function setStagingConfig(bytes32 channelId, ChannelConfiguration calldata channelConfig) external;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import {IERC165} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/interfaces/IERC165.sol";
import {Common} from "../../libraries/Common.sol";

interface IChannelVerifierProxy is IERC165 {

function verify(
bytes calldata payload,
bytes calldata parameterPayload
) external payable returns (bytes memory verifierResponse);

function verifyBulk(
bytes[] calldata payloads,
bytes calldata parameterPayload
) external payable returns (bytes[] memory verifiedReports);
}
3 changes: 2 additions & 1 deletion core/gethwrappers/llo-feeds/go_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ package gethwrappers
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.16/ExposedVerifier/ExposedVerifier.abi ../../../contracts/solc/v0.8.16/ExposedVerifier/ExposedVerifier.bin ExposedVerifier exposed_verifier
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.16/RewardManager/RewardManager.abi ../../../contracts/solc/v0.8.16/RewardManager/RewardManager.bin RewardManager reward_manager
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.16/FeeManager/FeeManager.abi ../../../contracts/solc/v0.8.16/FeeManager/FeeManager.bin FeeManager fee_manager
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.16/StreamConfigStore/StreamConfigStore.abi ../../../contracts/solc/v0.8.16/StreamConfigStore/StreamConfigStore.bin StreamConfigStore stream_config_store
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.16/ChannelConfigStore/ChannelConfigStore.abi ../../../contracts/solc/v0.8.16/ChannelConfigStore/ChannelConfigStore.bin ChannelConfigStore channel_config_store
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.16/ChannelVerifierProxy/ChannelVerifierProxy.abi ../../../contracts/solc/v0.8.16/ChannelVerifierProxy/ChannelVerifierProxy.bin ChannelVerifierProxy channel_verifier_proxy

0 comments on commit 8647ede

Please sign in to comment.