From d01283337d0427e48863f9dda612773d6d48311d Mon Sep 17 00:00:00 2001 From: puneetmahajan Date: Tue, 19 Dec 2023 16:21:55 +0530 Subject: [PATCH] make time as int64 because wasm won't parse --- proto/pstake/ratesync/v1beta1/contract.proto | 2 +- x/ratesync/keeper/ica_tx.go | 2 +- x/ratesync/types/contract.pb.go | 106 ++++++++----------- 3 files changed, 45 insertions(+), 65 deletions(-) diff --git a/proto/pstake/ratesync/v1beta1/contract.proto b/proto/pstake/ratesync/v1beta1/contract.proto index 1d4f47075..f150079a8 100644 --- a/proto/pstake/ratesync/v1beta1/contract.proto +++ b/proto/pstake/ratesync/v1beta1/contract.proto @@ -24,5 +24,5 @@ message LiquidStakeRate { // cvalue = default_bond_denom_price/stk_denom_price // cvalue = stk_denom_supply/default_bond_denom_supply string c_value = 3[(gogoproto.nullable) = false, (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; - google.protobuf.Timestamp controller_chain_time = 4[(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + int64 controller_chain_time = 4; } \ No newline at end of file diff --git a/x/ratesync/keeper/ica_tx.go b/x/ratesync/keeper/ica_tx.go index 7e1e04f64..0c5cbc6be 100644 --- a/x/ratesync/keeper/ica_tx.go +++ b/x/ratesync/keeper/ica_tx.go @@ -107,7 +107,7 @@ func (k *Keeper) ExecuteLiquidStakeRateTx(ctx sdk.Context, feature types.LiquidS DefaultBondDenom: hostDenom, StkDenom: mintDenom, CValue: cValue, - ControllerChainTime: ctx.BlockTime(), + ControllerChainTime: ctx.BlockTime().Unix(), }, } contractBz, err := json.Marshal(contractMsg) diff --git a/x/ratesync/types/contract.pb.go b/x/ratesync/types/contract.pb.go index b38d3ce56..e8ae3a805 100644 --- a/x/ratesync/types/contract.pb.go +++ b/x/ratesync/types/contract.pb.go @@ -9,19 +9,16 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf -var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -126,7 +123,7 @@ type LiquidStakeRate struct { // cvalue = default_bond_denom_price/stk_denom_price // cvalue = stk_denom_supply/default_bond_denom_supply CValue github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=c_value,json=cValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"c_value"` - ControllerChainTime time.Time `protobuf:"bytes,4,opt,name=controller_chain_time,json=controllerChainTime,proto3,stdtime" json:"controller_chain_time"` + ControllerChainTime int64 `protobuf:"varint,4,opt,name=controller_chain_time,json=controllerChainTime,proto3" json:"controller_chain_time,omitempty"` } func (m *LiquidStakeRate) Reset() { *m = LiquidStakeRate{} } @@ -176,11 +173,11 @@ func (m *LiquidStakeRate) GetStkDenom() string { return "" } -func (m *LiquidStakeRate) GetControllerChainTime() time.Time { +func (m *LiquidStakeRate) GetControllerChainTime() int64 { if m != nil { return m.ControllerChainTime } - return time.Time{} + return 0 } func init() { @@ -194,37 +191,36 @@ func init() { } var fileDescriptor_11a849967ac18085 = []byte{ - // 468 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xe3, 0x52, 0x4a, 0xbb, 0x1c, 0x0a, 0xa6, 0x40, 0x08, 0x92, 0x83, 0x72, 0xa8, 0x7a, - 0x20, 0xbb, 0x6a, 0x39, 0xc2, 0x85, 0x34, 0x1c, 0x90, 0x90, 0x90, 0xdc, 0x16, 0xa1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, 0x3a, 0x97, 0xf3, 0xa8, - 0xf3, 0x63, 0x1e, 0x75, 0x0e, 0xdf, 0xfe, 0xb5, 0x71, 0x05, 0xb5, 0x91, 0x06, 0x41, 0x09, 0xf8, - 0xac, 0x80, 0xf9, 0x0c, 0x86, 0x8a, 0xa3, 0x9c, 0x02, 0x9b, 0xee, 0xb0, 0x93, 0x9b, 0xcf, 0xd5, - 0x59, 0x49, 0x57, 0xdc, 0x26, 0x6f, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x3a, 0xfb, 0xa4, - 0xce, 0x02, 0x00, 0x00, + // 452 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x6e, 0xd4, 0x30, + 0x10, 0x86, 0x37, 0xb4, 0x14, 0x6a, 0x0e, 0x85, 0x50, 0x60, 0x29, 0x52, 0xb6, 0xda, 0x43, 0xb5, + 0x07, 0x36, 0x56, 0x97, 0x23, 0x5c, 0xd8, 0x2e, 0x07, 0x24, 0x24, 0xa4, 0xb4, 0xe5, 0xd0, 0x4b, + 0xe4, 0xd8, 0xd3, 0xd4, 0xda, 0xc4, 0x0e, 0xf1, 0x24, 0x6a, 0xdf, 0x82, 0x87, 0xe9, 0x43, 0xf4, + 0x58, 0xf5, 0x84, 0x38, 0x54, 0x68, 0xf7, 0xc0, 0x6b, 0xa0, 0xd8, 0x46, 0x85, 0xa2, 0x9e, 0x12, + 0xcf, 0xff, 0x69, 0x66, 0xfe, 0xdf, 0x26, 0x3b, 0x95, 0x41, 0x36, 0x07, 0x5a, 0x33, 0x04, 0x73, + 0xa6, 0x38, 0x6d, 0x77, 0x33, 0x40, 0xb6, 0x4b, 0xb9, 0x56, 0x58, 0x33, 0x8e, 0x71, 0x55, 0x6b, + 0xd4, 0xe1, 0x0b, 0xc7, 0xc5, 0x7f, 0xb8, 0xd8, 0x73, 0x5b, 0x9b, 0xb9,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 0xd1, 0x40, 0x7f, 0xc5, 0xc6, 0xf0, 0xae, 0x5b, 0xe3, 0xc7, 0xf5, 0x60, 0x27, 0x97, 0x78, + 0xd2, 0x64, 0x31, 0xd7, 0xa5, 0x4f, 0xdf, 0x7f, 0xc6, 0x46, 0xcc, 0x29, 0x9e, 0x55, 0x60, 0xe2, + 0x19, 0xf0, 0xab, 0xf3, 0x31, 0xf1, 0xa1, 0xcd, 0x80, 0x27, 0x6b, 0xfc, 0x4b, 0xd7, 0x2b, 0x9c, + 0x90, 0x67, 0xf6, 0xfa, 0x75, 0x51, 0x40, 0x9d, 0xf2, 0x13, 0x26, 0x55, 0xda, 0xdd, 0x52, 0x7f, + 0x75, 0x3b, 0x18, 0xad, 0x24, 0x4f, 0x6f, 0xc4, 0xbd, 0x4e, 0x3b, 0x90, 0x25, 0x4c, 0x0f, 0x2f, + 0x16, 0x51, 0x70, 0xb9, 0x88, 0x82, 0x9f, 0x8b, 0x28, 0xf8, 0xb6, 0x8c, 0x7a, 0x97, 0xcb, 0xa8, + 0xf7, 0x7d, 0x19, 0xf5, 0x8e, 0xde, 0xfe, 0xb5, 0x4b, 0x05, 0xb5, 0x91, 0x06, 0x41, 0x71, 0xf8, + 0xac, 0x80, 0xba, 0x74, 0xc7, 0x8a, 0xa1, 0x6c, 0x81, 0xb6, 0x13, 0x7a, 0x7a, 0xf3, 0x10, 0xed, + 0x92, 0xd9, 0x9a, 0x7d, 0x13, 0x6f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x3b, 0x03, 0x81, + 0xa8, 0x02, 0x00, 0x00, } func (m *InstantiateLiquidStakeRateContract) Marshal() (dAtA []byte, err error) { @@ -310,14 +306,11 @@ func (m *LiquidStakeRate) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.ControllerChainTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.ControllerChainTime):]) - if err2 != nil { - return 0, err2 + if m.ControllerChainTime != 0 { + i = encodeVarintContract(dAtA, i, uint64(m.ControllerChainTime)) + i-- + dAtA[i] = 0x20 } - i -= n2 - i = encodeVarintContract(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x22 { size := m.CValue.Size() i -= size @@ -396,8 +389,9 @@ func (m *LiquidStakeRate) Size() (n int) { } l = m.CValue.Size() n += 1 + l + sovContract(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.ControllerChainTime) - n += 1 + l + sovContract(uint64(l)) + if m.ControllerChainTime != 0 { + n += 1 + sovContract(uint64(m.ControllerChainTime)) + } return n } @@ -700,10 +694,10 @@ func (m *LiquidStakeRate) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 4: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ControllerChainTime", wireType) } - var msglen int + m.ControllerChainTime = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowContract @@ -713,25 +707,11 @@ func (m *LiquidStakeRate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ControllerChainTime |= int64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthContract - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthContract - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.ControllerChainTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipContract(dAtA[iNdEx:])