Skip to content

Commit 3679838

Browse files
authored
Merge pull request #12 from datachainlab/bump-ibc-solidity
Bump ibc-solidity to v0.3.26 Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
2 parents 017d076 + 43b9f3b commit 3679838

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

contracts/LCPClient.sol

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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
{

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "LCP Client in Solidity",
55
"dependencies": {
66
"@openzeppelin/contracts": "^5.0.1",
7-
"@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#v0.3.25",
7+
"@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#v0.3.26",
88
"base64": "git+https://github.com/datachainlab/base64.git#4d85607b18d981acff392d2e99ba654305552a97",
99
"solidity-datetime": "git+https://github.com/datachainlab/solidity-datetime.git#294fc244973cc5f9ec374713affde12c1403927c",
1010
"@ensdomains/ens-contracts": "0.0.22"

0 commit comments

Comments
 (0)