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

Persist Environment in metadata #1741

Merged
merged 11 commits into from
Apr 14, 2023
Merged

Persist Environment in metadata #1741

merged 11 commits into from
Apr 14, 2023

Conversation

SkymanOne
Copy link
Contributor

This PR closes #1695 by adding a field environment to metadata.json which contains the info about the types of the contract's environment.

@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2023

Codecov Report

Merging #1741 (a1b505d) into master (d5c1f4a) will decrease coverage by 0.10%.
The diff coverage is 100.00%.

❗ Current head a1b505d differs from pull request most recent head 3b7d8ff. Consider uploading reports for the commit 3b7d8ff to get more accurate results

@@            Coverage Diff             @@
##           master    #1741      +/-   ##
==========================================
- Coverage   70.76%   70.67%   -0.10%     
==========================================
  Files         206      206              
  Lines        6455     6581     +126     
==========================================
+ Hits         4568     4651      +83     
- Misses       1887     1930      +43     
Impacted Files Coverage Δ
...rates/ink/codegen/src/generator/chain_extension.rs 95.23% <ø> (ø)
crates/ink/codegen/src/generator/env.rs 100.00% <ø> (ø)
crates/ink/tests/return_type_metadata.rs 50.00% <ø> (+5.55%) ⬆️
crates/metadata/src/lib.rs 55.00% <ø> (ø)
crates/metadata/src/tests.rs 100.00% <ø> (ø)
crates/env/src/types.rs 9.09% <100.00%> (+9.09%) ⬆️
crates/ink/codegen/src/generator/metadata.rs 97.24% <100.00%> (+0.34%) ⬆️
crates/metadata/src/specs.rs 93.67% <100.00%> (+1.33%) ⬆️

... and 56 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -16,7 +16,6 @@ categories = ["no-std", "embedded"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]

[dependencies]
ink_metadata = { version = "4.1.0", path = "../metadata", default-features = false, features = ["derive"], optional = true }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because it seems it is not used anywhere.

@SkymanOne SkymanOne merged commit a20ffc1 into master Apr 14, 2023
@SkymanOne SkymanOne deleted the gn/env-in-metadata branch April 14, 2023 09:36
@cmichi cmichi mentioned this pull request Apr 20, 2023
goastler added a commit to prosopo/ink_sr25519 that referenced this pull request Jul 31, 2023
goastler added a commit to prosopo/ink_sr25519 that referenced this pull request Aug 2, 2023
SkymanOne pushed a commit that referenced this pull request Aug 9, 2023
* sr25519 signature verification

* offchain signature verification

* fmt

* schnorrkel optional

* update dictionary

* fix

* update changelog

* add info about unstable function usage

* missing docs

* review suggestions

* added catch for invalid public key or signature in sr25519 verification

public key byte[] and/or signature byte[] may not be constructed into a PublicKey or Signature if it's in the wrong format. These errors originate from the schnorrkel library and need to be caught, otherwise it'll panic and propagate up to smart contracts in ink.

* switched to simple signing context in sr25519_verify fn

there is no need to make the context directly, we can delegate that to the schnorrkel library

* Added docs for sr25519_verify()

Docs + example + notes about context set to "substrate"

* Added docs to sr25519VerifyFailed error

Helpful for debugging why the error has occurred, as there is only ever one of 3 reasons: invalid public key, invalid message or invalid signature

* Added docs link to substrate sr25519 signing context

* cargo fmt

* Remove reference on message variable of sr25519_verify()

Not required according to clippy

* Clippy embed error in panic statement during metadata execution

Clippy's advice

* sr25519 verification tests

Tested invalid public key, invalid signature, invalid message and valid case

* Updated sr25519_verify PR number in CHANGELOG.md

* Fix comment to adhere to spell check in sr25519 verification tests

* add parity as author of sr25519 module

Co-authored-by: Green Baneling <XgreenX9999@gmail.com>

* ignore semicolon correction in item module

* add warning to docs for sr25519_verify() depending on unstable interfaces

* remove space typo from sr25519 docs

* remove #1741 from changelog

* added documentation to the dummy method in sr25519_verification example

* typo in sr25519 example contract dummy method

* spell check fix in method doc for sr25519

* spell check fix in method doc for sr25519

* move changelog entry for #1741

* changelog typo

---------

Co-authored-by: kziemianek <kasper.ziemianek@gmail.com>
Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persist Environment types and values in metadata
3 participants