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

Make WaitL1 and WaitL2 separate functions #186

Open
joshklop opened this issue Sep 1, 2024 · 2 comments
Open

Make WaitL1 and WaitL2 separate functions #186

joshklop opened this issue Sep 1, 2024 · 2 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@joshklop
Copy link
Collaborator

joshklop commented Sep 1, 2024

It is preferable to have receivers, rather than fields that are set when the struct is built.

monomer/e2e/stack.go

Lines 294 to 299 in 6e976af

WaitL1: func(numBlocks int) error {
return wait(numBlocks, 1)
},
WaitL2: func(numBlocks int) error {
return wait(numBlocks, 2)
},

If I'm missing the reasoning, please correct me @NiloCK.

@joshklop joshklop added the good first issue Good for newcomers label Sep 1, 2024
@NiloCK
Copy link
Collaborator

NiloCK commented Sep 3, 2024

On first write, they were separate but identical functions, which I combined as a de-duplication.

I'm fine either way, but it's a trade of indirection vs duplication with probably not a lot of gain in either direction.

@joshklop
Copy link
Collaborator Author

joshklop commented Sep 4, 2024

The best way to go is probably to have a single function in stack_test.go

func wait(client BlockByNumberInterface, numBlocks uint64) error {
    // implementation ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants