feat: introduce tycho-protobuf crate#996
Open
kayibal wants to merge 1 commit into
Open
Conversation
Factors out a new `tycho-protobuf` crate from `protocols/substreams/crates/tycho-substreams`. The crate lives at `crates/tycho-protobuf` inside the main workspace. - `src/pb/` holds the generated protobuf types (from `proto/tycho/evm/v1/common.proto`); regenerate with `PROTO_BUILD=1 cargo build -p tycho-protobuf` or `buf generate` from the crate directory (uses the same `buf.gen.yaml` plugin/attribute config as tycho-substreams). - `src/convert.rs` exposes the `TryFromMessage` trait and all implementations converting protobuf messages to `tycho-common` domain types. - `src/error.rs` defines `DecodeError` with `Decode(String)` and `Empty` variants so the crate has no dependency on the indexer-internal `ExtractionError`. `BlockChanges` and `TxWithContractChanges` are moved from `tycho-indexer::extractor::models` to `tycho-common::models::blockchain` and re-exported from there. `into_aggregated()` now returns `MergeError` instead of `ExtractionError`. `tycho-indexer` drops the `tycho-substreams` dependency and uses `tycho-protobuf` instead. `protobuf_deserialisation.rs` is reduced to a single re-export of `TryFromMessage`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/tycho-protobufworkspace crate that owns the protobuf type definitions and conversions previously scattered acrosstycho-substreams(external) andtycho-indexerBlockChangesandTxWithContractChangesfromtycho-indexer::extractor::modelstotycho-common::models::blockchaintycho-indexerdrops itstycho-substreamsdependencycrates/tycho-protobufsrc/pb/proto/tycho/evm/v1/common.protosrc/convert.rsTryFromMessagetrait + all protobuf → domain type conversionssrc/error.rsDecodeError(no dependency on indexer-internal error types)buf.gen.yamltycho-substreamsbuild.rsbuf generatewhenPROTO_BUILD=1is setRegenerate with
PROTO_BUILD=1 cargo build -p tycho-protobuforbuf generatefrom the crate directory.tycho-commonBlockChangesandTxWithContractChangesare now intycho-common::models::blockchain(and re-exported fromtycho-common::models).BlockChanges::into_aggregated()returnsMergeErrorinstead of the indexer-internalExtractionError.tycho-indexertycho-substreams = "0.6.0"replaced bytycho-protobuf.workspaceprotobuf_deserialisation.rsreduced topub use tycho_protobuf::convert::TryFromMessageExtractionErrorgets a manualFrom<tycho_protobuf::error::DecodeError>impl soDecodeError::Emptymaps toExtractionError::EmptyTest plan
cargo check --workspacepassescargo test -p tycho-common --libpasses (67 tests)cargo test -p tycho-indexer --libpasses (327 tests; 5serial_dbtests require a live Postgres connection and are expected to fail locally)🤖 Generated with Claude Code