Compare commits

...

7 Commits

Author SHA1 Message Date
Sam Ricotta
03d2ace0ef test downgrade to linter 2022-08-10 16:42:50 +02:00
dependabot[bot]
65367d7e94 build(deps): Bump github.com/golangci/golangci-lint (#9188)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.47.2 to 1.48.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.47.2...v1.48.0)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-08 09:35:03 -04:00
William Banfield
c72335712b remove old proto workflow (#9167) 2022-08-04 12:32:48 -04:00
Callum Waters
fb5cd16de2 config: p2p.external-address (backport #9107) (#9153) 2022-08-02 15:19:30 -04:00
Callum Waters
708a62fc31 backport: Fix unsafe-reset-all for working with default home (#9103) (#9113) 2022-08-01 17:35:22 +02:00
dependabot[bot]
7e902dc79a build(deps): Bump github.com/bufbuild/buf from 1.4.0 to 1.7.0 (#9137) 2022-08-01 09:25:13 +02:00
Callum Waters
0846f3e4c7 fix mockery generation script (#9094) (#9114) 2022-07-30 16:31:04 +02:00
35 changed files with 1278 additions and 126 deletions

View File

@@ -7,7 +7,7 @@ name: Check generated code
on:
pull_request:
branches:
- v0.34.x
- main
permissions:
contents: read

View File

@@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.16'
go-version: '^1.18'
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
@@ -26,7 +26,7 @@ jobs:
- uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.45
version: v1.42.1
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: env.GIT_DIFF

View File

@@ -1,22 +0,0 @@
name: Protobuf
# Protobuf runs buf (https://buf.build/) lint and check-breakage
# This workflow is only run when a .proto file has been modified
on:
pull_request:
paths:
- "**.proto"
jobs:
proto-lint:
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v3
- name: lint
run: make proto-lint
proto-breakage:
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v3
- name: check-breakage
run: make proto-check-breaking-ci

View File

@@ -21,7 +21,10 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
### FEATURES
- [#9083] backport cli command to reindex missed events (@cmwaters)
- [cli] \#9107 Add the `p2p.external-address` argument to set the node P2P external address (@amimart)
### IMPROVEMENTS
### BUG FIXES
- [#9103] fix unsafe-reset-all for working with home path (@rootwarp)

View File

@@ -74,9 +74,9 @@ install:
### Mocks ###
###############################################################################
mockery:
mockery:
go generate -run="./scripts/mockery_generate.sh" ./...
.PHONY: mockery
.PHONY: mockery
###############################################################################
### Protobuf ###

View File

@@ -29,7 +29,7 @@ var ResetStateCmd = &cobra.Command{
Short: "Remove all the data and WAL",
PreRun: deprecateSnakeCase,
RunE: func(cmd *cobra.Command, args []string) (err error) {
config, err = ParseConfig()
config, err = ParseConfig(cmd)
if err != nil {
return err
}
@@ -54,7 +54,7 @@ var ResetPrivValidatorCmd = &cobra.Command{
// XXX: this is totally unsafe.
// it's only suitable for testnets.
func resetAllCmd(cmd *cobra.Command, args []string) (err error) {
config, err = ParseConfig()
config, err = ParseConfig(cmd)
if err != nil {
return err
}
@@ -71,7 +71,7 @@ func resetAllCmd(cmd *cobra.Command, args []string) (err error) {
// XXX: this is totally unsafe.
// it's only suitable for testnets.
func resetPrivValidator(cmd *cobra.Command, args []string) (err error) {
config, err = ParseConfig()
config, err = ParseConfig(cmd)
if err != nil {
return err
}

View File

@@ -29,12 +29,25 @@ func registerFlagsRootCmd(cmd *cobra.Command) {
// ParseConfig retrieves the default environment configuration,
// sets up the Tendermint root and ensures that the root exists
func ParseConfig() (*cfg.Config, error) {
func ParseConfig(cmd *cobra.Command) (*cfg.Config, error) {
conf := cfg.DefaultConfig()
err := viper.Unmarshal(conf)
if err != nil {
return nil, err
}
var home string
if os.Getenv("TMHOME") != "" {
home = os.Getenv("TMHOME")
} else {
home, err = cmd.Flags().GetString(cli.HomeFlag)
if err != nil {
return nil, err
}
}
conf.RootDir = home
conf.SetRoot(conf.RootDir)
cfg.EnsureRoot(conf.RootDir)
if err := conf.ValidateBasic(); err != nil {
@@ -52,7 +65,7 @@ var RootCmd = &cobra.Command{
return nil
}
config, err = ParseConfig()
config, err = ParseConfig(cmd)
if err != nil {
return err
}

View File

@@ -63,6 +63,8 @@ func AddNodeFlags(cmd *cobra.Command) {
"p2p.laddr",
config.P2P.ListenAddress,
"node listen address. (0.0.0.0:0 means any interface, any port)")
cmd.Flags().String("p2p.external-address",
config.P2P.ExternalAddress, "ip:port address to advertise to peers for them to dial")
cmd.Flags().String("p2p.seeds", config.P2P.Seeds, "comma-delimited ID@host:port seed nodes")
cmd.Flags().String("p2p.persistent_peers", config.P2P.PersistentPeers, "comma-delimited ID@host:port persistent peers")
cmd.Flags().String("p2p.unconditional_peer_ids",

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -58,13 +58,13 @@ func (_m *BlockStore) LoadBlockMeta(height int64) *types.BlockMeta {
return r0
}
type mockConstructorTestingTNewBlockStore interface {
type NewBlockStoreT interface {
mock.TestingT
Cleanup(func())
}
// NewBlockStore creates a new instance of BlockStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewBlockStore(t mockConstructorTestingTNewBlockStore) *BlockStore {
func NewBlockStore(t NewBlockStoreT) *BlockStore {
mock := &BlockStore{}
mock.Mock.Test(t)

View File

@@ -4,7 +4,7 @@ import (
"github.com/tendermint/tendermint/types"
)
//go:generate mockery --case underscore --name BlockStore
//go:generate ../scripts/mockery_generate.sh BlockStore
type BlockStore interface {
LoadBlockMeta(height int64) *types.BlockMeta

8
go.mod
View File

@@ -21,7 +21,6 @@ require (
github.com/golang/protobuf v1.5.2
github.com/google/orderedcode v0.0.1
github.com/gorilla/websocket v1.5.0
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/gtank/merlin v0.1.1
github.com/lib/pq v1.10.6
github.com/libp2p/go-buffer-pool v0.1.0
@@ -38,15 +37,14 @@ require (
github.com/stretchr/testify v1.8.0
github.com/tendermint/tm-db v0.6.6
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9
golang.org/x/net v0.0.0-20220726230323-06994584191e
google.golang.org/grpc v1.48.0
gotest.tools v2.2.0+incompatible // indirect
)
require (
github.com/bufbuild/buf v1.4.0
github.com/bufbuild/buf v1.7.0
github.com/creachadair/taskgroup v0.3.2
github.com/golangci/golangci-lint v1.47.2
github.com/golangci/golangci-lint v1.48.0
github.com/prometheus/common v0.34.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca
github.com/vektra/mockery/v2 v2.14.0

1211
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,7 @@ var errNegOrZeroHeight = errors.New("negative or zero height")
type KeyPathFunc func(path string, key []byte) (merkle.KeyPath, error)
// LightClient is an interface that contains functionality needed by Client from the light client.
//go:generate mockery --case underscore --name LightClient
//go:generate ../../scripts/mockery_generate.sh LightClient
type LightClient interface {
ChainID() string
Update(ctx context.Context, now time.Time) (*types.LightBlock, error)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -100,13 +100,13 @@ func (_m *LightClient) VerifyLightBlockAtHeight(ctx context.Context, height int6
return r0, r1
}
type mockConstructorTestingTNewLightClient interface {
type NewLightClientT interface {
mock.TestingT
Cleanup(func())
}
// NewLightClient creates a new instance of LightClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewLightClient(t mockConstructorTestingTNewLightClient) *LightClient {
func NewLightClient(t NewLightClientT) *LightClient {
mock := &LightClient{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -330,13 +330,13 @@ func (_m *Peer) TrySend(_a0 byte, _a1 []byte) bool {
return r0
}
type mockConstructorTestingTNewPeer interface {
type NewPeerT interface {
mock.TestingT
Cleanup(func())
}
// NewPeer creates a new instance of Peer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewPeer(t mockConstructorTestingTNewPeer) *Peer {
func NewPeer(t NewPeerT) *Peer {
mock := &Peer{}
mock.Mock.Test(t)

View File

@@ -12,7 +12,7 @@ import (
tmconn "github.com/tendermint/tendermint/p2p/conn"
)
//go:generate mockery --case underscore --name Peer
//go:generate ../scripts/mockery_generate.sh Peer
const metricsTickerDuration = 10 * time.Second

View File

@@ -5,7 +5,7 @@ import (
"github.com/tendermint/tendermint/abci/types"
)
//go:generate mockery --case underscore --name AppConnConsensus|AppConnMempool|AppConnQuery|AppConnSnapshot
//go:generate ../scripts/mockery_generate.sh AppConnConsensus|AppConnMempool|AppConnQuery|AppConnSnapshot
//----------------------------------------------------------------------------------------
// Enforce which abci msgs can be sent on a connection at the type level

View File

@@ -11,6 +11,8 @@ import (
e2e "github.com/tendermint/tendermint/test/e2e/app"
)
//go:generate ../scripts/mockery_generate.sh ClientCreator
// ClientCreator creates new ABCI clients.
type ClientCreator interface {
// NewABCIClient returns a new ABCI client.

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -141,13 +141,13 @@ func (_m *AppConnConsensus) SetResponseCallback(_a0 abcicli.Callback) {
_m.Called(_a0)
}
type mockConstructorTestingTNewAppConnConsensus interface {
type NewAppConnConsensusT interface {
mock.TestingT
Cleanup(func())
}
// NewAppConnConsensus creates a new instance of AppConnConsensus. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewAppConnConsensus(t mockConstructorTestingTNewAppConnConsensus) *AppConnConsensus {
func NewAppConnConsensus(t NewAppConnConsensusT) *AppConnConsensus {
mock := &AppConnConsensus{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -102,13 +102,13 @@ func (_m *AppConnMempool) SetResponseCallback(_a0 abcicli.Callback) {
_m.Called(_a0)
}
type mockConstructorTestingTNewAppConnMempool interface {
type NewAppConnMempoolT interface {
mock.TestingT
Cleanup(func())
}
// NewAppConnMempool creates a new instance of AppConnMempool. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewAppConnMempool(t mockConstructorTestingTNewAppConnMempool) *AppConnMempool {
func NewAppConnMempool(t NewAppConnMempoolT) *AppConnMempool {
mock := &AppConnMempool{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -96,13 +96,13 @@ func (_m *AppConnQuery) QuerySync(_a0 types.RequestQuery) (*types.ResponseQuery,
return r0, r1
}
type mockConstructorTestingTNewAppConnQuery interface {
type NewAppConnQueryT interface {
mock.TestingT
Cleanup(func())
}
// NewAppConnQuery creates a new instance of AppConnQuery. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewAppConnQuery(t mockConstructorTestingTNewAppConnQuery) *AppConnQuery {
func NewAppConnQuery(t NewAppConnQueryT) *AppConnQuery {
mock := &AppConnQuery{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -119,13 +119,13 @@ func (_m *AppConnSnapshot) OfferSnapshotSync(_a0 types.RequestOfferSnapshot) (*t
return r0, r1
}
type mockConstructorTestingTNewAppConnSnapshot interface {
type NewAppConnSnapshotT interface {
mock.TestingT
Cleanup(func())
}
// NewAppConnSnapshot creates a new instance of AppConnSnapshot. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewAppConnSnapshot(t mockConstructorTestingTNewAppConnSnapshot) *AppConnSnapshot {
func NewAppConnSnapshot(t NewAppConnSnapshotT) *AppConnSnapshot {
mock := &AppConnSnapshot{}
mock.Mock.Test(t)

View File

@@ -1,10 +1,9 @@
// Code generated by mockery v1.1.1. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
abcicli "github.com/tendermint/tendermint/abci/client"
)
@@ -35,3 +34,18 @@ func (_m *ClientCreator) NewABCIClient() (abcicli.Client, error) {
return r0, r1
}
type NewClientCreatorT interface {
mock.TestingT
Cleanup(func())
}
// NewClientCreator creates a new instance of ClientCreator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewClientCreator(t NewClientCreatorT) *ClientCreator {
mock := &ClientCreator{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

15
scripts/mockery_generate.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
#
# Invoke Mockery v2 to update generated mocks for the given type.
#
# This script runs a locally-installed "mockery" if available, otherwise it
# runs the published Docker container. This legerdemain is so that the CI build
# and a local build can work off the same script.
#
if ! which mockery ; then
mockery() {
docker run --rm -v "$PWD":/w --workdir=/w vektra/mockery:v2.12.3
}
fi
mockery --disable-version-string --case underscore --name "$@"

View File

@@ -7,7 +7,7 @@ import (
"github.com/tendermint/tendermint/types"
)
//go:generate mockery --case underscore --name BlockIndexer
//go:generate ../../scripts/mockery_generate.sh BlockIndexer
// BlockIndexer defines an interface contract for indexing block events.
type BlockIndexer interface {

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.12.3. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -193,13 +193,13 @@ func (_m *BlockStore) Size() int64 {
return r0
}
type mockConstructorTestingTNewBlockStore interface {
type NewBlockStoreT interface {
mock.TestingT
Cleanup(func())
}
// NewBlockStore creates a new instance of BlockStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewBlockStore(t mockConstructorTestingTNewBlockStore) *BlockStore {
func NewBlockStore(t NewBlockStoreT) *BlockStore {
mock := &BlockStore{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -70,13 +70,13 @@ func (_m *EvidencePool) Update(_a0 state.State, _a1 types.EvidenceList) {
_m.Called(_a0, _a1)
}
type mockConstructorTestingTNewEvidencePool interface {
type NewEvidencePoolT interface {
mock.TestingT
Cleanup(func())
}
// NewEvidencePool creates a new instance of EvidencePool. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewEvidencePool(t mockConstructorTestingTNewEvidencePool) *EvidencePool {
func NewEvidencePool(t NewEvidencePoolT) *EvidencePool {
mock := &EvidencePool{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -218,13 +218,13 @@ func (_m *Store) SaveABCIResponses(_a0 int64, _a1 *tendermintstate.ABCIResponses
return r0
}
type mockConstructorTestingTNewStore interface {
type NewStoreT interface {
mock.TestingT
Cleanup(func())
}
// NewStore creates a new instance of Store. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewStore(t mockConstructorTestingTNewStore) *Store {
func NewStore(t NewStoreT) *Store {
mock := &Store{}
mock.Mock.Test(t)

View File

@@ -12,7 +12,7 @@ import (
//------------------------------------------------------
// blockstore
//go:generate mockery --case underscore --name BlockStore
//go:generate ../scripts/mockery_generate.sh BlockStore
// BlockStore defines the interface used by the ConsensusState.
type BlockStore interface {
@@ -38,7 +38,7 @@ type BlockStore interface {
//-----------------------------------------------------------------------------
// evidence pool
//go:generate mockery --case underscore --name EvidencePool
//go:generate ../scripts/mockery_generate.sh EvidencePool
// EvidencePool defines the EvidencePool interface used by State.
type EvidencePool interface {

View File

@@ -39,7 +39,7 @@ func calcABCIResponsesKey(height int64) []byte {
//----------------------
//go:generate mockery --case underscore --name Store
//go:generate ../scripts/mockery_generate.sh Store
// Store defines the state store interface
//

View File

@@ -10,7 +10,7 @@ import (
// XXX/TODO: These types should be moved to the indexer package.
//go:generate mockery --case underscore --name TxIndexer
//go:generate ../../scripts/mockery_generate.sh TxIndexer
// TxIndexer interface defines methods to index and search transactions.
type TxIndexer interface {

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.12.3. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
// Code generated by mockery. DO NOT EDIT.
package mocks
@@ -83,13 +83,13 @@ func (_m *StateProvider) State(ctx context.Context, height uint64) (state.State,
return r0, r1
}
type mockConstructorTestingTNewStateProvider interface {
type NewStateProviderT interface {
mock.TestingT
Cleanup(func())
}
// NewStateProvider creates a new instance of StateProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewStateProvider(t mockConstructorTestingTNewStateProvider) *StateProvider {
func NewStateProvider(t NewStateProviderT) *StateProvider {
mock := &StateProvider{}
mock.Mock.Test(t)

View File

@@ -22,7 +22,7 @@ import (
"github.com/tendermint/tendermint/version"
)
//go:generate mockery --case underscore --name StateProvider
//go:generate ../scripts/mockery_generate.sh StateProvider
// StateProvider is a provider of trusted state data for bootstrapping a node. This refers
// to the state.State object, not the state machine.