* Reservable, Transferrable Fungible(s), plus adapters.
* Repot into new dir
* Imbalances for Fungibles
* Repot and balanced fungible.
* Clean up names and bridge-over Imbalanced.
* Repot frame_support::trait. Finally.
* Make build.
* Docs
* Good errors
* Fix tests. Implement fungible::Inspect for Balances.
* Implement additional traits for Balances.
* Revert UI test "fixes"
* Fix UI error
* Fix UI test
* More work on fungibles
* Fixes
* More work.
* Update lock
* Make fungible::reserved work for Balances
* Introduce Freezer to Assets, ready for a reserve & locks pallet. Some renaming/refactoring.
* Cleanup errors
* Imbalances working with Assets
* Test for freezer.
* Grumbles
* Grumbles
* Fixes
* Extra "side-car" data for a user's asset balance.
* Fix
* Fix test
* Fixes
* Line lengths
* Comments
* Update frame/assets/src/tests.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Update frame/support/src/traits/tokens/fungibles.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Update frame/assets/src/lib.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Update frame/support/src/traits/tokens/fungible.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Introduce `transfer_reserved`
* Rename fungible Reserve -> Hold, add flag structs
* Avoid the `melted` API - its too complex and gives little help
* Repot Assets pallet
Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* make types within `generate_solution_type` macro explicit
Closes#8444.
Just changes the parsing logic for that macro; does not change any
emitted code. The associated types associated with the macro now
require explicit, keyword-style declaration.
**Old**:
```rust
sp_npos_elections::generate_solution_type!(
#[compact]
pub struct TestCompact::<VoterIndex, TargetIndex, PerU16>(16)
);
```
**New**:
```rust
sp_npos_elections::generate_solution_type!(
#[compact]
pub struct TestCompact::<VoterIndex = VoterIndex, CandidateIndex = TargetIndex, Accuracy = PerU16>(16)
);
```
* un-ignore doc-tests
* use new form in bin/node/runtime/
* rename CandidateIndex -> TargetIndex
* add tests demonstrating some potential compile failures
* Base features and traits.
* pallet and unsigned phase
* Undo bad formattings.
* some formatting cleanup.
* Small self-cleanup.
* Make it all build
* self-review
* Some doc tests.
* Some changes from other PR
* Fix session test
* Update Cargo.lock
* Update frame/election-provider-multi-phase/src/lib.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
* Some review comments
* Rename + make encode/decode
* Do an assert as well, just in case.
* Fix build
* Update frame/election-provider-multi-phase/src/unsigned.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
* Las comment
* fix staking fuzzer.
* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Add one last layer of feasibility check as well.
* Last fixes to benchmarks
* Some more docs.
* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Some nits
* It all works
* Some self cleanup
* Update frame/staking/src/lib.rs
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
* remove most todos.
* Round of self-review.
* Fix migration
* clean macro
* Revert wrong merge
* Make the number of nominations configurable
* Self reivew
* renmae.
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
Fixes for better understanding and reading to developers. Added exact outputs and specific word names.
Note!
- Couldn't merge the approved previous pull request found at https://github.com/paritytech/substrate/pull/8409 which is the same as this one, that I proposed earlier on.
* Use 'Pallet' struct in construct_runtime.
* Fix genesis and metadata macro.
* Fix 'Pallet' type alias.
* Replace 'Module' with 'Pallet' for all construct_runtime use cases.
* Replace more deprecated 'Module' struct.
* Bring back AllModules and AllPalletsWithSystem type, but deprecate them.
* Replace deprecated 'Module' struct from merge master.
* Minor fix.
* Fix UI tests.
* Revert UI override in derive_no_bound.
* Fix more deprecated 'Module' use from master branch.
* Fix more deprecated 'Module' use from master branch.
* Update diener to enable polkadot companions that use new crates
Diener will be updated in the CI image to make it possible to have
companions that add new crates from Substrate.
Besides that the wasm-bindgen is updated, because `0.2.70` is not
available anymore on crates.io.
* update lock
Co-authored-by: kianenigma <kian@parity.io>
* more clear randomness API for BABE
* babe: move randomness utilities to its own file
* node: use babe::RandomnessFromOneEpochAgo in random_seed implementation
* frame-support: annotate randomness trait with block number
* pallet-randomness-collective-flip: fix for new randomness trait
* pallet-society: fix randomness usage
* pallet-lottery: fix randomness usage
* pallet-contracts: fix randomness usage
* pallet-babe: fix randomness usage
we need to track when the current and previous epoch started so that we
know the block number by each existing on-chain was known
* node: fix random_seed
* node-template: fix random_seed
* frame-support: extend docs
* babe: add test for epoch starting block number tracking
* babe: fix epoch randomness docs
* frame: add todos for dealing with randomness api changes
Co-authored-by: André Silva <andrerfosilva@gmail.com>
* Add MMR custom RPC.
* Change RuntimeApi to avoid hardcoding leaf type.
* Properly implement the new RuntimeAPI and wire up RPC.
* Extract Offchain DB as separate execution extension.
* Enable offchain DB access for offchain calls.
* Fix offchain_election tests.
* Skip block initialisation for proof generation.
* Fix integration test setup.
* Fix offchain tests. Not sure how I missed them earlier 🤷.
* Fix long line.
* One more test missing.
* Update mock for multi-phase.
* Address review grumbbles.
* Address review grumbles.
* Fix line width of a comment
* Make changes
* Add serialize/deserialize, copy babe epoch config defaults from node runtime
* Fix line widths and turn default features off for serde
* Remove ser/deser from Epoch, fix node-cli
* Apply suggestions
* Add comment to BABE_GENESIS_EPOCH_CONFIG in bin
* Apply suggestions
* Add a sketchy migration function
* Add a migration test
* Check for PendingEpochConfigChange as well
* Make epoch_config in node-cli
* Move updating EpochConfig out of the if
* Fix executor tests
* Calculate weight for add_epoch_configurations
* Fix babe test
* Apply suggestions from code review
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Add more asserts to tests, remove unused changes to primitives/slots
* Allow setting the migration pallet prefix
* Rename to BabePalletPrefix
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Introduce new concept of "slot portion for proposing"
Currently when building a block we actually give the proposer all of the
time in the slot, while this is wrong. The slot is actually split in at
least two phases proposing and propagation or in the polkadot case into
three phases validating pov's, proposing and propagation. As we don't
want to bring that much polkadot concepts into Substrate, we only
support splitting the slot into proposing and propagation. The portion
can now be passed as parameter to AuRa and BABE to configure this value.
However, this slot portion for propagation doesn't mean that the
proposer can not go over this limit. When we miss slots we still apply
the lenience factor to increase the proposing time, so that we have
enough time to build a heavy block.
Besides all what was said above, this is especially required for
parachains. Parachains have a much more constraint proposing window.
Currently the slot duration is at minimum 12 seconds, but we only have
around 500ms for proposing. So, this slot portion for proposing is
really required to make it working without hacks.
* Offgit feedback
* Cast cast cast
Currently we wrap every `GenesisConfig` field in an `Option`, while
we require `Default` being implemented for all pallet genesisconfigs.
Passing `None` also results in the genesis not being initialized, which
is a bug as seen from the perspective of a pallet developer?
This pr changes the fields of the `GenesisConfig` to non `Option` types.
* AuRa improvements
Hot and fresh AuRa improvements. This pr does the following:
- Move code belonging to the import queue etc to import_queue.rs
- Introduce `ImportQueueParams` and `StartAuraParams` structs to make
it more easier to understand what parameters we pass to AuRa.
- Introduce `CheckForEquivocation` to tell AuRa if it should check for
equivocation on block import. This is required for parachains, because
they are allowed to equivocate when they build two blocks for the same
slot, but for different relay chain parents.
* Update client/consensus/aura/src/import_queue.rs
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Fix compilation
* AAA
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Init `RuntimeLogger` automatically for each runtime api call
This pr change the runtime api in such a way to always and automatically
enable the `RuntimeLogger`. This enables the user to use `log` or
`tracing` from inside the runtime to create log messages. As logging
introduces some extra code and especially increases the size of the wasm
blob. It is advised to disable all logging completely with
`sp-api/disable-logging` when doing the wasm builds for the on-chain
wasm runtime.
Besides these changes, the pr also brings most of the logging found in
frame to the same format "runtime::*".
* Update frame/im-online/src/lib.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
* Update test-utils/runtime/Cargo.toml
* Fix test
* Don't use tracing in the runtime, as we don't support it :D
* Fixes
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
* A clean new attempt
* Checkpoint to move remote.
* A lot of dependency wiring to make it feature gated.
* bad macro, bad macro.
* Undo the DB mess.
* Update frame/support/src/traits.rs
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Apply suggestions from code review
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* unbreak the build
* Better logging and ids for migrations
* Fix doc.
* Test
* Update frame/try-runtime/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update utils/frame/try-runtime/cli/Cargo.toml
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Update frame/try-runtime/Cargo.toml
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Address most review grumbles.
* Fix build
* Add some comments
* Remove allowing one pallet at a time.
* Rework the PR
* nit
* Slightly better error handling.
* Remove files
* Update utils/frame/remote-externalities/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update frame/support/src/dispatch.rs
* Update frame/support/src/dispatch.rs
* Fix test
* Make extension trait.
* Bring back try-runtime/std
* remove bincode
* Remove warning
* Change test features
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* contracts: Update README
* contracts: Add CHANGELOG.md
* contracts: Bump version to v3.0.0 and allow publish
* Typos
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Improve wording in the changelog
* contracts: Add reserved field to ContractInfoOf for future proofing
* also bump frame-benchmarking
* update lockfile
Co-authored-by: Andrew Jones <ascjones@gmail.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
* contracts: Convert to framev2
* Reduce the API surface of the crate
* Remove unused import
* Merge import block
* Use pallet::metadata to reduce metadata diff
* Remove the explicit "Null" from AccountCounter
* contracts: Consider contract size in weights
* Bump spec version
* Whitespace fix
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
* Correct pre-charged code weight even in the error case
* Use the instrumented code size in weight calculation
* Charge the cost of re-instrumentation from the gas meter
* Fix benchmark
* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Better documentation of return types
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
* Ensure we spawn the block import worker as an essential task
This pr ensures that we spawn the block import worker as an essential
task. This is quite important as we need to bring down the node when the
block import is done. Besides that it adds some debug output to the
block import worker.
* Don't be stupid :D
* A clean new attempt
* Checkpoint to move remote.
* A lot of dependency wiring to make it feature gated.
* bad macro, bad macro.
* Undo the DB mess.
* Update frame/support/src/traits.rs
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Apply suggestions from code review
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* unbreak the build
* Update frame/try-runtime/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update utils/frame/try-runtime/cli/Cargo.toml
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Update frame/try-runtime/Cargo.toml
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Address most review grumbles.
* Fix build
* Add some comments
* Remove allowing one pallet at a time.
* More grumbles.
* relocate remote-ext
* Fix build
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Fix tracing tests (#8022)
* Fix tracing tests
The tests were not working properly.
1. Some test was setting a global subscriber, this could lead to racy
conditions with other tests.
2. A logging test called `process::exit` which is completly wrong.
* Update client/tracing/src/lib.rs
Co-authored-by: David <dvdplm@gmail.com>
* Review comments
Co-authored-by: David <dvdplm@gmail.com>
* Fix tracing spans are not being forwarded to spawned task (#8009)
* Fix tracing spans are not being forwarded to spawned task
There is a bug that tracing spans are not forwarded to spawned task. The
problem was that only the telemetry span was forwarded. The solution to
this is to use the tracing provided `in_current_span` to capture the
current active span and pass the telemetry span explictely. We will now
always enter the span when the future is polled. This is essentially the
same strategy as tracing is doing with its `Instrumented`, but now
extended for our use case with having multiple spans active.
* More tests
* Proper test for telemetry and prefix span
* WIP
* Fix test (need to create & enter the span at the same time)
* WIP
* Remove telemtry_span from sc_service config
* CLEANUP
* Update comment
* Incorrect indent
* More meaningful name
* Dedent
* Naming XD
* Attempt to make a more complete test
* lint
* Missing licenses
* Remove user data
* CLEANUP
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* CLEANUP
* Apply suggestion
* Update bin/node/cli/tests/telemetry.rs
Co-authored-by: David <dvdplm@gmail.com>
* Wrapping lines
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: David <dvdplm@gmail.com>