allow e2e to work for out of process app

This commit is contained in:
William Banfield
2022-07-15 16:57:42 -04:00
parent 223ece93c8
commit 00dd3a6801
4 changed files with 31 additions and 2 deletions

View File

@@ -112,7 +112,24 @@ func startApp(cfg *Config) error {
return err
}
logger.Info("start app", "msg", log.NewLazySprintf("Server listening on %v (%v protocol)", cfg.Listen, cfg.Protocol))
return nil
tmcfg, nodeLogger, nodeKey, err := setupNode()
if err != nil {
return fmt.Errorf("failed to setup config: %w", err)
}
n, err := node.NewNode(tmcfg,
privval.LoadOrGenFilePV(tmcfg.PrivValidatorKeyFile(), tmcfg.PrivValidatorStateFile()),
nodeKey,
proxy.NewRemoteClientCreator(cfg.Listen, cfg.Protocol, true),
node.DefaultGenesisDocProviderFunc(tmcfg),
node.DefaultDBProvider,
node.DefaultMetricsProvider(tmcfg.Instrumentation),
nodeLogger,
)
if err != nil {
return err
}
return n.Start()
}
// startNode starts a Tendermint node running the application directly. It assumes the Tendermint

View File

@@ -96,6 +96,8 @@ type ManifestNode struct {
// This defaults to v0.
Mempool string `toml:"mempool_version"`
ABCIProtocol string `toml:"abci_protocol"`
// StateSync enables state sync. The runner automatically configures trusted
// block hashes and RPC servers. At least one node in the network must have
// SnapshotInterval set to non-zero, and the state syncing node must have

View File

@@ -145,6 +145,10 @@ func LoadTestnet(file string) (*Testnet, error) {
for _, name := range nodeNames {
nodeManifest := manifest.Nodes[name]
abciProtocol := "builtin"
if nodeManifest.ABCIProtocol != "" {
abciProtocol = nodeManifest.ABCIProtocol
}
node := &Node{
Name: name,
Testnet: testnet,
@@ -154,7 +158,7 @@ func LoadTestnet(file string) (*Testnet, error) {
ProxyPort: proxyPortGen.Next(),
Mode: ModeValidator,
Database: "goleveldb",
ABCIProtocol: Protocol(testnet.ABCIProtocol),
ABCIProtocol: Protocol(abciProtocol),
PrivvalProtocol: ProtocolFile,
StartAt: nodeManifest.StartAt,
FastSync: nodeManifest.FastSync,

View File

@@ -82,10 +82,15 @@ func Setup(testnet *e2e.Testnet) error {
}
}
fmt.Println("proxy! app")
fmt.Println(node.Name)
fmt.Println(node.Mode)
fmt.Println(node.ABCIProtocol)
cfg, err := MakeConfig(node)
if err != nil {
return err
}
fmt.Println(cfg.ProxyApp)
config.WriteConfigFile(filepath.Join(nodeDir, "config", "config.toml"), cfg) // panics
appCfg, err := MakeAppConfig(node)
@@ -244,6 +249,7 @@ func MakeConfig(node *e2e.Node) (*config.Config, error) {
case e2e.ProtocolUNIX:
cfg.ProxyApp = AppAddressUNIX
case e2e.ProtocolTCP:
fmt.Println("tcp?")
cfg.ProxyApp = AppAddressTCP
case e2e.ProtocolGRPC:
cfg.ProxyApp = AppAddressTCP