mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Add circuit configuration to node config
- Remove MaxL1CoordTxs parameter from the TxSelector because this parameter doesn't exist - Use ChainID in l1tx byte encoding - Pass txprocessor configuration to batch builder via an existing parameter
This commit is contained in:
23
node/node.go
23
node/node.go
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/hermeznetwork/hermez-node/prover"
|
||||
"github.com/hermeznetwork/hermez-node/synchronizer"
|
||||
"github.com/hermeznetwork/hermez-node/test/debugapi"
|
||||
"github.com/hermeznetwork/hermez-node/txprocessor"
|
||||
"github.com/hermeznetwork/hermez-node/txselector"
|
||||
"github.com/hermeznetwork/tracerr"
|
||||
"github.com/jmoiron/sqlx"
|
||||
@@ -202,8 +203,8 @@ func NewNode(mode Mode, cfg *config.Node) (*Node, error) {
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
// TODO: Get (configCircuits []ConfigCircuit, batchNum common.BatchNum, nLevels uint64) from smart contract
|
||||
nLevels := uint64(32) //nolint:gomnd
|
||||
batchBuilder, err := batchbuilder.NewBatchBuilder(cfg.Coordinator.BatchBuilder.Path, stateDB, nil, 0, nLevels)
|
||||
batchBuilder, err := batchbuilder.NewBatchBuilder(cfg.Coordinator.BatchBuilder.Path,
|
||||
stateDB, nil, 0, uint64(cfg.Coordinator.Circuit.NLevels))
|
||||
if err != nil {
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
@@ -216,6 +217,22 @@ func NewNode(mode Mode, cfg *config.Node) (*Node, error) {
|
||||
cfg.Coordinator.ProofServerPollInterval.Duration)
|
||||
}
|
||||
|
||||
txProcessorCfg := txprocessor.Config{
|
||||
NLevels: uint32(cfg.Coordinator.Circuit.NLevels),
|
||||
MaxTx: uint32(cfg.Coordinator.Circuit.MaxTx),
|
||||
ChainID: chainIDU16,
|
||||
MaxFeeTx: common.RollupConstMaxFeeIdxCoordinator,
|
||||
MaxL1Tx: common.RollupConstMaxL1Tx,
|
||||
}
|
||||
verifierIdx, err := scConsts.Rollup.FindVerifierIdx(
|
||||
cfg.Coordinator.Circuit.MaxTx,
|
||||
cfg.Coordinator.Circuit.NLevels,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
log.Infow("Found verifier that matches circuit config", "verifierIdx", verifierIdx)
|
||||
|
||||
coord, err = coordinator.NewCoordinator(
|
||||
coordinator.Config{
|
||||
ForgerAddress: cfg.Coordinator.ForgerAddress,
|
||||
@@ -232,6 +249,8 @@ func NewNode(mode Mode, cfg *config.Node) (*Node, error) {
|
||||
PurgeBlockDelay: cfg.Coordinator.L2DB.PurgeBlockDelay,
|
||||
InvalidateBlockDelay: cfg.Coordinator.L2DB.InvalidateBlockDelay,
|
||||
},
|
||||
VerifierIdx: uint8(verifierIdx),
|
||||
TxProcessorConfig: txProcessorCfg,
|
||||
},
|
||||
historyDB,
|
||||
l2DB,
|
||||
|
||||
Reference in New Issue
Block a user