syntax = "proto3";

package ibc.core.client.v1;

option go_package = "github.com/cosmos/ibc-go/v9/modules/core/02-client/types";

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";

// IdentifiedClientState defines a client state with an additional client
// identifier field.
message IdentifiedClientState {
  // client identifier
  string client_id = 1;
  // client state
  google.protobuf.Any client_state = 2;
}

// ConsensusStateWithHeight defines a consensus state with an additional height
// field.
message ConsensusStateWithHeight {
  // consensus state height
  Height height = 1 [(gogoproto.nullable) = false];
  // consensus state
  google.protobuf.Any consensus_state = 2;
}

// ClientConsensusStates defines all the stored consensus states for a given
// client.
message ClientConsensusStates {
  // client identifier
  string client_id = 1;
  // consensus states and their heights associated with the client
  repeated ConsensusStateWithHeight consensus_states = 2 [(gogoproto.nullable) = false];
}

// Height is a monotonically increasing data type
// that can be compared against another Height for the purposes of updating and
// freezing clients
//
// Normally the RevisionHeight is incremented at each height while keeping
// RevisionNumber the same. However some consensus algorithms may choose to
// reset the height in certain conditions e.g. hard forks, state-machine
// breaking changes In these cases, the RevisionNumber is incremented so that
// height continues to be monitonically increasing even as the RevisionHeight
// gets reset
//
// Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag.
// This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height.
message Height {
  option (gogoproto.goproto_getters)  = false;
  option (gogoproto.goproto_stringer) = false;

  // the revision that the client is currently on
  uint64 revision_number = 1 [(gogoproto.jsontag) = "revision_number"];
  // the height within the given revision
  uint64 revision_height = 2 [(gogoproto.jsontag) = "revision_height"];
}

// Params defines the set of IBC light client parameters.
message Params {
  // allowed_clients defines the list of allowed client state types which can be created
  // and interacted with. If a client type is removed from the allowed clients list, usage
  // of this client will be disabled until it is added again to the list.
  repeated string allowed_clients = 1;
}
