-
Notifications
You must be signed in to change notification settings - Fork 79
refactor: scaffold multi-chain pipeline #910
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
Changes from all commits
4a187fb
33e957d
0e189fe
83b17dd
43aad01
f520acb
7a382fd
5f0c285
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,7 +39,7 @@ gasket::impl_splitter!(|_worker: Worker, stage: Stage, unit: ChainEvent| => { | |||||||||||||||
| let mut buffer = Vec::new(); | ||||||||||||||||
|
|
||||||||||||||||
| match unit { | ||||||||||||||||
| ChainEvent::Apply(point, Record::CborBlock(cbor)) => { | ||||||||||||||||
| ChainEvent::Apply(point, Record::Cardano(cardano::Record::CborBlock(cbor))) => { | ||||||||||||||||
| let mut writer = EventWriter::new( | ||||||||||||||||
| point.clone(), | ||||||||||||||||
| &stage.output, | ||||||||||||||||
|
|
@@ -89,9 +89,13 @@ pub struct Config { | |||||||||||||||
|
|
||||||||||||||||
| impl Config { | ||||||||||||||||
| pub fn bootstrapper(self, ctx: &Context) -> Result<Stage, Error> { | ||||||||||||||||
| let chain_config = match &ctx.chain { | ||||||||||||||||
| Chain::Cardano(chain_config) => chain_config.clone(), | ||||||||||||||||
| }; | ||||||||||||||||
|
Comment on lines
+92
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-exhaustive pattern matching will panic on non-Cardano chains. The pattern match on Add proper error handling for non-Cardano chains: - let chain_config = match &ctx.chain {
- Chain::Cardano(chain_config) => chain_config.clone(),
- };
+ let chain_config = match &ctx.chain {
+ Chain::Cardano(chain_config) => chain_config.clone(),
+ _ => return Err(Error::config("legacy_v1 filter only supports Cardano chain")),
+ };📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
|
|
||||||||||||||||
| let stage = Stage { | ||||||||||||||||
| config: self, | ||||||||||||||||
| genesis: ctx.chain.clone().into(), | ||||||||||||||||
| genesis: chain_config.into(), | ||||||||||||||||
| ops_count: Default::default(), | ||||||||||||||||
| input: Default::default(), | ||||||||||||||||
| output: Default::default(), | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| use serde_json::{json, Value as JsonValue}; | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub enum Record { | ||
| // Scaffold placeholder for now | ||
| ParsedBlock(()), | ||
| RawBlock(Vec<u8>), | ||
| } | ||
|
|
||
| impl From<Record> for JsonValue { | ||
| fn from(value: Record) -> Self { | ||
| match value { | ||
| Record::ParsedBlock(x) => json!(x), | ||
| Record::RawBlock(x) => json!({ "hex": hex::encode(x) }), | ||
| } | ||
| } | ||
| } |
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.
Make
alloydependency optional and feature-gated.The
alloydependency is currently unconditional despite the TODO comment suggesting it should be feature-gated. This adds unnecessary dependencies and increases build times for users not using Ethereum features.Apply this diff to make
alloyoptional and gated by theethfeature:Then update the
ethfeature definition at line 23 to includealloy:📝 Committable suggestion
🤖 Prompt for AI Agents