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

Use erigon as the external client for op_geth_test.go #52

Merged
merged 9 commits into from
Sep 21, 2023

Conversation

boyuan-chen
Copy link

This PR can bring up erigon as the external client for all tests in op_geth_test.go.

Copy link

@jyellick jyellick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. I might suggest renaming op_geth_test.go to l2_eth_test.go or something more generic to indicate that these tests are meant to cover the L2 eth clients generally, not just op-geth. Once we're happy with this, we should certainly send it upstream.

op-e2e/op_geth.go Outdated Show resolved Hide resolved
op-e2e/op_geth.go Outdated Show resolved Hide resolved
op-e2e/op_geth_test.go Show resolved Hide resolved
@@ -235,7 +236,7 @@ type EthInstance interface {
WSEndpoint() string
HTTPAuthEndpoint() string
WSAuthEndpoint() string
Close()
Close() error

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not immediately obvious to me why we changed this signature?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's easier for us to use the same code node.Close() to stop both external clients and the geth client started by geth.Init().

https://github.com/bobanetwork/v3-anchorage/blob/3a9c216e2c6becac6b5553e1f6e8224515c27579/op-e2e/op_geth.go#L144

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing GethInstance was already calling gi.Node.Close(), if rather than storing the Node, we stored the EthInstance, we'd get access to that. But, not a big deal either way.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion! I replaced Node with EthInstance.

Copy link

@jyellick jyellick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a few nits, but nothing that's worth holding up merging over.

op-e2e/op_geth.go Outdated Show resolved Hide resolved
op-e2e/op_geth.go Show resolved Hide resolved
@@ -90,7 +116,10 @@ func NewOpGeth(t *testing.T, ctx context.Context, cfg *SystemConfig) (*OpGeth, e
)
require.Nil(t, err)

l2Client, err := ethclient.Dial(node.HTTPEndpoint())
l2Client, err := ethclient.Dial(HTTPEndpoint)
require.Nil(t, err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The existing test is using require.Nil(t, err), so maybe it's best to stick with it, but the more idiomatic assertion would be require.NoError(t, err).

@@ -235,7 +236,7 @@ type EthInstance interface {
WSEndpoint() string
HTTPAuthEndpoint() string
WSAuthEndpoint() string
Close()
Close() error

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing GethInstance was already calling gi.Node.Close(), if rather than storing the Node, we stored the EthInstance, we'd get access to that. But, not a big deal either way.

@InoMurko
Copy link

oh wow, great!!!

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.

4 participants