propagate the IDescribedByMetaV1 probe error out of implements_i_described_by_meta_v1 - #271
Open
thedavidmeister wants to merge 1 commit into
Open
propagate the IDescribedByMetaV1 probe error out of implements_i_described_by_meta_v1#271thedavidmeister wants to merge 1 commit into
thedavidmeister wants to merge 1 commit into
Conversation
The IDescribedByMetaV1 `supportsInterface` call folded every failure into `false` with `Err(_) => false` plus `abi_decode_returns(..).unwrap_or(false)`, so a transport outage, a rate limit or a malformed node response rendered as the definitive "this contract does not implement IDescribedByMetaV1". The call now goes through rain-erc's own `IERC165` rpc binding and reuses its classification: revert data or empty calldata stay `Ok(false)` per ERC-165, anything else surfaces as `Erc165Error`. `fetch_for_contract` renders that as a new transparent `AuthoringMetaV2Error::Erc165Error` rather than `HasNoWords`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 22 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 selected for processing (2)
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 |
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.
Closes #175.
The IDescribedByMetaV1
supportsInterfacecall inimplements_i_described_by_meta_v1folded every failure intofalse:so a transport outage, a rate limit, or a malformed node response rendered as
the definitive "this contract does not implement IDescribedByMetaV1", and
fetch_for_contractturned that intoHasNoWords— indistinguishable from acontract that genuinely lacks the interface.
IERC165rpc binding(
IERC165::new(addr, provider).supportsInterface(..).call()) and reuses thatcrate's classification rather than a second, looser one: revert data or empty
calldata stay
Ok(false)per ERC-165, anything else — transport failure,decode failure — surfaces as
Erc165Error, rain-erc's documented "answerunknown". The manual
TransactionRequest+abi_decode_returnsround tripgoes away with it.
AuthoringMetaV2Errorgains a transparentErc165Errorvariant, andfetch_for_contractmaps the probe error into it rather thanHasNoWords.Relationship to #243
implements_i_described_by_meta_v1folds twice, and the two folds are filed astwo issues. PR #243, filed against issue #154, fixes the first fold —
supports_erc165(..) .unwrap_or(false)at the top of the function. This PR fixes the second —the
IDescribedByMetaV1supportsInterfacecall at the bottom — anddeliberately leaves the first
unwrap_or(false)untouched, so the two changesare complementary rather than overlapping.
Both must change the signature to
Result<bool, Erc165Error>to carry an errorout at all, and both add the same
AuthoringMetaV2Error::Erc165Errorvariantand the same
fetch_for_contractcall-site shape; that shared part is writtenidentically to #243 here to keep the merge trivial. Merge order does not
matter, but whichever lands second needs a rebase whose only real conflicts
are one line in the function head (take #243's
.await?) and the match block atthe tail (take this PR's). Merging only one of them leaves the other fold in
place.
QA
meta::tests::test_implements_described_by_call_error_is_unknown(erc165 gate passes, the IDescribedByMetaV1 probe answers a JSON-RPC rate-limit error with no revert data, the gate must returnErr),meta::tests::test_implements_undecodable_response_is_unknown(the probe answers0xdeadbeef, not a decodablebool, so a decode failure must beErrnotfalse),meta::types::authoring::v2::tests::test_fetch_for_contract_described_by_probe_error_is_not_has_no_words(the RPC answers thesupportsInterface(IDescribedByMetaV1)call with HTTP 500;fetch_for_contractmust surfaceErc165Error, notHasNoWords) — each fails on base behaviour, verified by reinstating the pre-change expression under the new signature, see the mutation line below.crates/cli/src/meta/mod.rs:463-470, the whole match tail replaced by the literal pre-change semanticsOk(supported) => Ok(supported), Err(_) => Ok(false),— one edit reinstates both halves of the old fold, since the contract binding surfaces the decode failure asErrtoo. Result:11 passed; 3 failed; killed by exactly the three discriminating tests above. The tests pinning behaviour this PR does not change survived, as intended:test_implements_i_describe_by_meta_v1(revert →Ok(false)),test_implements_empty_response_is_false(0x→Ok(false)) andtest_implements_erc165_gate_short_circuits(the erc165-probe fold, propagate the erc165 probe error out of fetch_for_contract #243's half). Mutation reverted, filtered suite re-run green — 14 passed.supports_erc165— "Errif a non-revert failure (transport or decode) prevented us from finishing the probe — callers can treat that as 'answer unknown' rather than silently reading 'no support'" — plus the rule itsErc165Errordoc and privateis_revert_likestate (revert data orZeroDatafold toOk(false), everything else isErr), read from~/.cargo/registry/.../rain-erc-0.1.1/src/erc165/mod.rs, i.e. from the dependency rather than from this repo's implementation. The fetch-level expectation follows from the issue's own framing: transport failures after the gate already surface asRpcError, so the gate's must surface too.Err;fetch_for_contractrenders it asErc165Error), for transport and for decode, which the issue names together. The issue's alternative branch — keepbooland document that errors read asfalse— is not taken; theResultbranch it offers is.test_implements_undecodable_response_is_falseis renamed totest_implements_empty_response_is_falsebecause "undecodable" now names the opposite outcome; the response it pushes and the answer it asserts are unchanged. The first fold in the same function belongs to issue fetch_for_contract reports transient RPC/transport failures during the erc165 probe as HasNoWords #154 / PR propagate the erc165 probe error out of fetch_for_contract #243 and is deliberately out of scope here.Local:
cargo fmt --check,cargo check --all-targetsandcargo clippy --all-targets -- -D warningsclean. Test runs were filtered tothe affected tests rather than the whole suite.
🤖 Generated with Claude Code