| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Move preprocess_abi_json (and add_default_event_param_names) out of the codegen command and into the shared abi module so that other components can normalize ABIs the same way codegen does. No behavior change for codegen; this is a prerequisite for making manifest validation parse ABIs identically to codegen.
load_abi previously returned Option and silently dropped read/parse errors, so an event handler referencing a malformed ABI would skip signature validation entirely and codegen would still report success. Return Result<Option<JsonAbi>, ManifestValidationError> instead: - missing file -> Ok(None) (reported by file-existence validation) - present but unparseable -> Err(InvalidFile), surfaced to the user - otherwise Ok(Some(abi)) The ABI is now preprocessed via abi::preprocess_abi_json so validation parses exactly what codegen parses, avoiding spurious mismatches.
'gnd add' wrote the ABI, mapping stub, manifest entry and networks.json for the new data source but never updated schema.graphql, so the generated subgraph referenced entity types that did not exist and failed to compile. Add add_schema_entities, which appends a GraphQL entity type per event (reusing the new scaffold::generate_event_entities helper). Entity names already present in the schema are skipped with a notice, so re-running 'add' or adding a contract that shares event names never produces duplicate type definitions.
The contract-address validator hardcoded Ethereum's 0x + 40-hex format, so 'gnd init --protocol near' rejected every valid NEAR named account (e.g. wnear.flux-dev). Add protocol-aware validate_contract_address: Ethereum keeps the hex check, NEAR uses the account-id rules (length 2..=64 and NEAR's naming regex), and other protocols are checked only for non-emptiness. Wire it into both the non-interactive init_from_contract path and the interactive contract-address prompt.
load_manifest parsed manifests with graph-node's Ethereum-typed UnresolvedSubgraphManifest, whose deserializer rejects 'kind: near', so 'gnd codegen' failed outright on NEAR subgraphs. NEAR (like cosmos/arweave/substreams) has no ABIs, and codegen only needs the schema path plus data-source/template names and mapping files. Rather than depend on each chain crate, detect these kinds and route to a lightweight parse_manifest_loose that extracts just those fields from the YAML. The Ethereum/subgraph typed path is unchanged. NEAR codegen now emits schema types only, matching graph-cli.
graph-node no longer supports the cosmos, arweave, or substreams chains, so gnd should not let users create or process subgraphs for them. Refuse them both when creating a subgraph (`init --protocol`) and when loading an existing manifest (codegen/build/validate/test/deploy), pointing users to an older graph-cli version instead. The `--protocol` flag still accepts these values (the variants are kept but hidden from `--help` and completion) so we can emit a helpful message rather than a generic clap error. NEAR stays supported, and the still-supported `file/arweave` offchain data source is left untouched.
There was a problem hiding this comment.
LGTM! Some of this overlaps with my #6661 (eg: abi.rs preprocessing move). No action needed, I'll rebase mine once this lands.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR addresses the issues noted in graph-tooling