mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-05 19:40:44 +00:00
proxy: collapse triforcated client
This commit is contained in:
20
node/node.go
20
node/node.go
@@ -159,7 +159,7 @@ func makeNode(
|
||||
nodeMetrics := defaultMetricsProvider(cfg.Instrumentation)(genDoc.ChainID)
|
||||
|
||||
// Create the proxyApp and establish connections to the ABCI app (consensus, mempool, query).
|
||||
proxyApp := proxy.NewAppConns(clientCreator, logger.With("module", "proxy"), nodeMetrics.proxy)
|
||||
proxyApp := proxy.New(clientCreator, logger.With("module", "proxy"), nodeMetrics.proxy)
|
||||
if err := proxyApp.Start(ctx); err != nil {
|
||||
return nil, fmt.Errorf("error starting proxy app connections: %w", err)
|
||||
}
|
||||
@@ -289,7 +289,7 @@ func makeNode(
|
||||
blockExec := sm.NewBlockExecutor(
|
||||
stateStore,
|
||||
logger.With("module", "state"),
|
||||
proxyApp.Consensus(),
|
||||
proxyApp,
|
||||
mp,
|
||||
evPool,
|
||||
blockStore,
|
||||
@@ -343,8 +343,8 @@ func makeNode(
|
||||
genDoc.InitialHeight,
|
||||
*cfg.StateSync,
|
||||
logger.With("module", "statesync"),
|
||||
proxyApp.Snapshot(),
|
||||
proxyApp.Query(),
|
||||
proxyApp,
|
||||
proxyApp,
|
||||
router.OpenChannel,
|
||||
peerManager.Subscribe(ctx),
|
||||
stateStore,
|
||||
@@ -394,11 +394,7 @@ func makeNode(
|
||||
shutdownOps: makeCloser(closers),
|
||||
|
||||
rpcEnv: &rpccore.Environment{
|
||||
ProxyAppQuery: proxyApp.Query(),
|
||||
ProxyAppMempool: proxyApp.Mempool(),
|
||||
|
||||
StateStore: stateStore,
|
||||
BlockStore: blockStore,
|
||||
ProxyApp: proxyApp,
|
||||
EvidencePool: evPool,
|
||||
ConsensusState: csState,
|
||||
|
||||
@@ -769,14 +765,14 @@ func loadStateFromDBOrGenesisDocProvider(
|
||||
return state, nil
|
||||
}
|
||||
|
||||
func getRouterConfig(conf *config.Config, proxyApp proxy.AppConns) p2p.RouterOptions {
|
||||
func getRouterConfig(conf *config.Config, proxyApp abciclient.Client) p2p.RouterOptions {
|
||||
opts := p2p.RouterOptions{
|
||||
QueueType: conf.P2P.QueueType,
|
||||
}
|
||||
|
||||
if conf.FilterPeers && proxyApp != nil {
|
||||
opts.FilterPeerByID = func(ctx context.Context, id types.NodeID) error {
|
||||
res, err := proxyApp.Query().Query(ctx, abci.RequestQuery{
|
||||
res, err := proxyApp.Query(ctx, abci.RequestQuery{
|
||||
Path: fmt.Sprintf("/p2p/filter/id/%s", id),
|
||||
})
|
||||
if err != nil {
|
||||
@@ -790,7 +786,7 @@ func getRouterConfig(conf *config.Config, proxyApp proxy.AppConns) p2p.RouterOpt
|
||||
}
|
||||
|
||||
opts.FilterPeerByIP = func(ctx context.Context, ip net.IP, port uint16) error {
|
||||
res, err := proxyApp.Query().Query(ctx, abci.RequestQuery{
|
||||
res, err := proxyApp.Query(ctx, abci.RequestQuery{
|
||||
Path: fmt.Sprintf("/p2p/filter/addr/%s", net.JoinHostPort(ip.String(), strconv.Itoa(int(port)))),
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -274,7 +274,7 @@ func TestCreateProposalBlock(t *testing.T) {
|
||||
logger := log.NewNopLogger()
|
||||
|
||||
cc := abciclient.NewLocalCreator(kvstore.NewApplication())
|
||||
proxyApp := proxy.NewAppConns(cc, logger, proxy.NopMetrics())
|
||||
proxyApp := proxy.New(cc, logger, proxy.NopMetrics())
|
||||
err = proxyApp.Start(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -291,7 +291,7 @@ func TestCreateProposalBlock(t *testing.T) {
|
||||
mp := mempool.NewTxMempool(
|
||||
logger.With("module", "mempool"),
|
||||
cfg.Mempool,
|
||||
proxyApp.Mempool(),
|
||||
proxyApp,
|
||||
state.LastBlockHeight,
|
||||
)
|
||||
|
||||
@@ -328,7 +328,7 @@ func TestCreateProposalBlock(t *testing.T) {
|
||||
blockExec := sm.NewBlockExecutor(
|
||||
stateStore,
|
||||
logger,
|
||||
proxyApp.Consensus(),
|
||||
proxyApp,
|
||||
mp,
|
||||
evidencePool,
|
||||
blockStore,
|
||||
@@ -373,7 +373,7 @@ func TestMaxTxsProposalBlockSize(t *testing.T) {
|
||||
logger := log.NewNopLogger()
|
||||
|
||||
cc := abciclient.NewLocalCreator(kvstore.NewApplication())
|
||||
proxyApp := proxy.NewAppConns(cc, logger, proxy.NopMetrics())
|
||||
proxyApp := proxy.New(cc, logger, proxy.NopMetrics())
|
||||
err = proxyApp.Start(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -391,7 +391,7 @@ func TestMaxTxsProposalBlockSize(t *testing.T) {
|
||||
mp := mempool.NewTxMempool(
|
||||
logger.With("module", "mempool"),
|
||||
cfg.Mempool,
|
||||
proxyApp.Mempool(),
|
||||
proxyApp,
|
||||
state.LastBlockHeight,
|
||||
)
|
||||
|
||||
@@ -404,7 +404,7 @@ func TestMaxTxsProposalBlockSize(t *testing.T) {
|
||||
blockExec := sm.NewBlockExecutor(
|
||||
stateStore,
|
||||
logger,
|
||||
proxyApp.Consensus(),
|
||||
proxyApp,
|
||||
mp,
|
||||
sm.EmptyEvidencePool{},
|
||||
blockStore,
|
||||
@@ -441,7 +441,7 @@ func TestMaxProposalBlockSize(t *testing.T) {
|
||||
logger := log.NewNopLogger()
|
||||
|
||||
cc := abciclient.NewLocalCreator(kvstore.NewApplication())
|
||||
proxyApp := proxy.NewAppConns(cc, logger, proxy.NopMetrics())
|
||||
proxyApp := proxy.New(cc, logger, proxy.NopMetrics())
|
||||
err = proxyApp.Start(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -456,7 +456,7 @@ func TestMaxProposalBlockSize(t *testing.T) {
|
||||
mp := mempool.NewTxMempool(
|
||||
logger.With("module", "mempool"),
|
||||
cfg.Mempool,
|
||||
proxyApp.Mempool(),
|
||||
proxyApp,
|
||||
state.LastBlockHeight,
|
||||
)
|
||||
|
||||
@@ -476,7 +476,7 @@ func TestMaxProposalBlockSize(t *testing.T) {
|
||||
blockExec := sm.NewBlockExecutor(
|
||||
stateStore,
|
||||
logger,
|
||||
proxyApp.Consensus(),
|
||||
proxyApp,
|
||||
mp,
|
||||
sm.EmptyEvidencePool{},
|
||||
blockStore,
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
abciclient "github.com/tendermint/tendermint/abci/client"
|
||||
"github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/internal/blocksync"
|
||||
@@ -20,7 +21,6 @@ import (
|
||||
"github.com/tendermint/tendermint/internal/p2p"
|
||||
"github.com/tendermint/tendermint/internal/p2p/conn"
|
||||
"github.com/tendermint/tendermint/internal/p2p/pex"
|
||||
"github.com/tendermint/tendermint/internal/proxy"
|
||||
sm "github.com/tendermint/tendermint/internal/state"
|
||||
"github.com/tendermint/tendermint/internal/state/indexer"
|
||||
"github.com/tendermint/tendermint/internal/state/indexer/sink"
|
||||
@@ -171,7 +171,7 @@ func onlyValidatorIsUs(state sm.State, pubKey crypto.PubKey) bool {
|
||||
func createMempoolReactor(
|
||||
ctx context.Context,
|
||||
cfg *config.Config,
|
||||
proxyApp proxy.AppConns,
|
||||
proxyApp abciclient.Client,
|
||||
state sm.State,
|
||||
memplMetrics *mempool.Metrics,
|
||||
peerManager *p2p.PeerManager,
|
||||
@@ -183,7 +183,7 @@ func createMempoolReactor(
|
||||
mp := mempool.NewTxMempool(
|
||||
logger,
|
||||
cfg.Mempool,
|
||||
proxyApp.Mempool(),
|
||||
proxyApp,
|
||||
state.LastBlockHeight,
|
||||
mempool.WithMetrics(memplMetrics),
|
||||
mempool.WithPreCheck(sm.TxPreCheck(state)),
|
||||
@@ -385,7 +385,7 @@ func createRouter(
|
||||
nodeKey types.NodeKey,
|
||||
peerManager *p2p.PeerManager,
|
||||
cfg *config.Config,
|
||||
proxyApp proxy.AppConns,
|
||||
proxyApp abciclient.Client,
|
||||
) (*p2p.Router, error) {
|
||||
|
||||
p2pLogger := logger.With("module", "p2p")
|
||||
|
||||
Reference in New Issue
Block a user