Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
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
2 changes: 2 additions & 0 deletions changelog/bragaigor-nit-4241.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### Changed
- enable execution and consensus only mode
6 changes: 4 additions & 2 deletions cmd/chaininfo/chain_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ type ChainInfo struct {
RollupAddresses *RollupAddresses `json:"rollup"`
}

func GetChainConfig(chainId *big.Int, chainName string, genesisBlockNum uint64, l2ChainInfoFiles []string, l2ChainInfoJson string) (*params.ChainConfig, error) {
func GetChainConfig(chainId *big.Int, chainName string, genesisBlockNum *uint64, l2ChainInfoFiles []string, l2ChainInfoJson string) (*params.ChainConfig, error) {
chainInfo, err := ProcessChainInfo(chainId.Uint64(), chainName, l2ChainInfoFiles, l2ChainInfoJson)
if err != nil {
return nil, err
}
if chainInfo.ChainConfig != nil {
chainInfo.ChainConfig.ArbitrumChainParams.GenesisBlockNum = genesisBlockNum
if genesisBlockNum != nil {
chainInfo.ChainConfig.ArbitrumChainParams.GenesisBlockNum = *genesisBlockNum
}
return chainInfo.ChainConfig, nil
}
if chainId.Uint64() != 0 {
Expand Down
7 changes: 5 additions & 2 deletions cmd/nitro/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func (c *NodeConfig) Validate() error {
if err := c.ParentChain.Validate(); err != nil {
return err
}

if err := c.Node.Validate(); err != nil {
return err
}
Expand All @@ -169,8 +170,10 @@ func (c *NodeConfig) Validate() error {
if c.Node.Sequencer || c.Node.BatchPoster.Enable {
return errors.New("sequencing and batch-posting are currently not supported when connecting to an execution client over RPC")
}
} else if c.Execution.ConsensusRPCClient.URL != "" {
return errors.New("consensus is connecting directly to execution but execution is connecting to consensus over an rpc- invalid case")
} else if c.Execution.RPCServer.Enable && c.Execution.ConsensusRPCClient.URL == "" {
return errors.New("communication over rpc is enabled on execution but consensus RPC client is not set")
} else if c.Node.RPCServer.Enable && c.Node.ExecutionRPCClient.URL == "" {
return errors.New("communication over rpc is enabled on consensus but execution RPC client is not set")
}
if err := c.BlocksReExecutor.Validate(); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/nitro/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ func GetInit(config *config.NodeConfig, executionDB ethdb.Database) (statetransf
if err != nil {
return nil, nil, nil, err
}
chainConfig, err = chaininfo.GetChainConfig(new(big.Int).SetUint64(config.Chain.ID), config.Chain.Name, genesisBlockNr, config.Chain.InfoFiles, config.Chain.InfoJson)
chainConfig, err = chaininfo.GetChainConfig(new(big.Int).SetUint64(config.Chain.ID), config.Chain.Name, &genesisBlockNr, config.Chain.InfoFiles, config.Chain.InfoJson)
if err != nil {
return nil, nil, nil, err
}
Expand Down
359 changes: 207 additions & 152 deletions cmd/nitro/nitro.go

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions cmd/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func main() {
}
} else {
log.Info("Falling back to hardcoded chain config.")
chainConfig, err = chaininfo.GetChainConfig(chainId, "", genesisBlockNum, []string{}, "")
chainConfig, err = chaininfo.GetChainConfig(chainId, "", &genesisBlockNum, []string{}, "")
if err != nil {
panic(err)
}
Expand All @@ -424,7 +424,8 @@ func main() {
chainConfig := initMessage.ChainConfig
if chainConfig == nil {
log.Info("No chain config in the init message. Falling back to hardcoded chain config.")
chainConfig, err = chaininfo.GetChainConfig(initMessage.ChainId, "", 0, []string{}, "")
genesisBlockNum := uint64(0)
chainConfig, err = chaininfo.GetChainConfig(initMessage.ChainId, "", &genesisBlockNum, []string{}, "")
if err != nil {
panic(err)
}
Expand Down
11 changes: 8 additions & 3 deletions execution_consensus/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,21 @@ func InitAndStartExecutionAndConsensusNodes(ctx context.Context, stack *node.Nod
return nil, fmt.Errorf("error starting geth stack: %w", err)
}
if execNode != nil {
// consensusNode may be nil; SetConsensusClient handles it via consensusRPCClient
execNode.SetConsensusClient(consensusNode)
if err := execNode.Start(ctx); err != nil {
Comment thread
diegoximenes marked this conversation as resolved.
return nil, fmt.Errorf("error starting exec node: %w", err)
}
}
if err := consensusNode.Start(ctx); err != nil {
return nil, fmt.Errorf("error starting consensus node: %w", err)
if consensusNode != nil {
if err := consensusNode.Start(ctx); err != nil {
return nil, fmt.Errorf("error starting consensus node: %w", err)
}
}
Comment thread
bragaigor marked this conversation as resolved.
return func() {
consensusNode.StopAndWait()
if consensusNode != nil {
consensusNode.StopAndWait()
}
if execNode != nil {
execNode.StopAndWait()
}
Expand Down
2 changes: 1 addition & 1 deletion nitro-testnode
Loading