diff --git a/changelog.md b/changelog.md index 5f608c7b2f..56f8373f26 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,12 @@ ### Fixes +* [1687](https://github.com/zeta-chain/node/pull/1687) - only use EVM supported chains for gas stability pool + +## Version: v12.2.4 + +### Fixes + * [1638](https://github.com/zeta-chain/node/issues/1638) - additional check to make sure external chain height always increases * [1672](https://github.com/zeta-chain/node/pull/1672) - paying 50% more than base gas price to buffer EIP1559 gas price increase * [1642](https://github.com/zeta-chain/node/pull/1642) - Change WhitelistERC20 authorization from group1 to group2 diff --git a/proto/crosschain/events.proto b/proto/crosschain/events.proto index 90fff428fb..6497fd147e 100644 --- a/proto/crosschain/events.proto +++ b/proto/crosschain/events.proto @@ -58,3 +58,9 @@ message EventOutboundSuccess { string new_status = 4; string value_received = 5; } + +message EventCCTXGasPriceIncreased { + string cctx_index = 1; + string gas_price_increase = 2; + string additional_fees = 3; +} diff --git a/typescript/crosschain/events_pb.d.ts b/typescript/crosschain/events_pb.d.ts index 4bcfde46e6..285f476b30 100644 --- a/typescript/crosschain/events_pb.d.ts +++ b/typescript/crosschain/events_pb.d.ts @@ -291,3 +291,37 @@ export declare class EventOutboundSuccess extends Message static equals(a: EventOutboundSuccess | PlainMessage | undefined, b: EventOutboundSuccess | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.crosschain.EventCCTXGasPriceIncreased + */ +export declare class EventCCTXGasPriceIncreased extends Message { + /** + * @generated from field: string cctx_index = 1; + */ + cctxIndex: string; + + /** + * @generated from field: string gas_price_increase = 2; + */ + gasPriceIncrease: string; + + /** + * @generated from field: string additional_fees = 3; + */ + additionalFees: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.EventCCTXGasPriceIncreased"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): EventCCTXGasPriceIncreased; + + static fromJson(jsonValue: JsonValue, options?: Partial): EventCCTXGasPriceIncreased; + + static fromJsonString(jsonString: string, options?: Partial): EventCCTXGasPriceIncreased; + + static equals(a: EventCCTXGasPriceIncreased | PlainMessage | undefined, b: EventCCTXGasPriceIncreased | PlainMessage | undefined): boolean; +} + diff --git a/x/crosschain/keeper/abci.go b/x/crosschain/keeper/abci.go index 78959be37c..dac6bcacc3 100644 --- a/x/crosschain/keeper/abci.go +++ b/x/crosschain/keeper/abci.go @@ -4,10 +4,11 @@ import ( "fmt" "time" + "github.com/zeta-chain/zetacore/common" + cosmoserrors "cosmossdk.io/errors" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -17,8 +18,21 @@ const ( RemainingFeesToStabilityPoolPercent = 95 ) +// CheckAndUpdateCctxGasPriceFunc is a function type for checking and updating the gas price of a cctx +type CheckAndUpdateCctxGasPriceFunc func( + ctx sdk.Context, + k Keeper, + cctx types.CrossChainTx, + flags observertypes.GasPriceIncreaseFlags, +) (math.Uint, math.Uint, error) + // IterateAndUpdateCctxGasPrice iterates through all cctx and updates the gas price if pending for too long -func (k Keeper) IterateAndUpdateCctxGasPrice(ctx sdk.Context) error { +// The function returns the number of cctxs updated and the gas price increase flags used +func (k Keeper) IterateAndUpdateCctxGasPrice( + ctx sdk.Context, + chains []*common.Chain, + updateFunc CheckAndUpdateCctxGasPriceFunc, +) (int, observertypes.GasPriceIncreaseFlags) { // fetch the gas price increase flags or use default gasPriceIncreaseFlags := observertypes.DefaultGasPriceIncreaseFlags crosschainFlags, found := k.zetaObserverKeeper.GetCrosschainFlags(ctx) @@ -28,38 +42,66 @@ func (k Keeper) IterateAndUpdateCctxGasPrice(ctx sdk.Context) error { // skip if haven't reached epoch end if ctx.BlockHeight()%gasPriceIncreaseFlags.EpochLength != 0 { - return nil + return 0, gasPriceIncreaseFlags } - // iterate all chains' pending cctx - chains := common.DefaultChainsList() + cctxCount := 0 + +IterateChains: for _, chain := range chains { - res, err := k.CctxListPending(sdk.UnwrapSDKContext(ctx), &types.QueryListCctxPendingRequest{ - ChainId: chain.ChainId, - Limit: gasPriceIncreaseFlags.MaxPendingCctxs, - }) - if err != nil { - return err - } + // support only external evm chains + if common.IsEVMChain(chain.ChainId) && !common.IsZetaChain(chain.ChainId) { + res, err := k.CctxListPending(sdk.UnwrapSDKContext(ctx), &types.QueryListCctxPendingRequest{ + ChainId: chain.ChainId, + Limit: gasPriceIncreaseFlags.MaxPendingCctxs, + }) + if err != nil { + ctx.Logger().Info("GasStabilityPool: fetching pending cctx failed", + "chainID", chain.ChainId, + "err", err.Error(), + ) + continue IterateChains + } - // iterate through all pending cctx - for _, pendingCctx := range res.CrossChainTx { - if pendingCctx != nil { - _, _, err := k.CheckAndUpdateCctxGasPrice(ctx, *pendingCctx, gasPriceIncreaseFlags) - if err != nil { - return err + // iterate through all pending cctx + for _, pendingCctx := range res.CrossChainTx { + if pendingCctx != nil { + gasPriceIncrease, additionalFees, err := updateFunc(ctx, k, *pendingCctx, gasPriceIncreaseFlags) + if err != nil { + ctx.Logger().Info("GasStabilityPool: updating gas price for pending cctx failed", + "cctxIndex", pendingCctx.Index, + "err", err.Error(), + ) + continue IterateChains + } + if !gasPriceIncrease.IsNil() && !gasPriceIncrease.IsZero() { + // Emit typed event for gas price increase + if err := ctx.EventManager().EmitTypedEvent( + &types.EventCCTXGasPriceIncreased{ + CctxIndex: pendingCctx.Index, + GasPriceIncrease: gasPriceIncrease.String(), + AdditionalFees: additionalFees.String(), + }); err != nil { + ctx.Logger().Error( + "GasStabilityPool: failed to emit EventCCTXGasPriceIncreased", + "err", err.Error(), + ) + } + cctxCount++ + } } } } } - return nil + return cctxCount, gasPriceIncreaseFlags } // CheckAndUpdateCctxGasPrice checks if the retry interval is reached and updates the gas price if so // The function returns the gas price increase and the additional fees paid from the gas stability pool -func (k Keeper) CheckAndUpdateCctxGasPrice( +func CheckAndUpdateCctxGasPrice( ctx sdk.Context, + k Keeper, cctx types.CrossChainTx, flags observertypes.GasPriceIncreaseFlags, ) (math.Uint, math.Uint, error) { @@ -108,7 +150,7 @@ func (k Keeper) CheckAndUpdateCctxGasPrice( if err := k.fungibleKeeper.WithdrawFromGasStabilityPool(ctx, chainID, additionalFees.BigInt()); err != nil { return math.ZeroUint(), math.ZeroUint(), cosmoserrors.Wrap( types.ErrNotEnoughFunds, - fmt.Sprintf("cannot withdraw %s from gas stability pool", additionalFees.String()), + fmt.Sprintf("cannot withdraw %s from gas stability pool, error: %s", additionalFees.String(), err.Error()), ) } diff --git a/x/crosschain/keeper/abci_test.go b/x/crosschain/keeper/abci_test.go index 12263a3587..ea46e70dc4 100644 --- a/x/crosschain/keeper/abci_test.go +++ b/x/crosschain/keeper/abci_test.go @@ -6,13 +6,105 @@ import ( "time" "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/common" testkeeper "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -func TestKeeper_CheckAndUpdateCctxGasPrice(t *testing.T) { +func TestKeeper_IterateAndUpdateCctxGasPrice(t *testing.T) { + k, ctx, _, zk := testkeeper.CrosschainKeeper(t) + + // updateFuncMap tracks the calls done with cctx index + updateFuncMap := make(map[string]struct{}) + + // failMap gives the cctx index that should fail + failMap := make(map[string]struct{}) + + // updateFunc mocks the update function and keep track of the calls done with cctx index + updateFunc := func( + ctx sdk.Context, + k keeper.Keeper, + cctx types.CrossChainTx, + flags observertypes.GasPriceIncreaseFlags, + ) (math.Uint, math.Uint, error) { + if _, ok := failMap[cctx.Index]; ok { + return math.NewUint(0), math.NewUint(0), errors.New("failed") + } + + updateFuncMap[cctx.Index] = struct{}{} + return math.NewUint(10), math.NewUint(10), nil + } + + // add some evm and non-evm chains + supportedChains := []*common.Chain{ + {ChainId: common.EthChain().ChainId}, + {ChainId: common.BtcMainnetChain().ChainId}, + {ChainId: common.BscMainnetChain().ChainId}, + {ChainId: common.ZetaChainMainnet().ChainId}, + } + + // set pending cctx + tss := sample.Tss() + zk.ObserverKeeper.SetTSS(ctx, tss) + createCctxWithNonceRange(t, ctx, *k, 10, 15, common.EthChain().ChainId, tss, zk) + createCctxWithNonceRange(t, ctx, *k, 20, 25, common.BtcMainnetChain().ChainId, tss, zk) + createCctxWithNonceRange(t, ctx, *k, 30, 35, common.BscMainnetChain().ChainId, tss, zk) + createCctxWithNonceRange(t, ctx, *k, 40, 45, common.ZetaChainMainnet().ChainId, tss, zk) + + // set a cctx where the update function should fail to test that the next cctx are not updated but the next chains are + failMap["1-12"] = struct{}{} + + // test that the default crosschain flags are used when not set and the epoch length is not reached + ctx = ctx.WithBlockHeight(observertypes.DefaultCrosschainFlags().GasPriceIncreaseFlags.EpochLength + 1) + + cctxCount, flags := k.IterateAndUpdateCctxGasPrice(ctx, supportedChains, updateFunc) + require.Equal(t, 0, cctxCount) + require.Equal(t, *observertypes.DefaultCrosschainFlags().GasPriceIncreaseFlags, flags) + + // test that custom crosschain flags are used when set and the epoch length is reached + customFlags := observertypes.GasPriceIncreaseFlags{ + EpochLength: 100, + RetryInterval: time.Minute * 10, + GasPriceIncreasePercent: 100, + GasPriceIncreaseMax: 200, + MaxPendingCctxs: 10, + } + crosschainFlags := sample.CrosschainFlags() + crosschainFlags.GasPriceIncreaseFlags = &customFlags + zk.ObserverKeeper.SetCrosschainFlags(ctx, *crosschainFlags) + + cctxCount, flags = k.IterateAndUpdateCctxGasPrice(ctx, supportedChains, updateFunc) + require.Equal(t, 0, cctxCount) + require.Equal(t, customFlags, flags) + + // test that cctx are iterated and updated when the epoch length is reached + + ctx = ctx.WithBlockHeight(observertypes.DefaultCrosschainFlags().GasPriceIncreaseFlags.EpochLength * 2) + cctxCount, flags = k.IterateAndUpdateCctxGasPrice(ctx, supportedChains, updateFunc) + + // 2 eth + 5 bsc = 7 + require.Equal(t, 7, cctxCount) + require.Equal(t, customFlags, flags) + + // check that the update function was called with the cctx index + require.Equal(t, 7, len(updateFuncMap)) + require.Contains(t, updateFuncMap, "1-10") + require.Contains(t, updateFuncMap, "1-11") + + require.Contains(t, updateFuncMap, "56-30") + require.Contains(t, updateFuncMap, "56-31") + require.Contains(t, updateFuncMap, "56-32") + require.Contains(t, updateFuncMap, "56-33") + require.Contains(t, updateFuncMap, "56-34") +} + +func TestCheckAndUpdateCctxGasPrice(t *testing.T) { sampleTimestamp := time.Now() retryIntervalReached := sampleTimestamp.Add(observertypes.DefaultGasPriceIncreaseFlags.RetryInterval + time.Second) retryIntervalNotReached := sampleTimestamp.Add(observertypes.DefaultGasPriceIncreaseFlags.RetryInterval - time.Second) @@ -282,7 +374,7 @@ func TestKeeper_CheckAndUpdateCctxGasPrice(t *testing.T) { } // check and update gas price - gasPriceIncrease, feesPaid, err := k.CheckAndUpdateCctxGasPrice(ctx, tc.cctx, tc.flags) + gasPriceIncrease, feesPaid, err := keeper.CheckAndUpdateCctxGasPrice(ctx, *k, tc.cctx, tc.flags) if tc.isError { require.Error(t, err) diff --git a/x/crosschain/keeper/grpc_query_cctx_test.go b/x/crosschain/keeper/grpc_query_cctx_test.go index cd5d1e3c14..c326f41a42 100644 --- a/x/crosschain/keeper/grpc_query_cctx_test.go +++ b/x/crosschain/keeper/grpc_query_cctx_test.go @@ -22,14 +22,14 @@ func createCctxWithNonceRange( t *testing.T, ctx sdk.Context, k keeper.Keeper, - low int, - high int, + lowPending int, + highPending int, chainID int64, tss observertypes.TSS, zk keepertest.ZetaKeepers, ) (cctxs []*types.CrossChainTx) { - for i := 0; i < low; i++ { - cctx := sample.CrossChainTx(t, fmt.Sprintf("%d", i)) + for i := 0; i < lowPending; i++ { + cctx := sample.CrossChainTx(t, fmt.Sprintf("%d-%d", chainID, i)) cctx.CctxStatus.Status = types.CctxStatus_OutboundMined cctx.InboundTxParams.SenderChainId = chainID k.SetCrossChainTx(ctx, *cctx) @@ -40,8 +40,8 @@ func createCctxWithNonceRange( Tss: tss.TssPubkey, }) } - for i := low; i < high; i++ { - cctx := sample.CrossChainTx(t, fmt.Sprintf("%d", i)) + for i := lowPending; i < highPending; i++ { + cctx := sample.CrossChainTx(t, fmt.Sprintf("%d-%d", chainID, i)) cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound cctx.InboundTxParams.SenderChainId = chainID k.SetCrossChainTx(ctx, *cctx) @@ -55,8 +55,8 @@ func createCctxWithNonceRange( } zk.ObserverKeeper.SetPendingNonces(ctx, observertypes.PendingNonces{ ChainId: chainID, - NonceLow: int64(low), - NonceHigh: int64(high), + NonceLow: int64(lowPending), + NonceHigh: int64(highPending), Tss: tss.TssPubkey, }) @@ -135,12 +135,12 @@ func TestKeeper_CctxListPending(t *testing.T) { cctxs := createCctxWithNonceRange(t, ctx, *k, 1000, 2000, chainID, tss, zk) // set some cctxs as pending below nonce - cctx1, found := k.GetCrossChainTx(ctx, "940") + cctx1, found := k.GetCrossChainTx(ctx, "1337-940") require.True(t, found) cctx1.CctxStatus.Status = types.CctxStatus_PendingOutbound k.SetCrossChainTx(ctx, cctx1) - cctx2, found := k.GetCrossChainTx(ctx, "955") + cctx2, found := k.GetCrossChainTx(ctx, "1337-955") require.True(t, found) cctx2.CctxStatus.Status = types.CctxStatus_PendingOutbound k.SetCrossChainTx(ctx, cctx2) diff --git a/x/crosschain/module.go b/x/crosschain/module.go index 9e2e4ec81b..421f92c895 100644 --- a/x/crosschain/module.go +++ b/x/crosschain/module.go @@ -188,10 +188,12 @@ func (AppModule) ConsensusVersion() uint64 { return 4 } // BeginBlock executes all ABCI BeginBlock logic respective to the crosschain module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - err := am.keeper.IterateAndUpdateCctxGasPrice(ctx) - if err != nil { - ctx.Logger().Info("Error iterating and updating pending cctx gas price", "err", err.Error()) - } + // get all supported chains + supportedChains := am.keeper.GetObserverKeeper().GetSupportedChains(ctx) + + // iterate and update gas price for cctx that are pending for too long + // error is logged in the function + am.keeper.IterateAndUpdateCctxGasPrice(ctx, supportedChains, keeper.CheckAndUpdateCctxGasPrice) } // EndBlock executes all ABCI EndBlock logic respective to the crosschain module. It diff --git a/x/crosschain/types/events.pb.go b/x/crosschain/types/events.pb.go index 3fbc7f3fa3..68c05a18f0 100644 --- a/x/crosschain/types/events.pb.go +++ b/x/crosschain/types/events.pb.go @@ -509,55 +509,120 @@ func (m *EventOutboundSuccess) GetValueReceived() string { return "" } +type EventCCTXGasPriceIncreased struct { + CctxIndex string `protobuf:"bytes,1,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"` + GasPriceIncrease string `protobuf:"bytes,2,opt,name=gas_price_increase,json=gasPriceIncrease,proto3" json:"gas_price_increase,omitempty"` + AdditionalFees string `protobuf:"bytes,3,opt,name=additional_fees,json=additionalFees,proto3" json:"additional_fees,omitempty"` +} + +func (m *EventCCTXGasPriceIncreased) Reset() { *m = EventCCTXGasPriceIncreased{} } +func (m *EventCCTXGasPriceIncreased) String() string { return proto.CompactTextString(m) } +func (*EventCCTXGasPriceIncreased) ProtoMessage() {} +func (*EventCCTXGasPriceIncreased) Descriptor() ([]byte, []int) { + return fileDescriptor_7398db8b12b87b9e, []int{5} +} +func (m *EventCCTXGasPriceIncreased) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventCCTXGasPriceIncreased) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventCCTXGasPriceIncreased.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventCCTXGasPriceIncreased) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCCTXGasPriceIncreased.Merge(m, src) +} +func (m *EventCCTXGasPriceIncreased) XXX_Size() int { + return m.Size() +} +func (m *EventCCTXGasPriceIncreased) XXX_DiscardUnknown() { + xxx_messageInfo_EventCCTXGasPriceIncreased.DiscardUnknown(m) +} + +var xxx_messageInfo_EventCCTXGasPriceIncreased proto.InternalMessageInfo + +func (m *EventCCTXGasPriceIncreased) GetCctxIndex() string { + if m != nil { + return m.CctxIndex + } + return "" +} + +func (m *EventCCTXGasPriceIncreased) GetGasPriceIncrease() string { + if m != nil { + return m.GasPriceIncrease + } + return "" +} + +func (m *EventCCTXGasPriceIncreased) GetAdditionalFees() string { + if m != nil { + return m.AdditionalFees + } + return "" +} + func init() { proto.RegisterType((*EventInboundFinalized)(nil), "zetachain.zetacore.crosschain.EventInboundFinalized") proto.RegisterType((*EventZrcWithdrawCreated)(nil), "zetachain.zetacore.crosschain.EventZrcWithdrawCreated") proto.RegisterType((*EventZetaWithdrawCreated)(nil), "zetachain.zetacore.crosschain.EventZetaWithdrawCreated") proto.RegisterType((*EventOutboundFailure)(nil), "zetachain.zetacore.crosschain.EventOutboundFailure") proto.RegisterType((*EventOutboundSuccess)(nil), "zetachain.zetacore.crosschain.EventOutboundSuccess") + proto.RegisterType((*EventCCTXGasPriceIncreased)(nil), "zetachain.zetacore.crosschain.EventCCTXGasPriceIncreased") } func init() { proto.RegisterFile("crosschain/events.proto", fileDescriptor_7398db8b12b87b9e) } var fileDescriptor_7398db8b12b87b9e = []byte{ - // 586 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xdd, 0x6a, 0xd4, 0x40, - 0x14, 0x6e, 0xda, 0xdd, 0xed, 0xee, 0xf4, 0x0f, 0x62, 0xb5, 0x63, 0xb1, 0xa1, 0x2e, 0xf8, 0x73, - 0xe3, 0x06, 0xf1, 0x0d, 0x5a, 0x94, 0x16, 0x91, 0x42, 0x5b, 0x11, 0x7a, 0x33, 0xcc, 0x26, 0x87, - 0x64, 0x30, 0x99, 0x59, 0x66, 0x26, 0xbb, 0xd9, 0x3e, 0x85, 0x2f, 0x22, 0xf8, 0x00, 0x3e, 0x80, - 0x97, 0xbd, 0xf0, 0xc2, 0x4b, 0xd9, 0x7d, 0x11, 0x99, 0x99, 0x44, 0xbb, 0xa9, 0xe8, 0x85, 0x28, - 0x78, 0x95, 0x73, 0xbe, 0x73, 0x72, 0xf2, 0xcd, 0xf7, 0x4d, 0x0e, 0xda, 0x89, 0xa4, 0x50, 0x2a, - 0x4a, 0x29, 0xe3, 0x21, 0x8c, 0x81, 0x6b, 0x35, 0x18, 0x49, 0xa1, 0x85, 0xbf, 0x77, 0x09, 0x9a, - 0x5a, 0x7c, 0x60, 0x23, 0x21, 0x61, 0xf0, 0xa3, 0x77, 0xf7, 0x56, 0x24, 0xf2, 0x5c, 0xf0, 0xd0, - 0x3d, 0xdc, 0x3b, 0xbb, 0xdb, 0x89, 0x48, 0x84, 0x0d, 0x43, 0x13, 0x39, 0xb4, 0xff, 0x79, 0x05, - 0xdd, 0x7e, 0x6e, 0x46, 0x1f, 0xf3, 0xa1, 0x28, 0x78, 0xfc, 0x82, 0x71, 0x9a, 0xb1, 0x4b, 0x88, - 0xfd, 0x7d, 0xb4, 0x9e, 0xab, 0x84, 0xe8, 0xe9, 0x08, 0x48, 0x21, 0x33, 0xec, 0xed, 0x7b, 0x8f, - 0x7b, 0xa7, 0x28, 0x57, 0xc9, 0xf9, 0x74, 0x04, 0xaf, 0x65, 0xe6, 0xef, 0x21, 0x14, 0x45, 0xba, - 0x24, 0x8c, 0xc7, 0x50, 0xe2, 0x65, 0x5b, 0xef, 0x19, 0xe4, 0xd8, 0x00, 0xfe, 0x1d, 0xd4, 0x51, - 0xc0, 0x63, 0x90, 0x78, 0xc5, 0x96, 0xaa, 0xcc, 0xbf, 0x8b, 0xba, 0xba, 0x24, 0x42, 0x26, 0x8c, - 0xe3, 0x96, 0xad, 0xac, 0xea, 0xf2, 0xc4, 0xa4, 0xfe, 0x36, 0x6a, 0x53, 0xa5, 0x40, 0xe3, 0xb6, - 0xc5, 0x5d, 0xe2, 0xdf, 0x43, 0x88, 0x71, 0xa2, 0x4b, 0x92, 0x52, 0x95, 0xe2, 0x8e, 0x2d, 0x75, - 0x19, 0x3f, 0x2f, 0x8f, 0xa8, 0x4a, 0xfd, 0x87, 0x68, 0x8b, 0x71, 0x32, 0xcc, 0x44, 0xf4, 0x96, - 0xa4, 0xc0, 0x92, 0x54, 0xe3, 0x55, 0xdb, 0xb2, 0xc1, 0xf8, 0x81, 0x41, 0x8f, 0x2c, 0xe8, 0xef, - 0xa2, 0xae, 0x84, 0x08, 0xd8, 0x18, 0x24, 0xee, 0xba, 0x19, 0x75, 0xee, 0x3f, 0x40, 0x9b, 0x75, - 0x4c, 0xac, 0x84, 0xb8, 0xe7, 0x46, 0xd4, 0xe8, 0xa1, 0x01, 0xcd, 0x89, 0x68, 0x2e, 0x0a, 0xae, - 0x31, 0x72, 0x27, 0x72, 0x99, 0xff, 0x08, 0x6d, 0x49, 0xc8, 0xe8, 0x14, 0x62, 0x92, 0x83, 0x52, - 0x34, 0x01, 0xbc, 0x66, 0x1b, 0x36, 0x2b, 0xf8, 0x95, 0x43, 0x8d, 0x62, 0x1c, 0x26, 0x44, 0x69, - 0xaa, 0x0b, 0x85, 0xd7, 0x9d, 0x62, 0x1c, 0x26, 0x67, 0x16, 0x30, 0x34, 0x5c, 0xe9, 0xfb, 0x98, - 0x0d, 0x47, 0xc3, 0xa1, 0xf5, 0x94, 0xfb, 0x68, 0xdd, 0x49, 0x59, 0x71, 0xdd, 0xb4, 0x4d, 0x6b, - 0x0e, 0xb3, 0x4c, 0xfb, 0xef, 0x97, 0xd1, 0x8e, 0xb5, 0xf5, 0x42, 0x46, 0x6f, 0x98, 0x4e, 0x63, - 0x49, 0x27, 0x87, 0x12, 0xa8, 0xfe, 0x9b, 0xc6, 0x36, 0x79, 0xb5, 0x6e, 0xf0, 0x6a, 0x58, 0xd9, - 0x6e, 0x58, 0x79, 0xdd, 0xa2, 0xce, 0x6f, 0x2d, 0x5a, 0xfd, 0xb5, 0x45, 0xdd, 0x05, 0x8b, 0x16, - 0x95, 0xef, 0x35, 0x94, 0xef, 0x7f, 0xf0, 0x10, 0x76, 0x7a, 0x81, 0xa6, 0xff, 0x4c, 0xb0, 0x45, - 0x35, 0x5a, 0x0d, 0x35, 0x16, 0x29, 0xb7, 0x9b, 0x94, 0x3f, 0x7a, 0x68, 0xdb, 0x52, 0x3e, 0x29, - 0xb4, 0xfb, 0x75, 0x29, 0xcb, 0x0a, 0x09, 0x7f, 0x4e, 0x77, 0x0f, 0x21, 0x91, 0xc5, 0xf5, 0x87, - 0x1d, 0xe5, 0x9e, 0xc8, 0xe2, 0xea, 0x96, 0x2e, 0xf2, 0x6a, 0xfd, 0xe4, 0x12, 0x8f, 0x69, 0x56, - 0x00, 0xa9, 0x8c, 0x89, 0x2b, 0xea, 0x1b, 0x16, 0x3d, 0xad, 0xc0, 0x9b, 0xf4, 0xcf, 0x8a, 0x28, - 0x02, 0xa5, 0xfe, 0x0f, 0xfa, 0x07, 0x2f, 0x3f, 0xcd, 0x02, 0xef, 0x6a, 0x16, 0x78, 0x5f, 0x67, - 0x81, 0xf7, 0x6e, 0x1e, 0x2c, 0x5d, 0xcd, 0x83, 0xa5, 0x2f, 0xf3, 0x60, 0xe9, 0xe2, 0x69, 0xc2, - 0x74, 0x5a, 0x0c, 0x07, 0x91, 0xc8, 0x43, 0xb3, 0x9c, 0x9f, 0xb8, 0xfd, 0x5d, 0xef, 0xe9, 0xb0, - 0x0c, 0xaf, 0x6d, 0x75, 0x73, 0x4a, 0x35, 0xec, 0xd8, 0x5d, 0xfc, 0xec, 0x5b, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xee, 0x0c, 0x96, 0x59, 0xf0, 0x05, 0x00, 0x00, + // 654 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0xcf, 0x6e, 0x13, 0x3b, + 0x14, 0xc6, 0x3b, 0x6d, 0x92, 0x26, 0x6e, 0x9b, 0x5e, 0xcd, 0xed, 0xbd, 0xf5, 0x8d, 0x6e, 0xa3, + 0x52, 0x89, 0x3f, 0x0b, 0x48, 0x84, 0x78, 0x83, 0x46, 0x94, 0x56, 0x08, 0x15, 0xb5, 0x45, 0xa0, + 0x6e, 0x2c, 0xc7, 0x73, 0x98, 0xb1, 0x98, 0xb1, 0x23, 0xdb, 0xd3, 0x4e, 0xfb, 0x14, 0x88, 0xf7, + 0x40, 0xe2, 0x01, 0x78, 0x00, 0x96, 0x5d, 0xb0, 0x60, 0x89, 0xda, 0x17, 0x41, 0xb6, 0x67, 0x68, + 0x33, 0x45, 0xb0, 0x40, 0x20, 0xb1, 0x8a, 0xcf, 0x77, 0xec, 0x93, 0x9f, 0xbf, 0xe3, 0xe4, 0xa0, + 0x55, 0xa6, 0xa4, 0xd6, 0x2c, 0xa1, 0x5c, 0x0c, 0xe1, 0x08, 0x84, 0xd1, 0x83, 0x89, 0x92, 0x46, + 0x86, 0x6b, 0xa7, 0x60, 0xa8, 0xd3, 0x07, 0x6e, 0x25, 0x15, 0x0c, 0x2e, 0xf7, 0xf6, 0xfe, 0x66, + 0x32, 0xcb, 0xa4, 0x18, 0xfa, 0x0f, 0x7f, 0xa6, 0xb7, 0x12, 0xcb, 0x58, 0xba, 0xe5, 0xd0, 0xae, + 0xbc, 0xba, 0xf1, 0x71, 0x0e, 0xfd, 0xf3, 0xd0, 0x96, 0xde, 0x11, 0x63, 0x99, 0x8b, 0x68, 0x8b, + 0x0b, 0x9a, 0xf2, 0x53, 0x88, 0xc2, 0x75, 0xb4, 0x98, 0xe9, 0x98, 0x98, 0x93, 0x09, 0x90, 0x5c, + 0xa5, 0x38, 0x58, 0x0f, 0xee, 0x74, 0xf6, 0x50, 0xa6, 0xe3, 0x83, 0x93, 0x09, 0x3c, 0x53, 0x69, + 0xb8, 0x86, 0x10, 0x63, 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+ 0xfe, 0x8a, 0x6b, 0xd5, 0xec, 0xdf, 0x0b, 0x8d, 0x22, 0x6e, 0xb8, 0x14, 0x34, 0x25, 0x2f, 0x01, + 0xaa, 0x5b, 0x75, 0x2f, 0xe5, 0x2d, 0x00, 0xbd, 0xf9, 0xf8, 0xc3, 0x79, 0x3f, 0x38, 0x3b, 0xef, + 0x07, 0x9f, 0xcf, 0xfb, 0xc1, 0xeb, 0x8b, 0xfe, 0xcc, 0xd9, 0x45, 0x7f, 0xe6, 0xd3, 0x45, 0x7f, + 0xe6, 0xf0, 0x7e, 0xcc, 0x4d, 0x92, 0x8f, 0x07, 0x4c, 0x66, 0x43, 0x3b, 0x31, 0xee, 0xf9, 0xa1, + 0x52, 0x0d, 0x8f, 0x61, 0x31, 0xbc, 0x32, 0x6a, 0xac, 0xf5, 0x7a, 0xdc, 0x72, 0x03, 0xe2, 0xc1, + 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0x45, 0x66, 0xf0, 0x4d, 0x85, 0x06, 0x00, 0x00, } func (m *EventInboundFinalized) Marshal() (dAtA []byte, err error) { @@ -941,6 +1006,50 @@ func (m *EventOutboundSuccess) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventCCTXGasPriceIncreased) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventCCTXGasPriceIncreased) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventCCTXGasPriceIncreased) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AdditionalFees) > 0 { + i -= len(m.AdditionalFees) + copy(dAtA[i:], m.AdditionalFees) + i = encodeVarintEvents(dAtA, i, uint64(len(m.AdditionalFees))) + i-- + dAtA[i] = 0x1a + } + if len(m.GasPriceIncrease) > 0 { + i -= len(m.GasPriceIncrease) + copy(dAtA[i:], m.GasPriceIncrease) + i = encodeVarintEvents(dAtA, i, uint64(len(m.GasPriceIncrease))) + i-- + dAtA[i] = 0x12 + } + if len(m.CctxIndex) > 0 { + i -= len(m.CctxIndex) + copy(dAtA[i:], m.CctxIndex) + i = encodeVarintEvents(dAtA, i, uint64(len(m.CctxIndex))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -1149,6 +1258,27 @@ func (m *EventOutboundSuccess) Size() (n int) { return n } +func (m *EventCCTXGasPriceIncreased) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CctxIndex) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.GasPriceIncrease) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.AdditionalFees) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2621,6 +2751,152 @@ func (m *EventOutboundSuccess) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventCCTXGasPriceIncreased) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventCCTXGasPriceIncreased: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventCCTXGasPriceIncreased: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CctxIndex = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncrease", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GasPriceIncrease = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AdditionalFees", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AdditionalFees = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0