zjb0807
be3d0ba4ab
Add TypeInfo ( #10010 )
...
* add TypeInfo for DispatchTime
* add TypeInfo for BoundedBTreeSet
* add skip_type_params
* add TypeInfo for BoundedSlice
* add skip_type_params
2021-10-13 12:49:34 +02:00
Jay Pavlina
b890a28ca3
Implement core::fmt::Debug for BoundedVec ( #9914 )
2021-10-02 08:11:37 +00:00
Bastian Köcher
62187b5916
Prepare UI tests for rust 1.55 ( #9637 )
...
* Prepare UI tests for rust 1.54
* Delete wrong_page.stderr
* CI: run with a staging CI image
* Revert "CI: run with a staging CI image"
This reverts commit 66f5b00d14b50fd9d8fbf773f7e884f380697591.
* CI: debug, again
* LOG_TARGET is only used in std
* Remove unnecessary unsafe
* Fixes
* Use correct rustc locally
* FMT
* Compile with benchmarking
* Review feedback
* Some ui tests
* I know...
* Fix wasm tests
Co-authored-by: Denis P <denis.pisarev@parity.io >
Co-authored-by: thiolliere <gui.thiolliere@gmail.com >
2021-09-24 10:42:08 +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
Keith Yeung
886825a5c0
Generate storage info for aura pallet ( #9371 )
...
* Generate storage info for aura pallet
* Add MaxAuthorities to node-template aura pallet config
* Fix compilation errors on node-template
* Use WeakBoundedVec instead of BoundedVec
* Improve comment on BoundedSlice's EncodeLike impl
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Bump MaxAuthorities count to 32 for node template
* cargo fmt
* cargo fmt
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2021-09-02 01:24:08 +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
Keith Yeung
721a3b9e9c
Ensure data size of identity pallet is bounded ( #9168 )
...
* Ensure data size of identity pallet is bounded
* Fix unit tests for identity pallet
* Move identity pallet custom types into its own module
* Make use of NoBound family traits
* Fix identity pallet benchmarks
* Enumerate type imports
* Properly convert to BoundedVec in benchmarks
* Re-export types
* Use BoundedVec when storing sub identities
* Add generate_storage_info
* Manually implement MaxEncodedLen on select types
* Use ConstU32 instead of parameter_type
* Leverage DefaultNoBound and add some comments
* Use max_encoded_len() instead of hardcoded constant
* Use MaxEncodedLen in parity-scal-codec
* Add get_mut method for WeakBoundedVec
* Use expect on an infallible operation
* Rewrite as for loop
2021-07-08 02:57:26 +00:00
Igor Matuszewski
eb6d651f9c
Remove in-tree max-encoded-len and use the new SCALE codec crate instead ( #9163 )
...
* Update impl-codec to use new upstream MaxEncodedLen trait
* Adapt crates to use the updated codec crate for `MaxEncodedLen`
* Remove max-encoded-len crate altogether
* Fix test compilation in `pallet-proxy`
* reorganize import (#9186 )
* Fix remaining `MaxEncodedLen` imports
* Fix remaining old usages of max-encoded-len crate
* Fix UI test
* Manually depend on new impl-codec to fix Polkadot companion build
* Use newly released primitive-types v0.9.1 that has new codec impls
* Make sure codec deps are up-to-date in crates that use them
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
2021-07-05 20:37:24 +00:00
Gavin Wood
bf1ea96c66
Non-fungible token traits ( #8993 )
...
* Non-fungible token traits
* Docs
* Fixes
* Implement non-fungible trait for Uniques
* Update frame/uniques/src/impl_nonfungibles.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* Update frame/uniques/src/impl_nonfungibles.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2021-06-03 13:20:34 +02:00
Shawn Tabrizi
554a0cb274
also fix bounded vec ( #8987 )
2021-06-02 04:30:53 +00: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
Guillaume Thiolliere
25625a0f0c
Introduce WeakBoundedVec, StorageTryAppend, and improve BoundedVec API ( #8842 )
...
* fix bounded vec doc and unsafe
* fix btree map and set and tests
* introduce weak_bounded_vec and StorageTryAppend
* fix tests and reorganize tests
* improve doc
* add doc
* Update frame/support/src/storage/weak_bounded_vec.rs
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com >
* fix inner doc
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com >
2021-05-21 09:07:00 +00:00
Peter Goodspeed-Niklaus
b689790171
Relax BoundedVec trait restrictions ( #8749 )
...
* requiring users to maintain an unchecked invariant is unsafe
* relax trait restrictions on BoundedVec<T, S>
A normal `Vec<T>` can do many things without any particular trait
bounds on `T`. This commit relaxes the bounds on `BoundedVec<T, S>`
to give it similar capabilities.
2021-05-07 20:04:16 +00:00
Peter Goodspeed-Niklaus
db69eb04bb
Add BoundedBTreeMap to frame_support::storage ( #8745 )
...
* Add `BoundedBTreeMap` to `frame_support::storage`
Part of https://github.com/paritytech/substrate/issues/8719 .
* max_encoded_len will never encode length > bound
* requiring users to maintain an unchecked invariant is unsafe
* only impl debug when std
* add some marker traits
* add tests
2021-05-06 13:54:13 +00:00
Peter Goodspeed-Niklaus
a935274ef9
BoundedVec MaxEncodedLen microoptimization ( #8746 )
2021-05-06 11:01:42 +00:00
Peter Goodspeed-Niklaus
98744eb3b2
implement BoundedEncodedLen ( #8720 )
...
* implement BoundedEncodedLen
* update header
* update imports
* use impl_for_tuples instead of a custom macro
* remove redundant where clause
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* impl for Compact<T>
* impl BoundedEncodedLen for BoundedVec (#8727 )
* impl BoundedEncodedLen for bool
* explicitly implement BoundedEncodedLen for each Compact form
Turns out that u16 doesn't play nicely with the pattern; those values
take two extra bytes, where all other cases take one. :(
* rename BoundedEncodedLen -> MaxEncodedLen
* add tests of compact encoded length
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2021-05-04 13:57:32 +00:00
Shawn Tabrizi
5fb7658ae9
Improve BoundedVec API ( #8707 )
...
* improve bounded vec api
* Update frame/support/src/storage/bounded_vec.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Update frame/support/src/storage/bounded_vec.rs
* Update frame/support/src/storage/bounded_vec.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2021-05-04 09:17:52 +00:00
Guillaume Thiolliere
bb343c7c26
fix doc and dyn ( #8631 )
2021-04-17 17:01:31 +02:00
Kian Paimani
6bcf5f21c4
BoundedVec + Shims for Append/DecodeLength ( #8556 )
...
* prototype for shawn
* Clean and document it
* Add more docs
* Move imports
* Some changes for easier compat.
* revert exmaple pallet
* rename
* BoundedVec for AccountLocks (#8580 )
* Example with balances
* Fix tests
* Make it indexable
* fix
* Fix tests
* fix test
* Fix collective as well
* Fix test
* Update frame/support/src/storage/mod.rs
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com >
* Repot and add for value
* Add for map and double map
* Final touches.
* Update frame/support/src/storage/bounded_vec.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Add a few more tests
* Add import
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com >
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
2021-04-16 06:06:05 +00:00