Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: MsgUpdateCrosschainFlags into MsgEnableCCTXFlags, MsgDisableCCTXFlags and MsgUpdateGasPriceIncreaseFlags #2269

Merged
merged 19 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* [2205](https://github.com/zeta-chain/node/pull/2205) - remove deprecated variables pre-v17
* [2226](https://github.com/zeta-chain/node/pull/2226) - improve Go formatting with imports standardization and max line length to 120
* [2262](https://github.com/zeta-chain/node/pull/2262) - refactor MsgUpdateZRC20 into MsgPauseZrc20 and MsgUnPauseZRC20
* [2269](https://github.com/zeta-chain/node/pull/2269) - refactor MsgUpdateCrosschainFlags into MsgEnableCCTX, MsgDisableCCTX and MsgUpdateGasPriceIncreaseFlags


### Tests

Expand Down
6 changes: 5 additions & 1 deletion docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57735,13 +57735,17 @@ definitions:
type: object
observerMsgAddObserverResponse:
type: object
observerMsgDisableCCTXResponse:
type: object
observerMsgEnableCCTXResponse:
type: object
observerMsgRemoveChainParamsResponse:
type: object
observerMsgResetChainNoncesResponse:
type: object
observerMsgUpdateChainParamsResponse:
type: object
observerMsgUpdateCrosschainFlagsResponse:
observerMsgUpdateGasPriceIncreaseFlagsResponse:
type: object
observerMsgUpdateKeygenResponse:
type: object
Expand Down
4 changes: 4 additions & 0 deletions docs/releases/v17_breaking_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* `MsgUpdateVerificationFlags` has been removed, and replaced with `MsgEnableHeaderVerification` and `MsgDisableHeaderVerification` messages.
* `MsgEnableHeaderVerification` message enables block header verification for a list of chains and can be triggered via `PolicyType_groupOperational`
* `MsgDisableHeaderVerification` message disables block header verification for a list of chains and can be triggered via `PolicyType_emergency`
* `MsgUpdateCrosschainFlags` has been removed,and replaced with `MsgEnableCCTX`, `MsgDisableCCTX` and `MsgUpdateGasPriceIncreaseFlags` messages.
kingpinXD marked this conversation as resolved.
Show resolved Hide resolved
kingpinXD marked this conversation as resolved.
Show resolved Hide resolved
* `MsgEnableCCTX` message enables either the IsInboundEnabled flag, or the IsOutboundEnabled flag or both `PolicyType_groupOperational`
* `MsgDisableCCTX` message disables either the IsInboundEnabled flag, or the IsOutboundEnabled flag or both `PolicyType_emergency`
* `MsgUpdateGasPriceIncreaseFlags` message updates the gas price increase flags and can be triggered via `PolicyType_groupOperational`

### `BallotMaturityBlocks` moved to `emissions` module

Expand Down
54 changes: 38 additions & 16 deletions docs/spec/observer/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,6 @@ message MsgAddBlameVote {
}
```

## MsgUpdateCrosschainFlags

UpdateCrosschainFlags updates the crosschain related flags.

Aurthorized: admin policy group 1 (except enabling/disabled
inbounds/outbounds and gas price increase), admin policy group 2 (all).

```proto
message MsgUpdateCrosschainFlags {
string creator = 1;
bool isInboundEnabled = 3;
bool isOutboundEnabled = 4;
GasPriceIncreaseFlags gasPriceIncreaseFlags = 5;
}
```

## MsgUpdateKeygen

UpdateKeygen updates the block height of the keygen and sets the status to
Expand Down Expand Up @@ -142,3 +126,41 @@ message MsgVoteTSS {
}
```

## MsgEnableCCTX

EnableCCTX enables the IsInboundEnabled and IsOutboundEnabled flags.These flags control the creation of inbounds and outbounds.
The flags are enabled by the policy account with the groupOperational policy type.

```proto
message MsgEnableCCTX {
string creator = 1;
bool enableInbound = 2;
bool enableOutbound = 3;
}
```

## MsgDisableCCTX

DisableCCTX disables the IsInboundEnabled and IsOutboundEnabled flags. These flags control the creation of inbounds and outbounds.
The flags are disabled by the policy account with the groupEmergency policy type.

```proto
message MsgDisableCCTX {
string creator = 1;
bool disableInbound = 2;
bool disableOutbound = 3;
}
```

## MsgUpdateGasPriceIncreaseFlags

UpdateGasPriceIncreaseFlags updates the GasPriceIncreaseFlags. These flags control the increase of gas prices.
The flags are updated by the policy account with the groupOperational policy type.

```proto
message MsgUpdateGasPriceIncreaseFlags {
string creator = 1;
GasPriceIncreaseFlags gasPriceIncreaseFlags = 2;
}
```

15 changes: 12 additions & 3 deletions proto/zetachain/zetacore/observer/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,19 @@ message EventNewObserverAdded {
uint64 observer_last_block_count = 5;
}

message EventCrosschainFlagsUpdated {
message EventCCTXDisabled {
string msg_type_url = 1;
bool isInboundEnabled = 2;
bool isOutboundEnabled = 3;
GasPriceIncreaseFlags gasPriceIncreaseFlags = 4;
string signer = 5;
}

message EventCCTXEnabled {
string msg_type_url = 1;
bool isInboundEnabled = 2;
bool isOutboundEnabled = 3;
}

message EventGasPriceIncreaseFlagsUpdated {
string msg_type_url = 1;
GasPriceIncreaseFlags gasPriceIncreaseFlags = 2;
}
39 changes: 28 additions & 11 deletions proto/zetachain/zetacore/observer/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ service Msg {
rpc RemoveChainParams(MsgRemoveChainParams)
returns (MsgRemoveChainParamsResponse);
rpc AddBlameVote(MsgAddBlameVote) returns (MsgAddBlameVoteResponse);
rpc UpdateCrosschainFlags(MsgUpdateCrosschainFlags)
returns (MsgUpdateCrosschainFlagsResponse);
rpc UpdateKeygen(MsgUpdateKeygen) returns (MsgUpdateKeygenResponse);
rpc VoteBlockHeader(MsgVoteBlockHeader) returns (MsgVoteBlockHeaderResponse);
rpc ResetChainNonces(MsgResetChainNonces)
returns (MsgResetChainNoncesResponse);
rpc VoteTSS(MsgVoteTSS) returns (MsgVoteTSSResponse);
rpc EnableCCTX(MsgEnableCCTX) returns (MsgEnableCCTXResponse);
rpc DisableCCTX(MsgDisableCCTX) returns (MsgDisableCCTXResponse);
rpc UpdateGasPriceIncreaseFlags(MsgUpdateGasPriceIncreaseFlags)
returns (MsgUpdateGasPriceIncreaseFlagsResponse);
}

message MsgUpdateObserver {
Expand Down Expand Up @@ -83,15 +85,6 @@ message MsgAddBlameVote {

message MsgAddBlameVoteResponse {}

message MsgUpdateCrosschainFlags {
string creator = 1;
bool isInboundEnabled = 3;
bool isOutboundEnabled = 4;
GasPriceIncreaseFlags gasPriceIncreaseFlags = 5;
}

message MsgUpdateCrosschainFlagsResponse {}

message MsgUpdateKeygen {
string creator = 1;
int64 block = 2;
Expand Down Expand Up @@ -120,3 +113,27 @@ message MsgVoteTSSResponse {
bool vote_finalized = 2;
bool keygen_success = 3;
}

message MsgEnableCCTX {
string creator = 1;
bool enableInbound = 2;
bool enableOutbound = 3;
}

message MsgEnableCCTXResponse {}

message MsgDisableCCTX {
string creator = 1;
bool disableInbound = 2;
bool disableOutbound = 3;
}

message MsgDisableCCTXResponse {}

message MsgUpdateGasPriceIncreaseFlags {
string creator = 1;
GasPriceIncreaseFlags gasPriceIncreaseFlags = 2
[ (gogoproto.nullable) = false ];
}

message MsgUpdateGasPriceIncreaseFlagsResponse {}
9 changes: 9 additions & 0 deletions testutil/sample/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,12 @@ func NonceToCCTX(t *testing.T, seed string) types.NonceToCctx {
Tss: Tss().TssPubkey,
}
}

func GasPriceIncreaseFlags() types.GasPriceIncreaseFlags {
return types.GasPriceIncreaseFlags{
EpochLength: 1,
RetryInterval: 1,
GasPriceIncreasePercent: 1,
MaxPendingCctxs: 100,
}
}
77 changes: 65 additions & 12 deletions typescript/zetachain/zetacore/observer/events_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ export declare class EventNewObserverAdded extends Message<EventNewObserverAdded
}

/**
* @generated from message zetachain.zetacore.observer.EventCrosschainFlagsUpdated
* @generated from message zetachain.zetacore.observer.EventCCTXDisabled
*/
export declare class EventCrosschainFlagsUpdated extends Message<EventCrosschainFlagsUpdated> {
export declare class EventCCTXDisabled extends Message<EventCCTXDisabled> {
/**
* @generated from field: string msg_type_url = 1;
*/
Expand All @@ -148,28 +148,81 @@ export declare class EventCrosschainFlagsUpdated extends Message<EventCrosschain
*/
isOutboundEnabled: boolean;

constructor(data?: PartialMessage<EventCCTXDisabled>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.observer.EventCCTXDisabled";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EventCCTXDisabled;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EventCCTXDisabled;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EventCCTXDisabled;

static equals(a: EventCCTXDisabled | PlainMessage<EventCCTXDisabled> | undefined, b: EventCCTXDisabled | PlainMessage<EventCCTXDisabled> | undefined): boolean;
}

/**
* @generated from message zetachain.zetacore.observer.EventCCTXEnabled
*/
export declare class EventCCTXEnabled extends Message<EventCCTXEnabled> {
/**
* @generated from field: zetachain.zetacore.observer.GasPriceIncreaseFlags gasPriceIncreaseFlags = 4;
* @generated from field: string msg_type_url = 1;
*/
gasPriceIncreaseFlags?: GasPriceIncreaseFlags;
msgTypeUrl: string;

/**
* @generated from field: bool isInboundEnabled = 2;
*/
isInboundEnabled: boolean;

/**
* @generated from field: string signer = 5;
* @generated from field: bool isOutboundEnabled = 3;
*/
signer: string;
isOutboundEnabled: boolean;

constructor(data?: PartialMessage<EventCCTXEnabled>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.observer.EventCCTXEnabled";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EventCCTXEnabled;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EventCCTXEnabled;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EventCCTXEnabled;

static equals(a: EventCCTXEnabled | PlainMessage<EventCCTXEnabled> | undefined, b: EventCCTXEnabled | PlainMessage<EventCCTXEnabled> | undefined): boolean;
}

/**
* @generated from message zetachain.zetacore.observer.EventGasPriceIncreaseFlagsUpdated
*/
export declare class EventGasPriceIncreaseFlagsUpdated extends Message<EventGasPriceIncreaseFlagsUpdated> {
/**
* @generated from field: string msg_type_url = 1;
*/
msgTypeUrl: string;

/**
* @generated from field: zetachain.zetacore.observer.GasPriceIncreaseFlags gasPriceIncreaseFlags = 2;
*/
gasPriceIncreaseFlags?: GasPriceIncreaseFlags;

constructor(data?: PartialMessage<EventCrosschainFlagsUpdated>);
constructor(data?: PartialMessage<EventGasPriceIncreaseFlagsUpdated>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.observer.EventCrosschainFlagsUpdated";
static readonly typeName = "zetachain.zetacore.observer.EventGasPriceIncreaseFlagsUpdated";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EventCrosschainFlagsUpdated;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EventGasPriceIncreaseFlagsUpdated;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EventCrosschainFlagsUpdated;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EventGasPriceIncreaseFlagsUpdated;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EventCrosschainFlagsUpdated;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EventGasPriceIncreaseFlagsUpdated;

static equals(a: EventCrosschainFlagsUpdated | PlainMessage<EventCrosschainFlagsUpdated> | undefined, b: EventCrosschainFlagsUpdated | PlainMessage<EventCrosschainFlagsUpdated> | undefined): boolean;
static equals(a: EventGasPriceIncreaseFlagsUpdated | PlainMessage<EventGasPriceIncreaseFlagsUpdated> | undefined, b: EventGasPriceIncreaseFlagsUpdated | PlainMessage<EventGasPriceIncreaseFlagsUpdated> | undefined): boolean;
}

Loading
Loading