Skip to content

Commit 44ca8f6

Browse files
committed
gnd: Replace custom manifest parsing with graph-node types
Replace gnd's lenient manual JSON/YAML parsing with graph-node's `UnresolvedSubgraphManifest<Chain>::parse()`. This uses the same serde types as graph-node itself, so required fields like `source.abi` and `mapping.abis` are now enforced at parse time. Changes: - Add `graph-chain-ethereum` as a direct gnd dependency - Rewrite `load_manifest()` to use `UnresolvedSubgraphManifest::parse()` - Convert parsed graph-node types into gnd's existing Manifest/DataSource /Template/Abi types to minimize caller changes - Re-export unresolved Ethereum types from graph-chain-ethereum for future validation steps - Add `UnresolvedSource::address()` accessor on subgraph data sources - Add tests for missing `source.abi` and missing `mapping.abis` rejection - Update test manifests to include all required fields
1 parent 980d9ac commit 44ca8f6

6 files changed

Lines changed: 279 additions & 137 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chain/ethereum/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ pub use buffered_call_cache::BufferedCallCache;
2323

2424
// ETHDEP: These concrete types should probably not be exposed.
2525
pub use data_source::{
26-
BlockHandlerFilter, DataSource, DataSourceTemplate, Mapping, TemplateSource,
26+
BlockHandlerFilter, DataSource, DataSourceTemplate, Mapping, MappingBlockHandler,
27+
MappingCallHandler, TemplateSource, UnresolvedDataSource, UnresolvedDataSourceTemplate,
28+
UnresolvedMapping, UnresolvedMappingEventHandler,
2729
};
2830

2931
pub mod chain;

gnd/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ path = "tests/codegen_verification.rs"
1818
[dependencies]
1919
# Core graph dependencies
2020
graph = { path = "../graph" }
21+
graph-chain-ethereum = { path = "../chain/ethereum" }
2122
graph-core = { path = "../core" }
2223
graph-node = { path = "../node" }
2324

gnd/src/commands/codegen.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ schema:
612612
dataSources:
613613
- kind: ethereum/contract
614614
name: TestDataSource
615+
source:
616+
abi: TestContract
615617
mapping:
616618
kind: ethereum/events
617619
apiVersion: 0.0.5
@@ -727,6 +729,8 @@ schema:
727729
dataSources:
728730
- kind: ethereum/contract
729731
name: ExampleSubgraph
732+
source:
733+
abi: ExampleContract
730734
mapping:
731735
kind: ethereum/events
732736
apiVersion: 0.0.5

0 commit comments

Comments
 (0)