Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor dymint config to support loading configuration from file #326

Prev Previous commit
Next Next commit
Merge branch 'main' into mtsitrin/325-refactor-dymint-config-to-suppo…
…rt-loading-configuration-from-file
  • Loading branch information
mtsitrin committed May 21, 2023
commit 1ca78051bfdafa10a81bb26474e6bad5a70f2141
1 change: 1 addition & 0 deletions block/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"crypto/rand"
"encoding/hex"
"errors"
"sync/atomic"
"testing"
"time"
Expand Down
33 changes: 5 additions & 28 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package node
import (
"context"
"crypto/rand"
"encoding/hex"
"errors"
"testing"
"time"

"github.com/dymensionxyz/dymint/da"
"github.com/dymensionxyz/dymint/node/events"
"github.com/dymensionxyz/dymint/mempool"
"github.com/dymensionxyz/dymint/node/events"
"github.com/dymensionxyz/dymint/settlement"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
Expand All @@ -30,29 +32,8 @@ func TestStartup(t *testing.T) {
assert := assert.New(t)
require := require.New(t)

app := &mocks.Application{}
app.On("InitChain", mock.Anything).Return(abci.ResponseInitChain{})
key, _, err := crypto.GenerateEd25519Key(rand.Reader)
require.NoError(err)

signingKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
require.NoError(err)

// TODO(omritoptix): Test with and without aggregator mode.

nodeConfig := config.NodeConfig{
RootDir: "",
DBPath: "",
P2P: config.P2PConfig{},
RPC: config.RPCConfig{},
Aggregator: false,
BlockManagerConfig: config.BlockManagerConfig{BatchSyncInterval: time.Second * 5, BlockTime: 100 * time.Millisecond},
DALayer: "mock",
DAConfig: "",
SettlementLayer: "mock",
SettlementConfig: settlement.Config{},
}
node, err := NewNode(context.Background(), nodeConfig, key, signingKey, proxy.NewLocalClientCreator(app), &types.GenesisDoc{ChainID: "test"}, log.TestingLogger())
node, err := createNode()
require.NoError(err)
require.NotNil(node)

Expand Down Expand Up @@ -226,10 +207,6 @@ func createNode() (node *Node, err error) {
signingKey, pubkey, _ := crypto.GenerateEd25519Key(rand.Reader)
// TODO(omritoptix): Test with and without aggregator mode.
pubkeyBytes, _ := pubkey.Raw()
mockConfigFmt := `
{"proposer_pub_key": "%s"}
`
mockConfig := fmt.Sprintf(mockConfigFmt, hex.EncodeToString(pubkeyBytes))
nodeConfig := config.NodeConfig{
RootDir: "",
DBPath: "",
Expand All @@ -240,7 +217,7 @@ func createNode() (node *Node, err error) {
DALayer: "mock",
DAConfig: "",
SettlementLayer: "mock",
SettlementConfig: mockConfig,
SettlementConfig: settlement.Config{ProposerPubKey: hex.EncodeToString(pubkeyBytes)},
}
node, err = NewNode(context.Background(), nodeConfig, key, signingKey, proxy.NewLocalClientCreator(app), &types.GenesisDoc{ChainID: "test"}, log.TestingLogger())
if err != nil {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.