* Avoid reading contract code when it is supplied in the extrinsic
* Remove custom proof size injection from schedule
* Set benchmarks pov_mode to Measure
* Reduce overestimation of code size on re-instrument
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Do not override proof size from benchmark
* Do not charge proof size for basic block
* Incrase gas limit for tests
* Fix deletion queue to also use `proof_size`
* Fix tests
* Update frame/contracts/src/schedule.rs
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
* Fix wrong schedule macro invocations
* Remove stale docs
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Handle zero components
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Fix instruction weight
---------
Co-authored-by: command-bot <>
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
* Removed assumptions about ancestry from fork tree prune method
* Tests improvement
* Fork tree prune refactory
* Code refactory
* Correctly handle borderline, but legit, case
* Apply suggestions from code review
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Removed duplicated test
---------
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* pallet-timestamp: Remove `ValidAtTimestamp` error variant
The error variant wasn't that useful and it was also used wrongly in the code. In the code we
returned this variant when the `timestamp < minimum`. The problem of this is that we waited on the
node side some time, but then `set` function rejects the timestamp because of the same check (the
timestamp in the block stays the same). We ensure that the timestamp isn't drifting too much in the
future, but waiting for the timestamp to be "valid" would open some attack vector. The consensus
protocols also compare the slots in the blocks to ensure that there isn't a block from the future
and in the runtime we then ensure that `slot = timestamp / slot_duration`. So, we can just remove
this variant and replace it with a new variant `TimeBetweenBlocksTooShort` to not even try importing
a block which uses a too short delay since the last block.
* Update primitives/timestamp/src/lib.rs
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Rename to `TooEarly`
* FMT
---------
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* feat: improve prove_finality api and export it
* fmt
* fix
* improve prove_finality and kept private
* Update client/finality-grandpa/src/finality_proof.rs
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* add `prove_finality_proof` to `FinalityProofProvider`
* fix some and impl Clone for FinalityProofProvider
* improve by suggestions
---------
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* sc-client-db: Fix `PruningMode::ArchiveCanonical`
When running a node with `--state-pruning archive-canonical` it was directly failing on genesis.
There was an issue in the state-db `pin` implementation. It was not checking the state of a block
correctly when running with archive canonical (and also not for every other block after they are canonicalized).
* FMT
For on-demand justifications, peer selection is based on witnessed
gossip votes. This commit changes the condition for selecting a peer
to request justification for `block` from
"last voted on >= `block`" to "peer last voted on strict > `block`".
When allowing `>=` we see nodes continuously spamming unsuccessful
on-demand requests to nodes which are still voting on a block without
having a justification available.
One way to fix the spam would be to add some rate-limiting or backoff
period when requesting justifications.
The other solution (present in this commit) is to simply request
justifications from peers that are voting on future blocks so we know
they're _guaranteed_ to have the wanted mandatory justification
available to send back.
Signed-off-by: acatangiu <adrian@parity.io>
* grandpa: don't error if best block and finality target are inconsistent
* grandpa: add test for best block override
* grandpa: make clippy happy
* grandpa: log selectchain override as debug instead of warn
* Finalization target should be chosed as some ancestor of SelectChain::best_chain
* More test assertions
* Improve docs
* Removed stale docs
* Rename 'target' to 'base' in lookup method
* Fix typo
* Apply suggestions from code review
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Rename 'target_hash' to 'base_hash' in 'SelectChain::finality_target()'
* Apply suggestions from code review
Co-authored-by: Anton <anton.kalyaev@gmail.com>
* Docs improvement
* Doc fix
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* Apply more code suggestions
---------
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
* [Fix] Try-state feature-gated for BagsList
* fix comment
* fix try_state remote-tests
* feature-gate try-state remote test for bags-list
* remove try-state from a migration
* more SortedListProvider fixes
* more fixes
* more fixes to allow do_try_state usage in other crates
* do-try-state for fuzz
* more fixes
* more fixes
* remove feature-flag
* do-try-state
* fix review comments
* Update frame/bags-list/src/mock.rs
Co-authored-by: Anton <anton.kalyaev@gmail.com>
---------
Co-authored-by: parity-processbot <>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
* pallet-scheduler: Ensure we request a preimage
The scheduler was not requesting a preimage. When a preimage is requested, a user can deposit it
without paying any fees.
* Review changes
* referenda metadata
* todo comment
* remove TODO, update rustdocs
* referenda clear_metadata origin signed or root
* referenda metadata unit tests
* drop schema type for referenda metadata
* remove metadata type
* referenda metadata benches
* note different preimages
* metadata for democracy pallet
* metadata democracy pallet tests and benches
* fix cargo clippy
* update docs
* ".git/.scripts/bench-bot.sh" pallet dev pallet_democracy
* ".git/.scripts/bench-bot.sh" pallet dev pallet_referenda
* Update the doc frame/democracy/src/lib.rs
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
* Update the doc frame/democracy/src/lib.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>
* reference instead clone for take
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>
* error rename BadMetadata to PreimageNotExist
* clear metadata within internal_cancel_referendum fn
* remove redundant clone
* collapse metadata api into one set_metadata method
* fmt
* review fixes
* not request preimage on set_metadata
* rename events and update docs
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_democracy
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_referenda
* rename reset_metadata to transfer_metadata
---------
Co-authored-by: command-bot <>
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>
* zombienet validators warp sync draft
Sketch of warp-sync test for validators.
Not tested.
Follow-up of: #12769
* yet another warp-sync scenario added
- all validators are synced from DB,
- some full nodes are synced from DB,
- full-node is warp-synced
* fixes
* fixes
* missing files
* path fixed
---------
Co-authored-by: parity-processbot <>
* Bump `wasmtime` to 4.0.0 (and a few other deps)
* Use `Error::msg` instead of `anyhow!`
* Bump `wasmtime` to 5.0.0
* Update `Cargo.lock`
* Add `wasmtime` feature to `sp-wasm-interface` dependency
* client/beefy: detect equivocated votes
* client/beefy: make sure to persist state after voting
* client/beefy: drop never-used aux-schema v2 migration
* impl review suggestion
---------
Signed-off-by: Adrian Catangiu <adrian@parity.io>
* Remove in-tree bounded types and use bounded-collections crate
* Fixes
* Bump bounded-collections version
* cargo fmt
* Bump bounded-collections
* Only export non-bounded types at the top level
* Fixes
* Bump bounded-collections
* beefy: add support to configure BEEFY genesis
* client/beefy: more flexible test runtime api
* client/beefy: add tests for custom BEEFY genesis
* client/beefy: ignore old state that didn't account for pallet genesis
* client/beefy: fix clippy
* frame/beefy: default BEEFY-genesis is block One::one()
* frame/beefy: add extra doc comments
---------
Co-authored-by: parity-processbot <>
* Minor: Update output validity tests
Quick follow-up to https://github.com/paritytech/substrate/pull/13183.
Mainly, I wanted to double check that the `test_return_max_memory_offset` test doesn't pass just
because the output length is 0.
I also:
- Organized these tests into a module.
- Added a comment explaining why we don't use the `wasm_export_functions` macro.
* Update test based on review comment
* move BeefyMmrApi to pallet-beefy-mmr
* fix test_utils use pallet-beefy-mmr BeefyMmrApi
* Move beefy-merkle-tree to utils and Rename to Merkle-tree
* fix fmt and test
* Update merkle-tree to binary-merkle-tree and Remove Keccak256 mod from merkle-tree
* change merkle-tree name to binary-merkle-tree
* mirr fix