Skip to content

Commit

Permalink
Initialized the settlement client with the proposer upon initializati…
Browse files Browse the repository at this point in the history
…on (#168)

* Initialized the settlement client with the proposer upon initialization and refactored settlement client to be more testable.

* Updated to go.sum

* Removed the local repalcement in the go.mod.

* Udpated dymension version.

* Fixed data race in access to latestHeight.

* Fixed p2p client flaky gossiping test.
  • Loading branch information
omritoptix authored Dec 26, 2022
1 parent 8ec3b08 commit c9cfddf
Show file tree
Hide file tree
Showing 27 changed files with 2,058 additions and 1,057 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ proto/pb
.DS_Store
.vscode
.idea
build
11 changes: 5 additions & 6 deletions block/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestInitialState(t *testing.T) {
logger := log.TestingLogger()
pubsubServer := pubsub.NewServer()
pubsubServer.Start()
settlementlc := slregistry.GetClient(slregistry.ClientMock)
settlementlc := slregistry.GetClient(slregistry.Mock)
_ = settlementlc.Init(nil, pubsubServer, logger)

// Init empty store and full store
Expand Down Expand Up @@ -259,7 +259,7 @@ func getManager(settlementlc settlement.LayerClient, dalc da.DataAvailabilityLay
pubsubServer.Start()

if settlementlc == nil {
settlementlc = slregistry.GetClient(slregistry.ClientMock)
settlementlc = slregistry.GetClient(slregistry.Mock)
}
_ = initSettlementLayerMock(settlementlc, defaultBatchSize, uint64(state.LastBlockHeight), uint64(state.LastBlockHeight)+1, pubsubServer, logger)

Expand Down Expand Up @@ -297,10 +297,9 @@ func initDALCMock(dalc da.DataAvailabilityLayerClient, daBlockTime time.Duration
// TODO(omritoptix): Possible move out to a generic testutil
func initSettlementLayerMock(settlementlc settlement.LayerClient, batchSize uint64, latestHeight uint64, batchOffsetHeight uint64, pubsubServer *pubsub.Server, logger log.Logger) error {
conf := slmock.Config{
AutoUpdateBatches: false,
BatchSize: batchSize,
LatestHeight: latestHeight,
BatchOffsetHeight: batchOffsetHeight,
Config: &settlement.Config{
BatchSize: batchSize,
},
}
byteconf, _ := json.Marshal(conf)
return settlementlc.Init(byteconf, pubsubServer, logger)
Expand Down
81 changes: 0 additions & 81 deletions cmd/commands/init.go

This file was deleted.

97 changes: 0 additions & 97 deletions cmd/commands/root.go

This file was deleted.

Loading

0 comments on commit c9cfddf

Please sign in to comment.