From 0dd957e9d2aaeed5d782c28901079c8dc82b291c Mon Sep 17 00:00:00 2001 From: pyncz Date: Mon, 18 Nov 2024 21:21:07 +0300 Subject: [PATCH 1/7] feat(x/oracle): maintain both `creation_time` and `creation_height` for price records --- proto/archway/oracle/v1/oracle.proto | 13 +- x/oracle/genesis_test.go | 2 +- x/oracle/keeper/keeper.go | 6 +- x/oracle/keeper/querier_test.go | 36 +++- x/oracle/keeper/update_exchange_rates.go | 2 +- x/oracle/types/oracle.pb.go | 201 +++++++++++++++-------- x/oracle/types/params.go | 8 +- 7 files changed, 180 insertions(+), 88 deletions(-) diff --git a/proto/archway/oracle/v1/oracle.proto b/proto/archway/oracle/v1/oracle.proto index 69a19679..170643a7 100644 --- a/proto/archway/oracle/v1/oracle.proto +++ b/proto/archway/oracle/v1/oracle.proto @@ -3,6 +3,7 @@ package archway.oracle.v1; import "gogoproto/gogo.proto"; import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/archway-network/archway/x/oracle/types"; @@ -38,7 +39,8 @@ message Params { // Ex. '["unibi:uusd","ubtc:uusd"]' repeated string whitelist = 4 [ (gogoproto.moretags) = "yaml:\"whitelist\"", - (gogoproto.customtype) = "github.com/archway-network/archway/x/oracle/asset.Pair" + (gogoproto.customtype) = + "github.com/archway-network/archway/x/oracle/asset.Pair" ]; // SlashFraction returns the proportion of an oracle's stake that gets // slashed in the event of slashing. `SlashFraction` specifies the exact @@ -137,7 +139,14 @@ message DatedPrice { (gogoproto.nullable) = false ]; - uint64 created_block = 2 [ (gogoproto.moretags) = "yaml:\"created_block\"" ]; + int64 creation_height = 2 + [ (gogoproto.moretags) = "yaml:\"creation_height\"" ]; + + google.protobuf.Timestamp creation_time = 3 [ + (gogoproto.moretags) = "yaml:\"creation_time\"", + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; } // Rewards defines a credit object towards validators diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index cb5618e6..0b4ef402 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -27,7 +27,7 @@ func TestExportInitGenesis(t *testing.T) { keepers.OracleKeeper.Params.Set(ctx, types.DefaultParams()) keepers.OracleKeeper.FeederDelegations.Set(ctx, ValAddrs[0], AccAddrs[1]) - keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreatedBlock: 0}) + keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreationHeight: 0, CreationTime: 0}) keepers.OracleKeeper.Prevotes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, ValAddrs[0], uint64(2))) keepers.OracleKeeper.Votes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Pair: "foo", ExchangeRate: math.LegacyNewDec(123)}}, ValAddrs[0])) keepers.OracleKeeper.WhitelistedPairs.Set(ctx, "pair1:pair1") diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 25981a5b..bc050a4b 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -206,7 +206,11 @@ func (k Keeper) GetExchangeRate(ctx sdk.Context, pair asset.Pair) (price math.Le // SetPrice sets the price for a pair as well as the price snapshot. func (k Keeper) SetPrice(ctx sdk.Context, pair asset.Pair, price math.LegacyDec) { - k.ExchangeRates.Set(ctx, pair, types.DatedPrice{ExchangeRate: price, CreatedBlock: uint64(ctx.BlockHeight())}) + k.ExchangeRates.Set(ctx, pair, types.DatedPrice{ + ExchangeRate: price, + CreationHeight: ctx.BlockHeight(), + CreationTime: ctx.BlockTime(), + }) key := collections.Join(pair, ctx.BlockTime()) timestampMs := ctx.BlockTime().UnixMilli() diff --git a/x/oracle/keeper/querier_test.go b/x/oracle/keeper/querier_test.go index 1ec833f0..f4f6f882 100644 --- a/x/oracle/keeper/querier_test.go +++ b/x/oracle/keeper/querier_test.go @@ -38,7 +38,11 @@ func TestQueryExchangeRate(t *testing.T) { querier := keeper.NewQuerier(keepers.OracleKeeper) rate := math.LegacyNewDec(1700) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(ctx.BlockHeight())}) + keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTime: ctx.BlockTime(), + }) // empty request _, err := querier.ExchangeRate(ctx, nil) @@ -86,8 +90,16 @@ func TestQueryExchangeRates(t *testing.T) { querier := keeper.NewQuerier(keepers.OracleKeeper) rate := math.LegacyNewDec(1700) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(ctx.BlockHeight())}) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(ctx.BlockHeight())}) + keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTime: ctx.BlockTime(), + }) + keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTime: ctx.BlockTime(), + }) res, err := querier.ExchangeRates(ctx, &types.QueryExchangeRatesRequest{}) require.NoError(t, err) @@ -219,9 +231,21 @@ func TestQueryActives(t *testing.T) { queryClient := keeper.NewQuerier(keepers.OracleKeeper) rate := math.LegacyNewDec(1700) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(ctx.BlockHeight())}) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(ctx.BlockHeight())}) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ExchangeRate: rate, CreatedBlock: uint64(ctx.BlockHeight())}) + keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTime: ctx.BlockTime(), + }) + keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), types.DatedPrice{ + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTime: ctx.BlockTime(), + }) + keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTime: ctx.BlockTime(), + }) res, err := queryClient.Actives(ctx, &types.QueryActivesRequest{}) require.NoError(t, err) diff --git a/x/oracle/keeper/update_exchange_rates.go b/x/oracle/keeper/update_exchange_rates.go index 6196dcc4..ffb4aeb2 100644 --- a/x/oracle/keeper/update_exchange_rates.go +++ b/x/oracle/keeper/update_exchange_rates.go @@ -116,7 +116,7 @@ func (k Keeper) ClearExchangeRates(ctx sdk.Context, pairVotes map[asset.Pair]typ k.ExchangeRates.Walk(ctx, nil, func(key asset.Pair, _ types.DatedPrice) (bool, error) { _, isValid := pairVotes[key] previousExchangeRate, _ := k.ExchangeRates.Get(ctx, key) - isExpired := previousExchangeRate.CreatedBlock+params.ExpirationBlocks <= uint64(ctx.BlockHeight()) + isExpired := uint64(previousExchangeRate.CreationHeight)+params.ExpirationBlocks <= uint64(ctx.BlockHeight()) if isValid || isExpired { err := k.ExchangeRates.Remove(ctx, key) diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index c1d35ca6..dfdff25f 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -12,6 +12,7 @@ import ( proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" @@ -261,8 +262,9 @@ func (m *ExchangeRateTuple) XXX_DiscardUnknown() { var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo type DatedPrice struct { - ExchangeRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"exchange_rate" yaml:"exchange_rate"` - CreatedBlock uint64 `protobuf:"varint,2,opt,name=created_block,json=createdBlock,proto3" json:"created_block,omitempty" yaml:"created_block"` + ExchangeRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"exchange_rate" yaml:"exchange_rate"` + CreationHeight int64 `protobuf:"varint,2,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` + CreationTime time.Time `protobuf:"bytes,3,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` } func (m *DatedPrice) Reset() { *m = DatedPrice{} } @@ -298,13 +300,20 @@ func (m *DatedPrice) XXX_DiscardUnknown() { var xxx_messageInfo_DatedPrice proto.InternalMessageInfo -func (m *DatedPrice) GetCreatedBlock() uint64 { +func (m *DatedPrice) GetCreationHeight() int64 { if m != nil { - return m.CreatedBlock + return m.CreationHeight } return 0 } +func (m *DatedPrice) GetCreationTime() time.Time { + if m != nil { + return m.CreationTime + } + return time.Time{} +} + // Rewards defines a credit object towards validators // which provide prices faithfully for different pairs. type Rewards struct { @@ -383,68 +392,71 @@ func init() { func init() { proto.RegisterFile("archway/oracle/v1/oracle.proto", fileDescriptor_ceb632d7c2facf1a) } var fileDescriptor_ceb632d7c2facf1a = []byte{ - // 966 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0x1b, 0xc5, - 0x1b, 0xf6, 0x26, 0x4e, 0x1a, 0x8f, 0x93, 0xfe, 0xe2, 0x69, 0xfa, 0x63, 0x93, 0x56, 0xde, 0x30, - 0x20, 0x94, 0x03, 0xec, 0x2a, 0xe5, 0x9f, 0x08, 0x70, 0xe8, 0x12, 0x2a, 0x55, 0x14, 0x64, 0x8d, - 0x2a, 0x90, 0x7a, 0x31, 0xe3, 0xdd, 0xc9, 0xee, 0x28, 0xbb, 0x1e, 0x33, 0x33, 0x89, 0xe3, 0x6f, - 0xc0, 0x11, 0x2e, 0x08, 0x6e, 0x39, 0x23, 0x71, 0xe0, 0x5b, 0xf4, 0xd8, 0x23, 0xea, 0x61, 0x0b, - 0xc9, 0xa5, 0xe2, 0xe8, 0x4f, 0x80, 0x66, 0x76, 0x1c, 0x6f, 0x64, 0x1f, 0x4c, 0xc5, 0x6d, 0xdf, - 0xf7, 0x99, 0x79, 0xde, 0x7f, 0xcf, 0xce, 0x0b, 0xda, 0x44, 0x44, 0xe9, 0x90, 0x8c, 0x02, 0x2e, - 0x48, 0x94, 0xd1, 0xe0, 0x74, 0xdf, 0x7e, 0xf9, 0x03, 0xc1, 0x15, 0x87, 0x2d, 0x8b, 0xfb, 0xd6, - 0x7b, 0xba, 0xbf, 0xb3, 0x95, 0xf0, 0x84, 0x1b, 0x34, 0xd0, 0x5f, 0xe5, 0xc1, 0x9d, 0x76, 0xc2, - 0x79, 0x92, 0xd1, 0xc0, 0x58, 0xbd, 0x93, 0xa3, 0x20, 0x3e, 0x11, 0x44, 0x31, 0xde, 0x9f, 0xe0, - 0x11, 0x97, 0x39, 0x97, 0x41, 0x8f, 0x48, 0x1d, 0xa5, 0x47, 0x15, 0xd9, 0x0f, 0x22, 0xce, 0x2c, - 0x8e, 0x7e, 0x59, 0x03, 0xab, 0x1d, 0x22, 0x48, 0x2e, 0xe1, 0x87, 0xa0, 0x79, 0xca, 0x15, 0xed, - 0x0e, 0xa8, 0x60, 0x3c, 0x76, 0x9d, 0x5d, 0x67, 0xaf, 0x1e, 0xfe, 0x7f, 0x5c, 0x78, 0x70, 0x44, - 0xf2, 0xec, 0x00, 0x55, 0x40, 0x84, 0x81, 0xb6, 0x3a, 0xc6, 0x80, 0x11, 0xb8, 0x69, 0x30, 0x95, - 0x0a, 0x2a, 0x53, 0x9e, 0xc5, 0xee, 0xd2, 0xae, 0xb3, 0xd7, 0x08, 0x3f, 0x79, 0x5a, 0x78, 0xb5, - 0xe7, 0x85, 0x77, 0xa7, 0xcc, 0x41, 0xc6, 0xc7, 0x3e, 0xe3, 0x41, 0x4e, 0x54, 0xea, 0x3f, 0xa2, - 0x09, 0x89, 0x46, 0x87, 0x34, 0x1a, 0x17, 0xde, 0xed, 0x0a, 0xfd, 0x15, 0x05, 0xc2, 0x1b, 0xda, - 0xf1, 0x78, 0x62, 0xc3, 0x27, 0xa0, 0x29, 0xe8, 0x90, 0x88, 0xb8, 0xdb, 0x23, 0xfd, 0xd8, 0x5d, - 0x36, 0x11, 0x3e, 0x5a, 0x2c, 0x82, 0x2d, 0xa0, 0x72, 0x1f, 0x61, 0x50, 0x5a, 0x21, 0xe9, 0xc7, - 0x30, 0x03, 0x8d, 0x61, 0xca, 0x14, 0xcd, 0x98, 0x54, 0x6e, 0x7d, 0x77, 0x79, 0xaf, 0x11, 0x7e, - 0xf5, 0xbc, 0xf0, 0x3e, 0x48, 0x98, 0x4a, 0x4f, 0x7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 0x57, 0x76, 0xa7, 0x2c, 0x89, 0x71, 0x73, - 0xba, 0x41, 0x25, 0x7c, 0x1f, 0xac, 0xe8, 0xa5, 0x2c, 0xdd, 0x65, 0x23, 0xc4, 0x6d, 0xbf, 0xac, - 0xc7, 0xd7, 0x6b, 0xdb, 0xb7, 0x6b, 0xdb, 0xff, 0x8c, 0xb3, 0x7e, 0x58, 0xd7, 0x15, 0xe3, 0xf2, - 0x74, 0xf8, 0xc5, 0xd3, 0x8b, 0xb6, 0xf3, 0xec, 0xa2, 0xed, 0xfc, 0x79, 0xd1, 0x76, 0x7e, 0xb8, - 0x6c, 0xd7, 0x9e, 0x5d, 0xb6, 0x6b, 0x7f, 0x5c, 0xb6, 0x6b, 0x4f, 0xf6, 0xff, 0xcd, 0xdc, 0xd5, - 0x68, 0x40, 0x65, 0x6f, 0xd5, 0x3c, 0xad, 0xef, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x31, 0xf1, - 0x7d, 0x89, 0x9c, 0x08, 0x00, 0x00, + // 1021 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xf6, 0x26, 0x4e, 0x1a, 0x8f, 0x93, 0x34, 0x9e, 0xba, 0x65, 0x93, 0x56, 0x5e, 0x33, 0x20, + 0x94, 0x03, 0xac, 0x95, 0xf0, 0x25, 0x02, 0x97, 0x6e, 0x43, 0x45, 0x45, 0x41, 0xd6, 0x28, 0x02, + 0xa9, 0x17, 0x33, 0x5e, 0x4f, 0x76, 0x47, 0xd9, 0xf5, 0x98, 0x99, 0x49, 0x9c, 0xfc, 0x03, 0x8e, + 0xe5, 0x52, 0xc1, 0x2d, 0x67, 0x6e, 0xfc, 0x8b, 0x1e, 0x7b, 0x44, 0x3d, 0x6c, 0x21, 0xb9, 0x54, + 0x1c, 0xfd, 0x0b, 0xd0, 0xcc, 0x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0x3d, 0xd9, 0xfa, 0x3f, 0x03, 0xa6, 0x4e, 0x06, 0x54, 0x76, 0x17, 0x4d, 0x15, 0x3e, 0xfe, + 0x2f, 0x00, 0x00, 0xff, 0xff, 0x07, 0x99, 0xbb, 0x17, 0x26, 0x09, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -770,8 +782,16 @@ func (m *DatedPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.CreatedBlock != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.CreatedBlock)) + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreationTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintOracle(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a + if m.CreationHeight != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.CreationHeight)) i-- dAtA[i] = 0x10 } @@ -945,9 +965,11 @@ func (m *DatedPrice) Size() (n int) { _ = l l = m.ExchangeRate.Size() n += 1 + l + sovOracle(uint64(l)) - if m.CreatedBlock != 0 { - n += 1 + sovOracle(uint64(m.CreatedBlock)) + if m.CreationHeight != 0 { + n += 1 + sovOracle(uint64(m.CreationHeight)) } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreationTime) + n += 1 + l + sovOracle(uint64(l)) return n } @@ -1775,9 +1797,9 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedBlock", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) } - m.CreatedBlock = 0 + m.CreationHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOracle @@ -1787,11 +1809,44 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CreatedBlock |= uint64(b&0x7F) << shift + m.CreationHeight |= int64(b&0x7F) << shift if b < 0x80 { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipOracle(dAtA[iNdEx:]) diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index b75b9c77..7e523d49 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -25,12 +25,12 @@ var ( ) // Default parameter values -// Assumes block times are 2s +// Assumes block times are 6s const ( - DefaultVotePeriod = 5 // vote every 1 minute - DefaultSlashWindow = 3600 // 2 hours + DefaultVotePeriod = 10 // vote every 1 minute + DefaultSlashWindow = 1200 // 2 hours DefaultMinVoters = 4 // minimum of 4 voters for a pair to become valid - DefaultExpirationBlocks = 900 // 30 minutes + DefaultExpirationBlocks = 300 // 30 minutes ) // Default parameter values From d38e9d59e4a82dbb091ca1640a134b87ce102a9b Mon Sep 17 00:00:00 2001 From: pyncz Date: Mon, 18 Nov 2024 21:33:56 +0300 Subject: [PATCH 2/7] chore: proto gen --- proto/archway/callback/v1/callback.proto | 87 +++++++++++++++--------- proto/archway/callback/v1/errors.proto | 6 +- proto/archway/callback/v1/events.proto | 86 ++++++++++++----------- proto/archway/callback/v1/genesis.proto | 2 +- proto/archway/callback/v1/query.proto | 44 ++++++------ proto/archway/callback/v1/tx.proto | 74 +++++++++++--------- proto/archway/cwerrors/v1/cwerrors.proto | 3 +- proto/archway/cwfees/v1/cwfees.proto | 26 ++++--- proto/archway/genmsg/v1/genmsg.proto | 8 +-- proto/archway/rewards/v1/tx.proto | 13 ++-- x/callback/types/callback.pb.go | 39 +++++++---- x/callback/types/errors.pb.go | 6 +- x/callback/types/events.pb.go | 24 ++++--- x/callback/types/query.pb.go | 15 ++-- x/callback/types/tx.pb.go | 36 ++++++---- x/cwerrors/types/cwerrors.pb.go | 3 +- x/cwfees/types/cwfees.pb.go | 21 ++++-- x/genmsg/types/genmsg.pb.go | 3 +- x/rewards/types/events.pb.go | 1 + x/rewards/types/genesis.pb.go | 1 + x/rewards/types/query.pb.go | 1 + x/rewards/types/query.pb.gw.go | 1 + x/rewards/types/rewards.pb.go | 1 + x/rewards/types/tx.pb.go | 4 +- x/tracking/types/genesis.pb.go | 1 + x/tracking/types/query.pb.go | 1 + x/tracking/types/query.pb.gw.go | 1 + x/tracking/types/tracking.pb.go | 1 + 28 files changed, 311 insertions(+), 198 deletions(-) diff --git a/proto/archway/callback/v1/callback.proto b/proto/archway/callback/v1/callback.proto index 513b6fed..ec37b5f4 100644 --- a/proto/archway/callback/v1/callback.proto +++ b/proto/archway/callback/v1/callback.proto @@ -10,42 +10,63 @@ option go_package = "github.com/archway-network/archway/x/callback/types"; // Callback defines the callback structure. message Callback { - // contract_address is the address of the contract which is requesting the callback (bech32 encoded). - string contract_address = 1; - // job_id is an identifier the callback requestor can pass in to identify the callback when it happens. - uint64 job_id = 2; - // callback_height is the height at which the callback is executed. - int64 callback_height = 3; - // fee_split is the breakdown of the fees paid by the contract to reserve the callback - CallbackFeesFeeSplit fee_split = 4; - // reserved_by is the address which reserved the callback (bech32 encoded). - string reserved_by = 5; - // callback_gas_limit is the maximum gas that can be consumed by this callback. - uint64 max_gas_limit = 6; + // contract_address is the address of the contract which is requesting the + // callback (bech32 encoded). + string contract_address = 1; + // job_id is an identifier the callback requestor can pass in to identify the + // callback when it happens. + uint64 job_id = 2; + // callback_height is the height at which the callback is executed. + int64 callback_height = 3; + // fee_split is the breakdown of the fees paid by the contract to reserve the + // callback + CallbackFeesFeeSplit fee_split = 4; + // reserved_by is the address which reserved the callback (bech32 encoded). + string reserved_by = 5; + // callback_gas_limit is the maximum gas that can be consumed by this + // callback. + uint64 max_gas_limit = 6; } -// CallbackFeesFeeSplit is the breakdown of all the fees that need to be paid by the contract to reserve a callback +// CallbackFeesFeeSplit is the breakdown of all the fees that need to be paid by +// the contract to reserve a callback message CallbackFeesFeeSplit { - // transaction_fees is the transaction fees for the callback based on its gas consumption - cosmos.base.v1beta1.Coin transaction_fees = 1; - // block_reservation_fees is the block reservation fees portion of the callback reservation fees - cosmos.base.v1beta1.Coin block_reservation_fees = 2; - // future_reservation_fees is the future reservation fees portion of the callback reservation fees - cosmos.base.v1beta1.Coin future_reservation_fees = 3; - // surplus_fees is any extra fees passed in for the registration of the callback - cosmos.base.v1beta1.Coin surplus_fees = 4; - } + // transaction_fees is the transaction fees for the callback based on its gas + // consumption + cosmos.base.v1beta1.Coin transaction_fees = 1; + // block_reservation_fees is the block reservation fees portion of the + // callback reservation fees + cosmos.base.v1beta1.Coin block_reservation_fees = 2; + // future_reservation_fees is the future reservation fees portion of the + // callback reservation fees + cosmos.base.v1beta1.Coin future_reservation_fees = 3; + // surplus_fees is any extra fees passed in for the registration of the + // callback + cosmos.base.v1beta1.Coin surplus_fees = 4; +} // Params defines the module parameters. message Params { - // callback_gas_limit is the maximum gas that can be consumed by a callback. - uint64 callback_gas_limit = 1; - // max_block_reservation_limit is the maximum number of callbacks which can be registered in a given block. - uint64 max_block_reservation_limit = 2; - // max_future_reservation_limit is the maximum number of blocks in the future that a contract can request a callback in. - uint64 max_future_reservation_limit = 3; - // block_reservation_fee_multiplier is used to calculate a part of the reservation fees which will need to be paid when requesting the callback. - string block_reservation_fee_multiplier = 4 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false]; - // future_reservation_fee_multiplier is used to calculate a part of the reservation fees which will need to be paid while requesting the callback. - string future_reservation_fee_multiplier = 5 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false]; -} \ No newline at end of file + // callback_gas_limit is the maximum gas that can be consumed by a callback. + uint64 callback_gas_limit = 1; + // max_block_reservation_limit is the maximum number of callbacks which can be + // registered in a given block. + uint64 max_block_reservation_limit = 2; + // max_future_reservation_limit is the maximum number of blocks in the future + // that a contract can request a callback in. + uint64 max_future_reservation_limit = 3; + // block_reservation_fee_multiplier is used to calculate a part of the + // reservation fees which will need to be paid when requesting the callback. + string block_reservation_fee_multiplier = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // future_reservation_fee_multiplier is used to calculate a part of the + // reservation fees which will need to be paid while requesting the callback. + string future_reservation_fee_multiplier = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/archway/callback/v1/errors.proto b/proto/archway/callback/v1/errors.proto index 0139a782..ab7dafe1 100644 --- a/proto/archway/callback/v1/errors.proto +++ b/proto/archway/callback/v1/errors.proto @@ -9,8 +9,10 @@ option go_package = "github.com/archway-network/archway/x/callback/types"; enum ModuleErrors { // ERR_UNKNOWN is the default error code ERR_UNKNOWN = 0; - // ERR_OUT_OF_GAS is the error code when the contract callback exceeds the gas limit allowed by the module + // ERR_OUT_OF_GAS is the error code when the contract callback exceeds the gas + // limit allowed by the module ERR_OUT_OF_GAS = 1; - // ERR_CONTRACT_EXECUTION_FAILED is the error code when the contract callback execution fails + // ERR_CONTRACT_EXECUTION_FAILED is the error code when the contract callback + // execution fails ERR_CONTRACT_EXECUTION_FAILED = 2; } \ No newline at end of file diff --git a/proto/archway/callback/v1/events.proto b/proto/archway/callback/v1/events.proto index 669175bc..cc519077 100644 --- a/proto/archway/callback/v1/events.proto +++ b/proto/archway/callback/v1/events.proto @@ -10,54 +10,62 @@ import "cosmos_proto/cosmos.proto"; // CallbackRegisteredEvent is emitted when a callback is registered. message CallbackRegisteredEvent { - // contract_address is the address of the contract for which callback is being registered (bech32 encoded). - string contract_address = 1; - // job_id is an identifier of the callback. - uint64 job_id = 2; - // callback_height is the height at which the callback is executed. - int64 callback_height = 3; - // fee_split is the breakdown of the fees paid by the contract to reserve the callback - CallbackFeesFeeSplit fee_split = 4; - // reserved_by is the address which reserved the callback (bech32 encoded). - string reserved_by = 5; + // contract_address is the address of the contract for which callback is being + // registered (bech32 encoded). + string contract_address = 1; + // job_id is an identifier of the callback. + uint64 job_id = 2; + // callback_height is the height at which the callback is executed. + int64 callback_height = 3; + // fee_split is the breakdown of the fees paid by the contract to reserve the + // callback + CallbackFeesFeeSplit fee_split = 4; + // reserved_by is the address which reserved the callback (bech32 encoded). + string reserved_by = 5; } // CallbackCancelledEvent is emitted when a callback is cancelled. message CallbackCancelledEvent { - // cancelled_by is the address of the contract whose callback is being cancelled (bech32 encoded) - string cancelled_by = 1; - // contract_address is the address of the contract (bech32 encoded) - string contract_address = 2; - // job_id is an identifier the callback requestor had passed during registration of the callback - uint64 job_id = 3; - // callback_height is the height at which the callback requestor had registered the callback - int64 callback_height = 4; - // refund_amount is the amount of fees which was refunded on cancellation - cosmos.base.v1beta1.Coin refund_amount = 5 [ (gogoproto.nullable) = false ]; + // cancelled_by is the address of the contract whose callback is being + // cancelled (bech32 encoded) + string cancelled_by = 1; + // contract_address is the address of the contract (bech32 encoded) + string contract_address = 2; + // job_id is an identifier the callback requestor had passed during + // registration of the callback + uint64 job_id = 3; + // callback_height is the height at which the callback requestor had + // registered the callback + int64 callback_height = 4; + // refund_amount is the amount of fees which was refunded on cancellation + cosmos.base.v1beta1.Coin refund_amount = 5 [ (gogoproto.nullable) = false ]; } -// CallbackExecutedSuccessEvent is emitted when a callback is executed successfully. +// CallbackExecutedSuccessEvent is emitted when a callback is executed +// successfully. message CallbackExecutedSuccessEvent { - // contract_address is the address of the contract for which callback is being executed (bech32 encoded). - string contract_address = 1; - // job_id is an identifier of the callback. - uint64 job_id = 2; - // sudo_msg is the input passed by the module to the contract - string sudo_msg = 3; - // gas_used is the amount of gas consumed during the callback execution - uint64 gas_used = 4; + // contract_address is the address of the contract for which callback is being + // executed (bech32 encoded). + string contract_address = 1; + // job_id is an identifier of the callback. + uint64 job_id = 2; + // sudo_msg is the input passed by the module to the contract + string sudo_msg = 3; + // gas_used is the amount of gas consumed during the callback execution + uint64 gas_used = 4; } // CallbackExecutedFailedEvent is emitted when a callback execution fails. message CallbackExecutedFailedEvent { - // contract_address is the address of the contract for which callback is being executed (bech32 encoded). - string contract_address = 1; - // job_id is an identifier of the callback. - uint64 job_id = 2; - // sudo_msg is the input passed by the module to the contract - string sudo_msg = 3; - // gas_used is the amount of gas consumed during the callback execution - uint64 gas_used = 4; - // error is the error returned during the callback execution - string error = 5; + // contract_address is the address of the contract for which callback is being + // executed (bech32 encoded). + string contract_address = 1; + // job_id is an identifier of the callback. + uint64 job_id = 2; + // sudo_msg is the input passed by the module to the contract + string sudo_msg = 3; + // gas_used is the amount of gas consumed during the callback execution + uint64 gas_used = 4; + // error is the error returned during the callback execution + string error = 5; } diff --git a/proto/archway/callback/v1/genesis.proto b/proto/archway/callback/v1/genesis.proto index d81c594a..f25eb949 100644 --- a/proto/archway/callback/v1/genesis.proto +++ b/proto/archway/callback/v1/genesis.proto @@ -10,7 +10,7 @@ import "archway/callback/v1/callback.proto"; // GenesisState defines the initial state of the callback module. message GenesisState { // params defines all the module parameters. - Params params = 1 [ (gogoproto.nullable) = false ]; + Params params = 1 [ (gogoproto.nullable) = false ]; // callbacks defines all the callbacks which are yet to be executed repeated Callback callbacks = 2; } diff --git a/proto/archway/callback/v1/query.proto b/proto/archway/callback/v1/query.proto index 3714deca..db481396 100644 --- a/proto/archway/callback/v1/query.proto +++ b/proto/archway/callback/v1/query.proto @@ -10,18 +10,21 @@ import "archway/callback/v1/callback.proto"; // Query service for the callback module. service Query { - // Params returns module parameters - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/archway/callback/v1/params"; - } - // EstimateCallbackFees returns the total amount of callback fees a contract needs to pay to register the callback - rpc EstimateCallbackFees(QueryEstimateCallbackFeesRequest) returns (QueryEstimateCallbackFeesResponse) { - option (google.api.http).get = "/archway/callback/v1/estimate_callback_fees"; - } - // Callbacks returns all the callbacks registered at a given height - rpc Callbacks(QueryCallbacksRequest) returns (QueryCallbacksResponse) { - option (google.api.http).get = "/archway/callback/v1/callbacks"; - } + // Params returns module parameters + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/archway/callback/v1/params"; + } + // EstimateCallbackFees returns the total amount of callback fees a contract + // needs to pay to register the callback + rpc EstimateCallbackFees(QueryEstimateCallbackFeesRequest) + returns (QueryEstimateCallbackFeesResponse) { + option (google.api.http).get = + "/archway/callback/v1/estimate_callback_fees"; + } + // Callbacks returns all the callbacks registered at a given height + rpc Callbacks(QueryCallbacksRequest) returns (QueryCallbacksResponse) { + option (google.api.http).get = "/archway/callback/v1/callbacks"; + } } // QueryParamsRequest is the request for Query.Params. @@ -33,28 +36,31 @@ message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } -// QueryEstimateCallbackFeesRequest is the request for Query.EstimateCallbackFees. -message QueryEstimateCallbackFeesRequest{ +// QueryEstimateCallbackFeesRequest is the request for +// Query.EstimateCallbackFees. +message QueryEstimateCallbackFeesRequest { // block_height is the height at which to estimate the callback fees int64 block_height = 1; } -// QueryEstimateCallbackFeesResponse is the response for Query.EstimateCallbackFees. -message QueryEstimateCallbackFeesResponse{ - // total_fees is the total fees that needs to be paid by the contract to reserve a callback +// QueryEstimateCallbackFeesResponse is the response for +// Query.EstimateCallbackFees. +message QueryEstimateCallbackFeesResponse { + // total_fees is the total fees that needs to be paid by the contract to + // reserve a callback cosmos.base.v1beta1.Coin total_fees = 1; // fee_split is the breakdown of the total_fees CallbackFeesFeeSplit fee_split = 2; } // QueryCallbacksRequest is the request for Query.Callbacks. -message QueryCallbacksRequest{ +message QueryCallbacksRequest { // block_height is the height at which to query the callbacks int64 block_height = 1; } // QueryCallbacksResponse is the response for Query.Callbacks. -message QueryCallbacksResponse{ +message QueryCallbacksResponse { // callbacks is the list of callbacks registered at the given height repeated Callback callbacks = 1; } \ No newline at end of file diff --git a/proto/archway/callback/v1/tx.proto b/proto/archway/callback/v1/tx.proto index 1903458f..f9935334 100644 --- a/proto/archway/callback/v1/tx.proto +++ b/proto/archway/callback/v1/tx.proto @@ -15,7 +15,8 @@ service Msg { // module parameters. The authority is defined in the keeper. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); - // RequestCallback defines a message for registering a callback at a specific height by a given contract + // RequestCallback defines a message for registering a callback at a specific + // height by a given contract rpc RequestCallback(MsgRequestCallback) returns (MsgRequestCallbackResponse); // CancelCallback defines a message for cancelling an existing callback @@ -24,53 +25,64 @@ service Msg { // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - // authority is the address that controls the module (defaults to x/gov unless overwritten). - string authority = 1; - // params defines the x/callback parameters to update. - // - // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "params,omitempty"]; + option (cosmos.msg.v1.signer) = "authority"; + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1; + // params defines the x/callback parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "params,omitempty" + ]; } - -// MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. message MsgUpdateParamsResponse {} // MsgRequestCallback is the Msg/RequestCallback request type. message MsgRequestCallback { - option (cosmos.msg.v1.signer) = "sender"; - // sender is the address who is requesting the callback (bech32 encoded) - string sender = 1; - // contract_address is the address of the contract which is requesting the callback (bech32 encoded) - string contract_address = 2; - // job_id is an identifier the callback requestor can pass in to identify the callback when it happens - uint64 job_id = 3; - // callback_height is the height at which the callback is executed. - int64 callback_height = 4; - // fees is the amount of fees being paid to register the contract - cosmos.base.v1beta1.Coin fees = 5 [ (gogoproto.nullable) = false ]; + option (cosmos.msg.v1.signer) = "sender"; + // sender is the address who is requesting the callback (bech32 encoded) + string sender = 1; + // contract_address is the address of the contract which is requesting the + // callback (bech32 encoded) + string contract_address = 2; + // job_id is an identifier the callback requestor can pass in to identify the + // callback when it happens + uint64 job_id = 3; + // callback_height is the height at which the callback is executed. + int64 callback_height = 4; + // fees is the amount of fees being paid to register the contract + cosmos.base.v1beta1.Coin fees = 5 [ (gogoproto.nullable) = false ]; } - -// MsgRequestCallbackResponse defines the response structure for executing a MsgRequestCallback message. +// MsgRequestCallbackResponse defines the response structure for executing a +// MsgRequestCallback message. message MsgRequestCallbackResponse {} // MsgCancelCallback is the Msg/CancelCallback request type. -message MsgCancelCallback{ +message MsgCancelCallback { option (cosmos.msg.v1.signer) = "sender"; - // sender is the address of the contract which is cancelling the callback (bech32 encoded) + // sender is the address of the contract which is cancelling the callback + // (bech32 encoded) string sender = 1; // contract_address is the address of the contract (bech32 encoded) string contract_address = 2; - // job_id is an identifier the callback requestor had passed during registration of the callback + // job_id is an identifier the callback requestor had passed during + // registration of the callback uint64 job_id = 3; - // callback_height is the height at which the callback requestor had registered the callback + // callback_height is the height at which the callback requestor had + // registered the callback int64 callback_height = 4; } - -// MsgCancelCallbackResponse defines the response structure for executing a MsgCancelCallback message. +// MsgCancelCallbackResponse defines the response structure for executing a +// MsgCancelCallback message. message MsgCancelCallbackResponse { - // refund is the amount of fees being refunded due to the cancellation of the callback + // refund is the amount of fees being refunded due to the cancellation of the + // callback cosmos.base.v1beta1.Coin refund = 1 [ (gogoproto.nullable) = false ]; -} \ No newline at end of file +} \ No newline at end of file diff --git a/proto/archway/cwerrors/v1/cwerrors.proto b/proto/archway/cwerrors/v1/cwerrors.proto index ded53eab..3d580373 100644 --- a/proto/archway/cwerrors/v1/cwerrors.proto +++ b/proto/archway/cwerrors/v1/cwerrors.proto @@ -24,6 +24,7 @@ message SudoError { enum ModuleErrors { // ERR_UNKNOWN is the default error code ERR_UNKNOWN = 0; - // ERR_CALLBACK_EXECUTION_FAILED is the error code for when the error callback fails + // ERR_CALLBACK_EXECUTION_FAILED is the error code for when the error callback + // fails ERR_CALLBACK_EXECUTION_FAILED = 1; } \ No newline at end of file diff --git a/proto/archway/cwfees/v1/cwfees.proto b/proto/archway/cwfees/v1/cwfees.proto index 3bf230cd..0b104012 100644 --- a/proto/archway/cwfees/v1/cwfees.proto +++ b/proto/archway/cwfees/v1/cwfees.proto @@ -5,15 +5,18 @@ import "google/protobuf/any.proto"; import "cosmos/msg/v1/msg.proto"; - option go_package = "github.com/archway-network/archway/x/cwfees/types"; service Msg { option (cosmos.msg.v1.service) = true; - // RegisterAsGranter allows a cosmwasm contract to register itself as a fee granter. - rpc RegisterAsGranter(MsgRegisterAsGranter) returns (MsgRegisterAsGranterResponse); - // UnregisterAsGranter allows a cosmwasm contract to unregister itself as a fee granter. - rpc UnregisterAsGranter(MsgUnregisterAsGranter) returns (MsgUnregisterAsGranterResponse); + // RegisterAsGranter allows a cosmwasm contract to register itself as a fee + // granter. + rpc RegisterAsGranter(MsgRegisterAsGranter) + returns (MsgRegisterAsGranterResponse); + // UnregisterAsGranter allows a cosmwasm contract to unregister itself as a + // fee granter. + rpc UnregisterAsGranter(MsgUnregisterAsGranter) + returns (MsgUnregisterAsGranterResponse); } // MsgRegisterAsGranter allows a contract to register itself as a fee granter. @@ -25,7 +28,8 @@ message MsgRegisterAsGranter { // MsgRegisterAsGranterResponse defines the response of RegisterAsGranter. message MsgRegisterAsGranterResponse {} -// MsgUnregisterAsGranter can be used by a cosmwasm contract to unregister itself as a fee granter. +// MsgUnregisterAsGranter can be used by a cosmwasm contract to unregister +// itself as a fee granter. message MsgUnregisterAsGranter { option (cosmos.msg.v1.signer) = "granting_contract"; string granting_contract = 1; @@ -35,8 +39,10 @@ message MsgUnregisterAsGranter { message MsgUnregisterAsGranterResponse {} service Query { - // IsGrantingContract can be used to check if a contract is a granting contract. - rpc IsGrantingContract(IsGrantingContractRequest) returns (IsGrantingContractResponse); + // IsGrantingContract can be used to check if a contract is a granting + // contract. + rpc IsGrantingContract(IsGrantingContractRequest) + returns (IsGrantingContractResponse); } // IsGrantingContract is the request type of IsGrantingContract RPC. @@ -53,6 +59,4 @@ message IsGrantingContractResponse { } // GenesisState represents the genesis state of the cwfeesant module. -message GenesisState { - repeated string granting_contracts = 1; -} +message GenesisState { repeated string granting_contracts = 1; } diff --git a/proto/archway/genmsg/v1/genmsg.proto b/proto/archway/genmsg/v1/genmsg.proto index 93f2de4c..2dc193ed 100644 --- a/proto/archway/genmsg/v1/genmsg.proto +++ b/proto/archway/genmsg/v1/genmsg.proto @@ -3,10 +3,8 @@ package archway.genmsg.v1; import "google/protobuf/any.proto"; - option go_package = "github.com/archway-network/archway/x/genmsg/types"; -// GenesisState represents the messages to be processed during genesis by the genmsg module. -message GenesisState { - repeated google.protobuf.Any messages = 1; -} +// GenesisState represents the messages to be processed during genesis by the +// genmsg module. +message GenesisState { repeated google.protobuf.Any messages = 1; } diff --git a/proto/archway/rewards/v1/tx.proto b/proto/archway/rewards/v1/tx.proto index 982d2669..3c914956 100644 --- a/proto/archway/rewards/v1/tx.proto +++ b/proto/archway/rewards/v1/tx.proto @@ -50,9 +50,7 @@ message MsgWithdrawRewards { option (cosmos.msg.v1.signer) = "rewards_address"; message RecordsLimit { uint64 limit = 1; } - message RecordIDs { - repeated uint64 ids = 1; - } + message RecordIDs { repeated uint64 ids = 1; } // rewards_address is the address to distribute rewards to (bech32 encoded). string rewards_address = 1; @@ -89,20 +87,23 @@ message MsgSetFlatFee { // MsgSetFlatFeeResponse is the response for Msg.SetFlatFee. message MsgSetFlatFeeResponse {} - // MsgUpdateParams is the Msg/UpdateParams request type. // // Since: archway v5 && cosmos-sdk 0.47 message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; - // authority is the address that controls the module (defaults to x/gov unless overwritten). + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). string authority = 1; // params defines the x/rewards parameters to update. // // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "params,omitempty"]; + Params params = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "params,omitempty" + ]; } // MsgUpdateParamsResponse defines the response structure for executing a diff --git a/x/callback/types/callback.pb.go b/x/callback/types/callback.pb.go index 38f8ceee..1c1a6fa7 100644 --- a/x/callback/types/callback.pb.go +++ b/x/callback/types/callback.pb.go @@ -29,17 +29,21 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Callback defines the callback structure. type Callback struct { - // contract_address is the address of the contract which is requesting the callback (bech32 encoded). + // contract_address is the address of the contract which is requesting the + // callback (bech32 encoded). ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - // job_id is an identifier the callback requestor can pass in to identify the callback when it happens. + // job_id is an identifier the callback requestor can pass in to identify the + // callback when it happens. JobId uint64 `protobuf:"varint,2,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` // callback_height is the height at which the callback is executed. CallbackHeight int64 `protobuf:"varint,3,opt,name=callback_height,json=callbackHeight,proto3" json:"callback_height,omitempty"` - // fee_split is the breakdown of the fees paid by the contract to reserve the callback + // fee_split is the breakdown of the fees paid by the contract to reserve the + // callback FeeSplit *CallbackFeesFeeSplit `protobuf:"bytes,4,opt,name=fee_split,json=feeSplit,proto3" json:"fee_split,omitempty"` // reserved_by is the address which reserved the callback (bech32 encoded). ReservedBy string `protobuf:"bytes,5,opt,name=reserved_by,json=reservedBy,proto3" json:"reserved_by,omitempty"` - // callback_gas_limit is the maximum gas that can be consumed by this callback. + // callback_gas_limit is the maximum gas that can be consumed by this + // callback. MaxGasLimit uint64 `protobuf:"varint,6,opt,name=max_gas_limit,json=maxGasLimit,proto3" json:"max_gas_limit,omitempty"` } @@ -118,15 +122,20 @@ func (m *Callback) GetMaxGasLimit() uint64 { return 0 } -// CallbackFeesFeeSplit is the breakdown of all the fees that need to be paid by the contract to reserve a callback +// CallbackFeesFeeSplit is the breakdown of all the fees that need to be paid by +// the contract to reserve a callback type CallbackFeesFeeSplit struct { - // transaction_fees is the transaction fees for the callback based on its gas consumption + // transaction_fees is the transaction fees for the callback based on its gas + // consumption TransactionFees *types.Coin `protobuf:"bytes,1,opt,name=transaction_fees,json=transactionFees,proto3" json:"transaction_fees,omitempty"` - // block_reservation_fees is the block reservation fees portion of the callback reservation fees + // block_reservation_fees is the block reservation fees portion of the + // callback reservation fees BlockReservationFees *types.Coin `protobuf:"bytes,2,opt,name=block_reservation_fees,json=blockReservationFees,proto3" json:"block_reservation_fees,omitempty"` - // future_reservation_fees is the future reservation fees portion of the callback reservation fees + // future_reservation_fees is the future reservation fees portion of the + // callback reservation fees FutureReservationFees *types.Coin `protobuf:"bytes,3,opt,name=future_reservation_fees,json=futureReservationFees,proto3" json:"future_reservation_fees,omitempty"` - // surplus_fees is any extra fees passed in for the registration of the callback + // surplus_fees is any extra fees passed in for the registration of the + // callback SurplusFees *types.Coin `protobuf:"bytes,4,opt,name=surplus_fees,json=surplusFees,proto3" json:"surplus_fees,omitempty"` } @@ -195,13 +204,17 @@ func (m *CallbackFeesFeeSplit) GetSurplusFees() *types.Coin { type Params struct { // callback_gas_limit is the maximum gas that can be consumed by a callback. CallbackGasLimit uint64 `protobuf:"varint,1,opt,name=callback_gas_limit,json=callbackGasLimit,proto3" json:"callback_gas_limit,omitempty"` - // max_block_reservation_limit is the maximum number of callbacks which can be registered in a given block. + // max_block_reservation_limit is the maximum number of callbacks which can be + // registered in a given block. MaxBlockReservationLimit uint64 `protobuf:"varint,2,opt,name=max_block_reservation_limit,json=maxBlockReservationLimit,proto3" json:"max_block_reservation_limit,omitempty"` - // max_future_reservation_limit is the maximum number of blocks in the future that a contract can request a callback in. + // max_future_reservation_limit is the maximum number of blocks in the future + // that a contract can request a callback in. MaxFutureReservationLimit uint64 `protobuf:"varint,3,opt,name=max_future_reservation_limit,json=maxFutureReservationLimit,proto3" json:"max_future_reservation_limit,omitempty"` - // block_reservation_fee_multiplier is used to calculate a part of the reservation fees which will need to be paid when requesting the callback. + // block_reservation_fee_multiplier is used to calculate a part of the + // reservation fees which will need to be paid when requesting the callback. BlockReservationFeeMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=block_reservation_fee_multiplier,json=blockReservationFeeMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"block_reservation_fee_multiplier"` - // future_reservation_fee_multiplier is used to calculate a part of the reservation fees which will need to be paid while requesting the callback. + // future_reservation_fee_multiplier is used to calculate a part of the + // reservation fees which will need to be paid while requesting the callback. FutureReservationFeeMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=future_reservation_fee_multiplier,json=futureReservationFeeMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"future_reservation_fee_multiplier"` } diff --git a/x/callback/types/errors.pb.go b/x/callback/types/errors.pb.go index 460b6385..92baa1e2 100644 --- a/x/callback/types/errors.pb.go +++ b/x/callback/types/errors.pb.go @@ -27,9 +27,11 @@ type ModuleErrors int32 const ( // ERR_UNKNOWN is the default error code ModuleErrors_ERR_UNKNOWN ModuleErrors = 0 - // ERR_OUT_OF_GAS is the error code when the contract callback exceeds the gas limit allowed by the module + // ERR_OUT_OF_GAS is the error code when the contract callback exceeds the gas + // limit allowed by the module ModuleErrors_ERR_OUT_OF_GAS ModuleErrors = 1 - // ERR_CONTRACT_EXECUTION_FAILED is the error code when the contract callback execution fails + // ERR_CONTRACT_EXECUTION_FAILED is the error code when the contract callback + // execution fails ModuleErrors_ERR_CONTRACT_EXECUTION_FAILED ModuleErrors = 2 ) diff --git a/x/callback/types/events.pb.go b/x/callback/types/events.pb.go index 5dd882b2..1424fdb1 100644 --- a/x/callback/types/events.pb.go +++ b/x/callback/types/events.pb.go @@ -27,13 +27,15 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // CallbackRegisteredEvent is emitted when a callback is registered. type CallbackRegisteredEvent struct { - // contract_address is the address of the contract for which callback is being registered (bech32 encoded). + // contract_address is the address of the contract for which callback is being + // registered (bech32 encoded). ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` // job_id is an identifier of the callback. JobId uint64 `protobuf:"varint,2,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` // callback_height is the height at which the callback is executed. CallbackHeight int64 `protobuf:"varint,3,opt,name=callback_height,json=callbackHeight,proto3" json:"callback_height,omitempty"` - // fee_split is the breakdown of the fees paid by the contract to reserve the callback + // fee_split is the breakdown of the fees paid by the contract to reserve the + // callback FeeSplit *CallbackFeesFeeSplit `protobuf:"bytes,4,opt,name=fee_split,json=feeSplit,proto3" json:"fee_split,omitempty"` // reserved_by is the address which reserved the callback (bech32 encoded). ReservedBy string `protobuf:"bytes,5,opt,name=reserved_by,json=reservedBy,proto3" json:"reserved_by,omitempty"` @@ -109,13 +111,16 @@ func (m *CallbackRegisteredEvent) GetReservedBy() string { // CallbackCancelledEvent is emitted when a callback is cancelled. type CallbackCancelledEvent struct { - // cancelled_by is the address of the contract whose callback is being cancelled (bech32 encoded) + // cancelled_by is the address of the contract whose callback is being + // cancelled (bech32 encoded) CancelledBy string `protobuf:"bytes,1,opt,name=cancelled_by,json=cancelledBy,proto3" json:"cancelled_by,omitempty"` // contract_address is the address of the contract (bech32 encoded) ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - // job_id is an identifier the callback requestor had passed during registration of the callback + // job_id is an identifier the callback requestor had passed during + // registration of the callback JobId uint64 `protobuf:"varint,3,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` - // callback_height is the height at which the callback requestor had registered the callback + // callback_height is the height at which the callback requestor had + // registered the callback CallbackHeight int64 `protobuf:"varint,4,opt,name=callback_height,json=callbackHeight,proto3" json:"callback_height,omitempty"` // refund_amount is the amount of fees which was refunded on cancellation RefundAmount types.Coin `protobuf:"bytes,5,opt,name=refund_amount,json=refundAmount,proto3" json:"refund_amount"` @@ -189,9 +194,11 @@ func (m *CallbackCancelledEvent) GetRefundAmount() types.Coin { return types.Coin{} } -// CallbackExecutedSuccessEvent is emitted when a callback is executed successfully. +// CallbackExecutedSuccessEvent is emitted when a callback is executed +// successfully. type CallbackExecutedSuccessEvent struct { - // contract_address is the address of the contract for which callback is being executed (bech32 encoded). + // contract_address is the address of the contract for which callback is being + // executed (bech32 encoded). ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` // job_id is an identifier of the callback. JobId uint64 `protobuf:"varint,2,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` @@ -264,7 +271,8 @@ func (m *CallbackExecutedSuccessEvent) GetGasUsed() uint64 { // CallbackExecutedFailedEvent is emitted when a callback execution fails. type CallbackExecutedFailedEvent struct { - // contract_address is the address of the contract for which callback is being executed (bech32 encoded). + // contract_address is the address of the contract for which callback is being + // executed (bech32 encoded). ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` // job_id is an identifier of the callback. JobId uint64 `protobuf:"varint,2,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` diff --git a/x/callback/types/query.pb.go b/x/callback/types/query.pb.go index 252d1979..c8b53e91 100644 --- a/x/callback/types/query.pb.go +++ b/x/callback/types/query.pb.go @@ -113,7 +113,8 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -// QueryEstimateCallbackFeesRequest is the request for Query.EstimateCallbackFees. +// QueryEstimateCallbackFeesRequest is the request for +// Query.EstimateCallbackFees. type QueryEstimateCallbackFeesRequest struct { // block_height is the height at which to estimate the callback fees BlockHeight int64 `protobuf:"varint,1,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` @@ -159,9 +160,11 @@ func (m *QueryEstimateCallbackFeesRequest) GetBlockHeight() int64 { return 0 } -// QueryEstimateCallbackFeesResponse is the response for Query.EstimateCallbackFees. +// QueryEstimateCallbackFeesResponse is the response for +// Query.EstimateCallbackFees. type QueryEstimateCallbackFeesResponse struct { - // total_fees is the total fees that needs to be paid by the contract to reserve a callback + // total_fees is the total fees that needs to be paid by the contract to + // reserve a callback TotalFees *types.Coin `protobuf:"bytes,1,opt,name=total_fees,json=totalFees,proto3" json:"total_fees,omitempty"` // fee_split is the breakdown of the total_fees FeeSplit *CallbackFeesFeeSplit `protobuf:"bytes,2,opt,name=fee_split,json=feeSplit,proto3" json:"fee_split,omitempty"` @@ -369,7 +372,8 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Params returns module parameters Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // EstimateCallbackFees returns the total amount of callback fees a contract needs to pay to register the callback + // EstimateCallbackFees returns the total amount of callback fees a contract + // needs to pay to register the callback EstimateCallbackFees(ctx context.Context, in *QueryEstimateCallbackFeesRequest, opts ...grpc.CallOption) (*QueryEstimateCallbackFeesResponse, error) // Callbacks returns all the callbacks registered at a given height Callbacks(ctx context.Context, in *QueryCallbacksRequest, opts ...grpc.CallOption) (*QueryCallbacksResponse, error) @@ -414,7 +418,8 @@ func (c *queryClient) Callbacks(ctx context.Context, in *QueryCallbacksRequest, type QueryServer interface { // Params returns module parameters Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // EstimateCallbackFees returns the total amount of callback fees a contract needs to pay to register the callback + // EstimateCallbackFees returns the total amount of callback fees a contract + // needs to pay to register the callback EstimateCallbackFees(context.Context, *QueryEstimateCallbackFeesRequest) (*QueryEstimateCallbackFeesResponse, error) // Callbacks returns all the callbacks registered at a given height Callbacks(context.Context, *QueryCallbacksRequest) (*QueryCallbacksResponse, error) diff --git a/x/callback/types/tx.pb.go b/x/callback/types/tx.pb.go index 9594bb84..f14e66da 100644 --- a/x/callback/types/tx.pb.go +++ b/x/callback/types/tx.pb.go @@ -32,7 +32,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgUpdateParams is the Msg/UpdateParams request type. type MsgUpdateParams struct { - // authority is the address that controls the module (defaults to x/gov unless overwritten). + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // params defines the x/callback parameters to update. // @@ -87,7 +88,8 @@ func (m *MsgUpdateParams) GetParams() Params { return Params{} } -// MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. type MsgUpdateParamsResponse struct { } @@ -128,9 +130,11 @@ var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo type MsgRequestCallback struct { // sender is the address who is requesting the callback (bech32 encoded) Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // contract_address is the address of the contract which is requesting the callback (bech32 encoded) + // contract_address is the address of the contract which is requesting the + // callback (bech32 encoded) ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - // job_id is an identifier the callback requestor can pass in to identify the callback when it happens + // job_id is an identifier the callback requestor can pass in to identify the + // callback when it happens JobId uint64 `protobuf:"varint,3,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` // callback_height is the height at which the callback is executed. CallbackHeight int64 `protobuf:"varint,4,opt,name=callback_height,json=callbackHeight,proto3" json:"callback_height,omitempty"` @@ -206,7 +210,8 @@ func (m *MsgRequestCallback) GetFees() types.Coin { return types.Coin{} } -// MsgRequestCallbackResponse defines the response structure for executing a MsgRequestCallback message. +// MsgRequestCallbackResponse defines the response structure for executing a +// MsgRequestCallback message. type MsgRequestCallbackResponse struct { } @@ -245,13 +250,16 @@ var xxx_messageInfo_MsgRequestCallbackResponse proto.InternalMessageInfo // MsgCancelCallback is the Msg/CancelCallback request type. type MsgCancelCallback struct { - // sender is the address of the contract which is cancelling the callback (bech32 encoded) + // sender is the address of the contract which is cancelling the callback + // (bech32 encoded) Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // contract_address is the address of the contract (bech32 encoded) ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - // job_id is an identifier the callback requestor had passed during registration of the callback + // job_id is an identifier the callback requestor had passed during + // registration of the callback JobId uint64 `protobuf:"varint,3,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` - // callback_height is the height at which the callback requestor had registered the callback + // callback_height is the height at which the callback requestor had + // registered the callback CallbackHeight int64 `protobuf:"varint,4,opt,name=callback_height,json=callbackHeight,proto3" json:"callback_height,omitempty"` } @@ -316,9 +324,11 @@ func (m *MsgCancelCallback) GetCallbackHeight() int64 { return 0 } -// MsgCancelCallbackResponse defines the response structure for executing a MsgCancelCallback message. +// MsgCancelCallbackResponse defines the response structure for executing a +// MsgCancelCallback message. type MsgCancelCallbackResponse struct { - // refund is the amount of fees being refunded due to the cancellation of the callback + // refund is the amount of fees being refunded due to the cancellation of the + // callback Refund types.Coin `protobuf:"bytes,1,opt,name=refund,proto3" json:"refund"` } @@ -427,7 +437,8 @@ type MsgClient interface { // UpdateParams defines a governance operation for updating the x/callback // module parameters. The authority is defined in the keeper. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) - // RequestCallback defines a message for registering a callback at a specific height by a given contract + // RequestCallback defines a message for registering a callback at a specific + // height by a given contract RequestCallback(ctx context.Context, in *MsgRequestCallback, opts ...grpc.CallOption) (*MsgRequestCallbackResponse, error) // CancelCallback defines a message for cancelling an existing callback CancelCallback(ctx context.Context, in *MsgCancelCallback, opts ...grpc.CallOption) (*MsgCancelCallbackResponse, error) @@ -473,7 +484,8 @@ type MsgServer interface { // UpdateParams defines a governance operation for updating the x/callback // module parameters. The authority is defined in the keeper. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) - // RequestCallback defines a message for registering a callback at a specific height by a given contract + // RequestCallback defines a message for registering a callback at a specific + // height by a given contract RequestCallback(context.Context, *MsgRequestCallback) (*MsgRequestCallbackResponse, error) // CancelCallback defines a message for cancelling an existing callback CancelCallback(context.Context, *MsgCancelCallback) (*MsgCancelCallbackResponse, error) diff --git a/x/cwerrors/types/cwerrors.pb.go b/x/cwerrors/types/cwerrors.pb.go index 359a6f93..f92691aa 100644 --- a/x/cwerrors/types/cwerrors.pb.go +++ b/x/cwerrors/types/cwerrors.pb.go @@ -29,7 +29,8 @@ type ModuleErrors int32 const ( // ERR_UNKNOWN is the default error code ModuleErrors_ERR_UNKNOWN ModuleErrors = 0 - // ERR_CALLBACK_EXECUTION_FAILED is the error code for when the error callback fails + // ERR_CALLBACK_EXECUTION_FAILED is the error code for when the error callback + // fails ModuleErrors_ERR_CALLBACK_EXECUTION_FAILED ModuleErrors = 1 ) diff --git a/x/cwfees/types/cwfees.pb.go b/x/cwfees/types/cwfees.pb.go index c6dcb0dc..0ba745d8 100644 --- a/x/cwfees/types/cwfees.pb.go +++ b/x/cwfees/types/cwfees.pb.go @@ -111,7 +111,8 @@ func (m *MsgRegisterAsGranterResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRegisterAsGranterResponse proto.InternalMessageInfo -// MsgUnregisterAsGranter can be used by a cosmwasm contract to unregister itself as a fee granter. +// MsgUnregisterAsGranter can be used by a cosmwasm contract to unregister +// itself as a fee granter. type MsgUnregisterAsGranter struct { GrantingContract string `protobuf:"bytes,1,opt,name=granting_contract,json=grantingContract,proto3" json:"granting_contract,omitempty"` } @@ -387,9 +388,11 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // RegisterAsGranter allows a cosmwasm contract to register itself as a fee granter. + // RegisterAsGranter allows a cosmwasm contract to register itself as a fee + // granter. RegisterAsGranter(ctx context.Context, in *MsgRegisterAsGranter, opts ...grpc.CallOption) (*MsgRegisterAsGranterResponse, error) - // UnregisterAsGranter allows a cosmwasm contract to unregister itself as a fee granter. + // UnregisterAsGranter allows a cosmwasm contract to unregister itself as a + // fee granter. UnregisterAsGranter(ctx context.Context, in *MsgUnregisterAsGranter, opts ...grpc.CallOption) (*MsgUnregisterAsGranterResponse, error) } @@ -421,9 +424,11 @@ func (c *msgClient) UnregisterAsGranter(ctx context.Context, in *MsgUnregisterAs // MsgServer is the server API for Msg service. type MsgServer interface { - // RegisterAsGranter allows a cosmwasm contract to register itself as a fee granter. + // RegisterAsGranter allows a cosmwasm contract to register itself as a fee + // granter. RegisterAsGranter(context.Context, *MsgRegisterAsGranter) (*MsgRegisterAsGranterResponse, error) - // UnregisterAsGranter allows a cosmwasm contract to unregister itself as a fee granter. + // UnregisterAsGranter allows a cosmwasm contract to unregister itself as a + // fee granter. UnregisterAsGranter(context.Context, *MsgUnregisterAsGranter) (*MsgUnregisterAsGranterResponse, error) } @@ -499,7 +504,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // IsGrantingContract can be used to check if a contract is a granting contract. + // IsGrantingContract can be used to check if a contract is a granting + // contract. IsGrantingContract(ctx context.Context, in *IsGrantingContractRequest, opts ...grpc.CallOption) (*IsGrantingContractResponse, error) } @@ -522,7 +528,8 @@ func (c *queryClient) IsGrantingContract(ctx context.Context, in *IsGrantingCont // QueryServer is the server API for Query service. type QueryServer interface { - // IsGrantingContract can be used to check if a contract is a granting contract. + // IsGrantingContract can be used to check if a contract is a granting + // contract. IsGrantingContract(context.Context, *IsGrantingContractRequest) (*IsGrantingContractResponse, error) } diff --git a/x/genmsg/types/genmsg.pb.go b/x/genmsg/types/genmsg.pb.go index 7e94afa3..2319bfce 100644 --- a/x/genmsg/types/genmsg.pb.go +++ b/x/genmsg/types/genmsg.pb.go @@ -23,7 +23,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GenesisState represents the messages to be processed during genesis by the genmsg module. +// GenesisState represents the messages to be processed during genesis by the +// genmsg module. type GenesisState struct { Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` } diff --git a/x/rewards/types/events.pb.go b/x/rewards/types/events.pb.go index 7f38d842..4ad8eb3e 100644 --- a/x/rewards/types/events.pb.go +++ b/x/rewards/types/events.pb.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: archway/rewards/v1/events.proto diff --git a/x/rewards/types/genesis.pb.go b/x/rewards/types/genesis.pb.go index 21fe8bb6..d88ba053 100644 --- a/x/rewards/types/genesis.pb.go +++ b/x/rewards/types/genesis.pb.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: archway/rewards/v1/genesis.proto diff --git a/x/rewards/types/query.pb.go b/x/rewards/types/query.pb.go index f61c4cd2..f2f58a9f 100644 --- a/x/rewards/types/query.pb.go +++ b/x/rewards/types/query.pb.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: archway/rewards/v1/query.proto diff --git a/x/rewards/types/query.pb.gw.go b/x/rewards/types/query.pb.gw.go index c2869094..cf4bea30 100644 --- a/x/rewards/types/query.pb.gw.go +++ b/x/rewards/types/query.pb.gw.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: archway/rewards/v1/query.proto diff --git a/x/rewards/types/rewards.pb.go b/x/rewards/types/rewards.pb.go index b5c30b57..fbf6a709 100644 --- a/x/rewards/types/rewards.pb.go +++ b/x/rewards/types/rewards.pb.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: archway/rewards/v1/rewards.proto diff --git a/x/rewards/types/tx.pb.go b/x/rewards/types/tx.pb.go index a66c37b0..328cf953 100644 --- a/x/rewards/types/tx.pb.go +++ b/x/rewards/types/tx.pb.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: archway/rewards/v1/tx.proto @@ -468,7 +469,8 @@ var xxx_messageInfo_MsgSetFlatFeeResponse proto.InternalMessageInfo // // Since: archway v5 && cosmos-sdk 0.47 type MsgUpdateParams struct { - // authority is the address that controls the module (defaults to x/gov unless overwritten). + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // params defines the x/rewards parameters to update. // diff --git a/x/tracking/types/genesis.pb.go b/x/tracking/types/genesis.pb.go index 6b57e5f9..ae8b10b9 100644 --- a/x/tracking/types/genesis.pb.go +++ b/x/tracking/types/genesis.pb.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: archway/tracking/v1/genesis.proto diff --git a/x/tracking/types/query.pb.go b/x/tracking/types/query.pb.go index 9f83ae5b..fa952624 100644 --- a/x/tracking/types/query.pb.go +++ b/x/tracking/types/query.pb.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: archway/tracking/v1/query.proto diff --git a/x/tracking/types/query.pb.gw.go b/x/tracking/types/query.pb.gw.go index 04c2314d..9e3d0c67 100644 --- a/x/tracking/types/query.pb.gw.go +++ b/x/tracking/types/query.pb.gw.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. // source: archway/tracking/v1/query.proto diff --git a/x/tracking/types/tracking.pb.go b/x/tracking/types/tracking.pb.go index 099528cb..21976757 100644 --- a/x/tracking/types/tracking.pb.go +++ b/x/tracking/types/tracking.pb.go @@ -1,3 +1,4 @@ +// DONTCOVER // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: archway/tracking/v1/tracking.proto From 262d2f69969c3345fe98145832f5124968ae9d2b Mon Sep 17 00:00:00 2001 From: pyncz Date: Mon, 18 Nov 2024 21:46:46 +0300 Subject: [PATCH 3/7] fix(x/oracle): update types --- x/oracle/genesis_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index 0b4ef402..64c60a96 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -2,6 +2,7 @@ package oracle_test import ( "testing" + "time" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -27,7 +28,7 @@ func TestExportInitGenesis(t *testing.T) { keepers.OracleKeeper.Params.Set(ctx, types.DefaultParams()) keepers.OracleKeeper.FeederDelegations.Set(ctx, ValAddrs[0], AccAddrs[1]) - keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreationHeight: 0, CreationTime: 0}) + keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreationHeight: 0, CreationTime: time.Time{}}) keepers.OracleKeeper.Prevotes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, ValAddrs[0], uint64(2))) keepers.OracleKeeper.Votes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Pair: "foo", ExchangeRate: math.LegacyNewDec(123)}}, ValAddrs[0])) keepers.OracleKeeper.WhitelistedPairs.Set(ctx, "pair1:pair1") From 2015aeaa9d1c1f9c469a2d26b2fae628378a3129 Mon Sep 17 00:00:00 2001 From: pyncz Date: Mon, 18 Nov 2024 22:07:17 +0300 Subject: [PATCH 4/7] refactor(x/oracle): use `uint64` for `CreationTime` --- proto/archway/oracle/v1/oracle.proto | 14 +-- x/oracle/genesis_test.go | 3 +- x/oracle/keeper/keeper.go | 2 +- x/oracle/keeper/querier_test.go | 12 +- x/oracle/types/oracle.pb.go | 178 ++++++++++++--------------- 5 files changed, 95 insertions(+), 114 deletions(-) diff --git a/proto/archway/oracle/v1/oracle.proto b/proto/archway/oracle/v1/oracle.proto index 170643a7..4ef64eb5 100644 --- a/proto/archway/oracle/v1/oracle.proto +++ b/proto/archway/oracle/v1/oracle.proto @@ -3,7 +3,6 @@ package archway.oracle.v1; import "gogoproto/gogo.proto"; import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/archway-network/archway/x/oracle/types"; @@ -139,14 +138,13 @@ message DatedPrice { (gogoproto.nullable) = false ]; + /// creation_height defines the block height when price record was created int64 creation_height = 2 - [ (gogoproto.moretags) = "yaml:\"creation_height\"" ]; - - google.protobuf.Timestamp creation_time = 3 [ - (gogoproto.moretags) = "yaml:\"creation_time\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; + [ (gogoproto.moretags) = "yaml:\"creation_height\"" ]; + + /// creation_time defines the block time when price record was created + uint64 creation_time = 3 + [ (gogoproto.moretags) = "yaml:\"creation_time\"" ]; } // Rewards defines a credit object towards validators diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index 64c60a96..0b4ef402 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -2,7 +2,6 @@ package oracle_test import ( "testing" - "time" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,7 +27,7 @@ func TestExportInitGenesis(t *testing.T) { keepers.OracleKeeper.Params.Set(ctx, types.DefaultParams()) keepers.OracleKeeper.FeederDelegations.Set(ctx, ValAddrs[0], AccAddrs[1]) - keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreationHeight: 0, CreationTime: time.Time{}}) + keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreationHeight: 0, CreationTime: 0}) keepers.OracleKeeper.Prevotes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, ValAddrs[0], uint64(2))) keepers.OracleKeeper.Votes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Pair: "foo", ExchangeRate: math.LegacyNewDec(123)}}, ValAddrs[0])) keepers.OracleKeeper.WhitelistedPairs.Set(ctx, "pair1:pair1") diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index bc050a4b..0746642d 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -209,7 +209,7 @@ func (k Keeper) SetPrice(ctx sdk.Context, pair asset.Pair, price math.LegacyDec) k.ExchangeRates.Set(ctx, pair, types.DatedPrice{ ExchangeRate: price, CreationHeight: ctx.BlockHeight(), - CreationTime: ctx.BlockTime(), + CreationTime: uint64(ctx.BlockTime().UnixMilli()), }) key := collections.Join(pair, ctx.BlockTime()) diff --git a/x/oracle/keeper/querier_test.go b/x/oracle/keeper/querier_test.go index f4f6f882..bbb7fbf6 100644 --- a/x/oracle/keeper/querier_test.go +++ b/x/oracle/keeper/querier_test.go @@ -41,7 +41,7 @@ func TestQueryExchangeRate(t *testing.T) { keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), - CreationTime: ctx.BlockTime(), + CreationTime: uint64(ctx.BlockTime().UnixMilli()), }) // empty request @@ -93,12 +93,12 @@ func TestQueryExchangeRates(t *testing.T) { keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), - CreationTime: ctx.BlockTime(), + CreationTime: uint64(ctx.BlockTime().UnixMilli()), }) keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), - CreationTime: ctx.BlockTime(), + CreationTime: uint64(ctx.BlockTime().UnixMilli()), }) res, err := querier.ExchangeRates(ctx, &types.QueryExchangeRatesRequest{}) @@ -234,17 +234,17 @@ func TestQueryActives(t *testing.T) { keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), - CreationTime: ctx.BlockTime(), + CreationTime: uint64(ctx.BlockTime().UnixMilli()), }) keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), - CreationTime: ctx.BlockTime(), + CreationTime: uint64(ctx.BlockTime().UnixMilli()), }) keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), - CreationTime: ctx.BlockTime(), + CreationTime: uint64(ctx.BlockTime().UnixMilli()), }) res, err := queryClient.Actives(ctx, &types.QueryActivesRequest{}) diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index dfdff25f..d10dd903 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -12,7 +12,6 @@ import ( proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/durationpb" - _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" @@ -262,9 +261,11 @@ func (m *ExchangeRateTuple) XXX_DiscardUnknown() { var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo type DatedPrice struct { - ExchangeRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"exchange_rate" yaml:"exchange_rate"` - CreationHeight int64 `protobuf:"varint,2,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` - CreationTime time.Time `protobuf:"bytes,3,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + ExchangeRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"exchange_rate" yaml:"exchange_rate"` + // / creation_height defines the block height when price record was created + CreationHeight int64 `protobuf:"varint,2,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` + // / creation_time defines the block time when price record was created + CreationTime uint64 `protobuf:"varint,3,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty" yaml:"creation_time"` } func (m *DatedPrice) Reset() { *m = DatedPrice{} } @@ -307,11 +308,11 @@ func (m *DatedPrice) GetCreationHeight() int64 { return 0 } -func (m *DatedPrice) GetCreationTime() time.Time { +func (m *DatedPrice) GetCreationTime() uint64 { if m != nil { return m.CreationTime } - return time.Time{} + return 0 } // Rewards defines a credit object towards validators @@ -392,71 +393,70 @@ func init() { func init() { proto.RegisterFile("archway/oracle/v1/oracle.proto", fileDescriptor_ceb632d7c2facf1a) } var fileDescriptor_ceb632d7c2facf1a = []byte{ - // 1021 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x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9, 0x45, 0x8d, 0xe7, 0x58, 0x0f, 0xbe, 0x0b, 0x96, 0x0b, - 0x4b, 0x5a, 0x1a, 0xfe, 0x65, 0x5c, 0x9d, 0xac, 0x6a, 0x09, 0x3f, 0x05, 0x0b, 0x7a, 0xfb, 0x4b, - 0x77, 0xde, 0x4c, 0xfc, 0xba, 0x9f, 0x17, 0xce, 0xd7, 0xff, 0x07, 0xbe, 0xfd, 0x3f, 0xf0, 0x1f, - 0x70, 0xd6, 0x0f, 0xca, 0x9a, 0x17, 0xce, 0xbd, 0x83, 0x6f, 0x9f, 0x9f, 0x35, 0x9c, 0x17, 0x67, - 0x0d, 0xe7, 0xef, 0xb3, 0x86, 0xf3, 0xf4, 0xbc, 0x51, 0x7a, 0x71, 0xde, 0x28, 0xfd, 0x75, 0xde, - 0x28, 0x3d, 0xd9, 0xfa, 0x3f, 0x03, 0xa6, 0x4e, 0x06, 0x54, 0x76, 0x17, 0x4d, 0x15, 0x3e, 0xfe, - 0x2f, 0x00, 0x00, 0xff, 0xff, 0x07, 0x99, 0xbb, 0x17, 0x26, 0x09, 0x00, 0x00, + // 996 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0x1b, 0xc5, + 0x1b, 0xf6, 0x26, 0x4e, 0x1a, 0x8f, 0x93, 0x34, 0x9e, 0xa6, 0xfd, 0x6d, 0xd2, 0xca, 0x9b, 0xdf, + 0x80, 0x50, 0x0e, 0xb0, 0x56, 0xca, 0x3f, 0x11, 0xe0, 0xd0, 0x6d, 0xa8, 0xa8, 0x28, 0xc8, 0x1a, + 0x45, 0x20, 0xf5, 0x62, 0xc6, 0xbb, 0x93, 0xdd, 0x51, 0x76, 0x3d, 0x66, 0x66, 0x12, 0x27, 0xdf, + 0x80, 0x23, 0x5c, 0x10, 0xdc, 0x72, 0xe6, 0xc6, 0xb7, 0xe8, 0xb1, 0x47, 0x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 0x3b, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xb4, 0x21, 0x70, + 0xe1, 0x08, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -782,14 +782,11 @@ func (m *DatedPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreationTime):]) - if err2 != nil { - return 0, err2 + if m.CreationTime != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.CreationTime)) + i-- + dAtA[i] = 0x18 } - i -= n2 - i = encodeVarintOracle(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x1a if m.CreationHeight != 0 { i = encodeVarintOracle(dAtA, i, uint64(m.CreationHeight)) i-- @@ -968,8 +965,9 @@ func (m *DatedPrice) Size() (n int) { if m.CreationHeight != 0 { n += 1 + sovOracle(uint64(m.CreationHeight)) } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreationTime) - n += 1 + l + sovOracle(uint64(l)) + if m.CreationTime != 0 { + n += 1 + sovOracle(uint64(m.CreationTime)) + } return n } @@ -1815,10 +1813,10 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { } } case 3: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) } - var msglen int + m.CreationTime = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOracle @@ -1828,25 +1826,11 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.CreationTime |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthOracle - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipOracle(dAtA[iNdEx:]) From d65f5bb4d4a7359a20f552f22e10c497bd9a88b5 Mon Sep 17 00:00:00 2001 From: pyncz Date: Tue, 19 Nov 2024 16:11:05 +0300 Subject: [PATCH 5/7] refactor(x/oracle): handle errors --- x/oracle/genesis_test.go | 24 ++++++++++++++---------- x/oracle/keeper/keeper.go | 12 ++++++++---- x/oracle/keeper/querier_test.go | 27 +++++++++++++++------------ 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index 0b4ef402..1e81cdb2 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -25,19 +25,23 @@ func TestExportInitGenesis(t *testing.T) { ValAddrs[i] = sdk.ValAddress(vals[i].Address) } - keepers.OracleKeeper.Params.Set(ctx, types.DefaultParams()) - keepers.OracleKeeper.FeederDelegations.Set(ctx, ValAddrs[0], AccAddrs[1]) - keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ExchangeRate: math.LegacyNewDec(123), CreationHeight: 0, CreationTime: 0}) - keepers.OracleKeeper.Prevotes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, ValAddrs[0], uint64(2))) - keepers.OracleKeeper.Votes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Pair: "foo", ExchangeRate: math.LegacyNewDec(123)}}, ValAddrs[0])) - keepers.OracleKeeper.WhitelistedPairs.Set(ctx, "pair1:pair1") - keepers.OracleKeeper.WhitelistedPairs.Set(ctx, "pair2:pair2") - keepers.OracleKeeper.MissCounters.Set(ctx, ValAddrs[0], 10) - keepers.OracleKeeper.Rewards.Set(ctx, 0, types.Rewards{ + require.NoError(t, keepers.OracleKeeper.Params.Set(ctx, types.DefaultParams())) + require.NoError(t, keepers.OracleKeeper.FeederDelegations.Set(ctx, ValAddrs[0], AccAddrs[1])) + require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ + ExchangeRate: math.LegacyNewDec(123), + CreationHeight: 0, + CreationTime: 0, + })) + require.NoError(t, keepers.OracleKeeper.Prevotes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, ValAddrs[0], uint64(2)))) + require.NoError(t, keepers.OracleKeeper.Votes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Pair: "foo", ExchangeRate: math.LegacyNewDec(123)}}, ValAddrs[0]))) + require.NoError(t, keepers.OracleKeeper.WhitelistedPairs.Set(ctx, "pair1:pair1")) + require.NoError(t, keepers.OracleKeeper.WhitelistedPairs.Set(ctx, "pair2:pair2")) + require.NoError(t, keepers.OracleKeeper.MissCounters.Set(ctx, ValAddrs[0], 10)) + require.NoError(t, keepers.OracleKeeper.Rewards.Set(ctx, 0, types.Rewards{ Id: 0, VotePeriods: 100, Coins: sdk.NewCoins(sdk.NewInt64Coin("test", 1000)), - }) + })) genesis := oracle.ExportGenesis(ctx, keepers.OracleKeeper) chain = e2eTesting.NewTestChain(t, 2) diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 0746642d..cbb245cb 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -206,19 +206,23 @@ func (k Keeper) GetExchangeRate(ctx sdk.Context, pair asset.Pair) (price math.Le // SetPrice sets the price for a pair as well as the price snapshot. func (k Keeper) SetPrice(ctx sdk.Context, pair asset.Pair, price math.LegacyDec) { - k.ExchangeRates.Set(ctx, pair, types.DatedPrice{ + if err := k.ExchangeRates.Set(ctx, pair, types.DatedPrice{ ExchangeRate: price, CreationHeight: ctx.BlockHeight(), CreationTime: uint64(ctx.BlockTime().UnixMilli()), - }) + }); err != nil { + ctx.Logger().Error("failed to set DatedPrice", "pair", pair, "error", err) + } key := collections.Join(pair, ctx.BlockTime()) timestampMs := ctx.BlockTime().UnixMilli() - k.PriceSnapshots.Set(ctx, key, types.PriceSnapshot{ + if err := k.PriceSnapshots.Set(ctx, key, types.PriceSnapshot{ Pair: pair, Price: price, TimestampMs: timestampMs, - }) + }); err != nil { + ctx.Logger().Error("failed to set PriceSnapshot", "pair", pair, "error", err) + } if err := ctx.EventManager().EmitTypedEvent(&types.EventPriceUpdate{ Pair: pair.String(), Price: price, diff --git a/x/oracle/keeper/querier_test.go b/x/oracle/keeper/querier_test.go index bbb7fbf6..ff8f3011 100644 --- a/x/oracle/keeper/querier_test.go +++ b/x/oracle/keeper/querier_test.go @@ -38,11 +38,11 @@ func TestQueryExchangeRate(t *testing.T) { querier := keeper.NewQuerier(keepers.OracleKeeper) rate := math.LegacyNewDec(1700) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ + require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), CreationTime: uint64(ctx.BlockTime().UnixMilli()), - }) + })) // empty request _, err := querier.ExchangeRate(ctx, nil) @@ -90,16 +90,16 @@ func TestQueryExchangeRates(t *testing.T) { querier := keeper.NewQuerier(keepers.OracleKeeper) rate := math.LegacyNewDec(1700) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ + require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), CreationTime: uint64(ctx.BlockTime().UnixMilli()), - }) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ + })) + require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), CreationTime: uint64(ctx.BlockTime().UnixMilli()), - }) + })) res, err := querier.ExchangeRates(ctx, &types.QueryExchangeRatesRequest{}) require.NoError(t, err) @@ -231,21 +231,24 @@ func TestQueryActives(t *testing.T) { queryClient := keeper.NewQuerier(keepers.OracleKeeper) rate := math.LegacyNewDec(1700) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ + + require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), CreationTime: uint64(ctx.BlockTime().UnixMilli()), - }) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), types.DatedPrice{ + })) + + require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), CreationTime: uint64(ctx.BlockTime().UnixMilli()), - }) - keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ + })) + + require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ ExchangeRate: rate, CreationHeight: ctx.BlockHeight(), CreationTime: uint64(ctx.BlockTime().UnixMilli()), - }) + })) res, err := queryClient.Actives(ctx, &types.QueryActivesRequest{}) require.NoError(t, err) From 2b01f69391f1b55e1991dc073b81c82d85d69174 Mon Sep 17 00:00:00 2001 From: pyncz Date: Wed, 20 Nov 2024 13:25:52 +0300 Subject: [PATCH 6/7] fix(x/oracle): rename `creation_time` to `creation_time_unix_ms` --- proto/archway/oracle/v1/oracle.proto | 9 +- x/oracle/genesis_test.go | 6 +- x/oracle/keeper/keeper.go | 6 +- x/oracle/keeper/querier_test.go | 36 +++---- x/oracle/types/oracle.pb.go | 154 ++++++++++++++------------- 5 files changed, 107 insertions(+), 104 deletions(-) diff --git a/proto/archway/oracle/v1/oracle.proto b/proto/archway/oracle/v1/oracle.proto index 4ef64eb5..5dd4cd14 100644 --- a/proto/archway/oracle/v1/oracle.proto +++ b/proto/archway/oracle/v1/oracle.proto @@ -138,13 +138,14 @@ message DatedPrice { (gogoproto.nullable) = false ]; - /// creation_height defines the block height when price record was created + // creation_height defines the block height when price record was created int64 creation_height = 2 [ (gogoproto.moretags) = "yaml:\"creation_height\"" ]; - /// creation_time defines the block time when price record was created - uint64 creation_time = 3 - [ (gogoproto.moretags) = "yaml:\"creation_time\"" ]; + // creation_time_unix_ms defines the block time in milliseconds since unix epoch, + // when price record was created + uint64 creation_time_unix_ms = 3 + [ (gogoproto.moretags) = "yaml:\"creation_time_unix_ms\"" ]; } // Rewards defines a credit object towards validators diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index 1e81cdb2..e5d38856 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -28,9 +28,9 @@ func TestExportInitGenesis(t *testing.T) { require.NoError(t, keepers.OracleKeeper.Params.Set(ctx, types.DefaultParams())) require.NoError(t, keepers.OracleKeeper.FeederDelegations.Set(ctx, ValAddrs[0], AccAddrs[1])) require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, "pair1:pair2", types.DatedPrice{ - ExchangeRate: math.LegacyNewDec(123), - CreationHeight: 0, - CreationTime: 0, + ExchangeRate: math.LegacyNewDec(123), + CreationHeight: 0, + CreationTimeUnixMs: 0, })) require.NoError(t, keepers.OracleKeeper.Prevotes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, ValAddrs[0], uint64(2)))) require.NoError(t, keepers.OracleKeeper.Votes.Set(ctx, ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Pair: "foo", ExchangeRate: math.LegacyNewDec(123)}}, ValAddrs[0]))) diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index cbb245cb..af87257e 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -207,9 +207,9 @@ func (k Keeper) GetExchangeRate(ctx sdk.Context, pair asset.Pair) (price math.Le // SetPrice sets the price for a pair as well as the price snapshot. func (k Keeper) SetPrice(ctx sdk.Context, pair asset.Pair, price math.LegacyDec) { if err := k.ExchangeRates.Set(ctx, pair, types.DatedPrice{ - ExchangeRate: price, - CreationHeight: ctx.BlockHeight(), - CreationTime: uint64(ctx.BlockTime().UnixMilli()), + ExchangeRate: price, + CreationHeight: ctx.BlockHeight(), + CreationTimeUnixMs: uint64(ctx.BlockTime().UnixMilli()), }); err != nil { ctx.Logger().Error("failed to set DatedPrice", "pair", pair, "error", err) } diff --git a/x/oracle/keeper/querier_test.go b/x/oracle/keeper/querier_test.go index ff8f3011..f7267b66 100644 --- a/x/oracle/keeper/querier_test.go +++ b/x/oracle/keeper/querier_test.go @@ -39,9 +39,9 @@ func TestQueryExchangeRate(t *testing.T) { rate := math.LegacyNewDec(1700) require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ - ExchangeRate: rate, - CreationHeight: ctx.BlockHeight(), - CreationTime: uint64(ctx.BlockTime().UnixMilli()), + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTimeUnixMs: uint64(ctx.BlockTime().UnixMilli()), })) // empty request @@ -91,14 +91,14 @@ func TestQueryExchangeRates(t *testing.T) { rate := math.LegacyNewDec(1700) require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ - ExchangeRate: rate, - CreationHeight: ctx.BlockHeight(), - CreationTime: uint64(ctx.BlockTime().UnixMilli()), + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTimeUnixMs: uint64(ctx.BlockTime().UnixMilli()), })) require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ - ExchangeRate: rate, - CreationHeight: ctx.BlockHeight(), - CreationTime: uint64(ctx.BlockTime().UnixMilli()), + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTimeUnixMs: uint64(ctx.BlockTime().UnixMilli()), })) res, err := querier.ExchangeRates(ctx, &types.QueryExchangeRatesRequest{}) @@ -233,21 +233,21 @@ func TestQueryActives(t *testing.T) { rate := math.LegacyNewDec(1700) require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), types.DatedPrice{ - ExchangeRate: rate, - CreationHeight: ctx.BlockHeight(), - CreationTime: uint64(ctx.BlockTime().UnixMilli()), + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTimeUnixMs: uint64(ctx.BlockTime().UnixMilli()), })) require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), types.DatedPrice{ - ExchangeRate: rate, - CreationHeight: ctx.BlockHeight(), - CreationTime: uint64(ctx.BlockTime().UnixMilli()), + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTimeUnixMs: uint64(ctx.BlockTime().UnixMilli()), })) require.NoError(t, keepers.OracleKeeper.ExchangeRates.Set(ctx, asset.Registry.Pair(denoms.ETH, denoms.NUSD), types.DatedPrice{ - ExchangeRate: rate, - CreationHeight: ctx.BlockHeight(), - CreationTime: uint64(ctx.BlockTime().UnixMilli()), + ExchangeRate: rate, + CreationHeight: ctx.BlockHeight(), + CreationTimeUnixMs: uint64(ctx.BlockTime().UnixMilli()), })) res, err := queryClient.Actives(ctx, &types.QueryActivesRequest{}) diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index d10dd903..085d4bf3 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -262,10 +262,11 @@ var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo type DatedPrice struct { ExchangeRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"exchange_rate" yaml:"exchange_rate"` - // / creation_height defines the block height when price record was created + // creation_height defines the block height when price record was created CreationHeight int64 `protobuf:"varint,2,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` - // / creation_time defines the block time when price record was created - CreationTime uint64 `protobuf:"varint,3,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty" yaml:"creation_time"` + // creation_time_unix_ms defines the block time in milliseconds since unix epoch, + // when price record was created + CreationTimeUnixMs uint64 `protobuf:"varint,3,opt,name=creation_time_unix_ms,json=creationTimeUnixMs,proto3" json:"creation_time_unix_ms,omitempty" yaml:"creation_time_unix_ms"` } func (m *DatedPrice) Reset() { *m = DatedPrice{} } @@ -308,9 +309,9 @@ func (m *DatedPrice) GetCreationHeight() int64 { return 0 } -func (m *DatedPrice) GetCreationTime() uint64 { +func (m *DatedPrice) GetCreationTimeUnixMs() uint64 { if m != nil { - return m.CreationTime + return m.CreationTimeUnixMs } return 0 } @@ -393,70 +394,71 @@ func init() { func init() { proto.RegisterFile("archway/oracle/v1/oracle.proto", fileDescriptor_ceb632d7c2facf1a) } var fileDescriptor_ceb632d7c2facf1a = []byte{ - // 996 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0x1b, 0xc5, - 0x1b, 0xf6, 0x26, 0x4e, 0x1a,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 0x77, 0x8a, 0xdc, 0x83, 0xa7, - 0x24, 0x4b, 0x77, 0x51, 0x05, 0x44, 0x18, 0x68, 0xab, 0x6b, 0x0c, 0x18, 0x82, 0x55, 0x83, 0xa9, - 0x44, 0x50, 0x99, 0xf0, 0x34, 0x72, 0xe7, 0xb6, 0x9c, 0xed, 0x46, 0xf0, 0xc9, 0xb3, 0xdc, 0xab, - 0xbd, 0xc8, 0xbd, 0xbb, 0xa5, 0x06, 0x19, 0x1d, 0xfa, 0x8c, 0x77, 0x32, 0xa2, 0x12, 0xff, 0x09, - 0x8d, 0x49, 0x78, 0xba, 0x47, 0xc3, 0x22, 0xf7, 0x6e, 0x57, 0xe8, 0x2f, 0x29, 0x10, 0x5e, 0xd1, - 0x8e, 0xfd, 0xb1, 0x0d, 0x9f, 0x82, 0xa6, 0xa0, 0x23, 0x22, 0xa2, 0x5e, 0x9f, 0x0c, 0x22, 0x77, - 0xde, 0x64, 0xf8, 0xe8, 0x7a, 0x19, 0x6c, 0x01, 0x95, 0xff, 0x11, 0x06, 0xa5, 0x15, 0x90, 0x41, - 0x04, 0x53, 0xd0, 0x18, 0x25, 0x4c, 0xd1, 0x94, 0x49, 0xe5, 0xd6, 0xb7, 0xe6, 0xb7, 0x1b, 0xc1, - 0x57, 0x2f, 0x72, 0xef, 0x83, 0x98, 0xa9, 0xe4, 0xa8, 0xef, 0x87, 0x3c, 0xeb, 0xd8, 0x79, 0xbc, - 0x33, 0xa0, 0x6a, 0xc4, 0xc5, 0xe1, 0xd8, 0xee, 0x9c, 0x8c, 0x27, 0x48, 0xa4, 0xa4, 0xca, 0xef, - 0x12, 0x26, 0x8a, 0xdc, 0x5b, 0x2b, 0x13, 0x5e, 0x92, 0x22, 0x3c, 0x49, 0xa0, 0xdb, 0x25, 0x53, - 0x22, 0x93, 0xde, 0x81, 0x20, 0xa1, 0x1e, 0x95, 0xbb, 0xf0, 0x1a, 0xed, 0xba, 0x4a, 0x81, 0xf0, - 0x8a, 0x71, 0x3c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 0xef, 0xdb, 0xb7, 0xdf, 0x7f, 0xc8, 0xd9, 0x20, 0xa8, 0xeb, 0xb6, 0xe1, 0x32, 0x3a, 0xf8, - 0xe2, 0xd9, 0x79, 0xdb, 0x79, 0x7e, 0xde, 0x76, 0xfe, 0x38, 0x6f, 0x3b, 0x3f, 0x5c, 0xb4, 0x6b, - 0xcf, 0x2f, 0xda, 0xb5, 0xdf, 0x2f, 0xda, 0xb5, 0xa7, 0x3b, 0xff, 0x66, 0x79, 0xd4, 0xe9, 0x90, - 0xca, 0xfe, 0xa2, 0xb9, 0x9f, 0xdf, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xb4, 0x21, 0x70, - 0xe1, 0x08, 0x00, 0x00, + // 1011 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x73, 0xdb, 0x44, + 0x18, 0xb6, 0x12, 0x27, 0x8d, 0xd7, 0x49, 0x1a, 0x6f, 0x93, 0xe2, 0xa6, 0x19, 0xcb, 0x2c, 0x0c, + 0x93, 0x03, 0xc8, 0x93, 0xf2, 0x35, 0x04, 0x2e, 0x55, 0x43, 0x87, 0x0e, 0x2d, 0xe3, 0x59, 0x02, + 0xcc, 0xf4, 0x22, 0xd6, 0xd2, 0x46, 0xda, 0x89, 0xa4, 0x35, 0xda, 0x75, 0x9c, 0xfc, 0x83, 0x1e, + 0xe1, 0xc2, 0xc0, 0x2d, 0x67, 0x6e, 0xfc, 0x8b, 0x1e, 0x7b, 0x64, 0x7a, 0x50, 0x21, 0xb9, 0x74, + 0x38, 0xfa, 0x17, 0x30, 0xbb, 0x5a, 0xc7, 0x4a, 0xed, 0x43, 0xe8, 0xf4, 0xa6, 0xf7, 0x63, 0x9f, + 0xf7, 0x79, 0x3f, 0xf6, 0x5d, 0x81, 0x16, 0xc9, 0xfc, 0x68, 0x48, 0x4e, 0x3a, 0x3c, 0x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, 0x23, 0xa9, 0xd3, 0x9b, 0x77, 0x37, 0x47, + 0xb9, 0x7d, 0xb3, 0x00, 0x78, 0xc5, 0x01, 0xe1, 0xd5, 0xb1, 0xe6, 0x2b, 0xad, 0x80, 0xdf, 0x82, + 0x8d, 0x0b, 0x1f, 0xc9, 0x12, 0xea, 0x0d, 0x52, 0x76, 0xec, 0x25, 0xc2, 0x4c, 0x73, 0x7b, 0x94, + 0xdb, 0x5b, 0xaf, 0x40, 0x95, 0xdd, 0x10, 0x86, 0x63, 0xfd, 0x3e, 0x4b, 0xe8, 0x77, 0x29, 0x3b, + 0x7e, 0x24, 0x90, 0x00, 0xd7, 0xb0, 0x7e, 0xac, 0x04, 0x5c, 0x05, 0x73, 0xcc, 0x3c, 0xcd, 0x78, + 0x8e, 0x05, 0xf0, 0x6d, 0xb0, 0x5c, 0x7a, 0x96, 0x85, 0x66, 0x5c, 0xc5, 0xf5, 0xc9, 0xe3, 0x2c, + 0xe0, 0xc7, 0x60, 0x41, 0xbd, 0xf7, 0x8a, 0xc2, 0xbc, 0x5e, 0xa4, 0x45, 0xa9, 0x1c, 0xf5, 0x47, + 0xe0, 0x98, 0x3f, 0x02, 0xe7, 0x1e, 0x67, 0xa9, 0x5b, 0x55, 0xc5, 0xc4, 0x85, 0xb7, 0xfb, 0xf5, + 0xd3, 0xb3, 0x96, 0xf5, 0xec, 0xac, 0x65, 0xfd, 0x7d, 0xd6, 0xb2, 0x7e, 0x3e, 0x6f, 0x55, 0x9e, + 0x9d, 0xb7, 0x2a, 0x7f, 0x9d, 0xb7, 0x2a, 0x8f, 0x77, 0xfe, 0xcf, 0x48, 0xc9, 0x93, 0x3e, 0x15, + 0xbd, 0x45, 0xbd, 0xb5, 0x3f, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x27, 0x88, 0xf6, 0xf7, + 0x08, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -782,8 +784,8 @@ func (m *DatedPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.CreationTime != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.CreationTime)) + if m.CreationTimeUnixMs != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.CreationTimeUnixMs)) i-- dAtA[i] = 0x18 } @@ -965,8 +967,8 @@ func (m *DatedPrice) Size() (n int) { if m.CreationHeight != 0 { n += 1 + sovOracle(uint64(m.CreationHeight)) } - if m.CreationTime != 0 { - n += 1 + sovOracle(uint64(m.CreationTime)) + if m.CreationTimeUnixMs != 0 { + n += 1 + sovOracle(uint64(m.CreationTimeUnixMs)) } return n } @@ -1814,9 +1816,9 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CreationTimeUnixMs", wireType) } - m.CreationTime = 0 + m.CreationTimeUnixMs = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOracle @@ -1826,7 +1828,7 @@ func (m *DatedPrice) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CreationTime |= uint64(b&0x7F) << shift + m.CreationTimeUnixMs |= uint64(b&0x7F) << shift if b < 0x80 { break } From e23469c82e5a0693fc001a14d0364f2a27a1d2a7 Mon Sep 17 00:00:00 2001 From: pyncz Date: Wed, 20 Nov 2024 13:28:21 +0300 Subject: [PATCH 7/7] chore: update `buf.lock` --- proto/buf.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/buf.lock b/proto/buf.lock index 675cb673..0d13e67d 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -29,5 +29,5 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: e7f8d366f5264595bcc4cd4139af9973 - digest: shake256:e5e5f1c12f82e028ea696faa43b4f9dc6258a6d1226282962a8c8b282e10946281d815884f574bd279ebd9cd7588629beb3db17b892af6c33b56f92f8f67f509 + commit: c0913f24652a4cfc95f77d97443a5005 + digest: shake256:0ef3248c6235d420fe61f373154adcde6b94e3297f82472b1d8d8c3747240b61b4a10405e2a6f8ac1c98816ac6e690ea7871024aa5ae0e035cd540214667ceed