-
Notifications
You must be signed in to change notification settings - Fork 2
/
IHandler.sol
74 lines (66 loc) · 2.95 KB
/
IHandler.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (C) Polytope Labs Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
pragma solidity ^0.8.17;
import {IIsmpHost} from "./IIsmpHost.sol";
import {PostRequestMessage, PostResponseMessage, GetResponseMessage, PostRequestTimeoutMessage, PostResponseTimeoutMessage, GetTimeoutMessage} from "./Message.sol";
/*
* @title The Ismp Handler
* @author Polytope Labs ([email protected])
*
* @notice The IHandler interface serves as the entry point for ISMP datagrams, i.e consensus, requests & response messages.
*/
interface IHandler {
/**
* @dev Handle an incoming consensus message. This uses the IConsensusClient contract registered on the host to perform the consensus message verification.
* @param host - Ismp host
* @param proof - consensus proof
*/
function handleConsensus(IIsmpHost host, bytes memory proof) external;
/**
* @dev Handles incoming POST requests, check request proofs, message delay and timeouts, then dispatch POST requests to the apropriate contracts.
* @param host - Ismp host
* @param request - batch post requests
*/
function handlePostRequests(IIsmpHost host, PostRequestMessage memory request) external;
/**
* @dev Handles incoming POST responses, check response proofs, message delay and timeouts, then dispatch POST responses to the apropriate contracts.
* @param host - Ismp host
* @param response - batch post responses
*/
function handlePostResponses(IIsmpHost host, PostResponseMessage memory response) external;
/**
* @dev check response proofs, message delay and timeouts, then dispatch get responses to modules
* @param host - Ismp host
* @param message - batch get responses
*/
function handleGetResponses(IIsmpHost host, GetResponseMessage memory message) external;
/**
* @dev check timeout proofs then dispatch to modules
* @param host - Ismp host
* @param message - batch post request timeouts
*/
function handlePostRequestTimeouts(IIsmpHost host, PostRequestTimeoutMessage memory message) external;
/**
* @dev check timeout proofs then dispatch to modules
* @param host - Ismp host
* @param message - batch post response timeouts
*/
function handlePostResponseTimeouts(IIsmpHost host, PostResponseTimeoutMessage memory message) external;
/**
* @dev dispatch to modules
* @param host - Ismp host
* @param message - batch get request timeouts
*/
function handleGetRequestTimeouts(IIsmpHost host, GetTimeoutMessage memory message) external;
}