From 1ab3c5e761fee972cbd311a9a2ce136e8f59dcec Mon Sep 17 00:00:00 2001 From: Omri Date: Tue, 6 Dec 2022 16:31:11 +0200 Subject: [PATCH] Support for non aggregator mode (#155) * Changed default value of aggregator to prevent a bug where it's always set as true. * Changed some dymension config flags to be optional for non-aggregator mode. * Fixed a bug where SLStateIndex wouldn't get updated. * Enhanced logging messages on p2p and dymension client. --- config/config.go | 2 +- p2p/client.go | 3 ++ proto/types/dymint/state.proto | 2 +- settlement/dymension.go | 20 +++++-- types/pb/dymint/state.pb.go | 98 +++++++++++++++++----------------- types/serialization.go | 2 + 6 files changed, 71 insertions(+), 56 deletions(-) diff --git a/config/config.go b/config/config.go index 870f30024..3389c7ee4 100644 --- a/config/config.go +++ b/config/config.go @@ -87,7 +87,7 @@ func (nc *NodeConfig) GetViperConfig(v *viper.Viper) error { func AddFlags(cmd *cobra.Command) { def := DefaultNodeConfig - cmd.Flags().Bool(flagAggregator, def.Aggregator, "run node in aggregator mode") + cmd.Flags().Bool(flagAggregator, false, "run node in aggregator mode") cmd.Flags().String(flagDALayer, def.DALayer, "Data Availability Layer Client name (mock or grpc") cmd.Flags().String(flagDAConfig, def.DAConfig, "Data Availability Layer Client config") cmd.Flags().String(flagSettlementLayer, def.SettlementLayer, "Settlement Layer Client name (currently only mock)") diff --git a/p2p/client.go b/p2p/client.go index 1960cd14e..3d74b5694 100644 --- a/p2p/client.go +++ b/p2p/client.go @@ -294,10 +294,13 @@ func (c *Client) findPeers(ctx context.Context) error { // tryConnect attempts to connect to a peer and logs error if necessary func (c *Client) tryConnect(ctx context.Context, peer peer.AddrInfo) { + c.logger.Debug("trying to connect to peer", "peer", peer) err := c.host.Connect(ctx, peer) if err != nil { c.logger.Error("failed to connect to peer", "peer", peer, "error", err) + return } + c.logger.Debug("connected to peer", "peer", peer) } func (c *Client) setupGossiping(ctx context.Context) error { diff --git a/proto/types/dymint/state.proto b/proto/types/dymint/state.proto index b13dd34b9..5b16233f2 100755 --- a/proto/types/dymint/state.proto +++ b/proto/types/dymint/state.proto @@ -22,7 +22,7 @@ message State { tendermint.types.BlockID last_block_id = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "LastBlockID"]; google.protobuf.Timestamp last_block_time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - uint64 da_height = 7 [(gogoproto.customname) = "DAHeight"]; + uint64 sl_state_index = 7 [(gogoproto.customname) = "SLStateIndex"]; tendermint.types.ValidatorSet next_validators = 8; tendermint.types.ValidatorSet validators = 9; diff --git a/settlement/dymension.go b/settlement/dymension.go index d557770c2..87bd5d40b 100644 --- a/settlement/dymension.go +++ b/settlement/dymension.go @@ -68,10 +68,7 @@ func (d *DymensionLayerClient) Init(config []byte, pubsub *pubsub.Server, logger d.ctx, d.cancel = context.WithCancel(context.Background()) client, err := cosmosclient.New( d.ctx, - cosmosclient.WithAddressPrefix(addressPrefix), - cosmosclient.WithNodeAddress(c.NodeAddress), - cosmosclient.WithKeyringBackend(c.KeyringBackend), - cosmosclient.WithHome(c.KeyRingHomeDir), + d.getCosmosClientOptions(d.config)..., ) if err != nil { return err @@ -112,6 +109,19 @@ func (d *DymensionLayerClient) getConfig(config []byte) (*Config, error) { return c, nil } +func (d *DymensionLayerClient) getCosmosClientOptions(c Config) []cosmosclient.Option { + options := []cosmosclient.Option{ + cosmosclient.WithAddressPrefix(addressPrefix), + cosmosclient.WithNodeAddress(d.config.NodeAddress), + } + if d.config.KeyringBackend != "" { + options = append(options, + cosmosclient.WithKeyringBackend(d.config.KeyringBackend), + cosmosclient.WithHome(d.config.KeyRingHomeDir)) + } + return options +} + // Start is called once, after init. It initializes the query client. func (d *DymensionLayerClient) Start() error { d.logger.Debug("settlement Layer Client starting.") @@ -286,7 +296,7 @@ func (d *DymensionLayerClient) SubmitBatch(batch *types.Batch, daClient da.Clien func (d *DymensionLayerClient) RetrieveBatch(stateIndex ...uint64) (*ResultRetrieveBatch, error) { var stateInfo rollapptypes.StateInfo if len(stateIndex) == 0 { - d.logger.Debug("Getting latest batch from settlement layer", "latest height", d.latestHeight) + d.logger.Debug("Getting latest batch from settlement layer") latestStateInfoIndexResp, err := d.rollappQueryClient.LatestStateInfoIndex(d.ctx, &rollapptypes.QueryGetLatestStateInfoIndexRequest{RollappId: d.config.RollappID}) if latestStateInfoIndexResp == nil { diff --git a/types/pb/dymint/state.pb.go b/types/pb/dymint/state.pb.go index 536a896e1..691cafe56 100644 --- a/types/pb/dymint/state.pb.go +++ b/types/pb/dymint/state.pb.go @@ -37,7 +37,7 @@ type State struct { LastBlockHeight int64 `protobuf:"varint,4,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` LastBlockID types.BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` LastBlockTime time.Time `protobuf:"bytes,6,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` - DAHeight uint64 `protobuf:"varint,7,opt,name=da_height,json=daHeight,proto3" json:"da_height,omitempty"` + SLStateIndex uint64 `protobuf:"varint,7,opt,name=sl_state_index,json=slStateIndex,proto3" json:"sl_state_index,omitempty"` NextValidators *types.ValidatorSet `protobuf:"bytes,8,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"` Validators *types.ValidatorSet `protobuf:"bytes,9,opt,name=validators,proto3" json:"validators,omitempty"` LastValidators *types.ValidatorSet `protobuf:"bytes,10,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"` @@ -123,9 +123,9 @@ func (m *State) GetLastBlockTime() time.Time { return time.Time{} } -func (m *State) GetDAHeight() uint64 { +func (m *State) GetSLStateIndex() uint64 { if m != nil { - return m.DAHeight + return m.SLStateIndex } return 0 } @@ -193,45 +193,45 @@ func init() { func init() { proto.RegisterFile("types/dymint/state.proto", fileDescriptor_4b679420add07272) } var fileDescriptor_4b679420add07272 = []byte{ - // 596 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x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0xcc, 0x92, 0x79, 0x60, 0x87, 0x64, - 0xc6, 0xff, 0xab, 0x50, 0xc6, 0x1f, 0xdb, 0xcd, 0xe2, 0x87, 0xfa, 0xe3, 0x2a, 0x1f, 0x7b, 0x50, - 0x7e, 0x07, 0x75, 0x71, 0x47, 0xcf, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x35, 0x36, 0xc0, 0x05, - 0xdf, 0x04, 0x00, 0x00, + // 603 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4d, 0x6f, 0xda, 0x30, + 0x1c, 0xc6, 0xc9, 0x4a, 0x81, 0x9a, 0xb7, 0x2e, 0xdb, 0x21, 0x65, 0x52, 0x48, 0xbb, 0x17, 0xa1, + 0x1d, 0x12, 0x69, 0x95, 0x76, 0xdc, 0x21, 0x54, 0x1a, 0x48, 0x68, 0x9a, 0xc2, 0xd4, 0xc3, 0x2e, + 0x91, 0x93, 0x78, 0x89, 0xb5, 0x10, 0x47, 0xb1, 0xa9, 0x60, 0x1f, 0x60, 0xe7, 0x7e, 0xac, 0x1e, + 0x7b, 0xdc, 0x89, 0x4d, 0xf0, 0x45, 0x26, 0xdb, 0x09, 0xa4, 0x45, 0x48, 0xbd, 0xc5, 0x8f, 0x7f, + 0xff, 0x27, 0x8f, 0xfd, 0xb7, 0x0d, 0x34, 0xb6, 0x4c, 0x11, 0xb5, 0x82, 0xe5, 0x0c, 0x27, 0xcc, + 0xa2, 0x0c, 0x32, 0x64, 0xa6, 0x19, 0x61, 0x44, 0xad, 0x49, 0xad, 0xf7, 0x32, 0x24, 0x21, 0x11, + 0x92, 0xc5, 0xbf, 0xe4, 0x6c, 0xaf, 0x1f, 0x12, 0x12, 0xc6, 0xc8, 0x12, 0x23, 0x6f, 0xfe, 0xc3, + 0x62, 0x78, 0x86, 0x28, 0x83, 0xb3, 0x34, 0x07, 0xce, 0xa5, 0x31, 0x43, 0x49, 0x80, 0x32, 0x61, + 0x0e, 0x3d, 0x1f, 0x5b, 0x42, 0xcd, 0x91, 0x8b, 0x3d, 0x24, 0x17, 0x4a, 0xcc, 0xbb, 0x03, 0xcc, + 0x0d, 0x8c, 0x71, 0x00, 0x19, 0xc9, 0x72, 0xee, 0xf5, 0x01, 0x2e, 0x85, 0x19, 0x9c, 0x1d, 0xfe, + 0xa1, 0x58, 0x70, 0xf9, 0x87, 0x17, 0xbf, 0xeb, 0xe0, 0x78, 0xca, 0x55, 0xf5, 0x12, 0xd4, 0x6f, + 0x50, 0x46, 0x31, 0x49, 0x34, 0xc5, 0x50, 0x06, 0xcd, 0x0f, 0x67, 0xe6, 0xae, 0xd2, 0x94, 0x5b, + 0x75, 0x2d, 0x01, 0xa7, 0x20, 0xd5, 0x33, 0xd0, 0xf0, 0x23, 0x88, 0x13, 0x17, 0x07, 0xda, 0x33, + 0x43, 0x19, 0x9c, 0x38, 0x75, 0x31, 0x1e, 0x07, 0xea, 0x5b, 0xd0, 0xc1, 0x09, 0x66, 0x18, 0xc6, + 0x6e, 0x84, 0x70, 0x18, 0x31, 0xed, 0xc8, 0x50, 0x06, 0x47, 0x4e, 0x3b, 0x57, 0x47, 0x42, 0x54, + 0xdf, 0x83, 0xe7, 0x31, 0xa4, 0xcc, 0xf5, 0x62, 0xe2, 0xff, 0x2c, 0xc8, 0xaa, 0x20, 0xbb, 0x7c, + 0xc2, 0xe6, 0x7a, 0xce, 0x3a, 0xa0, 0x5d, 0x62, 0x71, 0xa0, 0x1d, 0xef, 0x07, 0x95, 0x8b, 0x13, + 0x55, 0xe3, 0x2b, 0xfb, 0xc5, 0xdd, 0xaa, 0x5f, 0x59, 0xaf, 0xfa, 0xcd, 0x49, 0x61, 0x35, 0xbe, + 0x72, 0x9a, 0x5b, 0xdf, 0x71, 0xa0, 0x4e, 0x40, 0xb7, 0xe4, 0xc9, 0xdb, 0xaa, 0xd5, 0x84, 0x6b, + 0xcf, 0x94, 0x3d, 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0x8f, 0x19, 0x75, 0x23, 0x48, 0x23, + 0xad, 0x63, 0x28, 0x83, 0x96, 0x3c, 0xc0, 0x8e, 0xd4, 0x47, 0x90, 0x46, 0xfc, 0xba, 0xc0, 0x34, + 0x95, 0x48, 0x57, 0x20, 0x75, 0x98, 0xa6, 0x7c, 0xca, 0x1e, 0xdd, 0xad, 0x75, 0xe5, 0x7e, 0xad, + 0x2b, 0xff, 0xd6, 0xba, 0x72, 0xbb, 0xd1, 0x2b, 0xf7, 0x1b, 0xbd, 0xf2, 0x67, 0xa3, 0x57, 0xbe, + 0x9b, 0x21, 0x66, 0xd1, 0xdc, 0x33, 0x7d, 0x32, 0xe3, 0x0f, 0x17, 0x4a, 0xf8, 0xcd, 0x5b, 0x2c, + 0x7f, 0x15, 0xaf, 0x58, 0x7e, 0xf3, 0xbd, 0x7c, 0xec, 0xd5, 0xc4, 0x81, 0xbd, 0xfc, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0xcb, 0x3d, 0x3d, 0x1d, 0xec, 0x04, 0x00, 0x00, } func (m *State) Marshal() (dAtA []byte, err error) { @@ -324,8 +324,8 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x42 } - if m.DAHeight != 0 { - i = encodeVarintState(dAtA, i, uint64(m.DAHeight)) + if m.SLStateIndex != 0 { + i = encodeVarintState(dAtA, i, uint64(m.SLStateIndex)) i-- dAtA[i] = 0x38 } @@ -414,8 +414,8 @@ func (m *State) Size() (n int) { n += 1 + l + sovState(uint64(l)) l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime) n += 1 + l + sovState(uint64(l)) - if m.DAHeight != 0 { - n += 1 + sovState(uint64(m.DAHeight)) + if m.SLStateIndex != 0 { + n += 1 + sovState(uint64(m.SLStateIndex)) } if m.NextValidators != nil { l = m.NextValidators.Size() @@ -657,9 +657,9 @@ func (m *State) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 7: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DAHeight", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SLStateIndex", wireType) } - m.DAHeight = 0 + m.SLStateIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowState @@ -669,7 +669,7 @@ func (m *State) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DAHeight |= uint64(b&0x7F) << shift + m.SLStateIndex |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/types/serialization.go b/types/serialization.go index 28ab6bdb8..63164625f 100644 --- a/types/serialization.go +++ b/types/serialization.go @@ -243,6 +243,7 @@ func (s *State) ToProto() (*pb.State, error) { ChainId: s.ChainID, InitialHeight: s.InitialHeight, LastBlockHeight: s.LastBlockHeight, + SLStateIndex: s.SLStateIndex, LastBlockID: s.LastBlockID.ToProto(), LastBlockTime: s.LastBlockTime, NextValidators: nextValidators, @@ -263,6 +264,7 @@ func (s *State) FromProto(other *pb.State) error { s.ChainID = other.ChainId s.InitialHeight = other.InitialHeight s.LastBlockHeight = other.LastBlockHeight + s.SLStateIndex = other.SLStateIndex lastBlockID, err := types.BlockIDFromProto(&other.LastBlockID) if err != nil { return err