Skip to content

Commit

Permalink
imp: simplified light client interface
Browse files Browse the repository at this point in the history
  • Loading branch information
srdtrk committed Jul 23, 2024
1 parent cf330e2 commit 2b41eed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
12 changes: 2 additions & 10 deletions src/interfaces/ILightClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,8 @@ interface ILightClient is ILightClientMsgs {
function updateClient(bytes calldata updateMsg) external returns (UpdateResult);

/// @notice Querying the (non)membership of the key-value pairs
/// @return The timestamp of the verification height in the counterparty chain, e.g., unix timestamp in seconds.
function batchVerifyMembership(MsgBatchMembership calldata batchVerifyMsg) external view returns (uint32);

/// @notice Updating the client and querying the (non)membership of the key-value pairs on the updated consensus
// state.
/// @return The timestamp of the verification height in the counterparty chain
// and the result of the update operation.
function updateClientAndBatchVerifyMembership(MsgBatchMembership calldata batchVerifyMsg)
external
returns (uint32, UpdateResult);
/// @return The unix timestamp of the verification height in the counterparty chain in seconds.
function verifyMembership(MsgMembership calldata msg_) external view returns (uint32);

/// @notice Misbehaviour handling, moves the light client to the frozen state if misbehaviour is detected
/// @param misbehaviourMsg The misbehaviour message
Expand Down
13 changes: 2 additions & 11 deletions src/msgs/ILightClientMsgs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,17 @@ interface ILightClientMsgs {
bytes value;
}

/// @notice Initializes the light client with a trusted client state and consensus state
/// @dev Should be used in the constructor of the light client contract
struct MsgInitialize {
/// Initial client state
bytes clientState;
/// Initial consensus state
bytes consensusState;
}

/// @notice Message for querying the (non)membership of the key-value pairs in the Merkle root at a given height.
/// @dev If a value is empty, then we are querying for non-membership.
/// @dev The proof may differ depending on the client implementation and whether
/// `batchVerifyMembership` or `updateClientAndBatchVerifyMembership` is called.
struct MsgBatchMembership {
struct MsgMembership {
/// The proof
bytes proof;
/// Height of the proof
IICS02ClientMsgs.Height proofHeight;
/// The key-value pairs
KVPair[] keyValues;
KVPair kvPair;
}

/// @notice The result of an update operation
Expand Down

0 comments on commit 2b41eed

Please sign in to comment.