style: general linting (#15756)
This commit is contained in:
@@ -47,7 +47,7 @@ type CometStarter struct {
|
||||
// NewCometStarter accepts a minimal set of arguments to start comet with an ABCI app.
|
||||
// For further configuration, chain other CometStarter methods before calling Start:
|
||||
//
|
||||
// NewCometStarter(...).Logger(...).Start()
|
||||
// NewCometStarter(...).Logger(...).Start()
|
||||
func NewCometStarter(
|
||||
app abcitypes.Application,
|
||||
cfg *cmtcfg.Config,
|
||||
@@ -169,7 +169,6 @@ func (s *CometStarter) Start() (n *node.Node, err error) {
|
||||
node.DefaultMetricsProvider(s.cfg.Instrumentation),
|
||||
servercmtlog.CometZeroLogWrapper{Logger: s.logger},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create comet node: %w", err)
|
||||
}
|
||||
@@ -207,7 +206,7 @@ func (s *CometStarter) initDisk() (cmttypes.PrivValidator, *p2p.NodeKey, error)
|
||||
fpv := privval.NewFilePV(s.valPrivKey, s.cfg.PrivValidatorKeyFile(), s.cfg.PrivValidatorStateFile())
|
||||
fpv.Save()
|
||||
|
||||
if err := os.WriteFile(s.cfg.GenesisFile(), s.genesis, 0600); err != nil {
|
||||
if err := os.WriteFile(s.cfg.GenesisFile(), s.genesis, 0o600); err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to write genesis file: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/tx"
|
||||
|
||||
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
@@ -110,18 +110,16 @@ func (b *GenesisBuilder) GenTx(privVal secp256k1.PrivKey, val cmttypes.GenesisVa
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
|
||||
_, err = sdk.ValAddressFromBech32(msg.ValidatorAddress)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
msg.DelegatorAddress = sdk.AccAddress(valAddr).String()
|
||||
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
txConf := authtx.NewTxConfig(b.codec, tx.DefaultSignModes)
|
||||
txConf := authtx.NewTxConfig(b.codec, authtx.DefaultSignModes)
|
||||
|
||||
txb := txConf.NewTxBuilder()
|
||||
if err := txb.SetMsgs(msg); err != nil {
|
||||
@@ -456,13 +454,13 @@ func (b *GenesisBuilder) DefaultDistribution() *GenesisBuilder {
|
||||
// JSON returns the map of the genesis after applying some final transformations.
|
||||
func (b *GenesisBuilder) JSON() map[string]json.RawMessage {
|
||||
gentxGenesisState := genutiltypes.NewGenesisStateFromTx(
|
||||
authtx.NewTxConfig(b.codec, tx.DefaultSignModes).TxJSONEncoder(),
|
||||
authtx.NewTxConfig(b.codec, authtx.DefaultSignModes).TxJSONEncoder(),
|
||||
b.gentxs,
|
||||
)
|
||||
|
||||
if err := genutiltypes.ValidateGenesis(
|
||||
gentxGenesisState,
|
||||
authtx.NewTxConfig(b.codec, tx.DefaultSignModes).TxJSONDecoder(),
|
||||
authtx.NewTxConfig(b.codec, authtx.DefaultSignModes).TxJSONDecoder(),
|
||||
genutiltypes.DefaultMessageValidator,
|
||||
); err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -3,7 +3,6 @@ package testnet_test
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -83,7 +82,6 @@ func TestGenesisBuilder_ChainID(t *testing.T) {
|
||||
_, ok := m["chain_id"]
|
||||
require.False(t, ok)
|
||||
|
||||
m = gb.ChainID("my-chain").JSON()
|
||||
var id string
|
||||
require.NoError(
|
||||
t,
|
||||
@@ -98,8 +96,6 @@ func TestGenesisBuilder_ChainID(t *testing.T) {
|
||||
// Use known keys and addresses to assert that correct validator and delegator keys
|
||||
// occur in the expected locations (i.e. we didn't mistakenly swap the keys anywhere).
|
||||
func TestGenesisBuilder_GentxAddresses(t *testing.T) {
|
||||
const chainID = "simapp-chain"
|
||||
|
||||
const valSecret0 = "val-secret-0"
|
||||
const valAddr0 = "3F3B076353767F046477A6E0982F808C24D1870A"
|
||||
const valPubKey0 = "ZhVhrOUHnUwYw/GlBSBrw/0X6A261gchCRYkAxGF2jk="
|
||||
@@ -206,14 +202,6 @@ func TestGenesisBuilder_GentxAddresses(t *testing.T) {
|
||||
require.Equal(t, gentxs[0].Body.Messages[0].PubKey.Key, valPubKey0)
|
||||
require.Equal(t, gentxs[0].AuthInfo.SignerInfos[0].PublicKey.Key, delPubKey0)
|
||||
|
||||
// Delegator is derived from the secp256k1 key, not the ed25519 key.
|
||||
require.Equal(t, gentxs[0].Body.Messages[0].DelegatorAddress, delAccAddr0)
|
||||
|
||||
// The validator address must match the delegator address.
|
||||
_, parsedValAddr, err := bech32.DecodeAndConvert(gentxs[0].Body.Messages[0].DelegatorAddress)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, fmt.Sprintf("%X", parsedValAddr), delAddr0)
|
||||
|
||||
// The only base account in this genesis, matches the secp256k1 key.
|
||||
acct := g.AppState.Auth.Accounts[0]
|
||||
require.Equal(t, acct.Address, delAccAddr0)
|
||||
|
||||
Reference in New Issue
Block a user