-
Notifications
You must be signed in to change notification settings - Fork 2
feat(op-node): chain replication via BOP_REPLAY env
#4
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
feat(op-node): chain replication via BOP_REPLAY env
#4
Conversation
Such flags allows to gossip and receive unsafe payloads which timestamp is older than 60 seconds. Useful for testing purposes.
BOP_REPLAY env
5bdb1c4 to
4962e9b
Compare
ltitanb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! a lot of changes seems to be formatting, not sure if there's an equivalent of just fmt (of it it was not set). If not then happy to merge with the formatting changes too
| // CHANGE(thedevbirb): allow chain replication without deviation due to L1 state. | ||
| if _, ok := os.LookupEnv("BOP_REPLAY"); ok { | ||
| return | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we refactor this to a small function we call instead? also assuming this does a syscall every time it's called so if on the hot path maybe we could use a global static / atomic instead? if not then ok to keep this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, a static is probably simpler in this case. Btw os.LookupEnv doesn't make a syscall but calls this https://cs.opensource.google/go/go/+/refs/tags/go1.25.1:src/syscall/env_unix.go;l=66 and it is all in memory.
Pushing a change soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See 86fd3cc.
Regarding formatting, I don't see some tooling specifically used for it, this is what my LSP with go fmt did. But I can rollback individual changes if you want.
68283ad to
86fd3cc
Compare
The following PR introduces some lookup checks on the environment variable
BOP_REPLAYto assess whether this follower node is running in chain replication mode or not.Chain replication consists of replaying past L2 blocks of the chain but at the current time, which is something op-node hasn't been really designed for. As such, this env disable some important checks and routine usually used in production:
The result is a follower node which is able to ingest past L2 blocks and process them unsafely (because of the two points above).
There are some past commits where I tried to use a CLI flag instead, but imo they end up in more diffs and injecting this testing configuration in structs etc which is not desiderable. I kept them for reference, but I can squash everything in one commit if desired.