-
Notifications
You must be signed in to change notification settings - Fork 240
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
Macro error messages validating metadata and making suggestions #1339
Macro error messages validating metadata and making suggestions #1339
Conversation
* lightclient: Close wasm socket while dropping from connecting state Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Construct one time only closures Signed-off-by: Alexandru Vasile <[email protected]> * testing: Enable console logs for lightclient WASM testing Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Separate wakes and check connectivity on poll_read Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Close the socket depending on internal state Signed-off-by: Alexandru Vasile <[email protected]> * Revert "lightclient: Separate wakes and check connectivity on poll_read" This reverts commit 8660940. * lightclient: Return pending if socket is opening from poll_read Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Close the socket on `poll_close` Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Reset closures on Drop to avoid recursive invokation Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Close the socket if not already closing Signed-off-by: Alexandru Vasile <[email protected]> --------- Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
* cli: Add chainSpec command Signed-off-by: Alexandru Vasile <[email protected]> * cli/chainSpec: Move to dedicated module Signed-off-by: Alexandru Vasile <[email protected]> * cli: Compute the state root hash Signed-off-by: Alexandru Vasile <[email protected]> * cli: Remove code substitutes Signed-off-by: Alexandru Vasile <[email protected]> * artifacts: Update polkadot.json Signed-off-by: Alexandru Vasile <[email protected]> * scripts: Generate the chain spec Signed-off-by: Alexandru Vasile <[email protected]> * cli: Remove testing artifacts Signed-off-by: Alexandru Vasile <[email protected]> * cli: Fix clippy Signed-off-by: Alexandru Vasile <[email protected]> * cli: Apply rustfmt Signed-off-by: Alexandru Vasile <[email protected]> * cli: Introduce feature flag for smoldot dependency Signed-off-by: Alexandru Vasile <[email protected]> * cli: Rename chain-spec to chain-spec-pruning Signed-off-by: Alexandru Vasile <[email protected]> * scripts: Update chain-spec command Signed-off-by: Alexandru Vasile <[email protected]> --------- Signed-off-by: Alexandru Vasile <[email protected]>
* update crypto dependencies, adjust keypair * add scale_info::TypeInfo derive in some places * add multi signature derive
…on' into tadeohepperle/macro-better-error-messages
macro/src/lib.rs
Outdated
} | ||
} | ||
|
||
/// Fetches metadata in a blocking manner, either from a url (not recommended) or from a file path. |
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.
I don't get why fetching metadata from an URL is not recommended? :)
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.
It is not recommended for users because the compilation blocks while fetching the metadata, which is a bit slow and (maybe flaky) compared to using metadata file. But yeah, maybe the docs of this function don't need to mention this.
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.
Maybe we can say its not recommended for production use-cases. Do remember we added the ability to fetch the metadata from URL as a feature request from the cargo-contract
team, that wanted to fetch a fresh metadata for their testing
Co-authored-by: Niklas Adolfsson <[email protected]>
macro/src/lib.rs
Outdated
} | ||
|
||
// Note: just an additional function to make early returns easier. | ||
fn _subxt(args: TokenStream, item_mod: syn::ItemMod) -> Result<TokenStream, TokenStream> { |
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.
nit: or subxt_inner
; the underscore leads me to wonder if we are going to use the function (similar to let _unused = ..
)
macro/Cargo.toml
Outdated
@@ -23,5 +23,7 @@ proc-macro = true | |||
codec = { package = "parity-scale-codec", workspace = true } | |||
darling = { workspace = true } | |||
proc-macro-error = { workspace = true } | |||
syn = { workspace = true } | |||
syn.workspace = true |
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.
I do wonder, did this happen as a result of some linting extensions from your IDE?
We could revert this to keep consistency with the dependencies of this file (syn = { workspace = true }
)
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.
Nice one! 👍
Just some changes wrt the documentation, and importing the dependencies with a different format
Fixes #1269
Branched from #1260 so #1260 should be merged first.
This PR introduces checks to all user defined type paths that are passed to the subxt macro. This could be a custom derive, attribute or a substitute for a type. The macro now makes sure that the specified path exists in the type registry. If this is not fulfilled it errors and gives the user a list of valid paths that belong to a Type with the same name. Here is an example: