Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

support crypto primitives for no_std introducing full_crypto feature #3778

Merged
merged 27 commits into from
Nov 4, 2019

Conversation

brenzi
Copy link
Contributor

@brenzi brenzi commented Oct 7, 2019

This adds a new compiler feature full_crypto to

  • substrate-primitives
  • substrate-application-crypto

Why

The upstream logic knows only two use cases:

  • within a std environment -> use crypto primitives like sr25519::Pair
  • within wasm, a no_std environment with the goal of yielding lightweight binaries -> use host calls for crypto primitives

As we use substrate-primitives within an SGX enclave to sign extrinsics, we're actually adding a third use case:

  • within a no_std environment but needing crypto primitives -> no solution so far.

So far, we just patched cargo dependencies to our own fork of these substrate crates, but this is hard to maintain and we think others might benefit from our generalization.

CI

In order to make sure we can test this new feature automatically, we wrote a minimal crate:
https://github.com/scs/test-no-std/tree/substrate-primitives

unfortunately, the linker still fails, but as long as there is no duplicate lang itemerror, the build is to be considered a success.

@parity-cla-bot
Copy link

It looks like @brenzi signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

@burdges
Copy link

burdges commented Oct 7, 2019

Is rand appearing here? We've reached rand 0.7 by now?

As I've noted before w3f/schnorrkel#31 (comment) I think rand_os activates std before 0.2.1, so before rand 0.7. We avoid OsRng, ThreadRng, etc. on chain, but require roughly OsRng for substraTEE, etc.

We'll want RngCore5As4 from w3f/schnorrkel@8150ef6 if we want both ed25519-dalek and rand_core 0.5 (rand 0.7). Are cargo features an issue? I think not..

@brenzi
Copy link
Contributor Author

brenzi commented Oct 8, 2019

@burdges: What we need for substraTEE are: signing & verifying and hashing. For random we use Intel SGX features.
This also means we're not actually using Schnorrkel ourselves within the enclave, because - in contrast to ed25519 - sr25519 seems to require random for deriving a keypair from a seed. So we want to verify sr25519 signatures, but for signing we use an ed25519 pair.

I'm not sure I understand your remarks. no_std works for us in the enclave with sr25519 and ed25519. However, because of a cargo bug, we still need to patch to avoid duplicate lang item std:

[patch.crates-io]
ed25519-dalek = { git = "https://github.com/scs/ed25519-dalek.git", branch = "no_std_sgx"}

but that doesn't affect this codebase here.

@brenzi
Copy link
Contributor Author

brenzi commented Oct 8, 2019

added CI comments ^^^^

@burdges
Copy link

burdges commented Oct 8, 2019

sr25519 seems to require random for deriving a keypair from a seed.

We do not require randomness when expanding a keypair from a seed:
https://docs.rs/schnorrkel/0.1.1/src/schnorrkel/keys.rs.html#114

We do use randomness when doing HDKD in https://docs.rs/schnorrkel/0.1.1/src/schnorrkel/derive.rs.html#177 which I should probably replace with a t.witness_bytes call so that you can replace thread_rng using attach_rng. I tried to write the code more semantically once upon a time, but this'll make more sense now I think. Thanks!

We previously used randomness when doing HDKD in https://docs.rs/schnorrkel/0.1.1/src/schnorrkel/derive.rs.html#177 but any recent schnorrkel fixes this https://docs.rs/schnorrkel/0.8.5/src/schnorrkel/derive.rs.html#185 so use attach_rng if you must control the randomness source.

@kianenigma kianenigma added the A3-in_progress Pull request is in progress. No review needed at this stage. label Oct 8, 2019
@brenzi
Copy link
Contributor Author

brenzi commented Oct 9, 2019

@burdges: thanks for your helpful hints. This means we actually might use sr25519 keys for our enclave.

However: I consider this off-topic for this PR.

@brenzi
Copy link
Contributor Author

brenzi commented Oct 9, 2019

@bkchr, @kianenigma: This PR just got flagged "in progress". While it's true that it is not ready for merging/review, I'd like to ask you for a statement if you are willing to accept our added use case and the approach of this PR

@gavofyork
Copy link
Member

yeah; looks reasonable to me.

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

Sorry for the delay!

Generally looking good. Please remove these duplicate implementations, just import the trait from rstd.

And as I said, I would call the feature full_crypto.

core/primitives/src/ed25519.rs Outdated Show resolved Hide resolved
core/primitives/src/ed25519.rs Outdated Show resolved Hide resolved
core/primitives/src/crypto.rs Outdated Show resolved Hide resolved
core/primitives/src/crypto.rs Outdated Show resolved Hide resolved
core/primitives/src/crypto.rs Show resolved Hide resolved
core/primitives/Cargo.toml Outdated Show resolved Hide resolved
@brenzi brenzi changed the title support crypto primitives for no_std support crypto primitives for no_std introducing with_crypto feature Oct 30, 2019
@brenzi brenzi changed the title support crypto primitives for no_std introducing with_crypto feature support crypto primitives for no_std introducing full_crypto feature Oct 30, 2019
@bkchr
Copy link
Member

bkchr commented Oct 30, 2019

@brenzi you need to update the Cargo.lock and commit that. (Just run cargo build for a moment)

@brenzi
Copy link
Contributor Author

brenzi commented Oct 30, 2019

It appears to me that cargo doesn't forward our new feature full_crypto correctly:

error[E0412]: cannot find type `Pair` in module `app`
  --> core/finality-grandpa/primitives/src/lib.rs:38:31
   |
38 | pub type AuthorityPair = app::Pair;
   |                               ^^^^ not found in `app`
help: possible candidates are found in other modules, you can import them into scope
   |
25 | use app_crypto::Pair;
   |
25 | use app_crypto::ed25519::Pair;
   |
25 | use app_crypto::sr25519::Pair;
   |
25 | use sr_primitives::testing::sr25519::Pair;
   |

error[E0277]: the trait bound `app::Signature: std::hash::Hash` is not satisfied
  --> core/finality-grandpa/primitives/src/lib.rs:33:2
   |
33 |     app_crypto!(ed25519, GRANDPA);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `app::Signature`
   |
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

@bkchr: do you have a clue?

@brenzi
Copy link
Contributor Author

brenzi commented Oct 30, 2019

ahh, got it. need to add the feature for the finality crate as well - because it's a macro I guess.

.gitlab-ci.yml Outdated
- $DEPLOY_TAG
script:
- cd core/primitives/
- time cargo build --release --verbose --no-default-features --features full_crypto
Copy link
Member

Choose a reason for hiding this comment

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

Please don't build it in release, that just waste resources^^

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok.

@brenzi
Copy link
Contributor Author

brenzi commented Oct 30, 2019

@bkchr It seems I broke the CI script:

Running with gitlab-runner 12.4.1 (05161b14)
  on ci2-docker 8a60f15c
Using Docker executor with image parity/rust-builder:latest ...
ERROR: Preparation failed: Error response from daemon: Conflict. The container name "/runner-8a60f15c-project-145-concurrent-0-cache-c33bcaa1fd2c77edfc3893b41966cea8" is already in use by container "81f69a0237714f11351d20325b818d3400aa19476e4057b1d43bcaefcfbe0075". You have to remove (or rename) that container to be able to reuse that name. (cache_container.go:97:0s)
Will be retried in 3s ...

but why and how?

@brenzi
Copy link
Contributor Author

brenzi commented Oct 30, 2019

@bkchr: It seems that my new CI test is not run:

build-full-crypto-feature:

@brenzi
Copy link
Contributor Author

brenzi commented Oct 30, 2019

I'll have to put this on wait because it seem's the latest version causes no_std collisions when testing against https://github.com/scs/test-no-std/tree/substrate-primitives.
I'll revert once that's fixed

@brenzi
Copy link
Contributor Author

brenzi commented Oct 30, 2019

the last commit fixes it. My only remaining question is if my new CI test is actually running.

@brenzi
Copy link
Contributor Author

brenzi commented Oct 30, 2019

could we include building https://github.com/scs/test-no-std/tree/substrate-primitives in CI as well? It's a minimal crate that checks for no_std collisions. Maybe you already have means to test such things for wasm? Better ways?

.gitlab-ci.yml Outdated Show resolved Hide resolved
core/application-crypto/src/ed25519.rs Outdated Show resolved Hide resolved
core/application-crypto/src/lib.rs Outdated Show resolved Hide resolved
core/application-crypto/src/sr25519.rs Outdated Show resolved Hide resolved
core/consensus/aura/Cargo.toml Outdated Show resolved Hide resolved
core/application-crypto/src/lib.rs Outdated Show resolved Hide resolved
core/application-crypto/src/lib.rs Show resolved Hide resolved
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

One last nitpick, otherwise it looks good.

Ty for your patience :)

core/primitives/src/crypto.rs Outdated Show resolved Hide resolved
@bkchr
Copy link
Member

bkchr commented Nov 4, 2019

Ty!

@bkchr bkchr merged commit cefe4dc into paritytech:master Nov 4, 2019
@brenzi
Copy link
Contributor Author

brenzi commented Nov 4, 2019

@bkchr thanks for your patience and support too.

nodebreaker0-0 pushed a commit to nodebreaker0-0/substrate that referenced this pull request Nov 28, 2019
* Make sure im-online reports are high priority.

* Bump runtime.

base-code

edit option

environment block num - test

metrics fn push and finalized listing

best_block_num listing

Add translate API for storage values (paritytech#3947)

* Add translate item.

* fix

* doc

* fix doc

* A test added.

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <[email protected]>

* address suggestion

im-online: account for block authorship (paritytech#3973)

* im-online: account for block authorship

* im-online: add test for block authorship onlineness

* im-online: cleanup

* im-online: fix test

grandpa: Use storage proofs for Grandpa authorities (paritytech#3734)

* grandpa: Write Grandpa authorities to well known key.

Instead of requiring execution proofs for Grandpa authorities, this
enables much simpler storage proofs.

* grandpa: Introduce named AuthorityList type.

* grandpa: Storage migration for srml-grandpa module.

* Remove no-longer-used GrandpaApi runtime API.

* grandpa: Write AuthorityList to storage with encoding version.

We expect the AuthorityList type may change (eg. key changes). To make
upgrades smoother, include a version in the stored value.

* Bump node runtime spec version.

* Update srml/grandpa/src/lib.rs

Co-Authored-By: André Silva <[email protected]>

Add the code for compiling node-cli for WASM-browser (paritytech#3974)

* Extract CLI to separate module in node/cli

* Make node/cli compile for WASM

* More work on node/cli browser

* More work on browser node

* More work

* More work

* Purge a bit the CI script

* More clean up

* Remove substrate-finality-grandpa from the CI

Its tests use tokio, which fails to compile.

* Address review

* Add rocksdb feature to the service

* Fix substrate-service WASM CI

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <[email protected]>

* Don't WASM-compile substrate-service altogether

Remove NetworkSpecialization::on_event (paritytech#3976)

and backend reference to rpc builder (paritytech#3979)

Improve doc for storages in srml-support (paritytech#3982)

* improve doc

* Apply suggestions from code review

Retire `storage_items!` (paritytech#3950)

* Retire storage_items

* Add storage_items! tests to srml/support/tests

* Assimilate genesis config

Revert "grandpa: Use storage proofs for Grandpa authorities (paritytech#3734)" (paritytech#3983)

This reverts commit c3b1a98.

Print warning again if polling network is too long (paritytech#3984)

Add events for im_online (paritytech#3991)

* Add AllGood event for im_online

* Another event just in case.

* Bump runtime

authority-discovery: futures 03 Future (paritytech#3848)

* authority-discovery: futures 03 Future

* make ci happy

* use futures timer instead of tokio timer

* Update core/authority-discovery/src/lib.rs

Co-Authored-By: Bastian Köcher <[email protected]>

* remove tokio 01 runtime

* trigger build

* kill futures01

* rename futures

Integrate Wasmtime for runtime execution (paritytech#3869)

* executor: Use non wasmi-specific execution in tests.

* executor: Move all runtime execution tests into tests file.

* executor: Use test_case macro to easily execute tests with different
Wasm execution methods.

* executor: Convert errors to strings with Display, not Debug.

* node-executor: Rewrite benchmarks with criterion.

They were not passing compilation before and criterion seems to be more
widely used in Substrate.

* executor: Begin implementation of Wasm runtime.

The implementation demonstrates the outline of the execution, but does
not link against the external host functions.

* executor: Define and implement basic FunctionExecutor.

The SandboxCapabilities::invoke is still left unimplemented.

* executor: Implement host function trampoline generation.

* executor: Instantiate and link runtime module to env module.

* executor: Provide input data during wasmtime execution.

* executor: Implement SandboxCapabilites::invoke for wasmtime executor.

* executor: Integrate and test wasmtime execution method.

* executor: Improve FunctionExecution error messages.

* Scope the unsafe blocks to be smaller.

* Rename TrampolineState to EnvState.

* Let EnvState own its own compiler instead of unsafe lifetime cast.

* Refactor out some common wasmi/wasmtime logic.

* Typos and cosmetic changes.

* More trampoline comments.

* Cargo.lock update.

* cli: CLI option for running Substrate with compiled Wasm execution.

* executor: Switch dependency from fork to official wasmtime repo.

* Quiet down cranelift logs.

* Explicitly catch panics during host calls.

We do this to ensure that panics do not cross language boundaries.

* Additional checks and clarifications in make_trampoline.

* Fixes after merge from master and panic safety for wasmtime
instantiation.

Implement Debug for some structures (paritytech#3941)

* Implement Debug for some structures

`NetworkConfiguration`, `TransportConfig`, `NodeKeyConfig` and `Secret`.

Needs a new release of the `rust-libp2p` crate. This PR is just a
reminder.

* Explicitly separate `std` and `core`

* Add manual implementation for Secret

Possible fix to storage cache (paritytech#3989)

* Comment local_cache propagation

* Add test

* Deny cache when modifications are unknown

* Fix indentation

Don't panic in Offchain test context, when we are already panicking (paritytech#3996)

executor: Move runtime version caching out of WasmRuntime interface. (paritytech#3993)

* executor: Move runtime caching out of WasmRuntime interface.

The runtime version is now fetched and cached at a higher level, not
within the WasmRuntime trait implementations.

* executor: Require successful querying of runtime version.

Move config path generation into the service config for reusability (paritytech#3978)

* Move config path generation into the service config for reusability

* Make NoCostum Default and fix tests

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <[email protected]>

* remove function not used anymore

* Make path into an option

* remove database_path function and call it directly

* remove helper functions, use consts

expose offchain worker storage prefix (paritytech#3977)

* expose offchain worker storage prefix

* add docs

* move STORAGE_PREFIX to primitives

Optional serde for phragmen support (paritytech#3994)

* Add serde to phragmen

* Update lock file

* and bump a version

* and bump a version again

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <[email protected]>

* revert impl-tarit for tuple update

* revert session.

* Revert "revert session."

This reverts commit 98086c9.

* Revert "revert impl-tarit for tuple update"

This reverts commit 28a7fdd.

doc (paritytech#3995)

Implement color output for wasm builder (paritytech#4004)

* Implement color output for wasm builder

* Fix `Cargo.lock`

CI test executor with wasmtime (paritytech#4005)

Avoid sending heartbeat if we are already considered online. (paritytech#3981)

* Don't send a heartbeat if already online.

* Remove env_logger.

* Update lock.

* Bump runtime.

* Merge master

Deprecate ValidateUnsigned and prevent duplicate heartbeats (paritytech#3975)

* Add pre-dispatch checks for ValidateUnsigned

* Deprecate ValidateUnsigned.

* Bump specversion.

* Fix test.

fix formula in comment (paritytech#4006)

Substrate EVM (paritytech#3927)

* srml-evm: init the basic structures

* srml-evm: finish executor implementation

* srml-evm: implement balance deposit and withdraw

* srml-evm: implement the actuall call/create

* srml-evm: use crates.io version of evm

* srml-evm: fix no-std compile

* Remove dependency patch

* Update to evm 0.14

* Use double map for account storage

* Add precompiles support

* Add some basic docs

* Use runtime_io::chain_id()

* Update srml/evm/src/lib.rs

Co-Authored-By: Xiliang Chen <[email protected]>

* Update srml/evm/src/lib.rs

Co-Authored-By: Xiliang Chen <[email protected]>

* Fix WithdrawReason

* Unique saturate balance to u128

* Unique saturate withdraw to u128

* Remove extern crate alloc

* Move account code to a separate storage and use ref for convert_account_id

* More match cause for error message

* Fix potential interger overflow

* Use decode_len for fetching code length

support crypto primitives for no_std introducing `full_crypto` feature (paritytech#3778)

* introduced "with_crypto" feature and applied switches like in substrate-api-client fork

* introduced "with_crypto" feature and applied switches like in substraTEE-worker fork

* distinguishing core::hash vs std::hash

* @bkchr's review requests fulfilled

* fixes

* revert dependency upgrade ed25519-dalek

* added full_crypto features to all crates using app_crypto! macro

* fixing CI complaints.

* fix again

* adding CI test for with_crypto feature

* added full_crypto for ecdsa. now builds wit h--no-deafault-features --features with_crypto

* remove --release from CI test

* @bkchr requested changes. moved full_crypto CI test to build stage

* fixing no_std issue

* CI fresh copy from srml-staking

* gitlab CI with +nightly

* solved no-feature-in-macro dilemma

* cosmetics

* Update core/application-crypto/src/sr25519.rs

Co-Authored-By: Bastian Köcher <[email protected]>

* Update core/application-crypto/src/ed25519.rs

Co-Authored-By: Bastian Köcher <[email protected]>

* even more simple

* undo line delete

* refactoring app_crypto macro. splitting functionalities based on full_crypto feature

* whitespace cosmetics

refactor code: remove unused import (paritytech#4010)

* remove unused import

* fix test error

Update RPC deps. (paritytech#4012)

* Bump rpc deps

* Update core/test-runtime/src/genesismap.rs

Co-Authored-By: Bastian Köcher <[email protected]>

Enable parallel block download (paritytech#4014)

Traffic statistics (paritytech#4017)

* Network stats

* Fixed tests

Limit longevity of im-online heartbeats. (paritytech#4011)

* Limit longevity of im-online heartbeats.

* Unused import.

* Use parameter for session duration.

Header-only sync for old forks (paritytech#3942)

* Header-only sync for old forks

* Simplified blocks-count

* Update core/consensus/common/src/block_import.rs

Co-Authored-By: Marcio Diaz <[email protected]>

Revert "Header-only sync for old forks (paritytech#3942)" (paritytech#4022)

This reverts commit ac78c90.

Don't re-compile on every `cargo run` (paritytech#4019)

- Add new crate `substrate-build-script-utils` to unify the code of
`node`, `node-template` and `polkadot-node`.
- The `node-cli` build script needs to search upwards for the
`.git/HEAD` file to find it.

fix warnings (paritytech#4024)

Less verbose console output (paritytech#4029)

Apply breaking changes of new libp2p versions (paritytech#3877)

* Apply breaking changes of new libp2p versions

* Oops, forgot to update version

* Fix tests

* Fix imports with WASM

* Fix WASM for real

* Update core/network/src/debug_info.rs

Co-Authored-By: Roman Borschel <[email protected]>

* Fix compilation

Update `syn`, `proc-macro2` and `quote` to `1.x` (paritytech#4028)

Make `TestExternalities` implement `Send` (paritytech#4030)

* Make `TestExternalities` implement `Send` + `Sync`

* Fixes offchain

* Make it just `Send`

Treasury rewards should pay the remainder of the 10% (paritytech#4026)

* Treasury rewards should pay the remainder of the 10%..

* Event for deposits coming into treasury

* Fix tests

* Remove OnDilution

Also replace paths in [build-dependencies] (paritytech#4039)

* Also replace paths in [build-dependencies]

* Update scripts/node-template-release/src/main.rs

Co-Authored-By: Bastian Köcher <[email protected]>

* Slightly reduce memory usage

* Update scripts/node-template-release/src/main.rs

Co-Authored-By: Bastian Köcher <[email protected]>

Decrease peer reputation on bad transactions (paritytech#4035)

* Decrease reputation on bad transactions

* Don't punish on duplicate transactions

Add `ExistenceRequirement` to `Currency` trait (paritytech#4000)

* Added a public transfer_some function and a private transfer_inner fn

* Move transfer_some to the end of the module impl to fix failing contracts test

* Change whitespace

* Remove needless change to transfer logic

* Fix error

* Update srml/balances/src/lib.rs

Co-Authored-By: joe petrowski <[email protected]>

* Improve documentation and add test

* Update srml/balances/src/lib.rs

Co-Authored-By: Kian Paimani <[email protected]>

* Switch to changing Currency trait instead

Ban incoming invalid transactions (paritytech#4037)

Improve auto-docs a little. (paritytech#4032)

Check polkadot compilation. (paritytech#3980)

* Check polkadot compilation.

* Fix git grep.

* Make sure to update properly. Use commit hash instead.

Refactor out MaxPossibleReward, fix staking arithmetic (paritytech#4041)

* Refactor out MaxPossibleReward, fix staking arithmetic

* Fix rounding error in test

grandpa: Use storage proofs for Grandpa authorities (paritytech#3985)

Allow import withouth state verification (paritytech#4031)

* Allow import without state verification

* Explicit None

Co-Authored-By: Robert Habermeier <[email protected]>

Correctly serialize code in chain spec as hex (paritytech#4025)

* Correctly serialize code in chain spec as hex.

Due to a bug, the runtime code was previously serialized as a JSON
array of numbers, pretty printed one byte per line.

* Remove panic in macro and whitelist attribute types for storage
genesis config lines.

* Use syn::Error to enforce whitelisted attributes on genesis config.

* Blacklist genesis extra config line attributes instead of whitelist.

clean node/cli/Cargo.toml (paritytech#4046)

* clean node/cli/Cargo.toml

* minor fix

* clean node/runtime/Cargo.toml

fix two typos (paritytech#4048)

Increase parallel downloads to 5 (paritytech#4045)

* Increase parallel downloads to 5

* CLI param

Remove dependencies on OpenSSL (paritytech#4036)

* Remove dependency on hyper-tls

This removes one of the dependencies on native-tls, and thus on OpenSSL.
I will remove the other in a separate commit.

* Remove the `HttpClient` enum

It only had one variant.

* Apply suggestions from code review

Co-Authored-By: Pierre Krieger <[email protected]>

fix inmemory (paritytech#4049)

grandpa: progressively increase target gossip peers (paritytech#4050)

* grandpa: stricter gossip message filtering

* gossip: remove filtered message on send_message

* gossip: add test for tracking of broadcast attempts

* grandpa: only restrict gossip if we're connected to more than 5 authorities

* grandpa: add test for progressive gossip

* grandpa: add test for gossip filtering on local non-authority node

* grandpa: fix doc

* gossip, grandpa: tabify

* grandpa: relax filtering logic for global messages

Introduce thread pool for transaction validation. (paritytech#4051)

Batch gossip messages (paritytech#4055)

Fix minor comment typo "do" -> "do not" (paritytech#4054)

Fix sync downloading ancient chains (paritytech#4060)

* Update best block on announcement

* Added a test

grandpa: remove the periodic block announcer (paritytech#4062)

* grandpa: remove the periodic block announcer

* grandpa: remove periodic block announcer test

Fix the ui tests (paritytech#4066)

Improved cache documentation (paritytech#4067)

Additional logging for the transaction pool. (paritytech#4068)

* Additional logging for the pool.

* Long line.

Pass startup_time to telemetry (paritytech#4069)

Further fix for common block update (paritytech#4071)

Add a --no-private-ipv4 CLI option (paritytech#4042)

* Add a --no-private-ipv4 CLI option

* Fix tests

* Fix tests

Change max width to 100. (paritytech#4072)

Don't update common block on ancient block import (paritytech#4073)

Don't search for authority set change block if delay is zero (paritytech#4076)

srml-timestamp: define max timestamp drift in millis (paritytech#4077)

* srml-timestamp: define max timestamp drift in millis

* srml-timestamp: suffix MAX_TIMESTAMP_DRIFT with unit

Substrate runtime interface 2.0 (paritytech#4057)

* Adds first version of traits for generating the host functions

* First steps of the procedural macro

* Implements generation of the host extern functions

* Prefix ext host function with snake case trait name

* Implement host functions implementation on the host

* Change `HostFunctions` interface

* Implement `HostFunctions` for tuples

* Make `WasmExecutor` generic over the host functions

* Begin to add a test and make it compile

* Make the test succeed

* Add test to ensure that host functions are not found

* It's alive! Make the `set_storage` test work

* Add test for mutable references

* Code cleanup and documentation etc

* Add marker trait for types that should be passed as SCALE encoded

* Inherit the visibility from the trait and more improvements

* More impls and move them into their own file

* Code simplification by dropping one trait

* Give it a better name

* Implement traits for arrays

* Refactor code to support pass by codec/inner

* Docs

* Implement pass by inner for some crypto types and add a test

* Implement exchangeable function support

* Rewrite sr-io with as runtime interface

* Start reworking after master merge

* Adds `PassByCodec` derive

* Adds `PassByInner` derive

* Fix compilation errors

* More implementations

* Implement runtime interface traits for `str`

* Make `sr-io` compile again

* Fix more compilation errors

* More progress on getting stuff back to compile

* More compilation fixes

* Fix warnings

* Remove le conversions

* Add support for `wasm_only` interfaces

* Implement `Allocator` interface

* Improve error message

* Move `WasmAllocator` to `sr-io` and more clean ups

* Use correct function signature for wasm functions

* Store the host functions with the Wasm runtime

* Docs update

* Fix compilation after master merge

* Remove `sr-io/without_std`

* Make `srml-support` tests run again

* More compilation error fixes

* Use correct doc syntax

* Fix test-runtime

* Fix compilation

* Catch native panics when executing the wasm runtime

As with the native runtime, we now catch all native panics when we
execute the wasm runtime. The panics inside the wasm runtime were
already catched before by the wasm executor automatically, but any panic
in the host functions could bring down the node. The recent switch to
execute the native counterpart of the host function in `sr-io`, makes
this change required. The native `sr-io` functions just `panic` when
something is not provided or any other error occured.

* Fix compilation

* Don't panic in a panic

* Move `sr-sandbox` to new runtime interface

* Fixes tests after sandbox changes

* Make sure we detect invalid utf8

* Fixes after master merge

* Adds pass by enum strategy

* Fix wasmtime integration

* Some macro structure clean up

* Rework and test exchangebale host functions

* PassBy derive macros documentation

* Docs for `runtime_interface` macro

* Support wild card argument names

* Adds ui tests

* Make sure that we are backwards compatible to the old runtime interfaces

* Documentation

* Fixes after latest master merge

* Make `wasmtime` happy

* Make `full_crypto` work

* Make the new interface versionable

* Rename `Sanboxing` to `Sandbox`

* Don't finalize in test while importing

* Fix Performance regression

* Fix test

Remove Self vote from phragmen (paritytech#4081)

* first draft of everything that works

* Some test fixes

Allow ancient fork download after ancestry search (paritytech#4080)

Typed chain state queries over rpc. (paritytech#4079)

* Create typed client helpers for querying chain state storage items declared by
'decl_storage!'.

* Update substrate-rpc-custom functions to use async await syntax.

* The implementation of substrate-rpc-custom was a bit verbose and repetitive.
This commit makes the implementation simpler by intruducing a struct which
represents query for a typed value in storage. The new struct is called
StorageQuery. A StorageQuery wraps a raw StorageKey but is not directy
constructable. To construct a StorageQuery, the user must supply an
implementation of a srml_support::storage::generator trait such as
StorageValue or StorageMap.

A type implementing one of the generator traits can be aquired by:
A) marking a storage item as pub within a call to decl_storage (recommended)
or B) implementing one of the generator types manually.

While option B may sometimes me necessary, it's not recommended because
separate manual implementaions may lose sync with the original definition.

* drop unused dependency

* fmt

* Remove unnecessary pub from Authorities field in test-runtime storage
declaration.

This field was added to support a test in an earlier commit. The
test no longer relies on test-runtime so the change can be reverted.

* Move it to srml as support extension.

* Fix long lines.

* Fix.

Cleanup filtered messages (paritytech#4082)

Don't request old obsolete blocks (paritytech#4084)

core/consensus: fix console output for slot duration (paritytech#4085)

[WIP] .gitlab-ci.yml: Fix a check for polkadot to work on forked repos v2 (paritytech#4078)

* Fix a check for polkadot to work on forked repos.

* .gitlab-ci.yml: Add `git diff` for CI debugging

* More future proof and less redundant.

* .gitlab-ci.yml: Improve comments and refactor sed command

* .gitlab-ci.yml: Remove two commas in a row

* .gitlab-ci.yml: Ensure to match branch statements at the end

* .gitlab-ci.yml: Reference concrete commit

When one does not specify the concrete commit, cargo-update tries to
checkout 'master' in the Substrate repository.

* .gitlab-ci.yml: Remove 'git diff' debug line

Fix runtime interface docs and remove accidentally added file (paritytech#4092)

EVM should store contracts' balances in an account. (paritytech#4090)

update tiny-keccak (paritytech#4093)

* update tiny-keccak

* fix

* Update Cargo.toml

* update Cargo.lock

* remove keccak-hasher

Do nothing for zero imbalances (paritytech#4089)

Fix sync stalling on moving head (best block) prior to the tip of the chain sometimes (paritytech#4091)

* Work around finalization woes

* Fixed check_block

* Added a test

Weight annotation for block hooks.  (paritytech#4058)

* Initial version that works with proper tests.

* get rid of todos and grumbles and such.

* Cleanup and fix line-width

* fix test runtime test

Sensible limits for known blocks and extrinsics (paritytech#4094)

Randomized tests on storage cache (paritytech#4070)

* randomized tests

* destroy clones

* remove commented

* fixes

* add finalization fork

State machine call proof backend (paritytech#3945)

* drafting a proof extraction at the hashdb level (to include everything
for the 'call' proof case).

* use full proof by default (replace previous proof recorder).

* fix warnings.

* Cache value not found in proof recorder.

* Remove need or internal backend struct.

* fix type.

* doc

Translation for linked map (paritytech#4052)

* make linked_map generic functions better

* implement translation of linked map

* proc-macro for linked map updated

* test linked map migration

* account for instances

* address grumbles

* cut map short if migration fails

Do not download blocks too far ahead (paritytech#4095)

Keep tack of best imported block precisely (paritytech#4100)

Additional wasm diagnostics (paritytech#4097)

* Wasm diagnostics

* Pass the error

* Make errno optional

* Cargo.lock

* Log the error

Implement Copy, Deref and FromStr to (ed25519|sr25519)::Public (paritytech#3998)

*: Refactor authority discovery (key mngmt, runtime API) (paritytech#3955)

* {core,srml}/authority-discovery: Move generic to specific session keys

* {srml,core}/authority-discovery: Verify signature outside of runtime

Given that the `core/authority-discovery` uses concrete authority
identifiers and signatures, one can verify a signature with the
authority discovery within `core`. Given the above, the `verify` runtime
api is obsolete and thus removed.

* *: Add authority discovery to the set of session keys

* *: Sign authority discovery DHT payload with keystore instead of runtime

Instead of calling a runtime function to sign a dht payload, which then
invokes the keystore, pass the keystore to the authority discovery
module and use it directly.

* core/authority-discovery: Give libp2p Kademlia time to start up

* core/authority-discovery: Move authorities priority group name to const

* node/runtime/src/lib.rs: Bump runtime spec version

* *: Fix lints and node/testing test failures

* *: Fix formatting

* core/authority-discovery: Box dht event channel in unit tests

* node/cli/src/service.rs: Fix future import

* node/cli/src/service.rs: Replace unwrap by expect with proof

* node/cli/src/chain_spec: Remove TODO for testnet key generation

* core/authority-discovery/src/lib: Remove scale encoding TODOs

* srml/authority-discovery: Make comment a doc comment

* core/authority-discovery: Remove unused StreamExt import

* node/runtime: Bump impl version to debug CI

* Test ci.

* Change the line width to 100.

* Revert "Change the line width to 100."

This reverts commit edff1f8.

* Fix a check for polkadot to work on forked repos.

* Revert "node/runtime: Bump impl version to debug CI"

This reverts commit 1a90903.

* Revert "Test ci."

This reverts commit a2c9df5.

* Cargo.lock: Fix wrong lock file merge

* srml/authority-discovery: Keep track of new validator set not upcoming

* core/authority-discovery: Document key retrieval functions

Reorganising the repository - external renames and moves (paritytech#4074)

* Adding first rough ouline of the repository structure

* Remove old CI stuff

* add title

* formatting fixes

* move node-exits job's script to scripts dir

* Move docs into subdir

* move to bin

* move maintainence scripts, configs and helpers into its own dir

* add .local to ignore

* move core->client

* start up 'test' area

* move test client

* move test runtime

* make test move compile

* Add dependencies rule enforcement.

* Fix indexing.

* Update docs to reflect latest changes

* Moving /srml->/paint

* update docs

* move client/sr-* -> primitives/

* clean old readme

* remove old broken code in rhd

* update lock

* Step 1.

* starting to untangle client

* Fix after merge.

* start splitting out client interfaces

* move children and blockchain interfaces

* Move trie and state-machine to primitives.

* Fix WASM builds.

* fixing broken imports

* more interface moves

* move backend and light to interfaces

* move CallExecutor

* move cli off client

* moving around more interfaces

* re-add consensus crates into the mix

* fix subkey path

* relieve client from executor

* starting to pull out client from grandpa

* move is_decendent_of out of client

* grandpa still depends on client directly

* lemme tests pass

* rename srml->paint

* Make it compile.

* rename interfaces->client-api

* Move keyring to primitives.

* fixup libp2p dep

* fix broken use

* allow dependency enforcement to fail

* move fork-tree

* Moving wasm-builder

* make env

* move build-script-utils

* fixup broken crate depdencies and names

* fix imports for authority discovery

* fix typo

* update cargo.lock

* fixing imports

* Fix paths and add missing crates

* re-add missing crates

base-code(rebased)

set global/local metric

+

peers_num add

prres_num,best_heght,finallity_heght add

TARGET_SYN_NUMBER add

README.md add

README.md add

README.md

TARGET_SYN_NUMBER add

README.md add

README.md

fix: justification and newline at EOF

PEERS_NUM

README.md update

README.md update

README.md update

README.md update

README.md

README.md

README.md

translation of introduction

feat: add prometheus! in substrate

feat: add match for opts options

SaturatedConversion remove

refactor prometheus/lib.rs

chore: make macros for widgets

TODO : counter metrics type add->remove

chore: add prometheus! to consensus

chore: update README

chore: refactor README

chore: Refactor README

chore: Refactor README

chore: Refactor README
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A3-in_progress Pull request is in progress. No review needed at this stage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants