├── .cargo └── config.toml ├── .dockerignore ├── .editorconfig ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── release.md ├── dependabot.yml ├── pr-custom-review.yml └── workflows │ ├── burnin-label-notification.yml │ ├── check-D-labels.yml │ ├── check-bootnodes.yml │ ├── check-labels.yml │ ├── check-licenses.yml │ ├── check-new-bootnodes.yml │ ├── check-weights.yml │ ├── honggfuzz.yml │ ├── pr-custom-review.yml │ ├── release-01_branch-check.yml │ ├── release-10_candidate.yml │ ├── release-20_extrinsic-ordering-check-from-bin.yml │ ├── release-21_extrinsic-ordering-check-from-two.yml │ ├── release-30_publish-draft-release.yml │ ├── release-40_publish-rc-image.yml │ ├── release-50_publish-docker-release.yml │ ├── release-51_publish-docker-manual.yml │ └── release-99_bot.yml ├── .gitignore ├── .gitlab-ci.yml ├── .rpm └── polkadot.spec ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── RELEASE.md ├── SECURITY.md ├── build.rs ├── cli ├── Cargo.toml ├── build.rs └── src │ ├── cli.rs │ ├── command.rs │ ├── error.rs │ ├── host_perf_check.rs │ └── lib.rs ├── core-primitives ├── Cargo.toml └── src │ └── lib.rs ├── doc ├── docker.md ├── release-checklist.md ├── shell-completion.md └── testing.md ├── erasure-coding ├── Cargo.toml ├── benches │ ├── README.md │ └── scaling_with_validators.rs ├── fuzzer │ ├── .gitignore │ ├── Cargo.toml │ └── src │ │ ├── reconstruct.rs │ │ └── round_trip.rs └── src │ └── lib.rs ├── file_header.txt ├── grafana ├── README.md ├── general │ └── kusama_deployment.json └── parachains │ └── status.json ├── node ├── collation-generation │ ├── Cargo.toml │ └── src │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── metrics.rs │ │ └── tests.rs ├── core │ ├── README.md │ ├── approval-voting │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── approval_checking.rs │ │ │ ├── approval_db │ │ │ ├── mod.rs │ │ │ └── v1 │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── backend.rs │ │ │ ├── criteria.rs │ │ │ ├── import.rs │ │ │ ├── lib.rs │ │ │ ├── ops.rs │ │ │ ├── persisted_entries.rs │ │ │ ├── tests.rs │ │ │ └── time.rs │ ├── av-store │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── backing │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests │ │ │ ├── mod.rs │ │ │ └── prospective_parachains.rs │ ├── bitfield-signing │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── candidate-validation │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── chain-api │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── chain-selection │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── backend.rs │ │ │ ├── db_backend │ │ │ ├── mod.rs │ │ │ └── v1.rs │ │ │ ├── lib.rs │ │ │ ├── tests.rs │ │ │ └── tree.rs │ ├── dispute-coordinator │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── backend.rs │ │ │ ├── db │ │ │ ├── mod.rs │ │ │ └── v1.rs │ │ │ ├── error.rs │ │ │ ├── import.rs │ │ │ ├── initialized.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── participation │ │ │ ├── mod.rs │ │ │ ├── queues │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ └── tests.rs │ │ │ ├── scraping │ │ │ ├── candidates.rs │ │ │ ├── mod.rs │ │ │ └── tests.rs │ │ │ ├── spam_slots.rs │ │ │ ├── status.rs │ │ │ └── tests.rs │ ├── parachains-inherent │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── prospective-parachains │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── error.rs │ │ │ ├── fragment_tree.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── provisioner │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── disputes │ │ │ ├── mod.rs │ │ │ └── prioritized_selection │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── pvf-checker │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── interest_view.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── runtime_api.rs │ │ │ └── tests.rs │ ├── pvf │ │ ├── Cargo.toml │ │ ├── bin │ │ │ └── puppet_worker.rs │ │ ├── common │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ ├── error.rs │ │ │ │ ├── execute.rs │ │ │ │ ├── executor_intf.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── prepare.rs │ │ │ │ ├── pvf.rs │ │ │ │ └── worker │ │ │ │ ├── mod.rs │ │ │ │ └── security.rs │ │ ├── execute-worker │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── prepare-worker │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ ├── executor_intf.rs │ │ │ │ ├── lib.rs │ │ │ │ └── memory_stats.rs │ │ ├── src │ │ │ ├── artifacts.rs │ │ │ ├── error.rs │ │ │ ├── execute │ │ │ │ ├── mod.rs │ │ │ │ ├── queue.rs │ │ │ │ └── worker_intf.rs │ │ │ ├── host.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── prepare │ │ │ │ ├── mod.rs │ │ │ │ ├── pool.rs │ │ │ │ ├── queue.rs │ │ │ │ └── worker_intf.rs │ │ │ ├── priority.rs │ │ │ ├── testing.rs │ │ │ └── worker_intf.rs │ │ └── tests │ │ │ └── it │ │ │ ├── adder.rs │ │ │ ├── main.rs │ │ │ └── worker_common.rs │ └── runtime-api │ │ ├── Cargo.toml │ │ └── src │ │ ├── cache.rs │ │ ├── lib.rs │ │ ├── metrics.rs │ │ └── tests.rs ├── gum │ ├── Cargo.toml │ ├── README.md │ ├── proc-macro │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── tests.rs │ │ │ └── types.rs │ └── src │ │ ├── lib.rs │ │ └── tests.rs ├── jaeger │ ├── Cargo.toml │ └── src │ │ ├── config.rs │ │ ├── errors.rs │ │ ├── lib.rs │ │ └── spans.rs ├── malus │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── container │ │ ├── Containerfile-cargo-chef │ │ ├── build.sh │ │ ├── malus-local-build.Containerfile │ │ └── polkadot-local-build.Containerfile │ ├── integrationtests │ │ ├── 0001-dispute-valid-block.toml │ │ └── 0001-dispute-valid-block.zndsl │ └── src │ │ ├── interceptor.rs │ │ ├── malus.rs │ │ ├── shared.rs │ │ ├── tests.rs │ │ └── variants │ │ ├── back_garbage_candidate.rs │ │ ├── common.rs │ │ ├── dispute_valid_candidates.rs │ │ ├── mod.rs │ │ └── suggest_garbage_candidate.rs ├── metrics │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── lib.rs │ │ ├── metronome.rs │ │ ├── runtime │ │ ├── mod.rs │ │ └── parachain.rs │ │ └── tests.rs ├── network │ ├── README.md │ ├── approval-distribution │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── availability-distribution │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── pov_requester │ │ │ └── mod.rs │ │ │ ├── requester │ │ │ ├── fetch_task │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── mod.rs │ │ │ ├── session_cache.rs │ │ │ └── tests.rs │ │ │ ├── responder.rs │ │ │ └── tests │ │ │ ├── mock.rs │ │ │ ├── mod.rs │ │ │ └── state.rs │ ├── availability-recovery │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── error.rs │ │ │ ├── futures_undead.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── bitfield-distribution │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── bridge │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── errors.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── network.rs │ │ │ ├── rx │ │ │ ├── mod.rs │ │ │ └── tests.rs │ │ │ ├── tx │ │ │ ├── mod.rs │ │ │ └── tests.rs │ │ │ └── validator_discovery.rs │ ├── collator-protocol │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── collator_side │ │ │ ├── collation.rs │ │ │ ├── metrics.rs │ │ │ ├── mod.rs │ │ │ ├── tests │ │ │ │ ├── mod.rs │ │ │ │ └── prospective_parachains.rs │ │ │ └── validators_buffer.rs │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ └── validator_side │ │ │ ├── collation.rs │ │ │ ├── metrics.rs │ │ │ ├── mod.rs │ │ │ └── tests │ │ │ ├── mod.rs │ │ │ └── prospective_parachains.rs │ ├── dispute-distribution │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── receiver │ │ │ ├── batches │ │ │ │ ├── batch.rs │ │ │ │ ├── mod.rs │ │ │ │ └── waiting_queue.rs │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ └── peer_queues.rs │ │ │ ├── sender │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ └── send_task.rs │ │ │ └── tests │ │ │ ├── mock.rs │ │ │ └── mod.rs │ ├── gossip-support │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── tests.rs │ ├── protocol │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── authority_discovery.rs │ │ │ ├── grid_topology.rs │ │ │ ├── lib.rs │ │ │ ├── peer_set.rs │ │ │ ├── reputation.rs │ │ │ └── request_response │ │ │ ├── incoming │ │ │ ├── error.rs │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── outgoing.rs │ │ │ ├── v1.rs │ │ │ └── vstaging.rs │ └── statement-distribution │ │ ├── Cargo.toml │ │ └── src │ │ ├── error.rs │ │ ├── legacy_v1 │ │ ├── mod.rs │ │ ├── requester.rs │ │ ├── responder.rs │ │ └── tests.rs │ │ ├── lib.rs │ │ ├── metrics.rs │ │ └── vstaging │ │ ├── candidates.rs │ │ ├── cluster.rs │ │ ├── grid.rs │ │ ├── groups.rs │ │ ├── mod.rs │ │ ├── requests.rs │ │ ├── statement_store.rs │ │ └── tests │ │ ├── cluster.rs │ │ ├── grid.rs │ │ ├── mod.rs │ │ └── requests.rs ├── overseer │ ├── Cargo.toml │ ├── examples │ │ └── minimal-example.rs │ └── src │ │ ├── dummy.rs │ │ ├── lib.rs │ │ ├── memory_stats.rs │ │ ├── metrics.rs │ │ └── tests.rs ├── primitives │ ├── Cargo.toml │ └── src │ │ ├── approval.rs │ │ ├── disputes │ │ ├── message.rs │ │ ├── mod.rs │ │ └── status.rs │ │ └── lib.rs ├── service │ ├── Cargo.toml │ ├── README.adoc │ ├── chain-specs │ │ ├── .gitignore │ │ ├── kusama.json │ │ ├── polkadot.json │ │ ├── rococo.json │ │ ├── westend.json │ │ └── wococo.json │ └── src │ │ ├── benchmarking.rs │ │ ├── chain_spec.rs │ │ ├── fake_runtime_api.rs │ │ ├── grandpa_support.rs │ │ ├── lib.rs │ │ ├── overseer.rs │ │ ├── parachains_db │ │ ├── mod.rs │ │ └── upgrade.rs │ │ ├── relay_chain_selection.rs │ │ ├── tests.rs │ │ └── workers.rs ├── subsystem-test-helpers │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── mock.rs ├── subsystem-types │ ├── Cargo.toml │ └── src │ │ ├── errors.rs │ │ ├── lib.rs │ │ ├── messages.rs │ │ ├── messages │ │ └── network_bridge_event.rs │ │ └── runtime_client.rs ├── subsystem-util │ ├── Cargo.toml │ └── src │ │ ├── backing_implicit_view.rs │ │ ├── database.rs │ │ ├── determine_new_blocks.rs │ │ ├── inclusion_emulator │ │ ├── mod.rs │ │ └── staging.rs │ │ ├── lib.rs │ │ ├── nesting_sender.rs │ │ ├── reputation.rs │ │ ├── runtime │ │ ├── error.rs │ │ └── mod.rs │ │ └── tests.rs ├── subsystem │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── test │ ├── client │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── block_builder.rs │ │ │ └── lib.rs │ ├── performance-test │ │ ├── Cargo.toml │ │ ├── build.rs │ │ └── src │ │ │ ├── constants.rs │ │ │ ├── gen_ref_constants.rs │ │ │ └── lib.rs │ └── service │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── src │ │ ├── chain_spec.rs │ │ └── lib.rs │ │ └── tests │ │ ├── build-blocks.rs │ │ └── call-function.rs └── zombienet-backchannel │ ├── Cargo.toml │ └── src │ ├── errors.rs │ └── lib.rs ├── parachain ├── Cargo.toml ├── README.adoc ├── src │ ├── lib.rs │ ├── primitives.rs │ └── wasm_api.rs └── test-parachains │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── adder │ ├── Cargo.toml │ ├── build.rs │ ├── collator │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── bin │ │ │ └── puppet_worker.rs │ │ ├── src │ │ │ ├── cli.rs │ │ │ ├── lib.rs │ │ │ └── main.rs │ │ └── tests │ │ │ └── integration.rs │ └── src │ │ ├── lib.rs │ │ └── wasm_validation.rs │ ├── halt │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ └── lib.rs │ ├── src │ └── lib.rs │ └── undying │ ├── Cargo.toml │ ├── build.rs │ ├── collator │ ├── Cargo.toml │ ├── bin │ │ └── puppet_worker.rs │ ├── src │ │ ├── cli.rs │ │ ├── lib.rs │ │ └── main.rs │ └── tests │ │ └── integration.rs │ └── src │ ├── lib.rs │ └── wasm_validation.rs ├── primitives ├── Cargo.toml ├── README.adoc ├── src │ ├── lib.rs │ ├── runtime_api.rs │ ├── v5 │ │ ├── executor_params.rs │ │ ├── metrics.rs │ │ ├── mod.rs │ │ ├── signed.rs │ │ └── slashing.rs │ └── vstaging │ │ └── mod.rs └── test-helpers │ ├── Cargo.toml │ └── src │ └── lib.rs ├── roadmap ├── implementers-guide │ ├── .gitignore │ ├── README.md │ ├── book.toml │ ├── last-changed.css │ ├── mermaid-init.js │ ├── mermaid.min.js │ └── src │ │ ├── README.md │ │ ├── SUMMARY.md │ │ ├── architecture.md │ │ ├── disputes-flow.md │ │ ├── further-reading.md │ │ ├── glossary.md │ │ ├── messaging.md │ │ ├── node │ │ ├── README.md │ │ ├── approval │ │ │ ├── README.md │ │ │ ├── approval-distribution.md │ │ │ └── approval-voting.md │ │ ├── availability │ │ │ ├── README.md │ │ │ ├── availability-distribution.md │ │ │ ├── availability-recovery.md │ │ │ ├── bitfield-distribution.md │ │ │ └── bitfield-signing.md │ │ ├── backing │ │ │ ├── README.md │ │ │ ├── candidate-backing.md │ │ │ ├── pov-distribution.md │ │ │ ├── prospective-parachains.md │ │ │ ├── statement-distribution-legacy.md │ │ │ └── statement-distribution.md │ │ ├── collators │ │ │ ├── README.md │ │ │ ├── collation-generation.md │ │ │ └── collator-protocol.md │ │ ├── disputes │ │ │ ├── README.md │ │ │ ├── dispute-coordinator.md │ │ │ └── dispute-distribution.md │ │ ├── grandpa-voting-rule.md │ │ ├── overseer.md │ │ ├── subsystems-and-jobs.md │ │ └── utility │ │ │ ├── README.md │ │ │ ├── availability-store.md │ │ │ ├── candidate-validation.md │ │ │ ├── chain-api.md │ │ │ ├── chain-selection.md │ │ │ ├── gossip-support.md │ │ │ ├── network-bridge.md │ │ │ ├── peer-set-manager.md │ │ │ ├── provisioner.md │ │ │ ├── pvf-host-and-workers.md │ │ │ ├── pvf-prechecker.md │ │ │ └── runtime-api.md │ │ ├── protocol-approval.md │ │ ├── protocol-chain-selection.md │ │ ├── protocol-disputes.md │ │ ├── protocol-overview.md │ │ ├── pvf-prechecking.md │ │ ├── runtime-api │ │ ├── README.md │ │ ├── availability-cores.md │ │ ├── candidate-events.md │ │ ├── candidate-pending-availability.md │ │ ├── candidates-included.md │ │ ├── disputes-info.md │ │ ├── persisted-validation-data.md │ │ ├── pvf-prechecking.md │ │ ├── session-index.md │ │ ├── validation-code.md │ │ ├── validator-groups.md │ │ └── validators.md │ │ ├── runtime │ │ ├── README.md │ │ ├── configuration.md │ │ ├── disputes.md │ │ ├── dmp.md │ │ ├── hrmp.md │ │ ├── inclusion.md │ │ ├── initializer.md │ │ ├── parainherent.md │ │ ├── paras.md │ │ ├── scheduler.md │ │ ├── session_info.md │ │ └── shared.md │ │ ├── types │ │ ├── README.md │ │ ├── approval.md │ │ ├── availability.md │ │ ├── backing.md │ │ ├── candidate.md │ │ ├── disputes.md │ │ ├── messages.md │ │ ├── network.md │ │ ├── overseer-protocol.md │ │ ├── pvf-prechecking.md │ │ └── runtime.md │ │ └── whence-parachains.md ├── parachains.md ├── phase-1.png ├── phase-1.toml └── render.sh ├── rpc ├── Cargo.toml └── src │ └── lib.rs ├── runtime ├── common │ ├── Cargo.toml │ ├── slot_range_helper │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── src │ │ ├── assigned_slots │ │ ├── benchmarking.rs │ │ ├── migration.rs │ │ └── mod.rs │ │ ├── auctions.rs │ │ ├── claims.rs │ │ ├── crowdloan │ │ ├── migration.rs │ │ └── mod.rs │ │ ├── elections.rs │ │ ├── impls.rs │ │ ├── integration_tests.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── paras_registrar.rs │ │ ├── paras_sudo_wrapper.rs │ │ ├── purchase.rs │ │ ├── slot_range.rs │ │ ├── slots │ │ ├── migration.rs │ │ └── mod.rs │ │ ├── traits.rs │ │ ├── try_runtime.rs │ │ └── xcm_sender.rs ├── kusama │ ├── Cargo.toml │ ├── build.rs │ ├── constants │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── weights │ │ │ ├── block_weights.rs │ │ │ ├── extrinsic_weights.rs │ │ │ ├── mod.rs │ │ │ ├── paritydb_weights.rs │ │ │ └── rocksdb_weights.rs │ └── src │ │ ├── bag_thresholds.rs │ │ ├── governance │ │ ├── fellowship.rs │ │ ├── mod.rs │ │ ├── origins.rs │ │ └── tracks.rs │ │ ├── lib.rs │ │ ├── past_payouts.rs │ │ ├── tests.rs │ │ ├── weights │ │ ├── frame_benchmarking_baseline.rs │ │ ├── frame_election_provider_support.rs │ │ ├── frame_system.rs │ │ ├── mod.rs │ │ ├── pallet_bags_list.rs │ │ ├── pallet_balances.rs │ │ ├── pallet_balances_balances.rs │ │ ├── pallet_balances_nis_counterpart_balances.rs │ │ ├── pallet_bounties.rs │ │ ├── pallet_child_bounties.rs │ │ ├── pallet_collective_council.rs │ │ ├── pallet_collective_technical_committee.rs │ │ ├── pallet_conviction_voting.rs │ │ ├── pallet_democracy.rs │ │ ├── pallet_election_provider_multi_phase.rs │ │ ├── pallet_elections_phragmen.rs │ │ ├── pallet_fast_unstake.rs │ │ ├── pallet_identity.rs │ │ ├── pallet_im_online.rs │ │ ├── pallet_indices.rs │ │ ├── pallet_membership.rs │ │ ├── pallet_message_queue.rs │ │ ├── pallet_multisig.rs │ │ ├── pallet_nis.rs │ │ ├── pallet_nomination_pools.rs │ │ ├── pallet_offences.rs │ │ ├── pallet_preimage.rs │ │ ├── pallet_proxy.rs │ │ ├── pallet_ranked_collective.rs │ │ ├── pallet_recovery.rs │ │ ├── pallet_referenda_fellowship_referenda.rs │ │ ├── pallet_referenda_referenda.rs │ │ ├── pallet_scheduler.rs │ │ ├── pallet_session.rs │ │ ├── pallet_society.rs │ │ ├── pallet_staking.rs │ │ ├── pallet_timestamp.rs │ │ ├── pallet_tips.rs │ │ ├── pallet_treasury.rs │ │ ├── pallet_utility.rs │ │ ├── pallet_vesting.rs │ │ ├── pallet_whitelist.rs │ │ ├── pallet_xcm.rs │ │ ├── runtime_common_auctions.rs │ │ ├── runtime_common_claims.rs │ │ ├── runtime_common_crowdloan.rs │ │ ├── runtime_common_paras_registrar.rs │ │ ├── runtime_common_slots.rs │ │ ├── runtime_parachains_configuration.rs │ │ ├── runtime_parachains_disputes.rs │ │ ├── runtime_parachains_disputes_slashing.rs │ │ ├── runtime_parachains_hrmp.rs │ │ ├── runtime_parachains_inclusion.rs │ │ ├── runtime_parachains_initializer.rs │ │ ├── runtime_parachains_paras.rs │ │ ├── runtime_parachains_paras_inherent.rs │ │ └── xcm │ │ │ ├── mod.rs │ │ │ ├── pallet_xcm_benchmarks_fungible.rs │ │ │ └── pallet_xcm_benchmarks_generic.rs │ │ └── xcm_config.rs ├── metrics │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── with_runtime_metrics.rs │ │ └── without_runtime_metrics.rs ├── parachains │ ├── Cargo.toml │ └── src │ │ ├── assigner.rs │ │ ├── assigner_on_demand │ │ ├── benchmarking.rs │ │ ├── mock_helpers.rs │ │ ├── mod.rs │ │ └── tests.rs │ │ ├── assigner_parachains.rs │ │ ├── builder.rs │ │ ├── configuration.rs │ │ ├── configuration │ │ ├── benchmarking.rs │ │ ├── migration.rs │ │ ├── migration │ │ │ ├── v6.rs │ │ │ ├── v7.rs │ │ │ └── v8.rs │ │ └── tests.rs │ │ ├── disputes.rs │ │ ├── disputes │ │ ├── benchmarking.rs │ │ ├── migration.rs │ │ ├── slashing.rs │ │ ├── slashing │ │ │ └── benchmarking.rs │ │ └── tests.rs │ │ ├── dmp.rs │ │ ├── dmp │ │ └── tests.rs │ │ ├── hrmp.rs │ │ ├── hrmp │ │ ├── benchmarking.rs │ │ └── tests.rs │ │ ├── inclusion │ │ ├── benchmarking.rs │ │ ├── mod.rs │ │ └── tests.rs │ │ ├── initializer.rs │ │ ├── initializer │ │ ├── benchmarking.rs │ │ └── tests.rs │ │ ├── lib.rs │ │ ├── metrics.rs │ │ ├── mock.rs │ │ ├── origin.rs │ │ ├── paras │ │ ├── benchmarking.rs │ │ ├── benchmarking │ │ │ └── pvf_check.rs │ │ ├── mod.rs │ │ └── tests.rs │ │ ├── paras_inherent │ │ ├── benchmarking.rs │ │ ├── misc.rs │ │ ├── mod.rs │ │ ├── tests.rs │ │ └── weights.rs │ │ ├── reward_points.rs │ │ ├── runtime_api_impl │ │ ├── mod.rs │ │ ├── v5.rs │ │ └── vstaging.rs │ │ ├── scheduler.rs │ │ ├── scheduler │ │ ├── common.rs │ │ ├── migration.rs │ │ └── tests.rs │ │ ├── session_info.rs │ │ ├── session_info │ │ ├── migration.rs │ │ └── tests.rs │ │ ├── shared.rs │ │ ├── shared │ │ └── tests.rs │ │ ├── ump_tests.rs │ │ └── util.rs ├── polkadot │ ├── Cargo.toml │ ├── README.adoc │ ├── build.rs │ ├── constants │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── weights │ │ │ ├── block_weights.rs │ │ │ ├── extrinsic_weights.rs │ │ │ ├── mod.rs │ │ │ ├── paritydb_weights.rs │ │ │ └── rocksdb_weights.rs │ └── src │ │ ├── bag_thresholds.rs │ │ ├── governance │ │ ├── mod.rs │ │ ├── origins.rs │ │ └── tracks.rs │ │ ├── lib.rs │ │ ├── weights │ │ ├── frame_benchmarking_baseline.rs │ │ ├── frame_election_provider_support.rs │ │ ├── frame_system.rs │ │ ├── mod.rs │ │ ├── pallet_bags_list.rs │ │ ├── pallet_balances.rs │ │ ├── pallet_bounties.rs │ │ ├── pallet_child_bounties.rs │ │ ├── pallet_collective_council.rs │ │ ├── pallet_collective_technical_committee.rs │ │ ├── pallet_conviction_voting.rs │ │ ├── pallet_democracy.rs │ │ ├── pallet_election_provider_multi_phase.rs │ │ ├── pallet_elections_phragmen.rs │ │ ├── pallet_fast_unstake.rs │ │ ├── pallet_identity.rs │ │ ├── pallet_im_online.rs │ │ ├── pallet_indices.rs │ │ ├── pallet_membership.rs │ │ ├── pallet_message_queue.rs │ │ ├── pallet_multisig.rs │ │ ├── pallet_nomination_pools.rs │ │ ├── pallet_offences.rs │ │ ├── pallet_preimage.rs │ │ ├── pallet_proxy.rs │ │ ├── pallet_referenda.rs │ │ ├── pallet_scheduler.rs │ │ ├── pallet_session.rs │ │ ├── pallet_staking.rs │ │ ├── pallet_timestamp.rs │ │ ├── pallet_tips.rs │ │ ├── pallet_treasury.rs │ │ ├── pallet_utility.rs │ │ ├── pallet_vesting.rs │ │ ├── pallet_whitelist.rs │ │ ├── pallet_xcm.rs │ │ ├── runtime_common_auctions.rs │ │ ├── runtime_common_claims.rs │ │ ├── runtime_common_crowdloan.rs │ │ ├── runtime_common_paras_registrar.rs │ │ ├── runtime_common_slots.rs │ │ ├── runtime_parachains_configuration.rs │ │ ├── runtime_parachains_disputes.rs │ │ ├── runtime_parachains_disputes_slashing.rs │ │ ├── runtime_parachains_hrmp.rs │ │ ├── runtime_parachains_inclusion.rs │ │ ├── runtime_parachains_initializer.rs │ │ ├── runtime_parachains_paras.rs │ │ ├── runtime_parachains_paras_inherent.rs │ │ └── xcm │ │ │ ├── mod.rs │ │ │ ├── pallet_xcm_benchmarks_fungible.rs │ │ │ └── pallet_xcm_benchmarks_generic.rs │ │ └── xcm_config.rs ├── rococo │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── constants │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── weights │ │ │ ├── block_weights.rs │ │ │ ├── extrinsic_weights.rs │ │ │ ├── mod.rs │ │ │ ├── paritydb_weights.rs │ │ │ └── rocksdb_weights.rs │ └── src │ │ ├── lib.rs │ │ ├── validator_manager.rs │ │ ├── weights │ │ ├── frame_benchmarking_baseline.rs │ │ ├── frame_system.rs │ │ ├── mod.rs │ │ ├── pallet_balances.rs │ │ ├── pallet_balances_nis_counterpart_balances.rs │ │ ├── pallet_bounties.rs │ │ ├── pallet_child_bounties.rs │ │ ├── pallet_collective.rs │ │ ├── pallet_collective_council.rs │ │ ├── pallet_collective_technical_committee.rs │ │ ├── pallet_democracy.rs │ │ ├── pallet_elections_phragmen.rs │ │ ├── pallet_identity.rs │ │ ├── pallet_im_online.rs │ │ ├── pallet_indices.rs │ │ ├── pallet_membership.rs │ │ ├── pallet_message_queue.rs │ │ ├── pallet_multisig.rs │ │ ├── pallet_nis.rs │ │ ├── pallet_preimage.rs │ │ ├── pallet_proxy.rs │ │ ├── pallet_scheduler.rs │ │ ├── pallet_session.rs │ │ ├── pallet_sudo.rs │ │ ├── pallet_timestamp.rs │ │ ├── pallet_tips.rs │ │ ├── pallet_treasury.rs │ │ ├── pallet_utility.rs │ │ ├── pallet_vesting.rs │ │ ├── pallet_xcm.rs │ │ ├── runtime_common_assigned_slots.rs │ │ ├── runtime_common_auctions.rs │ │ ├── runtime_common_claims.rs │ │ ├── runtime_common_crowdloan.rs │ │ ├── runtime_common_paras_registrar.rs │ │ ├── runtime_common_slots.rs │ │ ├── runtime_parachains_assigner_on_demand.rs │ │ ├── runtime_parachains_configuration.rs │ │ ├── runtime_parachains_disputes.rs │ │ ├── runtime_parachains_hrmp.rs │ │ ├── runtime_parachains_inclusion.rs │ │ ├── runtime_parachains_initializer.rs │ │ ├── runtime_parachains_paras.rs │ │ ├── runtime_parachains_paras_inherent.rs │ │ └── xcm │ │ │ ├── mod.rs │ │ │ ├── pallet_xcm_benchmarks_fungible.rs │ │ │ └── pallet_xcm_benchmarks_generic.rs │ │ └── xcm_config.rs ├── test-runtime │ ├── Cargo.toml │ ├── build.rs │ ├── constants │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── weights │ │ │ ├── block_weights.rs │ │ │ ├── extrinsic_weights.rs │ │ │ ├── mod.rs │ │ │ ├── paritydb_weights.rs │ │ │ └── rocksdb_weights.rs │ └── src │ │ ├── lib.rs │ │ └── xcm_config.rs └── westend │ ├── Cargo.toml │ ├── build.rs │ ├── constants │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── weights │ │ ├── block_weights.rs │ │ ├── extrinsic_weights.rs │ │ ├── mod.rs │ │ ├── paritydb_weights.rs │ │ └── rocksdb_weights.rs │ └── src │ ├── bag_thresholds.rs │ ├── lib.rs │ ├── tests.rs │ ├── weights │ ├── frame_election_provider_support.rs │ ├── frame_system.rs │ ├── mod.rs │ ├── pallet_bags_list.rs │ ├── pallet_balances.rs │ ├── pallet_election_provider_multi_phase.rs │ ├── pallet_fast_unstake.rs │ ├── pallet_identity.rs │ ├── pallet_im_online.rs │ ├── pallet_indices.rs │ ├── pallet_message_queue.rs │ ├── pallet_multisig.rs │ ├── pallet_nomination_pools.rs │ ├── pallet_offences.rs │ ├── pallet_preimage.rs │ ├── pallet_proxy.rs │ ├── pallet_recovery.rs │ ├── pallet_scheduler.rs │ ├── pallet_session.rs │ ├── pallet_staking.rs │ ├── pallet_sudo.rs │ ├── pallet_timestamp.rs │ ├── pallet_utility.rs │ ├── pallet_vesting.rs │ ├── pallet_xcm.rs │ ├── runtime_common_assigned_slots.rs │ ├── runtime_common_auctions.rs │ ├── runtime_common_crowdloan.rs │ ├── runtime_common_paras_registrar.rs │ ├── runtime_common_slots.rs │ ├── runtime_parachains_configuration.rs │ ├── runtime_parachains_disputes.rs │ ├── runtime_parachains_disputes_slashing.rs │ ├── runtime_parachains_hrmp.rs │ ├── runtime_parachains_inclusion.rs │ ├── runtime_parachains_initializer.rs │ ├── runtime_parachains_paras.rs │ ├── runtime_parachains_paras_inherent.rs │ └── xcm │ │ ├── mod.rs │ │ ├── pallet_xcm_benchmarks_fungible.rs │ │ └── pallet_xcm_benchmarks_generic.rs │ └── xcm_config.rs ├── rustfmt.toml ├── scripts ├── adder-collator.sh ├── build-demos.sh ├── build-only-wasm.sh ├── ci │ ├── changelog │ │ ├── .gitignore │ │ ├── Gemfile │ │ ├── Gemfile.lock │ │ ├── README.md │ │ ├── bin │ │ │ └── changelog │ │ ├── digests │ │ │ ├── .gitignore │ │ │ └── .gitkeep │ │ ├── lib │ │ │ └── changelog.rb │ │ ├── templates │ │ │ ├── _free_notes.md.tera │ │ │ ├── change.md.tera │ │ │ ├── changes.md.tera │ │ │ ├── changes_api.md.tera │ │ │ ├── changes_client.md.tera │ │ │ ├── changes_misc.md.tera │ │ │ ├── changes_runtime.md.tera │ │ │ ├── compiler.md.tera │ │ │ ├── debug.md.tera │ │ │ ├── docker_image.md.tera │ │ │ ├── full_pr_list.md.tera │ │ │ ├── global_priority.md.tera │ │ │ ├── high_priority.md.tera │ │ │ ├── host_functions-list.md.tera │ │ │ ├── host_functions.md.tera │ │ │ ├── migrations-db.md.tera │ │ │ ├── migrations-runtime.md.tera │ │ │ ├── pre_release.md.tera │ │ │ ├── runtime.md.tera │ │ │ ├── runtimes.md.tera │ │ │ └── template.md.tera │ │ └── test │ │ │ └── test_basic.rb │ ├── common │ │ └── lib.sh │ ├── dockerfiles │ │ ├── adder-collator │ │ │ ├── build-injected.sh │ │ │ └── test-build.sh │ │ ├── binary_injected.Dockerfile │ │ ├── build-injected.sh │ │ ├── entrypoint.sh │ │ ├── malus │ │ │ ├── build-injected.sh │ │ │ └── test-build.sh │ │ ├── polkadot │ │ │ ├── README.md │ │ │ ├── build-injected.sh │ │ │ ├── docker-compose-local.yml │ │ │ ├── docker-compose.yml │ │ │ ├── polkadot_Dockerfile.README.md │ │ │ ├── polkadot_builder.Dockerfile │ │ │ ├── polkadot_injected_debian.Dockerfile │ │ │ └── test-build.sh │ │ └── staking-miner │ │ │ ├── README.md │ │ │ ├── build-injected.sh │ │ │ ├── build.sh │ │ │ ├── staking-miner_Dockerfile.README.md │ │ │ ├── staking-miner_builder.Dockerfile │ │ │ └── test-build.sh │ ├── github │ │ ├── check-rel-br │ │ ├── check_bootnodes.sh │ │ ├── check_labels.sh │ │ ├── check_new_bootnodes.sh │ │ ├── check_weights_swc.sh │ │ ├── extrinsic-ordering-filter.sh │ │ ├── generate_release_text.rb │ │ ├── lib.rb │ │ ├── polkadot_release.erb │ │ ├── run_fuzzer.sh │ │ └── verify_updated_weights.sh │ ├── gitlab │ │ ├── check_extrinsics_ordering.sh │ │ ├── check_runtime.sh │ │ ├── lingua.dic │ │ ├── pipeline │ │ │ ├── build.yml │ │ │ ├── check.yml │ │ │ ├── publish.yml │ │ │ ├── short-benchmarks.yml │ │ │ ├── test.yml │ │ │ ├── weights.yml │ │ │ └── zombienet.yml │ │ ├── prettier.sh │ │ ├── spellcheck.toml │ │ └── test_deterministic_wasm.sh │ └── run_benches_for_runtime.sh ├── common.sh ├── init.sh ├── packaging │ ├── deb-maintainer-scripts │ │ └── postinst │ └── polkadot.service ├── prepare-test-net.sh ├── release.sh ├── run_all_benches.sh ├── two-node-local-net.sh └── update-rust-stable.sh ├── src ├── README.adoc ├── bin │ ├── execute-worker.rs │ └── prepare-worker.rs └── main.rs ├── statement-table ├── Cargo.toml ├── README.adoc └── src │ ├── generic.rs │ └── lib.rs ├── tests ├── benchmark_block.rs ├── benchmark_extrinsic.rs ├── benchmark_overhead.rs ├── benchmark_storage_works.rs ├── common.rs ├── invalid_order_arguments.rs ├── purge_chain_works.rs ├── running_the_node_and_interrupt.rs └── workers.rs ├── utils ├── generate-bags │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── remote-ext-tests │ └── bags-list │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src │ │ └── main.rs └── staking-miner │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── src │ ├── dry_run.rs │ ├── emergency_solution.rs │ ├── main.rs │ ├── monitor.rs │ ├── opts.rs │ ├── prelude.rs │ ├── rpc.rs │ ├── runtime_versions.rs │ └── signer.rs │ └── tests │ └── cli.rs ├── xcm ├── Cargo.toml ├── pallet-xcm-benchmarks │ ├── Cargo.toml │ ├── src │ │ ├── fungible │ │ │ ├── benchmarking.rs │ │ │ ├── mock.rs │ │ │ └── mod.rs │ │ ├── generic │ │ │ ├── benchmarking.rs │ │ │ ├── mock.rs │ │ │ └── mod.rs │ │ ├── lib.rs │ │ └── mock.rs │ └── template.hbs ├── pallet-xcm │ ├── Cargo.toml │ └── src │ │ ├── benchmarking.rs │ │ ├── lib.rs │ │ ├── migration.rs │ │ ├── mock.rs │ │ └── tests.rs ├── procedural │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── v2.rs │ │ ├── v3.rs │ │ └── weight_info.rs ├── src │ ├── double_encoded.rs │ ├── lib.rs │ ├── tests.rs │ ├── v2 │ │ ├── junction.rs │ │ ├── mod.rs │ │ ├── multiasset.rs │ │ ├── multilocation.rs │ │ └── traits.rs │ └── v3 │ │ ├── junction.rs │ │ ├── junctions.rs │ │ ├── mod.rs │ │ ├── multiasset.rs │ │ ├── multilocation.rs │ │ └── traits.rs ├── xcm-builder │ ├── Cargo.toml │ ├── src │ │ ├── asset_conversion.rs │ │ ├── barriers.rs │ │ ├── currency_adapter.rs │ │ ├── filter_asset_location.rs │ │ ├── fungibles_adapter.rs │ │ ├── lib.rs │ │ ├── location_conversion.rs │ │ ├── matcher.rs │ │ ├── matches_token.rs │ │ ├── nonfungibles_adapter.rs │ │ ├── origin_aliases.rs │ │ ├── origin_conversion.rs │ │ ├── pay.rs │ │ ├── process_xcm_message.rs │ │ ├── routing.rs │ │ ├── test_utils.rs │ │ ├── tests │ │ │ ├── aliases.rs │ │ │ ├── assets.rs │ │ │ ├── barriers.rs │ │ │ ├── basic.rs │ │ │ ├── bridging │ │ │ │ ├── local_para_para.rs │ │ │ │ ├── local_relay_relay.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── paid_remote_relay_relay.rs │ │ │ │ ├── remote_para_para.rs │ │ │ │ ├── remote_para_para_via_relay.rs │ │ │ │ └── remote_relay_relay.rs │ │ │ ├── expecting.rs │ │ │ ├── locking.rs │ │ │ ├── mock.rs │ │ │ ├── mod.rs │ │ │ ├── origins.rs │ │ │ ├── pay │ │ │ │ ├── mock.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── pay.rs │ │ │ │ └── salary.rs │ │ │ ├── querying.rs │ │ │ ├── transacting.rs │ │ │ ├── version_subscriptions.rs │ │ │ └── weight.rs │ │ ├── universal_exports.rs │ │ └── weight.rs │ └── tests │ │ ├── mock │ │ └── mod.rs │ │ └── scenarios.rs ├── xcm-executor │ ├── Cargo.toml │ ├── integration-tests │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── src │ │ ├── assets.rs │ │ ├── config.rs │ │ ├── lib.rs │ │ └── traits │ │ ├── asset_exchange.rs │ │ ├── asset_lock.rs │ │ ├── conversion.rs │ │ ├── drop_assets.rs │ │ ├── export.rs │ │ ├── fee_manager.rs │ │ ├── filter_asset_location.rs │ │ ├── mod.rs │ │ ├── on_response.rs │ │ ├── should_execute.rs │ │ ├── token_matching.rs │ │ ├── transact_asset.rs │ │ └── weight.rs └── xcm-simulator │ ├── Cargo.toml │ ├── example │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── parachain.rs │ │ └── relay_chain.rs │ ├── fuzzer │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── fuzz.rs │ │ ├── parachain.rs │ │ └── relay_chain.rs │ └── src │ └── lib.rs └── zombienet_tests ├── .set_env ├── README.md ├── async_backing ├── 001-async-backing-compatibility.toml ├── 001-async-backing-compatibility.zndsl ├── 002-async-backing-runtime-upgrade.toml ├── 002-async-backing-runtime-upgrade.zndsl ├── 003-async-backing-collator-mix.toml ├── 003-async-backing-collator-mix.zndsl └── README.md ├── functional ├── 0001-parachains-pvf.toml ├── 0001-parachains-pvf.zndsl ├── 0002-parachains-disputes.toml ├── 0002-parachains-disputes.zndsl ├── 0003-beefy-and-mmr.toml ├── 0003-beefy-and-mmr.zndsl ├── 0003-beefy-finalized-heads.js ├── 0003-common.js ├── 0003-mmr-generate-and-verify-proof.js ├── 0003-mmr-leaves.js ├── 0003-parachains-garbage-candidate.toml ├── 0003-parachains-garbage-candidate.zndsl ├── 0004-parachains-disputes-past-session.toml └── 0004-parachains-disputes-past-session.zndsl ├── misc ├── 0001-check_paritydb.sh ├── 0001-paritydb.toml ├── 0001-paritydb.zndsl ├── 0002-download-polkadot-from-pr.sh ├── 0002-upgrade-node.toml ├── 0002-upgrade-node.zndsl └── 0003-parathreads.toml └── smoke ├── 0001-parachains-smoke-test.toml ├── 0001-parachains-smoke-test.zndsl ├── 0002-parachains-upgrade-smoke-test.toml ├── 0002-parachains-upgrade-smoke-test.zndsl ├── 0003-deregister-register-validator-smoke.toml ├── 0003-deregister-register-validator-smoke.zndsl └── 0003-deregister-register-validator.js /.dockerignore: -------------------------------------------------------------------------------- 1 | doc 2 | **/target 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.rs] 4 | indent_style=tab 5 | indent_size=tab 6 | tab_width=4 7 | max_line_length=120 8 | end_of_line=lf 9 | charset=utf-8 10 | trim_trailing_whitespace=true 11 | insert_final_newline=true 12 | 13 | [*.yml] 14 | indent_style=space 15 | indent_size=2 16 | tab_width=8 17 | end_of_line=lf 18 | charset=utf-8 19 | trim_trailing_whitespace=true 20 | insert_final_newline=true 21 | 22 | [*.sh] 23 | indent_style=space 24 | indent_size=2 25 | tab_width=8 26 | end_of_line=lf 27 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /.gitlab-ci.yml filter=ci-prettier 2 | /scripts/ci/gitlab/pipeline/*.yml filter=ci-prettier 3 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # CI 2 | /.github/ @paritytech/ci @chevdor 3 | /scripts/ci/ @paritytech/ci @chevdor 4 | /.gitlab-ci.yml @paritytech/ci 5 | # lingua.dic is not managed by CI team 6 | /scripts/ci/gitlab/lingua.dic 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | - It would help if you submit info about the system you are running, e.g.: operating system, kernel version, amount of available memory and swap, etc. 11 | - Logs could be very helpful. If possible, submit the whole log. Please format it as ```code blocks```. 12 | - Describe the role your node plays, e.g. validator, full node or light client. 13 | - Any command-line options were passed? 14 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "cargo" 4 | directory: "/" 5 | labels: ["A2-insubstantial", "B0-silent", "C1-low", "E2-dependencies"] 6 | # Handle updates for crates from github.com/paritytech/substrate manually. 7 | ignore: 8 | - dependency-name: "substrate-*" 9 | - dependency-name: "sc-*" 10 | - dependency-name: "sp-*" 11 | - dependency-name: "frame-*" 12 | - dependency-name: "fork-tree" 13 | - dependency-name: "frame-remote-externalities" 14 | - dependency-name: "pallet-*" 15 | - dependency-name: "beefy-*" 16 | - dependency-name: "try-runtime-*" 17 | - dependency-name: "test-runner" 18 | - dependency-name: "generate-bags" 19 | - dependency-name: "sub-tokens" 20 | schedule: 21 | interval: "daily" 22 | - package-ecosystem: github-actions 23 | directory: '/' 24 | labels: ["A2-insubstantial", "B0-silent", "C1-low", "E2-dependencies"] 25 | schedule: 26 | interval: daily 27 | -------------------------------------------------------------------------------- /.github/pr-custom-review.yml: -------------------------------------------------------------------------------- 1 | # 🔒 PROTECTED: Changes to locks-review-team should be approved by the current locks-review-team 2 | locks-review-team: locks-review 3 | team-leads-team: polkadot-review 4 | action-review-team: ci 5 | 6 | rules: 7 | - name: Runtime files 8 | check_type: changed_files 9 | condition: 10 | include: ^runtime\/(kusama|polkadot)\/src\/.+\.rs$ 11 | exclude: ^runtime\/(kusama|polkadot)\/src\/weights\/.+\.rs$ 12 | all_distinct: 13 | - min_approvals: 1 14 | teams: 15 | - locks-review 16 | - min_approvals: 1 17 | teams: 18 | - polkadot-review 19 | 20 | - name: Core developers 21 | check_type: changed_files 22 | condition: 23 | include: .* 24 | # excluding files from 'Runtime files' and 'CI files' rules 25 | exclude: ^runtime/(kusama|polkadot)/src/[^/]+\.rs$|^\.gitlab-ci\.yml|^(?!.*\.dic$|.*spellcheck\.toml$)scripts/ci/.*|^\.github/.* 26 | min_approvals: 3 27 | teams: 28 | - core-devs 29 | 30 | - name: CI files 31 | check_type: changed_files 32 | condition: 33 | # dictionary files are excluded 34 | include: ^\.gitlab-ci\.yml|^(?!.*\.dic$|.*spellcheck\.toml$)scripts/ci/.*|^\.github/.* 35 | min_approvals: 2 36 | teams: 37 | - ci 38 | - release-engineering 39 | 40 | prevent-review-request: 41 | teams: 42 | - core-devs 43 | -------------------------------------------------------------------------------- /.github/workflows/burnin-label-notification.yml: -------------------------------------------------------------------------------- 1 | name: Notify devops when burn-in label applied 2 | on: 3 | pull_request: 4 | types: [labeled] 5 | 6 | jobs: 7 | notify-devops: 8 | runs-on: ubuntu-latest 9 | strategy: 10 | matrix: 11 | channel: 12 | - name: 'Team: DevOps' 13 | room: '!lUslSijLMgNcEKcAiE:parity.io' 14 | 15 | steps: 16 | - name: Send Matrix message to ${{ matrix.channel.name }} 17 | if: startsWith(github.event.label.name, 'A1-') 18 | uses: s3krit/matrix-message-action@70ad3fb812ee0e45ff8999d6af11cafad11a6ecf # v0.0.3 19 | with: 20 | room_id: ${{ matrix.channel.room }} 21 | access_token: ${{ secrets.RELEASENOTES_MATRIX_V2_ACCESS_TOKEN }} 22 | server: m.parity.io 23 | message: | 24 | @room Burn-in request received for the following PR: ${{ github.event.pull_request.html_url }} 25 | -------------------------------------------------------------------------------- /.github/workflows/check-bootnodes.yml: -------------------------------------------------------------------------------- 1 | # checks all networks we care about (kusama, polkadot, westend) and ensures 2 | # the bootnodes in their respective chainspecs are contactable 3 | 4 | name: Check all bootnodes 5 | on: 6 | push: 7 | branches: 8 | # Catches v1.2.3 and v1.2.3-rc1 9 | - release-v[0-9]+.[0-9]+.[0-9]+* 10 | 11 | jobs: 12 | check_bootnodes: 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | runtime: [westend, kusama, polkadot] 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Checkout sources 20 | uses: actions/checkout@v3 21 | - name: Install polkadot 22 | shell: bash 23 | run: | 24 | curl -L "$(curl -s https://api.github.com/repos/paritytech/polkadot/releases/latest \ 25 | | jq -r '.assets | .[] | select(.name == "polkadot").browser_download_url')" \ 26 | | sudo tee /usr/local/bin/polkadot > /dev/null 27 | sudo chmod +x /usr/local/bin/polkadot 28 | polkadot --version 29 | - name: Check ${{ matrix.runtime }} bootnodes 30 | shell: bash 31 | run: scripts/ci/github/check_bootnodes.sh node/service/chain-specs/${{ matrix.runtime }}.json 32 | -------------------------------------------------------------------------------- /.github/workflows/check-licenses.yml: -------------------------------------------------------------------------------- 1 | name: Check licenses 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | check-licenses: 8 | runs-on: ubuntu-22.04 9 | steps: 10 | - name: Checkout sources 11 | uses: actions/checkout@v3 12 | - uses: actions/setup-node@v3.8.1 13 | with: 14 | node-version: '18.x' 15 | registry-url: 'https://npm.pkg.github.com' 16 | scope: '@paritytech' 17 | - name: Check the licenses 18 | run: | 19 | shopt -s globstar 20 | 21 | npx @paritytech/license-scanner@0.0.5 scan \ 22 | --ensure-licenses=Apache-2.0 \ 23 | --ensure-licenses=GPL-3.0-only \ 24 | ./**/*.rs 25 | env: 26 | NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | -------------------------------------------------------------------------------- /.github/workflows/check-new-bootnodes.yml: -------------------------------------------------------------------------------- 1 | # If a chainspec file is updated with new bootnodes, we check to make sure those bootnodes are contactable 2 | 3 | name: Check new bootnodes 4 | on: 5 | pull_request: 6 | paths: 7 | - 'node/service/chain-specs/*.json' 8 | 9 | jobs: 10 | check_bootnodes: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout sources 14 | uses: actions/checkout@v3 15 | with: 16 | fetch-depth: 0 17 | - name: Install polkadot 18 | shell: bash 19 | run: | 20 | curl -L "$(curl -s https://api.github.com/repos/paritytech/polkadot/releases/latest \ 21 | | jq -r '.assets | .[] | select(.name == "polkadot").browser_download_url')" \ 22 | | sudo tee /usr/local/bin/polkadot > /dev/null 23 | sudo chmod +x /usr/local/bin/polkadot 24 | polkadot --version 25 | - name: Check new bootnodes 26 | shell: bash 27 | run: | 28 | scripts/ci/github/check_new_bootnodes.sh 29 | -------------------------------------------------------------------------------- /.github/workflows/release-01_branch-check.yml: -------------------------------------------------------------------------------- 1 | name: Release - Branch check 2 | on: 3 | push: 4 | branches: 5 | # Catches v1.2.3 and v1.2.3-rc1 6 | - release-v[0-9]+.[0-9]+.[0-9]+* 7 | 8 | workflow_dispatch: 9 | 10 | jobs: 11 | check_branch: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout sources 15 | uses: actions/checkout@v3 16 | with: 17 | fetch-depth: 0 18 | 19 | - name: Run check 20 | shell: bash 21 | run: ./scripts/ci/github/check-rel-br 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/target/ 2 | **/*.rs.bk 3 | *.swp 4 | .wasm-binaries 5 | runtime/wasm/target/ 6 | **/._* 7 | .idea 8 | .vscode 9 | polkadot.* 10 | !polkadot.service 11 | .DS_Store 12 | .env 13 | 14 | artifacts 15 | release-artifacts 16 | release.json 17 | -------------------------------------------------------------------------------- /.rpm/polkadot.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Name: polkadot 4 | Summary: Implementation of a https://polkadot.network node in Rust based on the Substrate framework. 5 | Version: @@VERSION@@ 6 | Release: @@RELEASE@@%{?dist} 7 | License: GPLv3 8 | Group: Applications/System 9 | Source0: %{name}-%{version}.tar.gz 10 | 11 | Requires: systemd, shadow-utils 12 | Requires(post): systemd 13 | Requires(preun): systemd 14 | Requires(postun): systemd 15 | 16 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root 17 | 18 | %description 19 | %{summary} 20 | 21 | 22 | %prep 23 | %setup -q 24 | 25 | 26 | %install 27 | rm -rf %{buildroot} 28 | mkdir -p %{buildroot} 29 | cp -a * %{buildroot} 30 | 31 | %post 32 | config_file="/etc/default/polkadot" 33 | getent group polkadot >/dev/null || groupadd -r polkadot 34 | getent passwd polkadot >/dev/null || \ 35 | useradd -r -g polkadot -d /home/polkadot -m -s /sbin/nologin \ 36 | -c "User account for running polkadot as a service" polkadot 37 | if [ ! -e "$config_file" ]; then 38 | echo 'POLKADOT_CLI_ARGS=""' > /etc/default/polkadot 39 | fi 40 | exit 0 41 | 42 | %clean 43 | rm -rf %{buildroot} 44 | 45 | %files 46 | %defattr(-,root,root,-) 47 | %{_bindir}/* 48 | /usr/lib/systemd/system/polkadot.service 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Dear contributors and users, 2 | 3 | We would like to inform you that we have recently made significant changes to our repository structure. In order to streamline our development process and foster better contributions, we have merged three separate repositories Cumulus, Substrate and Polkadot into a single new repository: [the Polkadot SDK](https://github.com/paritytech/polkadot-sdk). Go ahead and make sure to support us by giving a star ⭐️ to the new repo. 4 | 5 | By consolidating our codebase, we aim to enhance collaboration and provide a more efficient platform for future development. 6 | 7 | If you currently have an open pull request in any of the merged repositories, we kindly request that you resubmit your PR in the new repository. This will ensure that your contributions are considered within the updated context and enable us to review and merge them more effectively. 8 | 9 | We appreciate your understanding and ongoing support throughout this transition. Should you have any questions or require further assistance, please don't hesitate to [reach out to us](https://forum.polkadot.network/t/psa-parity-is-currently-working-on-merging-the-polkadot-stack-repositories-into-one-single-repository/2883). 10 | 11 | Best Regards, 12 | 13 | Parity Technologies -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | fn main() { 18 | substrate_build_script_utils::generate_cargo_keys(); 19 | // For the node/worker version check, make sure we always rebuild the node and binary workers 20 | // when the version changes. 21 | substrate_build_script_utils::rerun_if_git_head_changed(); 22 | } 23 | -------------------------------------------------------------------------------- /cli/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | fn main() { 18 | if let Ok(profile) = std::env::var("PROFILE") { 19 | println!("cargo:rustc-cfg=build_type=\"{}\"", profile); 20 | } 21 | substrate_build_script_utils::generate_cargo_keys(); 22 | // For the node/worker version check, make sure we always rebuild the node when the version 23 | // changes. 24 | substrate_build_script_utils::rerun_if_git_head_changed(); 25 | } 26 | -------------------------------------------------------------------------------- /cli/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Polkadot CLI library. 18 | 19 | #![warn(missing_docs)] 20 | 21 | #[cfg(feature = "cli")] 22 | mod cli; 23 | #[cfg(feature = "cli")] 24 | mod command; 25 | #[cfg(feature = "cli")] 26 | mod error; 27 | #[cfg(all(feature = "hostperfcheck", build_type = "release"))] 28 | mod host_perf_check; 29 | 30 | #[cfg(feature = "service")] 31 | pub use service::{self, Block, CoreApi, IdentifyVariant, ProvideRuntimeApi, TFullClient}; 32 | 33 | #[cfg(feature = "malus")] 34 | pub use service::overseer::prepared_overseer_builder; 35 | 36 | #[cfg(feature = "cli")] 37 | pub use cli::*; 38 | 39 | #[cfg(feature = "cli")] 40 | pub use command::*; 41 | 42 | #[cfg(feature = "cli")] 43 | pub use sc_cli::{Error, Result}; 44 | -------------------------------------------------------------------------------- /core-primitives/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-core-primitives" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 10 | sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 11 | sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 12 | scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } 13 | parity-scale-codec = { version = "3.6.1", default-features = false, features = [ "derive" ] } 14 | 15 | [features] 16 | default = [ "std" ] 17 | std = [ 18 | "scale-info/std", 19 | "sp-core/std", 20 | "sp-runtime/std", 21 | "sp-std/std", 22 | "scale-info/std", 23 | "parity-scale-codec/std", 24 | ] 25 | -------------------------------------------------------------------------------- /doc/shell-completion.md: -------------------------------------------------------------------------------- 1 | # Shell completion 2 | 3 | The Polkadot CLI command supports shell auto-completion. For this to work, you will need to run the completion script matching you build and system. 4 | 5 | Assuming you built a release version using `cargo build --release` and use `bash` run the following: 6 | 7 | ```bash 8 | source target/release/completion-scripts/polkadot.bash 9 | ``` 10 | 11 | You can find completion scripts for: 12 | 13 | - bash 14 | - fish 15 | - zsh 16 | - elvish 17 | - powershell 18 | 19 | To make this change persistent, you can proceed as follow: 20 | 21 | ## First install 22 | 23 | ```bash 24 | COMPL_DIR=$HOME/.completion 25 | mkdir -p $COMPL_DIR 26 | cp -f target/release/completion-scripts/polkadot.bash $COMPL_DIR/ 27 | echo "source $COMPL_DIR/polkadot.bash" >> $HOME/.bash_profile 28 | source $HOME/.bash_profile 29 | ``` 30 | 31 | ## Update 32 | 33 | When you build a new version of Polkadot, the following will ensure you auto-completion script matches the current binary: 34 | 35 | ```bash 36 | COMPL_DIR=$HOME/.completion 37 | mkdir -p $COMPL_DIR 38 | cp -f target/release/completion-scripts/polkadot.bash $COMPL_DIR/ 39 | source $HOME/.bash_profile 40 | ``` 41 | -------------------------------------------------------------------------------- /erasure-coding/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-erasure-coding" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | polkadot-primitives = { path = "../primitives" } 10 | polkadot-node-primitives = { package = "polkadot-node-primitives", path = "../node/primitives" } 11 | novelpoly = { package = "reed-solomon-novelpoly", version = "1.0.0" } 12 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["std", "derive"] } 13 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 14 | sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } 15 | thiserror = "1.0.31" 16 | 17 | [dev-dependencies] 18 | criterion = { version = "0.4.0", default-features = false, features = ["cargo_bench_support"] } 19 | 20 | [[bench]] 21 | name = "scaling_with_validators" 22 | harness = false 23 | -------------------------------------------------------------------------------- /erasure-coding/fuzzer/.gitignore: -------------------------------------------------------------------------------- 1 | hfuzz_target/ 2 | hfuzz_workspace/ 3 | Cargo.lock 4 | -------------------------------------------------------------------------------- /erasure-coding/fuzzer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "erasure_coding_fuzzer" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | publish = false 8 | 9 | [dependencies] 10 | polkadot-erasure-coding = { path = ".." } 11 | honggfuzz = "0.5" 12 | polkadot-primitives = { path = "../../primitives" } 13 | primitives = { package = "polkadot-node-primitives", path = "../../node/primitives/" } 14 | 15 | [[bin]] 16 | name = "reconstruct" 17 | path = "src/reconstruct.rs" 18 | 19 | [[bin]] 20 | name = "round_trip" 21 | path = "src/round_trip.rs" 22 | -------------------------------------------------------------------------------- /erasure-coding/fuzzer/src/reconstruct.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use honggfuzz::fuzz; 18 | use polkadot_erasure_coding::*; 19 | use primitives::AvailableData; 20 | 21 | fn main() { 22 | loop { 23 | fuzz!(|data: (usize, Vec<(Vec, usize)>)| { 24 | let (num_validators, chunk_input) = data; 25 | let reconstructed: Result = reconstruct_v1( 26 | num_validators, 27 | chunk_input.iter().map(|t| (&*t.0, t.1)).collect::>(), 28 | ); 29 | println!("reconstructed {:?}", reconstructed); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /file_header.txt: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | -------------------------------------------------------------------------------- /node/collation-generation/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-collation-generation" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | futures = "0.3.21" 10 | gum = { package = "tracing-gum", path = "../gum" } 11 | polkadot-erasure-coding = { path = "../../erasure-coding" } 12 | polkadot-node-primitives = { path = "../primitives" } 13 | polkadot-node-subsystem = { path = "../subsystem" } 14 | polkadot-node-subsystem-util = { path = "../subsystem-util" } 15 | polkadot-primitives = { path = "../../primitives" } 16 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 17 | sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" } 18 | thiserror = "1.0.31" 19 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["bit-vec", "derive"] } 20 | 21 | [dev-dependencies] 22 | polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" } 23 | test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../primitives/test-helpers" } 24 | assert_matches = "1.4.0" 25 | sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } 26 | -------------------------------------------------------------------------------- /node/collation-generation/src/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use thiserror::Error; 18 | 19 | #[derive(Debug, Error)] 20 | pub enum Error { 21 | #[error(transparent)] 22 | Subsystem(#[from] polkadot_node_subsystem::SubsystemError), 23 | #[error(transparent)] 24 | OneshotRecv(#[from] futures::channel::oneshot::Canceled), 25 | #[error(transparent)] 26 | Runtime(#[from] polkadot_node_subsystem::errors::RuntimeApiError), 27 | #[error(transparent)] 28 | Util(#[from] polkadot_node_subsystem_util::Error), 29 | #[error(transparent)] 30 | Erasure(#[from] polkadot_erasure_coding::Error), 31 | } 32 | 33 | pub type Result = std::result::Result; 34 | -------------------------------------------------------------------------------- /node/core/README.md: -------------------------------------------------------------------------------- 1 | This folder contains core subsystems, each with their own crate. 2 | -------------------------------------------------------------------------------- /node/core/bitfield-signing/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-core-bitfield-signing" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | futures = "0.3.21" 10 | gum = { package = "tracing-gum", path = "../../gum" } 11 | polkadot-primitives = { path = "../../../primitives" } 12 | polkadot-node-subsystem = { path = "../../subsystem" } 13 | polkadot-node-subsystem-util = { path = "../../subsystem-util" } 14 | sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } 15 | wasm-timer = "0.2.5" 16 | thiserror = "1.0.31" 17 | 18 | [dev-dependencies] 19 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 20 | test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../../primitives/test-helpers" } 21 | -------------------------------------------------------------------------------- /node/core/chain-api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-core-chain-api" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | futures = "0.3.21" 10 | gum = { package = "tracing-gum", path = "../../gum" } 11 | sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } 12 | polkadot-primitives = { path = "../../../primitives" } 13 | polkadot-node-metrics = { path = "../../metrics" } 14 | polkadot-node-subsystem = {path = "../../subsystem" } 15 | sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } 16 | sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } 17 | 18 | [dev-dependencies] 19 | futures = { version = "0.3.21", features = ["thread-pool"] } 20 | maplit = "1.0.2" 21 | parity-scale-codec = "3.6.1" 22 | polkadot-node-primitives = { path = "../../primitives" } 23 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 24 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 25 | -------------------------------------------------------------------------------- /node/core/chain-selection/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-core-chain-selection" 3 | description = "Chain Selection Subsystem" 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | futures = "0.3.21" 11 | futures-timer = "3" 12 | gum = { package = "tracing-gum", path = "../../gum" } 13 | polkadot-primitives = { path = "../../../primitives" } 14 | polkadot-node-primitives = { path = "../../primitives" } 15 | polkadot-node-subsystem = { path = "../../subsystem" } 16 | polkadot-node-subsystem-util = { path = "../../subsystem-util" } 17 | kvdb = "0.13.0" 18 | thiserror = "1.0.31" 19 | parity-scale-codec = "3.6.1" 20 | 21 | [dev-dependencies] 22 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 23 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 24 | parking_lot = "0.12.0" 25 | assert_matches = "1" 26 | kvdb-memorydb = "0.13.0" 27 | -------------------------------------------------------------------------------- /node/core/chain-selection/src/db_backend/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! A database [`Backend`][crate::backend::Backend] for the chain selection subsystem. 18 | 19 | pub(super) mod v1; 20 | -------------------------------------------------------------------------------- /node/core/dispute-coordinator/src/db/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Database component for the dispute coordinator. 18 | 19 | pub(super) mod v1; 20 | -------------------------------------------------------------------------------- /node/core/parachains-inherent/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-core-parachains-inherent" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | futures = "0.3.21" 10 | futures-timer = "3.0.2" 11 | gum = { package = "tracing-gum", path = "../../gum" } 12 | thiserror = "1.0.31" 13 | async-trait = "0.1.57" 14 | polkadot-node-subsystem = { path = "../../subsystem" } 15 | polkadot-overseer = { path = "../../overseer" } 16 | polkadot-primitives = { path = "../../../primitives" } 17 | sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } 18 | sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" } 19 | -------------------------------------------------------------------------------- /node/core/prospective-parachains/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-core-prospective-parachains" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | futures = "0.3.19" 10 | gum = { package = "tracing-gum", path = "../../gum" } 11 | parity-scale-codec = "3.6.4" 12 | thiserror = "1.0.30" 13 | fatality = "0.0.6" 14 | bitvec = "1" 15 | 16 | polkadot-primitives = { path = "../../../primitives" } 17 | polkadot-node-primitives = { path = "../../primitives" } 18 | polkadot-node-subsystem = { path = "../../subsystem" } 19 | polkadot-node-subsystem-util = { path = "../../subsystem-util" } 20 | 21 | [dev-dependencies] 22 | assert_matches = "1" 23 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 24 | polkadot-node-subsystem-types = { path = "../../subsystem-types" } 25 | polkadot-primitives-test-helpers = { path = "../../../primitives/test-helpers" } 26 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 27 | sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } 28 | sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } 29 | sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } 30 | sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } 31 | -------------------------------------------------------------------------------- /node/core/provisioner/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-core-provisioner" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } 10 | futures = "0.3.21" 11 | gum = { package = "tracing-gum", path = "../../gum" } 12 | thiserror = "1.0.31" 13 | polkadot-primitives = { path = "../../../primitives" } 14 | polkadot-node-primitives = { path = "../../primitives" } 15 | polkadot-node-subsystem = { path = "../../subsystem" } 16 | polkadot-node-subsystem-util = { path = "../../subsystem-util" } 17 | futures-timer = "3.0.2" 18 | fatality = "0.0.6" 19 | 20 | [dev-dependencies] 21 | sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } 22 | sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } 23 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 24 | test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../../primitives/test-helpers" } 25 | -------------------------------------------------------------------------------- /node/core/pvf/bin/puppet_worker.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | polkadot_node_core_pvf::decl_puppet_worker_main!(); 18 | -------------------------------------------------------------------------------- /node/core/pvf/execute-worker/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-core-pvf-execute-worker" 3 | description = "Polkadot crate that contains the logic for executing PVFs. Used by the polkadot-execute-worker binary." 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | cpu-time = "1.0.0" 11 | futures = "0.3.21" 12 | gum = { package = "tracing-gum", path = "../../../gum" } 13 | rayon = "1.5.1" 14 | tikv-jemalloc-ctl = { version = "0.5.0", optional = true } 15 | tokio = { version = "1.24.2", features = ["fs", "process"] } 16 | 17 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 18 | 19 | polkadot-node-core-pvf-common = { path = "../common" } 20 | polkadot-parachain = { path = "../../../../parachain" } 21 | polkadot-primitives = { path = "../../../../primitives" } 22 | 23 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 24 | sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" } 25 | sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } 26 | 27 | [target.'cfg(target_os = "linux")'.dependencies] 28 | tikv-jemalloc-ctl = "0.5.0" 29 | 30 | [features] 31 | builder = [] 32 | -------------------------------------------------------------------------------- /node/core/pvf/src/execute/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Execution part of the pipeline. 18 | //! 19 | //! The validation host [runs the queue][`start`] communicating with it by sending [`ToQueue`] 20 | //! messages. The queue will spawn workers in new processes. Those processes should jump to 21 | //! `polkadot_node_core_pvf_worker::execute_worker_entrypoint`. 22 | 23 | mod queue; 24 | mod worker_intf; 25 | 26 | pub use queue::{start, PendingExecutionRequest, ToQueue}; 27 | -------------------------------------------------------------------------------- /node/core/pvf/src/prepare/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Preparation part of pipeline 18 | //! 19 | //! The validation host spins up two processes: the queue (by running [`start_queue`]) and the pool 20 | //! (by running [`start_pool`]). 21 | //! 22 | //! The pool will spawn workers in new processes and those should execute pass control to 23 | //! `polkadot_node_core_pvf_worker::prepare_worker_entrypoint`. 24 | 25 | mod pool; 26 | mod queue; 27 | mod worker_intf; 28 | 29 | pub use pool::start as start_pool; 30 | pub use queue::{start as start_queue, FromQueue, ToQueue}; 31 | -------------------------------------------------------------------------------- /node/core/pvf/src/priority.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | /// A priority assigned to execution of a PVF. 18 | #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 19 | pub enum Priority { 20 | /// Normal priority for things that do not require immediate response, but still need to be 21 | /// done pretty quick. 22 | /// 23 | /// Approvals and disputes fall into this category. 24 | Normal, 25 | /// This priority is used for requests that are required to be processed as soon as possible. 26 | /// 27 | /// For example, backing is on a critical path and requires execution as soon as possible. 28 | Critical, 29 | } 30 | 31 | impl Priority { 32 | /// Returns `true` if `self` is `Crticial` 33 | pub fn is_critical(self) -> bool { 34 | self == Priority::Critical 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /node/core/runtime-api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-core-runtime-api" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | futures = "0.3.21" 10 | gum = { package = "tracing-gum", path = "../../gum" } 11 | lru = "0.11.0" 12 | 13 | sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } 14 | 15 | polkadot-primitives = { path = "../../../primitives" } 16 | polkadot-node-metrics = { path = "../../metrics" } 17 | polkadot-node-subsystem = { path = "../../subsystem" } 18 | polkadot-node-subsystem-types = { path = "../../subsystem-types" } 19 | 20 | [dev-dependencies] 21 | sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } 22 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 23 | sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } 24 | async-trait = "0.1.57" 25 | futures = { version = "0.3.21", features = ["thread-pool"] } 26 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 27 | polkadot-node-primitives = { path = "../../primitives" } 28 | test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../../primitives/test-helpers" } 29 | -------------------------------------------------------------------------------- /node/gum/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tracing-gum" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | description = "Stick logs together with the TraceID as provided by tempo" 8 | 9 | [dependencies] 10 | coarsetime = "0.1.22" 11 | tracing = "0.1.35" 12 | jaeger = { path = "../jaeger", package = "polkadot-node-jaeger" } 13 | gum-proc-macro = { path = "./proc-macro", package = "tracing-gum-proc-macro" } 14 | polkadot-primitives = { path = "../../primitives", features = ["std"] } 15 | -------------------------------------------------------------------------------- /node/gum/proc-macro/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tracing-gum-proc-macro" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | description = "Generate an overseer including builder pattern and message wrapper from a single annotated struct definition." 8 | 9 | [package.metadata.docs.rs] 10 | targets = ["x86_64-unknown-linux-gnu"] 11 | 12 | [lib] 13 | proc-macro = true 14 | 15 | [dependencies] 16 | syn = { version = "2.0.15", features = ["full", "extra-traits"] } 17 | quote = "1.0.28" 18 | proc-macro2 = "1.0.56" 19 | proc-macro-crate = "1.1.3" 20 | expander = "2.0.0" 21 | 22 | [dev-dependencies] 23 | assert_matches = "1.5.0" 24 | 25 | 26 | [features] 27 | default = [] 28 | # write the expanded version to a `gum.[a-f0-9]{10}.rs` 29 | # in the `OUT_DIR` as defined by `cargo` for the `expander` crate. 30 | expand = [] 31 | -------------------------------------------------------------------------------- /node/jaeger/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-jaeger" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | description = "Polkadot Jaeger primitives, but equally useful for Grafana/Tempo" 8 | 9 | [dependencies] 10 | mick-jaeger = "0.1.8" 11 | lazy_static = "1.4" 12 | parking_lot = "0.12.0" 13 | polkadot-primitives = { path = "../../primitives" } 14 | polkadot-node-primitives = { path = "../primitives" } 15 | sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } 16 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 17 | thiserror = "1.0.31" 18 | tokio = "1.24.2" 19 | log = "0.4.17" 20 | parity-scale-codec = { version = "3.6.1", default-features = false } 21 | -------------------------------------------------------------------------------- /node/jaeger/src/errors.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Polkadot Jaeger error definitions. 18 | 19 | /// A description of an error during jaeger initialization. 20 | #[derive(Debug, thiserror::Error)] 21 | #[allow(missing_docs)] 22 | pub enum JaegerError { 23 | #[error("Already launched the collector thread")] 24 | AlreadyLaunched, 25 | 26 | #[error("Missing jaeger configuration")] 27 | MissingConfiguration, 28 | } 29 | -------------------------------------------------------------------------------- /node/malus/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | fn main() { 18 | substrate_build_script_utils::generate_cargo_keys(); 19 | // For the node/worker version check, make sure we always rebuild the node and binary workers 20 | // when the version changes. 21 | substrate_build_script_utils::rerun_if_git_head_changed(); 22 | } 23 | -------------------------------------------------------------------------------- /node/malus/container/build.sh: -------------------------------------------------------------------------------- 1 | podman build -t paritypr/malus:v1 -f Containerfile ../../../.. 2 | -------------------------------------------------------------------------------- /node/malus/integrationtests/0001-dispute-valid-block.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "wococo-local" 7 | command = "polkadot" 8 | 9 | [[relaychain.nodes]] 10 | name = "alice" 11 | validator = true 12 | extra_args = [ "--alice", "-lparachain=debug" ] 13 | 14 | [[relaychain.nodes]] 15 | name = "bob" 16 | validator = true 17 | extra_args = [ "--bob", "-lparachain=debug" ] 18 | 19 | [[relaychain.nodes]] 20 | name = "charlie" 21 | validator = true 22 | extra_args = [ "--charlie", "-lparachain=debug" ] 23 | 24 | [[relaychain.nodes]] 25 | name = "dave" 26 | validator = true 27 | command = "malus dispute-ancestor" 28 | extra_args = ["--dave", "-lparachain=debug"] 29 | image = "{{MALUS_IMAGE}}" 30 | autoConnectApi = false 31 | 32 | [[parachains]] 33 | id = 100 34 | 35 | [parachains.collator] 36 | name = "collator01" 37 | image = "{{COL_IMAGE}}" 38 | command = "adder-collator" 39 | args = ["-lparachain=debug"] 40 | -------------------------------------------------------------------------------- /node/malus/src/variants/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Collection of behavior variants. 18 | 19 | mod back_garbage_candidate; 20 | mod common; 21 | mod dispute_valid_candidates; 22 | mod suggest_garbage_candidate; 23 | 24 | pub(crate) use self::{ 25 | back_garbage_candidate::{BackGarbageCandidateOptions, BackGarbageCandidates}, 26 | dispute_valid_candidates::{DisputeAncestorOptions, DisputeValidCandidates}, 27 | suggest_garbage_candidate::{SuggestGarbageCandidateOptions, SuggestGarbageCandidates}, 28 | }; 29 | pub(crate) use common::*; 30 | -------------------------------------------------------------------------------- /node/metrics/README.md: -------------------------------------------------------------------------------- 1 | # polkadot-node-metrics 2 | 3 | ## Testing 4 | 5 | Before running `cargo test` in this crate, make sure the worker binaries are built first. This can be done with: 6 | 7 | ```sh 8 | cargo build --bin polkadot-execute-worker --bin polkadot-prepare-worker 9 | ``` 10 | -------------------------------------------------------------------------------- /node/network/README.md: -------------------------------------------------------------------------------- 1 | This folder holds all networking subsystem implementations, each with their own crate. 2 | -------------------------------------------------------------------------------- /node/network/approval-distribution/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-approval-distribution" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | polkadot-node-metrics = { path = "../../metrics" } 10 | polkadot-node-network-protocol = { path = "../protocol" } 11 | polkadot-node-primitives = { path = "../../primitives" } 12 | polkadot-node-subsystem = { path = "../../subsystem" } 13 | polkadot-node-subsystem-util = { path = "../../subsystem-util" } 14 | polkadot-primitives = { path = "../../../primitives" } 15 | polkadot-node-jaeger = { path = "../../jaeger" } 16 | rand = "0.8" 17 | 18 | futures = "0.3.21" 19 | futures-timer = "3.0.2" 20 | gum = { package = "tracing-gum", path = "../../gum" } 21 | 22 | [dev-dependencies] 23 | sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } 24 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] } 25 | 26 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 27 | polkadot-primitives-test-helpers = { path = "../../../primitives/test-helpers" } 28 | 29 | assert_matches = "1.4.0" 30 | schnorrkel = { version = "0.9.1", default-features = false } 31 | rand_core = "0.5.1" # should match schnorrkel 32 | rand_chacha = "0.3.1" 33 | env_logger = "0.9.0" 34 | log = "0.4.17" 35 | -------------------------------------------------------------------------------- /node/network/bitfield-distribution/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-availability-bitfield-distribution" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | always-assert = "0.1" 10 | futures = "0.3.21" 11 | futures-timer = "3.0.2" 12 | gum = { package = "tracing-gum", path = "../../gum" } 13 | polkadot-primitives = { path = "../../../primitives" } 14 | polkadot-node-subsystem = {path = "../../subsystem" } 15 | polkadot-node-subsystem-util = { path = "../../subsystem-util" } 16 | polkadot-node-network-protocol = { path = "../../network/protocol" } 17 | rand = "0.8" 18 | 19 | [dev-dependencies] 20 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 21 | bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } 22 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 23 | sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } 24 | sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } 25 | sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } 26 | sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } 27 | maplit = "1.0.2" 28 | log = "0.4.17" 29 | env_logger = "0.9.0" 30 | assert_matches = "1.4.0" 31 | rand_chacha = "0.3.1" 32 | -------------------------------------------------------------------------------- /node/network/bridge/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-network-bridge" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | always-assert = "0.1" 10 | async-trait = "0.1.57" 11 | futures = "0.3.21" 12 | gum = { package = "tracing-gum", path = "../../gum" } 13 | polkadot-primitives = { path = "../../../primitives" } 14 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 15 | sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } 16 | sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } 17 | polkadot-node-metrics = { path = "../../metrics"} 18 | polkadot-node-network-protocol = { path = "../protocol" } 19 | polkadot-node-subsystem = {path = "../../subsystem" } 20 | polkadot-overseer = { path = "../../overseer" } 21 | parking_lot = "0.12.0" 22 | bytes = "1" 23 | fatality = "0.0.6" 24 | thiserror = "1" 25 | 26 | [dev-dependencies] 27 | assert_matches = "1.4.0" 28 | polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } 29 | polkadot-node-subsystem-util = { path = "../../subsystem-util"} 30 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 31 | sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } 32 | futures-timer = "3" 33 | polkadot-primitives-test-helpers = { path = "../../../primitives/test-helpers" } 34 | -------------------------------------------------------------------------------- /node/network/bridge/src/errors.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use polkadot_node_subsystem::SubsystemError; 18 | pub(crate) use polkadot_overseer::OverseerError; 19 | 20 | #[fatality::fatality(splitable)] 21 | pub(crate) enum Error { 22 | /// Received error from overseer: 23 | #[fatal] 24 | #[error(transparent)] 25 | SubsystemError(#[from] SubsystemError), 26 | /// The stream of incoming events concluded. 27 | #[fatal] 28 | #[error("Event stream closed unexpectedly")] 29 | EventStreamConcluded, 30 | } 31 | 32 | impl From for Error { 33 | fn from(e: OverseerError) -> Self { 34 | Error::SubsystemError(SubsystemError::from(e)) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /node/network/protocol/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-network-protocol" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | description = "Primitives types for the Node-side" 8 | 9 | [dependencies] 10 | async-channel = "1.8.0" 11 | async-trait = "0.1.57" 12 | hex = "0.4.3" 13 | polkadot-primitives = { path = "../../../primitives" } 14 | polkadot-node-primitives = { path = "../../primitives" } 15 | polkadot-node-jaeger = { path = "../../jaeger" } 16 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 17 | sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } 18 | sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } 19 | strum = { version = "0.24", features = ["derive"] } 20 | futures = "0.3.21" 21 | thiserror = "1.0.31" 22 | fatality = "0.0.6" 23 | rand = "0.8" 24 | derive_more = "0.99" 25 | gum = { package = "tracing-gum", path = "../../gum" } 26 | bitvec = "1" 27 | 28 | [dev-dependencies] 29 | rand_chacha = "0.3.1" 30 | 31 | [features] 32 | network-protocol-staging = [] 33 | -------------------------------------------------------------------------------- /node/primitives/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-primitives" 3 | description = "Primitives types for the Node-side" 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | bounded-vec = "0.7" 11 | futures = "0.3.21" 12 | polkadot-primitives = { path = "../../primitives" } 13 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 14 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 15 | sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } 16 | sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } 17 | sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } 18 | sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" } 19 | sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } 20 | polkadot-parachain = { path = "../../parachain", default-features = false } 21 | schnorrkel = "0.9.1" 22 | thiserror = "1.0.31" 23 | serde = { version = "1.0.163", features = ["derive"] } 24 | 25 | [target.'cfg(not(target_os = "unknown"))'.dependencies] 26 | zstd = { version = "0.11.2", default-features = false } 27 | 28 | [dev-dependencies] 29 | polkadot-erasure-coding = { path = "../../erasure-coding" } 30 | -------------------------------------------------------------------------------- /node/service/README.adoc: -------------------------------------------------------------------------------- 1 | 2 | = Polkadot Service 3 | 4 | placeholder 5 | //TODO Write content :) (https://github.com/paritytech/polkadot/issues/159) 6 | -------------------------------------------------------------------------------- /node/service/chain-specs/.gitignore: -------------------------------------------------------------------------------- 1 | !/*.json 2 | -------------------------------------------------------------------------------- /node/subsystem-test-helpers/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-subsystem-test-helpers" 3 | description = "Subsystem traits and message definitions" 4 | publish = false 5 | version.workspace = true 6 | authors.workspace = true 7 | edition.workspace = true 8 | license.workspace = true 9 | 10 | [dependencies] 11 | async-trait = "0.1.57" 12 | futures = "0.3.21" 13 | parking_lot = "0.12.0" 14 | polkadot-node-subsystem = { path = "../subsystem" } 15 | polkadot-node-subsystem-util = { path = "../subsystem-util" } 16 | polkadot-primitives = { path = "../../primitives" } 17 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 18 | sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } 19 | sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } 20 | sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } 21 | sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } 22 | 23 | [dev-dependencies] 24 | polkadot-overseer = { path = "../overseer" } 25 | -------------------------------------------------------------------------------- /node/subsystem-types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-subsystem-types" 3 | description = "Subsystem traits and message definitions" 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | derive_more = "0.99.17" 11 | futures = "0.3.21" 12 | polkadot-primitives = { path = "../../primitives" } 13 | polkadot-node-primitives = { path = "../primitives" } 14 | polkadot-node-network-protocol = { path = "../network/protocol" } 15 | polkadot-statement-table = { path = "../../statement-table" } 16 | polkadot-node-jaeger = { path = "../jaeger" } 17 | orchestra = "0.0.5" 18 | sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } 19 | sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } 20 | sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } 21 | sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } 22 | sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" } 23 | smallvec = "1.8.0" 24 | substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } 25 | thiserror = "1.0.31" 26 | async-trait = "0.1.57" 27 | -------------------------------------------------------------------------------- /node/subsystem-util/src/inclusion_emulator/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2017-2022 Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | pub mod staging; 15 | -------------------------------------------------------------------------------- /node/subsystem/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-node-subsystem" 3 | description = "Subsystem traits and message definitions and the generated overseer" 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | polkadot-overseer = { path = "../overseer" } 11 | polkadot-node-subsystem-types = { path = "../subsystem-types" } 12 | polkadot-node-jaeger = { path = "../jaeger" } 13 | -------------------------------------------------------------------------------- /node/test/performance-test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-performance-test" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | thiserror = "1.0.31" 11 | quote = "1.0.28" 12 | env_logger = "0.9" 13 | log = "0.4" 14 | 15 | polkadot-node-core-pvf-prepare-worker = { path = "../../core/pvf/prepare-worker" } 16 | polkadot-erasure-coding = { path = "../../../erasure-coding" } 17 | polkadot-node-primitives = { path = "../../primitives" } 18 | polkadot-primitives = { path = "../../../primitives" } 19 | 20 | sc-executor-common = { git = "https://github.com/paritytech/substrate", branch = "master" } 21 | sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" } 22 | 23 | kusama-runtime = { path = "../../../runtime/kusama" } 24 | 25 | [[bin]] 26 | name = "gen-ref-constants" 27 | path = "src/gen_ref_constants.rs" 28 | 29 | [features] 30 | runtime-benchmarks = ["kusama-runtime/runtime-benchmarks"] 31 | -------------------------------------------------------------------------------- /node/test/performance-test/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | fn main() { 18 | if let Ok(profile) = std::env::var("PROFILE") { 19 | println!("cargo:rustc-cfg=build_type=\"{}\"", profile); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /node/test/performance-test/src/constants.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! This file was automatically generated by `gen-ref-constants`. 18 | //! Do not edit manually! 19 | 20 | use std::time::Duration; 21 | pub const PVF_PREPARE_TIME_LIMIT: Duration = Duration::from_millis(4910u64); 22 | pub const ERASURE_CODING_TIME_LIMIT: Duration = Duration::from_millis(466u64); 23 | -------------------------------------------------------------------------------- /node/test/service/README.md: -------------------------------------------------------------------------------- 1 | # polkadot-test-service 2 | 3 | ## Testing 4 | 5 | Before running `cargo test` in this crate, make sure the worker binaries are built first. This can be done with: 6 | 7 | ```sh 8 | cargo build --bin polkadot-execute-worker --bin polkadot-prepare-worker 9 | ``` 10 | -------------------------------------------------------------------------------- /node/zombienet-backchannel/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "zombienet-backchannel" 3 | description = "Zombienet backchannel to notify test runner and coordinate with malus actors." 4 | readme = "README.md" 5 | publish = false 6 | version.workspace = true 7 | authors.workspace = true 8 | edition.workspace = true 9 | license.workspace = true 10 | 11 | [dependencies] 12 | tokio = { version = "1.24.2", default-features = false, features = ["macros", "net", "rt-multi-thread", "sync"] } 13 | url = "2.3.1" 14 | tokio-tungstenite = "0.17" 15 | futures-util = "0.3.23" 16 | lazy_static = "1.4.0" 17 | parity-scale-codec = { version = "3.6.1", features = ["derive"] } 18 | reqwest = { version = "0.11", features = ["rustls-tls"], default-features = false } 19 | thiserror = "1.0.31" 20 | gum = { package = "tracing-gum", path = "../gum/" } 21 | serde = { version = "1.0", features = ["derive"] } 22 | serde_json = "1" 23 | -------------------------------------------------------------------------------- /node/zombienet-backchannel/src/errors.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Polkadot Zombienet Backchannel error definitions. 18 | 19 | #[derive(Debug, thiserror::Error)] 20 | #[allow(missing_docs)] 21 | pub enum BackchannelError { 22 | #[error("Error connecting websocket server")] 23 | CantConnectToWS, 24 | 25 | #[error("Backchannel not initialized yet")] 26 | Uninitialized, 27 | 28 | #[error("Backchannel already initialized")] 29 | AlreadyInitialized, 30 | 31 | #[error("Error sending new value to backchannel")] 32 | SendItemFail, 33 | 34 | #[error("Invalid host for connection backchannel")] 35 | InvalidHost, 36 | 37 | #[error("Invalid port for connection backchannel")] 38 | InvalidPort, 39 | } 40 | -------------------------------------------------------------------------------- /parachain/README.adoc: -------------------------------------------------------------------------------- 1 | 2 | = Polkadot Parachain 3 | 4 | placeholder 5 | //TODO Write content :) (https://github.com/paritytech/polkadot/issues/159) 6 | -------------------------------------------------------------------------------- /parachain/test-parachains/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /parachain/test-parachains/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test-parachains" 3 | description = "Integration tests using the test-parachains" 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | publish = false 9 | 10 | [dependencies] 11 | tiny-keccak = { version = "2.0.2", features = ["keccak"] } 12 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 13 | 14 | adder = { package = "test-parachain-adder", path = "adder" } 15 | halt = { package = "test-parachain-halt", path = "halt" } 16 | 17 | [dev-dependencies] 18 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 19 | 20 | [features] 21 | default = ["std"] 22 | std = ["adder/std", "halt/std"] 23 | -------------------------------------------------------------------------------- /parachain/test-parachains/README.md: -------------------------------------------------------------------------------- 1 | # Test Parachains 2 | 3 | Each parachain consists of three parts: a `#![no_std]` library with the main execution logic, a WASM crate which wraps this logic, and a collator node. 4 | -------------------------------------------------------------------------------- /parachain/test-parachains/adder/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test-parachain-adder" 3 | description = "Test parachain which adds to a number as its state transition" 4 | build = "build.rs" 5 | edition.workspace = true 6 | license.workspace = true 7 | version.workspace = true 8 | authors.workspace = true 9 | publish = false 10 | 11 | [dependencies] 12 | parachain = { package = "polkadot-parachain", path = "../../", default-features = false, features = [ "wasm-api" ] } 13 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 14 | sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 15 | tiny-keccak = { version = "2.0.2", features = ["keccak"] } 16 | dlmalloc = { version = "0.2.4", features = [ "global" ] } 17 | 18 | # We need to make sure the global allocator is disabled until we have support of full substrate externalities 19 | sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = [ "disable_allocator" ] } 20 | 21 | [build-dependencies] 22 | substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } 23 | 24 | [features] 25 | default = [ "std" ] 26 | std = [ 27 | "parachain/std", 28 | "sp-std/std", 29 | ] 30 | -------------------------------------------------------------------------------- /parachain/test-parachains/adder/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | fn main() { 20 | WasmBuilder::new() 21 | .with_current_project() 22 | .export_heap_base() 23 | .disable_runtime_version_section_check() 24 | .build() 25 | } 26 | -------------------------------------------------------------------------------- /parachain/test-parachains/adder/collator/README.md: -------------------------------------------------------------------------------- 1 | # How to run this collator 2 | 3 | First, build Polkadot: 4 | 5 | ```sh 6 | cargo build --release 7 | ``` 8 | 9 | Then start two validators that will run for the relay chain: 10 | 11 | ```sh 12 | cargo run --release -- -d alice --chain rococo-local --validator --alice --port 50551 13 | cargo run --release -- -d bob --chain rococo-local --validator --bob --port 50552 14 | ``` 15 | 16 | Next start the collator that will collate for the adder parachain: 17 | 18 | ```sh 19 | cargo run --release -p test-parachain-adder-collator -- --tmp --chain rococo-local --port 50553 20 | ``` 21 | 22 | The last step is to register the parachain using polkadot-js. The parachain id is 23 | 100. The genesis state and the validation code are printed at startup by the collator. 24 | 25 | To do this automatically, run `scripts/adder-collator.sh`. 26 | -------------------------------------------------------------------------------- /parachain/test-parachains/adder/collator/bin/puppet_worker.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | polkadot_node_core_pvf::decl_puppet_worker_main!(); 18 | -------------------------------------------------------------------------------- /parachain/test-parachains/halt/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test-parachain-halt" 3 | description = "Test parachain which executes forever" 4 | build = "build.rs" 5 | publish = false 6 | version.workspace = true 7 | authors.workspace = true 8 | edition.workspace = true 9 | license.workspace = true 10 | 11 | [dependencies] 12 | 13 | [build-dependencies] 14 | substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } 15 | rustversion = "1.0.6" 16 | 17 | [features] 18 | default = [ "std" ] 19 | std = [] 20 | -------------------------------------------------------------------------------- /parachain/test-parachains/halt/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | fn main() { 20 | WasmBuilder::new() 21 | .with_current_project() 22 | .export_heap_base() 23 | .disable_runtime_version_section_check() 24 | .build(); 25 | 26 | enable_alloc_error_handler(); 27 | } 28 | 29 | #[rustversion::before(1.68)] 30 | fn enable_alloc_error_handler() { 31 | if !cfg!(feature = "std") { 32 | println!("cargo:rustc-cfg=enable_alloc_error_handler"); 33 | } 34 | } 35 | 36 | #[rustversion::since(1.68)] 37 | fn enable_alloc_error_handler() {} 38 | -------------------------------------------------------------------------------- /parachain/test-parachains/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Stub - the fundamental logic of this crate is the integration tests. 18 | -------------------------------------------------------------------------------- /parachain/test-parachains/undying/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test-parachain-undying" 3 | description = "Test parachain for zombienet integration tests" 4 | build = "build.rs" 5 | publish = false 6 | version.workspace = true 7 | authors.workspace = true 8 | edition.workspace = true 9 | license.workspace = true 10 | 11 | [dependencies] 12 | parachain = { package = "polkadot-parachain", path = "../../", default-features = false, features = [ "wasm-api" ] } 13 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 14 | sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 15 | tiny-keccak = { version = "2.0.2", features = ["keccak"] } 16 | dlmalloc = { version = "0.2.4", features = [ "global" ] } 17 | log = { version = "0.4.17", default-features = false } 18 | 19 | # We need to make sure the global allocator is disabled until we have support of full substrate externalities 20 | sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = [ "disable_allocator" ] } 21 | 22 | [build-dependencies] 23 | substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } 24 | 25 | [features] 26 | default = [ "std" ] 27 | std = [ 28 | "parachain/std", 29 | "sp-std/std", 30 | ] 31 | -------------------------------------------------------------------------------- /parachain/test-parachains/undying/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | fn main() { 20 | WasmBuilder::new() 21 | .with_current_project() 22 | .export_heap_base() 23 | .disable_runtime_version_section_check() 24 | .build() 25 | } 26 | -------------------------------------------------------------------------------- /parachain/test-parachains/undying/collator/bin/puppet_worker.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | polkadot_node_core_pvf::decl_puppet_worker_main!(); 18 | -------------------------------------------------------------------------------- /primitives/README.adoc: -------------------------------------------------------------------------------- 1 | 2 | = Polkadot primitives 3 | 4 | placeholder 5 | //TODO Write content :) (https://github.com/paritytech/polkadot/issues/159) 6 | -------------------------------------------------------------------------------- /primitives/test-helpers/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-primitives-test-helpers" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } 11 | sp-application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 12 | sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } 13 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] } 14 | polkadot-primitives = { path = "../" } 15 | rand = "0.8.5" 16 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/.gitignore: -------------------------------------------------------------------------------- 1 | book/ 2 | *.generated.svg 3 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/README.md: -------------------------------------------------------------------------------- 1 | # The Polkadot Parachain Host Implementers' Guide 2 | 3 | The implementers' guide is compiled from several source files with [`mdBook`](https://github.com/rust-lang/mdBook). 4 | 5 | ## Hosted build 6 | 7 | This is available [here](https://paritytech.github.io/polkadot/book/). 8 | 9 | ## Local build 10 | 11 | To view it locally from the repo root: 12 | 13 | Ensure graphviz is installed: 14 | 15 | ```sh 16 | brew install graphviz # for macOS 17 | sudo apt-get install graphviz # for Ubuntu/Debian 18 | ``` 19 | 20 | Then install and build the book: 21 | 22 | ```sh 23 | cargo install mdbook mdbook-linkcheck mdbook-graphviz mdbook-mermaid mdbook-last-changed 24 | mdbook serve roadmap/implementers-guide 25 | ``` 26 | 27 | and in a second terminal window run: 28 | 29 | ```sh 30 | open http://localhost:3000 31 | ``` 32 | 33 | ## Specification 34 | 35 | See also the Polkadot specification [hosted](https://spec.polkadot.network/), and its [source](https://github.com/w3f/polkadot-spec). 36 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["Rob Habermeier", "Peter Goodspeed-Niklaus"] 3 | language = "en" 4 | multilingual = false 5 | src = "src" 6 | title = "The Polkadot Parachain Host Implementers' Guide" 7 | 8 | [preprocessor.graphviz] 9 | command = "mdbook-graphviz" 10 | [preprocessor.mermaid] 11 | command = "mdbook-mermaid" 12 | [preprocessor.last-changed] 13 | command = "mdbook-last-changed" 14 | renderer = ["html"] 15 | 16 | [output.html] 17 | additional-css = ["last-changed.css"] 18 | additional-js = ["mermaid.min.js", "mermaid-init.js"] 19 | # Repository URL used in the last-changed link. 20 | git-repository-url = "https://github.com/paritytech/polkadot" 21 | 22 | [output.linkcheck] 23 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/last-changed.css: -------------------------------------------------------------------------------- 1 | footer { 2 | font-size: 0.8em; 3 | text-align: center; 4 | margin-top: 50px; 5 | border-top: 1px solid black; 6 | padding: 5px 0; 7 | } 8 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/mermaid-init.js: -------------------------------------------------------------------------------- 1 | mermaid.initialize({startOnLoad:true}); 2 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/README.md: -------------------------------------------------------------------------------- 1 | # Preamble 2 | 3 | This document aims to describe the purpose, functionality, and implementation of the host for Polkadot's _parachains_ functionality - that is, the software which provides security and advancement for constituent parachains. It is not for the implementer of a specific parachain but rather for the implementer of the Parachain Host. In practice, this is for the implementers of Polkadot in general. 4 | 5 | There are a number of other documents describing the research in more detail. All referenced documents will be linked here and should be read alongside this document for the best understanding of the full picture. However, this is the only document which aims to describe key aspects of Polkadot's particular instantiation of much of that research down to low-level technical details and software architecture. 6 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/further-reading.md: -------------------------------------------------------------------------------- 1 | # Further Reading 2 | 3 | - Polkadot Wiki on Consensus: 4 | - Polkadot Spec: 5 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/approval/README.md: -------------------------------------------------------------------------------- 1 | # Approval Subsystems 2 | 3 | The approval subsystems implement the node-side of the [Approval Protocol](../../protocol-approval.md). 4 | 5 | We make a divide between the [assignment/voting logic](approval-voting.md) and the [distribution logic](approval-distribution.md) that distributes assignment certifications and approval votes. The logic in the assignment and voting also informs the GRANDPA voting rule on how to vote. 6 | 7 | These subsystems are intended to flag issues and begin participating in live disputes. Dispute subsystems also track all observed votes (backing, approval, and dispute-specific) by all validators on all candidates. 8 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/availability/README.md: -------------------------------------------------------------------------------- 1 | # Availability Subsystems 2 | 3 | The availability subsystems are responsible for ensuring that Proofs of Validity of backed candidates are widely available within the validator set, without requiring every node to retain a full copy. They accomplish this by broadly distributing erasure-coded chunks of the PoV, keeping track of which validator has which chunk by means of signed bitfields. They are also responsible for reassembling a complete PoV when required, e.g. when an approval checker needs to validate a parachain block. 4 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/backing/README.md: -------------------------------------------------------------------------------- 1 | # Backing Subsystems 2 | 3 | The backing subsystems, when conceived as a black box, receive an arbitrary quantity of parablock candidates and associated proofs of validity from arbitrary untrusted collators. From these, they produce a bounded quantity of backable candidates which relay chain block authors may choose to include in a subsequent block. 4 | 5 | In broad strokes, the flow operates like this: 6 | 7 | - **Candidate Selection** winnows the field of parablock candidates, selecting up to one of them to second. 8 | - **Candidate Backing** ensures that a seconding candidate is valid, then generates the appropriate `Statement`. It also keeps track of which candidates have received the backing of a quorum of other validators. 9 | - **Statement Distribution** is the networking component which ensures that all validators receive each others' statements. 10 | - **PoV Distribution** is the networking component which ensures that validators considering a candidate can get the appropriate PoV. 11 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/backing/pov-distribution.md: -------------------------------------------------------------------------------- 1 | # PoV Distribution 2 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/collators/README.md: -------------------------------------------------------------------------------- 1 | # Collators 2 | 3 | Collators are special nodes which bridge a parachain to the relay chain. They are simultaneously full nodes of the parachain, and at least light clients of the relay chain. Their overall contribution to the system is the generation of Proofs of Validity for parachain candidates. 4 | 5 | The **Collation Generation** subsystem triggers collators to produce collations 6 | and then forwards them to **Collator Protocol** to circulate to validators. 7 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/disputes/README.md: -------------------------------------------------------------------------------- 1 | # Disputes Subsystems 2 | 3 | If approval voting finds an invalid candidate, a dispute is raised. The disputes 4 | subsystems are concerned with the following: 5 | 6 | 1. Disputes can be raised 7 | 2. Disputes (votes) get propagated to all other validators 8 | 3. Votes get recorded as necessary 9 | 3. Nodes will participate in disputes in a sensible fashion 10 | 4. Finality is stopped while a candidate is being disputed on chain 11 | 5. Chains can be reverted in case a dispute concludes invalid 12 | 6. Votes are provided to the provisioner for importing on chain, in order for 13 | slashing to work. 14 | 15 | The dispute-coordinator subsystem interfaces with the provisioner and chain 16 | selection to make the bulk of this possible. `dispute-distribution` is concerned 17 | with getting votes out to other validators and receiving them in a spam 18 | resilient way. 19 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/utility/README.md: -------------------------------------------------------------------------------- 1 | # Utility Subsystems 2 | 3 | The utility subsystems are an assortment which don't have a natural home in another subsystem collection. 4 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/utility/chain-api.md: -------------------------------------------------------------------------------- 1 | # Chain API 2 | 3 | The Chain API subsystem is responsible for providing a single point of access to chain state data via a set of pre-determined queries. 4 | 5 | ## Protocol 6 | 7 | Input: [`ChainApiMessage`](../../types/overseer-protocol.md#chain-api-message) 8 | 9 | Output: None 10 | 11 | ## Functionality 12 | 13 | On receipt of `ChainApiMessage`, answer the request and provide the response to the side-channel embedded within the request. 14 | 15 | Currently, the following requests are supported: 16 | * Block hash to number 17 | * Block hash to header 18 | * Block weight 19 | * Finalized block number to hash 20 | * Last finalized block number 21 | * Ancestors 22 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/utility/gossip-support.md: -------------------------------------------------------------------------------- 1 | # Gossip Support 2 | 3 | The Gossip Support Subsystem is responsible for keeping track of session changes 4 | and issuing a connection request to all validators in the next, current and 5 | a few past sessions if we are a validator in these sessions. 6 | The request will add all validators to a reserved PeerSet, meaning we will not 7 | reject a connection request from any validator in that set. 8 | 9 | In addition to that, it creates a gossip overlay topology per session which 10 | limits the amount of messages sent and received to be an order of sqrt of the 11 | validators. Our neighbors in this graph will be forwarded to the network bridge 12 | with the `NetworkBridgeMessage::NewGossipTopology` message. 13 | 14 | See https://github.com/paritytech/polkadot/issues/3239 for more details. 15 | 16 | The gossip topology is used by parachain distribution subsystems, 17 | such as Bitfield Distribution, (small) Statement Distribution and 18 | Approval Distribution to limit the amount of peers we send messages to 19 | and handle view updates. 20 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/utility/peer-set-manager.md: -------------------------------------------------------------------------------- 1 | # Peer Set Manager 2 | 3 | > TODO 4 | 5 | ## Protocol 6 | 7 | ## Functionality 8 | 9 | ## Jobs, if any 10 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/node/utility/runtime-api.md: -------------------------------------------------------------------------------- 1 | # Runtime API 2 | 3 | The Runtime API subsystem is responsible for providing a single point of access to runtime state data via a set of pre-determined queries. This prevents shared ownership of a blockchain client resource by providing 4 | 5 | ## Protocol 6 | 7 | Input: [`RuntimeApiMessage`](../../types/overseer-protocol.md#runtime-api-message) 8 | 9 | Output: None 10 | 11 | ## Functionality 12 | 13 | On receipt of `RuntimeApiMessage::Request(relay_parent, request)`, answer the request using the post-state of the `relay_parent` provided and provide the response to the side-channel embedded within the request. 14 | 15 | ## Jobs 16 | 17 | > TODO Don't limit requests based on parent hash, but limit caching. No caching should be done for any requests on `relay_parent`s that are not active based on `ActiveLeavesUpdate` messages. Maybe with some leeway for things that have just been stopped. 18 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/candidate-events.md: -------------------------------------------------------------------------------- 1 | # Candidate Events 2 | 3 | Yields a vector of events concerning candidates that occurred within the given block. 4 | 5 | ```rust 6 | enum CandidateEvent { 7 | /// This candidate receipt was backed in the most recent block. 8 | CandidateBacked(CandidateReceipt, HeadData, CoreIndex, GroupIndex), 9 | /// This candidate receipt was included and became a parablock at the most recent block. 10 | CandidateIncluded(CandidateReceipt, HeadData, CoreIndex, GroupIndex), 11 | /// This candidate receipt was not made available in time and timed out. 12 | CandidateTimedOut(CandidateReceipt, HeadData, CoreIndex), 13 | } 14 | 15 | fn candidate_events(at: Block) -> Vec; 16 | ``` 17 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/candidate-pending-availability.md: -------------------------------------------------------------------------------- 1 | # Candidate Pending Availability 2 | 3 | Get the receipt of a candidate pending availability. This returns `Some` for any paras assigned to occupied cores in `availability_cores` and `None` otherwise. 4 | 5 | ```rust 6 | fn candidate_pending_availability(at: Block, ParaId) -> Option; 7 | ``` 8 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/candidates-included.md: -------------------------------------------------------------------------------- 1 | # Candidates Included 2 | 3 | This runtime API is for checking which candidates have been included within the chain, locally. 4 | 5 | ```rust 6 | /// Input and output have the same length. 7 | fn candidates_included(Vec<(SessionIndex, CandidateHash)>) -> Vec; 8 | ``` 9 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/disputes-info.md: -------------------------------------------------------------------------------- 1 | # Disputes Info 2 | 3 | Get information about all disputes known by the chain as well as information about which validators the disputes subsystem will accept disputes from. These disputes may be either live or concluded. The [`DisputeState`](../types/disputes.md#disputestate) can be used to determine whether the dispute still accepts votes, as well as which validators' votes may be included. 4 | 5 | ```rust 6 | struct Dispute { 7 | session: SessionIndex, 8 | candidate: CandidateHash, 9 | dispute_state: DisputeState, 10 | local: bool, 11 | } 12 | 13 | struct SpamSlotsInfo { 14 | max_spam_slots: u32, 15 | session_spam_slots: Vec<(SessionIndex, Vec)>, 16 | } 17 | 18 | struct DisputesInfo { 19 | disputes: Vec, 20 | spam_slots: SpamSlotsInfo, 21 | } 22 | 23 | fn disputes_info() -> DisputesInfo; 24 | ``` 25 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/persisted-validation-data.md: -------------------------------------------------------------------------------- 1 | # Persisted Validation Data 2 | 3 | Yields the [`PersistedValidationData`](../types/candidate.md#persistedvalidationdata) for the given [`ParaId`](../types/candidate.md#paraid) along with an assumption that should be used if the para currently occupies a core: 4 | 5 | ```rust 6 | /// Returns the persisted validation data for the given para and occupied core assumption. 7 | /// 8 | /// Returns `None` if either the para is not registered or the assumption is `Freed` 9 | /// and the para already occupies a core. 10 | fn persisted_validation_data(at: Block, ParaId, OccupiedCoreAssumption) -> Option; 11 | ``` -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/pvf-prechecking.md: -------------------------------------------------------------------------------- 1 | # PVF Pre-checking 2 | 3 | > ⚠️ This runtime API was added in v2. 4 | 5 | There are two main runtime APIs to work with PVF pre-checking. 6 | 7 | The first runtime API is designed to fetch all PVFs that require pre-checking voting. The PVFs are 8 | identified by their code hashes. As soon as the PVF gains required support, the runtime API will 9 | not return the PVF anymore. 10 | 11 | ```rust 12 | fn pvfs_require_precheck() -> Vec; 13 | ``` 14 | 15 | The second runtime API is needed to submit the judgement for a PVF, whether it is approved or not. 16 | The voting process uses unsigned transactions. The [`PvfCheckStatement`](../types/pvf-prechecking.md) is circulated through the network via gossip similar to a normal transaction. At some point the validator 17 | will include the statement in the block, where it will be processed by the runtime. If that was the 18 | last vote before gaining the super-majority, this PVF will not be returned by `pvfs_require_precheck` anymore. 19 | 20 | ```rust 21 | fn submit_pvf_check_statement(stmt: PvfCheckStatement, signature: ValidatorSignature); 22 | ``` 23 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/session-index.md: -------------------------------------------------------------------------------- 1 | # Session Index 2 | 3 | Get the session index that is expected at the child of a block. 4 | 5 | In the [`Initializer`](../runtime/initializer.md) module, session changes are buffered by one block. The session index of the child of any relay block is always predictable by that block's state. 6 | 7 | This session index can be used to derive a [`SigningContext`](../types/candidate.md#signing-context). 8 | 9 | ```rust 10 | /// Returns the session index expected at a child of the block. 11 | fn session_index_for_child(at: Block) -> SessionIndex; 12 | ``` 13 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/validation-code.md: -------------------------------------------------------------------------------- 1 | # Validation Code 2 | 3 | Fetch the validation code used by a para, making the given `OccupiedCoreAssumption`. 4 | 5 | ```rust 6 | fn validation_code(at: Block, ParaId, OccupiedCoreAssumption) -> Option; 7 | ``` 8 | 9 | Fetch the validation code (past, present or future) by its hash. 10 | 11 | ```rust 12 | fn validation_code_by_hash(at: Block, ValidationCodeHash) -> Option; 13 | ``` 14 | 15 | Fetch the validation code hash used by a para, making the given `OccupiedCoreAssumption`. 16 | 17 | > ⚠️ This API was introduced in `ParachainHost` v2. 18 | 19 | ```rust 20 | fn validation_code_hash(at: Block, ParaId, OccupiedCoreAssumption) -> Option; 21 | ``` 22 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/runtime-api/validators.md: -------------------------------------------------------------------------------- 1 | # Validators 2 | 3 | Yields the validator-set at the state of a given block. This validator set is always the one responsible for backing parachains in the child of the provided block. 4 | 5 | ```rust 6 | fn validators(at: Block) -> Vec; 7 | ``` 8 | -------------------------------------------------------------------------------- /roadmap/implementers-guide/src/types/pvf-prechecking.md: -------------------------------------------------------------------------------- 1 | # PVF Pre-checking types 2 | 3 | ## `PvfCheckStatement` 4 | 5 | > ⚠️ This type was added in v2. 6 | 7 | One of the main units of information on which PVF pre-checking voting is build is the `PvfCheckStatement`. 8 | 9 | This is a statement by the validator who ran the pre-checking process for a PVF. A PVF is identified by the `ValidationCodeHash`. 10 | 11 | The statement is valid only during a single session, specified in the `session_index`. 12 | 13 | ```rust 14 | struct PvfCheckStatement { 15 | /// `true` if the subject passed pre-checking and `false` otherwise. 16 | pub accept: bool, 17 | /// The validation code hash that was checked. 18 | pub subject: ValidationCodeHash, 19 | /// The index of a session during which this statement is considered valid. 20 | pub session_index: SessionIndex, 21 | /// The index of the validator from which this statement originates. 22 | pub validator_index: ValidatorIndex, 23 | } 24 | ``` 25 | -------------------------------------------------------------------------------- /roadmap/phase-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paritytech/polkadot/52209dcfe546ff39cc031b92d64e787e7e8264d4/roadmap/phase-1.png -------------------------------------------------------------------------------- /roadmap/render.sh: -------------------------------------------------------------------------------- 1 | # requires skill-tree: github.com/nikomatsakis/skill-tree 2 | 3 | render () { 4 | echo "Rendering $1" 5 | skill-tree $1.toml output 6 | python3 -c "from graphviz import render; render('dot', 'png', 'output/skill-tree.dot')" 7 | mv output/skill-tree.dot.png "$1.png" 8 | rm -rf output 9 | } 10 | 11 | render phase-1 12 | -------------------------------------------------------------------------------- /runtime/common/slot_range_helper/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "slot-range-helper" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | paste = "1.0" 10 | enumn = "0.1.8" 11 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 12 | sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 13 | sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 14 | 15 | [features] 16 | default = ["std"] 17 | std = [ 18 | "sp-std/std", 19 | "parity-scale-codec/std", 20 | "sp-runtime/std", 21 | ] 22 | -------------------------------------------------------------------------------- /runtime/kusama/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | fn main() { 20 | WasmBuilder::new() 21 | .with_current_project() 22 | .import_memory() 23 | .export_heap_base() 24 | .build() 25 | } 26 | -------------------------------------------------------------------------------- /runtime/kusama/constants/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kusama-runtime-constants" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | smallvec = "1.8.0" 10 | 11 | frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 12 | primitives = { package = "polkadot-primitives", path = "../../../primitives", default-features = false } 13 | runtime-common = { package = "polkadot-runtime-common", path = "../../common", default-features = false } 14 | sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 15 | sp-weights = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 16 | sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "frame-support/std", 22 | "primitives/std", 23 | "runtime-common/std", 24 | "sp-core/std", 25 | "sp-runtime/std", 26 | "sp-weights/std" 27 | ] 28 | -------------------------------------------------------------------------------- /runtime/kusama/constants/src/weights/mod.rs: -------------------------------------------------------------------------------- 1 | // This file is part of Substrate. 2 | 3 | // Copyright (C) Parity Technologies (UK) Ltd. 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | //! Expose the auto generated weight files. 19 | 20 | pub mod block_weights; 21 | pub mod extrinsic_weights; 22 | pub mod paritydb_weights; 23 | pub mod rocksdb_weights; 24 | 25 | pub use block_weights::BlockExecutionWeight; 26 | pub use extrinsic_weights::ExtrinsicBaseWeight; 27 | pub use paritydb_weights::constants::ParityDbWeight; 28 | pub use rocksdb_weights::constants::RocksDbWeight; 29 | -------------------------------------------------------------------------------- /runtime/metrics/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-runtime-metrics" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false} 10 | sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 11 | parity-scale-codec = { version = "3.6.1", default-features = false } 12 | primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false } 13 | frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } 14 | 15 | bs58 = { version = "0.4.0", default-features = false, features = ["alloc"] } 16 | 17 | [features] 18 | default = ["std"] 19 | std = [ 20 | "sp-std/std", 21 | "sp-tracing/std", 22 | "parity-scale-codec/std", 23 | "primitives/std", 24 | "bs58/std" 25 | ] 26 | runtime-metrics = ["sp-tracing/with-tracing", "frame-benchmarking"] 27 | -------------------------------------------------------------------------------- /runtime/metrics/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Runtime metric interface similar to native Prometheus metrics. 18 | //! 19 | //! This is intended to be used only for testing and debugging and **must never 20 | //! be used in production**. It requires the Substrate wasm tracing support 21 | //! and command line configuration: `--tracing-targets wasm_tracing=trace`. 22 | 23 | #![cfg_attr(not(feature = "std"), no_std)] 24 | 25 | #[cfg(feature = "runtime-metrics")] 26 | mod with_runtime_metrics; 27 | #[cfg(feature = "runtime-metrics")] 28 | pub use crate::with_runtime_metrics::*; 29 | 30 | #[cfg(not(feature = "runtime-metrics"))] 31 | mod without_runtime_metrics; 32 | #[cfg(not(feature = "runtime-metrics"))] 33 | pub use crate::without_runtime_metrics::*; 34 | -------------------------------------------------------------------------------- /runtime/parachains/src/configuration/migration.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! A module that is responsible for migration of storage. 18 | 19 | pub mod v6; 20 | pub mod v7; 21 | pub mod v8; 22 | -------------------------------------------------------------------------------- /runtime/parachains/src/disputes/benchmarking.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use super::*; 18 | 19 | use frame_benchmarking::benchmarks; 20 | use frame_system::RawOrigin; 21 | use sp_runtime::traits::One; 22 | 23 | benchmarks! { 24 | force_unfreeze { 25 | Frozen::::set(Some(One::one())); 26 | }: _(RawOrigin::Root) 27 | verify { 28 | assert!(Frozen::::get().is_none()) 29 | } 30 | 31 | impl_benchmark_test_suite!( 32 | Pallet, 33 | crate::mock::new_test_ext(Default::default()), 34 | crate::mock::Test 35 | ); 36 | } 37 | -------------------------------------------------------------------------------- /runtime/parachains/src/inclusion/benchmarking.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use super::*; 18 | use frame_benchmarking::benchmarks; 19 | use pallet_message_queue as mq; 20 | 21 | benchmarks! { 22 | where_clause { 23 | where 24 | T: mq::Config, 25 | } 26 | 27 | receive_upward_messages { 28 | let i in 1 .. 1000; 29 | 30 | let max_len = mq::MaxMessageLenOf::::get() as usize; 31 | let para = 42u32.into(); // not especially important. 32 | let upward_messages = vec![vec![0; max_len]; i as usize]; 33 | Pallet::::receive_upward_messages(para, vec![vec![0; max_len]; 1].as_slice()); 34 | }: { Pallet::::receive_upward_messages(para, upward_messages.as_slice()) } 35 | 36 | impl_benchmark_test_suite!( 37 | Pallet, 38 | crate::mock::new_test_ext(Default::default()), 39 | crate::mock::Test 40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /runtime/parachains/src/runtime_api_impl/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Runtime API implementations for Parachains. 18 | //! 19 | //! These are exposed as different modules using different sets of primitives. 20 | //! At the moment there is a `v2` module for the current stable API and 21 | //! `vstaging` module for all staging methods. 22 | //! When new version of the stable API is released it will be based on `v2` and 23 | //! will contain methods from `vstaging`. 24 | //! The promotion consists of the following steps: 25 | //! 1. Bump the version of the stable module (e.g. `v2` becomes `v3`) 26 | //! 2. Move methods from `vstaging` to `v3`. The new stable version should include all methods from 27 | //! `vstaging` tagged with the new version number (e.g. all `v3` methods). 28 | pub mod v5; 29 | pub mod vstaging; 30 | -------------------------------------------------------------------------------- /runtime/parachains/src/session_info/migration.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! A module that is responsible for migration of storage. 18 | 19 | use frame_support::traits::StorageVersion; 20 | 21 | /// The current storage version. 22 | pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); 23 | -------------------------------------------------------------------------------- /runtime/polkadot/README.adoc: -------------------------------------------------------------------------------- 1 | 2 | = Polkadot Runtime 3 | 4 | placeholder 5 | //TODO Write content :) (https://github.com/paritytech/polkadot/issues/159) 6 | -------------------------------------------------------------------------------- /runtime/polkadot/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Substrate is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | fn main() { 20 | WasmBuilder::new() 21 | .with_current_project() 22 | .import_memory() 23 | .export_heap_base() 24 | .build() 25 | } 26 | -------------------------------------------------------------------------------- /runtime/polkadot/constants/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-runtime-constants" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | smallvec = "1.8.0" 10 | 11 | frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 12 | primitives = { package = "polkadot-primitives", path = "../../../primitives", default-features = false } 13 | runtime-common = { package = "polkadot-runtime-common", path = "../../common", default-features = false } 14 | sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 15 | sp-weights = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 16 | sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "frame-support/std", 22 | "primitives/std", 23 | "runtime-common/std", 24 | "sp-core/std", 25 | "sp-runtime/std", 26 | "sp-weights/std" 27 | ] 28 | -------------------------------------------------------------------------------- /runtime/polkadot/constants/src/weights/mod.rs: -------------------------------------------------------------------------------- 1 | // This file is part of Substrate. 2 | 3 | // Copyright (C) Parity Technologies (UK) Ltd. 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | //! Expose the auto generated weight files. 19 | 20 | pub mod block_weights; 21 | pub mod extrinsic_weights; 22 | pub mod paritydb_weights; 23 | pub mod rocksdb_weights; 24 | 25 | pub use block_weights::BlockExecutionWeight; 26 | pub use extrinsic_weights::ExtrinsicBaseWeight; 27 | pub use paritydb_weights::constants::ParityDbWeight; 28 | pub use rocksdb_weights::constants::RocksDbWeight; 29 | -------------------------------------------------------------------------------- /runtime/rococo/README.md: -------------------------------------------------------------------------------- 1 | # Rococo: v2.1 2 | 3 | Rococo is a testnet runtime with no stability guarantees. 4 | 5 | ## How to run `rococo-local` 6 | 7 | The [Cumulus Tutorial](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/) details building, starting, and testing `rococo-local` and parachains connecting to it. 8 | 9 | ## How to register a parachain on the Rococo testnet 10 | 11 | The [parachain registration process](https://docs.substrate.io/tutorials/v3/cumulus/rococo/) on the public Rococo testnet is also outlined. 12 | -------------------------------------------------------------------------------- /runtime/rococo/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Substrate is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Substrate is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Substrate. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | fn main() { 20 | WasmBuilder::new() 21 | .with_current_project() 22 | .import_memory() 23 | .export_heap_base() 24 | .build() 25 | } 26 | -------------------------------------------------------------------------------- /runtime/rococo/constants/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rococo-runtime-constants" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | smallvec = "1.8.0" 10 | 11 | frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 12 | primitives = { package = "polkadot-primitives", path = "../../../primitives", default-features = false } 13 | runtime-common = { package = "polkadot-runtime-common", path = "../../common", default-features = false } 14 | sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 15 | sp-weights = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 16 | sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "frame-support/std", 22 | "primitives/std", 23 | "runtime-common/std", 24 | "sp-core/std", 25 | "sp-runtime/std", 26 | "sp-weights/std" 27 | ] 28 | -------------------------------------------------------------------------------- /runtime/rococo/constants/src/weights/mod.rs: -------------------------------------------------------------------------------- 1 | // This file is part of Substrate. 2 | 3 | // Copyright (C) Parity Technologies (UK) Ltd. 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | //! Expose the auto generated weight files. 19 | 20 | pub mod block_weights; 21 | pub mod extrinsic_weights; 22 | pub mod paritydb_weights; 23 | pub mod rocksdb_weights; 24 | 25 | pub use block_weights::BlockExecutionWeight; 26 | pub use extrinsic_weights::ExtrinsicBaseWeight; 27 | pub use paritydb_weights::constants::ParityDbWeight; 28 | pub use rocksdb_weights::constants::RocksDbWeight; 29 | -------------------------------------------------------------------------------- /runtime/test-runtime/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | fn main() { 20 | WasmBuilder::new() 21 | .with_current_project() 22 | .import_memory() 23 | .export_heap_base() 24 | .build() 25 | } 26 | -------------------------------------------------------------------------------- /runtime/test-runtime/constants/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test-runtime-constants" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | smallvec = "1.8.0" 11 | 12 | frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 13 | primitives = { package = "polkadot-primitives", path = "../../../primitives", default-features = false } 14 | runtime-common = { package = "polkadot-runtime-common", path = "../../common", default-features = false } 15 | sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 16 | sp-weights = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 17 | sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 18 | 19 | [features] 20 | default = ["std"] 21 | std = [ 22 | "sp-core/std", 23 | "sp-runtime/std", 24 | "sp-weights/std", 25 | "runtime-common/std", 26 | "primitives/std", 27 | "frame-support/std", 28 | ] 29 | -------------------------------------------------------------------------------- /runtime/test-runtime/constants/src/weights/mod.rs: -------------------------------------------------------------------------------- 1 | // This file is part of Substrate. 2 | 3 | // Copyright (C) Parity Technologies (UK) Ltd. 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | //! Expose the auto generated weight files. 19 | 20 | pub mod block_weights; 21 | pub mod extrinsic_weights; 22 | pub mod paritydb_weights; 23 | pub mod rocksdb_weights; 24 | 25 | pub use block_weights::constants::BlockExecutionWeight; 26 | pub use extrinsic_weights::constants::ExtrinsicBaseWeight; 27 | pub use paritydb_weights::constants::ParityDbWeight; 28 | pub use rocksdb_weights::constants::RocksDbWeight; 29 | -------------------------------------------------------------------------------- /runtime/westend/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Substrate is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | fn main() { 20 | WasmBuilder::new() 21 | .with_current_project() 22 | .import_memory() 23 | .export_heap_base() 24 | .build() 25 | } 26 | -------------------------------------------------------------------------------- /runtime/westend/constants/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "westend-runtime-constants" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | smallvec = "1.8.0" 10 | 11 | frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 12 | primitives = { package = "polkadot-primitives", path = "../../../primitives", default-features = false } 13 | runtime-common = { package = "polkadot-runtime-common", path = "../../common", default-features = false } 14 | sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 15 | sp-weights = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 16 | sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } 17 | 18 | [features] 19 | default = ["std"] 20 | std = [ 21 | "frame-support/std", 22 | "primitives/std", 23 | "runtime-common/std", 24 | "sp-core/std", 25 | "sp-runtime/std", 26 | "sp-weights/std" 27 | ] 28 | -------------------------------------------------------------------------------- /runtime/westend/constants/src/weights/mod.rs: -------------------------------------------------------------------------------- 1 | // This file is part of Substrate. 2 | 3 | // Copyright (C) Parity Technologies (UK) Ltd. 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | //! Expose the auto generated weight files. 19 | 20 | pub mod block_weights; 21 | pub mod extrinsic_weights; 22 | pub mod paritydb_weights; 23 | pub mod rocksdb_weights; 24 | 25 | pub use block_weights::BlockExecutionWeight; 26 | pub use extrinsic_weights::ExtrinsicBaseWeight; 27 | pub use paritydb_weights::constants::ParityDbWeight; 28 | pub use rocksdb_weights::constants::RocksDbWeight; 29 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | # Basic 2 | edition = "2021" 3 | hard_tabs = true 4 | max_width = 100 5 | use_small_heuristics = "Max" 6 | 7 | # Imports 8 | imports_granularity = "Crate" 9 | reorder_imports = true 10 | 11 | # Consistency 12 | newline_style = "Unix" 13 | 14 | # Format comments 15 | comment_width = 100 16 | wrap_comments = true 17 | 18 | # Misc 19 | chain_width = 80 20 | spaces_around_ranges = false 21 | binop_separator = "Back" 22 | reorder_impl_items = false 23 | match_arm_leading_pipes = "Preserve" 24 | match_arm_blocks = false 25 | match_block_trailing_comma = true 26 | trailing_comma = "Vertical" 27 | trailing_semicolon = false 28 | use_field_init_shorthand = true 29 | -------------------------------------------------------------------------------- /scripts/build-demos.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script assumes that all pre-requisites are installed. 4 | 5 | set -e 6 | 7 | PROJECT_ROOT=`git rev-parse --show-toplevel` 8 | source `dirname "$0"`/common.sh 9 | 10 | export CARGO_INCREMENTAL=0 11 | 12 | # Save current directory. 13 | pushd . 14 | 15 | cd $ROOT 16 | 17 | for DEMO in "${DEMOS[@]}" 18 | do 19 | echo "*** Building wasm binaries in $DEMO" 20 | cd "$PROJECT_ROOT/$DEMO" 21 | 22 | ./build.sh 23 | 24 | cd - >> /dev/null 25 | done 26 | 27 | # Restore initial directory. 28 | popd 29 | -------------------------------------------------------------------------------- /scripts/build-only-wasm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Script for building only the WASM binary of the given project. 4 | 5 | set -e 6 | 7 | PROJECT_ROOT=`git rev-parse --show-toplevel` 8 | 9 | if [ "$#" -lt 1 ]; then 10 | echo "You need to pass the name of the crate you want to compile!" 11 | exit 1 12 | fi 13 | 14 | WASM_BUILDER_RUNNER="$PROJECT_ROOT/target/release/wbuild-runner/$1" 15 | 16 | if [ -z "$2" ]; then 17 | export WASM_TARGET_DIRECTORY=$(pwd) 18 | else 19 | export WASM_TARGET_DIRECTORY=$2 20 | fi 21 | 22 | if [ -d $WASM_BUILDER_RUNNER ]; then 23 | export DEBUG=false 24 | export OUT_DIR="$PROJECT_ROOT/target/release/build" 25 | cargo run --release --manifest-path="$WASM_BUILDER_RUNNER/Cargo.toml" \ 26 | | grep -vE "cargo:rerun-if-|Executing build command" 27 | else 28 | cargo build --release -p $1 29 | fi 30 | -------------------------------------------------------------------------------- /scripts/ci/changelog/.gitignore: -------------------------------------------------------------------------------- 1 | changelog.md 2 | *.json 3 | release*.md 4 | .env 5 | -------------------------------------------------------------------------------- /scripts/ci/changelog/Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | 5 | git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } 6 | 7 | gem 'octokit', '~> 4' 8 | 9 | gem 'git_diff_parser', '~> 3' 10 | 11 | gem 'toml', '~> 0.3.0' 12 | 13 | gem 'rake', group: :dev 14 | 15 | gem 'optparse', '~> 0.1.1' 16 | 17 | gem 'logger', '~> 1.4' 18 | 19 | gem 'changelogerator', '0.10.1' 20 | 21 | gem 'test-unit', group: :dev 22 | 23 | gem 'rubocop', group: :dev, require: false 24 | -------------------------------------------------------------------------------- /scripts/ci/changelog/digests/.gitignore: -------------------------------------------------------------------------------- 1 | *.json 2 | -------------------------------------------------------------------------------- /scripts/ci/changelog/digests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paritytech/polkadot/52209dcfe546ff39cc031b92d64e787e7e8264d4/scripts/ci/changelog/digests/.gitkeep -------------------------------------------------------------------------------- /scripts/ci/changelog/lib/changelog.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # A Class to find Substrate references 4 | class SubRef 5 | require 'octokit' 6 | require 'toml' 7 | 8 | attr_reader :client, :repository 9 | 10 | def initialize(github_repo) 11 | @client = Octokit::Client.new( 12 | access_token: ENV['GITHUB_TOKEN'] 13 | ) 14 | @repository = @client.repository(github_repo) 15 | end 16 | 17 | # This function checks the Cargo.lock of a given 18 | # Rust project, for a given package, and fetches 19 | # the dependency git ref. 20 | def get_dependency_reference(ref, package) 21 | cargo = TOML::Parser.new( 22 | Base64.decode64( 23 | @client.contents( 24 | @repository.full_name, 25 | path: 'Cargo.lock', 26 | query: { ref: ref.to_s } 27 | ).content 28 | ) 29 | ).parsed 30 | cargo['package'].find { |p| p['name'] == package }['source'].split('#').last 31 | end 32 | 33 | # Get the git ref of the last release for the repo. 34 | # repo is given in the form paritytech/polkadot 35 | def get_last_ref() 36 | 'refs/tags/' + @client.latest_release(@repository.full_name).tag_name 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/_free_notes.md.tera: -------------------------------------------------------------------------------- 1 | 2 | {# This file uses the Markdown format with additional templating such as this comment. -#} 3 | {# Such a comment will not show up in the rendered release notes. -#} 4 | {# The content of this file (if any) will be inserted at the top of the release notes -#} 5 | {# and generated for each new release candidate. -#} 6 | {# Ensure you leave an empty line at both top and bottom of this file. -#} 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/change.md.tera: -------------------------------------------------------------------------------- 1 | {# This macro shows ONE change #} 2 | {%- macro change(c, cml="[C]", dot="[P]", sub="[S]") -%} 3 | 4 | {%- if c.meta.C and c.meta.C.agg.max >= 7 -%} 5 | {%- set prio = " ‼️ HIGH" -%} 6 | {%- elif c.meta.C and c.meta.C.agg.max >= 3 -%} 7 | {%- set prio = " ❗️ Medium" -%} 8 | {%- elif c.meta.C and c.meta.C.agg.max < 3 -%} 9 | {%- set prio = " Low" -%} 10 | {%- else -%} 11 | {%- set prio = "" -%} 12 | {%- endif -%} 13 | 14 | {%- set audit = "" -%} 15 | 16 | {%- if c.meta.D and c.meta.D.D1 -%} 17 | {%- set audit = "✅ audited " -%} 18 | {%- elif c.meta.D and c.meta.D.D2 -%} 19 | {%- set audit = "✅ trivial " -%} 20 | {%- elif c.meta.D and c.meta.D.D3 -%} 21 | {%- set audit = "✅ trivial " -%} 22 | {%- elif c.meta.D and c.meta.D.D5 -%} 23 | {%- set audit = "⏳ pending non-critical audit " -%} 24 | {%- else -%} 25 | {%- set audit = "" -%} 26 | {%- endif -%} 27 | 28 | {%- if c.html_url is containing("polkadot") -%} 29 | {%- set repo = dot -%} 30 | {%- elif c.html_url is containing("substrate") -%} 31 | {%- set repo = sub -%} 32 | {%- else -%} 33 | {%- set repo = " " -%} 34 | {%- endif -%} 35 | 36 | {%- if c.meta.T and c.meta.T.T6 -%} 37 | {%- set xcm = " [✉️ XCM]" -%} 38 | {%- else -%} 39 | {%- set xcm = "" -%} 40 | {%- endif -%} 41 | 42 | {{- repo }} {{ audit }}[`#{{c.number}}`]({{c.html_url}}) {{- prio }} - {{ c.title | capitalize | truncate(length=120, end="…") }}{{xcm }} 43 | {%- endmacro change -%} 44 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/changes.md.tera: -------------------------------------------------------------------------------- 1 | {# This include generates the section showing the changes #} 2 | ## Changes 3 | 4 | ### Legend 5 | 6 | - {{ DOT }} Polkadot 7 | - {{ SUB }} Substrate 8 | 9 | {% include "changes_client.md.tera" %} 10 | 11 | {% include "changes_runtime.md.tera" %} 12 | 13 | {% include "changes_api.md.tera" %} 14 | 15 | {% include "changes_misc.md.tera" %} 16 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/changes_api.md.tera: -------------------------------------------------------------------------------- 1 | {% import "change.md.tera" as m_c -%} 2 | ### API 3 | 4 | {#- The changes are sorted by merge date #} 5 | {%- for pr in changes | sort(attribute="merged_at") %} 6 | 7 | {%- if pr.meta.B %} 8 | {%- if pr.meta.B.B0 %} 9 | {#- We skip silent ones -#} 10 | {%- else -%} 11 | 12 | {%- if pr.meta.T and pr.meta.T.T2 and not pr.title is containing("ompanion") %} 13 | - {{ m_c::change(c=pr) }} 14 | {%- endif -%} 15 | {% endif -%} 16 | {% endif -%} 17 | {% endfor %} 18 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/changes_client.md.tera: -------------------------------------------------------------------------------- 1 | {% import "change.md.tera" as m_c -%} 2 | ### Client 3 | 4 | {#- The changes are sorted by merge date #} 5 | {%- for pr in changes | sort(attribute="merged_at") %} 6 | 7 | {%- if pr.meta.B %} 8 | {%- if pr.meta.B.B0 %} 9 | {#- We skip silent ones -#} 10 | {%- else -%} 11 | 12 | {%- if pr.meta.T and pr.meta.T.T0 and not pr.title is containing("ompanion") %} 13 | - {{ m_c::change(c=pr) }} 14 | {%- endif -%} 15 | {% endif -%} 16 | {% endif -%} 17 | {% endfor %} 18 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/changes_misc.md.tera: -------------------------------------------------------------------------------- 1 | {%- import "change.md.tera" as m_c -%} 2 | 3 | {%- set_global misc_count = 0 -%} 4 | {#- First pass to count #} 5 | {%- for pr in changes -%} 6 | {%- if pr.meta.B %} 7 | {%- if pr.meta.B.B0 -%} 8 | {#- We skip silent ones -#} 9 | {%- else -%} 10 | {%- if pr.meta.T and pr.meta.T.agg.max > 2 %} 11 | {%- set_global misc_count = misc_count + 1 -%} 12 | {%- endif -%} 13 | {% endif -%} 14 | {% endif -%} 15 | {% endfor -%} 16 | 17 | 18 | {%- if misc_count > 0 %} 19 | ### Misc 20 | 21 | {% if misc_count > 10 %} 22 | There are other misc. changes. You can expand the list below to view them all. 23 |
Other misc. changes 24 | {% endif -%} 25 | 26 | {#- The changes are sorted by merge date #} 27 | {%- for pr in changes | sort(attribute="merged_at") %} 28 | {%- if pr.meta.B and not pr.title is containing("ompanion") %} 29 | {%- if pr.meta.B.B0 %} 30 | {#- We skip silent ones -#} 31 | {%- else -%} 32 | {%- if pr.meta.T and pr.meta.T.agg.max > 2 %} 33 | - {{ m_c::change(c=pr) }} 34 | {%- endif -%} 35 | {% endif -%} 36 | {% endif -%} 37 | {% endfor %} 38 | 39 | {% if misc_count > 10 %} 40 |
41 | {% endif -%} 42 | {% endif -%} 43 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/changes_runtime.md.tera: -------------------------------------------------------------------------------- 1 | {%- import "change.md.tera" as m_c -%} 2 | 3 | ### Runtime 4 | 5 | {#- The changes are sorted by merge date -#} 6 | {% for pr in changes | sort(attribute="merged_at") -%} 7 | 8 | {%- if pr.meta.B -%} 9 | {%- if pr.meta.B.B0 -%} 10 | {#- We skip silent ones -#} 11 | {%- else -%} 12 | 13 | {%- if pr.meta.T and pr.meta.T.T1 and not pr.title is containing("ompanion") %} 14 | - {{ m_c::change(c=pr) }} 15 | {%- endif -%} 16 | {%- endif -%} 17 | 18 | {%- endif -%} 19 | {%- endfor %} 20 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/compiler.md.tera: -------------------------------------------------------------------------------- 1 | ## Rust compiler versions 2 | 3 | This release was built and tested against the following versions of `rustc`. 4 | Other versions may work. 5 | 6 | - Rust Stable: `{{ env.RUSTC_STABLE }}` 7 | - Rust Nightly: `{{ env.RUSTC_NIGHTLY }}` 8 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/debug.md.tera: -------------------------------------------------------------------------------- 1 | {%- set to_ignore = changes | filter(attribute="meta.B.B0") %} 2 | 3 | 9 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/docker_image.md.tera: -------------------------------------------------------------------------------- 1 | 2 | ## Docker image 3 | 4 | The docker image for this release can be found at [Docker hub](https://hub.docker.com/r/parity/polkadot/tags?page=1&ordering=last_updated) 5 | (It will be available a few minutes after the release has been published). 6 | 7 | You may pull it using: 8 | 9 | ``` 10 | docker pull parity/polkadot:latest 11 | ``` 12 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/full_pr_list.md.tera: -------------------------------------------------------------------------------- 1 | {# This is a helper template to get the FULL PR list #} 2 | {# It is not used in the release notes #} 3 | 4 | # PR list 5 | 6 | ## substrate 7 | 8 | {%- for change in substrate.changes %} 9 | - [S] [`{{ change.number }}`]({{ change.html_url }}) - {{ change.title }} 10 | {%- endfor %} 11 | 12 | ## polkadot 13 | 14 | {%- for change in polkadot.changes %} 15 | - [P] [`{{ change.number }}`]({{ change.html_url }}) - {{ change.title }} 16 | {%- endfor %} 17 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/global_priority.md.tera: -------------------------------------------------------------------------------- 1 | {% import "high_priority.md.tera" as m_p -%} 2 | ## Upgrade Priority 3 | 4 | {%- set polkadot_prio = 0 -%} 5 | {%- set substrate_prio = 0 -%} 6 | 7 | {# We fetch the various priorities #} 8 | {%- if polkadot.meta.C -%} 9 | {%- set polkadot_prio = polkadot.meta.C.max -%} 10 | {%- endif -%} 11 | {%- if substrate.meta.C -%} 12 | {%- set substrate_prio = substrate.meta.C.max -%} 13 | {%- endif -%} 14 | 15 | {# We compute the global priority #} 16 | {%- set global_prio = polkadot_prio -%} 17 | {%- if substrate_prio > global_prio -%} 18 | {%- set global_prio = substrate_prio -%} 19 | {%- endif -%} 20 | 21 | {#- We show the result #} 22 | {{ m_p::high_priority(p=global_prio, changes=changes) }} 23 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/high_priority.md.tera: -------------------------------------------------------------------------------- 1 | {%- import "change.md.tera" as m_c -%} 2 | 3 | {# This macro convert a priority level into readable output #} 4 | {%- macro high_priority(p, changes) -%} 5 | 6 | {%- if p >= 7 -%} 7 | {%- set prio = "‼️ HIGH" -%} 8 | {%- set text = "This is a **high priority** release and you must upgrade as as soon as possible." -%} 9 | {%- elif p >= 3 -%} 10 | {%- set prio = "❗️ Medium" -%} 11 | {%- set text = "This is a medium priority release and you should upgrade in a timely manner." -%} 12 | {%- else -%} 13 | {%- set prio = "Low" -%} 14 | {%- set text = "This is a low priority release and you may upgrade at your convenience." -%} 15 | {%- endif %} 16 | 17 | 18 | 19 | {%- if prio %} 20 | {{prio}}: {{text}} 21 | 22 | {% if p >= 3 %} 23 | The changes motivating this priority level are: 24 | {% for pr in changes | sort(attribute="merged_at") -%} 25 | {%- if pr.meta.C -%} 26 | {%- if pr.meta.C.agg.max >= p %} 27 | - {{ m_c::change(c=pr) }} 28 | {%- if pr.meta.T and pr.meta.T.T1 %} (RUNTIME) 29 | {% endif %} 30 | {%- endif -%} 31 | {%- endif -%} 32 | {%- endfor -%} 33 | {%- else -%} 34 | 35 | {%- endif -%} 36 | {%- endif -%} 37 | 38 | {%- endmacro priority -%} 39 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/host_functions-list.md.tera: -------------------------------------------------------------------------------- 1 | {%- import "change.md.tera" as m_c -%} 2 | 3 | {% for pr in changes | sort(attribute="merged_at") -%} 4 | 5 | {%- if pr.meta.B and pr.meta.B.B0 -%} 6 | {#- We skip silent ones -#} 7 | {%- else -%} 8 | {%- if pr.meta.E and pr.meta.E.E3 -%} 9 | - {{ m_c::change(c=pr) }} 10 | {% endif -%} 11 | {% endif -%} 12 | {%- endfor -%} 13 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/migrations-db.md.tera: -------------------------------------------------------------------------------- 1 | {% import "change.md.tera" as m_c %} 2 | {%- set_global db_migration_count = 0 -%} 3 | {%- for pr in changes -%} 4 | {%- if pr.meta.B and pr.meta.B.B0 %} 5 | {#- We skip silent ones -#} 6 | {%- elif pr.meta.E and pr.meta.E.E1 -%} 7 | {%- set_global db_migration_count = db_migration_count + 1 -%} 8 | {%- endif -%} 9 | {%- endfor %} 10 | 11 | ## Database Migrations 12 | 13 | Database migrations are operations upgrading the database to the latest stand. 14 | Some migrations may break compatibility, making a backup of your database is highly recommended. 15 | 16 | {% if db_migration_count == 0 -%} 17 | ℹ️ There is no database migration in this release. 18 | {%- elif db_migration_count == 1 -%} 19 | ⚠️ There is one database migration in this release: 20 | {%- else -%} 21 | ⚠️ There are {{ db_migration_count }} database migrations in this release: 22 | {%- endif %} 23 | {% for pr in changes | sort(attribute="merged_at") -%} 24 | 25 | {%- if pr.meta.B and pr.meta.B.B0 %} 26 | {#- We skip silent ones -#} 27 | {%- elif pr.meta.E and pr.meta.E.E1 -%} 28 | - {{ m_c::change(c=pr) }} 29 | {% endif -%} 30 | {% endfor -%} 31 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/migrations-runtime.md.tera: -------------------------------------------------------------------------------- 1 | {%- import "change.md.tera" as m_c %} 2 | {%- set_global runtime_migration_count = 0 -%} 3 | {%- for pr in changes -%} 4 | {%- if pr.meta.B and pr.meta.B.B0 %} 5 | {#- We skip silent ones -#} 6 | {%- elif pr.meta.E and pr.meta.E.E0 -%} 7 | {%- set_global runtime_migration_count = runtime_migration_count + 1 -%} 8 | {%- endif -%} 9 | {%- endfor %} 10 | 11 | ## Runtime Migrations 12 | 13 | Runtime migrations are operations running once during a runtime upgrade. 14 | 15 | {% if runtime_migration_count == 0 -%} 16 | ℹ️ There is no runtime migration in this release. 17 | {%- elif runtime_migration_count == 1 -%} 18 | ⚠️ There is one runtime migration in this release: 19 | {%- else -%} 20 | ⚠️ There are {{ runtime_migration_count }} runtime migrations in this release: 21 | {%- endif %} 22 | {% for pr in changes | sort(attribute="merged_at") -%} 23 | 24 | {%- if pr.meta.B and pr.meta.B.B0 %} 25 | {#- We skip silent ones -#} 26 | {%- elif pr.meta.E and pr.meta.E.E0 -%} 27 | - {{ m_c::change(c=pr) }} 28 | {% endif -%} 29 | {% endfor -%} 30 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/pre_release.md.tera: -------------------------------------------------------------------------------- 1 | {%- if env.PRE_RELEASE == "true" -%} 2 |
⚠️ This is a pre-release 3 | 4 | **Release candidates** are **pre-releases** and may not be final. 5 | Although they are reasonably tested, there may be additional changes or issues 6 | before an official release is tagged. Use at your own discretion, and consider 7 | only using final releases on critical production infrastructure. 8 |
9 | {% else -%} 10 | 11 | {%- endif %} 12 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/runtimes.md.tera: -------------------------------------------------------------------------------- 1 | {# This include shows the list and details of the runtimes #} 2 | {%- import "runtime.md.tera" as m_r -%} 3 | 4 | {# --- #} 5 | 6 | ## Runtimes 7 | 8 | {% set rtm = srtool[0] -%} 9 | 10 | The information about the runtimes included in this release can be found below. 11 | The runtimes have been built using [{{ rtm.data.gen }}](https://github.com/paritytech/srtool) and `{{ rtm.data.rustc }}`. 12 | 13 | {%- for runtime in srtool | sort(attribute="name") %} 14 | {%- set HIDE_VAR = "HIDE_SRTOOL_" ~ runtime.name | upper %} 15 | {%- if not env is containing(HIDE_VAR) %} 16 | 17 | {{ m_r::runtime(runtime=runtime) }} 18 | {%- endif %} 19 | {%- endfor %} 20 | -------------------------------------------------------------------------------- /scripts/ci/changelog/templates/template.md.tera: -------------------------------------------------------------------------------- 1 | {# This is the entry point of the template -#} 2 | 3 | {% include "pre_release.md.tera" -%} 4 | 5 | {% if env.PRE_RELEASE == "true" -%} 6 | This pre-release contains the changes from `{{ env.REF1 | replace(from="refs/tags/", to="") }}` to `{{ env.REF2 | replace(from="refs/tags/", to="") }}`. 7 | {%- else -%} 8 | This release contains the changes from `{{ env.REF1 | replace(from="refs/tags/", to="") }}` to `{{ env.REF2 | replace(from="refs/tags/", to="") }}`. 9 | {% endif -%} 10 | 11 | {%- set changes = polkadot.changes | concat(with=substrate.changes) -%} 12 | {%- include "debug.md.tera" -%} 13 | 14 | {%- set CML = "[C]" -%} 15 | {%- set DOT = "[P]" -%} 16 | {%- set SUB = "[S]" -%} 17 | 18 | {# -- Manual free notes section -- #} 19 | {% include "_free_notes.md.tera" -%} 20 | 21 | {# -- Important automatic section -- #} 22 | {% include "global_priority.md.tera" -%} 23 | 24 | {% include "host_functions.md.tera" -%} 25 | 26 | {% include "migrations-db.md.tera" -%} 27 | 28 | {% include "migrations-runtime.md.tera" -%} 29 | {# --------------------------------- #} 30 | 31 | {% include "compiler.md.tera" -%} 32 | 33 | {% include "runtimes.md.tera" -%} 34 | 35 | {% include "changes.md.tera" -%} 36 | 37 | {% include "docker_image.md.tera" -%} 38 | -------------------------------------------------------------------------------- /scripts/ci/changelog/test/test_basic.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative '../lib/changelog' 4 | require 'test/unit' 5 | 6 | class TestChangelog < Test::Unit::TestCase 7 | def test_get_dep_ref_polkadot 8 | c = SubRef.new('paritytech/polkadot') 9 | ref = '13c2695' 10 | package = 'sc-cli' 11 | result = c.get_dependency_reference(ref, package) 12 | assert_equal('7db0768a85dc36a3f2a44d042b32f3715c00a90d', result) 13 | end 14 | 15 | def test_get_dep_ref_invalid_ref 16 | c = SubRef.new('paritytech/polkadot') 17 | ref = '9999999' 18 | package = 'sc-cli' 19 | assert_raise do 20 | c.get_dependency_reference(ref, package) 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/adder-collator/build-injected.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Sample call: 4 | # $0 /path/to/folder_with_binary 5 | # This script replace the former dedicated Dockerfile 6 | # and shows how to use the generic binary_injected.dockerfile 7 | 8 | PROJECT_ROOT=`git rev-parse --show-toplevel` 9 | 10 | export BINARY=adder-collator,undying-collator 11 | export BIN_FOLDER=$1 12 | 13 | $PROJECT_ROOT/scripts/ci/dockerfiles/build-injected.sh 14 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/adder-collator/test-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TMP=$(mktemp -d) 4 | ENGINE=${ENGINE:-podman} 5 | 6 | # TODO: Switch to /bin/bash when the image is built from parity/base-bin 7 | 8 | # Fetch some binaries 9 | $ENGINE run --user root --rm -i \ 10 | --pull always \ 11 | -v "$TMP:/export" \ 12 | --entrypoint /usr/bin/bash \ 13 | paritypr/colander:master -c \ 14 | 'cp "$(which adder-collator)" /export' 15 | 16 | $ENGINE run --user root --rm -i \ 17 | --pull always \ 18 | -v "$TMP:/export" \ 19 | --entrypoint /usr/bin/bash \ 20 | paritypr/colander:master -c \ 21 | 'cp "$(which undying-collator)" /export' 22 | 23 | ./build-injected.sh $TMP 24 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/binary_injected.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/parity/base-bin 2 | 3 | # This file allows building a Generic container image 4 | # based on one or multiple pre-built Linux binaries. 5 | # Some defaults are set to polkadot but all can be overriden. 6 | 7 | SHELL ["/bin/bash", "-c"] 8 | 9 | # metadata 10 | ARG VCS_REF 11 | ARG BUILD_DATE 12 | ARG IMAGE_NAME 13 | 14 | # That can be a single one or a comma separated list 15 | ARG BINARY=polkadot 16 | 17 | ARG BIN_FOLDER=. 18 | ARG DOC_URL=https://github.com/paritytech/polkadot 19 | ARG DESCRIPTION="Polkadot: a platform for web3" 20 | ARG AUTHORS="devops-team@parity.io" 21 | ARG VENDOR="Parity Technologies" 22 | 23 | LABEL io.parity.image.authors=${AUTHORS} \ 24 | io.parity.image.vendor="${VENDOR}" \ 25 | io.parity.image.revision="${VCS_REF}" \ 26 | io.parity.image.title="${IMAGE_NAME}" \ 27 | io.parity.image.created="${BUILD_DATE}" \ 28 | io.parity.image.documentation="${DOC_URL}" \ 29 | io.parity.image.description="${DESCRIPTION}" \ 30 | io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/ci/dockerfiles/binary_injected.Dockerfile" 31 | 32 | USER root 33 | WORKDIR /app 34 | 35 | # add polkadot binary to docker image 36 | # sample for polkadot: COPY ./polkadot ./polkadot-*-worker /usr/local/bin/ 37 | COPY entrypoint.sh . 38 | COPY "bin/*" "/usr/local/bin/" 39 | RUN chmod -R a+rx "/usr/local/bin" 40 | 41 | USER parity 42 | ENV BINARY=${BINARY} 43 | 44 | # ENTRYPOINT 45 | ENTRYPOINT ["/app/entrypoint.sh"] 46 | 47 | # We call the help by default 48 | CMD ["--help"] 49 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Sanity check 4 | if [ -z "$BINARY" ] 5 | then 6 | echo "BINARY ENV not defined, this should never be the case. Aborting..." 7 | exit 1 8 | fi 9 | 10 | # If the user built the image with multiple binaries, 11 | # we consider the first one to be the canonical one 12 | # To start with another binary, the user can either: 13 | # - use the --entrypoint option 14 | # - pass the ENV BINARY with a single binary 15 | IFS=',' read -r -a BINARIES <<< "$BINARY" 16 | BIN0=${BINARIES[0]} 17 | echo "Starting binary $BIN0" 18 | $BIN0 $@ 19 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/malus/build-injected.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Sample call: 4 | # $0 /path/to/folder_with_binary 5 | # This script replace the former dedicated Dockerfile 6 | # and shows how to use the generic binary_injected.dockerfile 7 | 8 | PROJECT_ROOT=`git rev-parse --show-toplevel` 9 | 10 | export BINARY=malus,polkadot-execute-worker,polkadot-prepare-worker 11 | export BIN_FOLDER=$1 12 | # export TAGS=... 13 | 14 | $PROJECT_ROOT/scripts/ci/dockerfiles/build-injected.sh 15 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/malus/test-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TMP=$(mktemp -d) 4 | ENGINE=${ENGINE:-podman} 5 | 6 | export TAGS=latest,beta,7777,1.0.2-rc23 7 | 8 | # Fetch some binaries 9 | $ENGINE run --user root --rm -i \ 10 | --pull always \ 11 | -v "$TMP:/export" \ 12 | --entrypoint /bin/bash \ 13 | paritypr/malus:7217 -c \ 14 | 'cp "$(which malus)" /export' 15 | 16 | echo "Checking binaries we got:" 17 | ls -al $TMP 18 | 19 | ./build-injected.sh $TMP 20 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/polkadot/README.md: -------------------------------------------------------------------------------- 1 | # Self built Docker image 2 | 3 | The Polkadot repo contains several options to build Docker images for Polkadot. 4 | 5 | This folder contains a self-contained image that does not require a Linux pre-built binary. 6 | 7 | Instead, building the image is possible on any host having docker installed and will 8 | build Polkadot inside Docker. That also means that no Rust toolchain is required on the host 9 | machine for the build to succeed. 10 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/polkadot/build-injected.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Sample call: 4 | # $0 /path/to/folder_with_binary 5 | # This script replace the former dedicated Dockerfile 6 | # and shows how to use the generic binary_injected.dockerfile 7 | 8 | PROJECT_ROOT=`git rev-parse --show-toplevel` 9 | 10 | export BINARY=polkadot,polkadot-execute-worker,polkadot-prepare-worker 11 | export BIN_FOLDER=$1 12 | 13 | $PROJECT_ROOT/scripts/ci/dockerfiles/build-injected.sh 14 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/polkadot/docker-compose-local.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | node_alice: 4 | ports: 5 | - "30333:30333" 6 | - "9933:9933" 7 | - "9944:9944" 8 | - "9615:9615" 9 | image: parity/polkadot:latest 10 | volumes: 11 | - "polkadot-data-alice:/data" 12 | command: | 13 | --chain=polkadot-local 14 | --alice 15 | -d /data 16 | --node-key 0000000000000000000000000000000000000000000000000000000000000001 17 | networks: 18 | testing_net: 19 | ipv4_address: 172.28.1.1 20 | 21 | node_bob: 22 | ports: 23 | - "30344:30333" 24 | - "9935:9933" 25 | - "9945:9944" 26 | - "29615:9615" 27 | image: parity/polkadot:latest 28 | volumes: 29 | - "polkadot-data-bob:/data" 30 | links: 31 | - "node_alice:alice" 32 | command: | 33 | --chain=polkadot-local 34 | --bob 35 | -d /data 36 | --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR' 37 | networks: 38 | testing_net: 39 | ipv4_address: 172.28.1.2 40 | 41 | volumes: 42 | polkadot-data-alice: 43 | polkadot-data-bob: 44 | 45 | networks: 46 | testing_net: 47 | ipam: 48 | driver: default 49 | config: 50 | - subnet: 172.28.0.0/16 51 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/polkadot/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | polkadot: 4 | image: parity/polkadot:latest 5 | 6 | ports: 7 | - "127.0.0.1:30333:30333/tcp" 8 | - "127.0.0.1:9933:9933/tcp" 9 | - "127.0.0.1:9944:9944/tcp" 10 | - "127.0.0.1:9615:9615/tcp" 11 | 12 | volumes: 13 | - "polkadot-data:/data" 14 | 15 | command: | 16 | --unsafe-rpc-external 17 | --unsafe-ws-external 18 | --rpc-cors all 19 | --prometheus-external 20 | 21 | volumes: 22 | polkadot-data: 23 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/polkadot/polkadot_Dockerfile.README.md: -------------------------------------------------------------------------------- 1 | # Polkadot official Docker image 2 | 3 | ## [Polkadot](https://polkadot.network/) 4 | 5 | ## [GitHub](https://github.com/paritytech/polkadot) 6 | 7 | ## [Polkadot Wiki](https://wiki.polkadot.network/) 8 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/polkadot/test-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TMP=$(mktemp -d) 4 | ENGINE=${ENGINE:-podman} 5 | 6 | # You need to build an injected image first 7 | 8 | # Fetch some binaries 9 | $ENGINE run --user root --rm -i \ 10 | -v "$TMP:/export" \ 11 | --entrypoint /bin/bash \ 12 | parity/polkadot -c \ 13 | 'cp "$(which polkadot)" /export' 14 | 15 | echo "Checking binaries we got:" 16 | tree $TMP 17 | 18 | ./build-injected.sh $TMP 19 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/staking-miner/README.md: -------------------------------------------------------------------------------- 1 | # staking-miner container image 2 | 3 | ## Build using the Builder 4 | 5 | ``` 6 | ./build.sh 7 | ``` 8 | 9 | ## Build the injected Image 10 | 11 | You first need a valid Linux binary to inject. Let's assume this binary is located in `BIN_FOLDER`. 12 | 13 | ``` 14 | ./build-injected.sh "$BIN_FOLDER" 15 | ``` 16 | 17 | ## Test 18 | 19 | Here is how to test the image. We can generate a valid seed but the staking-miner will quickly notice that our 20 | account is not funded and "does not exist". 21 | 22 | You may pass any ENV supported by the binary and must provide at least a few such as `SEED` and `URI`: 23 | ``` 24 | ENV SEED="" 25 | ENV URI="wss://rpc.polkadot.io:443" 26 | ENV RUST_LOG="info" 27 | ``` 28 | 29 | ``` 30 | export SEED=$(subkey generate -n polkadot --output-type json | jq -r .secretSeed) 31 | podman run --rm -it \ 32 | -e URI="wss://rpc.polkadot.io:443" \ 33 | -e RUST_LOG="info" \ 34 | -e SEED \ 35 | localhost/parity/staking-miner \ 36 | dry-run seq-phragmen 37 | ``` 38 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/staking-miner/build-injected.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Sample call: 4 | # $0 /path/to/folder_with_staking-miner_binary 5 | # This script replace the former dedicated staking-miner "injected" Dockerfile 6 | # and shows how to use the generic binary_injected.dockerfile 7 | 8 | PROJECT_ROOT=`git rev-parse --show-toplevel` 9 | 10 | export BINARY=staking-miner 11 | export BIN_FOLDER=$1 12 | 13 | $PROJECT_ROOT/scripts/ci/dockerfiles/build-injected.sh 14 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/staking-miner/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Sample call: 4 | # $0 /path/to/folder_with_staking-miner_binary 5 | # This script replace the former dedicated staking-miner "injected" Dockerfile 6 | # and shows how to use the generic binary_injected.dockerfile 7 | 8 | PROJECT_ROOT=`git rev-parse --show-toplevel` 9 | ENGINE=podman 10 | 11 | echo "Building the staking-miner using the Builder image" 12 | echo "PROJECT_ROOT=$PROJECT_ROOT" 13 | $ENGINE build -t staking-miner -f staking-miner_builder.Dockerfile "$PROJECT_ROOT" 14 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/staking-miner/staking-miner_Dockerfile.README.md: -------------------------------------------------------------------------------- 1 | # Staking-miner Docker image 2 | 3 | ## [GitHub](https://github.com/paritytech/polkadot/tree/master/utils/staking-miner) 4 | -------------------------------------------------------------------------------- /scripts/ci/dockerfiles/staking-miner/test-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TMP=$(mktemp -d) 4 | ENGINE=${ENGINE:-podman} 5 | 6 | # You need to build an injected image first 7 | 8 | # Fetch some binaries 9 | $ENGINE run --user root --rm -i \ 10 | -v "$TMP:/export" \ 11 | --entrypoint /bin/bash \ 12 | parity/staking-miner -c \ 13 | 'cp "$(which staking-miner)" /export' 14 | 15 | echo "Checking binaries we got:" 16 | tree $TMP 17 | 18 | ./build-injected.sh $TMP 19 | -------------------------------------------------------------------------------- /scripts/ci/github/check_weights_swc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Need to set globstar for ** magic 3 | shopt -s globstar 4 | 5 | RUNTIME=$1 6 | VERSION=$2 7 | echo "
" 8 | echo "Weight changes for $RUNTIME" 9 | echo 10 | swc compare commits \ 11 | --method asymptotic \ 12 | --offline \ 13 | --path-pattern "./runtime/$RUNTIME/src/weights/**/*.rs" \ 14 | --no-color \ 15 | --format markdown \ 16 | --strip-path-prefix "runtime/$RUNTIME/src/weights/" \ 17 | "$VERSION" 18 | #--ignore-errors 19 | echo 20 | echo "
" 21 | -------------------------------------------------------------------------------- /scripts/ci/github/lib.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Gets the runtime version for a given runtime from the filesystem. 4 | # Optionally accepts a path that is the root of the project which defaults to 5 | # the current working directory 6 | def get_runtime(runtime: nil, path: '.', runtime_dir: 'runtime') 7 | File.open(path + "/#{runtime_dir}/#{runtime}/src/lib.rs") do |f| 8 | f.find { |l| l =~ /spec_version/ }.match(/[0-9]+/)[0] 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /scripts/ci/github/polkadot_release.erb: -------------------------------------------------------------------------------- 1 | <%= print release_priority[:text] %> <%= puts " due to changes: *#{Changelog.changes_with_label(all_changes, release_priority[:label]).map(&:pretty_title).join(", ")}*" if release_priority[:priority] > 1 %> 2 | 3 | Native runtimes: 4 | 5 | - Polkadot: **<%= polkadot_runtime %>** 6 | - Kusama: **<%= kusama_runtime %>** 7 | - Westend: **<%= westend_runtime %>** 8 | 9 | This release was tested against the following versions of `rustc`. Other versions may work. 10 | 11 | - <%= rustc_stable %> 12 | - <%= rustc_nightly %> 13 | 14 | WASM runtimes built with [<%= polkadot_json['info']['generator']['name'] %> v<%= polkadot_json['info']['generator']['version'] %>](https://github.com/paritytech/srtool) using `<%= polkadot_json['rustc'] %>`. 15 | 16 | Proposal hashes: 17 | * `polkadot_runtime-v<%= polkadot_runtime %>.compact.compressed.wasm`: `<%= polkadot_json['runtimes']['compressed']['prop'] %>` 18 | * `kusama_runtime-v<%= kusama_runtime %>.compact.compressed.wasm`: `<%= kusama_json['runtimes']['compressed']['prop'] %>` 19 | 20 | <% unless misc_changes.empty? %> 21 | ## Changes 22 | 23 | <% misc_changes.each do |c| %> 24 | * <%= c[:pretty_title] %> 25 | <% end %> 26 | <% end %> 27 | 28 | <% unless client_changes.empty? %> 29 | ## Client 30 | 31 | <% client_changes.each do |c| %> 32 | * <%= c[:pretty_title] %> 33 | <% end %> 34 | <% end %> 35 | 36 | <% unless runtime_changes.empty? %> 37 | ## Runtime 38 | 39 | <% runtime_changes.each do |c| %> 40 | * <%= c[:pretty_title] %> 41 | <% end %> 42 | <% end %> 43 | -------------------------------------------------------------------------------- /scripts/ci/github/run_fuzzer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | timeout --signal INT 5h cargo hfuzz run $1 4 | status=$? 5 | 6 | if [ $status -ne 124 ]; then 7 | echo "Found a panic!" 8 | # TODO: provide Minimal Reproducible Input 9 | # TODO: message on Matrix 10 | exit 1 11 | else 12 | echo "Didn't find any problem in 5 hours of fuzzing" 13 | fi 14 | -------------------------------------------------------------------------------- /scripts/ci/gitlab/pipeline/short-benchmarks.yml: -------------------------------------------------------------------------------- 1 | # This file is part of .gitlab-ci.yml 2 | # Here are all jobs that are executed during "short-benchmarks" stage 3 | 4 | # Run all pallet benchmarks only once to check if there are any errors 5 | short-benchmark-polkadot: &short-bench 6 | stage: short-benchmarks 7 | extends: 8 | - .test-pr-refs 9 | - .docker-env 10 | # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs 11 | needs: 12 | - job: build-short-benchmark 13 | artifacts: true 14 | variables: 15 | RUNTIME: polkadot 16 | script: 17 | - ./artifacts/polkadot benchmark pallet --wasm-execution compiled --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1 18 | 19 | short-benchmark-kusama: 20 | <<: *short-bench 21 | variables: 22 | RUNTIME: kusama 23 | 24 | short-benchmark-westend: 25 | <<: *short-bench 26 | variables: 27 | RUNTIME: westend 28 | -------------------------------------------------------------------------------- /scripts/ci/gitlab/pipeline/weights.yml: -------------------------------------------------------------------------------- 1 | # This file is part of .gitlab-ci.yml 2 | # Here are all jobs that are executed during "weights" stage 3 | 4 | update_polkadot_weights: &update-weights 5 | # The update-weights pipeline defaults to `interruptible: false` so that we'll be able to 6 | # reach and run the benchmarking jobs despite the "Auto-cancel redundant pipelines" CI setting. 7 | # The setting is relevant because future pipelines (e.g. created for new commits or other schedules) 8 | # might otherwise cancel the benchmark jobs early. 9 | interruptible: false 10 | stage: weights 11 | timeout: 1d 12 | when: manual 13 | image: $CI_IMAGE 14 | variables: 15 | RUNTIME: polkadot 16 | artifacts: 17 | paths: 18 | - ${RUNTIME}_weights_${CI_COMMIT_SHORT_SHA}.patch 19 | script: 20 | - ./scripts/ci/run_benches_for_runtime.sh $RUNTIME 21 | - git diff -P > ${RUNTIME}_weights_${CI_COMMIT_SHORT_SHA}.patch 22 | # uses the "shell" executors 23 | tags: 24 | - weights 25 | 26 | update_kusama_weights: 27 | <<: *update-weights 28 | variables: 29 | RUNTIME: kusama 30 | 31 | update_westend_weights: 32 | <<: *update-weights 33 | variables: 34 | RUNTIME: westend 35 | 36 | update_rococo_weights: 37 | <<: *update-weights 38 | variables: 39 | RUNTIME: rococo 40 | -------------------------------------------------------------------------------- /scripts/ci/gitlab/prettier.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # meant to be installed via 4 | # git config filter.ci-prettier.clean "scripts/ci/gitlab/prettier.sh" 5 | 6 | prettier --parser yaml 7 | -------------------------------------------------------------------------------- /scripts/ci/gitlab/spellcheck.toml: -------------------------------------------------------------------------------- 1 | [hunspell] 2 | lang = "en_US" 3 | search_dirs = ["."] 4 | extra_dictionaries = ["lingua.dic"] 5 | skip_os_lookups = true 6 | use_builtin = true 7 | 8 | [hunspell.quirks] 9 | # He tagged it as 'TheGreatestOfAllTimes' 10 | transform_regex = [ 11 | # `Type`'s 12 | "^'([^\\s])'$", 13 | # 5x 14 | # 10.7% 15 | "^[0-9_]+(?:\\.[0-9]*)?(x|%)$", 16 | # Transforms' 17 | "^(.*)'$", 18 | # backslashes 19 | "^\\+$", 20 | "^[0-9]*+k|MB|Mb|ms|Mbit|nd|th|rd$", 21 | # single char `=` `>` `%` .. 22 | "^=|>|<|%$", 23 | # 22_100 24 | "^(?:[0-9]+_)+[0-9]+$", 25 | # V5, v5, P1.2, etc 26 | "[A-Za-z][0-9]", 27 | # ~50 28 | "~[0-9]+", 29 | "ABI", 30 | "bool", 31 | "sigil", 32 | ] 33 | allow_concatenation = true 34 | allow_dashes = true 35 | -------------------------------------------------------------------------------- /scripts/ci/gitlab/test_deterministic_wasm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #shellcheck source=../common/lib.sh 4 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh" 5 | 6 | # build runtime 7 | WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime 8 | # make checksum 9 | sha256sum target/release/wbuild/*-runtime/target/wasm32-unknown-unknown/release/*.wasm > checksum.sha256 10 | # clean up - FIXME: can we reuse some of the artifacts? 11 | cargo clean 12 | # build again 13 | WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime 14 | # confirm checksum 15 | sha256sum -c checksum.sha256 16 | -------------------------------------------------------------------------------- /scripts/common.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ROOT=`dirname "$0"` 4 | 5 | # A list of directories which contain wasm projects. 6 | SRCS=( 7 | "runtime/wasm" 8 | ) 9 | 10 | DEMOS=( 11 | "test-parachains/" 12 | ) 13 | 14 | # Make pushd/popd silent. 15 | 16 | pushd () { 17 | command pushd "$@" > /dev/null 18 | } 19 | 20 | popd () { 21 | command popd "$@" > /dev/null 22 | } 23 | -------------------------------------------------------------------------------- /scripts/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | echo "*** Initializing WASM build environment" 6 | 7 | if [ -z $CI_PROJECT_NAME ] ; then 8 | rustup update nightly 9 | rustup update stable 10 | fi 11 | 12 | rustup target add wasm32-unknown-unknown --toolchain nightly 13 | 14 | # Install wasm-gc. It's useful for stripping slimming down wasm binaries. 15 | command -v wasm-gc || \ 16 | cargo +nightly install --git https://github.com/alexcrichton/wasm-gc --force 17 | -------------------------------------------------------------------------------- /scripts/packaging/deb-maintainer-scripts/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | action="$1" 6 | config_file="/etc/default/polkadot" 7 | 8 | if [ "$action" = "configure" ]; then 9 | # Make user and group 10 | getent group polkadot >/dev/null 2>&1 || addgroup --system polkadot 11 | getent passwd polkadot >/dev/null 2>&1 || 12 | adduser --system --home /home/polkadot --disabled-password \ 13 | --ingroup polkadot polkadot 14 | if [ ! -e "$config_file" ]; then 15 | echo 'POLKADOT_CLI_ARGS=""' > /etc/default/polkadot 16 | fi 17 | fi 18 | -------------------------------------------------------------------------------- /scripts/packaging/polkadot.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Polkadot Node 3 | After=network.target 4 | Documentation=https://github.com/paritytech/polkadot 5 | 6 | [Service] 7 | EnvironmentFile=-/etc/default/polkadot 8 | ExecStart=/usr/bin/polkadot $POLKADOT_CLI_ARGS 9 | User=polkadot 10 | Group=polkadot 11 | Restart=always 12 | RestartSec=120 13 | CapabilityBoundingSet= 14 | LockPersonality=true 15 | NoNewPrivileges=true 16 | PrivateDevices=true 17 | PrivateMounts=true 18 | PrivateTmp=true 19 | PrivateUsers=true 20 | ProtectClock=true 21 | ProtectControlGroups=true 22 | ProtectHostname=true 23 | ProtectKernelModules=true 24 | ProtectKernelTunables=true 25 | ProtectSystem=strict 26 | RemoveIPC=true 27 | RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX 28 | RestrictNamespaces=true 29 | RestrictSUIDSGID=true 30 | SystemCallArchitectures=native 31 | SystemCallFilter=@system-service 32 | SystemCallFilter=landlock_add_rule landlock_create_ruleset landlock_restrict_self seccomp 33 | SystemCallFilter=~@clock @module @mount @reboot @swap @privileged 34 | UMask=0027 35 | 36 | [Install] 37 | WantedBy=multi-user.target 38 | -------------------------------------------------------------------------------- /scripts/release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | # This script is to be run when we are happy with a release candidate. 5 | # It accepts a single argument: version, in the format 'v1.2.3' 6 | 7 | version="$1" 8 | if [ -z "$version" ]; then 9 | echo "No version specified, cannot continue" 10 | exit 1 11 | fi 12 | 13 | if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then 14 | echo "Version should be in the format v1.2.3" 15 | exit 1 16 | fi 17 | 18 | echo '[+] Checking out the release branch' 19 | git checkout release 20 | echo '[+] Pulling latest version of the release branch from github' 21 | git pull 22 | echo '[+] Attempting to merge the release-candidate branch to the release branch' 23 | git merge "$version" 24 | echo '[+] Tagging the release' 25 | git tag -s -m "$version" "$version" 26 | echo '[+] Pushing the release branch and tag to Github. A new release will be created shortly' 27 | git push origin release 28 | git push origin "refs/tags/$version" 29 | -------------------------------------------------------------------------------- /scripts/run_all_benches.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Runs all benchmarks for all pallets, for each of the runtimes specified below 4 | # Should be run on a reference machine to gain accurate benchmarks 5 | # current reference machine: https://github.com/paritytech/substrate/pull/5848 6 | 7 | runtimes=( 8 | polkadot 9 | kusama 10 | westend 11 | ) 12 | 13 | for runtime in "${runtimes[@]}"; do 14 | "$(dirname "$0")/run_benches_for_runtime.sh" "$runtime" 15 | done 16 | -------------------------------------------------------------------------------- /scripts/update-rust-stable.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Script for updating the UI tests for a new rust stable version. 4 | # 5 | # It needs to be called like this: 6 | # 7 | # update-rust-stable.sh 1.61 8 | # 9 | # This will run all UI tests with the rust stable 1.61. The script 10 | # requires that rustup is installed. 11 | set -e 12 | 13 | if [ "$#" -ne 1 ]; then 14 | echo "Please specify the rust version to use. E.g. update-rust-stable.sh 1.61" 15 | exit 16 | fi 17 | 18 | RUST_VERSION=$1 19 | 20 | if ! command -v rustup &> /dev/null 21 | then 22 | echo "rustup needs to be installed" 23 | exit 24 | fi 25 | 26 | rustup install $RUST_VERSION 27 | rustup component add rust-src --toolchain $RUST_VERSION 28 | 29 | # Ensure we run the ui tests 30 | export RUN_UI_TESTS=1 31 | # We don't need any wasm files for ui tests 32 | export SKIP_WASM_BUILD=1 33 | # Let trybuild overwrite the .stderr files 34 | export TRYBUILD=overwrite 35 | 36 | # Run all the relevant UI tests 37 | # 38 | # Any new UI tests in different crates need to be added here as well. 39 | rustup run $RUST_VERSION cargo test -p orchestra ui 40 | -------------------------------------------------------------------------------- /src/README.adoc: -------------------------------------------------------------------------------- 1 | 2 | = Polkadot Src 3 | 4 | placeholder 5 | //TODO Write content :) (https://github.com/paritytech/polkadot/issues/159) 6 | -------------------------------------------------------------------------------- /src/bin/execute-worker.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Execute worker. 18 | 19 | polkadot_node_core_pvf_common::decl_worker_main!( 20 | "execute-worker", 21 | polkadot_node_core_pvf_execute_worker::worker_entrypoint, 22 | env!("SUBSTRATE_CLI_IMPL_VERSION") 23 | ); 24 | -------------------------------------------------------------------------------- /src/bin/prepare-worker.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Prepare worker. 18 | 19 | polkadot_node_core_pvf_common::decl_worker_main!( 20 | "prepare-worker", 21 | polkadot_node_core_pvf_prepare_worker::worker_entrypoint, 22 | env!("SUBSTRATE_CLI_IMPL_VERSION") 23 | ); 24 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | //! Polkadot CLI 18 | 19 | #![warn(missing_docs)] 20 | 21 | use color_eyre::eyre; 22 | 23 | /// Global allocator. Changing it to another allocator will require changing 24 | /// `memory_stats::MemoryAllocationTracker`. 25 | #[cfg(any(target_os = "linux", feature = "jemalloc-allocator"))] 26 | #[global_allocator] 27 | pub static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; 28 | 29 | fn main() -> eyre::Result<()> { 30 | color_eyre::install()?; 31 | polkadot_cli::run()?; 32 | Ok(()) 33 | } 34 | -------------------------------------------------------------------------------- /statement-table/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-statement-table" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } 10 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 11 | primitives = { package = "polkadot-primitives", path = "../primitives" } 12 | -------------------------------------------------------------------------------- /statement-table/README.adoc: -------------------------------------------------------------------------------- 1 | 2 | = Polkadot Statement table 3 | 4 | placeholder 5 | //TODO Write content :) (https://github.com/paritytech/polkadot/issues/159) 6 | -------------------------------------------------------------------------------- /tests/invalid_order_arguments.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Substrate. 3 | 4 | // Substrate is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Substrate is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Substrate. If not, see . 16 | 17 | use assert_cmd::cargo::cargo_bin; 18 | use std::process::Command; 19 | use tempfile::tempdir; 20 | 21 | #[test] 22 | #[cfg(unix)] 23 | fn invalid_order_arguments() { 24 | let tmpdir = tempdir().expect("could not create temp dir"); 25 | 26 | let status = Command::new(cargo_bin("polkadot")) 27 | .args(["--dev", "invalid_order_arguments", "-d"]) 28 | .arg(tmpdir.path()) 29 | .arg("-y") 30 | .status() 31 | .unwrap(); 32 | assert!(!status.success()); 33 | } 34 | -------------------------------------------------------------------------------- /utils/generate-bags/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "polkadot-voter-bags" 3 | version.workspace = true 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | clap = { version = "4.0.9", features = ["derive"] } 10 | 11 | generate-bags = { git = "https://github.com/paritytech/substrate", branch = "master" } 12 | sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } 13 | 14 | westend-runtime = { path = "../../runtime/westend" } 15 | kusama-runtime = { path = "../../runtime/kusama" } 16 | polkadot-runtime = { path = "../../runtime/polkadot" } 17 | -------------------------------------------------------------------------------- /utils/remote-ext-tests/bags-list/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "remote-ext-tests-bags-list" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | polkadot-runtime = { path = "../../../runtime/polkadot" } 11 | kusama-runtime = { path = "../../../runtime/kusama" } 12 | westend-runtime = { path = "../../../runtime/westend" } 13 | polkadot-runtime-constants = { path = "../../../runtime/polkadot/constants" } 14 | kusama-runtime-constants = { path = "../../../runtime/kusama/constants" } 15 | westend-runtime-constants = { path = "../../../runtime/westend/constants" } 16 | 17 | pallet-bags-list-remote-tests = { git = "https://github.com/paritytech/substrate", branch = "master" } 18 | sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } 19 | frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } 20 | sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } 21 | 22 | clap = { version = "4.0.9", features = ["derive"] } 23 | log = "0.4.17" 24 | tokio = { version = "1.24.2", features = ["macros"] } 25 | -------------------------------------------------------------------------------- /utils/remote-ext-tests/bags-list/README.md: -------------------------------------------------------------------------------- 1 | # Remote Extension Tests For Pallet Bags List 2 | 3 | Integration tests that use state from live chains via remote externalities. 4 | -------------------------------------------------------------------------------- /utils/staking-miner/.gitignore: -------------------------------------------------------------------------------- 1 | *.key 2 | *.bin 3 | -------------------------------------------------------------------------------- /xcm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xcm" 3 | description = "The basic XCM datastructures." 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | bounded-collections = { version = "0.1.8", default-features = false, features = ["serde"] } 11 | derivative = { version = "2.2.0", default-features = false, features = [ "use_core" ] } 12 | impl-trait-for-tuples = "0.2.2" 13 | log = { version = "0.4.17", default-features = false } 14 | parity-scale-codec = { version = "3.6.1", default-features = false, features = [ "derive", "max-encoded-len" ] } 15 | scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde"] } 16 | sp-weights = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] } 17 | serde = { version = "1.0.163", default-features = false, features = ["alloc", "derive"] } 18 | xcm-procedural = { path = "procedural" } 19 | 20 | [dev-dependencies] 21 | sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } 22 | hex = "0.4.3" 23 | hex-literal = "0.4.1" 24 | 25 | [features] 26 | default = ["std"] 27 | wasm-api = [] 28 | std = [ 29 | "bounded-collections/std", 30 | "parity-scale-codec/std", 31 | "scale-info/std", 32 | "serde/std", 33 | "sp-weights/std", 34 | ] 35 | -------------------------------------------------------------------------------- /xcm/procedural/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xcm-procedural" 3 | authors.workspace = true 4 | edition.workspace = true 5 | license.workspace = true 6 | version.workspace = true 7 | 8 | [lib] 9 | proc-macro = true 10 | 11 | [dependencies] 12 | proc-macro2 = "1.0.56" 13 | quote = "1.0.28" 14 | syn = "2.0.15" 15 | Inflector = "0.11.4" 16 | -------------------------------------------------------------------------------- /xcm/xcm-builder/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use super::{test_utils::*, *}; 18 | use core::convert::TryInto; 19 | use frame_support::{ 20 | assert_err, 21 | traits::{ConstU32, ContainsPair, ProcessMessageError}, 22 | weights::constants::{WEIGHT_PROOF_SIZE_PER_MB, WEIGHT_REF_TIME_PER_SECOND}, 23 | }; 24 | use xcm_executor::{traits::prelude::*, Config, XcmExecutor}; 25 | 26 | mod mock; 27 | use mock::*; 28 | 29 | mod aliases; 30 | mod assets; 31 | mod barriers; 32 | mod basic; 33 | mod bridging; 34 | mod expecting; 35 | mod locking; 36 | mod origins; 37 | mod pay; 38 | mod querying; 39 | mod transacting; 40 | mod version_subscriptions; 41 | mod weight; 42 | -------------------------------------------------------------------------------- /xcm/xcm-builder/src/tests/pay/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Parity Technologies (UK) Ltd. 2 | // This file is part of Polkadot. 3 | 4 | // Polkadot is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | 9 | // Polkadot is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with Polkadot. If not, see . 16 | 17 | use super::*; 18 | 19 | mod mock; 20 | mod pay; 21 | mod salary; 22 | -------------------------------------------------------------------------------- /xcm/xcm-executor/integration-tests/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xcm-executor-integration-tests" 3 | description = "Integration tests for the XCM Executor" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | version.workspace = true 8 | publish = false 9 | 10 | [dependencies] 11 | codec = { package = "parity-scale-codec", version = "3.6.1" } 12 | frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 13 | frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } 14 | futures = "0.3.21" 15 | pallet-xcm = { path = "../../pallet-xcm" } 16 | polkadot-test-client = { path = "../../../node/test/client" } 17 | polkadot-test-runtime = { path = "../../../runtime/test-runtime" } 18 | polkadot-test-service = { path = "../../../node/test/service" } 19 | sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } 20 | sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } 21 | sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } 22 | sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" } 23 | xcm = { path = "../..", default-features = false } 24 | xcm-executor = { path = ".." } 25 | sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } 26 | 27 | [features] 28 | default = ["std"] 29 | std = [ 30 | "xcm/std", 31 | "sp-runtime/std", 32 | "frame-support/std", 33 | ] 34 | -------------------------------------------------------------------------------- /xcm/xcm-simulator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xcm-simulator" 3 | description = "Test kit to simulate cross-chain message passing and XCM execution" 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | codec = { package = "parity-scale-codec", version = "3.6.1" } 11 | paste = "1.0.7" 12 | 13 | frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } 14 | sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } 15 | sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" } 16 | 17 | xcm = { path = "../" } 18 | xcm-executor = { path = "../xcm-executor" } 19 | xcm-builder = { path = "../xcm-builder" } 20 | polkadot-core-primitives = { path = "../../core-primitives"} 21 | polkadot-parachain = { path = "../../parachain" } 22 | polkadot-runtime-parachains = { path = "../../runtime/parachains" } 23 | -------------------------------------------------------------------------------- /xcm/xcm-simulator/fuzzer/.gitignore: -------------------------------------------------------------------------------- 1 | hfuzz_target 2 | hfuzz_workspace 3 | cargo 4 | coverage 5 | ccov.zip 6 | -------------------------------------------------------------------------------- /xcm/xcm-simulator/fuzzer/README.md: -------------------------------------------------------------------------------- 1 | # XCM Simulator Fuzzer 2 | 3 | This project will fuzz-test the XCM simulator. It can catch reachable panics, timeouts as well as integer overflows and underflows. 4 | 5 | ## Install dependencies 6 | 7 | ``` 8 | cargo install honggfuzz 9 | ``` 10 | 11 | ## Run the fuzzer 12 | 13 | In this directory, run this command: 14 | 15 | ``` 16 | cargo hfuzz run xcm-fuzzer 17 | ``` 18 | 19 | ## Run a single input 20 | 21 | In this directory, run this command: 22 | 23 | ``` 24 | cargo hfuzz run-debug xcm-fuzzer hfuzz_workspace/xcm-fuzzer/fuzzer_input_file 25 | ``` 26 | 27 | ## Generate coverage 28 | 29 | In this directory, run these four commands: 30 | 31 | ``` 32 | RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" CARGO_INCREMENTAL=0 SKIP_WASM_BUILD=1 CARGO_HOME=./cargo cargo build 33 | ../../../target/debug/xcm-fuzzer hfuzz_workspace/xcm-fuzzer/input/ 34 | zip -0 ccov.zip `find ../../../target/ \( -name "*.gc*" -o -name "test-*.gc*" \) -print` 35 | grcov ccov.zip -s ../../../ -t html --llvm --branch --ignore-not-existing -o ./coverage 36 | ``` 37 | 38 | The code coverage will be in `./coverage/index.html`. 39 | -------------------------------------------------------------------------------- /zombienet_tests/.set_env: -------------------------------------------------------------------------------- 1 | pathprepend() { 2 | for ((i=$#; i>0; i--)); 3 | do 4 | ARG="$@[$i]" 5 | if [ -d "$ARG" ] && [[ ":$PATH:" != *":$ARG:"* ]]; then 6 | PATH="$ARG${PATH:+":$PATH"}" 7 | fi 8 | done 9 | } 10 | 11 | # paths are prepend in order, so you can manage with version will run 12 | # by the order of this array 13 | CUSTOM_PATHS=( 14 | "~/polkadot/target/release" 15 | "~/polkadot/target/testnet" 16 | "~/cumulus/target/release" 17 | ) 18 | 19 | pathprepend $CUSTOM_PATHS 20 | export PATH=$PATH 21 | -------------------------------------------------------------------------------- /zombienet_tests/async_backing/001-async-backing-compatibility.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "rococo-local" 7 | default_command = "polkadot" 8 | 9 | [relaychain.default_resources] 10 | limits = { memory = "4G", cpu = "2" } 11 | requests = { memory = "2G", cpu = "1" } 12 | 13 | [[relaychain.nodes]] 14 | name = "alice" 15 | args = [ "-lparachain=debug,runtime=debug"] 16 | 17 | [[relaychain.nodes]] 18 | name = "bob" 19 | image = "{{ZOMBIENET_INTEGRATION_TEST_SECONDARY_IMAGE}}" 20 | args = [ "-lparachain=debug,runtime=debug"] 21 | 22 | [[parachains]] 23 | id = 100 24 | 25 | [parachains.collator] 26 | name = "collator01" 27 | image = "{{COL_IMAGE}}" 28 | command = "undying-collator" 29 | args = ["-lparachain=debug"] 30 | 31 | [types.Header] 32 | number = "u64" 33 | parent_hash = "Hash" 34 | post_state = "Hash" 35 | -------------------------------------------------------------------------------- /zombienet_tests/async_backing/001-async-backing-compatibility.zndsl: -------------------------------------------------------------------------------- 1 | Description: Async Backing Compatibility Test 2 | Network: ./001-async-backing-compatibility.toml 3 | Creds: config 4 | 5 | # General 6 | alice: is up 7 | bob: is up 8 | 9 | # Check authority status 10 | alice: reports node_roles is 4 11 | bob: reports node_roles is 4 12 | 13 | # Check peers 14 | alice: reports peers count is at least 2 within 20 seconds 15 | bob: reports peers count is at least 2 within 20 seconds 16 | 17 | # Parachain registration 18 | alice: parachain 100 is registered within 225 seconds 19 | bob: parachain 100 is registered within 225 seconds 20 | 21 | # Ensure parachain progress 22 | alice: parachain 100 block height is at least 10 within 250 seconds 23 | bob: parachain 100 block height is at least 10 within 250 seconds 24 | -------------------------------------------------------------------------------- /zombienet_tests/async_backing/002-async-backing-runtime-upgrade.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "rococo-local" 7 | default_command = "polkadot" 8 | 9 | [relaychain.default_resources] 10 | limits = { memory = "4G", cpu = "2" } 11 | requests = { memory = "2G", cpu = "1" } 12 | 13 | [[relaychain.nodes]] 14 | name = "alice" 15 | args = [ "-lparachain=debug,runtime=debug"] 16 | 17 | [[relaychain.nodes]] 18 | name = "bob" 19 | args = [ "-lparachain=debug,runtime=debug"] 20 | 21 | [[relaychain.nodes]] 22 | name = "charlie" 23 | image = "{{ZOMBIENET_INTEGRATION_TEST_SECONDARY_IMAGE}}" 24 | args = [ "-lparachain=debug,runtime=debug"] 25 | 26 | [[relaychain.nodes]] 27 | name = "dave" 28 | image = "{{ZOMBIENET_INTEGRATION_TEST_SECONDARY_IMAGE}}" 29 | args = [ "-lparachain=debug,runtime=debug"] 30 | 31 | [[parachains]] 32 | id = 100 33 | addToGenesis = true 34 | 35 | [parachains.collator] 36 | name = "collator02" 37 | image = "{{COL_IMAGE}}" 38 | command = "undying-collator" 39 | args = ["-lparachain=debug"] 40 | 41 | [[parachains]] 42 | id = 101 43 | addToGenesis = true 44 | 45 | [parachains.collator] 46 | name = "collator02" 47 | image = "{{COL_IMAGE}}" 48 | command = "undying-collator" 49 | args = ["-lparachain=debug"] 50 | 51 | [types.Header] 52 | number = "u64" 53 | parent_hash = "Hash" 54 | post_state = "Hash" 55 | -------------------------------------------------------------------------------- /zombienet_tests/async_backing/002-async-backing-runtime-upgrade.zndsl: -------------------------------------------------------------------------------- 1 | Description: Async Backing Runtime Upgrade Test 2 | Network: ./002-async-backing-runtime-upgrade.toml 3 | Creds: config 4 | 5 | # General 6 | alice: is up 7 | bob: is up 8 | charlie: is up 9 | dave: is up 10 | 11 | # Check peers 12 | alice: reports peers count is at least 3 within 20 seconds 13 | bob: reports peers count is at least 3 within 20 seconds 14 | 15 | # Parachain registration 16 | alice: parachain 100 is registered within 225 seconds 17 | bob: parachain 100 is registered within 225 seconds 18 | charlie: parachain 100 is registered within 225 seconds 19 | dave: parachain 100 is registered within 225 seconds 20 | alice: parachain 101 is registered within 225 seconds 21 | bob: parachain 101 is registered within 225 seconds 22 | charlie: parachain 101 is registered within 225 seconds 23 | dave: parachain 101 is registered within 225 seconds 24 | 25 | # Ensure parachain progress 26 | alice: parachain 100 block height is at least 10 within 250 seconds 27 | bob: parachain 100 block height is at least 10 within 250 seconds 28 | 29 | # Runtime upgrade (according to previous runtime tests, avg. is 30s) 30 | alice: run ../misc/0002-download-polkadot-from-pr.sh with "{{POLKADOT_PR_BIN_URL}}" within 40 seconds 31 | bob: run ../misc/0002-download-polkadot-from-pr.sh with "{{POLKADOT_PR_BIN_URL}}" within 40 seconds 32 | 33 | # Bootstrap the runtime upgrade 34 | sleep 30 seconds 35 | -------------------------------------------------------------------------------- /zombienet_tests/async_backing/003-async-backing-collator-mix.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "rococo-local" 7 | default_command = "polkadot" 8 | 9 | [relaychain.default_resources] 10 | limits = { memory = "4G", cpu = "2" } 11 | requests = { memory = "2G", cpu = "1" } 12 | 13 | [[relaychain.nodes]] 14 | name = "alice" 15 | args = [ "-lparachain=debug"] 16 | 17 | [[relaychain.nodes]] 18 | name = "bob" 19 | image = "{{ZOMBIENET_INTEGRATION_TEST_SECONDARY_IMAGE}}" 20 | args = [ "-lparachain=debug"] 21 | 22 | [[parachains]] 23 | id = 100 24 | 25 | [[parachains.collators]] 26 | name = "collator01" 27 | image = "docker.io/paritypr/colander:master" 28 | command = "undying-collator" 29 | args = ["-lparachain=debug"] 30 | 31 | [[parachains.collators]] 32 | name = "collator02" 33 | image = "{{COL_IMAGE}}" 34 | command = "undying-collator" 35 | args = ["-lparachain=debug"] 36 | 37 | [types.Header] 38 | number = "u64" 39 | parent_hash = "Hash" 40 | post_state = "Hash" 41 | -------------------------------------------------------------------------------- /zombienet_tests/async_backing/003-async-backing-collator-mix.zndsl: -------------------------------------------------------------------------------- 1 | Description: Async Backing Collator Mix Test 2 | Network: ./003-async-backing-collator-mix.toml 3 | Creds: config 4 | 5 | # General 6 | alice: is up 7 | bob: is up 8 | 9 | # Check peers 10 | alice: reports peers count is at least 3 within 20 seconds 11 | bob: reports peers count is at least 3 within 20 seconds 12 | 13 | # Parachain registration 14 | alice: parachain 100 is registered within 225 seconds 15 | bob: parachain 100 is registered within 225 seconds 16 | 17 | # Ensure parachain progress 18 | alice: parachain 100 block height is at least 10 within 250 seconds 19 | bob: parachain 100 block height is at least 10 within 250 seconds 20 | -------------------------------------------------------------------------------- /zombienet_tests/async_backing/README.md: -------------------------------------------------------------------------------- 1 | # async-backing zombienet tests 2 | 3 | This directory contains zombienet tests made explicitly for the async-backing feature branch. 4 | 5 | ## coverage 6 | 7 | - Network protocol upgrade deploying both master and async branch (compatibility). 8 | - Runtime ugprade while running both master and async backing branch nodes. 9 | - Async backing test with a mix of collators collating via async backing and sync backing. 10 | -------------------------------------------------------------------------------- /zombienet_tests/functional/0003-beefy-and-mmr.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "rococo-local" 7 | command = "polkadot" 8 | 9 | [[relaychain.node_groups]] 10 | name = "validator" 11 | count = 3 12 | args = ["--log=beefy=debug", "--enable-offchain-indexing=true"] 13 | 14 | [[relaychain.nodes]] 15 | name = "validator-unstable" 16 | args = ["--log=beefy=debug", "--enable-offchain-indexing=true"] 17 | -------------------------------------------------------------------------------- /zombienet_tests/functional/0003-common.js: -------------------------------------------------------------------------------- 1 | async function getApis(networkInfo, nodeNames) { 2 | const connectionPromises = nodeNames.map(async (nodeName) => { 3 | const { wsUri, userDefinedTypes } = networkInfo.nodesByName[nodeName]; 4 | const connection = await zombie.connect(wsUri, userDefinedTypes); 5 | return { nodeName, connection }; 6 | }); 7 | 8 | const connections = await Promise.all(connectionPromises); 9 | 10 | return connections.reduce((map, { nodeName, connection }) => { 11 | map[nodeName] = connection; 12 | return map; 13 | }, {}); 14 | } 15 | 16 | module.exports = { getApis }; 17 | -------------------------------------------------------------------------------- /zombienet_tests/functional/0003-mmr-generate-and-verify-proof.js: -------------------------------------------------------------------------------- 1 | const common = require('./0003-common.js'); 2 | 3 | async function run(nodeName, networkInfo, nodeNames) { 4 | const apis = await common.getApis(networkInfo, nodeNames); 5 | 6 | const proof = await apis[nodeName].rpc.mmr.generateProof([1, 9, 20]); 7 | 8 | const root = await apis[nodeName].rpc.mmr.root() 9 | 10 | const proofVerifications = await Promise.all( 11 | Object.values(apis).map(async (api) => { 12 | return api.rpc.mmr.verifyProof(proof); 13 | }) 14 | ); 15 | 16 | const proofVerificationsStateless = await Promise.all( 17 | Object.values(apis).map(async (api) => { 18 | return api.rpc.mmr.verifyProofStateless(root, proof); 19 | }) 20 | ); 21 | 22 | // check that all nodes accepted the proof 23 | return proofVerifications.every((proofVerification) => proofVerification) && proofVerificationsStateless.every((proofVerification) => proofVerification) 24 | } 25 | 26 | module.exports = { run }; 27 | -------------------------------------------------------------------------------- /zombienet_tests/functional/0003-mmr-leaves.js: -------------------------------------------------------------------------------- 1 | async function run(nodeName, networkInfo, args) { 2 | const { wsUri, userDefinedTypes } = networkInfo.nodesByName[nodeName]; 3 | const api = await zombie.connect(wsUri, userDefinedTypes); 4 | 5 | const mmrLeaves = await api.query.mmr.numberOfLeaves(); 6 | return mmrLeaves.toNumber() >= args[0] 7 | } 8 | 9 | module.exports = { run }; 10 | -------------------------------------------------------------------------------- /zombienet_tests/functional/0004-parachains-disputes-past-session.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | bootnode = true 4 | 5 | [relaychain.genesis.runtime.configuration.config] 6 | max_validators_per_core = 1 7 | needed_approvals = 3 8 | group_rotation_frequency = 4 9 | 10 | [relaychain] 11 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 12 | chain = "westend-local" # using westend-local to enable slashing 13 | default_command = "polkadot" 14 | 15 | [relaychain.default_resources] 16 | limits = { memory = "4G", cpu = "2" } 17 | requests = { memory = "2G", cpu = "1" } 18 | 19 | [[relaychain.nodes]] 20 | name = "alice" 21 | invulnerable = true # it will go offline, we don't want to disable it 22 | args = ["-lparachain=debug,runtime=debug"] 23 | 24 | [[relaychain.node_groups]] 25 | name = "honest-validator" 26 | count = 2 27 | args = ["-lruntime=debug,sync=trace"] 28 | 29 | [[relaychain.node_groups]] 30 | image = "{{MALUS_IMAGE}}" 31 | name = "malus-validator" 32 | command = "malus suggest-garbage-candidate" 33 | args = ["-lMALUS=trace"] 34 | count = 1 35 | 36 | [[parachains]] 37 | id = 1000 38 | cumulus_based = true 39 | 40 | [parachains.collator] 41 | name = "collator" 42 | command = "polkadot-parachain" 43 | image = "docker.io/parity/polkadot-parachain:latest" 44 | # image = "{{COL_IMAGE}}" 45 | args = ["-lparachain=debug"] 46 | -------------------------------------------------------------------------------- /zombienet_tests/functional/0004-parachains-disputes-past-session.zndsl: -------------------------------------------------------------------------------- 1 | Description: Past-session dispute slashing 2 | Network: ./0004-parachains-disputes-past-session.toml 3 | Creds: config 4 | 5 | alice: reports node_roles is 4 6 | 7 | # pause alice so that disputes don't conclude 8 | alice: pause 9 | 10 | # Ensure parachain is registered. 11 | honest-validator-0: parachain 1000 is registered within 100 seconds 12 | 13 | # Ensure parachain made progress. 14 | honest-validator-0: parachain 1000 block height is at least 1 within 300 seconds 15 | 16 | # There should be disputes initiated 17 | honest-validator-0: reports polkadot_parachain_candidate_disputes_total is at least 2 within 200 seconds 18 | 19 | # Stop issuing disputes 20 | malus-validator-0: pause 21 | 22 | # wait for the next session 23 | sleep 120 seconds 24 | 25 | # But should not resolve 26 | honest-validator-0: reports block height minus finalised block is at least 10 within 100 seconds 27 | 28 | # Now resume alice 29 | alice: resume 30 | 31 | # Disputes should start concluding now 32 | honest-validator-0: reports polkadot_parachain_candidate_dispute_concluded{validity="invalid"} is at least 1 within 200 seconds 33 | # Disputes should always end as "invalid" 34 | honest-validator-0: reports polkadot_parachain_candidate_dispute_concluded{validity="valid"} is 0 35 | 36 | # Check an unsigned extrinsic is submitted 37 | honest-validator: log line contains "Successfully reported pending slash" within 180 seconds 38 | -------------------------------------------------------------------------------- /zombienet_tests/misc/0001-check_paritydb.sh: -------------------------------------------------------------------------------- 1 | ls /data/chains/rococo_local_testnet/paritydb/full 2>/dev/null 2 | -------------------------------------------------------------------------------- /zombienet_tests/misc/0001-paritydb.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | bootnode = true 4 | 5 | [relaychain.genesis.runtime.runtime_genesis_config.configuration.config] 6 | max_validators_per_core = 1 7 | needed_approvals = 3 8 | 9 | [relaychain] 10 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 11 | chain = "rococo-local" 12 | chain_spec_command = "polkadot build-spec --chain rococo-local" 13 | default_command = "polkadot" 14 | 15 | [relaychain.default_resources] 16 | limits = { memory = "4G", cpu = "2" } 17 | requests = { memory = "2G", cpu = "1" } 18 | 19 | [[relaychain.node_groups]] 20 | name = "validator" 21 | count = 10 22 | args = ["-lparachain=debug", "--db=paritydb"] 23 | 24 | {% for id in range(2000,2010) %} 25 | [[parachains]] 26 | id = {{id}} 27 | addToGenesis = true 28 | genesis_state_generator = "undying-collator export-genesis-state --pov-size={{10000*(id-1999)}} --pvf-complexity={{id - 1999}}" 29 | [parachains.collator] 30 | name = "collator" 31 | image = "{{COL_IMAGE}}" 32 | command = "undying-collator" 33 | args = ["-lparachain=debug", "--pov-size={{10000*(id-1999)}}", "--parachain-id={{id}}", "--pvf-complexity={{id - 1999}}"] 34 | 35 | {% endfor %} 36 | 37 | [types.Header] 38 | number = "u64" 39 | parent_hash = "Hash" 40 | post_state = "Hash" 41 | -------------------------------------------------------------------------------- /zombienet_tests/misc/0002-download-polkadot-from-pr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euxo pipefail 4 | 5 | echo $@ 6 | 7 | CFG_DIR=/cfg 8 | 9 | # add CFG_DIR as first `looking dir` to allow to overrides commands. 10 | mkdir -p $CFG_DIR 11 | export PATH=$CFG_DIR:$PATH 12 | 13 | cd $CFG_DIR 14 | # see 0002-upgrade-node.zndsl to view the args. 15 | curl -L -O $1/polkadot 16 | curl -L -O $1/polkadot-prepare-worker 17 | curl -L -O $1/polkadot-execute-worker 18 | chmod +x $CFG_DIR/polkadot $CFG_DIR/polkadot-prepare-worker $CFG_DIR/polkadot-execute-worker 19 | echo $(polkadot --version) 20 | -------------------------------------------------------------------------------- /zombienet_tests/misc/0002-upgrade-node.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "rococo-local" 7 | 8 | 9 | [[relaychain.nodes]] 10 | name = "alice" 11 | args = [ "-lparachain=debug,runtime=debug", "--db paritydb" ] 12 | substrate_cli_args_version = 1 13 | 14 | [[relaychain.nodes]] 15 | name = "bob" 16 | args = [ "-lparachain=debug,runtime=debug", "--db rocksdb" ] 17 | substrate_cli_args_version = 1 18 | 19 | [[relaychain.nodes]] 20 | name = "charlie" 21 | args = [ "-lparachain=debug,runtime=debug", "--db paritydb" ] 22 | 23 | [[relaychain.nodes]] 24 | name = "dave" 25 | args = [ "-lparachain=debug,runtime=debug", "--db rocksdb" ] 26 | 27 | 28 | [[parachains]] 29 | id = 2000 30 | addToGenesis = true 31 | 32 | [parachains.collator] 33 | name = "collator01" 34 | image = "{{COL_IMAGE}}" 35 | command = "undying-collator" 36 | args = ["-lparachain=debug"] 37 | 38 | [[parachains]] 39 | id = 2001 40 | addToGenesis = true 41 | 42 | [parachains.collator] 43 | name = "collator02" 44 | image = "{{COL_IMAGE}}" 45 | command = "undying-collator" 46 | args = ["-lparachain=debug"] 47 | 48 | [types.Header] 49 | number = "u64" 50 | parent_hash = "Hash" 51 | post_state = "Hash" 52 | -------------------------------------------------------------------------------- /zombienet_tests/misc/0002-upgrade-node.zndsl: -------------------------------------------------------------------------------- 1 | Description: Smoke / Upgrade Node 2 | Network: ./0002-upgrade-node.toml 3 | Creds: config 4 | 5 | charlie: parachain 2000 block height is at least 10 within 200 seconds 6 | dave: parachain 2001 block height is at least 10 within 200 seconds 7 | 8 | # upgrade both nodes 9 | # For testing using native provider you should set this env var 10 | # POLKADOT_PR_ARTIFACTS_URL=https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/1842869/artifacts/raw/artifacts 11 | # with the version of polkadot you want to download. 12 | 13 | # avg 30s in our infra 14 | alice: run ./0002-download-polkadot-from-pr.sh with "{{POLKADOT_PR_ARTIFACTS_URL}}" within 40 seconds 15 | bob: run ./0002-download-polkadot-from-pr.sh with "{{POLKADOT_PR_ARTIFACTS_URL}}" within 40 seconds 16 | alice: restart after 5 seconds 17 | bob: restart after 5 seconds 18 | 19 | # process bootstrap 20 | sleep 30 seconds 21 | 22 | alice: is up within 10 seconds 23 | bob: is up within 10 seconds 24 | 25 | 26 | alice: parachain 2000 block height is at least 30 within 300 seconds 27 | bob: parachain 2001 block height is at least 30 within 120 seconds 28 | 29 | -------------------------------------------------------------------------------- /zombienet_tests/misc/0003-parathreads.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "rococo-local" 7 | command = "polkadot" 8 | 9 | [[relaychain.nodes]] 10 | name = "alice" 11 | args = [ "--alice", "-lruntime=debug,parachain=trace" ] 12 | 13 | [[relaychain.nodes]] 14 | name = "bob" 15 | args = [ "--bob", "-lruntime=debug,parachain=trace" ] 16 | 17 | [[parachains]] 18 | id = 100 19 | add_to_genesis = false 20 | register_para = true 21 | onboard_as_parachain = false 22 | 23 | [parachains.collator] 24 | name = "collator01" 25 | image = "{{COL_IMAGE}}" 26 | command = "adder-collator" 27 | args = [ "-lruntime=debug,parachain=trace" ] 28 | 29 | [types.Header] 30 | number = "u64" 31 | parent_hash = "Hash" 32 | post_state = "Hash" 33 | -------------------------------------------------------------------------------- /zombienet_tests/smoke/0001-parachains-smoke-test.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "rococo-local" 7 | command = "polkadot" 8 | 9 | [[relaychain.nodes]] 10 | name = "alice" 11 | args = [ "--alice", "-lruntime=debug,parachain=trace" ] 12 | 13 | [[relaychain.nodes]] 14 | name = "bob" 15 | args = [ "--bob", "-lruntime=debug,parachain=trace" ] 16 | 17 | [[parachains]] 18 | id = 100 19 | addToGenesis = false 20 | 21 | [parachains.collator] 22 | name = "collator01" 23 | image = "{{COL_IMAGE}}" 24 | command = "adder-collator" 25 | args = [ "-lruntime=debug,parachain=trace" ] 26 | 27 | [types.Header] 28 | number = "u64" 29 | parent_hash = "Hash" 30 | post_state = "Hash" 31 | -------------------------------------------------------------------------------- /zombienet_tests/smoke/0001-parachains-smoke-test.zndsl: -------------------------------------------------------------------------------- 1 | Description: Smoke Test 2 | Network: ./0001-parachains-smoke-test.toml 3 | Creds: config 4 | 5 | alice: parachain 100 is registered within 225 seconds 6 | alice: parachain 100 block height is at least 10 within 400 seconds 7 | -------------------------------------------------------------------------------- /zombienet_tests/smoke/0002-parachains-upgrade-smoke-test.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | bootnode = true 4 | 5 | [relaychain] 6 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 7 | chain = "rococo-local" 8 | command = "polkadot" 9 | 10 | [[relaychain.nodes]] 11 | name = "alice" 12 | extra_args = [ "--alice" ] 13 | 14 | [[relaychain.nodes.env]] 15 | name = "RUST_LOG" 16 | value = "runtime=debug,parachain=trace,cumulus-collator=trace,aura=trace" 17 | 18 | [[relaychain.nodes]] 19 | name = "bob" 20 | extra_args = [ "--bob" ] 21 | 22 | [[relaychain.nodes.env]] 23 | name = "RUST_LOG" 24 | value = "runtime=debug,parachain=trace,cumulus-collator=trace,aura=trace" 25 | 26 | [[parachains]] 27 | id = 100 28 | addToGenesis = true 29 | cumulus_based = true 30 | 31 | [parachains.collator] 32 | name = "collator01" 33 | image = "{{COL_IMAGE}}" 34 | command = "polkadot-collator" 35 | 36 | [[parachains.collator.env]] 37 | name = "RUST_LOG" 38 | value = "runtime=debug,parachain=trace,cumulus-collator=trace,aura=trace" 39 | -------------------------------------------------------------------------------- /zombienet_tests/smoke/0002-parachains-upgrade-smoke-test.zndsl: -------------------------------------------------------------------------------- 1 | Description: Smoke Test 2 | Network: ./0002-parachains-upgrade-smoke-test.toml 3 | Creds: config 4 | 5 | alice: parachain 100 is registered within 225 seconds 6 | alice: parachain 100 block height is at least 10 within 460 seconds 7 | alice: parachain 100 perform dummy upgrade within 200 seconds 8 | alice: parachain 100 block height is at least 14 within 200 seconds 9 | -------------------------------------------------------------------------------- /zombienet_tests/smoke/0003-deregister-register-validator-smoke.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | timeout = 1000 3 | 4 | [relaychain] 5 | default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" 6 | chain = "rococo-local" 7 | command = "polkadot" 8 | 9 | [[relaychain.nodes]] 10 | name = "alice" 11 | args = ["-lruntime=debug,parachain=trace" ] 12 | 13 | [[relaychain.nodes]] 14 | name = "bob" 15 | args = [ "-lruntime=debug,parachain=trace" ] 16 | 17 | [[relaychain.nodes]] 18 | name = "charlie" 19 | args = [ "-lruntime=debug,parachain=trace" ] 20 | 21 | [[relaychain.nodes]] 22 | name = "dave" 23 | args = [ "-lruntime=debug,parachain=trace" ] 24 | -------------------------------------------------------------------------------- /zombienet_tests/smoke/0003-deregister-register-validator-smoke.zndsl: -------------------------------------------------------------------------------- 1 | Description: Deregister / Register Validator Smoke 2 | Network: ./0003-deregister-register-validator-smoke.toml 3 | Creds: config 4 | 5 | # ensure is in the validator set 6 | dave: reports polkadot_node_is_parachain_validator is 1 within 240 secs 7 | dave: reports polkadot_node_is_active_validator is 1 within 240 secs 8 | 9 | # deregister and check 10 | alice: js-script ./0003-deregister-register-validator.js with "deregister,dave" return is 0 within 30 secs 11 | 12 | # Wait 2 sessions. The authority set change is enacted at curent_session + 2. 13 | sleep 120 seconds 14 | dave: reports polkadot_node_is_parachain_validator is 0 within 180 secs 15 | dave: reports polkadot_node_is_active_validator is 0 within 180 secs 16 | 17 | # register and check 18 | alice: js-script ./0003-deregister-register-validator.js with "register,dave" return is 0 within 30 secs 19 | 20 | # Wait 2 sessions. The authority set change is enacted at curent_session + 2. 21 | sleep 120 seconds 22 | dave: reports polkadot_node_is_parachain_validator is 1 within 180 secs 23 | dave: reports polkadot_node_is_active_validator is 1 within 180 secs 24 | --------------------------------------------------------------------------------