Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare Environment types against the node #1377

Merged
merged 24 commits into from
Oct 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions crates/extrinsics/src/env_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ use anyhow::{
fn get_node_env_fields(
registry: &PortableRegistry,
) -> Result<Option<Vec<Field<PortableForm>>>> {
let env_type_option = registry.types.iter().find(|t| {
let Some(env_type) = registry.types.iter().find(|t| {
let len = t.ty.path.segments.len();
t.ty.path.segments[len - 2..] == ["pallet_contracts", "Environment"]
});

let env_type = if let Some(tt) = env_type_option {
tt
} else {
}) else {
// if we can't find the type, then we use the old contract version.
tracing::warn!("The node does not contain `Environment` type. Are you using correct `pallet-contracts` version?");
contract_build::verbose_eprintln!(true, "The node does not contain `Environment` type. Are you using correct `pallet-contracts` version?");
ascjones marked this conversation as resolved.
Show resolved Hide resolved
return Ok(None)
};

Expand Down Expand Up @@ -77,10 +73,7 @@ pub fn compare_node_env_with_contract(
node_registry: &PortableRegistry,
contract_metadata: &InkProject,
) -> Result<()> {
let env_fields_option = get_node_env_fields(node_registry)?;
let env_fields = if let Some(f) = env_fields_option {
f
} else {
let Some(env_fields) = get_node_env_fields(node_registry)? else {
return Ok(())
};
for field in env_fields {
Expand Down
Loading