* Add pallet dex
* Fmt
* Add RPC endpoint
* Fix RPC
* Fix the build
* Some more fixes
* Add a method to topup pallet's account
* Add support for multi-currency into Uniques
* Fix the build
* Add [transactional] + setup() + fix balances
* Improve tests
* Fix price quotation
* Code clean up
* Validate swaps
* Fmt
* Update README
* add test
* mint LP assets in a different instance
* remove transactional as now the default
AssetsLocal renamed to Assets
* merge master
* Revert "Merge master"
* fix tests post merge.
* attempt to set create origin
* Internally allocate lp asset id.
* Simplify
* Bump to be in line
* additional bumps to make compile
* fix compile
* less bounds
* use fungible crates
* multiasset enum
* only allow native currency pairs
* added slippage tests
* transfer into separate method
(Also fee not set in 2 places now.)
Added test where lp and user are different users.
* Add benchmarks + weights
* Typos
* Clean up
* More tests,
split error into two because it wasn't clear which parameter.
renamed liquidity to lp_tokens_minted or lp_tokens_burned in events.
* tighten up naming
* Default, zero, square root traits not needed
Also let's not force people to be compact
* add keep-alive param
* add insufficient liquidity test
* Fix quote() to support u64
* Avoid recording balances twice
* cargo fmt
* Didn't mean to change error type
* temp
* Less
* Rework get_amount_in/get_amount_out
* Convert other places
* Rework the last piece
* Typo
* Fix benchmarks
* use hash trait
* Extract a native asset check into the runtime setting
* Don't set the metadata
* Remove spec file
* Enable multi-assets swaps by default
* Refactor conversion into u128
* Add path param to swap_token_for_exact_tokens
* Fix typo + a bit of refactoring
* Implement path param for swap_exact_tokens_for_tokens()
* Deref
* Minor fixes
* Add test with sensible scale values
* Use .windows()
* Fix benchmarks
* update docs
* Fix everything :)
* Chore
* Revert
* Chore
* prev way of creating sub accounts lead to collisions
* Update frame/dex/src/lib.rs
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
* Update frame/dex/src/lib.rs
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
* Chore
* Fmt fix on Uniques
* add call_index
bring code up to date with latest master
* revert readme changes
* add cr
* revert uniques changes
* reducing noise
* no need for deadline (#12990)
(there's generic transaction deadline functionality already)
* fix kitchen sink (#12991)
* fix kitchen sink
* Only the dex can mint lp_tokens
* add BenchmarkHelper for second instance (#12998)
* update mock to latest master
* less indirections (#13012)
* remove dex PR's custom RPC (#13050)
* As we have state_call we don't need a custom RPC
* fix docs
* no longer a need to upgrade rpc version (#13053)
* add CallbackHadle
* quote bugfix (#13191)
quote was giving same price in both directions as we were inverting needlessly.
* merging in dex specific changes due to pay by dex
* update lock file
* merging in kitchen sink changes
* Add get_reserves() api method
* Partial updating of the benchmarks
* Fix tests
* clippy
* Temp fix weights
* Fix benchmarks
* Add pool setup fee
* Money upfront
* Address some comments
* Use u128 in mock
* Fix benchmarks
* Change error message
* Update comments
* Change error names
* Implement PartialOrd for NativeOrAssetId
* add note
* Update errors
* More tests for assets sorting
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_dex
* Change the way we generate pool accounts
* Improve the liquidity removal method
* Extract MintMinLiquidity to config, rework all tests
* Add comments
* Validate provided amount
* Rename to asset-conversion
* Validate ED
* Improve handling the ED related errors
* typos
* Try to fix benchmarks
* Another try
* Another day, another try
* Fix benchmarks
* Expose fee related params
* Validate token's minimal amount the same way as ED
* fix typo
* Use longer path for swaps in benchmarks
* need to ref sp_std's vec.
* Remove From<u32> requirement when benchmarking
* impl BenchmarkHelper for ()
* only for runtime benchmarks
* MultiLocation: !MaybeDisplay
Looks like we might not need this bound from initial testing.
* Update frame/asset-conversion/src/lib.rs
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
* Update frame/asset-conversion/src/lib.rs
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
* Add documentation links
* add collision test
* Revert "[Enhancement] Throw an error when there are too many pallets (#13763)"
This reverts commit cc3152bc2f.
* [Enhancement] Throw an error when there are too many pallets (#13763)
* [Enhancement] Throw an error when there are too many pallets
* fix ui test
* fix PR comments
* Update frame/support/procedural/src/construct_runtime/mod.rs
Co-authored-by: Bastian Köcher <git@kchr.de>
* Update frame/support/procedural/src/construct_runtime/mod.rs
Co-authored-by: Bastian Köcher <git@kchr.de>
* ".git/.scripts/commands/fmt/fmt.sh"
---------
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>
* add benchmark helper
+ doc fix
* cargo fmt
* Fix adding liquidity to non-empty pool
* Fix compilation error
* Fix params ordering issue
* additional docs
* The swap path elements should be unique
* Fix account collision
* Validate all the pool in a swap path are unique
* Change the way we add liquidity to empty pools
* Improve docs
* remove unnessisary Display impl
* cargo fmt
* remove unused imports
* Make api consistent
* Chore
* Touch the pool account so it could hold the pair tokens
* Check the balance before touching the pool's account
* Introduce liquidity provision fee
* Touch the pool acc one more time
* Apply suggestions from code review
Co-authored-by: Sam Johnson <sam@durosoft.com>
* Update frame/asset-conversion/README.md
Co-authored-by: Sam Johnson <sam@durosoft.com>
* Use ContainsPair instead of the balance checker
* Remove old Currency trait
* Add liquidity withdrawal fee
* Update docs
* Use 0 withdrawal fee in mock
* Rename vars
* asset id not clone
* fix: shadow var was being used
* correct tests
* fix benches
* merge master
* neater
---------
Co-authored-by: Jegor Sidorenko <jegor@parity.io>
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
Co-authored-by: parity-processbot <>
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Sam Johnson <sam@durosoft.com>
* HoldReason: Improve usage
`HoldReason` was switched recently to use the `composite_enum` attribute that will merge the enums
from all pallets in the runtime to `RuntimeHoldReason`. `pallet-nis` was still requiring that the
variant was passed as constant to call `hold`. The proper implementation is to use the `HoldReason`
from inside the pallet directly when calling `hold`. This is done by adding a `RuntimeHoldReason` as
type to the `Config` trait and requiring that `Currency` is using the same reason. Besides that the
pr changes the name `HoldIdentifier` in `pallet_balances::Config` to `RuntimeHoldReason`.
* Update frame/nis/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Review comment
* Fixes
---------
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Prepare `sc-network` for `ProtocolController`/`NotificationService`
The upcoming notification protocol refactoring requires that protocols
are able to communicate with `sc-network` over unique and direct links.
This means that `sc-network` side of the link has to be created before
`sc-network` is initialized and that it is allowed to consume the object
as the receiver half of the link may not implement `Clone`.
Remove request-response and notification protocols from `NetworkConfiguration`
and create a new object that contains the configurations of these protocols
and which is consumable by `sc-network`. This is needed needed because, e.g.,
the receiver half of `NotificationService` is not clonable so `sc-network`
must consume it when it's initializing the protocols in `Notifications`.
Similar principe applies to `PeerStore`/`ProtocolController`: as per current
design, protocols are created before the network so `Protocol` cannot be
the one creating the `PeerStore` object. `FullNetworkConfiguration` will be
used to store the objects that `sc-network` will use to communicate with
protocols and it will also allow protocols to allocate handles so they
can directly communicate with `sc-network`.
* Fixes
* Update client/service/src/builder.rs
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
* Updates
* Doc updates + cargo-fmt
---------
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
* contracts: add events to ContractResult
* contracts: add encoded events to ContractResult
* contracts: add generic Event to ContractResult
* contracts: test bare_call events
* contracts: update bare_call test name
* contracts: add better comments to dry run events
* contracts: fix pallet contracts primitives implementation
* contracts: add EventRecord generic to ContractInstantiateResult
* contracts: make event collection optional
* contracts: impreved notes on `collect_events`
* contracts: update benchmarking calls
* contracts: change bare_call and bare_instantiate to accept enums instead of bools
* contracts: add partial eq to new enums
* contracts: improve comments
* contracts: improve comments
* contracts: fix bare_call benchmarking
* contracts: fix bare call and instantiate in impl_runtime_apis
* contracts: add api versioning to new ContractsApi functions
* contracts: modify api versioning to new ContractsApi functions
* contracts: create new contracts api trait
* contracts: clean up code
* contracts: remove the contract results with events
* contracts: undo contracts api v3
* contracts: remove commented out code
* contracts: add new test bare call result does not return events
* contracts: add code review improvements
* contracts: remove type imports
* contracts: minor code review improvements
* added [unstable][seal2] call()
* updated test to cover new seal_call proof_limit
* docs updated
* add [seal2][unstable] instantiate() and test
* add [seal2][unstable] weight_to_fee() + docs and test
* add [seal2][unstable] gas_left() + docs and test
* update benchmarks
* add DefaultDepositLimit to pallet Config
* specify deposit limit for nested call
add test for nested call deposit limit
save: separate deposit limit for nested calls
* specify deposit limit for nested instantiate
save: works with test
cleaned up debugging outputs
* update benchmarks
* added missing fixtures
* fix benches
* pass explicit deposit limit to storage bench
* explicit deposit limit for another set_storage bench
* add more deposit limit for storage benches
* moving to simplified benchmarks
* moved to simplified benchmarks
* fix seal_weight_to_fee bench
* fix seal_instantiate benchmark
* doc typo fix
* default dl for benchmarking
more dl for tests
dl for tests to max
deposit_limit fix in instantiate bench
fix instantiate bench
fix instantiate benchmark
fix instantiate bench again
remove dbg
fix seal bench again
fixing it still
seal_instantiate zero deposit
less runs to check if deposit enough
try
try 2
try 3
try 4
* max_runtime_mem to Schedule limits
* add default deposit limit fallback check to test
* weight params renaming
* fmt
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com>
* prettify inputs in tests
* typestate param refactored
---------
Co-authored-by: PG Herveou <pgherveou@gmail.com>
* globally upgrade quote to latest 1.0.x (1.0.26)
* globally upgrade syn to final 1.0.x version (1.0.109)
* globally upgrade proc-macro2 to 1.0.56
* upgrade to syn v2.0.13 and fix everything except NestedMeta
* fix parse nested metadata code in decl_runtime_apis.rs
* Port more stuff to syn 2.0
* Make the rest compile
* Ignore error
* update to syn 2.0.14
---------
Co-authored-by: Bastian Köcher <info@kchr.de>
* Introduce keystore specialized sign methods
* Get rid of 'AppKey::UntypedGeneric' associated type.
Untyped generics are accessible using associated types 'Generic' associated type.
I.e. <T as AppKey>::Public::Generic
* Get rid of 'CryptoTypePublicPair'
* Trivial fix
* Small refactory of local keystore implementations
* Remove 'crypto_id' method from 'Public'
* Trivial rename of 'AppKey' to 'AppCrypto'
* Remove unused import
* Improve docs
* Better signature related errors for authority-discovery
* Apply review suggestion
* Apply review suggestions
Co-authored-by: Koute <koute@users.noreply.github.com>
* Authority discoverty signing error revisited
* Signing error revisited for babe and aura as well
* Further cleanup
---------
Co-authored-by: Koute <koute@users.noreply.github.com>
* Try to fix flaky `temp-base-path-work` test
The test is most of the time failing when checking if the database path was deleted. The assumption
is that it takes a little bit more time by the OS to actually clean up the temp path under high
load. The pr tries to fix this by checking multiple times if the path was deleted. Besides that it
also ensures that the tests that require the benchmark feature don't fail when compiled without the feature.
* ".git/.scripts/commands/fmt/fmt.sh"
* Capture signals earlier
* Rewrite tests to let them having one big timeout
* Remove unneeded dep
* Update bin/node/cli/tests/common.rs
Co-authored-by: Koute <koute@users.noreply.github.com>
* Review feedback
* Update bin/node/cli/tests/common.rs
Co-authored-by: Anton <anton.kalyaev@gmail.com>
---------
Co-authored-by: command-bot <>
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
* impl_runtime_apis: Generate getters for `metadata_at` functions
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* runtime: Implement new `Metadata` runtime trait
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* runtime: Move `metadata_at` functions to construct_runtime macro
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* contruct_runtime: Use `OpaqueMetadata` from hidden imports
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Adjust testing
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/tests: Add tests for the new API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/tests: Adjust metdata naming
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Expose `metadata-v14` feature flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Expose metadata only under feature flags
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Expose v14 metadata by default
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Expose metadata feature for testing
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Test metadata under different feature flags
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update primitives/api/src/lib.rs
Co-authored-by: Bastian Köcher <git@kchr.de>
* Update primitives/api/src/lib.rs
Co-authored-by: Bastian Köcher <git@kchr.de>
* client/tests: Adjust testing to reflect trait Metadata change
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/metadata-ir: Add intermediate representation types for metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/metadata-ir: Convert metadata to V14
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/metadata-ir: Add API to convert metadata to multiple versions
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/metadata-ir: Expose V14 under feature flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Adjust to metadata IR
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: More adjustments
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Guard v14 details under feature flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Adjust testing
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* CI: Ensure `quick-benchmarks` uses `metadata-v14`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Use `metadata-v14` for benchmarks
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Adjust cargo fmt
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* kitchensink-runtime: Add feature flag for `metadata-v14`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support/test: Adjust testing
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support/test: Check crates locally
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Activate metadata-v14 for pallets
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Remove metadata-v14 feature flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/metadata_ir: Move `api.rs` to `mod.rs`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Handle latest metadata conversion via IR
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/tests: Add constant for metadata version 14
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support/test: Fix merge conflict
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update frame/support/Cargo.toml
Co-authored-by: Bastian Köcher <git@kchr.de>
* Update frame/support/src/metadata_ir/mod.rs
Co-authored-by: Bastian Köcher <git@kchr.de>
* Update frame/support/test/Cargo.toml
Co-authored-by: Bastian Köcher <git@kchr.de>
* Update primitives/api/src/lib.rs
Co-authored-by: Bastian Köcher <git@kchr.de>
* frame/metadata: Collect pallet documentation for MetadataIR
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/tests: Check pallet documentation is propagated to MetadataIR
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* frame/support: Improve documentation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <git@kchr.de>
* frame epm: expose feasibity_check in miner
The goal with this commit is to expose the `feasibity_check` such
that anyone that implements the `MinerConfig trait` can utilize it
* cleanup
* fix tests
* Move service tests to `client/network/tests`
These tests depend on `sc-network` and `sc-network-sync` so they should
live outside the crate.
* Move some configs from `sc-network-common` to `sc-network`
* Move `NetworkService` traits to `sc-network`
* Move request-responses to `sc-network`
* Remove more stuff
* Remove rest of configs from `sc-network-common` to `sc-network`
* Remove more stuff
* Fix warnings
* Update client/network/src/request_responses.rs
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
* Fix cargo doc
---------
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
* Experiments with common equivocation trait
* Improved equivocation trait
* Fix grandpa equivocation implementation
* Remove some cruft
* Remove some more cruft
* More generic naming
* Simplification of offences manipilation
* More refactory
* Some prograss with the encapsulation of offence report system
* Finally unit type works as a universal null report system
* Align substrate node code
* Further simplification
* Fix test utils
* Remove not required associated type
* Fix benches
* Rollback to prev field name
* Box big params
* Fix typo
* Remove new tag computation
* Remove default implementations
* Better docs
* Return 'Result' instead of bool
* Change offence report system return types
* Some renaming and documentation
* Improve documentation
* More abstract offence report system
* Rename 'consume_evidence' to 'process_evidence'
* Further docs refinements
* Doc for dummy offence report
* Fix rustdoc
* Fix after master merge
* Apply code review suggestions
* Improve docs