mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Merge node (sync-only) and coord config
This commit is contained in:
@@ -93,3 +93,46 @@ TokenHEZName = "Hermez Network Token"
|
||||
Withdrawals = 0
|
||||
BlockWithdrawalRate = 0
|
||||
MaxWithdrawals = 0
|
||||
|
||||
|
||||
[Coordinator]
|
||||
ForgerAddress = "0x6BB84Cc84D4A34467aD12a2039A312f7029e2071"
|
||||
ConfirmBlocks = 10
|
||||
L1BatchTimeoutPerc = 0.6
|
||||
ProofServerPollInterval = "1s"
|
||||
SyncRetryInterval = "1s"
|
||||
|
||||
[Coordinator.L2DB]
|
||||
SafetyPeriod = 10
|
||||
MaxTxs = 512
|
||||
TTL = "24h"
|
||||
PurgeBatchDelay = 10
|
||||
InvalidateBatchDelay = 20
|
||||
PurgeBlockDelay = 10
|
||||
InvalidateBlockDelay = 20
|
||||
|
||||
[Coordinator.TxSelector]
|
||||
Path = "/tmp/iden3-test/hermez/txselector"
|
||||
|
||||
[Coordinator.BatchBuilder]
|
||||
Path = "/tmp/iden3-test/hermez/batchbuilder"
|
||||
|
||||
[[Coordinator.ServerProofs]]
|
||||
URL = "http://localhost:3000"
|
||||
|
||||
[Coordinator.EthClient]
|
||||
CallGasLimit = 300000
|
||||
DeployGasLimit = 1000000
|
||||
GasPriceDiv = 100
|
||||
ReceiptTimeout = "60s"
|
||||
ReceiptLoopInterval = "500ms"
|
||||
|
||||
CheckLoopInterval = "500ms"
|
||||
Attempts = 8
|
||||
AttemptsDelay = "200ms"
|
||||
|
||||
[Coordinator.API]
|
||||
Coordinator = true
|
||||
|
||||
[Coordinator.Debug]
|
||||
BatchPath = "/tmp/iden3-test/hermez/batchesdebug"
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
[StateDB]
|
||||
Path = "/tmp/iden3-test/hermez/statedb"
|
||||
|
||||
[PostgreSQL]
|
||||
Port = 5432
|
||||
Host = "localhost"
|
||||
User = "hermez"
|
||||
Password = "yourpasswordhere"
|
||||
Name = "hermez"
|
||||
|
||||
[L2DB]
|
||||
SafetyPeriod = 10
|
||||
MaxTxs = 512
|
||||
TTL = "24h"
|
||||
|
||||
[Web3]
|
||||
URL = "XXX"
|
||||
|
||||
[Synchronizer]
|
||||
SyncLoopInterval = "1s"
|
||||
|
||||
[SmartContracts]
|
||||
Rollup = "0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0"
|
||||
Auction = "0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e"
|
||||
TokenHEZ = "0xf784709d2317D872237C4bC22f867d1BAe2913AB"
|
||||
TokenHEZName = "Hermez Network Token"
|
||||
|
||||
[EthClient]
|
||||
CallGasLimit = 300000
|
||||
DeployGasLimit = 1000000
|
||||
GasPriceDiv = 100
|
||||
ReceiptTimeout = "60s"
|
||||
IntervalReceiptLoop = "200ms"
|
||||
@@ -1,40 +0,0 @@
|
||||
ForgerAddress = "0x6BB84Cc84D4A34467aD12a2039A312f7029e2071"
|
||||
ConfirmBlocks = 10
|
||||
L1BatchTimeoutPerc = 0.6
|
||||
ProofServerPollInterval = "1s"
|
||||
SyncRetryInterval = "1s"
|
||||
|
||||
[L2DB]
|
||||
SafetyPeriod = 10
|
||||
MaxTxs = 512
|
||||
TTL = "24h"
|
||||
PurgeBatchDelay = 10
|
||||
InvalidateBatchDelay = 20
|
||||
PurgeBlockDelay = 10
|
||||
InvalidateBlockDelay = 20
|
||||
|
||||
[TxSelector]
|
||||
Path = "/tmp/iden3-test/hermez/txselector"
|
||||
|
||||
[BatchBuilder]
|
||||
Path = "/tmp/iden3-test/hermez/batchbuilder"
|
||||
|
||||
[[ServerProofs]]
|
||||
URL = "http://localhost:3000"
|
||||
|
||||
[EthClient]
|
||||
CallGasLimit = 300000
|
||||
DeployGasLimit = 1000000
|
||||
GasPriceDiv = 100
|
||||
ReceiptTimeout = "60s"
|
||||
ReceiptLoopInterval = "500ms"
|
||||
|
||||
CheckLoopInterval = "500ms"
|
||||
Attempts = 8
|
||||
AttemptsDelay = "200ms"
|
||||
|
||||
[API]
|
||||
Coordinator = true
|
||||
|
||||
[Debug]
|
||||
BatchPath = "/tmp/iden3-test/hermez/batchesdebug"
|
||||
@@ -1,14 +0,0 @@
|
||||
ForgerAddress = "0x6BB84Cc84D4A34467aD12a2039A312f7029e2071"
|
||||
ForgerLoopInterval = "500ms"
|
||||
|
||||
[EthClient]
|
||||
CallGasLimit = 300000
|
||||
DeployGasLimit = 1000000
|
||||
GasPriceDiv = 100
|
||||
ReceiptTimeout = "60s"
|
||||
IntervalReceiptLoop = "200ms"
|
||||
|
||||
[L2DB]
|
||||
SafetyPeriod = 10
|
||||
MaxTxs = 512
|
||||
TTL = "24h"
|
||||
@@ -13,11 +13,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
flagCfg = "cfg"
|
||||
flagCoordCfg = "coordcfg"
|
||||
flagMode = "mode"
|
||||
modeSync = "sync"
|
||||
modeCoord = "coord"
|
||||
flagCfg = "cfg"
|
||||
flagMode = "mode"
|
||||
modeSync = "sync"
|
||||
modeCoord = "coord"
|
||||
)
|
||||
|
||||
func cmdInit(c *cli.Context) error {
|
||||
@@ -35,7 +34,7 @@ func cmdRun(c *cli.Context) error {
|
||||
if err != nil {
|
||||
return tracerr.Wrap(fmt.Errorf("error parsing flags and config: %w", err))
|
||||
}
|
||||
node, err := node.NewNode(cfg.mode, cfg.node, cfg.coord)
|
||||
node, err := node.NewNode(cfg.mode, cfg.node)
|
||||
if err != nil {
|
||||
return tracerr.Wrap(fmt.Errorf("error starting node: %w", err))
|
||||
}
|
||||
@@ -61,9 +60,8 @@ func cmdRun(c *cli.Context) error {
|
||||
|
||||
// Config is the configuration of the hermez node execution
|
||||
type Config struct {
|
||||
mode node.Mode
|
||||
node *config.Node
|
||||
coord *config.Coordinator
|
||||
mode node.Mode
|
||||
node *config.Node
|
||||
}
|
||||
|
||||
func parseCli(c *cli.Context) (*Config, error) {
|
||||
@@ -80,36 +78,27 @@ func parseCli(c *cli.Context) (*Config, error) {
|
||||
func getConfig(c *cli.Context) (*Config, error) {
|
||||
var cfg Config
|
||||
mode := c.String(flagMode)
|
||||
switch mode {
|
||||
case modeSync:
|
||||
cfg.mode = node.ModeSynchronizer
|
||||
case modeCoord:
|
||||
cfg.mode = node.ModeCoordinator
|
||||
default:
|
||||
return nil, tracerr.Wrap(fmt.Errorf("invalid mode \"%v\"", mode))
|
||||
}
|
||||
|
||||
if cfg.mode == node.ModeCoordinator {
|
||||
coordCfgPath := c.String(flagCoordCfg)
|
||||
if coordCfgPath == "" {
|
||||
return nil, tracerr.Wrap(fmt.Errorf("required flag \"%v\" not set", flagCoordCfg))
|
||||
}
|
||||
coordCfg, err := config.LoadCoordinator(coordCfgPath)
|
||||
if err != nil {
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
cfg.coord = coordCfg
|
||||
}
|
||||
nodeCfgPath := c.String(flagCfg)
|
||||
if nodeCfgPath == "" {
|
||||
return nil, tracerr.Wrap(fmt.Errorf("required flag \"%v\" not set", flagCfg))
|
||||
}
|
||||
nodeCfg, err := config.LoadNode(nodeCfgPath)
|
||||
if err != nil {
|
||||
return nil, tracerr.Wrap(err)
|
||||
var err error
|
||||
switch mode {
|
||||
case modeSync:
|
||||
cfg.mode = node.ModeSynchronizer
|
||||
cfg.node, err = config.LoadNode(nodeCfgPath)
|
||||
if err != nil {
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
case modeCoord:
|
||||
cfg.mode = node.ModeCoordinator
|
||||
cfg.node, err = config.LoadCoordinator(nodeCfgPath)
|
||||
if err != nil {
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
default:
|
||||
return nil, tracerr.Wrap(fmt.Errorf("invalid mode \"%v\"", mode))
|
||||
}
|
||||
// nodeCfg.Synchronizer.InitialVariables.WDelayer.HermezRollupAddress = nodeCfg.SmartContracts.Rollup
|
||||
cfg.node = nodeCfg
|
||||
|
||||
return &cfg, nil
|
||||
}
|
||||
@@ -129,10 +118,6 @@ func main() {
|
||||
Usage: "Node configuration `FILE`",
|
||||
Required: true,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: flagCoordCfg,
|
||||
Usage: "Coordinator configuration `FILE`",
|
||||
},
|
||||
}
|
||||
|
||||
app.Commands = []*cli.Command{
|
||||
|
||||
Reference in New Issue
Block a user