Skip to content

Commit

Permalink
Upgrade scale-info to 2.5 (#1733)
Browse files Browse the repository at this point in the history
* Update requirements to scale-info 2.5

* Use fields to fix deprecation warnings

* Your mother

* Fmt
  • Loading branch information
ascjones authored Mar 30, 2023
1 parent 6fb975d commit e5e7e52
Show file tree
Hide file tree
Showing 45 changed files with 60 additions and 61 deletions.
2 changes: 1 addition & 1 deletion crates/e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sp-weights = "14.0.0"

[dev-dependencies]
# Required for the doctest of `MessageBuilder::call`
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
scale-info = { version = "2.5", default-features = false, features = ["derive"] }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion crates/env/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ secp256k1 = { version = "0.27.0", features = ["recovery", "global-context"], opt
#
# Sadly couldn't be marked as dev-dependency.
# Never use this crate outside the off-chain environment!
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink = { path = "../ink" }
Expand Down
2 changes: 1 addition & 1 deletion crates/ink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ink_metadata = { path = "../metadata", default-features = false }

trybuild = { version = "1.0.60", features = ["diff"] }
# Required for the doctest of `env_access::EnvAccess::instantiate_contract`
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
scale-info = { version = "2.5", default-features = false, features = ["derive"] }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion crates/ink/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ink = { path = ".." }
ink_metadata = { path = "../../metadata" }
ink_prelude = { path = "../../prelude" }
ink_storage = { path = "../../storage" }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
scale-info = { version = "2.5", default-features = false, features = ["derive"] }

[lib]
name = "ink_macro"
Expand Down
33 changes: 16 additions & 17 deletions crates/ink/tests/return_type_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ mod tests {
) -> (&'a Type<PortableForm>, &'a Type<PortableForm>) {
assert_eq!(
"Result",
format!("{}", ty.path()),
format!("{}", ty.path),
"Message return type should be a Result"
);
match ty.type_def() {
match &ty.type_def {
TypeDef::Variant(variant) => {
assert_eq!(2, variant.variants().len());
let ok_variant = &variant.variants()[0];
let ok_field = &ok_variant.fields()[0];
let ok_ty = resolve_type(metadata, ok_field.ty().id());
assert_eq!("Ok", ok_variant.name());
assert_eq!(2, variant.variants.len());
let ok_variant = &variant.variants[0];
let ok_field = &ok_variant.fields[0];
let ok_ty = resolve_type(metadata, ok_field.ty.id);
assert_eq!("Ok", ok_variant.name);

let err_variant = &variant.variants()[1];
let err_field = &err_variant.fields()[0];
let err_ty = resolve_type(metadata, err_field.ty().id());
assert_eq!("Err", err_variant.name());
let err_variant = &variant.variants[1];
let err_field = &err_variant.fields[0];
let err_ty = resolve_type(metadata, err_field.ty.id);
assert_eq!("Err", err_variant.name);

(ok_ty, err_ty)
}
Expand All @@ -107,10 +107,10 @@ mod tests {
assert_eq!("TraitDefinition::get_value", message.label());

let type_spec = message.return_type().opt_type().unwrap();
let ty = resolve_type(&metadata, type_spec.ty().id());
let ty = resolve_type(&metadata, type_spec.ty().id);
let (ok_ty, _) = extract_result(&metadata, ty);

assert_eq!(&TypeDef::Primitive(TypeDefPrimitive::U32), ok_ty.type_def());
assert_eq!(TypeDef::Primitive(TypeDefPrimitive::U32), ok_ty.type_def);
}

#[test]
Expand All @@ -125,19 +125,18 @@ mod tests {
format!("{}", type_spec.display_name())
);

let outer_result_ty = resolve_type(&metadata, type_spec.ty().id());
let outer_result_ty = resolve_type(&metadata, type_spec.ty().id);
let (outer_ok_ty, outer_err_ty) = extract_result(&metadata, outer_result_ty);
let (inner_ok_ty, _) = extract_result(&metadata, outer_ok_ty);

assert_eq!(
format!("{}", outer_err_ty.path()),
format!("{}", outer_err_ty.path),
"ink_primitives::LangError"
);

let unit_ty = TypeDef::Tuple(TypeDefTuple::new_portable(vec![]));
assert_eq!(
&unit_ty,
inner_ok_ty.type_def(),
unit_ty, inner_ok_ty.type_def,
"Ok variant should be a unit `()` type"
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ink_primitives = { version = "4.1.0", path = "../primitives/", default-features
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.3", default-features = false, features = ["derive", "serde", "decode"] }
scale-info = { version = "2.5", default-features = false, features = ["derive", "serde", "decode"] }

[dev-dependencies]
pretty_assertions = "1"
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }
ink_prelude = { version = "4.1.0", path = "../prelude/", default-features = false }
scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }
xxhash-rust = { version = "0.8", features = ["const_xxh32"] }

[features]
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ink_prelude = { version = "4.1.0", path = "../prelude/", default-features = fals

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.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }
cfg-if = "1.0"
array-init = { version = "2.0", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion crates/storage/traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ink_metadata = { version = "4.1.0", path = "../../metadata", default-features =
ink_primitives = { version = "4.1.0", path = "../../primitives", default-features = false }
ink_prelude = { version = "4.1.0", path = "../../prelude", default-features = false }
scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
paste = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/basic_contract_caller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

# Note: We **need** to specify the `ink-as-dependency` feature.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/call-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false, features = ["call-runtime"] }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

# Substrate
#
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/conditional-compilation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/contract-terminate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/contract-transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/custom-environment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/custom_allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ink = { path = "../../crates/ink", default-features = false, features = ["no-all
dlmalloc = {version = "0.2", default-features = false, features = ["global"] }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/dns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/erc1155/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/erc20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/erc721/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/flipper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/incrementer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

constructors_return_value = { path = "../constructors-return-value", default-features = false, features = ["ink-as-dependency"] }
integration_flipper = { path = "../integration-flipper", default-features = false, features = ["ink-as-dependency"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../../crates/e2e" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/mapping_integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/multi_contract_caller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

adder = { path = "adder", default-features = false, features = ["ink-as-dependency"] }
subber = { path = "subber", default-features = false, features = ["ink-as-dependency"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
ink = { path = "../../../crates/ink", default-features = false }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/multi_contract_caller/adder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ink = { path = "../../../crates/ink", default-features = false }
accumulator = { path = "../accumulator", default-features = false, features = ["ink-as-dependency"] }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/multi_contract_caller/subber/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ink = { path = "../../../crates/ink", default-features = false }
accumulator = { path = "../accumulator", default-features = false, features = ["ink-as-dependency"] }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/multisig/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/payment-channel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
scale-info = { version = "2.5", default-features = false, features = ["derive"] }

[dev-dependencies]
hex-literal = { version = "0.3" }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/psp22-extension/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/rand-extension/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/set_code_hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
ink_e2e = { path = "../../crates/e2e" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
ink = { path = "../../../crates/ink", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.5", default-features = false, features = ["derive"], optional = true }

[lib]
path = "lib.rs"
Expand Down
Loading

0 comments on commit e5e7e52

Please sign in to comment.