@@ -56,7 +56,7 @@ contract LCPClient is ILightClient {
5656 }
5757
5858 // @dev isDevelopmentMode returns true if the client allows the remote attestation of IAS in development.
59- function isDevelopmentMode () external view returns (bool ) {
59+ function isDevelopmentMode () public view returns (bool ) {
6060 return developmentMode;
6161 }
6262
@@ -69,7 +69,7 @@ contract LCPClient is ILightClient {
6969 string calldata clientId ,
7070 bytes calldata protoClientState ,
7171 bytes calldata protoConsensusState
72- ) external onlyIBC returns (Height.Data memory height ) {
72+ ) public onlyIBC returns (Height.Data memory height ) {
7373 ProtoClientState.Data memory clientState = LCPProtoMarshaler.unmarshalClientState (protoClientState);
7474 ProtoConsensusState.Data memory consensusState = LCPProtoMarshaler.unmarshalConsensusState (protoConsensusState);
7575
@@ -99,11 +99,7 @@ contract LCPClient is ILightClient {
9999 /**
100100 * @dev getTimestampAtHeight returns the timestamp of the consensus state at the given height.
101101 */
102- function getTimestampAtHeight (string calldata clientId , Height.Data calldata height )
103- external
104- view
105- returns (uint64 )
106- {
102+ function getTimestampAtHeight (string calldata clientId , Height.Data calldata height ) public view returns (uint64 ) {
107103 ConsensusState storage consensusState = consensusStates[clientId][height.toUint128 ()];
108104 require (consensusState.timestamp != 0 , "consensus state not found " );
109105 return consensusState.timestamp;
@@ -112,7 +108,7 @@ contract LCPClient is ILightClient {
112108 /**
113109 * @dev getLatestHeight returns the latest height of the client state corresponding to `clientId`.
114110 */
115- function getLatestHeight (string calldata clientId ) external view returns (Height.Data memory ) {
111+ function getLatestHeight (string calldata clientId ) public view returns (Height.Data memory ) {
116112 ProtoClientState.Data storage clientState = clientStates[clientId];
117113 require (clientState.latest_height.revision_height != 0 , "client state not found " );
118114 return clientState.latest_height;
@@ -121,17 +117,30 @@ contract LCPClient is ILightClient {
121117 * @dev getStatus returns the status of the client corresponding to `clientId`.
122118 */
123119
124- function getStatus (string calldata clientId ) external view returns (ClientStatus) {
120+ function getStatus (string calldata clientId ) public view returns (ClientStatus) {
125121 return clientStates[clientId].frozen ? ClientStatus.Frozen : ClientStatus.Active;
126122 }
127123
124+ /**
125+ * @dev getLatestInfo returns the latest height, the latest timestamp, and the status of the client corresponding to `clientId`.
126+ */
127+ function getLatestInfo (string calldata clientId )
128+ public
129+ view
130+ returns (Height.Data memory latestHeight , uint64 latestTimestamp , ClientStatus status )
131+ {
132+ latestHeight = clientStates[clientId].latest_height;
133+ latestTimestamp = consensusStates[clientId][latestHeight.toUint128 ()].timestamp;
134+ status = clientStates[clientId].frozen ? ClientStatus.Frozen : ClientStatus.Active;
135+ }
136+
128137 /**
129138 * @dev routeUpdateClient returns the calldata to the receiving function of the client message.
130139 * Light client contract may encode a client message as other encoding scheme(e.g. ethereum ABI)
131140 * Check ADR-001 for details.
132141 */
133142 function routeUpdateClient (string calldata clientId , bytes calldata protoClientMessage )
134- external
143+ public
135144 pure
136145 returns (bytes4 , bytes memory )
137146 {
@@ -222,7 +231,7 @@ contract LCPClient is ILightClient {
222231 * @dev getClientState returns the clientState corresponding to `clientId`.
223232 * If it's not found, the function returns false.
224233 */
225- function getClientState (string calldata clientId ) external view returns (bytes memory clientStateBytes , bool ) {
234+ function getClientState (string calldata clientId ) public view returns (bytes memory clientStateBytes , bool ) {
226235 ProtoClientState.Data storage clientState = clientStates[clientId];
227236 if (clientState.latest_height.revision_height == 0 ) {
228237 return (clientStateBytes, false );
@@ -235,7 +244,7 @@ contract LCPClient is ILightClient {
235244 * If it's not found, the function returns false.
236245 */
237246 function getConsensusState (string calldata clientId , Height.Data calldata height )
238- external
247+ public
239248 view
240249 returns (bytes memory consensusStateBytes , bool )
241250 {
0 commit comments