From 2b7f3d6d2fa7f83bcad554e82eee7ff6428ae1b2 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Fri, 27 Sep 2024 16:44:40 +0200 Subject: [PATCH 1/2] numblock removed --- .../dymension/rollapp/state_info.proto | 4 +- settlement/dymension/dymension_test.go | 2 +- settlement/dymension/utils.go | 2 +- .../dymension/rollapp/state_info.pb.go | 110 ++++++------------ types/pb/dymint/state.pb.go | 2 +- 5 files changed, 42 insertions(+), 78 deletions(-) diff --git a/proto/types/dymensionxyz/dymension/rollapp/state_info.proto b/proto/types/dymensionxyz/dymension/rollapp/state_info.proto index f24a0efc8..dfb16cbda 100644 --- a/proto/types/dymensionxyz/dymension/rollapp/state_info.proto +++ b/proto/types/dymensionxyz/dymension/rollapp/state_info.proto @@ -37,8 +37,8 @@ message StateInfo { string sequencer = 2; // startHeight is the block height of the first block in the batch uint64 startHeight = 3; - // numBlocks is the number of blocks included in this batch update - uint64 numBlocks = 4; + + reserved 4; // DAPath is the description of the location on the DA layer string DAPath = 5; diff --git a/settlement/dymension/dymension_test.go b/settlement/dymension/dymension_test.go index 5f24e9cb3..535ed7530 100644 --- a/settlement/dymension/dymension_test.go +++ b/settlement/dymension/dymension_test.go @@ -160,7 +160,7 @@ func TestPostBatch(t *testing.T) { } rollappQueryClientMock.On("StateInfo", mock.Anything, mock.Anything).Return( &rollapptypes.QueryGetStateInfoResponse{StateInfo: rollapptypes.StateInfo{ - StartHeight: batch.StartHeight(), StateInfoIndex: rollapptypes.StateInfoIndex{Index: 1}, DAPath: daMetaData.ToPath(), NumBlocks: 1, + StartHeight: batch.StartHeight(), StateInfoIndex: rollapptypes.StateInfoIndex{Index: 1}, DAPath: daMetaData.ToPath(), }}, nil) } else { diff --git a/settlement/dymension/utils.go b/settlement/dymension/utils.go index d071dfe9a..06fa71839 100644 --- a/settlement/dymension/utils.go +++ b/settlement/dymension/utils.go @@ -41,7 +41,7 @@ func convertStateInfoToResultRetrieveBatch(stateInfo *rollapptypes.StateInfo) (* batchResult := &settlement.Batch{ Sequencer: stateInfo.Sequencer, StartHeight: stateInfo.StartHeight, - EndHeight: stateInfo.StartHeight + stateInfo.NumBlocks - 1, + EndHeight: stateInfo.BDs.BD[len(stateInfo.BDs.BD)-1].Height, MetaData: &settlement.BatchMetaData{ DA: daMetaData, }, diff --git a/types/pb/dymensionxyz/dymension/rollapp/state_info.pb.go b/types/pb/dymensionxyz/dymension/rollapp/state_info.pb.go index bbb6c7b6f..5cd344e8c 100644 --- a/types/pb/dymensionxyz/dymension/rollapp/state_info.pb.go +++ b/types/pb/dymensionxyz/dymension/rollapp/state_info.pb.go @@ -99,8 +99,6 @@ type StateInfo struct { Sequencer string `protobuf:"bytes,2,opt,name=sequencer,proto3" json:"sequencer,omitempty"` // startHeight is the block height of the first block in the batch StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` - // numBlocks is the number of blocks included in this batch update - NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` // DAPath is the description of the location on the DA layer DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` // creationHeight is the height at which the UpdateState took place @@ -170,13 +168,6 @@ func (m *StateInfo) GetStartHeight() uint64 { return 0 } -func (m *StateInfo) GetNumBlocks() uint64 { - if m != nil { - return m.NumBlocks - } - return 0 -} - func (m *StateInfo) GetDAPath() string { if m != nil { return m.DAPath @@ -352,43 +343,43 @@ func init() { } var fileDescriptor_deebb9ffbcdd017e = []byte{ - // 573 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x41, 0x6e, 0xd3, 0x40, - 0x14, 0xcd, 0x34, 0x69, 0x5a, 0x4f, 0xa4, 0xa8, 0x1d, 0x55, 0xc8, 0x8a, 0xc0, 0x89, 0x2c, 0x81, - 0xb2, 0xb2, 0xab, 0x22, 0x36, 0x20, 0x16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, 0x65, 0x7b, 0x3b, 0x75, 0xa3, 0xf0, 0xb9, 0x59, 0x62, 0xcd, 0xb3, 0x9f, 0x6d, - 0xe0, 0x68, 0x45, 0x63, 0x5f, 0xa2, 0x36, 0x6c, 0xf8, 0x5c, 0x0c, 0xbf, 0x60, 0x9e, 0x89, 0xd1, - 0x1b, 0xca, 0x27, 0xe8, 0x73, 0xf1, 0x36, 0xef, 0xbc, 0xaa, 0x6d, 0xd6, 0xb7, 0x36, 0xcc, 0xef, - 0x00, 0x6e, 0xcd, 0x0f, 0x7a, 0x94, 0x44, 0x91, 0xcb, 0xd3, 0xff, 0x1c, 0x8d, 0xd2, 0xfc, 0xb5, - 0xfb, 0x98, 0xbf, 0x7c, 0xe3, 0xea, 0xaa, 0x1b, 0x9b, 0xdf, 0x00, 0x34, 0x94, 0xf5, 0x79, 0x7d, - 0xcc, 0x0e, 0x08, 0x75, 0x43, 0x72, 0xaa, 0x66, 0xde, 0x24, 0x38, 0xc1, 0x2b, 0xa8, 0xc0, 0xca, - 0xb8, 0x78, 0x70, 0x7b, 0xbc, 0x08, 0xd6, 0xd7, 0x3a, 0xd5, 0x7b, 0x5b, 0xb2, 0x4c, 0xd7, 0xfb, - 0x78, 0x3e, 0x35, 0xc0, 0xc5, 0xd4, 0x00, 0xbf, 0xa6, 0x06, 0x38, 0x9b, 0x19, 0x95, 0x8b, 0x99, - 0x51, 0xf9, 0x31, 0x33, 0x2a, 0xef, 0x0f, 0x02, 0x22, 0x27, 0x89, 0x97, 0xd9, 0xb1, 0xf4, 0x66, - 0x10, 0x2a, 0xed, 0xfc, 0x35, 0x89, 0xbd, 0x3b, 0x5e, 0x23, 0xaf, 0xae, 0xf2, 0xf4, 0xf4, 0x4f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x9b, 0x9b, 0x2a, 0x4a, 0x05, 0x00, 0x00, + // 568 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcd, 0x6a, 0xdb, 0x4c, + 0x14, 0xf5, 0xf8, 0x2f, 0xd6, 0x18, 0x8c, 0x33, 0x84, 0x0f, 0x61, 0xbe, 0xca, 0x46, 0xd0, 0xe2, + 0x95, 0x14, 0x52, 0xba, 0x69, 0xe9, 0x22, 0xc6, 0x84, 0x38, 0xab, 0x56, 0x09, 0xa5, 0x94, 0x82, + 0x2b, 0x59, 0x63, 0x79, 0xa8, 0x34, 0xa3, 0xce, 0x8c, 0x4a, 0x9c, 0xa7, 0xc8, 0x83, 0xf4, 0x41, + 0xb2, 0xcc, 0xae, 0x5d, 0xa5, 0xc5, 0x7e, 0x83, 0xee, 0xba, 0x2b, 0x1a, 0x29, 0x76, 0x62, 0xbb, + 0x49, 0x09, 0x74, 0xa7, 0x7b, 0xb9, 0xe7, 0xe8, 0xdc, 0x73, 0x2e, 0x03, 0x9f, 0xc9, 0x69, 0x8c, + 0x85, 0xed, 0x4f, 0x23, 0x4c, 0x05, 0x61, 0xf4, 0x74, 0x7a, 0xb6, 0x2c, 0x6c, 0xce, 0xc2, 0xd0, + 0x8d, 0x63, 0x5b, 0x48, 0x57, 0xe2, 0x21, 0xa1, 0x63, 0x66, 0xc5, 0x9c, 0x49, 0x86, 0x8c, 0x9b, + 0x00, 0x6b, 0x51, 0x58, 0x39, 0xa0, 0xb5, 0x13, 0xb0, 0x80, 0xa9, 0x51, 0x3b, 0xfd, 0xca, 0x50, + 0xad, 0x76, 0xc0, 0x58, 0x10, 0x62, 0x5b, 0x55, 0x5e, 0x32, 0xb6, 0x25, 0x89, 0xb0, 0x90, 0x6e, + 0x14, 0xe7, 0x03, 0x2f, 0xfe, 0x4a, 0x8d, 0x17, 0xb2, 0xd1, 0xc7, 0xa1, 0x8f, 0xc5, 0x88, 0x93, + 0x58, 0x32, 0x9e, 0x83, 0x77, 0xef, 0x04, 0x8f, 0x58, 0x14, 0x31, 0xaa, 0x36, 0x49, 0x44, 0x86, + 0x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8a, 0xb0, 0x65, 0x65, 0xf7, 0x65, 0x5d, 0xdf, 0x97, + 0x75, 0x72, 0x7d, 0x5f, 0xbd, 0x47, 0x29, 0xf4, 0xe7, 0x55, 0x7b, 0x7b, 0xea, 0x46, 0xe1, 0x73, + 0x73, 0x89, 0x35, 0xcf, 0xbf, 0xb7, 0x81, 0xa3, 0xe5, 0x8d, 0x7d, 0x89, 0xda, 0xb0, 0xee, 0x73, + 0x31, 0xfc, 0x8c, 0x79, 0x2a, 0x46, 0xaf, 0x2b, 0x9f, 0xa0, 0xcf, 0xc5, 0x9b, 0xac, 0x73, 0x54, + 0xae, 0x95, 0x9b, 0x95, 0xa3, 0x72, 0xad, 0xda, 0xdc, 0x32, 0xbf, 0x02, 0xd8, 0x5c, 0x04, 0x77, + 0x9c, 0x44, 0x91, 0xcb, 0xa7, 0xff, 0xf8, 0x04, 0x96, 0x11, 0x14, 0x1f, 0x12, 0xc1, 0x7a, 0xd2, + 0xa5, 0x4d, 0x49, 0x9b, 0x5f, 0x00, 0x34, 0x54, 0x00, 0x59, 0x7d, 0xc2, 0x0e, 0x08, 0x75, 0x43, + 0x72, 0xa6, 0x66, 0x5e, 0x27, 0x38, 0xc1, 0x1b, 0xa8, 0xc0, 0xc6, 0xa3, 0xf1, 0xe0, 0xf6, 0x78, + 0x15, 0xac, 0x17, 0x3b, 0xa5, 0x07, 0x5b, 0xb2, 0x4e, 0xd7, 0xfb, 0x70, 0x31, 0x33, 0xc0, 0xe5, + 0xcc, 0x00, 0x3f, 0x66, 0x06, 0x38, 0x9f, 0x1b, 0x85, 0xcb, 0xb9, 0x51, 0xf8, 0x36, 0x37, 0x0a, + 0xef, 0x0e, 0x02, 0x22, 0x27, 0x89, 0x97, 0xda, 0xb1, 0xf6, 0x36, 0x10, 0x2a, 0xed, 0xec, 0xd5, + 0x88, 0xbd, 0x7b, 0x5e, 0x1d, 0xaf, 0xaa, 0xae, 0xea, 0xe9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xce, 0x6c, 0x36, 0x0c, 0x32, 0x05, 0x00, 0x00, } func (m *StateInfoIndex) Marshal() (dAtA []byte, err error) { @@ -488,11 +479,6 @@ func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if m.NumBlocks != 0 { - i = encodeVarintStateInfo(dAtA, i, uint64(m.NumBlocks)) - i-- - dAtA[i] = 0x20 - } if m.StartHeight != 0 { i = encodeVarintStateInfo(dAtA, i, uint64(m.StartHeight)) i-- @@ -645,9 +631,6 @@ func (m *StateInfo) Size() (n int) { if m.StartHeight != 0 { n += 1 + sovStateInfo(uint64(m.StartHeight)) } - if m.NumBlocks != 0 { - n += 1 + sovStateInfo(uint64(m.NumBlocks)) - } l = len(m.DAPath) if l > 0 { n += 1 + l + sovStateInfo(uint64(l)) @@ -924,25 +907,6 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { break } } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) - } - m.NumBlocks = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStateInfo - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NumBlocks |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) diff --git a/types/pb/dymint/state.pb.go b/types/pb/dymint/state.pb.go index 4b318b849..1cb1dfca9 100644 --- a/types/pb/dymint/state.pb.go +++ b/types/pb/dymint/state.pb.go @@ -195,7 +195,7 @@ func (m *State) GetRollappParams() RollappParams { return RollappParams{} } -// rollapp params defined in genesis and updated via gov proposal +//rollapp params defined in genesis and updated via gov proposal type RollappParams struct { //data availability type (e.g. celestia) used in the rollapp Da string `protobuf:"bytes,1,opt,name=da,proto3" json:"da,omitempty"` From 39bd120be49fa80231aadc3a572877eababf0299 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Fri, 27 Sep 2024 16:50:52 +0200 Subject: [PATCH 2/2] fix for len 0 --- settlement/dymension/utils.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/settlement/dymension/utils.go b/settlement/dymension/utils.go index 06fa71839..00cc5f1cc 100644 --- a/settlement/dymension/utils.go +++ b/settlement/dymension/utils.go @@ -38,10 +38,16 @@ func convertStateInfoToResultRetrieveBatch(stateInfo *rollapptypes.StateInfo) (* if err != nil { return nil, err } + + endHeight := uint64(0) + if len(stateInfo.BDs.BD) > 0 { + endHeight = stateInfo.BDs.BD[len(stateInfo.BDs.BD)-1].Height + } + batchResult := &settlement.Batch{ Sequencer: stateInfo.Sequencer, StartHeight: stateInfo.StartHeight, - EndHeight: stateInfo.BDs.BD[len(stateInfo.BDs.BD)-1].Height, + EndHeight: endHeight, MetaData: &settlement.BatchMetaData{ DA: daMetaData, },