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

feat: rpc client for eth blockchains #520

Merged
merged 3 commits into from
Sep 16, 2024
Merged

Conversation

dav1do
Copy link
Contributor

@dav1do dav1do commented Sep 9, 2024

This PR adds an http client that knows how to talk to Ethereum RPC providers. It also validates that a time event proof correctly points at prev when parsing. The RPC client will be used to timestamp events which is coming in a follow up PR. That change will require storing more information and is related to both anchoring and timestamping. Event validation itself doesn't strictly require that we're able to follow a time event to the chain and prove that the root is in the proof. Without that, we have no time information but the event is "valid" from a structural perspective, and it's possible users will not all use the same chain, and we may want to gossip events even if we're not using them to timestamp ourselves.

The intention is to have the service (likely event) that is actually adding time information register a eth provider for every chain ID that they're interested in, and then they can query the blockchain and persist the block number and time information and add it to any events as needed. These changes are consumed by #522.

I expect that we will swap this out for a full eth client (e.g. alloy-rs) when we do self anchoring and need signing and such, but that should be a relatively small change as we can just impl the trait in terms of that client and it should work.

This currently targets #503 but can likely be rebased onto main at this point if that's preferred.

@dav1do dav1do requested review from a team and nathanielc as code owners September 9, 2024 18:49
@dav1do dav1do requested review from 3benbox and removed request for a team September 9, 2024 18:49
Copy link

linear bot commented Sep 9, 2024

Copy link
Collaborator

@stbrody stbrody left a comment

Choose a reason for hiding this comment

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

Tagging in @AaronGoldman as I believe there may already be code checked in somewhere that does this?

event/src/unvalidated/event.rs Outdated Show resolved Hide resolved
validation/src/blockchain/eth_rpc.rs Outdated Show resolved Hide resolved
validation/src/blockchain/eth_rpc.rs Outdated Show resolved Hide resolved
validation/src/blockchain/eth_rpc.rs Outdated Show resolved Hide resolved
@dav1do
Copy link
Contributor Author

dav1do commented Sep 9, 2024

Tagging in @AaronGoldman as I believe there may already be code checked in somewhere that does this?

This is taken from that code and adjusted to a bit (mostly just more serde and a trait).. it was removed from main a while back.

@dav1do dav1do force-pushed the feat/aes-277-validate-writes branch 3 times, most recently from 42d2ccb to 8e50b6b Compare September 12, 2024 00:54
@dav1do dav1do changed the base branch from feat/aes-277-validate-writes to main September 12, 2024 01:02
@dav1do dav1do added this pull request to the merge queue Sep 16, 2024
Merged via the queue into main with commit bce6471 Sep 16, 2024
7 checks passed
@dav1do dav1do deleted the feat/aes-273-eth-time-events branch September 16, 2024 17:47
This pull request was closed.
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