Skip to content

Commit

Permalink
decouple host params (#12)
Browse files Browse the repository at this point in the history
* decouple host params

* introduce RequestMetadata

* modify dispatchIncoming

* fix solidity
  • Loading branch information
seunlanlege authored Dec 29, 2023
1 parent 4bd6517 commit 034c940
Showing 1 changed file with 9 additions and 29 deletions.
38 changes: 9 additions & 29 deletions src/IIsmpHost.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,12 @@ pragma solidity 0.8.17;
import {StateCommitment, StateMachineHeight} from "./IConsensusClient.sol";
import {IIsmp, PostRequest, PostResponse, GetResponse, PostTimeout, GetRequest} from "./IIsmp.sol";

// The IsmpHost parameters
struct HostParams {
// default timeout in seconds for requests.
uint256 defaultTimeout;
// timestamp for when the consensus was most recently updated
uint256 lastUpdated;
// unstaking period
uint256 unStakingPeriod;
// minimum challenge period in seconds;
uint256 challengePeriod;
// consensus client contract
address consensusClient;
// admin account, this only has the rights to freeze, or unfreeze the bridge
address admin;
// Ismp request/response handler
address handler;
// the authorized cross-chain governor contract
address crosschainGovernor;
// current verified state of the consensus client;
bytes consensusState;
// Some metadata about the request
struct RequestMetadata {
// the relayer fee
uint256 fee;
// user who initiated the request
address sender;
}

interface IIsmpHost is IIsmp {
Expand Down Expand Up @@ -101,7 +87,7 @@ interface IIsmpHost is IIsmp {
* @param commitment - commitment to the request
* @return existence status of an outgoing request commitment
*/
function requestCommitments(bytes32 commitment) external returns (bool);
function requestCommitments(bytes32 commitment) external returns (RequestMetadata memory);

/**
* @param commitment - commitment to the response
Expand All @@ -125,12 +111,6 @@ interface IIsmpHost is IIsmp {
*/
function storeConsensusState(bytes memory state) external;

/**
* @dev Updates bridge params
* @param params new bridge params
*/
function setHostParams(HostParams memory params) external;

/**
* @dev Store the timestamp when the consensus client was updated
* @param timestamp - new timestamp
Expand Down Expand Up @@ -180,11 +160,11 @@ interface IIsmpHost is IIsmp {
* @dev Dispatch an incoming get timeout to source module
* @param timeout - get timeout
*/
function dispatchIncoming(GetRequest memory timeout) external;
function dispatchIncoming(GetRequest memory timeout, RequestMetadata memory meta, bytes32 commitment) external;

/**
* @dev Dispatch an incoming post timeout to source module
* @param timeout - post timeout
*/
function dispatchIncoming(PostTimeout memory timeout) external;
function dispatchIncoming(PostTimeout memory timeout, RequestMetadata memory meta, bytes32 commitment) external;
}

0 comments on commit 034c940

Please sign in to comment.