Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix batcher panic on invalid configuration #7975

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

mdehoog
Copy link
Contributor

@mdehoog mdehoog commented Oct 31, 2023

Description

The batcher panics if an invalid configuration is passed. This PR fixes the nil access so that the actual configuration error is printed, rather than a panic.

Tests

Added small regression test.

Additional context

It can be easily repro'd using (without this PR's changes):

make op-batcher && bin/op-batcher --l1-eth-rpc https://example.com --l2-eth-rpc https://example.com --rollup-rpc https://example.com

INFO [10-31|12:39:25.132] Initializing Batch Submitter
INFO [10-31|12:39:25.606] Stopping batcher
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x101623288]

goroutine 1 [running]:
github.com/ethereum-optimism/optimism/op-batcher/batcher.(*BatchSubmitter).StopBatchSubmitting(0x0, {0x101ddca60, 0x14000180690})
	/Users/michaeldehoog/src/optimism/op-batcher/batcher/driver.go:114 +0x38
github.com/ethereum-optimism/optimism/op-batcher/batcher.(*BatchSubmitter).StopBatchSubmittingIfRunning(0x1?, {0x101ddca60?, 0x14000180690?})
	/Users/michaeldehoog/src/optimism/op-batcher/batcher/driver.go:105 +0x24
github.com/ethereum-optimism/optimism/op-batcher/batcher.(*BatcherService).Stop(0x140002f2800, {0x101ddca60, 0x14000180690})
	/Users/michaeldehoog/src/optimism/op-batcher/batcher/service.go:292 +0x88
github.com/ethereum-optimism/optimism/op-batcher/batcher.BatcherServiceFromCLIConfig({0x101ddca60, 0x14000180690}, {0x101b8a6d8, 0x6}, 0x2c?, {0x101de2bf8, 0x14000494540})
	/Users/michaeldehoog/src/optimism/op-batcher/batcher/service.go:74 +0x84
main.main.Main.func1(0x140003e4340, 0x1025a1a00?)
	/Users/michaeldehoog/src/optimism/op-batcher/batcher/batch_submitter.go:32 +0x15c
main.main.LifecycleCmd.lifecycleCmd.func3(0x140003e4340)
	/Users/michaeldehoog/src/optimism/op-service/cliapp/lifecycle.go:56 +0x110
github.com/urfave/cli/v2.(*Command).Run(0x1400011cdc0, 0x140003e4340, {0x140001d6000, 0x7, 0x7})
	/Users/michaeldehoog/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:274 +0x730
github.com/urfave/cli/v2.(*App).RunContext(0x140000125a0, {0x101ddc788?, 0x1025a1a00}, {0x140001d6000, 0x7, 0x7})
	/Users/michaeldehoog/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:332 +0x518
github.com/urfave/cli/v2.(*App).Run(...)
	/Users/michaeldehoog/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:309
main.main()
	/Users/michaeldehoog/src/optimism/op-batcher/cmd/main.go:41 +0x4fc

@mdehoog mdehoog requested a review from a team as a code owner October 31, 2023 23:18
@mdehoog mdehoog requested a review from refcell October 31, 2023 23:18
@protolambda protolambda added this pull request to the merge queue Nov 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 1, 2023
@ajsutton ajsutton added this pull request to the merge queue Nov 1, 2023
Merged via the queue into ethereum-optimism:develop with commit ad0bdd6 Nov 1, 2023
@mdehoog mdehoog deleted the michael/batcher-panic branch November 1, 2023 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants