Skip to content

Conversation

@cody-wang-cb
Copy link
Collaborator

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

Added support for 3 RPCs

  • eth_getBlockByNumber with pending tag.
  • eth_getTransactionReceipt, it checks if it exists in the DB first, if not, then maybe it's a flashblock receipt then it checks in the cache
  • eth_getBalance with pending tag.

It runs a websocket client and listens to the rollup-boost web proxy. It parses the message and store the necessary information into the cache.

For message out of order scenarios, currently only handles to not updating older blocks, but doesn't handle cases like same block payload message out of order, will be TODO for future updates.

Added unit and integration tests, supports reth 1.2.2.

@cody-wang-cb cody-wang-cb changed the title Fixed standard RPC flow and added cache Added cache and stream data subscriber to receive data Feb 10, 2025
};
}

pub fn transform_tx(
Copy link
Collaborator Author

@cody-wang-cb cody-wang-cb Feb 12, 2025

Choose a reason for hiding this comment

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

}
}

pub fn transform_receipt(
Copy link
Collaborator Author

@cody-wang-cb cody-wang-cb Feb 12, 2025

Choose a reason for hiding this comment

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

src/rpc.rs Outdated
Self { eth_api, cache }
}

pub fn transform_block(&self, block: OpBlock) -> RpcBlock<Optimism> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,163 @@
use crate::cache::Cache;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cody-wang-cb cody-wang-cb changed the title Added cache and stream data subscriber to receive data feat: Flashblock RPCs Feb 26, 2025
};

// Then parse JSON
let payload: FlashblocksPayloadV1 =
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should move the parsing logic off the receiving worker. Feels like this could potentially block new messages.

Copy link
Collaborator Author

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

Choose a reason for hiding this comment

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

I feel like we need to be a bit cautious of making this process entirely async, given there's order requirements (payload with lower index should be processed first).
Which means even if it ends up blocking i think it's ok, but the most important thing is to make the parsing logic fast (which it is now, currently it's < 1ms for sepolia payload). Wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can still do ordering and move it off the worker for receiving (with a queue of some kind). Though I'm happy for us to address this in a follow up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good, created a ticket for this

@danyalprout danyalprout merged commit d788245 into main Mar 10, 2025
4 checks passed
@danyalprout danyalprout deleted the cody/cache branch March 10, 2025 17:21
avalonche pushed a commit to flashbots/rbuilder that referenced this pull request Mar 10, 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.
(base/node-reth#4)

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

## ✅ I have completed the following steps:

* [x] Run `make lint`
* [x] Run `make test`
* [x] Added tests (if applicable)
0xsimulacra pushed a commit to 0xsimulacra/base-node-reth that referenced this pull request Oct 1, 2025
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