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

Add support for genesis sub commands #384

Merged
merged 4 commits into from
Mar 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove UsingNewGenesisCommand from chainspec + add test
gjermundgaraba committed Feb 23, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 8d829262478eaa1f1094b63a0e5b44f1ada63b5e
11 changes: 4 additions & 7 deletions chainspec.go
Original file line number Diff line number Diff line change
@@ -28,11 +28,10 @@ type ChainSpec struct {
// Must be set.
Version string

// GasAdjustment, NoHostMount and UsingNewGenesisCommand are pointers in ChainSpec
// GasAdjustment and NoHostMount are pointers in ChainSpec
// so zero-overrides can be detected from omitted overrides.
GasAdjustment *float64
NoHostMount *bool
UsingNewGenesisCommand *bool
GasAdjustment *float64
NoHostMount *bool

// Embedded ChainConfig to allow for simple JSON definition of a ChainSpec.
ibc.ChainConfig
@@ -142,9 +141,7 @@ func (s *ChainSpec) applyConfigOverrides(cfg ibc.ChainConfig) (*ibc.ChainConfig,
if s.ModifyGenesis != nil {
cfg.ModifyGenesis = s.ModifyGenesis
}
if s.UsingNewGenesisCommand != nil {
cfg.UsingNewGenesisCommand = *s.UsingNewGenesisCommand
}
cfg.UsingNewGenesisCommand = s.UsingNewGenesisCommand

// Set the version depending on the chain type.
switch cfg.Type {
12 changes: 12 additions & 0 deletions chainspec_test.go
Original file line number Diff line number Diff line change
@@ -133,6 +133,18 @@ func TestChainSpec_Config(t *testing.T) {

require.Equal(t, m, cfg.NoHostMount)
})

t.Run("UsingNewGenesisCommand", func(t *testing.T) {
require.False(t, baseCfg.UsingNewGenesisCommand)

s := baseSpec
s.UsingNewGenesisCommand = true

cfg, err := s.Config(zaptest.NewLogger(t))
require.NoError(t, err)

require.True(t, cfg.UsingNewGenesisCommand)
})
})

t.Run("error cases", func(t *testing.T) {