-
Notifications
You must be signed in to change notification settings - Fork 677
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
feat: RPC endpoint /v2/traits/<contract-info>/<trait-info> #2498
Conversation
Thanks for this PR, @pavitthrap! One note before I take a closer look at the PR: this should be opened against |
ce26d03
to
9f70421
Compare
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.
This looks good to me, thanks @pavitthrap! I just had a few style nits. And since this PR adds a new RPC endpoint, you should update two places in the PR:
- Add a brief changelog entry under the
[Unreleased]
section inCHANGELOG.md
- Add an entry for the new endpoint to the OpenAPI spec
./docs/rpc/openapi.yaml
…ermine if a trait is implemented in a contract
9f70421
to
ea6e0c6
Compare
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.
LGTM! Just one comment on the endpoint's tag.
A note for the future: it'd be better not to do a force-push to update the PR once you've already opened the PR. It makes checking for resolution of comments harder because the reviewer can't see the specific changes that were made to address them.
Ah got it. It seemed like the only way here since I needed to rebase to get the openAPI changes, but I'll avoid it in other scenarios. |
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.
LGTM! Thanks @pavitthrap
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Added a RPC endpoint to determine if a given trait is implemented in a contract, either explicitly or implicitly.
Fixes #2382
Description
For some background, a trait is explicitly implemented in a contract if the contract has
impl-trait <trait info>
. Implicit implementation means a contract implements the traits without the declaration above.Notes
TraitIdentifier
) a field in HttpRequestType::GetIsTraitImplemented, even though the GET request independently passes in a trait name, trait contract address, and trait contract name. I did this because I thought it would be cleaner to parse the API path at a higher level, and pass down consolidated information (in the form of the structTraitIdentifier
. However, this is not consistent with how the contract data is passed (which is passed separately as contract address and contract name), so let me know if I should avoid consolidating the trait info until the functionhandle_get_is_trait_implemented
insrc/net/rpc.rs
.contract_analysis.add_implemented_trait
, and save the updated contract analysis by callingset_metadata
, which is a method ofClarityDatabase
. Let me know if I should open a RW connection to the database instead, and commit this information.Type of Change
Does this introduce a breaking change?
List the APIs or describe the functionality that this PR breaks.
Workarounds for or expected timeline for deprecation
Are documentation updates required?
Want to update the RPC endpoint documentation here
Testing information
Ran
cargo test
.