From e8f43014132b311ac46ca1fdf1ae78c81895cd70 Mon Sep 17 00:00:00 2001 From: rbajollari Date: Wed, 8 Jan 2025 15:09:02 -0500 Subject: [PATCH] take out more gas estimate stuff --- app/preblocker.go | 9 - proto/ojo/oracle/v1/abci.proto | 8 - x/oracle/abci/proposal_test.go | 13 -- x/oracle/abci/util.go | 23 -- x/oracle/types/abci.pb.go | 357 +++--------------------------- x/oracle/types/expected_keeper.go | 5 - 6 files changed, 25 insertions(+), 390 deletions(-) diff --git a/app/preblocker.go b/app/preblocker.go index 0df1c144..9e7d2221 100644 --- a/app/preblocker.go +++ b/app/preblocker.go @@ -8,8 +8,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ojo-network/ojo/x/oracle/abci" "github.com/ojo-network/ojo/x/oracle/types" - - gasestimatetypes "github.com/ojo-network/ojo/x/gasestimate/types" ) // PreBlocker is run before finalize block to update the aggregrate exchange rate votes on the oracle module @@ -60,13 +58,6 @@ func (app *App) PreBlocker(ctx sdk.Context, req *cometabci.RequestFinalizeBlock) } app.OracleKeeper.SetAggregateExchangeRateVote(ctx, valAddr, exchangeRateVote) } - for _, gasEstimate := range injectedVoteExtTx.GasEstimateMedians { - app.GasEstimateKeeper.SetGasEstimate(ctx, gasestimatetypes.GasEstimate{ - Network: gasEstimate.Network, - GasEstimate: gasEstimate.GasEstimation, - }) - } - app.Logger().Info("gas estimates updated", "gasestimates", injectedVoteExtTx.GasEstimateMedians) } app.Logger().Info( diff --git a/proto/ojo/oracle/v1/abci.proto b/proto/ojo/oracle/v1/abci.proto index 88605425..2272d02a 100644 --- a/proto/ojo/oracle/v1/abci.proto +++ b/proto/ojo/oracle/v1/abci.proto @@ -17,7 +17,6 @@ message OracleVoteExtension { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false ]; - repeated GasEstimate gas_estimates = 3 [(gogoproto.nullable) = false]; } // InjectedVoteExtensionTx defines the vote extension tx injected by the prepare @@ -27,11 +26,4 @@ message InjectedVoteExtensionTx { (gogoproto.nullable) = false ]; bytes extended_commit_info = 2; - repeated GasEstimate gas_estimate_medians = 3 [(gogoproto.nullable) = false]; -} - -// GasEstimate defines a gas estimate for a given network. -message GasEstimate { - int64 gas_estimation = 1; - string network = 2; } diff --git a/x/oracle/abci/proposal_test.go b/x/oracle/abci/proposal_test.go index 1099312f..21fc3e36 100644 --- a/x/oracle/abci/proposal_test.go +++ b/x/oracle/abci/proposal_test.go @@ -21,17 +21,6 @@ import ( oracletypes "github.com/ojo-network/ojo/x/oracle/types" ) -var testGasEstimates = []oracletypes.GasEstimate{ - { - GasEstimation: 300, - Network: "Ethereum", - }, - { - GasEstimation: 100, - Network: "Arbitrum", - }, -} - func (s *IntegrationTestSuite) TestPrepareProposalHandler() { app, ctx, keys := s.app, s.ctx, s.keys @@ -183,7 +172,6 @@ func (s *IntegrationTestSuite) TestProcessProposalHandler() { injectedVoteExtTx := oracletypes.InjectedVoteExtensionTx{ ExchangeRateVotes: exchangeRateVotes, ExtendedCommitInfo: localCommitInfoBz, - GasEstimateMedians: testGasEstimates, } bz, err := injectedVoteExtTx.Marshal() s.Require().NoError(err) @@ -320,7 +308,6 @@ func buildLocalCommitInfo( voteExt := oracletypes.OracleVoteExtension{ ExchangeRates: exchangeRates, Height: ctx.BlockHeight(), - GasEstimates: testGasEstimates, } bz, err := voteExt.Marshal() if err != nil { diff --git a/x/oracle/abci/util.go b/x/oracle/abci/util.go index 74e3eced..18758237 100644 --- a/x/oracle/abci/util.go +++ b/x/oracle/abci/util.go @@ -1,11 +1,7 @@ package abci import ( - "fmt" - "sort" - sdk "github.com/cosmos/cosmos-sdk/types" - oracletypes "github.com/ojo-network/ojo/x/oracle/types" ) // VoteExtensionsEnabled determines if vote extensions are enabled for the current block. @@ -25,22 +21,3 @@ func VoteExtensionsEnabled(ctx sdk.Context) bool { return cp.Abci.VoteExtensionsEnableHeight < ctx.BlockHeight() } - -func calculateMedian(gasEstimates []oracletypes.GasEstimate) (median oracletypes.GasEstimate, err error) { - if len(gasEstimates) == 0 { - return oracletypes.GasEstimate{}, fmt.Errorf("cannot calculate median of empty slice") - } - - sort.Slice(gasEstimates, func(i, j int) bool { - return gasEstimates[i].GasEstimation < gasEstimates[j].GasEstimation - }) - - mid := len(gasEstimates) / 2 - if len(gasEstimates)%2 == 0 { - return oracletypes.GasEstimate{ - GasEstimation: (gasEstimates[mid-1].GasEstimation + gasEstimates[mid].GasEstimation) / 2, - Network: gasEstimates[mid-1].Network, // or gasEstimates[mid].Network, choose consistently - }, nil - } - return gasEstimates[mid], nil -} diff --git a/x/oracle/types/abci.pb.go b/x/oracle/types/abci.pb.go index e74a793c..d4accf5e 100644 --- a/x/oracle/types/abci.pb.go +++ b/x/oracle/types/abci.pb.go @@ -30,7 +30,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type OracleVoteExtension struct { Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` ExchangeRates github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=exchange_rates,json=exchangeRates,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"exchange_rates"` - GasEstimates []GasEstimate `protobuf:"bytes,3,rep,name=gas_estimates,json=gasEstimates,proto3" json:"gas_estimates"` } func (m *OracleVoteExtension) Reset() { *m = OracleVoteExtension{} } @@ -71,7 +70,6 @@ var xxx_messageInfo_OracleVoteExtension proto.InternalMessageInfo type InjectedVoteExtensionTx struct { ExchangeRateVotes []AggregateExchangeRateVote `protobuf:"bytes,1,rep,name=exchange_rate_votes,json=exchangeRateVotes,proto3" json:"exchange_rate_votes"` ExtendedCommitInfo []byte `protobuf:"bytes,2,opt,name=extended_commit_info,json=extendedCommitInfo,proto3" json:"extended_commit_info,omitempty"` - GasEstimateMedians []GasEstimate `protobuf:"bytes,3,rep,name=gas_estimate_medians,json=gasEstimateMedians,proto3" json:"gas_estimate_medians"` } func (m *InjectedVoteExtensionTx) Reset() { *m = InjectedVoteExtensionTx{} } @@ -107,84 +105,39 @@ func (m *InjectedVoteExtensionTx) XXX_DiscardUnknown() { var xxx_messageInfo_InjectedVoteExtensionTx proto.InternalMessageInfo -// GasEstimate defines a gas estimate for a given network. -type GasEstimate struct { - GasEstimation int64 `protobuf:"varint,1,opt,name=gas_estimation,json=gasEstimation,proto3" json:"gas_estimation,omitempty"` - Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"` -} - -func (m *GasEstimate) Reset() { *m = GasEstimate{} } -func (m *GasEstimate) String() string { return proto.CompactTextString(m) } -func (*GasEstimate) ProtoMessage() {} -func (*GasEstimate) Descriptor() ([]byte, []int) { - return fileDescriptor_a17fd58ec0319b85, []int{2} -} -func (m *GasEstimate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GasEstimate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GasEstimate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GasEstimate) XXX_Merge(src proto.Message) { - xxx_messageInfo_GasEstimate.Merge(m, src) -} -func (m *GasEstimate) XXX_Size() int { - return m.Size() -} -func (m *GasEstimate) XXX_DiscardUnknown() { - xxx_messageInfo_GasEstimate.DiscardUnknown(m) -} - -var xxx_messageInfo_GasEstimate proto.InternalMessageInfo - func init() { proto.RegisterType((*OracleVoteExtension)(nil), "ojo.oracle.v1.OracleVoteExtension") proto.RegisterType((*InjectedVoteExtensionTx)(nil), "ojo.oracle.v1.InjectedVoteExtensionTx") - proto.RegisterType((*GasEstimate)(nil), "ojo.oracle.v1.GasEstimate") } func init() { proto.RegisterFile("ojo/oracle/v1/abci.proto", fileDescriptor_a17fd58ec0319b85) } var fileDescriptor_a17fd58ec0319b85 = []byte{ - // 463 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xe3, 0x16, 0x15, 0xb1, 0x6d, 0x2a, 0xb1, 0x8d, 0xc0, 0x8a, 0x90, 0x1b, 0x45, 0x42, - 0x0a, 0x42, 0x5d, 0x13, 0xfa, 0x04, 0xa4, 0x44, 0x55, 0x0f, 0x80, 0x64, 0x21, 0x0e, 0x1c, 0xb0, - 0xd6, 0xf6, 0x74, 0xb3, 0x29, 0xde, 0xa9, 0xbc, 0x4b, 0x30, 0x6f, 0xc1, 0x73, 0xf0, 0x24, 0x39, - 0xf6, 0xc8, 0x89, 0x3f, 0xc9, 0x9d, 0x57, 0x00, 0xed, 0xda, 0x56, 0x9c, 0x9e, 0x38, 0x79, 0x77, - 0xbf, 0x99, 0xf9, 0x7d, 0xe3, 0x19, 0xe2, 0xe3, 0x1c, 0x43, 0x2c, 0x78, 0xfa, 0x11, 0xc2, 0xc5, - 0x38, 0xe4, 0x49, 0x2a, 0xd9, 0x75, 0x81, 0x06, 0x69, 0x17, 0xe7, 0xc8, 0x2a, 0x85, 0x2d, 0xc6, - 0xfd, 0x9e, 0x40, 0x81, 0x4e, 0x09, 0xed, 0xa9, 0x0a, 0xea, 0x07, 0x29, 0xea, 0x1c, 0x75, 0x98, - 0x70, 0x6d, 0xf3, 0x13, 0x30, 0x7c, 0x1c, 0xa6, 0x28, 0x55, 0xad, 0xf7, 0xb7, 0xcb, 0xd7, 0xe5, - 0x9c, 0x36, 0xfc, 0xe3, 0x91, 0xa3, 0x37, 0xee, 0xe1, 0x1d, 0x1a, 0x98, 0x96, 0x06, 0x94, 0x96, - 0xa8, 0xe8, 0x03, 0xb2, 0x37, 0x03, 0x29, 0x66, 0xc6, 0xf7, 0x06, 0xde, 0x68, 0x37, 0xaa, 0x6f, - 0xb4, 0x24, 0x87, 0x50, 0xa6, 0x33, 0xae, 0x04, 0xc4, 0x05, 0x37, 0xa0, 0x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0x1d, 0xbe, 0x26, 0xfb, 0xad, 0x40, 0xfa, 0x98, 0x1c, 0xb6, 0x10, 0x12, 0x55, 0x3d, 0xf1, - 0xee, 0x26, 0xd5, 0x2e, 0x84, 0x4f, 0xee, 0x2a, 0x30, 0x9f, 0xb1, 0xb8, 0x72, 0x76, 0xef, 0x45, - 0xcd, 0x75, 0x72, 0xbe, 0xfc, 0x1d, 0x74, 0x96, 0xab, 0xc0, 0xbb, 0x59, 0x05, 0xde, 0xaf, 0x55, - 0xe0, 0x7d, 0x5d, 0x07, 0x9d, 0x9b, 0x75, 0xd0, 0xf9, 0xbe, 0x0e, 0x3a, 0xef, 0x9f, 0xb4, 0x46, - 0x8e, 0x73, 0x3c, 0xa9, 0xb3, 0xec, 0x39, 0x2c, 0x9b, 0xad, 0x74, 0x93, 0x4f, 0xf6, 0xdc, 0x4a, - 0x9e, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0x98, 0x69, 0xf4, 0x0f, 0x03, 0x00, 0x00, + // 382 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xcf, 0x8e, 0xd3, 0x30, + 0x10, 0xc6, 0xe3, 0x5d, 0xb4, 0x87, 0xc0, 0x22, 0x91, 0x5d, 0x41, 0x54, 0x21, 0x6f, 0xb5, 0xa7, + 0x20, 0xb4, 0x36, 0x65, 0x9f, 0x80, 0x2e, 0x08, 0xf5, 0x84, 0x14, 0x21, 0x0e, 0x1c, 0x88, 0x12, + 0x67, 0xea, 0x38, 0x25, 0x9e, 0x2a, 0x36, 0x25, 0xbc, 0x05, 0x6f, 0x81, 0x04, 0x2f, 0xd2, 0x63, + 0x8f, 0x9c, 0xf8, 0xd3, 0xbe, 0x08, 0x72, 0xfe, 0x08, 0xc2, 0x29, 0x93, 0xf9, 0x3c, 0xdf, 0xfc, + 0xf4, 0x8d, 0x1f, 0x62, 0x89, 0x1c,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44, 0xf6, 0x4c, + 0xca, 0x1a, 0x64, 0xea, 0x1c, 0xfe, 0xfa, 0x3b, 0xc7, 0xf9, 0x2d, 0x87, 0x19, 0xdf, 0x83, 0xff, + 0xfa, 0x26, 0x78, 0xe2, 0x9f, 0x83, 0x5b, 0x97, 0x43, 0x9e, 0x08, 0xac, 0x2a, 0x65, 0x13, 0xa5, + 0x97, 0x18, 0x1e, 0x4d, 0x49, 0x74, 0x27, 0x0e, 0x06, 0xed, 0xa6, 0x95, 0x16, 0x7a, 0x89, 0xf3, + 0x97, 0xdb, 0xdf, 0xd4, 0xdb, 0xee, 0x29, 0xd9, 0xed, 0x29, 0xf9, 0xb5, 0xa7, 0xe4, 0xf3, 0x81, + 0x7a, 0xbb, 0x03, 0xf5, 0xbe, 0x1f, 0xa8, 0xf7, 0xf6, 0xd1, 0x3f, 0x39, 0x60, 0x89, 0x57, 0x1a, + 0xec, 0x47, 0xac, 0x57, 0xae, 0xe6, 0xcd, 0x70, 0xaa, 0x36, 0x8e, 0xec, 0xa4, 0xbd, 0xd3, 0xf5, + 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x73, 0x9c, 0xa3, 0x24, 0x02, 0x00, 0x00, } func (m *OracleVoteExtension) Marshal() (dAtA []byte, err error) { @@ -207,20 +160,6 @@ func (m *OracleVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.GasEstimates) > 0 { - for iNdEx := len(m.GasEstimates) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasEstimates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } if len(m.ExchangeRates) > 0 { for iNdEx := len(m.ExchangeRates) - 1; iNdEx >= 0; iNdEx-- { { @@ -263,20 +202,6 @@ func (m *InjectedVoteExtensionTx) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l - if len(m.GasEstimateMedians) > 0 { - for iNdEx := len(m.GasEstimateMedians) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasEstimateMedians[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } if len(m.ExtendedCommitInfo) > 0 { i -= len(m.ExtendedCommitInfo) copy(dAtA[i:], m.ExtendedCommitInfo) @@ -301,41 +226,6 @@ func (m *InjectedVoteExtensionTx) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *GasEstimate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GasEstimate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GasEstimate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Network) > 0 { - i -= len(m.Network) - copy(dAtA[i:], m.Network) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Network))) - i-- - dAtA[i] = 0x12 - } - if m.GasEstimation != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasEstimation)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func encodeVarintAbci(dAtA []byte, offset int, v uint64) int { offset -= sovAbci(v) base := offset @@ -362,12 +252,6 @@ func (m *OracleVoteExtension) Size() (n int) { n += 1 + l + sovAbci(uint64(l)) } } - if len(m.GasEstimates) > 0 { - for _, e := range m.GasEstimates { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } return n } @@ -387,28 +271,6 @@ func (m *InjectedVoteExtensionTx) Size() (n int) { if l > 0 { n += 1 + l + sovAbci(uint64(l)) } - if len(m.GasEstimateMedians) > 0 { - for _, e := range m.GasEstimateMedians { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *GasEstimate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasEstimation != 0 { - n += 1 + sovAbci(uint64(m.GasEstimation)) - } - l = len(m.Network) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } return n } @@ -500,40 +362,6 @@ func (m *OracleVoteExtension) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasEstimates", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GasEstimates = append(m.GasEstimates, GasEstimate{}) - if err := m.GasEstimates[len(m.GasEstimates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAbci(dAtA[iNdEx:]) @@ -652,141 +480,6 @@ func (m *InjectedVoteExtensionTx) Unmarshal(dAtA []byte) error { m.ExtendedCommitInfo = []byte{} } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasEstimateMedians", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GasEstimateMedians = append(m.GasEstimateMedians, GasEstimate{}) - if err := m.GasEstimateMedians[len(m.GasEstimateMedians)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GasEstimate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GasEstimate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GasEstimate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasEstimation", wireType) - } - m.GasEstimation = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasEstimation |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Network", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Network = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAbci(dAtA[iNdEx:]) diff --git a/x/oracle/types/expected_keeper.go b/x/oracle/types/expected_keeper.go index 9e3879ad..153aad3d 100644 --- a/x/oracle/types/expected_keeper.go +++ b/x/oracle/types/expected_keeper.go @@ -8,7 +8,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - gasestimatetypes "github.com/ojo-network/ojo/x/gasestimate/types" ) // StakingKeeper defines the expected interface contract defined by the x/staking @@ -50,7 +49,3 @@ type BankKeeper interface { GetDenomMetaData(ctx context.Context, denom string) (banktypes.Metadata, bool) SetDenomMetaData(ctx context.Context, denomMetaData banktypes.Metadata) } - -type GasEstimateKeeper interface { - GetParams(ctx sdk.Context) (params gasestimatetypes.Params) -}