Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ run-follower-compare-sepolia:
--parent-chain.blob-client.beacon-url=http://209.127.228.66/consensus/6ekWpL9BXR0aLXrd \
--chain.id=421614 \
--execution.forwarding-target null \
--execution.enable-prefetch-block=false
--execution.enable-prefetch-block=false \
--http.addr=0.0.0.0 \
--http.port=8747

.PHONY: clean-run-follower-compare-sepolia
clean-run-follower-compare-sepolia: clean-follower run-follower-compare-sepolia
Expand Down
5 changes: 3 additions & 2 deletions cmd/nitro/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,9 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo
}

// Trigger genesis block building at Nethermind
_ = initDigester.DigestInitMessage(ctx, parsedInitMessage.InitialL1BaseFee, parsedInitMessage.SerializedChainConfig)

if _, err = initDigester.DigestInitMessage(ctx, parsedInitMessage.InitialL1BaseFee, parsedInitMessage.SerializedChainConfig); err != nil {
return chainDb, nil, err
}
l2BlockChain, err = gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initDataReader, chainConfig, genesisArbOSInit, tracer, parsedInitMessage, &config.Execution.TxIndexer, config.Init.AccountsPerSync)
if err != nil {
return chainDb, nil, err
Expand Down
21 changes: 14 additions & 7 deletions cmd/nitro/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ func mainImpl() int {
return 1
}
log.Info("Created nethermind execution client")
execNode = nethexec.NewCompareExecutionClient(gethNode, nmExec, fatalErrChan)
execNode = nethexec.NewCompareExecutionClient(ctx, gethNode, nmExec, fatalErrChan)
log.Info("Created compare execution client")
}

Expand Down Expand Up @@ -719,6 +719,17 @@ func mainImpl() int {
}
}

// Set up signal handling BEFORE starting nodes to enable cancellation during startup
sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)

// Start signal handler in separate goroutine to cancel context on SIGINT
go func() {
<-sigint
log.Info("received SIGINT, cancelling operations...")
cancelFunc()
}()

if valNode != nil {
err = valNode.Start(ctx)
if err != nil {
Expand All @@ -737,9 +748,6 @@ func mainImpl() int {
deferFuncs = []func(){func() { currentNode.StopAndWait() }}
}

sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)

if err == nil && nodeConfig.Init.IsReorgRequested() {
err = initReorg(nodeConfig.Init, chainInfo.ChainConfig, currentNode.InboxTracker)
if err != nil {
Expand All @@ -757,12 +765,11 @@ func mainImpl() int {
err = nil
select {
case err = <-fatalErrChan:
case <-sigint:
// If there was both a sigint and a fatal error, we want to log the fatal error
case <-ctx.Done():
select {
case err = <-fatalErrChan:
default:
log.Info("shutting down because of sigint")
log.Info("shutting down because of cancelled context (SIGINT)")
}
}

Expand Down
33 changes: 32 additions & 1 deletion execution/gethexec/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,39 @@ func (n *ExecutionNode) NextDelayedMessageNumber() (uint64, error) {
func (n *ExecutionNode) SequenceDelayedMessage(message *arbostypes.L1IncomingMessage, delayedSeqNum uint64) error {
return n.ExecEngine.SequenceDelayedMessage(message, delayedSeqNum)
}

const maxRetries = 3
const retryDelay = 100 * time.Millisecond

func (n *ExecutionNode) ResultAtMessageIndex(msgIdx arbutil.MessageIndex) containers.PromiseInterface[*execution.MessageResult] {
return containers.NewReadyPromise(n.ExecEngine.ResultAtMessageIndex(msgIdx))
promise := containers.NewPromise[*execution.MessageResult](nil)
go func() {
var res *execution.MessageResult
var err error

for attempt := range maxRetries {
res, err = n.ExecEngine.ResultAtMessageIndex(msgIdx)
if err == nil {
promise.Produce(res)
return
}

// Only retry on ResultNotFound errors
if !errors.Is(err, ResultNotFound) {
promise.ProduceError(err)
return
}

// Don't sleep after the last attempt
if attempt < maxRetries {
time.Sleep(retryDelay)
}
}

// All retries exhausted
promise.ProduceError(err)
}()
return &promise
}
func (n *ExecutionNode) ArbOSVersionForMessageIndex(msgIdx arbutil.MessageIndex) (uint64, error) {
return n.ExecEngine.ArbOSVersionForMessageIndex(msgIdx)
Expand Down
Loading