1. Jun 04, 2021
  2. Jun 01, 2021
  3. May 28, 2021
    • Shawn Tabrizi's avatar
      Simple `MaxBoundedLen` Implementations (#8793) · 444d4e20
      Shawn Tabrizi authored
      
      
      * 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: default avatarPeter Goodspeed-Niklaus <[email protected]>
      
      * Update frame/support/procedural/src/storage/storage_struct.rs
      
      Co-authored-by: default avatarPeter Goodspeed-Niklaus <[email protected]>
      
      * 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: default avatarShawn Tabrizi <[email protected]>
      
      * 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: default avatarPeter Goodspeed-Niklaus <[email protected]>
      
      * extract generate_crate_access_2018
      
      * Update lib.rs
      
      * compiler isnt smart enough
      
      Co-authored-by: default avatarthiolliere <[email protected]>
      Co-authored-by: default avatarPeter Goodspeed-Niklaus <[email protected]>
      Co-authored-by: default avatarPeter Goodspeed-Niklaus <[email protected]>
      444d4e20
  4. May 12, 2021
    • Sergey Pepyakin's avatar
      Embed runtime version as a custom section (#8688) · 0849bcce
      Sergey Pepyakin authored
      
      
      * emit a custom section from impl_runtime_apis!
      
      This change emits a custom section from the impl_runtime_apis! proc macro.
      
      Each implemented API will result to emitting a link section `runtime_apis`.
      During linking all sections with this name will be concatenated and
      placed into the final wasm binary under the same name.
      
      * Introduce `runtime_version` proc macro
      
      This macro takes an existing `RuntimeVersion` const declaration, parses
      it and emits the version information in form of a linking section.
      Ultimately such a linking section will result into a custom wasm
      section.
      
      * Parse custom wasm section for runtime version
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarDavid <[email protected]>
      
      * Fix sc-executor integration tests
      
      * Nits
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * Refactor apis section deserialization
      
      * Fix version decoding
      
      * Reuse uncompressed value for CallInWasm
      
      * Log on decompression error
      
      * Simplify if
      
      * Reexport proc-macro from sp_version
      
      * Merge ReadRuntimeVersionExt
      
      * Export `read_embedded_version`
      
      * Fix test
      
      * Simplify searching for custom section
      
      Co-authored-by: default avatarDavid <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      0849bcce
    • Shaun Wang's avatar
      frame system: add event util functions for tests. (#8734) · ad584733
      Shaun Wang authored
      * frame system: add event util functions for tests.
      
      * URemove unused fn.
      
      * Apply review suggestions.
      ad584733
  5. May 04, 2021
  6. Apr 13, 2021
  7. Apr 10, 2021
  8. Apr 06, 2021
  9. Apr 04, 2021
  10. Apr 01, 2021
  11. Mar 27, 2021
    • Gavin Wood's avatar
      Repot frame_support::traits; introduce some new currency stuff (#8435) · ff5765ea
      Gavin Wood authored
      
      
      * 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: default avatarBastian Köcher <[email protected]>
      ff5765ea
  12. Mar 18, 2021
    • Shaun Wang's avatar
      Replace 'Module' with 'Pallet' in construct_runtime macro (#8372) · 2e552244
      Shaun Wang authored
      * 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.
      2e552244
  13. Mar 16, 2021
    • Kian Paimani's avatar
      Audit fixes for election/staking decoupling part 2 (#8167) · b6c62639
      Kian Paimani authored
      
      
      * 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: default avatarGuillaume Thiolliere <[email protected]>
      
      * 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: default avatarGuillaume Thiolliere <[email protected]>
      
      * 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
      
      * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Fix doc
      
      * Mkae ci green
      
      * Audit fixes for election-provider: part 2 signed phase.
      
      * Fix weight
      
      * Some grumbles.
      
      * Try and weigh to get_npos_voters
      
      * Fix build
      
      * Fix line width
      
      * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Fix tests.
      
      * Fix build
      
      * Reorg some stuff
      
      * More reorg.
      
      * Reorg done.
      
      * Fix build
      
      * Another rename
      
      * Fix build
      
      * Update frame/election-provider-multi-phase/src/mock.rs
      
      Co-authored-by: default avatarPeter Goodspeed-Niklaus <[email protected]>
      
      * nit
      
      * better doc
      
      * Line width
      
      * Fix build
      
      * Self-review
      
      * Self-review
      
      * Fix wan
      
      * 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_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * fix build and review comments.
      
      * Update frame/election-provider-multi-phase/src/lib.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * add comment
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      Co-authored-by: default avatarPeter Goodspeed-Niklaus <[email protected]>
      b6c62639
  14. Mar 15, 2021
  15. Mar 05, 2021
  16. Mar 03, 2021
  17. Mar 02, 2021
    • Shawn Tabrizi's avatar
      Make Benchmark Output Analysis Function Configurable (#8228) · cdc59db5
      Shawn Tabrizi authored
      
      
      * Integrate `output-analysis`
      
      * fix test
      
      * use default
      
      * cargo run --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
      
      * Update frame/system/src/weights.rs
      
      * cargo run --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 --output-analysis=max
      
      * Update frame/system/src/weights.rs
      
      * dont discard value_dist and model
      
      * feedback
      
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      cdc59db5
  18. Mar 01, 2021
    • Bastian Köcher's avatar
      Init `RuntimeLogger` automatically for each runtime api call (#8128) · 68390d40
      Bastian Köcher authored
      
      
      * 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: default avatarGuillaume Thiolliere <[email protected]>
      
      * 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: default avatarGuillaume Thiolliere <[email protected]>
      68390d40
  19. Feb 28, 2021
  20. Feb 25, 2021
  21. Feb 23, 2021
  22. Feb 22, 2021
  23. Feb 19, 2021
  24. Feb 16, 2021
    • Peter Goodspeed-Niklaus's avatar
      Create a macro which automates creation of benchmark test suites. (#8104) · 44d5aba8
      Peter Goodspeed-Niklaus authored
      
      
      * Create a macro which automates creation of benchmark test suites.
      
      * bump impl_version
      
      * allow unused on test_bench_by_name
      
      * use proper doctest ignore attribute
      
      * Explicitly hand the Module to the test suite
      
      Much better practice than depending on it showing up implicitly in
      the namespace.
      
      * explicitly import what we need into `mod tests`
      
      * bench_module is `ident` not `tt`
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * allow end users to specify arguments for new_test_ext
      
      This turned out to be surprisingly easy. On reflection, it turns out
      that of course the compiler can't eagerly evaluate the function call,
      but needs to paste it in everywhere desired.
      
      * enable explicitly specifying the path to the benchmarks invocation
      
      also enable optional trailing commas
      
      * Revert "bump impl_version"
      
      This reverts commit 0209e4de33fd43873f8cfc6875815d0fd6151e63.
      
      * list failing benchmark tests and the errors which caused the failure
      
      * harden benchmark tests against internal panics
      
      * suppress warning about ignored profiles
      
      unfortunately, setting the profile here doesn't do anything; we'd
      need to set it in every leaf package anyway. However, as this was
      just making the default explicit anyway, I think it's safe enough
      to remove entirely.
      
      * impl_benchmark_test_suite for assets
      
      * impl_benchmark_test_suite for balances
      
      * impl_benchmark_test_suite for bounties
      
      * impl_benchmark_test_suite for Collective
      
      * impl_benchmark_test_suite for Contracts
      
      * impl_benchmark_test_suite for Democracy
      
      * don't impl_benchmark_test_suite for Elections-Phragmen
      
      * impl_benchmark_test_suite for Identity
      
      Note that Identity tests currently fail. They failed in an identical
      way before this change, so as far as I'm concerned, the status quo is
      good enough for now.
      
      * impl_benchmark_test_suite for ImOnline
      
      * impl_benchmark_test_suite for indices
      
      For this crate also, the test suite fails identically with and without
      this change, so we can say that this change is not the cause of the
      tests' failure to compile.
      
      * impl_benchmark_test_suite for lottery
      
      * impl_benchmark_test_suite for merkle-mountain-range
      
      * impl_benchmark_test_suite for Multisig
      
      These tests fail identically with and without the change, so the change
      seems unlikely to be the origin of the failures.
      
      * impl_benchmark_test_suite for offences
      
      * impl_benchmark_test_suite for Proxy
      
      Fails identically with and without this change.
      
      * impl_benchmark_test_suite for scheduler
      
      * impl_benchmark_test_suite for session
      
      It turns out to be important to be able to exclude items marked
      `#[extra]` sometimes. Who knew?
      
      * impl_benchmark_test_suite for staking
      
      * impl_benchmark_test_suite for system
      
      * impl_benchmark_test_suite for timestamp
      
      * impl_benchmark_test_suite for tips
      
      * impl_benchmark_test_suite for treasury
      
      * impl_benchmark_test_suite for utility
      
      Note that benchmark tests fail identically before and after this change.
      
      * impl_benchmark_test_suite for vesting
      
      * fix wrong module name in impl_benchmark_test_suite in Offences
      
      * address line length nits
      
      * enable optional keyword argument: exec_name
      
      Took a _lot_ of macro-wrangling to get the functionality that I want,
      but now you have the option to pass in
      
      ```rust
      impl_benchmark_test_suite!(
      	Elections,
      	crate::tests::ExtBuilder::default().desired_members(13).desired_runners_up(7),
      	crate::tests::Test,
      	exec_name = build_and_execute,
      );
      ```
      
      and have it expand out properly. A selected fragment of the expansion:
      
      ```rust
              fn test_benchmarks() {
                  crate::tests::ExtBuilder::default()
                      .desired_members(13)
                      .desired_runners_up(7)
                      .build_and_execute(|| {
      ```
      
      * get rid of dead code
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      44d5aba8
  25. Feb 15, 2021
  26. Feb 10, 2021
  27. Feb 09, 2021
  28. Feb 06, 2021
  29. Feb 03, 2021
  30. Jan 29, 2021
  31. Jan 25, 2021
  32. Jan 20, 2021
    • Andrew Jones's avatar
      Migrate frame-system to pallet attribute macro (#7898) · 71ef82af
      Andrew Jones authored
      
      
      * PRINT_PALLET_UPGRADE=1 cargo check -p frame-system
      
      * Copy attributes, imports, mods and type defs
      
      * Copy Config trait
      
      * Annotate constants
      
      * Tabify
      
      * Migrate hooks
      
      * Upgrade template rename interface to hooks
      
      * Migrate pallet call
      
      * Migrate Event
      
      * Migrate Error
      
      * Migrate Origin
      
      * Remove optional validate_unsigned
      
      * Remove remaining TODO_MAYBE_WHERE_CLAUSE
      
      * Overwrite original lib.rs with migrated lib2.rs.
      
      * Add required Event IsType constraint
      
      * Add disable supertrait check
      
      * Fix leftover Trait trait
      
      * Add missing pallet prefix for weight attributes
      
      * Add missing Error type parameter
      
      * Add missing Hooks type parameter
      
      * Private call visibility, restore original helper types and helpers etc
      
      * Fix hooks type parameter
      
      * Rename RawEvent to Event
      
      * Add missing storage type annotations
      
      * Remove unused imports
      
      * Add GenesisConfig helpers for compat
      
      * Fix unused import warnings
      
      * Update frame/support/procedural/src/storage/print_pallet_upgrade.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Fix test errors and warnings
      
      * Fix remaining errors and warnings
      
      * Apply review suggestion: fix formatting
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Apply review suggestion: annotate BlockLength as constant
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Apply review suggestion: add triling comma
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Apply review suggestion: add triling comma
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Apply review suggestion: add trailing comma
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Apply review suggestion: fix storage type indentation
      
      * Apply review suggestion: remove redundant Origin type alias
      
      * Add missing codec derives for BlockLength
      
      * Restore module docs
      
      * Module -> Pallet renamel
      
      * Revert "Update frame/support/procedural/src/storage/print_pallet_upgrade.rs"
      
      This reverts commit d2a2d5b6
      
      * Apply review suggestion: merge crate imports
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      
      * Revert "Upgrade template rename interface to hooks"
      
      This reverts commit 306f0239
      
      * Single line import
      
      * Refactor generated genesis build
      
      * Import sp_io::storage
      
      * Revert previous, fully qualify sp_io::storage
      
      * Fix ui tests
      
      * Fix errors after merge, missing changes
      
      * Set UpgradedToDualRefCount to true in genesis build
      
      * Annotated Runtime version with constant, exposing it via metadata
      
      * Add metadata attribute
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      71ef82af
  33. Jan 16, 2021
  34. Jan 12, 2021
  35. Jan 11, 2021