Skip to content

Commit

Permalink
Compare Environment types against the node (#1377)
Browse files Browse the repository at this point in the history
* check env types

* add changelog

* resolve merge conflict

* refactor API

* attempt to add tests

* test type resolution

* check for invalid composite types

* test the env match between contract and node

* remove comment

* test mismatch

* remove json file

* move module to extrinsics

* update the metadata to only refer to contracts

* adjust segment search

* use anyhow error

* adjust segment comparison

* print warning if Env is not present in node metadata

* prettify code a bit

* use let-else and proper warning

* add proper verbosity flag

* elborate warning msg

* vanila eprintln

* saturating sub for slice bound
  • Loading branch information
German authored Oct 25, 2023
1 parent dfdc768 commit 1a1024d
Show file tree
Hide file tree
Showing 11 changed files with 459 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Compare `Environment` types against the node - [#1377](https://github.com/paritytech/cargo-contract/pull/1377)
- Adds workflow for publishing docker images for the verifiable builds - [#1267](https://github.com/paritytech/cargo-contract/pull/1267)
- Detect `INK_STATIC_BUFFER_SIZE` env var - [#1310](https://github.com/paritytech/cargo-contract/pull/1310)
- Add `verify` command - [#1306](https://github.com/paritytech/cargo-contract/pull/1306)
Expand Down
61 changes: 31 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/extrinsics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ scale-info = "2.10.0"
subxt = "0.32.1"
subxt-signer = { version = "0.32.1", features = ["subxt", "sr25519"] }
hex = "0.4.3"
ink_metadata = "5.0.0-alpha"

[dev-dependencies]
assert_cmd = "2.0.12"
Expand Down
6 changes: 5 additions & 1 deletion crates/extrinsics/src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ use super::{
Missing,
TokenMetadata,
};
use crate::extrinsic_opts::ExtrinsicOpts;
use crate::{
check_env_types,
extrinsic_opts::ExtrinsicOpts,
};

use anyhow::{
anyhow,
Expand Down Expand Up @@ -186,6 +189,7 @@ impl CallCommandBuilder<state::Message, state::ExtrinsicOptions> {
let rpc = RpcClient::from_url(&url).await?;
let client = OnlineClient::from_rpc_client(rpc.clone()).await?;
let rpc = LegacyRpcMethods::new(rpc);
check_env_types(&client, &transcoder)?;

let token_metadata = TokenMetadata::query(&rpc).await?;

Expand Down
Loading

0 comments on commit 1a1024d

Please sign in to comment.