Repository navigation
Hold the committed ABI directory against what alloy::sol! consumed - #283
Conversation
The rust crate is the consumer of everything LibCopyArtifacts maintains, and nothing read it: the sol lane restates the consumed set as literals, so a binding dropped from lib.rs while its file stays, or generated from anywhere but the committed copy, produced no signal in either lane. The sol! path is now derived from the binding's name, and the same token list that drives the sol! calls also expands to consumed_artifacts(), which tests/committed_abi.rs holds against the directory on disk and against each artifact's abi. Closes #205 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 37 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment: S/M/L PR Classification Guidelines:This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed. Small (S)Characteristics:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
Closes #205.
crates/bindings/src/lib.rsis the CONSUMER of everythingLibCopyArtifactsmaintains, and nothing read it. #152 closed the sol half —
contracts()andcrates/bindings/abiname each other exactly, and the copy script proves everycommitted file fresh — but the consumed set is restated there as sol literals,
because the sol lane cannot read rust. So the two directions the issue's own
follow-up comment leaves open produced no signal in either lane:
lib.rswhile its committed file stays:contracts()still names it, the file still exists, the directory still counts, and the
orphan is refreshed forever by a copy script for a consumer that no longer
reads it;
file, a copy parked elsewhere, the live forge artifact.
What changed
crates/bindings/src/lib.rs: thesol!calls expand from onecommitted_bindings!list. The file is DERIVED from the binding's name(
abi/<name>.json, which isLibCopyArtifacts.committedPath) rather thanspelled per binding, so a single-binding retarget is no longer expressible.
The same token list expands to
consumed_artifacts(), so the crate reportswhat
sol!consumed instead of restating it: it cannot name a binding thiscrate does not have, or miss one it does.
crates/bindings/tests/committed_abi.rs(new, runs inrainix-rs/ rs-test):committed_directory_is_exactly_what_the_bindings_consume— the directory'sentries are exactly
<consumed>.json, every entry rather than every.json,so a file of any name that no binding reads fails.
every_binding_is_generated_from_its_committed_artifact— each binding'sgenerated ABI equals the ABI of the committed file of its own name.
crates/bindings/Cargo.toml,Cargo.lock:serde_jsondev-dependency, todeserialize the committed artifact.
alloy_json_abi::ContractObject::from_jsonneeds an
alloy-json-abifeature thealloymeta crate does not expose.The committed directory is the oracle because it is the one thing both lanes can
read. The sol lane holds
contracts()against it; this holds it against whatsol!consumed.contracts()andlib.rsthen agree without either lanerestating the other.
Relation to #245 (issue #151)
Same shape, different coupling, deliberately the other lane. #245 holds
subgraph.yaml'smapping.entitiesagainstschema.graphql— a claim checkedagainst the file that is its other side rather than against a list restated in
the test — and it is Solidity because the things it compares against
(
IMetaV1_2.MetaV1_2.selector,LibCopyArtifacts.contracts()) ARE Solidity, soa check written elsewhere would have to re-spell them. This one is Rust for the
mirror-image reason: what it checks is what
alloy::sol!consumed, which onlythe rust lane can see at all. Disjoint files — #245 touches
subgraph/subgraph.yamlandtest/subgraph/SubgraphManifest.t.sol, thistouches
crates/bindings/**— so neither conflicts with the other.QA
committed_directory_is_exactly_what_the_bindings_consumeand
every_binding_is_generated_from_its_committed_artifact, both new incrates/bindings/tests/committed_abi.rs. Neither can fail on base: base has norust-lane check of the bindings at all, which IS the defect, so each was
verified against the defect itself instead — M1 and M2 below re-introduce the
two states the issue describes on top of this branch, and each test fails on
the state it is about.
nix develop -c cargo test -p rain-metadata-bindings(baseline on this branch: 2 passed, 0 failed):crates/bindings/src/lib.rs: dropIDescribedByMetaV1from thecommitted_bindings!list, leaving its committed file in place (the residuedirection the issue's follow-up names) -> KILLED by
committed_directory_is_exactly_what_the_bindings_consume:abi does not hold exactly the artifacts alloy::sol! consumed, left{IDescribedByMetaV1.json, IMetaBoardV1_2.json}, right{IMetaBoardV1_2.json}.crates/bindings/src/lib.rs: retarget every binding toabi/IMetaBoardV1_2.json-> KILLED byevery_binding_is_generated_from_its_committed_artifact:IDescribedByMetaV1: the generated bindings are not the abi of its committed artifact. The directory test stays green, correctly: it is about names.crates/bindings/abi/: add an orphanIMetaBoardV1_2.alt.json-> KILLEDby the directory test, which names the extra entry in the set diff.
crates/bindings/src/lib.rs+ tree: retarget the directory,abi/->abi_alt/with the files moved with it -> KILLED, both tests, on thecommitted path they cannot find.
crates/bindings/abi/*.json), whichforge script script/CopyArtifacts.solwrites and the sol lane already holdsagainst
LibCopyArtifacts.contracts(). Nothing expected is spelled in thetest: the names come from the crate's own
consumed_artifacts()and the ABIsare parsed out of the files. The one literal,
ABI_DIR = "abi", is the test'sown spelling of the directory rather than anything the
sol!calls derivetheir paths from, which is what makes M4 a disagreement instead of something
both sides follow together.
the maintainer's follow-up, narrows to one direction — a rust-side retarget or
a binding dropped from
lib.rswhile the file stays. Both are covered (M1, M2)and the sol-lane-visible directions stay covered by the sol lane. The issue's
own suggestion, "a rust test asserting the set of files under
crates/bindings/abi/equals the setalloy::sol!consumes", is whatcommitted_directory_is_exactly_what_the_bindings_consumeis; the alternativeit offers (a generated manifest both lanes read) is not taken, because the
committed directory already IS a file both lanes read.
Also run:
cargo fmt --check,cargo clippy -p rain-metadata-bindings --all-targets -- -D warnings,cargo check --workspace(this last is what sayscrates/cli's uses ofIDescribedByMetaV1andIMetaBoardV1_2::emitMetaCallstill resolve against the regenerated bindings). The pre-commit bundle passed on
the commit. Not run locally: the sol lane and the rest of
cargo test, per thestanding instruction not to run the full suite on this machine; CI on this
branch covers both.
That the sol lane cannot see M1 or M2 is not re-verified here: no
.solfile inthis repo reads
crates/bindings/src/lib.rsat all —CopyArtifacts.t.solnamesit only in comments and in a failure message — which is the whole reason the
consumed set is restated there.
Two things are deliberately not claimed:
internalTypeis dropped from both sides before comparison. alloy's expandernever sets it (
to_abi::ty_to_paramleaves itNone), so it is not a fact thegenerated bindings can carry, and comparing it would fail on every artifact.
sol!read is not asserted, only the content it produced. It does notneed to be: a binding generated from a copy elsewhere is not stale until that
copy diverges from the committed one, and the moment it does,
every_binding_is_generated_from_its_committed_artifactfails; a path outsidethe crate directory breaks packaging loudly instead of silently.
All 11 checks pass on this branch, including
rainix-rs / static / rs-static,which had been failing repo-wide on an unrelated rainix hook bug.
🤖 Generated with Claude Code