mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-24 05:27:59 +00:00
Macro error messages validating metadata and making suggestions (#1339)
* integrate scale-typegen, remove types mod * reintroduce default substitutes and derives * support runtime_types only again * generating polkadot.rs ok * update scale-typegen to discrete error types * scale-typegen-api-changes * add note about UncheckedExtrinsic in default substitutes * add resursive attributes and derives * adjust example where Clone bound recursive * move scale-typegen dependency to workspace * expose default typegen settings * lightclient: Fix wasm socket closure called after being dropped (#1289) * lightclient: Close wasm socket while dropping from connecting state Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * lightclient: Construct one time only closures Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * testing: Enable console logs for lightclient WASM testing Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * lightclient: Separate wakes and check connectivity on poll_read Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * lightclient: Close the socket depending on internal state Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Revert "lightclient: Separate wakes and check connectivity on poll_read" This reverts commit 866094001d4c0b119a80ed681a74b323f74eae1b. * lightclient: Return pending if socket is opening from poll_read Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * lightclient: Close the socket on `poll_close` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * lightclient: Reset closures on Drop to avoid recursive invokation Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * lightclient: Close the socket if not already closing Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * workflows: Install rustup component for building substrate (#1295) Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Command to fetch chainSpec and optimise its size (#1278) * cli: Add chainSpec command Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli/chainSpec: Move to dedicated module Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Compute the state root hash Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Remove code substitutes Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * artifacts: Update polkadot.json Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * scripts: Generate the chain spec Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Remove testing artifacts Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Fix clippy Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Apply rustfmt Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Introduce feature flag for smoldot dependency Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cli: Rename chain-spec to chain-spec-pruning Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * scripts: Update chain-spec command Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * remove comments and unused args * Update substrate- and signer-related dependencies (#1297) * update crypto dependencies, adjust keypair * add scale_info::TypeInfo derive in some places * add multi signature derive * fix lock file * fix lock file again :| * adjust to new interface in scale-typegen * use released scale typegen * reintroduce type aliases * introduce type aliases again using scale-typegen * cargo fmt and clippy * reconcile changes with master branch * update polkadot.rs * bump scale-typgen to fix substitution * subxt macro, helpful error messages * adjust ui tests * fix lock file * format * Update macro/src/lib.rs Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> * incorperate nits * update Cargo.lock to avoid compatibility issues --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
#[subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_runtime::multiaddress::Event",
|
||||
with = "crate::MyEvent"
|
||||
)
|
||||
)]
|
||||
pub mod node_runtime {}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,18 @@
|
||||
error: Type `Event` does not exist at path `sp_runtime::multiaddress::Event`
|
||||
|
||||
A type with the same name is present at:
|
||||
frame_system::pallet::Event
|
||||
pallet_balances::pallet::Event
|
||||
pallet_multisig::pallet::Event
|
||||
--> src/incorrect/substitute_at_wrong_path.rs:1:1
|
||||
|
|
||||
1 | / #[subxt::subxt(
|
||||
2 | | runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
3 | | substitute_type(
|
||||
4 | | path = "sp_runtime::multiaddress::Event",
|
||||
5 | | with = "crate::MyEvent"
|
||||
6 | | )
|
||||
7 | | )]
|
||||
| |__^
|
||||
|
|
||||
= note: this error originates in the attribute macro `subxt::subxt` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
@@ -1,8 +1,8 @@
|
||||
#[subxt::subxt(
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_tiny.scale",
|
||||
runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
substitute_type(
|
||||
path = "sp_arithmetic::per_things::Perbill",
|
||||
with = "sp_runtime::Perbill"
|
||||
path = "frame_support::dispatch::DispatchInfo",
|
||||
with = "my_mod::DispatchInfo"
|
||||
)
|
||||
)]
|
||||
pub mod node_runtime {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error: Type Generation failed: Type substitution error: `substitute_type(with = <path>)` must be a path prefixed with 'crate::' or '::'
|
||||
--> src/incorrect/substitute_path_not_absolute.rs:5:16
|
||||
|
|
||||
5 | with = "sp_runtime::Perbill"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
5 | with = "my_mod::DispatchInfo"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Reference in New Issue
Block a user