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 flashblock ws url as a flag and add more data #442

Merged
merged 6 commits into from
Mar 10, 2025

Conversation

cody-wang-cb
Copy link
Contributor

@cody-wang-cb cody-wang-cb commented Feb 21, 2025

📝 Summary

Making flashblock websocket as flag so that it can be customizable.

Also added receipts, account balance, block number into the metadata field, such that the RPC node can build the RPC response for eth_transactionReceipt and eth_getBalance for pending blocks. (danyalprout/reth-flashblocks#4)

Added an integration test to test that the metadata field indeed has the new data.

✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@ZanCorDX
Copy link
Contributor

ZanCorDX commented Mar 5, 2025

Can you fix the checks?

@cody-wang-cb cody-wang-cb requested a review from metachris as a code owner March 5, 2025 22:27
@cody-wang-cb cody-wang-cb changed the base branch from more-fb to develop March 5, 2025 22:27
@cody-wang-cb cody-wang-cb requested a review from sukoneck as a code owner March 6, 2025 00:06
@cody-wang-cb cody-wang-cb marked this pull request as draft March 6, 2025 15:06
Copy link
Contributor Author

@cody-wang-cb cody-wang-cb left a comment

Choose a reason for hiding this comment

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

@ZanCorDX @ferranbt got some questions while working on the tests, mind taking a look and provide some guidance?

// there must be a line logging the monitoring transaction
op_rbuilder
.find_log_line("Committed block built by builder")
.find_log_line("Committed block built by builder") // no builder tx for flashblocks builder
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like the flashblock builder does not include this additional builder tx as the vanilla builder. https://github.com/flashbots/rbuilder/blob/develop/crates/op-rbuilder/src/payload_builder_vanilla.rs#L508

Is this expected? Curious what's the reason that there is always a builder tx for the vanilla builder

Copy link
Contributor

@avalonche avalonche Mar 7, 2025

Choose a reason for hiding this comment

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

the builder uses the builder tx for monitoring purposes, see here. These integration tests are for the vanilla builder, not flashblocks.
I think it would make more sense to have a different set of integration tests for flashblocks. I think you can configure this in rust like

  // This test always runs
  #[test]
  fn always_runs() {
      // Test code here
  }
  
  // This test only runs when "my_feature" is enabled
  #[cfg(feature = "my_feature")]
  #[test]
  fn only_with_feature() {
      // Test code that depends on my_feature
  }

Copy link
Contributor Author

@cody-wang-cb cody-wang-cb Mar 7, 2025

Choose a reason for hiding this comment

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

Yeah it makes sense that these tests were built for the vanilla builder. I could definitely move these new tests logics to a new test under flashblocks feature.
But I wonder for op-rbuilder, shouldn't the flashblock builder be the default builder? It seems a bit weird to me that there's discrepancy for the two builders in terms of functionality, besides the subblock part

Copy link
Contributor

Choose a reason for hiding this comment

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

flashblocks is still not ready for production so we are running the vanilla block builder as the default for now. I think eventually the plan is to make it default

@ferranbt ferranbt marked this pull request as ready for review March 7, 2025 16:42

- name: Generate test genesis file
run: cargo run -p op-rbuilder --bin tester --features optimism -- genesis --output genesis.json

- name: Run integration tests
run: cargo test --package op-rbuilder --lib --features optimism,integration -- integration::integration_test::tests
run: cargo test --package op-rbuilder --lib --features optimism,integration,flashblocks -- integration::integration_test::tests
Copy link
Contributor

Choose a reason for hiding this comment

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

could you also add the features to the makefile?

Copy link
Contributor

Choose a reason for hiding this comment

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

actually if you want the tests to pass you should remove flashblocks from the integration tests

Copy link
Contributor Author

@cody-wang-cb cody-wang-cb Mar 7, 2025

Choose a reason for hiding this comment

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

I think I should add another CI check for the flashblocks builder tests? (added above)

Copy link
Contributor

Choose a reason for hiding this comment

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

if its guarded behind a feature flag you should need a separate command / CI test and everything should pass

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup the above is a separate CI test in addition to the original test

@cody-wang-cb cody-wang-cb requested a review from avalonche March 7, 2025 18:44
@avalonche avalonche merged commit c28ea6e into flashbots:develop Mar 10, 2025
4 checks passed
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