From 91560644c7a05ab419f58871d7939a59ed2b2dd3 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:13:33 -0700 Subject: [PATCH] implement deviation & heartbeat logic --- proto/ojo/gmp/v1/gmp.proto | 9 ++- x/gmp/client/cli/tx.go | 3 +- x/gmp/keeper/keeper.go | 19 ++++--- x/gmp/module.go | 12 +++- x/gmp/types/gmp.pb.go | 111 ++++++++++++++++++++++--------------- x/gmp/types/msgs.go | 8 ++- x/gmp/types/params.go | 2 + 7 files changed, 105 insertions(+), 59 deletions(-) diff --git a/proto/ojo/gmp/v1/gmp.proto b/proto/ojo/gmp/v1/gmp.proto index 71cf0dbd..5d95bada 100644 --- a/proto/ojo/gmp/v1/gmp.proto +++ b/proto/ojo/gmp/v1/gmp.proto @@ -42,8 +42,13 @@ message Payment { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - // deviation is how much the price can deviate from the last updated price before triggering an update. - int64 deviation = 5; + // deviation is a percentage of how much the price can deviate before triggering an update. + // 100 = 100%. + string deviation = 5 [ + (gogoproto.moretags) = "yaml:\"deviation\"", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; // heartbeat is how often the price will be updated in Ojo blocks, regardless of whether the price has deviated or not. int64 heartbeat = 6; diff --git a/x/gmp/client/cli/tx.go b/x/gmp/client/cli/tx.go index 7e298a33..29c2369d 100644 --- a/x/gmp/client/cli/tx.go +++ b/x/gmp/client/cli/tx.go @@ -6,6 +6,7 @@ import ( "strconv" "strings" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -216,7 +217,7 @@ func GetCmdCreatePayment() *cobra.Command { return err } - deviation, err := strconv.ParseInt(args[2], 10, 64) + deviation, err := math.LegacyNewDecFromStr(args[2]) if err != nil { return err } diff --git a/x/gmp/keeper/keeper.go b/x/gmp/keeper/keeper.go index 8e550065..333ec65d 100644 --- a/x/gmp/keeper/keeper.go +++ b/x/gmp/keeper/keeper.go @@ -258,12 +258,10 @@ func (k Keeper) ProcessPayment( gasEstimate, err := k.GasEstimateKeeper.GetGasEstimate(ctx, payment.DestinationChain) if err != nil { k.Logger(ctx).With(err).Error("error getting gas estimate. using default gas estimates") - return err } else { gasAmount = math.NewInt(gasEstimate.GasEstimate) } - // estimate gas for the axelar relay coins := sdk.Coin{ Denom: payment.Token.Denom, Amount: gasAmount, @@ -275,7 +273,7 @@ func (k Keeper) ProcessPayment( k.Logger(ctx).With(err).Error("error getting relayer address") return err } - if payment.Token.Amount.LT(coins.Amount) { + if payment.Token.Amount.LTE(coins.Amount) { k.Logger(ctx).With(err).Debug("payment amount is less than gas estimate, returning funds and deleting payment") err := k.BankKeeper.SendCoinsFromModuleToAccount( ctx, @@ -294,14 +292,13 @@ func (k Keeper) ProcessPayment( authtypes.NewModuleAddress(types.ModuleName).String(), payment.DestinationChain, contractAddress, - "0x001", + types.EmptyContract, coins, []string{payment.Denom}, - []byte(""), - []byte(""), + types.EmptyByteSlice, + types.EmptyByteSlice, ctx.BlockHeight(), ) - _, err = k.RelayPrice(goCtx, msg) if err != nil { k.Logger(ctx).With(err).Error("error relaying price") @@ -311,6 +308,14 @@ func (k Keeper) ProcessPayment( // update payment in the store with the amount paid payment.Token.Amount = payment.Token.Amount.Sub(coins.Amount) + lastPrice, err := k.oracleKeeper.GetExchangeRate(ctx, payment.Denom) + if err != nil { + k.Logger(ctx).With(err).Error("error getting exchange rate") + return err + } + payment.LastPrice = lastPrice + payment.LastBlock = ctx.BlockHeight() + k.SetPayment(ctx, payment) k.Logger(ctx).Info("payment updated", "payment", payment) diff --git a/x/gmp/module.go b/x/gmp/module.go index 65db8885..de8465f9 100644 --- a/x/gmp/module.go +++ b/x/gmp/module.go @@ -166,7 +166,17 @@ func (am AppModule) EndBlock(goCtx context.Context) ([]abci.ValidatorUpdate, err ctx := sdk.UnwrapSDKContext(goCtx) payments := am.keeper.GetAllPayments(ctx) for _, payment := range payments { - am.keeper.ProcessPayment(goCtx, payment) + rate, err := am.oracleKeeper.GetExchangeRate(ctx, payment.Denom) + if err != nil { + continue + } + // if the last price has deviated by more than the deviation percentage, trigger an update + if payment.LastPrice.Sub(rate).Abs().GT(payment.Deviation) { + am.keeper.ProcessPayment(goCtx, payment) + } else if payment.LastBlock < ctx.BlockHeight()-payment.Heartbeat { + am.keeper.ProcessPayment(goCtx, payment) + } + } return []abci.ValidatorUpdate{}, nil } diff --git a/x/gmp/types/gmp.pb.go b/x/gmp/types/gmp.pb.go index b6eb0cbc..06179397 100644 --- a/x/gmp/types/gmp.pb.go +++ b/x/gmp/types/gmp.pb.go @@ -81,8 +81,9 @@ type Payment struct { Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` // token determines the IBC token that will be used for payment to Axelar. Token types.Coin `protobuf:"bytes,4,opt,name=token,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"token"` - // deviation is how much the price can deviate from the last updated price before triggering an update. - Deviation int64 `protobuf:"varint,5,opt,name=deviation,proto3" json:"deviation,omitempty"` + // deviation is a percentage of how much the price can deviate before triggering an update. + // 100 = 100%. + Deviation cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=deviation,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"deviation" yaml:"deviation"` // heartbeat is how often the price will be updated in Ojo blocks, regardless of whether the price has deviated or not. Heartbeat int64 `protobuf:"varint,6,opt,name=heartbeat,proto3" json:"heartbeat,omitempty"` // last_price is the last price that was sent to the smart contract.. @@ -132,39 +133,40 @@ func init() { func init() { proto.RegisterFile("ojo/gmp/v1/gmp.proto", fileDescriptor_199820a7e9d7929f) } var fileDescriptor_199820a7e9d7929f = []byte{ - // 507 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff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4c, 0xe9, 0x71, 0x51, 0xf2, 0x04, 0xfc, 0x86, - 0xe9, 0xbc, 0xff, 0xca, 0x34, 0xf2, 0x73, 0xd3, 0x7e, 0xe4, 0xae, 0x55, 0xe9, 0x3c, 0xe4, 0x18, - 0x09, 0xa6, 0xa7, 0xe1, 0x7b, 0xc8, 0x58, 0xb2, 0xba, 0x84, 0xe4, 0xef, 0xa6, 0x7d, 0xb2, 0x62, - 0x22, 0x7f, 0xdd, 0xb9, 0x49, 0xef, 0x8c, 0x9a, 0xc6, 0x19, 0x1a, 0x9b, 0x3e, 0xa9, 0x0a, 0xc7, - 0x39, 0x26, 0x73, 0xff, 0xae, 0xbb, 0xd7, 0x90, 0xbe, 0x01, 0xfd, 0xcb, 0xf5, 0x9f, 0xa0, 0xb6, - 0xde, 0x06, 0xde, 0xd5, 0x36, 0xf0, 0x7e, 0x6f, 0x03, 0xef, 0xeb, 0x2e, 0xa8, 0x5d, 0xed, 0x82, - 0xda, 0x8f, 0x5d, 0x50, 0xfb, 0xf4, 0xec, 0xd6, 0x0a, 0x70, 0x86, 0xe7, 0x12, 0xf4, 0x67, 0x2c, - 0xe7, 0xc6, 0x8e, 0xbe, 0xd8, 0x3f, 0x6d, 0xd7, 0x10, 0xd7, 0xed, 0x8f, 0x7c, 0xf9, 0x3f, 0x00, - 0x00, 0xff, 0xff, 0x41, 0x9b, 0x5c, 0xea, 0xeb, 0x02, 0x00, 0x00, + // 524 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xc1, 0x8e, 0xd3, 0x3c, + 0x10, 0x6e, 0xfe, 0xfe, 0x6d, 0x89, 0x17, 0xa4, 0x5d, 0xab, 0x87, 0xb0, 0x40, 0xba, 0x2a, 0x12, + 0xaa, 0x84, 0x36, 0xd9, 0xc2, 0x01, 0xc4, 0x8d, 0x76, 0x11, 0x17, 0x0e, 0x55, 0x04, 0x42, 0xe2, + 0x52, 0x39, 0xc9, 0x34, 0x75, 0x1b, 0xdb, 0x51, 0xec, 0x16, 0xfa, 0x16, 0x3c, 0x07, 0x0f, 0xc0, + 0x03, 0x70, 0xea, 0x71, 0x8f, 0x88, 0x43, 0x81, 0xf6, 0x0d, 0x78, 0x02, 0x64, 0x3b, 0xdd, 0xee, + 0x91, 0x93, 0x67, 0xbe, 0x99, 0xf9, 0xc6, 0xdf, 0x97, 0x18, 0xb5, 0xc5, 0x4c, 0x84, 0x19, 0x2b, + 0xc2, 0x65, 0x5f, 0x1f, 0x41, 0x51, 0x0a, 0x25, 0x30, 0x12, 0x33, 0x11, 0xe8, 0x74, 0xd9, 0x3f, + 0x6d, 0x67, 0x22, 0x13, 0x06, 0x0e, 0x75, 0x64, 0x3b, 0x4e, 0xfd, 0x44, 0x48, 0x26, 0x64, 0x18, + 0x13, 0x09, 0xe1, 0xb2, 0x1f, 0x83, 0x22, 0xfd, 0x30, 0x11, 0x94, 0xdb, 0x7a, 0xf7, 0x9b, 0x83, + 0x9a, 0x23, 0x52, 0x12, 0x26, 0x71, 0x07, 0x1d, 0x65, 0xac, 0x18, 0x93, 0x34, 0x2d, 0x41, 0x4a, + 0xcf, 0x39, 0x73, 0x7a, 0x6e, 0x84, 0x32, 0x56, 0xbc, 0xb4, 0xc8, 0xbe, 0x21, 0x99, 0x12, 0xce, + 0x21, 0xf7, 0xfe, 0xbb, 0x6e, 0x18, 0x5a, 0x64, 0xdf, 0xa0, 0x28, 0x03, 0xb1, 0x50, 0x5e, 0xfd, + 0xcc, 0xe9, 0xd5, 0x4d, 0xc3, 0x5b, 0x8b, 0xe0, 0x87, 0xe8, 0xce, 0x04, 0x60, 0x5c, 0x42, 0x42, + 0x0b, 0x0a, 0x5c, 0x79, 0xff, 0x1b, 0x8e, 0xdb, 0x13, 0x80, 0x68, 0x8f, 0xe1, 0x0b, 0xd4, 0x4e, + 0x61, 0x42, 0x16, 0xb9, 0x1a, 0x67, 0x44, 0x8e, 0x41, 0x2a, 0xca, 0x88, 0x02, 0xaf, 0x61, 0xe8, + 0x70, 0x55, 0x7b, 0x4d, 0xe4, 0xab, 0xaa, 0xd2, 0xfd, 0x5a, 0x47, 0xad, 0x11, 0x59, 0x31, 0x3d, + 0xed, 0xa1, 0x56, 0x09, 0x39, 0x59, 0x41, 0x59, 0x29, 0xd8, 0xa7, 0xf8, 0x31, 0x3a, 0x49, 0x35, + 0x19, 0x27, 0x8a, 0x0a, 0xae, 0x65, 0x50, 0x5e, 0x89, 0x38, 0xbe, 0x51, 0x18, 0x6a, 0x1c, 0xb7, + 0x51, 0x23, 0x05, 0x2e, 0x98, 0x11, 0xe1, 0x46, 0x36, 0xc1, 0x04, 0x35, 0x94, 0x98, 0x03, 0x37, + 0xf7, 0x3e, 0x7a, 0x72, 0x37, 0xb0, 0xee, 0x06, 0xda, 0xdd, 0xa0, 0x72, 0x37, 0x18, 0x0a, 0xca, + 0x07, 0x17, 0xeb, 0x4d, 0xa7, 0xf6, 0xe5, 0x67, 0xa7, 0x97, 0x51, 0x35, 0x5d, 0xc4, 0x41, 0x22, + 0x58, 0x58, 0x7d, 0x0a, 0x7b, 0x9c, 0xcb, 0x74, 0x1e, 0xaa, 0x55, 0x01, 0xd2, 0x0c, 0xc8, 0xc8, + 0x32, 0xe3, 0x77, 0xc8, 0x4d, 0x61, 0x49, 0xcd, 0x55, 0x8c, 0x64, 0x77, 0xf0, 0x4c, 0x73, 0xfd, + 0xd8, 0x74, 0xee, 0xd9, 0x49, 0x99, 0xce, 0x03, 0x2a, 0x42, 0x46, 0xd4, 0x34, 0x78, 0x03, 0x19, + 0x49, 0x56, 0x97, 0x90, 0xfc, 0xd9, 0x74, 0x8e, 0x57, 0x84, 0xe5, 0x2f, 0xba, 0xd7, 0xd3, 0xdd, + 0xe8, 0xc0, 0x84, 0xef, 0x23, 0x77, 0x0a, 0xa4, 0x54, 0x31, 0x10, 0xe5, 0x35, 0x8d, 0x93, 0x07, + 0x00, 0xbf, 0x47, 0x28, 0x27, 0x52, 0x8d, 0x8b, 0x92, 0x26, 0xe0, 0xb5, 0xcc, 0xd6, 0xe7, 0xff, + 0xb6, 0xf5, 0xc4, 0x6e, 0x3d, 0x8c, 0x77, 0x23, 0x57, 0x27, 0x23, 0x1d, 0xe3, 0x07, 0x15, 0x71, + 0x9c, 0x8b, 0x64, 0xee, 0xdd, 0xb2, 0x7b, 0x35, 0x32, 0xd0, 0xc0, 0xe0, 0x72, 0xfd, 0xdb, 0xaf, + 0xad, 0xb7, 0xbe, 0x73, 0xb5, 0xf5, 0x9d, 0x5f, 0x5b, 0xdf, 0xf9, 0xbc, 0xf3, 0x6b, 0x57, 0x3b, + 0xbf, 0xf6, 0x7d, 0xe7, 0xd7, 0x3e, 0x3c, 0xba, 0xe1, 0x9d, 0x98, 0x89, 0x73, 0x0e, 0xea, 0xa3, + 0x28, 0xe7, 0x3a, 0x0e, 0x3f, 0x99, 0xc7, 0x60, 0xfc, 0x8b, 0x9b, 0xe6, 0x57, 0x7e, 0xfa, 0x37, + 0x00, 0x00, 0xff, 0xff, 0x49, 0x4f, 0x3b, 0x8d, 0x24, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -261,11 +263,16 @@ func (m *Payment) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x30 } - if m.Deviation != 0 { - i = encodeVarintGmp(dAtA, i, uint64(m.Deviation)) - i-- - dAtA[i] = 0x28 + { + size := m.Deviation.Size() + i -= size + if _, err := m.Deviation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGmp(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a { size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -358,9 +365,8 @@ func (m *Payment) Size() (n int) { } l = m.Token.Size() n += 1 + l + sovGmp(uint64(l)) - if m.Deviation != 0 { - n += 1 + sovGmp(uint64(m.Deviation)) - } + l = m.Deviation.Size() + n += 1 + l + sovGmp(uint64(l)) if m.Heartbeat != 0 { n += 1 + sovGmp(uint64(m.Heartbeat)) } @@ -721,10 +727,10 @@ func (m *Payment) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Deviation", wireType) } - m.Deviation = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGmp @@ -734,11 +740,26 @@ func (m *Payment) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Deviation |= int64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGmp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGmp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Deviation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Heartbeat", wireType) diff --git a/x/gmp/types/msgs.go b/x/gmp/types/msgs.go index 2abc8c47..06926718 100644 --- a/x/gmp/types/msgs.go +++ b/x/gmp/types/msgs.go @@ -3,6 +3,7 @@ package types import ( fmt "fmt" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ojo-network/ojo/util/checkers" @@ -108,7 +109,7 @@ func NewMsgCreatePayment( destinationChain string, denom string, token sdk.Coin, - deviation int64, + deviation math.LegacyDec, heartbeat int64, ) *MsgCreatePayment { return &MsgCreatePayment{ @@ -146,8 +147,9 @@ func (msg MsgCreatePayment) ValidateBasic() error { if msg.Payment.Token.IsZero() { return fmt.Errorf("token cannot be zero") } - if msg.Payment.Deviation <= 0 { - return fmt.Errorf("deviation must be greater than 0") + // deviation must be between 0.5 and 50 + if msg.Payment.Deviation.LT(math.LegacyNewDecWithPrec(5, 1)) || msg.Payment.Deviation.GT(math.LegacyNewDec(50)) { + return fmt.Errorf("deviation must be between 0.5 and 50") } if msg.Payment.Heartbeat <= 0 { return fmt.Errorf("heartbeat must be greater than 0") diff --git a/x/gmp/types/params.go b/x/gmp/types/params.go index a99ea62c..e9d6aa56 100644 --- a/x/gmp/types/params.go +++ b/x/gmp/types/params.go @@ -10,6 +10,8 @@ var ( DefaultTimeout = int64(1) DefaultFeeRecipient = "axelar1zl3rxpp70lmte2xr6c4lgske2fyuj3hupcsvcd" DefaultGasEstimate = int64(1000000) + EmptyByteSlice = []byte{} + EmptyContract = "0x0000000000000000000000000000000000000000" ) func DefaultParams() Params {