Oliver Tale-Yazdi
b932e27e5b
Fix reentrancy of FrozenBalance::died hook ( #10473 )
...
* assets: execute `died` hook outside of mutate
Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo >
* assets: extend tests for `died` hook
Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo >
* assets: update doc of FrozenBalance::died
Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo >
* assets: review fixes
- fix cases where `died` should not have been called
- use `Option<DeadConsequence>` instead of `DeadConsequence`
Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo >
* assets: update comment in mock.rs
Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo >
* assets: return `Remove` in dead_account
The return value is ignored in the only case that it is produced
by a call, but having it this way makes it more understandable.
Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo >
2022-02-11 13:17:38 +00:00
girazoki
074ff19dbc
maybe_total_supply in pallet-assets ( #10799 )
...
* maybe_total_supply in pallet-assets
* Update frame/assets/src/functions.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2022-02-05 11:06:44 +00:00
Alexander Theißen
f3168c3fa0
Add production profile to substrate-wasm-builder ( #10747 )
...
* Add production profile to wasm builder
* Fix profile detection
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Replace panic! by println! + exit
* Default to `release` for wasm on debug builds
* Replaced unwrap by expect
* Update all weights
Rerun on the bm2 server.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* cargo run --quiet --profile=production --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
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Parity Bot <admin@parity.io >
2022-01-31 14:16:26 +00:00
Oliver Tale-Yazdi
9daea28085
Optimized weights ( #10692 )
...
* Add optimization flags to 'release' profile
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Optimized weights
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Add missing pallets
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Add `production` profile
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* pallet-collective: fix tests
the weight of System.remark went to 0, the collective test uses a
remark call to trigger an out-of-gas condition so I replaced it
with a `remark_with_event` call.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
2022-01-24 12:35:25 +00:00
Oliver Tale-Yazdi
362a6d9b28
Require MaxEncodedLen per default ( #10662 )
...
* Remove generate_storage_info
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Add without_storage_info where needed
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update doc tests
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Add more without_storage_info
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* fix TryBuild
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* fix TryBuild tests
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
2022-01-20 11:16:04 +00:00
Bastian Köcher
f3662b4bba
Happy new year 2022 ( #10573 )
2022-01-03 09:22:14 +01:00
Gavin Wood
7ee25416c2
Fix update_lock ( #10485 )
...
* Fix update_lock
* Fixes
* Formatting
* add `inc_consumers_without_limits` to session too
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2021-12-15 01:27:13 +01:00
Gavin Wood
3dd8f83a3a
Insufficient asset quota and deposits ( #10382 )
...
* Allow asset accounts to exist by deposit
* Place limit on consumers (and therefore freebie asset accounts)
* Maximum number of assets
* Fixes
* Fixes
* Formatting
* Docs
* Formatting
* Destroyed assets are properly tidied
* Update frame/assets/src/types.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Docs
* Docs
* Formatting
* Docs
* Docs
* Fixes
* Fixes
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
2021-12-09 13:22:54 +01:00
Guillaume Thiolliere
7f6f3322ad
improve doc ( #10431 )
2021-12-09 06:31:31 +00:00
Qinxuan Chen
69478639b3
Migrate all doc to new pallet macro ( #10187 )
...
* Migrate all doc to new pallet macro
Signed-off-by: koushiro <koushiro.cqx@gmail.com >
* Fix indent
Signed-off-by: koushiro <koushiro.cqx@gmail.com >
* Fix format
Signed-off-by: koushiro <koushiro.cqx@gmail.com >
2021-11-18 22:08:17 +00:00
David Salami
120894fdb7
Add field names to pallet Event variants ( #9993 )
...
* convert pallet-assets events to struct types
* updated events of a couple pallets
* updated pallet event field names
* update pallet event field names
* updated events in test files
* cargo fmt
* minorfixes
* fix assertion error
* minor fix
* formatting fix
* fmt
2021-11-16 01:56:00 +00:00
Qinxuan Chen
5d5e685ebe
frame_support::pallet_prelude: Add scale_info::TypeInfo ( #10221 )
...
Signed-off-by: koushiro <koushiro.cqx@gmail.com >
2021-11-09 12:59:55 +01:00
Kian Paimani
937b6f246e
put TryInto and TryFrom in sp_std::prelude ( #10183 )
...
* Switch to Rust 2021
* Update trybuild to fix errors
* half baked
* fix
* remove unused import
* remove more warnings
Co-authored-by: Bastian Köcher <info@kchr.de >
2021-11-08 00:24:53 +01:00
Cheng JIANG
0b0c41b5f4
add TypeInfo trait bound ( #10031 )
2021-10-15 12:22:51 +02:00
girazoki
48a524c565
Add low level traits to retrieve name, symbol, decimals and allowance in pallet-assets ( #9757 )
...
* Add ERC20 compatible trait to retrieve name, symbol, decimals and allowance
* delegate instead of spender
* Remove erc20 trait and divide it into lower level traits
* add import
* approvals and metadata depend on fungibles
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2021-10-07 14:29:48 +00:00
ucover
f8ce186496
Test each benchmark case in own #[test] ( #9860 )
...
* Generate one #[test] fn per bench case.
* Update benchmark macro syntax in frame pallets.
* Explain new benchmark macro syntax in example pallet.
* support with and without a semicolon
* update pallets to use individual tests
* migrate staking too
* migrate more pallets
* fix up democracy and use individual tests
* Fix comment
* Put println message in panic
* Remove `another_set_dummy` from doc
`another_set_dummy` is not present in the benchmarking.rs (anymore).
* Update doc for benchmarks macro
* Update doc for impl_benchmark_test_suite macro
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2021-10-01 08:17:26 +00:00
Shawn Tabrizi
54617ef661
Simple Trait to Inspect Metadata ( #9893 )
...
* simple trait to inspect metadata
* import vec
2021-09-30 16:46:48 +00:00
Vincent Geddes
653f299b95
Pallet Assets: Create new asset classes from genesis config ( #9742 )
...
* Pallet Assets: Allow creating asset classes from genesis config
* Add accounts and metadata to genesis config
* whitespace fixes
* Update more chainspecs
* Run rustfmt over code
* More formatting fixes
* Update frame/assets/src/lib.rs
Improve error message
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* Update frame/assets/src/lib.rs
Improve error message
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2021-09-30 16:32:29 +00:00
Shawn Tabrizi
f8a228859e
Fungibles and Non-Fungibles Create and Destroy Traits + Assets and Uniques Implementation ( #9844 )
...
* refactor `do_destroy`
* destroy trait
* refactor do_force_create
* impl create trait
* do not bleed weight into api
* Do the same for uniques
* add docs
2021-09-26 22:05:01 +00:00
Andrew Jones
49b6dfd2e5
Enrich metadata with type information ( #8615 )
...
* Cargo.lock after merge
* Restore scale-info feature
* Fully qualify TypeInfo derive
* Skip PendingSwap T
* Add missing skip_type_params attr
* metadata docs features
* Reduce pallet event attribute to struct
* Cargo.lock
* Update frame/balances/src/tests_composite.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Line widths check
* Cargo.lock
* Add scale-info/std
* Update frame/system/src/lib.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Use `skip_type_params` to remove `TypeInfo` requirements on checks
* Revert "Remove unused Call metadata stuff"
This reverts commit 41311f85
* Skip BalanceSwapAction type parameter
* Remove unused event metadata macro
* Update frame-metadata
* Update primitives/npos-elections/compact/src/codec.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Manual TypeInfo for Header
* Remove TypeInfo requirement for consts in BoundedVec etc.
* Another TypeInfo bound removed
* review: fix indentation
* TypeInfo impls for Identity types
* Add some todos to add custom TypeInfo impls
* Update frame/support/procedural/src/pallet/expand/pallet_struct.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Add some todos to add custom TypeInfo impls
* Add a test for manual Data TypeInfo impl
* Add custom TypeInfo impl for Vote
* Era custom TypeInfo crimes
* Revert finality-grandpa version to 0.14.z
* review: renamed module to pallet_constants_metadata
* New line at end of file
* Add missing scale-info/std
* Update frame/support/src/storage/types/mod.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Remove StorageEntryType::Map unused flag
* Add missing scale-info dependency after merge
* SignedExtension::AdditionalSigned metadata
* Update frame-metadata, use abbreviated docs and args fields
* Update frame/example/Cargo.toml
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* Add scale_info/std and remove unused scale-info dependency
* Remove scale-info dependency
* Remove treasury pallet::metadata
* Remove redundant Event test
* Add back scale-info as dev dependency
* fix error metadata when no error defined in decl_module
* Add Module3 to tests
* Fix metadata test
* Add docs feature to frame-support test
* WIP fixing pallet metadata test
* Remove redundant FunctionMetadata, FunctionArgumentMetadata as per https://github.com/paritytech/frame-metadata/pull/20
* Use main branch of frame-metadata
* Use patch of scale-info for latest changes
* Use latest patched scale-info
* Manual TypeInfo for DigestItem
* Manual TypeInfo for DigestItem
* Update scale-info
* Skip __Ignore variants for Error, depends on https://github.com/paritytech/scale-info/pull/117
* Named fields for FRAME v2 pallet Call variants
* Named fields for FRAME v1 pallet Call variants
* Add missing scale-info dependency
* WIP expand benchmark call variant
* fix benchmark with new function
create a new function for each variant of a pallet call.
This function is called by benchmarking macro in order not to break call
creation with unnamed argument
* fix tests
* more fix
* Fix staking tests
* Fix offchain workers calls
* Cherry pick rustfmt.toml from master
* cargo +nightly-2021-06-22 fmt --all
* Update to new call variant structs
* More call variant struct updates
* Remove unused import
* More call variant structs
* More call variant structs
* Even more call variant structs
* Mooar variant structs
* Evermore variant structs
* Call variant structs ad infinitum
* Fmt
* More call variants
* Last call variant
* Call variants all done?
* Fix SS58Prefix type
* Potential workaround for BitFlags<IdentityFields> TypeInfo
* Enable docs capturing for Call, Event, and Error types
* Fix IdentityFields TypeInfo
* Remove metadata-docs feature
* Add capture_docs = true for legacy Call, Event and Error types
* Fmt
* Fix metadata test type
* Update benchmarks with call struct variants
* Fmt
* More test fixes
* Fmt
* Fix benches
* Use latest capture_docs attr
* Latest scale_info
* Fmt
* review: change &Vec to &[]
* Remove pallet metadata attr
* review: remove commented out test code
* review: skip_type_params trailing comma suggestion
* Update to scale-info 0.10.0
* Update construct_runtime ui tests, different because of metadata TypeInfo impls
* Add some TypeInfo derives for UI tests
* Update storage ensure span ui stderrs
* Update call argument bound ui tests
Possibly changed because change from tuple to struct variants?
* Add scale-info dev dependency
* Update to latest finality-grandpa release
* review: missing newline
* review: missing scale-info/std
* review: remove duplicate scale-info/std
* review: remove fully qualified TypeInfo
* review: add missing scale-info/std
* review: remove unnecessary imports.
* Fmt
* Use crates.io RC version of frame-metadata
* Remove scale-info/std because it is a dev dependency
* Add missing scale_info dev-dependency for test
* Delete empty metadata folder
* Fix sp_std import
* review: improve manual UncheckedExtrinsic TypeInfo impl
* review: use full scale-info for dev-dependency
* Remove DefaultByteGetter impl
* review: derive TypeInfo for generic header
* Fmt
* Update primitives/runtime/src/generic/unchecked_extrinsic.rs
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* Update primitives/runtime/src/generic/unchecked_extrinsic.rs
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* Update bin/node/executor/Cargo.toml
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/identity/src/types.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/support/src/dispatch.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Remove redundant derive
* Simplify scale-info dependency
* Strip underscore prefix from call variant struct names
* Another underscore field
* More underscore fields
* Another underscore field
* Update to frame-metadata 14.0.0-rc.2 with combined StorageEntryType::Map
* Fmt
* Revert weights formatting
* Fix up some tests
* Fix up some tests for StorageEntryTypeMetadata
* scale-info dev dependency
* Fix test error
* Add missing TypeInfo derives
* Add back missing scale-info dependency
* Add back missing scale-info dependency
* Fix npos compact impls
* Cargo.lock
* Fmt
* Fix errors
* Fmt
* Fix renamed raw_solution field
* Fix error
* Fmt
* Fix some benchmarks
* Fmt
* Stray R
* Fix
* Add missing TypeInfos
* ui test fix
* Fix line widths
* Revert "ui test fix"
This reverts commit 2d15ec058a216e3f92d713f1174603a2bb1eac65.
* Upgrade to scale-info 0.11.0
* Revert "Upgrade to scale-info 0.11.0"
This reverts commit 047bb179085a0059c36cd20ab405f55cf0867e28.
* Add Runtime type
* Update to scale-info 0.12
* Update to scale-info 1.0
* Update frame-metadata to version 14.0.0
* Patch finality-grandpa until release available
* Fix metadata tests
* Fix metadata tests
* Fmt
* Remove patched finality-grandpa
* Fix tests, use scale_info imports
* Fix pallet tests
* Add BlockNumber TypeInfo bound
* ui test fix
* Cargo.lock
* Remove pallet metadata
* Cargo.lock
* Add missing scale-info dependency
* Remove pallet event metadata
* Fix error
* Fix collective errors
* Semicolol
* Fmt
* Remove another metadata attribute
* Add new variant to custom digest TypeInfo
* Fmt
* Cargo.lock from master
* Remove comma lol
* Fix example call error
* Fix example call error properly
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2021-09-15 11:40:41 +00:00
Kian Paimani
abd08e29ce
Rewrap all comments to 100 line width ( #9490 )
...
* reformat everything again
* manual formatting
* last manual fix
* Fix build
2021-08-11 14:56:55 +00:00
Gavin Wood
bdda3ed612
Remove Filter and use Contains instead ( #9514 )
...
* Remove Filter and use Contains instead
* Fixes
* Formatting
* Update docs/Upgrading-2.0-to-3.0.md
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Typo
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2021-08-07 19:26:40 +00:00
Shawn Tabrizi
0489c1768c
FRAME Weights with Storage Metadata ( #9471 )
...
* weights with metadata
* fix
* fix contract test
* skip metadata tag
* special handling for `frame_system`
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=frame_system --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/system/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* add skip metadata to contracts
* cargo run --quiet --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
* fix contract test
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_democracy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/democracy/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_bounties --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/bounties/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* expose component information
* fix test generation
* refactor list benchmarks
* move component selection out of runtime
* add benchmark verification
* missing feature
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_bounties --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/bounties/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_democracy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/democracy/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* add internal repeats
* update weights with internal repeats
* fix warning
* return error with pov
* try without tracking
* Revert "return error with pov"
This reverts commit 44c36cbbd3c6818f36f377e3e291f1df156e40f7.
* Revert "try without tracking"
This reverts commit f401c44aebff2232389d8d307b20924891e5d77d.
* Revert "Revert "try without tracking""
This reverts commit 4b4e05929802ad3e8154e107359447634e5fb21b.
* state without tracking
* fix build
* temp test
* split db and timing benchmarks
* extend db results?
* default repeat is internal
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_democracy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/democracy/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* fix warning
* bump linked hash map
* use linked hash map for storage tracker
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_democracy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/democracy/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* remove conflicting short command
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_democracy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/democracy/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* missed one linked hashmap
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_bounties --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/bounties/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_bounties --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/bounties/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* cargo run --quiet --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
* new weights with latest changes
* Update frame/benchmarking/src/utils.rs
Co-authored-by: Parity Benchmarking Bot <admin@parity.io >
2021-08-07 16:05:12 +00:00
Bastian Köcher
7b56ab15b4
Run cargo fmt on the whole code base ( #9394 )
...
* Run cargo fmt on the whole code base
* Second run
* Add CI check
* Fix compilation
* More unnecessary braces
* Handle weights
* Use --all
* Use correct attributes...
* Fix UI tests
* AHHHHHHHHH
* 🤦
* Docs
* Fix compilation
* 🤷
* Please stop
* 🤦 x 2
* More
* make rustfmt.toml consistent with polkadot
Co-authored-by: André Silva <andrerfosilva@gmail.com >
2021-07-21 14:32:32 +00:00
Alexander Popiak
f538174847
Balance to Asset Balance Conversion ( #9076 )
...
* add BalanceConversion trait and implementation
* derive some useful traits on Imbalance
* Update frame/support/src/traits/tokens/fungibles/imbalance.rs
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com >
* make BalanceConversion error type configurable
* add RuntimeDebug import and derive traits on other Imbalance
* formatting
* move BalanceConversion trait to frame-support
* add necessary trait import
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com >
2021-07-20 14:55:54 +00:00
Bastian Köcher
2b282a9435
Remove IncRefError, DecRefError and StoredMapError ( #9384 )
...
All of them are a subset of `DispatchError` anyway, no need to have
special errors IMHO.
2021-07-20 10:39:26 +02:00
Falco Hirschenberger
76a289ebd8
Add missing #[pallet::constant] annotations to pallets ( #9367 )
...
fixing #9306
2021-07-18 18:27:39 +00:00
Alexander Theißen
e01ac8cea0
contracts: Allow contracts to dispatch calls into the runtime ( #9276 )
...
* contracts: Allow contracts to dispatch calls into the runtime
* Fix RPC tests
* Fix typo
* Replace () by AllowAllFilter and DenyAllFilter
* Add rust doc
* Fixup for `()` removal
* Fix lowest gas calculation
* Rename AllowAllFilter and DenyAllFilter
* Updated changelog
2021-07-12 20:40:27 +00:00
Shinsaku Ashizawa
e581e6aff3
change reference module to pallet ( #9281 )
...
* change reference module to pallet
* fix inner doc
Co-authored-by: thiolliere <gui.thiolliere@gmail.com >
2021-07-06 13:56:37 +00:00
Squirrel
ea1f21a904
Use MAX associated const ( #9196 )
...
* Use MAX associated const
2021-06-24 11:53:49 +01:00
Shawn Tabrizi
e5831c3db3
New Weights for All Pallets ( #9148 )
...
* Create run_benchmarks.sh
* Update run_benchmarks.sh
* new weights
* Delete run_benchmarks.sh
* wrong folder
* remove grandpa weight
* Update weights.rs
2021-06-21 09:57:43 +00:00
Shawn Tabrizi
517fd6149a
Fixes in Assets Pallet ( #9059 )
...
* upper bound witness with refund
* simple test
* track approvals
* dont allow approvals when asset is frozen
* destroy returns approval deposit
* update `NonTransfer` proxies
* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_assets --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/assets/src/weights.rs --template=./.maintain/frame-weight-template.hbs
Co-authored-by: Parity Bot <admin@parity.io >
2021-06-12 14:59:56 +00:00
Alexander Popiak
5dec6e5c81
make all extrinsics public so they are available from outside ( #9078 )
...
Co-authored-by: thiolliere <gui.thiolliere@gmail.com >
2021-06-12 12:43:08 +02:00
Keith Yeung
828d1d74aa
Use pallet names to name enum variants ( #8990 )
...
* Remove unused event_metadata variable
* Eliminate mod_name and use pallet names to name enum variants
* Rename field name `pallet` to `path`
* Use only the pallet name to generate variant names
* Use new naming scheme for Event enum in sudo pallet tests
* Use new naming scheme for Event enum in offences pallet tests
* Use new naming scheme for Event enum in contracts pallet tests
* Use new naming scheme for Event enum in collective pallet tests
* Use new naming scheme for Event enum in bounties pallet tests
* Use new naming scheme for Event enum in balances pallet tests
* Use new naming scheme for Event enum in assets pallet tests
* Use new naming scheme for Event enum in frame support tests
* Use new naming scheme for Event enum in tips pallet tests
* Use new naming scheme for Event enum in transaction payment pallet tests
* Use new naming scheme for GenesisConfig fields in example pallet tests
* Use new naming scheme for GenesisConfig fields in elections pallet tests
* Use new naming scheme for Event enum in election provider multi-phase pallet tests
* Use new naming scheme for Event enum in elections phragmen pallet tests
* Use new naming scheme for GenesisConfig fields in chain spec
* Use new naming scheme for Event enum in staking pallet mock
* Use new naming scheme for GenesisConfig fields in node-template chain spec
* Use new naming scheme for GenesisConfig fields in node-testing chain spec
* Use new naming scheme for Event enum in node executor tests
* Use new naming scheme for GenesisConfig fields in transaction storage pallet mock
* Refactor match conditions
2021-06-09 09:31:29 +00:00
Xiliang Chen
223529e4dd
Named reserve ( #7778 )
...
* add NamedReservableCurrency
* move currency related trait and types into a new file
* implement NamedReservableCurrency
* remove empty reserves
* Update frame/support/src/traits.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* fix build
* bump year
* add MaxReserves
* repatriate_reserved_named should put reserved fund into named reserved
* add tests
* add some docs
* fix warning
* Update lib.rs
* fix test
* fix test
* fix
* fix
* triggier CI
* Move NamedReservableCurrency.
* Use strongly bounded vec for reserves.
* Fix test.
* remove duplicated file
* trigger CI
* Make `ReserveIdentifier` assosicated type
* add helpers
* make ReserveIdentifier assosicated type
* fix
* update
* trigger CI
* Apply suggestions from code review
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* trigger CI
* Apply suggestions from code review
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Gavin Wood <i@gavwood.com >
Co-authored-by: Shaun Wang <spxwang@gmail.com >
2021-06-04 09:32:46 +02:00
Gavin Wood
e819fd03f9
Uniques: An economically-secure basic-featured NFT pallet ( #8813 )
...
* Uniques: An economically-secure basic-featured NFT pallet
* force_transfer
* freeze/thaw
* team management
* approvals
* Fixes
* force_asset_status
* class_metadata
* instance metadata
* Fixes
* use nmap
* Fixes
* class metadata has information field
* Intiial mock/tests and a fix
* Remove impl_non_fungibles
* Docs
* Update frame/uniques/src/lib.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* Update frame/uniques/src/lib.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* Update frame/uniques/src/lib.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* Update frame/uniques/src/lib.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* Reserve, don't transfer.
* Fixes
* Tests
* Tests
* refresh_deposit
* Tests and proper handling of metdata destruction
* test burn
* Tests
* Update impl_fungibles.rs
* Initial benchmarking
* benchmark
* Fixes
* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Attributes
* Attribute metadata
* Fixes
* Update frame/uniques/README.md
* Docs
* Docs
* Docs
* Simple metadata
* Use BoundedVec
* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Update frame/uniques/src/lib.rs
Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev >
* Update frame/uniques/src/lib.rs
Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev >
* Update frame/uniques/src/lib.rs
Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev >
* Update frame/uniques/src/lib.rs
Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev >
* Update frame/uniques/src/lib.rs
Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev >
* Fixes
* Update frame/uniques/README.md
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io >
* Update frame/uniques/README.md
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io >
* Update frame/uniques/README.md
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io >
* Docs
* Bump
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Parity Bot <admin@parity.io >
Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev >
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io >
2021-06-01 18:03:13 +02:00
joe petrowski
32b793657a
remove duplicate Issued/Burned events ( #8935 )
2021-05-28 19:22:49 +00:00
Shawn Tabrizi
444d4e204c
Simple MaxBoundedLen Implementations ( #8793 )
...
* implement max_values + storages info
* some formatting + doc
* sudo sanity check
* timestamp
* assets (not working)
* fix assets
* impl for proxy
* update balances
* rename StoragesInfo -> PalletStorageInfo
* merge both StorageInfoTrait and PalletStorageInfo
I think it is more future proof. In the future some storage could make
use of multiple prefix. Like one to store how much value has been
inserted, etc...
* Update frame/support/procedural/src/storage/parse.rs
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com >
* Update frame/support/procedural/src/storage/storage_struct.rs
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com >
* Fix max_size using hasher information
hasher now expose `max_len` which allows to computes their maximum len.
For hasher without concatenation, it is the size of the hash part,
for hasher with concatenation, it is the size of the hash part + max
encoded len of the key.
* fix tests
* fix ui tests
* Move `MaxBoundedLen` into its own crate (#8814 )
* move MaxEncodedLen into its own crate
* remove MaxEncodedLen impl from frame-support
* add to assets and balances
* try more fixes
* fix compile
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* nits
* fix compile
* line width
* fix max-values-macro merge
* Add some derive, needed for test and other purpose
* use weak bounded vec in some cases
* Update lib.rs
* move max-encoded-len crate
* fix
* remove app crypto for now
* width
* Revert "remove app crypto for now"
This reverts commit 73623e9933d50648e0e7fe90b6171a8e45d7f5a2.
* unused variable
* more unused variables
* more fixes
* Add #[max_encoded_len_crate(...)] helper attribute
The purpose of this attribute is to reduce the surface area of
max_encoded_len changes. Crates deriving `MaxEncodedLen` do not
need to add it to `Cargo.toml`; they can instead just do
```rust
\#[derive(Encode, MaxEncodedLen)]
\#[max_encoded_len_crate(frame_support::max_encoded_len)]
struct Example;
```
* fix a ui test
* use #[max_encoded_len_crate(...)] helper in app_crypto
* remove max_encoded_len import where not necessary
* update lockfile
* fix ui test
* ui
* newline
* fix merge
* try fix ui again
* Update max-encoded-len/derive/src/lib.rs
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com >
* extract generate_crate_access_2018
* Update lib.rs
* compiler isnt smart enough
Co-authored-by: thiolliere <gui.thiolliere@gmail.com >
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com >
Co-authored-by: Peter Goodspeed-Niklaus <peter.r.goodspeedniklaus@gmail.com >
2021-05-28 18:35:15 +00:00
Tim Gestson
14befab52e
Remove now unneeded empty hooks and calls #8873 ( #8874 )
...
* Remove now unneeded empty hooks and calls
* fix pallet_ui tests
2021-05-23 16:30:46 +00:00
Keith Yeung
fcf83c0278
Use StorageNMap for Approvals in assets pallet ( #8816 )
...
* Use StorageNMap for Approvals in assets pallet
* Use EncodeLike on HashKeyPrefix trait bounds
* Add comments clarifying AccountId roles
* Properly document the keys in the Approvals storage
* Fix line width
2021-05-17 06:27:06 +00:00
Shaun Wang
ad584733e9
frame system: add event util functions for tests. ( #8734 )
...
* frame system: add event util functions for tests.
* URemove unused fn.
* Apply review suggestions.
2021-05-12 12:17:03 +00:00
Shaun Wang
2a38b23062
Add arithmetic dispatch errors. ( #8726 )
...
* Add arithmetic dispatch errors.
* Replace custom overflow errors.
* Replace custom underflow and division by zero errors.
* Replace overflow/underflow in token error.
* Add token and arithmetic errors in dispatch error equality test.
* Trigger CI.
2021-05-10 10:14:02 +02:00
François Garillot
052be8bbef
Simplify some Option / Result / ? operator patterns ( #8653 )
...
* Simplify some Option / Result / ? operator patterns
When those match a combinator exactly.
Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust ).
* adjust after review
* adjust post-review
2021-04-23 13:36:10 +00:00
Daniel Olano
7527bd758c
Make pallet Assets instantiable ( #8483 )
...
* Make pallet Assets instantiable
* use instantiable benchmarks
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2021-04-16 08:51:26 +00:00
ferrell-code
c90828ee34
tests for assets pallet ( #8487 )
...
* tests for assets
* Update frame/assets/src/tests.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/assets/src/tests.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* add force asset status check
* remove TODO
* actually remove TODO
* add force asset status tests
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2021-04-01 23:46:41 +02:00
Gavin Wood
643d2b669f
Introduce OnSetCode type into system config trait. ( #8496 )
...
* Introduce OnSetCode type into system config trait.
* Docs.
* Fixes
* Fixes
2021-04-01 12:20:24 +00:00
Gavin Wood
d0eee4f1cb
Implement fungible::* for Balances ( #8454 )
...
* 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 >
2021-03-28 20:59:34 +02:00
Gavin Wood
ff5765eac3
Repot frame_support::traits; introduce some new currency stuff ( #8435 )
...
* 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
* Fixes
* Update lock
* Grumbles
* Grumbles
* Fixes
Co-authored-by: Bastian Köcher <info@kchr.de >
2021-03-27 14:37:13 +01:00
Guillaume Thiolliere
aeff56260c
remove outdated comment ( #8442 )
2021-03-24 10:06:41 +00:00
Gavin Wood
b5b0ef592e
Fungibles trait and impl for Assets pallet ( #8425 )
...
* Fungibles trait and impl for Assets pallet
* Comment & whitespace
* Fixes
* Fix up CI/CD for the new labels.
* New labels.
* Fix labels
* Fix labels
* Whitespace
* Bump impl version.
* Fix accidental change
* Fixes
* Questionable fix.
* Better benchmark
2021-03-23 14:10:36 +01:00