-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ink! Analyzer #1615
ink! Analyzer #1615
Conversation
Hi @semuelle 👋 |
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.
Hi @davidsemakula thanks for the interesting application. I think this is a very useful project and would be happy to support it. Regarding static analysis, there is also substrace, and saft for frame pallets. Just wanted to mention these for you to check out, however I believe both are smaller research projects and don't have a VS-Code extension.
Hi @keeganquigley |
thanks for the explanation @davidsemakula yes I figured that would be the case considering you are focusing on ink! specifically. So no need to include them. However, it's possible that other committee members may ask more questions during the approval process. |
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.
Looks interesting to me, and I'm happy to approve it. You might want to take a look at this RFP: https://github.com/w3f/Grants-Program/blob/master/docs/RFPs/Open/Static-Analysis-for-Runtime-Pallets.md Ideally, at some point, there are tools for semantic as well as static analysis for ink, and I believe you mentioned this already as part of your future roadmap.
Hi @Noc2
Will do, thanks for sharing.
Yes, it's definitely something I'll be adding in the future, I just wanted to keep the initial scope relatively small. |
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.
Great project and great application. I would be happy to see this come to life.
Just one question: Do Docker deliverables really make sense in this project? Wouldn't a Makefile for building/testing/installing locally make more sense?
Hi @semuelle
So specifically for milestone 4, VS Code has this feature called Dev Containers that allows you to use a docker container as an isolated development environment that I think will be a neat and easy way for testing the VS Code extension. So for me this and the "apparent" preference for Docker testing environments in the application template made Docker look like the obvious choice. |
@Noc2 Looks like me requesting a re-review from Sebastian removed your review request from @bhargavbh 🙈 |
Congratulations and welcome to the Web3 Foundation Grants Program! Please refer to our Milestone Delivery repository for instructions on how to submit milestones and invoices, our FAQ for frequently asked questions and the support section of our README for more ways to find answers to your questions. |
@davidsemakula Congrats on the acceptance of the grant! Just to let you know, there is an ink! security meetup happening in Berlin next week. You can find details here. Not sure where you are based out of but just wanted to forward the info in case you are able to attend :) Looking forward to the deliveries. |
Thanks @keeganquigley, Super excited to work on the deliveries for this as well. 🚀 |
Thanks for taking the time to review and approve @keeganquigley, @Noc2 and @semuelle 🙂 |
Hi all. Sorry for the late reply as i was OoO. Even though the grant has been approved, i would still like to pitch in to get some clarity, since this is a very relevant project and would love to see it succeed.
|
Hi @bhargavbh
I briefly mentioned in the architecture section that the ink_ir crate will be used as a reference implementation for ink's semantic rules but I agree that it makes sense to share the methodology for extracting the semantic rules. So for each ink! macro defined in the ink_macro crate, we'll be extracting these rules from its corresponding ink_ir type, the types and functions it uses, as well as related unit tests. Using the I will definitely document this for testers and other contributors.
At the IR/AST level, yes. But the public interface has a wider feature set that will resemble (not just simply use) rust_ap_ide, so it's a bit more than just generating an IR/AST. The IR is more like a lower level dependency for the higher level semantic analyzer.
At a high-level yes, at a lower level the internal architectures for syn and ra_ap_syntax are sufficiently different that it would not be a trivial comparison but certainly doable.
At this stage, Yes. In general, like ink! itself, eDSL validation is happening before/without any macro code generation. In ink!'s case, all eDSL validation is performed in the ink_ir crate with public interface level type constructors returning Result<T, syn::Error>, and any Rust level errors from syn returned as is. In the future, with more ambitious goals for the analysis, this may change, but at this stage, it will all be ink IR level analysis.
Not 100% sure I follow, but I think this a no, if I understand you correctly. I think my answer above implicitly answers this as well though, otherwise some more context may help get us on the same page 🙂 |
Hi @davidsemakula thanks for the response!
|
Project Abstract
ink! analyzer is a collection of modular and reusable libraries and tools for semantic analysis of ink! smart contract code.
ink! analyzer aims to improve ink! language support in integrated development environments (IDEs), source code editors and other development tools by providing modular and reusable building blocks for implementing features like diagnostic errors, code completion suggestions, code/intent actions and hover content for the ink! programming language which is used for writing smart contracts for blockchains built on Substrate.
Relying on only generic Rust language support in IDEs, code editors and other development tools has some significant limitations for the developer experience including:
#[ink(storage)]
struct, at least one#[ink(message)]
method and the same for#[ink(constructor)]
, ink! attributes should be applied to items of the correct type e.t.c)#[ink(payable)]
) because macro expansion/name resolution and trait resolution are hard problems for generic IDE/code editor tools (see also https://rust-analyzer.github.io/blog/2021/11/21/ides-and-macros.html).To solve the above challenges and improve ink! language support in IDEs, code editors and other development tools, this project will create two main components:
Grant level
Application Checklist
project_name.md
).@_______:matrix.org
(change the homeserver if you use a different one)