1. Jul 13, 2022
    • Kian Paimani's avatar
      Revamp nomination pool reward scheme (#11669) · f8d4b999
      Kian Paimani authored
      
      
      * make pool roles optional
      
      * undo lock file changes?
      
      * add migration
      
      * add the ability for pools to chill themselves
      
      * boilerplate of tests
      
      * somewhat stable, but I think I found another bug as well
      
      * Fix it all
      
      * Add more more sophisticated test + capture one more bug.
      
      * Update frame/staking/src/lib.rs
      
      * reduce the diff a little bit
      
      * add some test for the slashing bug
      
      * cleanup
      
      * fix lock file?
      
      * Fix
      
      * fmt
      
      * Update frame/nomination-pools/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/nomination-pools/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/nomination-pools/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/nomination-pools/src/mock.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Fix build
      
      * fix some fishy tests..
      
      * add one last integrity check for MinCreateBond
      
      * remove bad assertion -- needs to be dealt with later
      
      * nits
      
      * fix tests and add benchmarks for chill
      
      * remove stuff
      
      * fix benchmarks
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_nomination_pools --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/nomination-pools/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * remove defensive
      
      * first working version
      
      * bring back all tests
      
      * ALL new tests work now
      
      * cleanup
      
      * make sure benchmarks and all work
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_nomination_pools --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/nomination-pools/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * round of self-review, make arithmetic safe
      
      * fix warn
      
      * add migration code
      
      * Fix doc
      
      * add precision notes
      
      * make arithmetic fallible
      
      * fix node runtime
      
      * a lot of precision tests and notes and stuff
      
      * document MaxPOintsToBalance better
      
      * :round of self-review
      
      * fmt
      
      * fix some comments
      
      * Fix proportional slashing logic
      
      * Update frame/nomination-pools/src/tests.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/nomination-pools/src/tests.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/nomination-pools/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * track poinst in migration
      
      * fix
      
      * fmt
      
      * fix migration
      
      * remove event read
      
      * Apply suggestions from code review
      
      * Update frame/staking/src/lib.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * Update frame/nomination-pools/src/lib.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * Update frame/nomination-pools/src/lib.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * update
      
      * fmt
      
      * fmt
      
      * add one last test
      
      * fmt
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      Co-authored-by: default avatarParity Bot <[email protected]>
      f8d4b999
    • Jegor Sidorenko's avatar
      Buy&Sell methods for Uniques (#11398) · 5d96c0a0
      Jegor Sidorenko authored
      
      
      * Allow to set item's price
      
      * Clean the state when we transfer/burn an item or destroy a collection
      
      * Allow to buy an item
      
      * Remove redundant checks
      
      * Improve events
      
      * Cover with tests
      
      * Add comments
      
      * Apply suggestions
      
      * Fmt
      
      * Improvements for price validation
      
      * Improve validation
      
      * Update to use the new terminology
      
      * Remove multi-assets support
      
      * Chore
      
      * Weights + benchmarking
      
      * Shield against human error
      
      * Test when we pass the higher item's price
      
      * fmt fix
      
      * Chore
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
      
      * Remove is_frozen check when setting the price
      
      * Try to fix benchmarking
      
      * Fix benchmarking
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
      
      * Add transactional
      
      * Add 'allow deprecated' flag for transactional
      
      * Remove #[allow(deprecated)]
      
      * ".git/.scripts/bench-bot.sh" pallet dev pallet_uniques
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: command-bot <>
      5d96c0a0
    • Kian Paimani's avatar
      Fix off by one error in proportional slashing (#11782) · 3ea6a88e
      Kian Paimani authored
      
      
      * Fix proportional slashing logic
      
      * Update frame/nomination-pools/test-staking/src/lib.rs
      
      Co-authored-by: default avatarDavid <[email protected]>
      
      * Update frame/staking/src/lib.rs
      
      Co-authored-by: default avatarDavid <[email protected]>
      
      * Update frame/staking/src/lib.rs
      
      Co-authored-by: default avatarDavid <[email protected]>
      
      * Update frame/staking/src/lib.rs
      
      Co-authored-by: default avatarDavid <[email protected]>
      
      * fmt
      
      * Update frame/nomination-pools/test-staking/src/lib.rs
      
      * clean
      
      * fix
      
      * last fixes
      
      * doc
      
      Co-authored-by: default avatarDavid <[email protected]>
      3ea6a88e
  2. Jul 12, 2022
    • Nazar Mokrynskyi's avatar
      Network sync refactoring (part 4) (#11412) · 5896072b
      Nazar Mokrynskyi authored
      
      
      * Remove direct dependency of `sc-network` on `sc-network-light`
      
      * Move `WarpSyncProvider` trait and surrounding data structures into `sc-network-common`
      
      * Move `WarpSyncProvider` trait and surrounding data structures into `sc-network-common`
      
      * Create `sync` module in `sc-network-common`, create `ChainSync` trait there (not used yet), move a bunch of associated data structures from `sc-network-sync`
      
      * Switch from concrete implementation to `ChainSync` trait from `sc-network-common`
      
      * Introduce `OpaqueStateRequest`/`OpaqueStateResponse` to remove generics from `StateSync` trait
      
      * Introduce `OpaqueBlockRequest`/`OpaqueBlockResponse`, make `scheme` module of `sc-network-sync` private
      
      * Surface `sc-network-sync` into `sc-service` and make `sc-network` not depend on it anymore
      
      * Remove now unnecessary dependency from `sc-network`
      
      * Replace crate links with just text since dependencies are gone now
      
      * Remove `warp_sync` re-export from `sc-network-common`
      
      * Update copyright in network-related files
      
      * Address review comments about documentation
      
      * Apply review suggestion
      
      * Rename `extra_requests` module to `metrics`
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      5896072b
    • Kian Paimani's avatar
      prep council election pallet for being dissolved (#11790) · 4b8d7842
      Kian Paimani authored
      * prep council election pallet for being dissolved + make it temporarily bounded
      
      * fix tests
      
      * fix
      
      * Update frame/elections-phragmen/src/lib.rs
      
      * fix bench?
      4b8d7842
    • Roman Proskuryakov's avatar
      Upgrade libp2p to 0.46.1 (#11787) · 1902dc16
      Roman Proskuryakov authored
      * Update libp2p to 0.46.0
      
      * Update libp2p to 0.46.1
      
      * Fix telemetry initialization
      
      * Fix tests
      1902dc16
    • Xiliang Chen's avatar
      CLI flag to configure tx ban duration (#11786) · 47b27c29
      Xiliang Chen authored
      
      
      * add tx-ban-seconds
      
      * fix
      
      * trigger CI
      
      * trigger CI
      
      * remove test print
      
      * Update client/cli/src/params/transaction_pool_params.rs
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      47b27c29
    • Arkadiy Paronyan's avatar
      sync: Fixed clearing subsequent ranges (#11815) · a1c60f09
      Arkadiy Paronyan authored
      * sync: Fixed clearing subsequent ranges
      
      * Warp sync fix
      
      * Better documentation
      a1c60f09
  3. Jul 09, 2022
  4. Jul 08, 2022
  5. Jul 07, 2022
    • Adrian Catangiu's avatar
      pallet-mmr: handle forks without collisions in offchain storage (#11594) · 27b53822
      Adrian Catangiu authored
      
      
      * pallet-mmr: fix some typos
      
      * pallet-mmr: make the MMR resilient to chain forks
      
      * pallet-mmr: get hash for block that added node
      
      * beefy-mmr: add debug logging
      
      * add explanatory comment
      
      * account for block offset of pallet activation
      
      * add support for finding all nodes added by leaf
      
      * minor improvements
      
      * add helper to return all nodes added to mmr with a leaf append
      
      * simplify leaf_node_index_to_leaf_index
      
      summing the (shifted) differences in peak positions adds up to the (shifted) final position, so
      don't need to fold over positions.
      
      * dead fish: this also doesn't work
      
      The idea was to keep a rolling window of `(parent_hash, pos)` leaf
      entries in the offchain db, with the window matching the one
      that provides `block_num -> block_hash` mappings in `frame_system`.
      
      Once a leaf exits the window it would be "canonicalized" by switching
      its offchain db key from `(parent_hash, pos)` to simple `pos`.
      
      This doesn't work however because there's no way to get leaf contents
      from offchain db while in runtime context.. so no way to get+clear+set
      leaf to change its key in offchain db.
      
      Ideas:
      1. move the "canonicalization" logic to offchain worker
      2. enhance IndexingApi with "offchain::move(old_key, new_key)"
         This is weird, but correct, deterministic and safe AFAICT, so
         it could be exposed to runtime.
      
      * simplify rightmost_leaf_node_index_from_pos
      
      * minor fix
      
      * move leaf canonicalization to offchain worker
      
      * move storage related code to storage.rs
      
      * on offchain reads use canonic key for old leaves
      
      * fix offchain worker write using canon key
      
      * fix pallet-mmr tests
      
      * add documentation and fix logging
      
      * add offchain mmr canonicalization test
      
      * test canon + generate + verify
      
      * fix pallet-beefy-mmr tests
      
      * implement review suggestions
      
      * improve test
      
      * pallet-mmr: add offchain pruning of forks
      
      * pallet-mmr: improve offchain pruning
      
      Instead of keeping pruning map as single blob in offchain db,
      keep individual parent-hash lists with block-num identifier as part
      of the offchain key.
      
      Signed-off-by: default avataracatangiu <[email protected]>
      
      * pallet-mmr: improve MMRStore<OffchainStorage>::get()
      
      Do the math and retrieve node using correct (canon or non-canon)
      offchain db key, instead of blindly looking in both canon and non-canon
      offchain db locations for each node.
      
      Still fallback on looking at both if for any reason it's not where
      expected.
      
      Signed-off-by: default avataracatangiu <[email protected]>
      
      * pallet-mmr: storage: improve logs
      
      * fix tests: correctly persist overlay
      
      runtime indexing API works on overlay, whereas offchain context
      bypasses overlay, so for loops > canon-window, canon would fail.
      
      * pallet-mmr: fix numeric typo in test
      
      * add comment around LeafData requirements
      
      Signed-off-by: default avataracatangiu <[email protected]>
      
      Co-authored-by: default avatarRobert Hambrock <[email protected]>
      27b53822
    • Arkadiy Paronyan's avatar
  6. Jul 05, 2022
  7. Jun 30, 2022
  8. Jun 29, 2022
  9. Jun 28, 2022
    • Koute's avatar
      Prevent unsoundness in environments with broken `madvise(MADV_DONTNEED)` (#11722) · 3d89fa36
      Koute authored
      * Prevend unsoundness in environments with broken `madvise(MADV_DONTNEED)`
      
      * Add the `std` feature to `rustix` dependency
      
      Apparently not having this breaks compilation on non-nightly toolchains.
      
      * Autodetect the page size when checking whether `madvise` works
      
      * Only make sure that the madvice check doesn't return `Err`
      3d89fa36
  10. Jun 27, 2022
  11. Jun 24, 2022
  12. Jun 23, 2022
    • Vladimir Istyufeev's avatar
    • Sasha Gryaznov's avatar
      [contracts] Implement transparent hashing for contract storage (#11501) · 68ea2ab0
      Sasha Gryaznov authored
      
      
      * save
      
      * builds and old tests pass
      
      save:  temporary value dropped while borrowed
      
      save: finally builds
      
      test updated but still fails
      
      * type names enhanced
      
      * VarSizedKey bounded to new Config param
      
      * improved wasm runtime updated funcs
      
      * unstable-interface tests fixed
      
      * benchmarks fixed
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      
      * fixes on feedback
      
      * fixes on feedback applied + make it build
      
      * benchmarks build but fail (old)
      
      * "Original code too large"
      
      * seal_clear_storage bench fixed (code size workaround hack removal tbd)
      
      * bench_seal_clear_storage pass
      
      * bench_seal_take_storage ... ok
      
      * added new seal_set_storage + updated benchmarks
      
      * added new seal_get_storage + updated benchmarks
      
      * added new seal_contains_storage + updated benchmarks
      
      * added tests for _transparent exec functions
      
      * wasm test for clear_storage
      
      * wasm test for take_storage
      
      * wasm test for new set_storage
      
      * wasm test for new get_storage
      
      * wasm test for new contains_storage
      
      * CI fix
      
      * ci fix
      
      * ci fix
      
      * ci fix
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
      
      * fixes according to the review feedback
      
      * tests & benchmarks fixed
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
      
      * refactoring
      
      * fix to runtime api
      
      * ci fix
      
      * ctx.get_storage() factored out
      
      * ctx.contains_storage() factored out
      
      * number of batches reduced for transparent hashing storage benchmarks
      
      * contracts RPC & pallet::get_storage to use transparent hashing
      
      * node and rpc updated to use get_storage with VarSizedKey
      
      * refactored (more concize)
      
      * refactored contains_storage (DRYed)
      
      * refactored contains_storage (DRYed)
      
      * fix rpc
      
      * fmt fix
      
      * more fixes in rpc
      
      * rollback `Pallet:get_storage` to Vec<u8> and rpc and node parts related to it
      
      * added `KeyDecodingFailed` error
      
      * Revert weird "fmt fix"
      
      This reverts commit c582cfff4b5cb2c9929fd5e3b45519bb24aeb657.
      
      * node-executor basic test update
      
      * fix node-executor basic test
      
      * benchmarks fix
      
      * more benchmarks fix
      
      * FixedSizedKey is hidden from pub, VarSizedKey is exported as StorageKey
      
      * ci fix
      
      * set_storage benchmark fix
      
      * ci fix
      
      * ci fix
      
      * comments improved
      
      * new error code to rpc: KEY_DECODING_FAILED
      
      * Put `rusty-cachier` before PR merge into `master` for `cargo-check-benches` job
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
      
      * minor optimization
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: Vladimir Istyufeev's avatarVladimir Istyufeev <[email protected]>
      Co-authored-by: command-bot <>
      68ea2ab0
    • Doordashcon's avatar
      make pallet-tips & pallet-bounties instantiable (#11473) · 7d2ecc89
      Doordashcon authored
      
      
      * make pallet-tips & pallet-bounties instantiable
      
      * update test
      
      * add default instance
      
      * update
      
      * cargo fmt
      
      * update
      
      * update
      
      * update
      
      * update
      
      * fix merge
      
      * fix tests
      
      * bounties benchmarking instantiable
      
      * fix benchmarks
      
      * make tips benchmarks instantible
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      7d2ecc89
  13. Jun 22, 2022
  14. Jun 21, 2022
  15. Jun 20, 2022
  16. Jun 19, 2022
  17. Jun 18, 2022
  18. Jun 17, 2022