Skip to content
  1. Mar 16, 2021
  2. Mar 15, 2021
  3. Mar 12, 2021
    • Kian Paimani's avatar
      remove whitespaces. (#8341) · f7259758
      Kian Paimani authored
      f7259758
    • André Silva's avatar
      im-online: use EstimateNextSessionRotation to get better estimates of session progress (#8242) · 51822097
      André Silva authored
      * frame-support: add method to estimate current session progress
      
      * im-online: use EstimateNextSessionRotation trait to delay heartbeats
      
      * node: fix im-online pallet instantiation
      
      * frame-support: fix docs
      
      * frame: fix tests
      
      * pallet-session: last block of periodic session means 100% session progress
      
      * pallet-session: add test for periodic session progress
      
      * pallet-babe: fix epoch progress and add test
      
      * frame-support: return weight with session estimates
      
      * pallet-im-online: add test for session progress logic
      51822097
    • Alexander Theißen's avatar
      contracts: Expose rent parameter to contracts (#8231) · a4e88758
      Alexander Theißen authored
      
      
      * contracts: Expose rent parameter to contracts
      
      * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Fix typos
      
      * Improve comments
      
      * Add rent parameter weights
      
      * Allow deploying a new schedule with the same version
      
      * Add storage migration for new schedule
      
      * Only decode the schedule version in storage migration
      
      * Remove confusing docs
      
      * Replace original_code_len() by aggregate_code_len()
      
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      a4e88758
  4. Mar 11, 2021
    • Bastian Köcher's avatar
      Convert timestamp to unit type wrapper (#8333) · 5d73e960
      Bastian Köcher authored
      The timestamp inherent type was up to now just a simple `u64`. This
      worked, but doesn't give you that much guarantees at compile time about
      the type. This pr changes that by converting this type to a unit type
      wrapper, similar to what we have done for `Slot`.
      
      This is required for some future pr that touches quite a lot of the
      inherents stuff :)
      
      Besides this unit wrapper type, this pr also moves the `OnTimestampSet`
      trait to `frame_support::traits`.
      5d73e960
    • JesseAbram's avatar
      Add on_idle hook (#8209) · c06e5569
      JesseAbram authored
      
      
      * add in idle hook
      
      * remaining weight passed through to on_idle
      
      * added weight return
      
      * remove TODO
      
      * weight adjustment fix
      
      * added adjusted weight into tuple
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * compile errors for on_idle in dispatch
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * on idle tuple clean up
      
      * register reduced weight
      
      * collect and add reduced wait from on idle call
      
      * better demo example
      
      * Update frame/support/procedural/src/pallet/expand/hooks.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * added tests to dispatch.rs
      
      * idle test on executive
      
      * skip on idle if remaining weight is 0
      
      * Update frame/executive/src/lib.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * abstract common logic out to functions
      
      * docs
      
      * remove demo example
      
      * remove debug
      
      * spacing
      
      * docs
      
      * revert template pallet to master
      
      * change reduced weight to used weight
      
      * remove empty line
      
      * lint
      
      * spacing
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * documentation
      
      * Update frame/support/procedural/src/pallet/expand/hooks.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * docs
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * docs
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      c06e5569
    • Wei Tang's avatar
    • Andreas Doerr's avatar
      Fix doc build (#8322) · 7aaba0c1
      Andreas Doerr authored
      7aaba0c1
    • Peter Goodspeed-Niklaus's avatar
      Implement PJR checker (#8160) · 781f9087
      Peter Goodspeed-Niklaus authored
      
      
      * Apply.
      
      * get rid of glob import
      
      * use meaningful generic type name
      
      * pjr_check operates on `Supports` struct used elsewhere
      
      * improve algorithmic complexity of `prepare_pjr_input`
      
      * fix rustdoc warnings
      
      * improve module docs
      
      * typo
      
      * simplify debug assertion
      
      * add test finding the phase-change threshold value for a constructed scenario
      
      * add more threshold scenarios to disambiguate plausible interpretations
      
      * add link to npos paper reference
      
      * docs: staked_assignment -> supports
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * add utility method for generating npos inputs
      
      * add a fuzzer which asserts that all unbalanced seq_phragmen are PJR
      
      Note that this currently fails. I hope that this can be rectified
      by calculating the threshold instead of choosing some arbitrary number.
      
      * assert in all cases, not just debug
      
      * leverage a native solution to choose candidates
      
      * use existing helper methods
      
      * add pjr-check and incorporate into the fuzzer
      
      We should probably have one of the W3F people look at this to ensure
      we're not misconstruing any definitions, but this seems like a
      fairly straightforward implementation.
      
      * fix compilation errors
      
      * Enable manually setting iteration parameters in single run.
      
      This gives us the ability to reproducably extract cases where
      honggfuzz has discovered a panic. For example:
      
      $ cargo run --release --bin phragmen_pjr -- --candidates 569 --voters 100
      Tue 23 Feb 2021 11:23:39 AM CET
         Compiling bitflags v1.2.1
         Compiling unicode-width v0.1.8
         Compiling unicode-segmentation v1.7.1
         Compiling ansi_term v0.11.0
         Compiling strsim v0.8.0
         Compiling vec_map v0.8.2
         Compiling proc-macro-error-attr v1.0.4
         Compiling proc-macro-error v1.0.4
         Compiling textwrap v0.11.0
         Compiling atty v0.2.14
         Compiling heck v0.3.2
         Compiling clap v2.33.3
         Compiling structopt-derive v0.4.14
         Compiling structopt v0.3.21
         Compiling sp-npos-elections-fuzzer v2.0.0-alpha.5 (/home/coriolinus/Documents/Projects/paritytech/substrate/primitives/npos-elections/fuzzer)
          Finished release [optimized] target(s) in 6.15s
           Running `/home/coriolinus/Documents/Projects/paritytech/substrate/target/release/phragmen_pjr -c 569 -v 100`
      thread 'main' panicked at 'unbalanced sequential phragmen must satisfy PJR', primitives/npos-elections/fuzzer/src/phragmen_pjr.rs:133:5
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
      
      This is still not adequate proof that seq_phragmen is broken; it could
      very well be that our PJR checker is doing the wrong thing, or we've
      somehow missed a parameter of interest. Still, it's concerning.
      
      * update comment verbiage for accuracy
      
      * it is valid in PJR for an elected candidate to have 0 support
      
      * Fix phragmen_pjr fuzzer
      
      It turns out that the fundamental problem causing previous implementations
      of the fuzzer to fail wasn't in `seq_phragmen` _or_ in `pjr_check`: it was
      in the rounding errors introduced in the various conversions between the
      internal data representation and the external one.
      
      Fixing the fuzzer is then simply an issue of using the internal representation
      and staying in that representation. However, that leaves the issue that
      `seq_phragmen` occasionally produces an output which is technically not
      PJR due to rounding errors. In the future we will need to add some kind of
      "close-enough" threshold. However, that is explicitly out of scope of
      this PR.
      
      * restart ci; it appears to be stalled
      
      * use necessary import for no-std
      
      * use a more realistic distribution of voters and candidates
      
      This isn't ideal; more realistic numbers would be about twice these.
      However, either case generation or voting has nonlinear execution
      time, and doubling these values brings iteration time from ~20s to
      ~180s. Fuzzing 6x as fast should make up for fuzzing cases half the size.
      
      * identify specifically which PJR check may fail
      
      * move candidate collection comment into correct place
      
      * standard_threshold: use a calculation method which cannot overflow
      
      * Apply suggestions from code review (update comments)
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * clarify the effectiveness bounds for t-pjr check
      
      * how to spell "committee"
      
      * reorganize: high -> low abstraction
      
      * ensure standard threshold calc cannot panic
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      Co-authored-by: default avatarkianenigma <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      781f9087
  5. Mar 10, 2021
    • asynchronous rob's avatar
      more clear randomness API for BABE (#8180) · e2960c38
      asynchronous rob authored
      
      
      * more clear randomness API for BABE
      
      * babe: move randomness utilities to its own file
      
      * node: use babe::RandomnessFromOneEpochAgo in random_seed implementation
      
      * frame-support: annotate randomness trait with block number
      
      * pallet-randomness-collective-flip: fix for new randomness trait
      
      * pallet-society: fix randomness usage
      
      * pallet-lottery: fix randomness usage
      
      * pallet-contracts: fix randomness usage
      
      * pallet-babe: fix randomness usage
      
      we need to track when the current and previous epoch started so that we
      know the block number by each existing on-chain was known
      
      * node: fix random_seed
      
      * node-template: fix random_seed
      
      * frame-support: extend docs
      
      * babe: add test for epoch starting block number tracking
      
      * babe: fix epoch randomness docs
      
      * frame: add todos for dealing with randomness api changes
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      e2960c38
    • Tomasz Drwięga's avatar
      Custom RPC for Merkle Mountain Range pallet (#8137) · f3d4355a
      Tomasz Drwięga authored
      * Add MMR custom RPC.
      
      * Change RuntimeApi to avoid hardcoding leaf type.
      
      * Properly implement the new RuntimeAPI and wire up RPC.
      
      * Extract Offchain DB as separate execution extension.
      
      * Enable offchain DB access for offchain calls.
      
      * Fix offchain_election tests.
      
      * Skip block initialisation for proof generation.
      
      * Fix integration test setup.
      
      * Fix offchain tests. Not sure how I missed them earlier 🤷.
      
      * Fix long line.
      
      * One more test missing.
      
      * Update mock for multi-phase.
      
      * Address review grumbbles.
      
      * Address review grumbles.
      
      * Fix line width of a comment
      f3d4355a
    • Ashley's avatar
      Return babe configuration information in the babe api epoch functions (#8072) · 7ace5e21
      Ashley authored
      
      
      * Make changes
      
      * Add serialize/deserialize, copy babe epoch config defaults from node runtime
      
      * Fix line widths and turn default features off for serde
      
      * Remove ser/deser from Epoch, fix node-cli
      
      * Apply suggestions
      
      * Add comment to BABE_GENESIS_EPOCH_CONFIG in bin
      
      * Apply suggestions
      
      * Add a sketchy migration function
      
      * Add a migration test
      
      * Check for PendingEpochConfigChange as well
      
      * Make epoch_config in node-cli
      
      * Move updating EpochConfig out of the if
      
      * Fix executor tests
      
      * Calculate weight for add_epoch_configurations
      
      * Fix babe test
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      
      * Add more asserts to tests, remove unused changes to primitives/slots
      
      * Allow setting the migration pallet prefix
      
      * Rename to BabePalletPrefix
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      7ace5e21
  6. Mar 09, 2021
    • Bastian Köcher's avatar
      c33235ac
    • Alexander Theißen's avatar
      Fix typo in generated docs. (#8300) · 7f170820
      Alexander Theißen authored
      7f170820
    • Gavin Wood's avatar
      Introduce IgnoredIssuance into Gilts (#8299) · a4921069
      Gavin Wood authored
      * IgnoredIssuance
      
      * Fixes
      
      * Fixes
      a4921069
    • Gavin Wood's avatar
      Assets: Remove zombies, introduce approvals (#8220) · 643a0ecd
      Gavin Wood authored
      
      
      * Initial work
      
      * Tests for frame system
      
      * Self-sufficient account ref-counting
      
      * Fixes
      
      * Benchmarks building.
      
      * Update frame/system/src/lib.rs
      
      Co-authored-by: default avatarJaco Greeff <[email protected]>
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * Test approvals
      
      * Fixes
      
      * Report assets pallet tests
      
      * Tests for approvals & force_cancel_approval
      
      * Use structs rather than tuples for approval data
      
      * Add force_asset_status, force_set_metadata
      
      * Add clear_metadata.
      
      * approval benchmarks
      
      * force_asset_status benchmarks
      
      * final benchmarks
      
      * 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
      
      * Update frame/system/src/lib.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/system/src/lib.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/system/src/lib.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Docs for new approval dispatches.
      
      * Docs for pallet.
      
      * Remove accidental code.
      
      * 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
      
      * 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
      
      * Fixes
      
      * Update frame/assets/src/lib.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * Grumbles.
      
      * Transfer zero works, use DispatchResult
      
      * fix test
      
      * Remove force_destroy
      
      * Remove TODO
      
      * 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
      
      * transfer_keep_alive
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * 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: default avatarJaco Greeff <[email protected]>
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      643a0ecd
  7. Mar 08, 2021
  8. Mar 06, 2021
    • Bastian Köcher's avatar
      Do not use `Option` to wrap `GenesisConfig` fields (#8275) · b0ebf649
      Bastian Köcher authored
      Currently we wrap every `GenesisConfig` field in an `Option`, while
      we require `Default` being implemented for all pallet genesisconfigs.
      Passing `None` also results in the genesis not being initialized, which
      is a bug as seen from the perspective of a pallet developer?
      
      This pr changes the fields of the `GenesisConfig` to non `Option` types.
      b0ebf649
  9. Mar 05, 2021
  10. Mar 03, 2021
  11. Mar 02, 2021
  12. Mar 01, 2021
    • André Silva's avatar
      13ef9ad3
    • 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
  13. Feb 28, 2021
  14. Feb 27, 2021
    • Gavin Wood's avatar
      Gilts Pallet (#8139) · ed365da8
      Gavin Wood authored
      
      
      * Initial draft
      
      * Enlarge function drafted.
      
      * Thaw draft
      
      * Retract_bid draft
      
      * Final bits of draft impl.
      
      * Test mockup
      
      * Tests
      
      * Docs
      
      * Add benchmark scaffold
      
      * Integrate weights
      
      * All benchmarks done
      
      * Missing file
      
      * Remove stale comments
      
      * Fixes
      
      * Fixes
      
      * Allow for priority queuing.
      
      * Another test and a fix
      
      * Fixes
      
      * Fixes
      
      * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_gilt --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/gilt/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Grumble
      
      * Update frame/gilt/src/tests.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * Update frame/gilt/src/tests.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * Grumble
      
      * Update frame/gilt/src/tests.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * Update frame/gilt/src/lib.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * Update frame/gilt/src/lib.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * Fix unreserve ordering
      
      * Grumble
      
      * Fixes
      
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      ed365da8
  15. Feb 26, 2021
  16. Feb 25, 2021