Skip to content

Commit

Permalink
Merge branch 'develop' into fix/remove-l2db
Browse files Browse the repository at this point in the history
  • Loading branch information
Shailu-s authored Dec 23, 2024
2 parents 4729427 + aafafb0 commit 729d7b9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion sequencer/cfg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Rollup = "0x3d4810E4F8377a34781A6Ceaab9dAc08E361192d"

[Coordinator]
## Ethereum address that the coordinator is using to forge batches
ForgerAddress = "0x46732b099639ff3d3ceeb4b6138ccbbb9b72f492"
ForgerAddress = "0x19795e3f46003bb44538708020dae2b4cc8b6425"
### Minimum balance the forger address needs to start the coordinator in wei. If It is set to 0, the coordinator will not check the balance
#MinimumForgeAddressBalance = "0"
### Number of confirmation blocks to be sure that the tx has been mined correctly
Expand Down
66 changes: 32 additions & 34 deletions sequencer/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ type Node struct {
// debugAPI *debugapi.DebugAPI
// Coordinator
coord *coordinator.Coordinator
msgCh chan interface{}

// Synchronizer
sync *synchronizer.Synchronizer
Expand Down Expand Up @@ -276,12 +275,17 @@ func NewNode(cfg *config.Node, version string) (*Node, error) {
Rollup: *sync.RollupConstants(),
}

// hdbNodeCfg := historydb.NodeConfig{
// ForgeDelay: cfg.Coordinator.ForgeDelay.Duration.Seconds(),
// }
// if err := historyDB.SetNodeConfig(&hdbNodeCfg); err != nil {
// return nil, common.Wrap(err)
// }

// TODO: rename node configs or remove unnecessary configs if not needed
hdbNodeCfg := historydb.NodeConfig{
MaxPoolTxs: cfg.Coordinator.L2DB.MaxTxs,
MinFeeUSD: cfg.Coordinator.L2DB.MinFeeUSD,
MaxFeeUSD: cfg.Coordinator.L2DB.MaxFeeUSD,
ForgeDelay: cfg.Coordinator.ForgeDelay.Duration.Seconds(),
}
if err := historyDB.SetNodeConfig(&hdbNodeCfg); err != nil {
return nil, common.Wrap(err)
}
hdbConsts := historydb.Constants{
SCConsts: common.SCConsts{
Rollup: scConsts.Rollup,
Expand All @@ -301,17 +305,17 @@ func NewNode(cfg *config.Node, version string) (*Node, error) {
log.Info("EtherScan method not configured in config file")
etherScanService = nil
}
// stateAPIUpdater, err := stateapiupdater.NewUpdater(
// historyDB,
// &hdbNodeCfg,
// initSCVars,
// &hdbConsts,
// &cfg.RecommendedFeePolicy,
// cfg.Coordinator.Circuit.MaxTx,
// )
// if err != nil {
// return nil, common.Wrap(err)
// }
stateAPIUpdater, err := stateapiupdater.NewUpdater(
historyDB,
&hdbNodeCfg,
initSCVars,
&hdbConsts,
&cfg.RecommendedFeePolicy,
cfg.Coordinator.Circuit.MaxTx,
)
if err != nil {
return nil, common.Wrap(err)
}

var coord *coordinator.Coordinator
// if mode == ModeCoordinator {
Expand Down Expand Up @@ -523,14 +527,15 @@ func NewNode(cfg *config.Node, version string) (*Node, error) {
// }
ctx, cancel := context.WithCancel(context.Background())
return &Node{
coord: coord,
sync: sync,
cfg: cfg,
sqlConnRead: db,
sqlConnWrite: db,
historyDB: historyDB,
ctx: ctx,
cancel: cancel,
stateAPIUpdater: stateAPIUpdater,
coord: coord,
sync: sync,
cfg: cfg,
sqlConnRead: db,
sqlConnWrite: db,
historyDB: historyDB,
ctx: ctx,
cancel: cancel,
}, nil
}

Expand Down Expand Up @@ -651,20 +656,13 @@ func (n *Node) Stop() {
n.coord.BatchBuilder().LocalStateDB().Close()
}

func (n *Node) SendMsg(ctx context.Context, msg interface{}) {
select {
case n.msgCh <- msg:
case <-ctx.Done():
}
}

func (n *Node) handleNewBlock(
ctx context.Context,
stats *synchronizer.Stats,
vars *common.SCVariablesPtr,
/*, batches []common.BatchData*/
) error {
n.SendMsg(ctx, coordinator.MsgSyncBlock{
n.coord.SendMsg(ctx, coordinator.MsgSyncBlock{
Stats: *stats,
Vars: *vars,
})
Expand Down

0 comments on commit 729d7b9

Please sign in to comment.