diff --git a/Cargo.toml b/Cargo.toml index 5fbf1113855..123f80b803c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,18 @@ [workspace] resolver = "2" members = [ - "crates/ink", - "crates/metadata", "crates/allocator", + "crates/e2e", + "crates/e2e/macro", + "crates/engine", + "crates/env", "crates/ink", - "crates/ink/macro", - "crates/ink/ir", "crates/ink/codegen", + "crates/ink/ir", "crates/ink/macro", + "crates/metadata", "crates/prelude", "crates/primitives", - "crates/e2e", - "crates/e2e/macro", - "crates/engine", - "crates/env", "crates/storage", "crates/storage/traits", ] @@ -22,6 +20,80 @@ exclude = [ "integration-tests/", ] +[workspace.package] +edition = "2021" +categories = ["no-std", "embedded"] +homepage = "https://www.parity.io/" +keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] +license = "Apache-2.0" +repository = "https://github.com/paritytech/ink" +version = "4.2.0" + +[workspace.dependencies] +arrayref = { version = "0.3" } +array-init = { version = "2.0", default-features = false } +blake2 = { version = "0.10" } +cargo_metadata = { version = "0.15.3" } +cfg-if = { version = "1.0" } +contract-build = { version = "3.0.0" } +derive_more = { version = "0.99.17", default-features = false } +either = { version = "1.5", default-features = false } +funty = { version = "2.0.0" } +heck = { version = "0.4.0" } +impl-serde = { version = "0.4.0", default-features = false } +itertools = { version = "0.11", default-features = false } +jsonrpsee = { version = "0.18.0" } +num-traits = { version = "0.2", default-features = false } +paste = { version = "1.0" } +pretty_assertions = { version = "1" } +proc-macro2 = { version = "1" } +quickcheck = { version = "1" } +quickcheck_macros = { version = "1" } +quote = { version = "1" } +rlibc = { version = "1" } +scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } +scale-decode = { version = "0.7.0", default-features = false } +scale-encode = { version = "0.3.0", default-features = false } +scale-info = { version = "2.6", default-features = false } +schemars = { version = "0.8" } +secp256k1 = { version = "0.27.0" } +serde = { version = "1.0.137", default-features = false } +serde_json = { version = "1.0.81" } +sha2 = { version = "0.10" } +sha3 = { version = "0.10" } +static_assertions = { version = "1.1" } +subxt = { version = "0.29.0" } +syn = { version = "2" } +synstructure = { version = "0.13.0" } +tokio = { version = "1.18.2" } +tracing = { version = "0.1.37" } +tracing-subscriber = { version = "0.3.17" } +trybuild = { version = "1.0.60" } +which = { version = "4.4.0" } +xxhash-rust = { version = "0.8" } + +# Substrate dependencies +pallet-contracts-primitives = { version = "24.0.0", default-features = false } +sp-core = { version = "21.0.0", default-features = false } +sp-keyring = { version = "24.0.0", default-features = false } +sp-runtime = { version = "24.0.0", default-features = false } +sp-weights = { version = "20.0.0", default-features = false } + +# Local dependencies +ink = { version = "4.2.0", path = "crates/ink", default-features = false } +ink_allocator = { version = "4.2.0", path = "crates/allocator", default-features = false } +ink_codegen = { version = "4.2.0", path = "crates/ink/codegen", default-features = false } +ink_e2e_macro = { version = "4.2.0", path = "crates/e2e/macro", default-features = false } +ink_engine = { version = "4.2.0", path = "crates/engine", default-features = false } +ink_env = { version = "4.2.0", path = "crates/env", default-features = false } +ink_ir = { version = "4.2.0", path = "crates/ink/ir", default-features = false } +ink_macro = { version = "4.2.0", path = "crates/ink/macro", default-features = false } +ink_metadata = { version = "4.2.0", path = "crates/metadata", default-features = false } +ink_prelude = { version = "4.2.0", path = "crates/prelude", default-features = false } +ink_primitives = { version = "4.2.0", path = "crates/primitives", default-features = false } +ink_storage = { version = "4.2.0", path = "crates/storage", default-features = false } +ink_storage_traits = { version = "4.2.0", path = "crates/storage/traits", default-features = false } + [profile.release] panic = "abort" lto = true diff --git a/crates/allocator/Cargo.toml b/crates/allocator/Cargo.toml index 5186baad1e7..14cc800c778 100644 --- a/crates/allocator/Cargo.toml +++ b/crates/allocator/Cargo.toml @@ -1,25 +1,26 @@ [package] name = "ink_allocator" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_allocator/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "[ink!] Bindings to the Wasm heap memory allocator." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_allocator/" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" [dependencies] -cfg-if = "1.0" +cfg-if = { workspace = true } [dev-dependencies] -quickcheck = "1" -quickcheck_macros = "1" +quickcheck = { workspace = true } +quickcheck_macros = { workspace = true } [features] default = ["std"] diff --git a/crates/e2e/Cargo.toml b/crates/e2e/Cargo.toml index 298b3a5a571..fac9e50bee2 100644 --- a/crates/e2e/Cargo.toml +++ b/crates/e2e/Cargo.toml @@ -1,46 +1,47 @@ [package] name = "ink_e2e" -version = "4.2.0" -authors = ["Parity Technologies "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_e2e/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies "] description = "[ink!] End-to-end testing framework for smart contracts." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_e2e/" include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] +readme = "README.md" [dependencies] -ink_e2e_macro = { version = "4.2.0", path = "./macro" } -ink = { version = "4.2.0", path = "../ink" } -ink_env = { version = "4.2.0", path = "../env" } -ink_primitives = { version = "4.2.0", path = "../primitives" } +funty = { workspace = true } +impl-serde = { workspace = true } +jsonrpsee = { workspace = true, features = ["ws-client"] } +scale = { package = "parity-scale-codec", workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +subxt = { workspace = true } +tokio = { workspace = true, features = ["rt-multi-thread"] } +tracing = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } -funty = "2.0.0" -impl-serde = { version = "0.4.0", default-features = false } -jsonrpsee = { version = "0.18.0", features = ["ws-client"] } -serde = { version = "1.0.137", default-features = false, features = ["derive"] } -serde_json = { version = "1.0.81" } -tokio = { version = "1.18.2", features = ["rt-multi-thread"] } -tracing = "0.1.37" -tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -subxt = "0.29.0" +ink_e2e_macro = { workspace = true, default-features = true } +ink = { workspace = true, default-features = true } +ink_env = { workspace = true, default-features = true } +ink_primitives = { workspace = true, default-features = true } # Substrate -pallet-contracts-primitives = "24.0.0" -sp-core = { version = "21.0.0", default-features = false } -sp-keyring = "24.0.0" -sp-runtime = "24.0.0" -sp-weights = "20.0.0" +pallet-contracts-primitives = { workspace = true } +sp-core = { workspace = true } +sp-keyring = { workspace = true } +sp-runtime = { workspace = true } +sp-weights = { workspace = true } [dev-dependencies] # Required for the doctest of `MessageBuilder::call` -scale-info = { version = "2.6", default-features = false, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } [features] default = ["std"] diff --git a/crates/e2e/macro/Cargo.toml b/crates/e2e/macro/Cargo.toml index 2cace41bab1..cbd8a8f4626 100644 --- a/crates/e2e/macro/Cargo.toml +++ b/crates/e2e/macro/Cargo.toml @@ -1,31 +1,33 @@ [package] name = "ink_e2e_macro" -version = "4.2.0" -authors = ["Parity Technologies "] -edition = "2021" -license = "Apache-2.0" -readme = "../README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_macro/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies "] description = "[ink!] Macro for generating end-to-end tests" -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_e2e_macro/" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "../README.md" [lib] name = "ink_e2e_macro" proc-macro = true [dependencies] -ink_ir = { version = "4.2.0", path = "../../ink/ir" } -cargo_metadata = "0.15.3" -contract-build = "3.0.0" -derive_more = "0.99.17" -tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } -serde_json = "1.0.89" -syn = "2" -proc-macro2 = "1" -quote = "1" -which = "4.4.0" +cargo_metadata = { workspace = true } +contract-build = { workspace = true } +derive_more = { workspace = true, default-features = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } +serde_json = { workspace = true } +syn = { workspace = true } +proc-macro2 = { workspace = true } +quote = { workspace = true } +which = { workspace = true } + +ink_ir = { workspace = true, default-features = true } diff --git a/crates/e2e/src/xts.rs b/crates/e2e/src/xts.rs index fc2463227db..1334c8f30e5 100644 --- a/crates/e2e/src/xts.rs +++ b/crates/e2e/src/xts.rs @@ -19,6 +19,7 @@ use super::{ ContractInstantiateResult, Signer, }; + use ink_env::Environment; use core::marker::PhantomData; diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index 3cc2465e26b..4c47c1e8c6d 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -1,30 +1,31 @@ [package] name = "ink_engine" -version = "4.2.0" -authors = ["Parity Technologies ", "Michael Müller "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_engine/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Michael Müller "] description = "[ink!] Off-chain environment for testing." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_engine/" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" [dependencies] -ink_primitives = { version = "4.2.0", path = "../../crates/primitives", default-features = false } -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } +derive_more = { workspace = true, features = ["from", "display"] } +scale = { package = "parity-scale-codec", workspace = true } +sha2 = { workspace = true } +sha3 = { workspace = true } +blake2 = { workspace = true } -sha2 = { version = "0.10" } -sha3 = { version = "0.10" } -blake2 = { version = "0.10" } +ink_primitives = { workspace = true } # ECDSA for the off-chain environment. -secp256k1 = { version = "0.27.0", features = ["recovery", "global-context"], optional = true } +secp256k1 = { workspace = true, features = ["recovery", "global-context"], optional = true } [features] default = ["std"] diff --git a/crates/engine/src/chain_extension.rs b/crates/engine/src/chain_extension.rs index 3a9bf3c1f53..40cd3bb4efc 100644 --- a/crates/engine/src/chain_extension.rs +++ b/crates/engine/src/chain_extension.rs @@ -13,6 +13,7 @@ // limitations under the License. use super::Error; + use derive_more::From; use std::collections::{ hash_map::Entry, diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index d3f4840024d..3c4585fbc60 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -1,58 +1,59 @@ [package] name = "ink_env" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -rust-version = "1.68" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_env/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "[ink!] Low-level interface for interacting with the smart contract Wasm executor." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_env/" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" +rust-version = "1.68" [dependencies] -ink_allocator = { version = "4.2.0", path = "../allocator", default-features = false } -ink_storage_traits = { version = "4.2.0", path = "../storage/traits", default-features = false } -ink_prelude = { version = "4.2.0", path = "../prelude", default-features = false } -ink_primitives = { version = "4.2.0", path = "../primitives", default-features = false } +arrayref = { workspace = true } +cfg-if = { workspace = true } +derive_more = { workspace = true, features = ["from", "display"] } +num-traits = { workspace = true, features = ["i128"] } +scale = { package = "parity-scale-codec", workspace = true } +paste = { workspace = true } +static_assertions = { workspace = true } -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } -num-traits = { version = "0.2", default-features = false, features = ["i128"] } -cfg-if = "1.0" -paste = "1.0" -arrayref = "0.3" -static_assertions = "1.1" +ink_allocator = { workspace = true } +ink_prelude = { workspace = true } +ink_primitives = { workspace = true } +ink_storage_traits = { workspace = true } [target.'cfg(target_arch = "wasm32")'.dependencies] -rlibc = "1" +rlibc = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -ink_engine = { version = "4.2.0", path = "../engine/", optional = true } +ink_engine = { workspace = true, default-features = true, optional = true } # Hashes for the off-chain environment. -sha2 = { version = "0.10", optional = true } -sha3 = { version = "0.10", optional = true } -blake2 = { version = "0.10", optional = true } +sha2 = { workspace = true, optional = true } +sha3 = { workspace = true, optional = true } +blake2 = { workspace = true, optional = true } # ECDSA for the off-chain environment. -secp256k1 = { version = "0.27.0", features = ["recovery", "global-context"], optional = true } +secp256k1 = { workspace = true, features = ["recovery", "global-context"], optional = true } # Only used in the off-chain environment. # # Sadly couldn't be marked as dev-dependency. # Never use this crate outside the off-chain environment! -scale-decode = { version = "0.7.0", default-features = false, optional = true } -scale-encode = { version = "0.3.0", default-features = false, optional = true } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +scale-decode = { workspace = true, optional = true } +scale-encode = { workspace = true, optional = true } +scale-info = { workspace = true, features = ["derive"], optional = true } [dev-dependencies] -ink = { path = "../ink" } +ink = { workspace = true } [features] default = ["std"] diff --git a/crates/env/src/engine/off_chain/test_api.rs b/crates/env/src/engine/off_chain/test_api.rs index bb4fdce1d01..4912dcdb337 100644 --- a/crates/env/src/engine/off_chain/test_api.rs +++ b/crates/env/src/engine/off_chain/test_api.rs @@ -27,6 +27,7 @@ use ink_engine::test_api::RecordedDebugMessages; use std::panic::UnwindSafe; pub use super::call_data::CallData; + pub use ink_engine::ChainExtension; /// Record for an emitted event. diff --git a/crates/env/src/types.rs b/crates/env/src/types.rs index 7de1f3e11ba..a825afd8b67 100644 --- a/crates/env/src/types.rs +++ b/crates/env/src/types.rs @@ -32,6 +32,7 @@ //! the trait bounds on the `Environment` trait types. use super::arithmetic::AtLeast32BitUnsigned; + use ink_primitives::{ AccountId, Clear, diff --git a/crates/ink/Cargo.toml b/crates/ink/Cargo.toml index b1c63468f44..b133face8ed 100644 --- a/crates/ink/Cargo.toml +++ b/crates/ink/Cargo.toml @@ -1,38 +1,39 @@ [package] name = "ink" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -rust-version = "1.63" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "[ink!] Rust based eDSL for writing smart contracts for Substrate" -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" +rust-version = "1.63" [dependencies] -ink_env = { version = "4.2.0", path = "../env", default-features = false } -ink_storage = { version = "4.2.0", path = "../storage", default-features = false } -ink_primitives = { version = "4.2.0", path = "../primitives", default-features = false } -ink_metadata = { version = "4.2.0", path = "../metadata", default-features = false, optional = true } -ink_prelude = { version = "4.2.0", path = "../prelude", default-features = false } -ink_macro = { version = "4.2.0", path = "macro", default-features = false } +derive_more = { workspace = true, features = ["from"] } +scale = { package = "parity-scale-codec", workspace = true } -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -derive_more = { version = "0.99", default-features = false, features = ["from"] } +ink_env = { workspace = true } +ink_storage = { workspace = true } +ink_primitives = { workspace = true } +ink_metadata = { workspace = true, optional = true } +ink_prelude = { workspace = true } +ink_macro = { workspace = true } [dev-dependencies] -ink_ir = { path = "./ir" } -ink_metadata = { path = "../metadata", default-features = false } +ink_ir = { workspace = true, default-features = true } +ink_metadata = { workspace = true } -trybuild = { version = "1.0.60", features = ["diff"] } +trybuild = { workspace = true, features = ["diff"] } # Required for the doctest of `env_access::EnvAccess::instantiate_contract` -scale-info = { version = "2.6", default-features = false, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } [features] default = ["std"] diff --git a/crates/ink/codegen/Cargo.toml b/crates/ink/codegen/Cargo.toml index 6a99282aa4b..b3cf1bf5ae3 100644 --- a/crates/ink/codegen/Cargo.toml +++ b/crates/ink/codegen/Cargo.toml @@ -1,43 +1,44 @@ [package] name = "ink_codegen" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] documentation = "https://docs.rs/ink_codegen/" -homepage = "https://www.parity.io/" description = "data structures and algorithms for generating ink! IR code" -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" [lib] name = "ink_codegen" [dependencies] -ink_primitives = { version = "4.2.0", path = "../../primitives" } -ir = { version = "4.2.0", package = "ink_ir", path = "../ir", default-features = false } -quote = "1" -syn = { version = "2.0", features = ["parsing", "full", "extra-traits"] } -proc-macro2 = "1.0" -derive_more = { version = "0.99", default-features = false, features = ["from"] } -itertools = "0.11" -either = { version = "1.5", default-features = false } -blake2 = "0.10" -heck = "0.4.0" -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -impl-serde = "0.4.0" +blake2 = { workspace = true } +derive_more = { workspace = true, features = ["from"] } +either = { workspace = true } +heck = { workspace = true } +impl-serde = { workspace = true, default-features = true } +itertools = { workspace = true } +scale = { package = "parity-scale-codec", workspace = true } +proc-macro2 = { workspace = true } +quote = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +syn = { workspace = true, features = ["parsing", "full", "extra-traits"] } -serde = { version = "1.0.137", default-features = false, features = ["derive"] } -serde_json = "1.0.81" +ink_ir = { workspace = true } +ink_primitives = { workspace = true } [features] default = ["std"] std = [ "itertools/use_std", "either/use_std", - "ir/std" + "ink_ir/std" ] diff --git a/crates/ink/codegen/src/enforced_error.rs b/crates/ink/codegen/src/enforced_error.rs index dc116b21596..3136c56933b 100644 --- a/crates/ink/codegen/src/enforced_error.rs +++ b/crates/ink/codegen/src/enforced_error.rs @@ -54,7 +54,7 @@ impl EnforcedErrors { pub fn cannot_call_trait_message( trait_ident: &syn::Ident, message_ident: &syn::Ident, - message_selector: ir::Selector, + message_selector: ink_ir::Selector, message_is_mut: bool, ) -> syn::Ident { Self::CannotCallTraitMessage { diff --git a/crates/ink/codegen/src/generator/arg_list.rs b/crates/ink/codegen/src/generator/arg_list.rs index f4acc5ccdbd..84212c6928b 100644 --- a/crates/ink/codegen/src/generator/arg_list.rs +++ b/crates/ink/codegen/src/generator/arg_list.rs @@ -34,7 +34,7 @@ pub fn output_ident(message_name: &syn::Ident) -> syn::Ident { /// /// This returns `__ink_binding_N` for every message input where `N` is the number /// of the input from first to last. -pub fn input_bindings(inputs: ir::InputsIter) -> Vec { +pub fn input_bindings(inputs: ink_ir::InputsIter) -> Vec { inputs .enumerate() .map(|(n, _)| format_ident!("__ink_binding_{}", n)) @@ -42,12 +42,12 @@ pub fn input_bindings(inputs: ir::InputsIter) -> Vec { } /// Returns the sequence of input types for the message. -pub fn input_types(inputs: ir::InputsIter) -> Vec<&syn::Type> { +pub fn input_types(inputs: ink_ir::InputsIter) -> Vec<&syn::Type> { inputs.map(|pat_type| &*pat_type.ty).collect::>() } /// Returns a tuple type representing the types yielded by the input types. -pub fn input_types_tuple(inputs: ir::InputsIter) -> TokenStream2 { +pub fn input_types_tuple(inputs: ink_ir::InputsIter) -> TokenStream2 { let input_types = input_types(inputs); if input_types.len() != 1 { // Pack all types into a tuple if they are not exactly 1. @@ -60,7 +60,7 @@ pub fn input_types_tuple(inputs: ir::InputsIter) -> TokenStream2 { } /// Returns a tuple expression representing the bindings yielded by the inputs. -pub fn input_bindings_tuple(inputs: ir::InputsIter) -> TokenStream2 { +pub fn input_bindings_tuple(inputs: ink_ir::InputsIter) -> TokenStream2 { let input_bindings = input_bindings(inputs); match input_bindings.len() { 0 => quote! { _ }, diff --git a/crates/ink/codegen/src/generator/as_dependency/call_builder.rs b/crates/ink/codegen/src/generator/as_dependency/call_builder.rs index 54414e048f4..dfc77accec8 100644 --- a/crates/ink/codegen/src/generator/as_dependency/call_builder.rs +++ b/crates/ink/codegen/src/generator/as_dependency/call_builder.rs @@ -17,7 +17,7 @@ use crate::{ GenerateCode, }; use derive_more::From; -use ir::Callable; +use ink_ir::Callable; use proc_macro2::TokenStream as TokenStream2; use quote::{ format_ident, @@ -39,7 +39,7 @@ use syn::spanned::Spanned as _; /// smart contract via long-hand calling notation to incrementally build up calls. #[derive(From)] pub struct CallBuilder<'a> { - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl GenerateCode for CallBuilder<'_> { @@ -172,7 +172,7 @@ impl CallBuilder<'_> { fn generate_code_for_trait_impl( &self, trait_path: &syn::Path, - impl_block: &ir::ItemImpl, + impl_block: &ink_ir::ItemImpl, ) -> TokenStream2 { let call_forwarder_impl = self.generate_call_forwarder_for_trait_impl(trait_path, impl_block); @@ -188,7 +188,7 @@ impl CallBuilder<'_> { fn generate_call_forwarder_for_trait_impl( &self, trait_path: &syn::Path, - impl_block: &ir::ItemImpl, + impl_block: &ink_ir::ItemImpl, ) -> TokenStream2 { let span = impl_block.span(); let cb_ident = Self::call_builder_ident(); @@ -247,7 +247,7 @@ impl CallBuilder<'_> { fn generate_ink_trait_impl( &self, trait_path: &syn::Path, - impl_block: &ir::ItemImpl, + impl_block: &ink_ir::ItemImpl, ) -> TokenStream2 { let span = impl_block.span(); let cb_ident = Self::call_builder_ident(); @@ -269,9 +269,9 @@ impl CallBuilder<'_> { fn generate_ink_trait_impl_for_message( &self, trait_path: &syn::Path, - message: ir::CallableWithSelector, + message: ink_ir::CallableWithSelector, ) -> TokenStream2 { - use ir::Callable as _; + use ink_ir::Callable as _; let span = message.span(); let message_ident = message.ident(); let output_ident = generator::output_ident(message_ident); @@ -287,8 +287,8 @@ impl CallBuilder<'_> { .is_ref_mut() .then(|| Some(quote! { mut })); let build_cmd = match message.receiver() { - ir::Receiver::Ref => quote! { build }, - ir::Receiver::RefMut => quote! { build_mut }, + ink_ir::Receiver::Ref => quote! { build }, + ink_ir::Receiver::RefMut => quote! { build_mut }, }; let attrs = self .contract @@ -345,7 +345,7 @@ impl CallBuilder<'_> { /// trait forwarder implementations. Instead we build the calls directly. fn generate_call_builder_inherent_impl( &self, - impl_block: &ir::ItemImpl, + impl_block: &ink_ir::ItemImpl, ) -> TokenStream2 { let span = impl_block.span(); let cb_ident = Self::call_builder_ident(); @@ -367,7 +367,7 @@ impl CallBuilder<'_> { /// building directly and does not forward to a trait call builder. fn generate_call_builder_inherent_impl_for_message( &self, - message: ir::CallableWithSelector, + message: ink_ir::CallableWithSelector, ) -> TokenStream2 { let span = message.span(); let callable = message.callable(); diff --git a/crates/ink/codegen/src/generator/as_dependency/contract_ref.rs b/crates/ink/codegen/src/generator/as_dependency/contract_ref.rs index 91f00534b3f..681452c4162 100644 --- a/crates/ink/codegen/src/generator/as_dependency/contract_ref.rs +++ b/crates/ink/codegen/src/generator/as_dependency/contract_ref.rs @@ -17,7 +17,7 @@ use crate::{ GenerateCode, }; use derive_more::From; -use ir::{ +use ink_ir::{ Callable, IsDocAttribute as _, }; @@ -41,7 +41,7 @@ use syn::spanned::Spanned as _; /// smart contract via long-hand calling notation to incrementally build up calls. #[derive(From)] pub struct ContractRef<'a> { - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl GenerateCode for ContractRef<'_> { @@ -238,7 +238,7 @@ impl ContractRef<'_> { fn generate_contract_trait_impl( &self, trait_path: &syn::Path, - impl_block: &ir::ItemImpl, + impl_block: &ink_ir::ItemImpl, ) -> TokenStream2 { let span = impl_block.span(); let attrs = impl_block.attrs(); @@ -260,7 +260,7 @@ impl ContractRef<'_> { fn generate_contract_trait_impl_messages( &self, trait_path: &syn::Path, - impl_block: &ir::ItemImpl, + impl_block: &ink_ir::ItemImpl, ) -> TokenStream2 { impl_block .iter_messages() @@ -275,20 +275,20 @@ impl ContractRef<'_> { fn generate_contract_trait_impl_for_message( &self, trait_path: &syn::Path, - message: ir::CallableWithSelector, + message: ink_ir::CallableWithSelector, ) -> TokenStream2 { - use ir::Callable as _; + use ink_ir::Callable as _; let span = message.span(); let trait_info_id = generator::generate_reference_to_trait_info(span, trait_path); let message_ident = message.ident(); let output_ident = generator::output_ident(message_ident); let call_operator = match message.receiver() { - ir::Receiver::Ref => quote! { call }, - ir::Receiver::RefMut => quote! { call_mut }, + ink_ir::Receiver::Ref => quote! { call }, + ink_ir::Receiver::RefMut => quote! { call_mut }, }; let forward_operator = match message.receiver() { - ir::Receiver::Ref => quote! { forward }, - ir::Receiver::RefMut => quote! { forward_mut }, + ink_ir::Receiver::Ref => quote! { forward }, + ink_ir::Receiver::RefMut => quote! { forward_mut }, }; let mut_token = message.receiver().is_ref_mut().then(|| quote! { mut }); let input_bindings = message.inputs().map(|input| &input.pat).collect::>(); @@ -343,7 +343,10 @@ impl ContractRef<'_> { /// This produces the short-hand calling notation for the inherent contract /// implementation. The generated code simply forwards its calling logic to the /// associated call builder. - fn generate_contract_inherent_impl(&self, impl_block: &ir::ItemImpl) -> TokenStream2 { + fn generate_contract_inherent_impl( + &self, + impl_block: &ink_ir::ItemImpl, + ) -> TokenStream2 { let span = impl_block.span(); let attrs = impl_block.attrs(); let forwarder_ident = self.generate_contract_ref_ident(); @@ -371,9 +374,9 @@ impl ContractRef<'_> { /// builder. fn generate_contract_inherent_impl_for_message( &self, - message: ir::CallableWithSelector, + message: ink_ir::CallableWithSelector, ) -> TokenStream2 { - use ir::Callable as _; + use ink_ir::Callable as _; let span = message.span(); let attrs = self .contract @@ -384,8 +387,8 @@ impl ContractRef<'_> { let message_ident = message.ident(); let try_message_ident = message.try_ident(); let call_operator = match message.receiver() { - ir::Receiver::Ref => quote! { call }, - ir::Receiver::RefMut => quote! { call_mut }, + ink_ir::Receiver::Ref => quote! { call }, + ink_ir::Receiver::RefMut => quote! { call_mut }, }; let mut_token = message.receiver().is_ref_mut().then(|| quote! { mut }); let input_bindings = message.inputs().map(|input| &input.pat).collect::>(); @@ -436,7 +439,7 @@ impl ContractRef<'_> { /// implements the long-hand calling notation code directly. fn generate_contract_inherent_impl_for_constructor( &self, - constructor: ir::CallableWithSelector, + constructor: ink_ir::CallableWithSelector, ) -> TokenStream2 { let span = constructor.span(); let attrs = self diff --git a/crates/ink/codegen/src/generator/as_dependency/mod.rs b/crates/ink/codegen/src/generator/as_dependency/mod.rs index 529ee878de2..d0771b5f407 100644 --- a/crates/ink/codegen/src/generator/as_dependency/mod.rs +++ b/crates/ink/codegen/src/generator/as_dependency/mod.rs @@ -35,7 +35,7 @@ use quote::quote; #[derive(From)] pub struct ContractReference<'a> { /// The contract to generate code for. - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl_as_ref_for_generator!(ContractReference); diff --git a/crates/ink/codegen/src/generator/blake2b.rs b/crates/ink/codegen/src/generator/blake2b.rs index b0fd5880cf9..4b1e622c871 100644 --- a/crates/ink/codegen/src/generator/blake2b.rs +++ b/crates/ink/codegen/src/generator/blake2b.rs @@ -14,7 +14,7 @@ use crate::GenerateCode; use derive_more::From; -use ir::HexLiteral; +use ink_ir::HexLiteral; use proc_macro2::TokenStream as TokenStream2; use quote::quote_spanned; @@ -22,7 +22,7 @@ use quote::quote_spanned; #[derive(From)] pub struct Blake2x256<'a> { /// The `blake2x256!` macro input. - macro_input: &'a ir::Blake2x256Macro, + macro_input: &'a ink_ir::Blake2x256Macro, } impl GenerateCode for Blake2x256<'_> { diff --git a/crates/ink/codegen/src/generator/chain_extension.rs b/crates/ink/codegen/src/generator/chain_extension.rs index d35a2a82e42..04656967fd6 100644 --- a/crates/ink/codegen/src/generator/chain_extension.rs +++ b/crates/ink/codegen/src/generator/chain_extension.rs @@ -14,7 +14,7 @@ use crate::GenerateCode; use derive_more::From; -use ir::ChainExtensionMethod; +use ink_ir::ChainExtensionMethod; use proc_macro2::TokenStream as TokenStream2; use quote::{ format_ident, @@ -25,7 +25,7 @@ use syn::spanned::Spanned; /// Generator to create an ink! chain extension. #[derive(From)] pub struct ChainExtension<'a> { - extension: &'a ir::ChainExtension, + extension: &'a ink_ir::ChainExtension, } impl ChainExtension<'_> { diff --git a/crates/ink/codegen/src/generator/contract.rs b/crates/ink/codegen/src/generator/contract.rs index 1662b826428..8bffd8c3355 100644 --- a/crates/ink/codegen/src/generator/contract.rs +++ b/crates/ink/codegen/src/generator/contract.rs @@ -25,7 +25,7 @@ use quote::quote; #[derive(From)] pub struct Contract<'a> { /// The contract to generate code for. - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl_as_ref_for_generator!(Contract); @@ -49,7 +49,7 @@ impl GenerateCode for Contract<'_> { .module() .items() .iter() - .filter_map(ir::Item::map_rust_item); + .filter_map(ink_ir::Item::map_rust_item); quote! { #( #attrs )* #vis mod #ident { diff --git a/crates/ink/codegen/src/generator/dispatch.rs b/crates/ink/codegen/src/generator/dispatch.rs index bf30512eba1..1e24f9ae6c5 100644 --- a/crates/ink/codegen/src/generator/dispatch.rs +++ b/crates/ink/codegen/src/generator/dispatch.rs @@ -19,7 +19,7 @@ use crate::{ GenerateCode, }; use derive_more::From; -use ir::{ +use ink_ir::{ Callable, CallableWithSelector, Constructor, @@ -66,7 +66,7 @@ pub struct ConstructorDispatchable<'a> { /// expected input types of the respective ink! constructor or message. #[derive(From)] pub struct Dispatch<'a> { - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl_as_ref_for_generator!(Dispatch); diff --git a/crates/ink/codegen/src/generator/env.rs b/crates/ink/codegen/src/generator/env.rs index c72627732ac..99434a14574 100644 --- a/crates/ink/codegen/src/generator/env.rs +++ b/crates/ink/codegen/src/generator/env.rs @@ -20,7 +20,7 @@ use quote::quote; /// Generates code for the ink! environment of the contract. #[derive(From)] pub struct Env<'a> { - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl GenerateCode for Env<'_> { diff --git a/crates/ink/codegen/src/generator/events.rs b/crates/ink/codegen/src/generator/events.rs index 48f16b14ebe..3c00ee10317 100644 --- a/crates/ink/codegen/src/generator/events.rs +++ b/crates/ink/codegen/src/generator/events.rs @@ -27,7 +27,7 @@ use syn::spanned::Spanned as _; /// Generates code for the ink! event structs of the contract. #[derive(From)] pub struct Events<'a> { - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl_as_ref_for_generator!(Events); @@ -159,7 +159,7 @@ impl<'a> Events<'a> { } /// Generate checks to guard against too many topics in event definitions. - fn generate_topics_guard(&self, event: &ir::Event) -> TokenStream2 { + fn generate_topics_guard(&self, event: &ink_ir::Event) -> TokenStream2 { let span = event.span(); let storage_ident = self.contract.module().storage().ident(); let event_ident = event.ident(); diff --git a/crates/ink/codegen/src/generator/ink_test.rs b/crates/ink/codegen/src/generator/ink_test.rs index 88f669e11c1..02b75fbb3b3 100644 --- a/crates/ink/codegen/src/generator/ink_test.rs +++ b/crates/ink/codegen/src/generator/ink_test.rs @@ -21,7 +21,7 @@ use quote::quote; #[derive(From)] pub struct InkTest<'a> { /// The test function to generate code for. - test: &'a ir::InkTest, + test: &'a ink_ir::InkTest, } impl GenerateCode for InkTest<'_> { @@ -72,7 +72,7 @@ impl GenerateCode for InkTest<'_> { } } -impl GenerateCode for ir::InkTest { +impl GenerateCode for ink_ir::InkTest { fn generate_code(&self) -> TokenStream2 { InkTest::from(self).generate_code() } diff --git a/crates/ink/codegen/src/generator/item_impls.rs b/crates/ink/codegen/src/generator/item_impls.rs index ca472091c88..bcd585f10c8 100644 --- a/crates/ink/codegen/src/generator/item_impls.rs +++ b/crates/ink/codegen/src/generator/item_impls.rs @@ -17,7 +17,7 @@ use core::iter; use crate::GenerateCode; use derive_more::From; use heck::ToLowerCamelCase as _; -use ir::{ +use ink_ir::{ Callable as _, HexLiteral, }; @@ -33,7 +33,7 @@ use syn::spanned::Spanned as _; /// Generates code for all ink! implementation blocks. #[derive(From)] pub struct ItemImpls<'a> { - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl_as_ref_for_generator!(ItemImpls); @@ -180,7 +180,7 @@ impl ItemImpls<'_> { } /// Generates the code for the given ink! message within a trait implementation block. - fn generate_trait_message(message: &ir::Message) -> TokenStream2 { + fn generate_trait_message(message: &ink_ir::Message) -> TokenStream2 { let span = message.span(); let attrs = message.attrs(); let vis = message.visibility(); @@ -206,7 +206,7 @@ impl ItemImpls<'_> { ) } - fn generate_trait_item_impl(item_impl: &ir::ItemImpl) -> TokenStream2 { + fn generate_trait_item_impl(item_impl: &ink_ir::ItemImpl) -> TokenStream2 { assert!(item_impl.trait_path().is_some()); let span = item_impl.span(); let attrs = item_impl.attrs(); @@ -235,7 +235,7 @@ impl ItemImpls<'_> { /// /// The `__ink_dylint_Constructor` config attribute is used here to convey the /// information that the generated function is an ink! constructor to `dylint`. - fn generate_inherent_constructor(constructor: &ir::Constructor) -> TokenStream2 { + fn generate_inherent_constructor(constructor: &ink_ir::Constructor) -> TokenStream2 { let span = constructor.span(); let attrs = constructor.attrs(); let vis = constructor.visibility(); @@ -254,7 +254,7 @@ impl ItemImpls<'_> { /// Generates the code for the given ink! message within an inherent implementation /// block. - fn generate_inherent_message(message: &ir::Message) -> TokenStream2 { + fn generate_inherent_message(message: &ink_ir::Message) -> TokenStream2 { let span = message.span(); let attrs = message.attrs(); let vis = message.visibility(); @@ -272,7 +272,7 @@ impl ItemImpls<'_> { ) } - fn generate_inherent_item_impl(item_impl: &ir::ItemImpl) -> TokenStream2 { + fn generate_inherent_item_impl(item_impl: &ink_ir::ItemImpl) -> TokenStream2 { assert!(item_impl.trait_path().is_none()); let span = item_impl.span(); let attrs = item_impl.attrs(); @@ -285,7 +285,7 @@ impl ItemImpls<'_> { let other_items = item_impl .items() .iter() - .filter_map(ir::ImplItem::filter_map_other_item) + .filter_map(ink_ir::ImplItem::filter_map_other_item) .map(ToTokens::to_token_stream); let self_type = item_impl.self_type(); quote_spanned!(span => @@ -300,7 +300,10 @@ impl ItemImpls<'_> { /// Generates code to guard against ink! implementations that have not been /// implemented for the ink! storage struct. - fn generate_item_impl_self_ty_guard(&self, item_impl: &ir::ItemImpl) -> TokenStream2 { + fn generate_item_impl_self_ty_guard( + &self, + item_impl: &ink_ir::ItemImpl, + ) -> TokenStream2 { let self_ty = item_impl.self_type(); let span = self_ty.span(); let storage_ident = self.contract.module().storage().ident(); @@ -311,7 +314,7 @@ impl ItemImpls<'_> { } /// Generates code for the given ink! implementation block. - fn generate_item_impl(&self, item_impl: &ir::ItemImpl) -> TokenStream2 { + fn generate_item_impl(&self, item_impl: &ink_ir::ItemImpl) -> TokenStream2 { let self_ty_guard = self.generate_item_impl_self_ty_guard(item_impl); let impl_block = match item_impl.trait_path() { Some(_) => Self::generate_trait_item_impl(item_impl), diff --git a/crates/ink/codegen/src/generator/metadata.rs b/crates/ink/codegen/src/generator/metadata.rs index 260867533a7..a332f06f241 100644 --- a/crates/ink/codegen/src/generator/metadata.rs +++ b/crates/ink/codegen/src/generator/metadata.rs @@ -15,7 +15,7 @@ use crate::GenerateCode; use ::core::iter; use derive_more::From; -use ir::{ +use ink_ir::{ Callable as _, HexLiteral, IsDocAttribute, @@ -37,7 +37,7 @@ use syn::{ #[derive(From)] pub struct Metadata<'a> { /// The contract to generate code for. - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl_as_ref_for_generator!(Metadata); @@ -137,7 +137,7 @@ impl Metadata<'_> { /// Generates ink! metadata for a single ink! constructor. fn generate_constructor( &self, - constructor: ir::CallableWithSelector, + constructor: ink_ir::CallableWithSelector, ) -> TokenStream2 { let span = constructor.span(); let docs = constructor @@ -397,7 +397,9 @@ impl Metadata<'_> { } /// Generate ink! metadata for a single argument of an ink! event definition. - fn generate_event_args(event: &ir::Event) -> impl Iterator + '_ { + fn generate_event_args( + event: &ink_ir::Event, + ) -> impl Iterator + '_ { event.fields().map(|event_field| { let span = event_field.span(); let ident = event_field.ident(); diff --git a/crates/ink/codegen/src/generator/mod.rs b/crates/ink/codegen/src/generator/mod.rs index 960a1b58dd7..7b6dd668878 100644 --- a/crates/ink/codegen/src/generator/mod.rs +++ b/crates/ink/codegen/src/generator/mod.rs @@ -18,8 +18,8 @@ /// They need to implement this trait in order to use other code generators. macro_rules! impl_as_ref_for_generator { ( $generator_name:ident ) => { - impl ::core::convert::AsRef for $generator_name<'_> { - fn as_ref(&self) -> &ir::Contract { + impl ::core::convert::AsRef for $generator_name<'_> { + fn as_ref(&self) -> &ink_ir::Contract { self.contract } } diff --git a/crates/ink/codegen/src/generator/selector.rs b/crates/ink/codegen/src/generator/selector.rs index d21ba632615..2c41cddc929 100644 --- a/crates/ink/codegen/src/generator/selector.rs +++ b/crates/ink/codegen/src/generator/selector.rs @@ -14,7 +14,7 @@ use crate::GenerateCode; use derive_more::From; -use ir::HexLiteral; +use ink_ir::HexLiteral; use proc_macro2::TokenStream as TokenStream2; use quote::quote_spanned; @@ -22,7 +22,7 @@ use quote::quote_spanned; #[derive(From)] pub struct SelectorId<'a> { /// The contract to generate code for. - macro_input: &'a ir::SelectorMacro, + macro_input: &'a ink_ir::SelectorMacro, } impl GenerateCode for SelectorId<'_> { @@ -42,7 +42,7 @@ impl GenerateCode for SelectorId<'_> { #[derive(From)] pub struct SelectorBytes<'a> { /// The contract to generate code for. - macro_input: &'a ir::SelectorMacro, + macro_input: &'a ink_ir::SelectorMacro, } impl GenerateCode for SelectorBytes<'_> { diff --git a/crates/ink/codegen/src/generator/storage.rs b/crates/ink/codegen/src/generator/storage.rs index a69c05648ab..0a0d008f564 100644 --- a/crates/ink/codegen/src/generator/storage.rs +++ b/crates/ink/codegen/src/generator/storage.rs @@ -24,7 +24,7 @@ use syn::spanned::Spanned as _; /// Generator to create the ink! storage struct and important trait implementations. #[derive(From)] pub struct Storage<'a> { - contract: &'a ir::Contract, + contract: &'a ink_ir::Contract, } impl_as_ref_for_generator!(Storage); diff --git a/crates/ink/codegen/src/generator/storage_item.rs b/crates/ink/codegen/src/generator/storage_item.rs index 3d96fd1a619..c16e3f04056 100644 --- a/crates/ink/codegen/src/generator/storage_item.rs +++ b/crates/ink/codegen/src/generator/storage_item.rs @@ -40,7 +40,7 @@ use syn::{ #[derive(From, Copy, Clone)] pub struct StorageItem<'a> { /// The storage item to generate code for. - item: &'a ir::StorageItem, + item: &'a ink_ir::StorageItem, } impl GenerateCode for StorageItem<'_> { diff --git a/crates/ink/codegen/src/generator/trait_def/call_builder.rs b/crates/ink/codegen/src/generator/trait_def/call_builder.rs index ecedf2758d2..cf7001d1272 100644 --- a/crates/ink/codegen/src/generator/trait_def/call_builder.rs +++ b/crates/ink/codegen/src/generator/trait_def/call_builder.rs @@ -328,8 +328,8 @@ impl CallBuilder<'_> { /// builder. fn generate_ink_trait_impl_for_message( &self, - message: &ir::InkTraitMessage, - selector: ir::Selector, + message: &ink_ir::InkTraitMessage, + selector: ink_ir::Selector, ) -> TokenStream2 { let span = message.span(); let message_ident = message.ident(); diff --git a/crates/ink/codegen/src/generator/trait_def/call_forwarder.rs b/crates/ink/codegen/src/generator/trait_def/call_forwarder.rs index e02e995b73d..6e3357bf5fd 100644 --- a/crates/ink/codegen/src/generator/trait_def/call_forwarder.rs +++ b/crates/ink/codegen/src/generator/trait_def/call_forwarder.rs @@ -364,7 +364,7 @@ impl CallForwarder<'_> { /// forwarder. fn generate_ink_trait_impl_for_message( &self, - message: &ir::InkTraitMessage, + message: &ink_ir::InkTraitMessage, ) -> TokenStream2 { let span = message.span(); let trait_ident = self.trait_def.trait_def.item().ident(); @@ -384,8 +384,8 @@ impl CallForwarder<'_> { let input_bindings = message.inputs().map(|input| &input.pat).collect::>(); let input_types = message.inputs().map(|input| &input.ty).collect::>(); let call_op = match message.receiver() { - ir::Receiver::Ref => quote! { call }, - ir::Receiver::RefMut => quote! { call_mut }, + ink_ir::Receiver::Ref => quote! { call }, + ink_ir::Receiver::RefMut => quote! { call_mut }, }; let mut_tok = message.mutates().then(|| quote! { mut }); let panic_str = format!( diff --git a/crates/ink/codegen/src/generator/trait_def/definition.rs b/crates/ink/codegen/src/generator/trait_def/definition.rs index edf7b1ed1a4..397d56f4fa5 100644 --- a/crates/ink/codegen/src/generator/trait_def/definition.rs +++ b/crates/ink/codegen/src/generator/trait_def/definition.rs @@ -24,7 +24,7 @@ use quote::{ }; impl<'a> TraitDefinition<'a> { - fn generate_for_message(message: ir::InkTraitMessage<'a>) -> TokenStream2 { + fn generate_for_message(message: ink_ir::InkTraitMessage<'a>) -> TokenStream2 { let span = message.span(); let attrs = message.attrs(); let sig = message.sig(); @@ -57,7 +57,7 @@ impl TraitDefinition<'_> { let messages = item .iter_items() .map(|(item, _)| item) - .flat_map(ir::InkTraitItem::filter_map_message) + .flat_map(ink_ir::InkTraitItem::filter_map_message) .map(Self::generate_for_message); quote_spanned!(span => #(#attrs)* diff --git a/crates/ink/codegen/src/generator/trait_def/mod.rs b/crates/ink/codegen/src/generator/trait_def/mod.rs index b0dba515277..c95ea055f53 100644 --- a/crates/ink/codegen/src/generator/trait_def/mod.rs +++ b/crates/ink/codegen/src/generator/trait_def/mod.rs @@ -31,7 +31,7 @@ use quote::{ /// Generator to create the ink! storage struct and important trait implementations. #[derive(From, Copy, Clone)] pub struct TraitDefinition<'a> { - trait_def: &'a ir::InkTraitDefinition, + trait_def: &'a ink_ir::InkTraitDefinition, } impl<'a> TraitDefinition<'a> { diff --git a/crates/ink/codegen/src/generator/trait_def/trait_registry.rs b/crates/ink/codegen/src/generator/trait_def/trait_registry.rs index b5407421d32..721067d95cc 100644 --- a/crates/ink/codegen/src/generator/trait_def/trait_registry.rs +++ b/crates/ink/codegen/src/generator/trait_def/trait_registry.rs @@ -131,7 +131,9 @@ impl TraitRegistry<'_> { } /// Generates code to assert that ink! input and output types meet certain properties. - fn generate_inout_guards_for_message(message: &ir::InkTraitMessage) -> TokenStream2 { + fn generate_inout_guards_for_message( + message: &ink_ir::InkTraitMessage, + ) -> TokenStream2 { let message_span = message.span(); let message_inputs = message.inputs().map(|input| { let input_span = input.span(); @@ -162,8 +164,8 @@ impl TraitRegistry<'_> { /// Generally the implementation of any ink! trait of the ink! trait registry fn generate_registry_for_message( &self, - message: &ir::InkTraitMessage, - selector: ir::Selector, + message: &ink_ir::InkTraitMessage, + selector: ink_ir::Selector, ) -> TokenStream2 { let span = message.span(); let ident = message.ident(); @@ -225,7 +227,7 @@ impl TraitRegistry<'_> { /// Returns a pair of input bindings `__ink_bindings_N` and types. fn input_bindings_and_types( - inputs: ir::InputsIter, + inputs: ink_ir::InputsIter, ) -> (Vec, Vec<&syn::Type>) { inputs .enumerate() @@ -317,8 +319,8 @@ impl TraitRegistry<'_> { /// ink! message defined by the ink! trait definition. fn generate_info_for_trait_for_message( &self, - message: &ir::InkTraitMessage, - selector: ir::Selector, + message: &ink_ir::InkTraitMessage, + selector: ink_ir::Selector, ) -> TokenStream2 { let span = message.span(); let trait_info_ident = self.trait_def.trait_info_ident(); diff --git a/crates/ink/codegen/src/lib.rs b/crates/ink/codegen/src/lib.rs index b5d9631c077..9bd13b8e4e8 100644 --- a/crates/ink/codegen/src/lib.rs +++ b/crates/ink/codegen/src/lib.rs @@ -46,6 +46,7 @@ use self::{ GenerateCodeUsing, }, }; + use proc_macro2::TokenStream as TokenStream2; /// Types for which code can be generated by this crate. @@ -54,35 +55,35 @@ pub trait CodeGenerator: Sized { type Generator: From + GenerateCode; } -impl<'a> CodeGenerator for &'a ir::Contract { +impl<'a> CodeGenerator for &'a ink_ir::Contract { type Generator = generator::Contract<'a>; } -impl<'a> CodeGenerator for &'a ir::StorageItem { +impl<'a> CodeGenerator for &'a ink_ir::StorageItem { type Generator = generator::StorageItem<'a>; } -impl<'a> CodeGenerator for &'a ir::InkTraitDefinition { +impl<'a> CodeGenerator for &'a ink_ir::InkTraitDefinition { type Generator = generator::TraitDefinition<'a>; } -impl<'a> CodeGenerator for &'a ir::InkTest { +impl<'a> CodeGenerator for &'a ink_ir::InkTest { type Generator = generator::InkTest<'a>; } -impl<'a> CodeGenerator for &'a ir::ChainExtension { +impl<'a> CodeGenerator for &'a ink_ir::ChainExtension { type Generator = generator::ChainExtension<'a>; } -impl<'a> CodeGenerator for &'a ir::SelectorMacro { +impl<'a> CodeGenerator for &'a ink_ir::SelectorMacro { type Generator = generator::SelectorId<'a>; } -impl<'a> CodeGenerator for &'a ir::SelectorMacro { +impl<'a> CodeGenerator for &'a ink_ir::SelectorMacro { type Generator = generator::SelectorBytes<'a>; } -impl<'a> CodeGenerator for &'a ir::Blake2x256Macro { +impl<'a> CodeGenerator for &'a ink_ir::Blake2x256Macro { type Generator = generator::Blake2x256<'a>; } diff --git a/crates/ink/codegen/src/traits.rs b/crates/ink/codegen/src/traits.rs index 4aa7aabbe87..905e1a02fea 100644 --- a/crates/ink/codegen/src/traits.rs +++ b/crates/ink/codegen/src/traits.rs @@ -21,23 +21,23 @@ pub trait GenerateCode { } /// Types implementing this trait can forward code generation to other generators. -pub trait GenerateCodeUsing: AsRef { +pub trait GenerateCodeUsing: AsRef { /// Generates code using the given codegen module. fn generate_code_using<'a, G>(&'a self) -> TokenStream2 where - G: GenerateCode + From<&'a ir::Contract>; + G: GenerateCode + From<&'a ink_ir::Contract>; } impl GenerateCodeUsing for T where - T: AsRef, + T: AsRef, { fn generate_code_using<'a, G>(&'a self) -> TokenStream2 where - G: GenerateCode + From<&'a ir::Contract>, + G: GenerateCode + From<&'a ink_ir::Contract>, { ::generate_code(&G::from( - >::as_ref(self), + >::as_ref(self), )) } } diff --git a/crates/ink/ir/Cargo.toml b/crates/ink/ir/Cargo.toml index 9c428af1e24..e826651cdca 100644 --- a/crates/ink/ir/Cargo.toml +++ b/crates/ink/ir/Cargo.toml @@ -1,30 +1,32 @@ [package] name = "ink_ir" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_ir/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "data structures and algorithms for ink! intermediate representation" -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_ir/" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" [lib] name = "ink_ir" [dependencies] -quote = "1" -syn = { version = "2.0", features = ["parsing", "full", "visit", "extra-traits"] } -proc-macro2 = "1.0" -itertools = { version = "0.11", default-features = false } -either = { version = "1.5", default-features = false } -blake2 = "0.10" -ink_prelude = { version = "4.1.0", path = "../../prelude/", default-features = false } +blake2 = { workspace = true } +either = { workspace = true } +itertools = { workspace = true } +proc-macro2 = { workspace = true } +quote = { workspace = true } +syn = { workspace = true, features = ["parsing", "full", "visit", "extra-traits"] } + +ink_prelude = { workspace = true } [features] default = ["std"] diff --git a/crates/ink/macro/Cargo.toml b/crates/ink/macro/Cargo.toml index 61d27f55f59..34cd03cc7de 100644 --- a/crates/ink/macro/Cargo.toml +++ b/crates/ink/macro/Cargo.toml @@ -1,37 +1,38 @@ [package] name = "ink_macro" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_macro/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "[ink!] Rust based eDSL for writing smart contracts for Substrate" -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_macro/" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" [dependencies] -ink_ir = { version = "4.2.0", path = "../ir", default-features = false } -ink_codegen = { version = "4.2.0", path = "../codegen", default-features = false } -ink_primitives = { version = "4.2.0", path = "../../primitives/", default-features = false } +scale = { package = "parity-scale-codec", workspace = true } +quote = { workspace = true } +proc-macro2 = { workspace = true } +syn = { workspace = true } +synstructure = { workspace = true } -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -syn = "2" -synstructure = "0.13.0" -proc-macro2 = "1" -quote = "1" +ink_ir = { workspace = true } +ink_codegen = { workspace = true } +ink_primitives = { workspace = true } [dev-dependencies] -ink_env = { path = "../../env" } -ink = { path = ".." } -ink_metadata = { path = "../../metadata" } -ink_prelude = { path = "../../prelude" } -ink_storage = { path = "../../storage" } -scale-info = { version = "2.6", default-features = false, features = ["derive"] } +ink_env = { workspace = true, default-features = true } +ink = { workspace = true, default-features = true } +ink_metadata = { workspace = true, default-features = true } +ink_prelude = { workspace = true, default-features = true } +ink_storage = { workspace = true, default-features = true } +scale-info = { workspace = true, features = ["derive"] } [lib] name = "ink_macro" diff --git a/crates/ink/tests/ui/storage_item/pass/argument_derive_false.rs b/crates/ink/tests/ui/storage_item/pass/argument_derive_false.rs index 6e4e83caa57..3506060db92 100644 --- a/crates/ink/tests/ui/storage_item/pass/argument_derive_false.rs +++ b/crates/ink/tests/ui/storage_item/pass/argument_derive_false.rs @@ -1,6 +1,6 @@ -use ink::storage::traits::Storable; use ink::storage::traits::{ ManualKey, + Storable, StorageKey, }; diff --git a/crates/ink/tests/ui/storage_item/pass/complex_packed_enum.rs b/crates/ink/tests/ui/storage_item/pass/complex_packed_enum.rs index 8bd302d8cbd..ed5eaffb4c2 100644 --- a/crates/ink/tests/ui/storage_item/pass/complex_packed_enum.rs +++ b/crates/ink/tests/ui/storage_item/pass/complex_packed_enum.rs @@ -1,3 +1,4 @@ +use ink::storage::traits::Storable; use ink_prelude::{ collections::{ BTreeMap, @@ -5,7 +6,6 @@ use ink_prelude::{ }, vec::Vec, }; -use ink::storage::traits::Storable; #[derive(Default, PartialEq, Eq, PartialOrd, Ord, scale::Encode, scale::Decode)] #[cfg_attr( diff --git a/crates/ink/tests/ui/storage_item/pass/complex_packed_struct.rs b/crates/ink/tests/ui/storage_item/pass/complex_packed_struct.rs index 13e125ba970..b5c2dbe7dac 100644 --- a/crates/ink/tests/ui/storage_item/pass/complex_packed_struct.rs +++ b/crates/ink/tests/ui/storage_item/pass/complex_packed_struct.rs @@ -1,3 +1,4 @@ +use ink::storage::traits::Storable; use ink_prelude::{ collections::{ BTreeMap, @@ -5,7 +6,6 @@ use ink_prelude::{ }, vec::Vec, }; -use ink::storage::traits::Storable; #[derive(Default, PartialEq, Eq, PartialOrd, Ord, scale::Encode, scale::Decode)] #[cfg_attr( diff --git a/crates/metadata/Cargo.toml b/crates/metadata/Cargo.toml index 54199eb7e31..46ee6db7e24 100644 --- a/crates/metadata/Cargo.toml +++ b/crates/metadata/Cargo.toml @@ -1,32 +1,33 @@ [package] name = "ink_metadata" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_metadata/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "[ink!] Metadata definitions for ink! smart contracts." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_metadata/" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" [dependencies] -ink_prelude = { version = "4.2.0", path = "../prelude/", default-features = false } -ink_primitives = { version = "4.2.0", path = "../primitives/", default-features = false } +serde = { workspace = true, features = ["derive", "alloc"] } +impl-serde = { workspace = true, default-features = true } +derive_more = { workspace = true, features = ["from"] } +scale-info = { workspace = true, features = ["derive", "serde", "decode", "schema"] } +schemars = { workspace = true } -serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] } -impl-serde = "0.4.0" -derive_more = { version = "0.99", default-features = false, features = ["from"] } -scale-info = { version = "2.6", default-features = false, features = ["derive", "serde", "decode", "schema"] } -schemars = "0.8" +ink_prelude = { workspace = true } +ink_primitives = { workspace = true } [dev-dependencies] -pretty_assertions = "1" -serde_json = "1" +pretty_assertions = { workspace = true } +serde_json = { workspace = true } [features] default = [ diff --git a/crates/prelude/Cargo.toml b/crates/prelude/Cargo.toml index 7c5f88bedf6..14e191cdfff 100644 --- a/crates/prelude/Cargo.toml +++ b/crates/prelude/Cargo.toml @@ -1,21 +1,22 @@ [package] name = "ink_prelude" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_prelude/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "[ink!] Common API for no_std and std to access alloc crate types." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_prelude/" include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] +readme = "README.md" [dependencies] -cfg-if = "1.0" +cfg-if = { workspace = true } [features] default = ["std"] diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index b2a3209259a..8b195918f5f 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -1,27 +1,29 @@ [package] name = "ink_primitives" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_primitives/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "[ink!] Fundamental primitive types for ink! smart contracts." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_primitives/" include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] +readme = "README.md" [dependencies] -derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } -ink_prelude = { version = "4.2.0", path = "../prelude/", default-features = false } -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -scale-decode = { version = "0.7.0", default-features = false, features = ["derive"], optional = true } -scale-encode = { version = "0.3.0", default-features = false, features = ["derive"], optional = true } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } -xxhash-rust = { version = "0.8", features = ["const_xxh32"] } +derive_more = { workspace = true, features = ["from", "display"] } +scale = { package = "parity-scale-codec", workspace = true } +scale-decode = { workspace = true, features = ["derive"], optional = true } +scale-encode = { workspace = true, features = ["derive"], optional = true } +scale-info = { workspace = true, features = ["derive"], optional = true } +xxhash-rust = { workspace = true, features = ["const_xxh32"] } + +ink_prelude = { workspace = true } [features] default = ["std"] diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index e9cb8e61d95..ddad603f3a3 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -1,38 +1,39 @@ [package] name = "ink_storage" -version = "4.2.0" -authors = ["Parity Technologies ", "Robin Freyler "] -edition = "2021" -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_storage/" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies ", "Robin Freyler "] description = "[ink!] Data structures to organize and manipulate ink! contract storage." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_storage/" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "README.md" [dependencies] -ink_env = { version = "4.2.0", path = "../env/", default-features = false } -ink_metadata = { version = "4.2.0", path = "../metadata/", default-features = false, features = ["derive"], optional = true } -ink_primitives = { version = "4.2.0", path = "../primitives/", default-features = false } -ink_storage_traits = { version = "4.2.0", path = "traits", default-features = false } -ink_prelude = { version = "4.2.0", path = "../prelude/", default-features = false } +array-init = { workspace = true } +cfg-if = { workspace = true } +derive_more = { workspace = true, features = ["from", "display"] } +scale = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true, features = ["derive"], optional = true } -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } -cfg-if = "1.0" -array-init = { version = "2.0", default-features = false } +ink_env = { workspace = true } +ink_metadata = { workspace = true, features = ["derive"], optional = true } +ink_prelude = { workspace = true } +ink_primitives = { workspace = true } +ink_storage_traits = { workspace = true } [dev-dependencies] -quickcheck = "1.0" -quickcheck_macros = "1.0" -itertools = "0.11" +quickcheck = { workspace = true } +quickcheck_macros = { workspace = true } +itertools = { workspace = true, default-features = true } -ink = { path = "../ink" } +ink = { workspace = true } [features] default = ["std"] diff --git a/crates/storage/traits/Cargo.toml b/crates/storage/traits/Cargo.toml index 602fab69776..aa2cb8579ff 100644 --- a/crates/storage/traits/Cargo.toml +++ b/crates/storage/traits/Cargo.toml @@ -1,28 +1,30 @@ [package] name = "ink_storage_traits" -version = "4.2.0" -authors = ["Parity Technologies "] -edition = "2021" -license = "Apache-2.0" -readme = "../README.md" -repository = "https://github.com/paritytech/ink" -documentation = "https://docs.rs/ink_storage_traits" -homepage = "https://www.parity.io/" +edition.workspace = true +categories.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +authors = ["Parity Technologies "] description = "[ink!] defines traits for using ink storage." -keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] -categories = ["no-std", "embedded"] +documentation = "https://docs.rs/ink_storage_traits" include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] +readme = "../README.md" [dependencies] -ink_metadata = { version = "4.2.0", path = "../../metadata", default-features = false, features = ["derive"], optional = true } -ink_primitives = { version = "4.2.0", path = "../../primitives", default-features = false } -ink_prelude = { version = "4.2.0", path = "../../prelude", default-features = false } -scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true, features = ["derive"], optional = true } + +ink_metadata = { workspace = true, features = ["derive"], optional = true } +ink_prelude = { workspace = true } +ink_primitives = { workspace = true } [dev-dependencies] -paste = "1.0" +paste = { workspace = true } [features] default = ["std"]