-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add IBC prefix for ics-08 clients and bugfixes (#826)
* feat: Add revision number to light client heights Add revision number but for now do not add support for resseting chain height * revert to using two clients * feat: add IBC prefix for ics-08 clients and bugfixes * fix: hash ack value before sending to verify membership for ics8 client --------- Co-authored-by: izyak <lbackup887@gmail.com>
- Loading branch information
1 parent
7d0585a
commit a7af666
Showing
8 changed files
with
231 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
syntax = "proto3"; | ||
package tendermint.light; | ||
|
||
option go_package = "libraries/go/common/tendermint;tendermint"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
message Fraction { | ||
uint64 numerator = 1; | ||
uint64 denominator = 2; | ||
} | ||
|
||
// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp | ||
message Duration { | ||
int64 seconds = 1; | ||
int32 nanos = 2; | ||
} | ||
|
||
message Consensus { | ||
uint64 block = 1; | ||
uint64 app = 2; | ||
} | ||
|
||
message ClientState { | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
string chain_id = 1; | ||
Fraction trust_level = 2; | ||
|
||
// duration of the period since the LastestTimestamp during which the | ||
// submitted headers are valid for upgrade | ||
Duration trusting_period = 3; | ||
// duration of the staking unbonding period | ||
Duration unbonding_period = 4; | ||
// defines how much new (untrusted) header's Time can drift into the future. | ||
Duration max_clock_drift = 5; | ||
// Block height when the client was frozen due to a misbehaviour | ||
//ibc.core.client.v1.Height frozen_height = 6; | ||
int64 frozen_height = 6; | ||
// Latest height the client was updated to | ||
int64 latest_height = 7; | ||
// This flag, when set to true, will allow governance to recover a client | ||
// which has expired | ||
bool allow_update_after_expiry = 8; | ||
// This flag, when set to true, will allow governance to unfreeze a client | ||
// whose chain has experienced a misbehaviour event | ||
bool allow_update_after_misbehaviour = 9; | ||
} | ||
|
||
// ConsensusState defines the consensus state from Tendermint. | ||
message ConsensusState { | ||
option (gogoproto.goproto_getters) = false; | ||
// timestamp that corresponds to the block height in which the ConsensusState | ||
// was stored. | ||
Timestamp timestamp = 1; | ||
|
||
// commitment root (i.e app hash) | ||
MerkleRoot root = 2; | ||
bytes next_validators_hash = 3; | ||
} | ||
|
||
// MerkleRoot defines a merkle root hash. | ||
// In the Cosmos SDK, the AppHash of a block header becomes the root. | ||
message MerkleRoot { | ||
bytes hash = 1; | ||
} | ||
|
||
enum BlockIDFlag { | ||
BLOCK_ID_FLAG_UNKNOWN = 0; | ||
BLOCK_ID_FLAG_ABSENT = 1; | ||
BLOCK_ID_FLAG_COMMIT = 2; | ||
BLOCK_ID_FLAG_NIL = 3; | ||
} | ||
|
||
enum SignedMsgType { | ||
SIGNED_MSG_TYPE_UNKNOWN = 0; | ||
// Votes | ||
SIGNED_MSG_TYPE_PREVOTE = 1; | ||
SIGNED_MSG_TYPE_PRECOMMIT = 2; | ||
|
||
// Proposals | ||
SIGNED_MSG_TYPE_PROPOSAL = 32; | ||
} | ||
|
||
message CanonicalPartSetHeader { | ||
uint32 total = 1; | ||
bytes hash = 2; | ||
} | ||
|
||
message CanonicalBlockID { | ||
bytes hash = 1; | ||
CanonicalPartSetHeader part_set_header = 2; | ||
} | ||
|
||
message CanonicalVote { | ||
SignedMsgType type = 1; | ||
sfixed64 height = 2; | ||
sfixed64 round = 3; | ||
BlockID block_id = 4; | ||
Timestamp timestamp = 5; | ||
string chain_id = 6; | ||
} | ||
|
||
message Vote { | ||
SignedMsgType type = 1; | ||
int64 height = 2; | ||
int32 round = 3; | ||
BlockID block_id = 4; | ||
Timestamp timestamp = 5; | ||
bytes validator_address = 6; | ||
int32 validator_index = 7; | ||
bytes signature = 8; | ||
} | ||
|
||
message ValidatorSet { | ||
repeated Validator validators = 1; | ||
Validator proposer = 2; | ||
int64 total_voting_power = 3; | ||
} | ||
|
||
message Validator { | ||
bytes address = 1; | ||
PublicKey pub_key = 2; | ||
int64 voting_power = 3; | ||
int64 proposer_priority = 4; | ||
} | ||
|
||
message SimpleValidator { | ||
PublicKey pub_key = 1; | ||
int64 voting_power = 2; | ||
} | ||
|
||
message PublicKey { | ||
oneof sum { | ||
bytes ed25519 = 1; | ||
bytes secp256k1 = 2; | ||
bytes sr25519 = 3; | ||
} | ||
} | ||
|
||
message PartSetHeader { | ||
uint32 total = 1; | ||
bytes hash= 2; | ||
} | ||
|
||
message BlockID { | ||
bytes hash = 1; | ||
PartSetHeader part_set_header = 2; | ||
} | ||
|
||
message Commit { | ||
int64 height = 1; | ||
int32 round = 2; | ||
BlockID block_id = 3; | ||
repeated CommitSig signatures = 4; | ||
} | ||
|
||
// CommitSig is a part of the Vote included in a Commit. | ||
message CommitSig { | ||
BlockIDFlag block_id_flag = 1; | ||
bytes validator_address = 2; | ||
Timestamp timestamp = 3; | ||
bytes signature = 4; | ||
} | ||
|
||
message Timestamp { | ||
// Represents seconds of UTC time since Unix epoch | ||
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to | ||
// 9999-12-31T23:59:59Z inclusive. | ||
int64 seconds = 1; | ||
|
||
// Non-negative fractions of a second at nanosecond resolution. Negative | ||
// second values with fractions must still have non-negative nanos values | ||
// that count forward in time. Must be from 0 to 999,999,999 | ||
// inclusive. | ||
int32 nanos = 2; | ||
} | ||
|
||
message LightHeader { | ||
Consensus version = 1; | ||
string chain_id = 2; | ||
int64 height = 3; | ||
Timestamp time = 4; | ||
BlockID last_block_id = 5; | ||
bytes last_commit_hash = 6; // commit from validators from the last block | ||
bytes data_hash = 7; // transactions | ||
bytes validators_hash = 8; // validators for the current block | ||
bytes next_validators_hash = 9; // validators for the next block | ||
bytes consensus_hash = 10; // consensus params for current block | ||
bytes app_hash = 11; // state after txs from the previous block | ||
bytes last_results_hash = 12; // root hash of all results from the txs from the previous block | ||
bytes evidence_hash = 13; // evidence included in the block | ||
bytes proposer_address = 14; // original proposer of the block | ||
} | ||
|
||
message SignedHeader { | ||
LightHeader header = 1; | ||
Commit commit = 2; | ||
} | ||
|
||
message TmHeader { | ||
SignedHeader signed_header = 1; | ||
ValidatorSet validator_set = 2; | ||
|
||
int64 trusted_height = 3; | ||
ValidatorSet trusted_validators = 4; | ||
} |