From 8993c28816aa53838a6c982c89113baad80bb53e Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Wed, 18 Dec 2024 19:55:36 -0800 Subject: [PATCH 1/2] feat: add configurable signer latency correction --- cmd/zetae2e/local/local.go | 3 +- docs/cli/zetacored/cli.md | 57 +++--- docs/openapi/openapi.swagger.yaml | 5 + docs/spec/observer/messages.md | 2 +- e2e/e2etests/e2etests.go | 15 +- e2e/e2etests/test_operational_flags.go | 51 ++++- .../zetacore/observer/operational.proto | 8 + proto/zetachain/zetacore/observer/tx.proto | 3 +- testutil/sample/observer.go | 5 +- .../zetacore/observer/operational_pb.d.ts | 10 +- .../zetachain/zetacore/observer/tx_pb.d.ts | 2 +- .../client/cli/tx_update_operational_flags.go | 8 +- ...sg_server_update_operational_flags_test.go | 12 +- x/observer/types/errors.go | 22 ++- .../message_update_operational_flags_test.go | 16 +- x/observer/types/operational.go | 19 ++ x/observer/types/operational.pb.go | 97 ++++++++-- x/observer/types/operational_test.go | 33 +++- x/observer/types/tx.pb.go | 174 +++++++++--------- zetaclient/metrics/metrics.go | 7 + zetaclient/orchestrator/orchestrator.go | 61 ++++++ zetaclient/orchestrator/orchestrator_test.go | 54 ++++++ 22 files changed, 515 insertions(+), 149 deletions(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 4385101a24..65b5fdcf44 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -362,7 +362,8 @@ func localE2ETest(cmd *cobra.Command, _ []string) { if testAdmin { eg.Go(adminTestRoutine(conf, deployerRunner, verbose, - e2etests.TestOperationalFlagsName, + e2etests.TestZetaclientSignerOffsetName, + e2etests.TestZetaclientRestartHeightName, e2etests.TestWhitelistERC20Name, e2etests.TestPauseZRC20Name, e2etests.TestUpdateBytecodeZRC20Name, diff --git a/docs/cli/zetacored/cli.md b/docs/cli/zetacored/cli.md index 56e293efe4..5f6d963e6f 100644 --- a/docs/cli/zetacored/cli.md +++ b/docs/cli/zetacored/cli.md @@ -13347,34 +13347,35 @@ zetacored tx observer update-operational-flags [flags] ### Options ``` - -a, --account-number uint The account number of the signing account (offline mode only) - --aux Generate aux signer data instead of sending a tx - -b, --broadcast-mode string Transaction broadcasting mode (sync|async) - --chain-id string The network chain ID - --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) - --fee-granter string Fee granter grants fees for the transaction - --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer - --fees string Fees to pay along with transaction; eg: 10uatom - --file string Path to a JSON file containing OperationalFlags - --from string Name or address of private key with which to sign - --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) - --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) - --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) - --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) - -h, --help help for update-operational-flags - --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) - --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used - --ledger Use a connected Ledger device - --node string [host]:[port] to tendermint rpc interface for this chain - --note string Note to add a description to the transaction (previously --memo) - --offline Offline mode (does not allow any online functionality) - -o, --output string Output format (text|json) - --restart-height int Height for a coordinated zetaclient restart - -s, --sequence uint The sequence number of the signing account (offline mode only) - --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature - --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height - --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator - -y, --yes Skip tx broadcasting prompt confirmation + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async) + --chain-id string The network chain ID + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --file string Path to a JSON file containing OperationalFlags + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-operational-flags + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string [host]:[port] to tendermint rpc interface for this chain + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) + --restart-height int Height for a coordinated zetaclient restart + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --signer-block-time-offset duration Offset from the zetacore block time to initiate signing + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation ``` ### Options inherited from parent commands diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 65f305da0f..694f839db6 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -58110,6 +58110,11 @@ definitions: description: |- Height for a coordinated zetaclient restart. Will be ignored if missed. + signer_block_time_offset: + type: string + description: |- + Offset from the zetacore block time to initiate signing. + Should be calculated and set based on max(zetaclient_core_block_latency). description: Flags for the top-level operation of zetaclient. observerPendingNonces: type: object diff --git a/docs/spec/observer/messages.md b/docs/spec/observer/messages.md index acceee29f2..0e194bed85 100644 --- a/docs/spec/observer/messages.md +++ b/docs/spec/observer/messages.md @@ -169,7 +169,7 @@ message MsgUpdateGasPriceIncreaseFlags { ```proto message MsgUpdateOperationalFlags { string creator = 1; - OperationalFlags operationalFlags = 2; + OperationalFlags operational_flags = 2; } ``` diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index cabc1e394f..1b9f3ef419 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -132,7 +132,8 @@ const ( TestMigrateERC20CustodyFundsName = "migrate_erc20_custody_funds" TestMigrateTSSName = "migrate_tss" TestSolanaWhitelistSPLName = "solana_whitelist_spl" - TestOperationalFlagsName = "operational_flags" + TestZetaclientRestartHeightName = "zetaclient_restart_height" + TestZetaclientSignerOffsetName = "zetaclient_signer_offset" /* Operational tests @@ -880,10 +881,16 @@ var AllE2ETests = []runner.E2ETest{ TestMigrateERC20CustodyFunds, ), runner.NewE2ETest( - TestOperationalFlagsName, - "operational flags functionality", + TestZetaclientRestartHeightName, + "zetaclient scheduled restart height", []runner.ArgDefinition{}, - TestOperationalFlags, + TestZetaclientRestartHeight, + ), + runner.NewE2ETest( + TestZetaclientSignerOffsetName, + "zetaclient signer offset", + []runner.ArgDefinition{}, + TestZetaclientSignerOffset, ), /* Special tests diff --git a/e2e/e2etests/test_operational_flags.go b/e2e/e2etests/test_operational_flags.go index 5084c38b58..0a3d0ee38c 100644 --- a/e2e/e2etests/test_operational_flags.go +++ b/e2e/e2etests/test_operational_flags.go @@ -11,11 +11,13 @@ import ( ) const ( - startTimestampMetricName = "zetaclient_last_start_timestamp_seconds" + startTimestampMetricName = "zetaclient_last_start_timestamp_seconds" + blockTimeLatencyMetricName = "zetaclient_core_block_latency" + blockTimeLatencySleepMetricName = "zetaclient_core_block_latency_sleep" ) -// TestOperationalFlags tests the functionality of operations flags. -func TestOperationalFlags(r *runner.E2ERunner, _ []string) { +// TestZetaclientRestartHeight tests scheduling a zetaclient restart via operational flags +func TestZetaclientRestartHeight(r *runner.E2ERunner, _ []string) { _, err := r.Clients.Zetacore.Observer.OperationalFlags( r.Ctx, &observertypes.QueryOperationalFlagsRequest{}, @@ -60,3 +62,46 @@ func TestOperationalFlags(r *runner.E2ERunner, _ []string) { require.Greater(r, currentStartTime, originalStartTime+1) } + +// TestZetaclientSignerOffset tests scheduling a zetaclient restart via operational flags +func TestZetaclientSignerOffset(r *runner.E2ERunner, _ []string) { + startBlockTimeLatencySleep, err := r.Clients.ZetaclientMetrics.FetchGauge(blockTimeLatencySleepMetricName) + require.NoError(r, err) + require.InDelta(r, 0, startBlockTimeLatencySleep, .01, "start block time latency should be 0") + + // get starting block time latency. + // we need to ensure it's not zero (if zetaclient just finished a restart) + var startBlockTimeLatency float64 + require.Eventually(r, func() bool { + startBlockTimeLatency, err = r.Clients.ZetaclientMetrics.FetchGauge(blockTimeLatencyMetricName) + require.NoError(r, err) + return startBlockTimeLatency > 1 + }, time.Second*15, time.Millisecond*100) + + desiredSignerBlockTimeOffset := time.Duration(startBlockTimeLatency*float64(time.Second)) + time.Millisecond*200 + + updateMsg := observertypes.NewMsgUpdateOperationalFlags( + r.ZetaTxServer.MustGetAccountAddressFromName(utils.OperationalPolicyName), + observertypes.OperationalFlags{ + SignerBlockTimeOffset: &desiredSignerBlockTimeOffset, + }, + ) + + _, err = r.ZetaTxServer.BroadcastTx(utils.OperationalPolicyName, updateMsg) + require.NoError(r, err) + + operationalFlagsRes, err := r.Clients.Zetacore.Observer.OperationalFlags( + r.Ctx, + &observertypes.QueryOperationalFlagsRequest{}, + ) + require.NoError(r, err) + require.InDelta(r, desiredSignerBlockTimeOffset, *(operationalFlagsRes.OperationalFlags.SignerBlockTimeOffset), .01) + + require.Eventually(r, func() bool { + blockTimeLatencySleep, err := r.Clients.ZetaclientMetrics.FetchGauge(blockTimeLatencySleepMetricName) + if err != nil { + return false + } + return blockTimeLatencySleep > .05 + }, time.Second*20, time.Second*1) +} diff --git a/proto/zetachain/zetacore/observer/operational.proto b/proto/zetachain/zetacore/observer/operational.proto index f94c7e7d11..62ff737074 100644 --- a/proto/zetachain/zetacore/observer/operational.proto +++ b/proto/zetachain/zetacore/observer/operational.proto @@ -1,6 +1,9 @@ syntax = "proto3"; package zetachain.zetacore.observer; +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; + option go_package = "github.com/zeta-chain/node/x/observer/types"; // Flags for the top-level operation of zetaclient. @@ -8,4 +11,9 @@ message OperationalFlags { // Height for a coordinated zetaclient restart. // Will be ignored if missed. int64 restart_height = 1; + + // Offset from the zetacore block time to initiate signing. + // Should be calculated and set based on max(zetaclient_core_block_latency). + google.protobuf.Duration signer_block_time_offset = 2 + [ (gogoproto.stdduration) = true ]; } \ No newline at end of file diff --git a/proto/zetachain/zetacore/observer/tx.proto b/proto/zetachain/zetacore/observer/tx.proto index 0d4ecf275e..aaeb62ba7c 100644 --- a/proto/zetachain/zetacore/observer/tx.proto +++ b/proto/zetachain/zetacore/observer/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package zetachain.zetacore.observer; import "gogoproto/gogo.proto"; +import "google/protobuf/field_mask.proto"; import "zetachain/zetacore/observer/blame.proto"; import "zetachain/zetacore/observer/crosschain_flags.proto"; import "zetachain/zetacore/observer/observer.proto"; @@ -143,7 +144,7 @@ message MsgUpdateGasPriceIncreaseFlagsResponse {} message MsgUpdateOperationalFlags { string creator = 1; - OperationalFlags operationalFlags = 2 [ (gogoproto.nullable) = false ]; + OperationalFlags operational_flags = 2 [ (gogoproto.nullable) = false ]; } message MsgUpdateOperationalFlagsResponse {} diff --git a/testutil/sample/observer.go b/testutil/sample/observer.go index aa8e0d82c4..1a0ed8f2ba 100644 --- a/testutil/sample/observer.go +++ b/testutil/sample/observer.go @@ -4,6 +4,7 @@ import ( "fmt" "math/rand" "testing" + "time" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -14,6 +15,7 @@ import ( "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/pkg/cosmos" zetacrypto "github.com/zeta-chain/node/pkg/crypto" + "github.com/zeta-chain/node/pkg/ptr" "github.com/zeta-chain/node/x/observer/types" ) @@ -287,6 +289,7 @@ func GasPriceIncreaseFlags() types.GasPriceIncreaseFlags { func OperationalFlags() types.OperationalFlags { return types.OperationalFlags{ - RestartHeight: 1, + RestartHeight: 1, + SignerBlockTimeOffset: ptr.Ptr(time.Second), } } diff --git a/typescript/zetachain/zetacore/observer/operational_pb.d.ts b/typescript/zetachain/zetacore/observer/operational_pb.d.ts index 5bae51a4e0..c9fc213927 100644 --- a/typescript/zetachain/zetacore/observer/operational_pb.d.ts +++ b/typescript/zetachain/zetacore/observer/operational_pb.d.ts @@ -3,7 +3,7 @@ /* eslint-disable */ // @ts-nocheck -import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import type { BinaryReadOptions, Duration, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; /** @@ -20,6 +20,14 @@ export declare class OperationalFlags extends Message { */ restartHeight: bigint; + /** + * Offset from the zetacore block time to initiate signing. + * Should be calculated and set based on max(zetaclient_core_block_latency). + * + * @generated from field: google.protobuf.Duration signer_block_time_offset = 2; + */ + signerBlockTimeOffset?: Duration; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/typescript/zetachain/zetacore/observer/tx_pb.d.ts b/typescript/zetachain/zetacore/observer/tx_pb.d.ts index 9afe867fdf..40ea5f9e8f 100644 --- a/typescript/zetachain/zetacore/observer/tx_pb.d.ts +++ b/typescript/zetachain/zetacore/observer/tx_pb.d.ts @@ -694,7 +694,7 @@ export declare class MsgUpdateOperationalFlags extends Message signerBlockTimeOffsetLimit { + return cosmoserrors.Wrapf(ErrOperationalFlagsSignerBlockTimeOffsetLimit, "(%s)", signerBlockTimeOffset) + } + } return nil } diff --git a/x/observer/types/operational.pb.go b/x/observer/types/operational.pb.go index b7af5711cf..e5fb9c3281 100644 --- a/x/observer/types/operational.pb.go +++ b/x/observer/types/operational.pb.go @@ -5,16 +5,21 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -27,6 +32,9 @@ type OperationalFlags struct { // Height for a coordinated zetaclient restart. // Will be ignored if missed. RestartHeight int64 `protobuf:"varint,1,opt,name=restart_height,json=restartHeight,proto3" json:"restart_height,omitempty"` + // Offset from the zetacore block time to initiate signing. + // Should be calculated and set based on max(zetaclient_core_block_latency). + SignerBlockTimeOffset *time.Duration `protobuf:"bytes,2,opt,name=signer_block_time_offset,json=signerBlockTimeOffset,proto3,stdduration" json:"signer_block_time_offset,omitempty"` } func (m *OperationalFlags) Reset() { *m = OperationalFlags{} } @@ -69,6 +77,13 @@ func (m *OperationalFlags) GetRestartHeight() int64 { return 0 } +func (m *OperationalFlags) GetSignerBlockTimeOffset() *time.Duration { + if m != nil { + return m.SignerBlockTimeOffset + } + return nil +} + func init() { proto.RegisterType((*OperationalFlags)(nil), "zetachain.zetacore.observer.OperationalFlags") } @@ -78,19 +93,25 @@ func init() { } var fileDescriptor_ea3eed2ec55093b5 = []byte{ - // 184 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xad, 0x4a, 0x2d, 0x49, - 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x07, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0xf3, 0x93, 0x8a, 0x53, - 0x8b, 0xca, 0x52, 0x8b, 0xf4, 0xf3, 0x0b, 0x52, 0x8b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x12, 0x73, - 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xa4, 0xe1, 0xca, 0xf5, 0x60, 0xca, 0xf5, 0x60, 0xca, - 0x95, 0x2c, 0xb9, 0x04, 0xfc, 0x11, 0x3a, 0xdc, 0x72, 0x12, 0xd3, 0x8b, 0x85, 0x54, 0xb9, 0xf8, - 0x8a, 0x52, 0x8b, 0x4b, 0x12, 0x8b, 0x4a, 0xe2, 0x33, 0x52, 0x33, 0xd3, 0x33, 0x4a, 0x24, 0x18, - 0x15, 0x18, 0x35, 0x98, 0x83, 0x78, 0xa1, 0xa2, 0x1e, 0x60, 0x41, 0x27, 0xd7, 0x13, 0x8f, 0xe4, - 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, - 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4e, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, - 0xce, 0xcf, 0x05, 0xbb, 0x50, 0x17, 0xe2, 0xd8, 0xbc, 0xfc, 0x94, 0x54, 0xfd, 0x0a, 0x84, 0x53, - 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xae, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, - 0xcf, 0xd8, 0x7d, 0x54, 0xd6, 0x00, 0x00, 0x00, + // 282 bytes of a gzipped FileDescriptorProto + 0x1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0x21, 0xc6, 0x2c, 0x33, 0x60, 0xc3, 0x7f, 0x63, + 0x32, 0xd9, 0xb9, 0x38, 0x62, 0x5e, 0xcf, 0x7a, 0x3d, 0xbb, 0x5a, 0xeb, 0xa3, 0xad, 0x8f, 0xef, + 0x13, 0x32, 0x3f, 0xf4, 0x07, 0xa2, 0x55, 0xfe, 0x4e, 0x95, 0x30, 0x73, 0xe9, 0xe8, 0xfa, 0xb3, + 0xa5, 0x64, 0xd9, 0x52, 0xf2, 0xd3, 0x52, 0xf2, 0xd6, 0xd1, 0xc1, 0xb2, 0xa3, 0x83, 0xaf, 0x8e, + 0x0e, 0x1e, 0xce, 0xa5, 0xb2, 0x79, 0x93, 0xb0, 0x14, 0x4b, 0x57, 0xd9, 0xd4, 0xb7, 0x57, 0xe1, + 0x02, 0xf8, 0xf3, 0xa6, 0x3b, 0xfb, 0x52, 0x83, 0x49, 0xb6, 0x9d, 0xf6, 0xf2, 0x37, 0x00, 0x00, + 0xff, 0xff, 0xf0, 0xe0, 0x3c, 0x60, 0x67, 0x01, 0x00, 0x00, } func (m *OperationalFlags) Marshal() (dAtA []byte, err error) { @@ -113,6 +134,16 @@ func (m *OperationalFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.SignerBlockTimeOffset != nil { + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.SignerBlockTimeOffset, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.SignerBlockTimeOffset):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintOperational(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x12 + } if m.RestartHeight != 0 { i = encodeVarintOperational(dAtA, i, uint64(m.RestartHeight)) i-- @@ -141,6 +172,10 @@ func (m *OperationalFlags) Size() (n int) { if m.RestartHeight != 0 { n += 1 + sovOperational(uint64(m.RestartHeight)) } + if m.SignerBlockTimeOffset != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.SignerBlockTimeOffset) + n += 1 + l + sovOperational(uint64(l)) + } return n } @@ -198,6 +233,42 @@ func (m *OperationalFlags) Unmarshal(dAtA []byte) error { break } } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignerBlockTimeOffset", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOperational + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOperational + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOperational + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SignerBlockTimeOffset == nil { + m.SignerBlockTimeOffset = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.SignerBlockTimeOffset, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipOperational(dAtA[iNdEx:]) diff --git a/x/observer/types/operational_test.go b/x/observer/types/operational_test.go index 39ef06ef82..077e083bb0 100644 --- a/x/observer/types/operational_test.go +++ b/x/observer/types/operational_test.go @@ -2,8 +2,10 @@ package types_test import ( "testing" + "time" "github.com/stretchr/testify/require" + "github.com/zeta-chain/node/pkg/ptr" "github.com/zeta-chain/node/x/observer/types" ) @@ -14,18 +16,45 @@ func TestOperationalFlags_Validate(t *testing.T) { errContains string }{ { - name: "invalid operational flags", + name: "invalid restart height", of: types.OperationalFlags{ RestartHeight: -1, }, errContains: types.ErrOperationalFlagsRestartHeightNegative.Error(), }, { - name: "valid", + name: "valid restart height", of: types.OperationalFlags{ RestartHeight: 1, }, }, + { + name: "valid signer offset", + of: types.OperationalFlags{ + SignerBlockTimeOffset: ptr.Ptr(time.Second), + }, + }, + { + name: "negative signer offset", + of: types.OperationalFlags{ + SignerBlockTimeOffset: ptr.Ptr(-time.Second), + }, + errContains: types.ErrOperationalFlagsRestartHeightNegative.Error(), + }, + { + name: "signer offset limit exceeded", + of: types.OperationalFlags{ + SignerBlockTimeOffset: ptr.Ptr(time.Minute), + }, + errContains: types.ErrOperationalFlagsSignerBlockTimeOffsetLimit.Error(), + }, + { + name: "all flags valid", + of: types.OperationalFlags{ + RestartHeight: 1, + SignerBlockTimeOffset: ptr.Ptr(time.Second), + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index 7ea1ae4086..eb779eebc5 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -14,6 +14,7 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/fieldmaskpb" io "io" math "math" math_bits "math/bits" @@ -1242,7 +1243,7 @@ var xxx_messageInfo_MsgUpdateGasPriceIncreaseFlagsResponse proto.InternalMessage type MsgUpdateOperationalFlags struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - OperationalFlags OperationalFlags `protobuf:"bytes,2,opt,name=operationalFlags,proto3" json:"operationalFlags"` + OperationalFlags OperationalFlags `protobuf:"bytes,2,opt,name=operational_flags,json=operationalFlags,proto3" json:"operational_flags"` } func (m *MsgUpdateOperationalFlags) Reset() { *m = MsgUpdateOperationalFlags{} } @@ -1362,91 +1363,92 @@ func init() { } var fileDescriptor_eda6e3b1d16a4021 = []byte{ - // 1332 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcb, 0x6f, 0xdb, 0xc6, - 0x13, 0x36, 0x7f, 0xce, 0xc3, 0x1e, 0x5b, 0xb2, 0xc3, 0x9f, 0xe3, 0xd8, 0x74, 0xa3, 0xa6, 0x6c, - 0xe2, 0x28, 0x2f, 0x29, 0x56, 0x8a, 0x3e, 0x81, 0x02, 0x8e, 0x93, 0xd8, 0x6e, 0xea, 0x24, 0xa0, - 0xdc, 0xa0, 0xc8, 0x85, 0x58, 0x91, 0x6b, 0x8a, 0x35, 0xbd, 0x2b, 0x70, 0x29, 0x3b, 0x4e, 0x83, - 0x02, 0x3d, 0x16, 0xe8, 0x21, 0xa7, 0x9e, 0x0a, 0xf4, 0xde, 0xff, 0xa0, 0xf7, 0x1e, 0xd2, 0x43, - 0x81, 0x1c, 0x7b, 0x2a, 0x8a, 0xe4, 0xd4, 0xff, 0xa2, 0xe0, 0xee, 0x72, 0x25, 0x51, 0x32, 0x45, - 0xb9, 0xe8, 0x49, 0xe4, 0xec, 0xf7, 0xcd, 0x7c, 0xb3, 0x8f, 0x99, 0x15, 0xe1, 0xe2, 0x33, 0x1c, - 0x21, 0xa7, 0x89, 0x7c, 0x52, 0xe5, 0x4f, 0x34, 0xc4, 0x55, 0xda, 0x60, 0x38, 0xdc, 0xc7, 0x61, - 0x35, 0x7a, 0x5a, 0x69, 0x85, 0x34, 0xa2, 0xfa, 0x92, 0x42, 0x55, 0x12, 0x54, 0x25, 0x41, 0x19, - 0x73, 0x1e, 0xf5, 0x28, 0xc7, 0x55, 0xe3, 0x27, 0x41, 0x31, 0x2e, 0x67, 0x39, 0x6e, 0x04, 0x68, - 0x0f, 0x4b, 0x60, 0x2d, 0x0b, 0xe8, 0x84, 0x94, 0x31, 0x3e, 0x68, 0xef, 0x04, 0xc8, 0x63, 0x92, - 0x73, 0x35, 0x8b, 0x93, 0x3c, 0x48, 0x6c, 0x39, 0x0b, 0xdb, 0x42, 0x21, 0xda, 0x4b, 0xbc, 0xde, - 0xcc, 0x44, 0x62, 0xe2, 0xfa, 0xc4, 0xb3, 0x09, 0x25, 0x0e, 0x4e, 0x18, 0x97, 0x32, 0x67, 0x8f, - 0x25, 0xb0, 0x1b, 0x99, 0x72, 0x5b, 0x38, 0x44, 0x91, 0x4f, 0x09, 0x0a, 0x32, 0xb2,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, 0x89, 0x5b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xa3, 0x3d, 0x21, - 0x82, 0x12, 0x00, 0x00, + // 1356 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x92, 0x7e, 0x24, 0x2f, 0xb1, 0x93, 0x2e, 0x69, 0x9a, 0x6c, 0xa8, 0x09, 0x4b, 0x9b, + 0xba, 0x5f, 0x76, 0xe3, 0x22, 0x3e, 0x25, 0xa4, 0x34, 0x6d, 0x93, 0x50, 0xd2, 0x56, 0xeb, 0x50, + 0xa1, 0x5e, 0x96, 0xf1, 0xee, 0x78, 0xbd, 0x64, 0x3d, 0x63, 0xed, 0xac, 0x93, 0xa6, 0x54, 0x48, + 0x1c, 0x91, 0x38, 0xf4, 0xc6, 0x05, 0x89, 0x3b, 0xff, 0x01, 0x77, 0x0e, 0xe5, 0x80, 0xd4, 0x23, + 0x27, 0x84, 0xda, 0x13, 0xff, 0x05, 0xda, 0x99, 0xd9, 0xf1, 0xfa, 0x23, 0x6b, 0x27, 0x88, 0x53, + 0x3c, 0x6f, 0x7e, 0xbf, 0xf7, 0x7e, 0x6f, 0x3e, 0xde, 0x9b, 0x2c, 0x5c, 0x78, 0x8a, 0x23, 0xe4, + 0x34, 0x90, 0x4f, 0xca, 0xfc, 0x17, 0x0d, 0x71, 0x99, 0xd6, 0x18, 0x0e, 0xf7, 0x70, 0x58, 0x8e, + 0x9e, 0x94, 0x5a, 0x21, 0x8d, 0xa8, 0xbe, 0xa4, 0x50, 0xa5, 0x04, 0x55, 0x4a, 0x50, 0xc6, 0x9c, + 0x47, 0x3d, 0xca, 0x71, 0xe5, 0xf8, 0x97, 0xa0, 0x18, 0xcb, 0x1e, 0xa5, 0x5e, 0x80, 0xcb, 0x7c, + 0x54, 0x6b, 0xd7, 0xcb,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 0xd9, 0x58, 0xff, 0x0f, 0x64, 0xa5, + 0xf0, 0xb9, 0x06, 0xf3, 0x87, 0x34, 0x9e, 0x51, 0x8b, 0x63, 0x0f, 0xcf, 0xf8, 0xf4, 0x78, 0xbc, + 0x44, 0xd2, 0xad, 0x3b, 0x2f, 0x5e, 0x15, 0xb4, 0x97, 0xaf, 0x0a, 0xda, 0xdf, 0xaf, 0x0a, 0xda, + 0xf3, 0xd7, 0x85, 0xb1, 0x97, 0xaf, 0x0b, 0x63, 0x7f, 0xbe, 0x2e, 0x8c, 0x3d, 0xbe, 0xea, 0xf9, + 0x51, 0xa3, 0x5d, 0x2b, 0x39, 0xb4, 0xc9, 0x3f, 0x47, 0x5c, 0x17, 0x5f, 0x26, 0xe2, 0xff, 0x48, + 0xca, 0x4f, 0x52, 0x5f, 0x46, 0x0e, 0x5a, 0x98, 0xd5, 0x4e, 0xf1, 0xaf, 0x12, 0x37, 0xff, 0x0d, + 0x00, 0x00, 0xff, 0xff, 0xbb, 0xb6, 0x4e, 0x47, 0xa5, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/zetaclient/metrics/metrics.go b/zetaclient/metrics/metrics.go index 1c2e03a21f..5475930707 100644 --- a/zetaclient/metrics/metrics.go +++ b/zetaclient/metrics/metrics.go @@ -94,6 +94,13 @@ var ( Help: "Difference between system time and block time from zetacore", }) + // CoreBlockLatencySleep is a gauge of the duration we sleep before signing + CoreBlockLatencySleep = promauto.NewGauge(prometheus.GaugeOpts{ + Namespace: ZetaClientNamespace, + Name: "core_block_latency_sleep", + Help: "The duration we sleep before signing", + }) + // Info is a gauge that contains information about the zetaclient environment Info = promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, diff --git a/zetaclient/orchestrator/orchestrator.go b/zetaclient/orchestrator/orchestrator.go index 6e818329b1..3e475fe442 100644 --- a/zetaclient/orchestrator/orchestrator.go +++ b/zetaclient/orchestrator/orchestrator.go @@ -68,6 +68,9 @@ type Orchestrator struct { dbDirectory string baseLogger base.Logger + // signerBlockTimeOffset + signerBlockTimeOffset time.Duration + // misc logger multiLogger ts *metrics.TelemetryServer @@ -135,6 +138,12 @@ func (oc *Orchestrator) Start(ctx context.Context) error { bg.Work(ctx, oc.runScheduler, bg.WithName("runScheduler"), bg.WithLogger(oc.logger.Logger)) bg.Work(ctx, oc.runObserverSignerSync, bg.WithName("runObserverSignerSync"), bg.WithLogger(oc.logger.Logger)) bg.Work(ctx, oc.runAppContextUpdater, bg.WithName("runAppContextUpdater"), bg.WithLogger(oc.logger.Logger)) + bg.Work( + ctx, + oc.runSyncObserverOperationalFlags, + bg.WithName("runSyncObserverOperationalFlags"), + bg.WithLogger(oc.logger.Logger), + ) return nil } @@ -318,6 +327,13 @@ func (oc *Orchestrator) runScheduler(ctx context.Context) error { continue } + sleepDuration := time.Until(newBlock.Block.Time.Add(oc.signerBlockTimeOffset)) + if sleepDuration < 0 { + sleepDuration = 0 + } + metrics.CoreBlockLatencySleep.Set(sleepDuration.Seconds()) + time.Sleep(sleepDuration) + balance, err := oc.zetacoreClient.GetZetaHotKeyBalance(ctx) if err != nil { oc.logger.Error().Err(err).Msgf("couldn't get operator balance") @@ -795,3 +811,48 @@ func (oc *Orchestrator) syncObserverSigner(ctx context.Context) error { return nil } + +func (oc *Orchestrator) runSyncObserverOperationalFlags(ctx context.Context) error { + // every other block + const cadence = 2 * constant.ZetaBlockTime + + task := func(ctx context.Context, _ *ticker.Ticker) error { + if err := oc.syncObserverOperationalFlags(ctx); err != nil { + oc.logger.Error().Err(err).Msg("syncObserverOperationalFlags failed") + } + + return nil + } + + return ticker.Run( + ctx, + cadence, + task, + ticker.WithLogger(oc.logger.Logger, "SyncObserverOperationalFlags"), + ticker.WithStopChan(oc.stop), + ) +} + +func (oc *Orchestrator) syncObserverOperationalFlags(ctx context.Context) error { + client := oc.zetacoreClient + flags, err := client.GetOperationalFlags(ctx) + if err != nil { + return fmt.Errorf("get operational flags: %w", err) + } + + oc.mu.Lock() + defer oc.mu.Unlock() + newSignerBlockTimeOffsetPtr := flags.SignerBlockTimeOffset + if newSignerBlockTimeOffsetPtr == nil { + return nil + } + newSignerBlockTimeOffset := *newSignerBlockTimeOffsetPtr + if oc.signerBlockTimeOffset != newSignerBlockTimeOffset { + oc.logger.Info(). + Dur("offset", newSignerBlockTimeOffset). + Msg("block time offset updated") + oc.signerBlockTimeOffset = newSignerBlockTimeOffset + } + + return nil +} diff --git a/zetaclient/orchestrator/orchestrator_test.go b/zetaclient/orchestrator/orchestrator_test.go index 8637a47e17..2a961a43fa 100644 --- a/zetaclient/orchestrator/orchestrator_test.go +++ b/zetaclient/orchestrator/orchestrator_test.go @@ -3,6 +3,7 @@ package orchestrator import ( "context" "testing" + "time" sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" @@ -14,6 +15,7 @@ import ( "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/pkg/coin" + "github.com/zeta-chain/node/pkg/ptr" "github.com/zeta-chain/node/testutil/sample" crosschainkeeper "github.com/zeta-chain/node/x/crosschain/keeper" crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" @@ -540,6 +542,58 @@ func Test_GetPendingCctxsWithinRateLimit(t *testing.T) { } } +func TestSyncObserverOperationalFlags(t *testing.T) { + ctx := context.Background() + t.Run("no flags set", func(t *testing.T) { + client := mocks.NewZetacoreClient(t) + + client.Mock.On("GetOperationalFlags", ctx).Return(observertypes.OperationalFlags{}, nil) + orchestrator := mockOrchestrator(t, client) + err := orchestrator.syncObserverOperationalFlags(ctx) + require.NoError(t, err) + require.Zero( + t, + orchestrator.signerBlockTimeOffset, + "block time offset should be zero if operational flags not set", + ) + }) + + t.Run("flags set", func(t *testing.T) { + client := mocks.NewZetacoreClient(t) + + expectedDuration := time.Second + client.Mock.On("GetOperationalFlags", ctx).Return(observertypes.OperationalFlags{ + SignerBlockTimeOffset: ptr.Ptr(expectedDuration), + }, nil) + orchestrator := mockOrchestrator(t, client) + err := orchestrator.syncObserverOperationalFlags(ctx) + require.NoError(t, err) + require.Equal(t, expectedDuration, orchestrator.signerBlockTimeOffset) + }) + + t.Run("flags updated", func(t *testing.T) { + client := mocks.NewZetacoreClient(t) + + expectedDuration := time.Second + mock := client.Mock.On("GetOperationalFlags", ctx).Return(observertypes.OperationalFlags{ + SignerBlockTimeOffset: ptr.Ptr(expectedDuration), + }, nil) + orchestrator := mockOrchestrator(t, client) + err := orchestrator.syncObserverOperationalFlags(ctx) + require.NoError(t, err) + require.Equal(t, expectedDuration, orchestrator.signerBlockTimeOffset) + + mock.Unset() + expectedDuration = time.Second * 2 + client.Mock.On("GetOperationalFlags", ctx).Return(observertypes.OperationalFlags{ + SignerBlockTimeOffset: ptr.Ptr(expectedDuration), + }, nil) + err = orchestrator.syncObserverOperationalFlags(ctx) + require.NoError(t, err) + require.Equal(t, expectedDuration, orchestrator.signerBlockTimeOffset) + }) +} + func mockOrchestrator(t *testing.T, zetaClient interfaces.ZetacoreClient, chainsOrParams ...any) *Orchestrator { supportedChains, obsParams := parseChainsWithParams(t, chainsOrParams...) From d5d0c221cd90126746c7771e8ca62cbc9bec2b1f Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 19 Dec 2024 08:26:09 -0800 Subject: [PATCH 2/2] coderabbit feedback --- proto/zetachain/zetacore/observer/tx.proto | 1 - x/observer/types/operational.go | 2 +- x/observer/types/operational_test.go | 2 +- x/observer/types/tx.pb.go | 172 ++++++++++----------- 4 files changed, 87 insertions(+), 90 deletions(-) diff --git a/proto/zetachain/zetacore/observer/tx.proto b/proto/zetachain/zetacore/observer/tx.proto index aaeb62ba7c..b3e1c1ab97 100644 --- a/proto/zetachain/zetacore/observer/tx.proto +++ b/proto/zetachain/zetacore/observer/tx.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package zetachain.zetacore.observer; import "gogoproto/gogo.proto"; -import "google/protobuf/field_mask.proto"; import "zetachain/zetacore/observer/blame.proto"; import "zetachain/zetacore/observer/crosschain_flags.proto"; import "zetachain/zetacore/observer/observer.proto"; diff --git a/x/observer/types/operational.go b/x/observer/types/operational.go index bdc4d124de..4da766c53a 100644 --- a/x/observer/types/operational.go +++ b/x/observer/types/operational.go @@ -17,7 +17,7 @@ func (f *OperationalFlags) Validate() error { if f.SignerBlockTimeOffset != nil { signerBlockTimeOffset := *f.SignerBlockTimeOffset if signerBlockTimeOffset < 0 { - return ErrOperationalFlagsRestartHeightNegative + return ErrOperationalFlagsSignerBlockTimeOffsetNegative } if signerBlockTimeOffset > signerBlockTimeOffsetLimit { return cosmoserrors.Wrapf(ErrOperationalFlagsSignerBlockTimeOffsetLimit, "(%s)", signerBlockTimeOffset) diff --git a/x/observer/types/operational_test.go b/x/observer/types/operational_test.go index 077e083bb0..79c8caf0dc 100644 --- a/x/observer/types/operational_test.go +++ b/x/observer/types/operational_test.go @@ -39,7 +39,7 @@ func TestOperationalFlags_Validate(t *testing.T) { of: types.OperationalFlags{ SignerBlockTimeOffset: ptr.Ptr(-time.Second), }, - errContains: types.ErrOperationalFlagsRestartHeightNegative.Error(), + errContains: types.ErrOperationalFlagsSignerBlockTimeOffsetNegative.Error(), }, { name: "signer offset limit exceeded", diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index eb779eebc5..2481756e9e 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -14,7 +14,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - _ "google.golang.org/protobuf/types/known/fieldmaskpb" io "io" math "math" math_bits "math/bits" @@ -1363,92 +1362,91 @@ func init() { } var fileDescriptor_eda6e3b1d16a4021 = []byte{ - // 1356 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x92, 0x7e, 0x24, 0x2f, 0xb1, 0x93, 0x2e, 0x69, 0x9a, 0x6c, 0xa8, 0x09, 0x4b, 0x9b, - 0xba, 0x5f, 0x76, 0xe3, 0x22, 0x3e, 0x25, 0xa4, 0x34, 0x6d, 0x93, 0x50, 0xd2, 0x56, 0xeb, 0x50, - 0xa1, 0x5e, 0x96, 0xf1, 0xee, 0x78, 0xbd, 0x64, 0x3d, 0x63, 0xed, 0xac, 0x93, 0xa6, 0x54, 0x48, - 0x1c, 0x91, 0x38, 0xf4, 0xc6, 0x05, 0x89, 0x3b, 0xff, 0x01, 0x77, 0x0e, 0xe5, 0x80, 0xd4, 0x23, - 0x27, 0x84, 0xda, 0x13, 0xff, 0x05, 0xda, 0x99, 0xd9, 0xf1, 0xfa, 0x23, 0x6b, 0x27, 0x88, 0x53, - 0x3c, 0x6f, 0x7e, 0xbf, 0xf7, 0x7e, 0x6f, 0x3e, 0xde, 0x9b, 0x2c, 0x5c, 0x78, 0x8a, 0x23, 0xe4, - 0x34, 0x90, 0x4f, 0xca, 0xfc, 0x17, 0x0d, 0x71, 0x99, 0xd6, 0x18, 0x0e, 0xf7, 0x70, 0x58, 0x8e, - 0x9e, 0x94, 0x5a, 0x21, 0x8d, 0xa8, 0xbe, 0xa4, 0x50, 0xa5, 0x04, 0x55, 0x4a, 0x50, 0xc6, 0x9c, - 0x47, 0x3d, 0xca, 0x71, 0xe5, 0xf8, 0x97, 0xa0, 0x18, 0xcb, 0x1e, 0xa5, 0x5e, 0x80, 0xcb, 0x7c, - 0x54, 0x6b, 0xd7, 0xcb, 0x75, 0x1f, 0x07, 0xae, 0xdd, 0x44, 0x6c, 0x57, 0x22, 0x2e, 0x65, 0x85, - 0xae, 0x05, 0xa8, 0x89, 0x25, 0xb0, 0x92, 0x05, 0x74, 0x42, 0xca, 0x18, 0x9f, 0xb4, 0xeb, 0x01, - 0xf2, 0x98, 0xe4, 0x5c, 0xc9, 0xe2, 0x24, 0x3f, 0x24, 0xb6, 0x98, 0x85, 0x6d, 0xa1, 0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, 0xb1, 0x97, 0xaf, 0x0b, 0x63, 0x7f, 0xbe, 0x2e, 0x8c, 0x3d, 0xbe, 0xea, 0xf9, - 0x51, 0xa3, 0x5d, 0x2b, 0x39, 0xb4, 0xc9, 0x3f, 0x47, 0x5c, 0x17, 0x5f, 0x26, 0xe2, 0xff, 0x48, - 0xca, 0x4f, 0x52, 0x5f, 0x46, 0x0e, 0x5a, 0x98, 0xd5, 0x4e, 0xf1, 0xaf, 0x12, 0x37, 0xff, 0x0d, - 0x00, 0x00, 0xff, 0xff, 0xbb, 0xb6, 0x4e, 0x47, 0xa5, 0x12, 0x00, 0x00, + // 1336 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0xdc, 0x44, + 0x14, 0x8f, 0x49, 0x3f, 0x92, 0x97, 0xec, 0x26, 0x35, 0x69, 0x9a, 0x38, 0x74, 0x29, 0xa6, 0x4d, + 0xb7, 0x5f, 0xbb, 0xcd, 0x16, 0xf1, 0x29, 0x21, 0xa5, 0x69, 0x9b, 0x84, 0x92, 0xb6, 0xf2, 0x86, + 0x0a, 0xf5, 0x62, 0x66, 0xed, 0x89, 0xd7, 0xc4, 0x99, 0x59, 0x79, 0xbc, 0x49, 0x53, 0x2a, 0x24, + 0x8e, 0x48, 0x1c, 0x7a, 0xe3, 0x82, 0xc4, 0x9d, 0xff, 0x80, 0x3b, 0x87, 0x72, 0x40, 0xea, 0x91, + 0x13, 0x42, 0xed, 0x89, 0xff, 0x02, 0x79, 0x66, 0x3c, 0xeb, 0xfd, 0x88, 0xd7, 0x5b, 0xc4, 0x69, + 0xed, 0x37, 0xbf, 0xdf, 0x7b, 0xbf, 0x37, 0x1f, 0xef, 0xcd, 0x1a, 0xce, 0x3f, 0xc1, 0x11, 0x72, + 0x9a, 0xc8, 0x27, 0x55, 0xfe, 0x44, 0x43, 0x5c, 0xa5, 0x0d, 0x86, 0xc3, 0x7d, 0x1c, 0x56, 0xa3, + 0xc7, 0x95, 0x56, 0x48, 0x23, 0xaa, 0x2f, 0x29, 0x54, 0x25, 0x41, 0x55, 0x12, 0x94, 0x31, 0xe7, + 0x51, 0x8f, 0x72, 0x5c, 0x35, 0x7e, 0x12, 0x14, 0xe3, 0x62, 0x96, 0xe3, 0x46, 0x80, 0xf6, 0xb0, + 0x04, 0xd6, 0xb2, 0x80, 0x4e, 0x48, 0x19, 0xe3, 0x83, 0xf6, 0x4e, 0x80, 0x3c, 0x26, 0x39, 0x97, + 0xb3, 0x38, 0xc9, 0x83, 0xc4, 0x96, 0xb3, 0xb0, 0x2d, 0x14, 0xa2, 0xbd, 0xc4, 0xeb, 0xf5, 0x4c, + 0x24, 0x26, 0xae, 0x4f, 0x3c, 0x9b, 0x50, 0xe2, 0xe0, 0x84, 0x71, 0x21, 0x73, 0xf6, 0x58, 0x02, + 0xbb, 0x96, 0x29, 0xb7, 0x85, 0x43, 0x14, 0xf9, 0x94, 0xa0, 0x20, 0x23, 0xbb, 0xd6, 0xae, 0x57, + 0xe5, 0x26, 0x26, 0x7f, 0x86, 0x60, 0x5b, 0x21, 0xa5, 0x3b, 0x4c, 0xfe, 0x08, 0xac, 0xf9, 0x8f, + 0x06, 0xa7, 0xb6, 0x98, 0xf7, 0x45, 0xcb, 0x45, 0x11, 0xbe, 0x2f, 0xe3, 0xeb, 0x0b, 0x70, 0xd2, + 0x09, 0x31, 0x8a, 0x68, 0xb8, 0xa0, 0x9d, 0xd3, 0xca, 0x93, 0x56, 0xf2, 0xaa, 0x5f, 0x87, 0x39, + 0x1a, 0xb8, 0x76, 0xa2, 0xd4, 0x46, 0xae, 0x1b, 0x62, 0xc6, 0x16, 0xde, 0xe0, 0x30, 0x9d, 0x06, + 0x6e, 0xe2, 0x64, 0x55, 0x8c, 0xc4, 0x0c, 0x82, 0x0f, 0xfa, 0x19, 0xe3, 0x82, 0x41, 0xf0, 0x41, + 0x2f, 0xe3, 0x21, 0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 0x33, + 0x73, 0xf9, 0x79, 0x30, 0xb9, 0xc7, 0x27, 0x39, 0x77, 0x93, 0xec, 0x50, 0x73, 0x9e, 0x2f, 0xae, + 0x52, 0xa3, 0x64, 0xae, 0xc2, 0x8c, 0xda, 0x14, 0x77, 0xf1, 0xa1, 0x87, 0x49, 0x86, 0xd0, 0x39, + 0x38, 0xce, 0x4f, 0xa6, 0x54, 0x29, 0x5e, 0xcc, 0x45, 0x38, 0xd3, 0xe3, 0x42, 0x79, 0xff, 0x49, + 0x83, 0x37, 0xf9, 0x36, 0x60, 0x38, 0xe2, 0xbb, 0xe0, 0x1e, 0xaf, 0xfe, 0xaf, 0x37, 0x17, 0xcb, + 0x30, 0x23, 0x86, 0x78, 0x0b, 0xb1, 0x03, 0x7a, 0xc0, 0x27, 0x64, 0xdc, 0x2a, 0x38, 0xca, 0xf5, + 0xe7, 0xf4, 0x40, 0x2f, 0xc3, 0x6c, 0x1a, 0xd7, 0xf4, 0xbd, 0xa6, 0x2c, 0x1e, 0xc5, 0x0e, 0x70, + 0xc3, 0xf7, 0x9a, 0xe6, 0x59, 0x58, 0x1a, 0xa0, 0x4e, 0xa9, 0xff, 0x55, 0x03, 0x90, 0x93, 0xb6, + 0x5d, 0xaf, 0x67, 0x88, 0x3e, 0x0b, 0x10, 0x31, 0x96, 0xec, 0x32, 0xb1, 0x33, 0x27, 0x23, 0xc6, + 0xe4, 0xbe, 0xba, 0x0a, 0xfa, 0x2e, 0x9f, 0x17, 0x3b, 0x5e, 0x2e, 0x5b, 0xd6, 0x33, 0xa1, 0x7d, + 0x56, 0x8c, 0x3c, 0xc2, 0x11, 0xda, 0x10, 0x95, 0xed, 0x16, 0x9c, 0x60, 0x11, 0x8a, 0xda, 0x4c, + 0x96, 0xf2, 0xab, 0x47, 0x55, 0x36, 0xd9, 0xc7, 0x2c, 0xec, 0x60, 0x7f, 0x1f, 0xd7, 0x39, 0xc7, + 0x92, 0x5c, 0xf3, 0xfb, 0x4e, 0x89, 0xde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0x50, 0x29, 0xf0, 0xf0, 0x0a, 0x35, 0xa0, 0x61, 0xe9, 0x3f, 0x6b, 0xb0, 0x94, 0xd5, 0xad, + 0x3e, 0xc9, 0xb7, 0x2d, 0x07, 0x92, 0x8d, 0xb5, 0xff, 0x40, 0x56, 0x0a, 0x9f, 0x69, 0x30, 0x7f, + 0x44, 0xe3, 0xc9, 0x5b, 0x1c, 0x7b, 0x78, 0xc6, 0xa7, 0xaf, 0xc7, 0x4b, 0x24, 0xdd, 0xbc, 0xfd, + 0xfc, 0x65, 0x49, 0x7b, 0xf1, 0xb2, 0xa4, 0xfd, 0xfd, 0xb2, 0xa4, 0x3d, 0x7b, 0x55, 0x1a, 0x7b, + 0xf1, 0xaa, 0x34, 0xf6, 0xe7, 0xab, 0xd2, 0xd8, 0xa3, 0x2b, 0x9e, 0x1f, 0x35, 0xdb, 0x8d, 0x8a, + 0x43, 0xf7, 0xf8, 0xe7, 0x88, 0x6b, 0xe2, 0xcb, 0x44, 0xfc, 0x8f, 0xa4, 0xfa, 0x38, 0xf5, 0x65, + 0xe4, 0xb0, 0x85, 0x59, 0xe3, 0x04, 0xff, 0x2a, 0x71, 0xe3, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x05, 0x3a, 0x52, 0xd9, 0x83, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used.