-
Notifications
You must be signed in to change notification settings - Fork 859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of RFC-123 #6029
base: master
Are you sure you want to change the base?
Conversation
* master: (28 commits) `substrate-node`: removed excessive polkadot-sdk features (#5925) Rename QueueEvent::StartWork (#6015) [ci] Remove quick-benchmarks-omni from GitLab (#6014) Set larger timeout for cmd.yml (#6006) Fix `0003-beefy-and-mmr` test (#6003) Remove redundant XCMs from dry run's forwarded xcms (#5913) Add RadiumBlock bootnodes to Coretime Polkadot Chain spec (#5967) Bump strum from 0.26.2 to 0.26.3 (#5943) Add PVF execution priority (#4837) Snowbridge V2 docs (#5902) Fix u256 conversion in BABE (#5994) [ci] Move test-linux-stable-no-try-runtime to GHA (#5979) Bump PoV request timeout (#5924) [Release/CI] Github flow to build `polkadot`/`polkadot-parachain` rc binaries and deb package (#5963) [ci] Remove short-benchmarks from Gitlab (#5988) Disable flaky tests reported in 5972/5973/5974 (#5976) Bump some dependencies (#5886) bump zombienet version and set request for k8s (#5968) [omni-bencher] Make all runtimes work (#5872) Omni-Node renamings (#5915) ...
Why?
This also happens in the block before. Not sure how this should be a problem in the runtime upgrade block. Yes, it decreases the available PoV size, but then we need to use multi block migrations. |
If we try to check a transaction at the block that sets the new code as pending code, it will use the old code for checking it (because RPC uses a runtime call with offchain context), but the next block will use the new code. So even though transaction might be valid with old code, it might be invalid with the new one (or vice versa). Am I missing something here? |
Ahh you meant validate_transaction. Transactions are getting invalidated any way by runtime upgrades because the spec version changes. Runtime upgrades are also not happen that regularly, so I think it is fine. |
For this item, what I want to test is a runtime upgrade with code close to max size to make sure it fits into PoV. My worry is that it will be included twice (as part of block body and state proof in :pending_code or twice in state proof). Given that max code size is set as 3mb, two of them might not fit into PoV limits (unless we bump them), although compression might save us here. |
Another question I have is that it seems to me that we only start compiling the new code with wasmtime when we call
because we will call some runtime API after importing it. However, with this PR, we will only start compiling the new runtime when we start importing block N+1 (unless we are a block producer) as the runtime API calls for block N use old code:
Is that correct, or I am missing somethings? |
How? Parachains are not upgrading instantly. They first need to announce it to the relay chain and even if they would do it instantly, |
While that is being correct, this doesn't mean it would always need to be the case that this is happening. However, we could add this optimization to ensure that the code is compiled in between importing and before building a new block. But this is not really a requirement for this PR IMO. |
* master: (129 commits) pallet-revive: Use `RUSTUP_TOOLCHAIN` if set (#6365) [eth-rpc] proxy /health (#6360) [Release|CI/CD] adjust release pipelines (#6366) Bump the known_good_semver group across 1 directory with 3 updates (#6339) Run check semver in MQ (#6287) [Deprecation] deprecate treasury `spend_local` call and related items (#6169) refactor and harden check_core_index (#6217) litep2p: Update litep2p to v0.8.0 (#6353) [pallet-staking] Additional check for virtual stakers (#5985) migrate pallet-remarks to v2 bench syntax (#6291) Remove leftover references of Wococo (#6361) snowbridge: allow account conversion for Ethereum accounts (#6221) authority-discovery: Populate DHT records with public listen addresses (#6298) Bounty Pallet: add `approve_bounty_with_curator` call to `bounties` pallet (#5961) Silent annoying log (#6351) [pallet-revive] rework balance transfers (#6187) `statement-distribution`: RFC103 implementation (#5883) Disable flaky tests reported in #6343 / #6345 (#6346) migrate pallet-recovery to benchmark V2 syntax (#6299) inclusion emulator: correctly handle UMP signals (#6178) ...
* master: (256 commits) fix chunk fetching network compatibility zombienet test (#6988) chore: delete repeat words (#7034) Print taplo version in CI (#7041) Implement cumulus StorageWeightReclaim as wrapping transaction extension + frame system ReclaimWeight (#6140) Make `TransactionExtension` tuple of tuple transparent for implication (#7028) Replace duplicated whitelist with whitelisted_storage_keys (#7024) [WIP] Fix networking-benchmarks (#7036) [docs] Fix release naming (#7032) migrate pallet-mixnet to umbrella crate (#6986) Improve remote externalities logging (#7021) Fix polkadot sdk doc. (#7022) Remove warning log from frame-omni-bencher CLI (#7020) [pallet-revive] fix file case (#6981) Add workflow for networking benchmarks (#7029) [CI] Skip SemVer on R0-silent and update docs (#6285) correct path in cumulus README (#7001) sync: Send already connected peers to new subscribers (#7011) Excluding chainlink domain for link checker CI (#6524) pallet-bounties: Fix benchmarks for 0 ED (#7013) Log peerset set ID -> protocol name mapping (#7005) ...
…ue-64 * origin/ao-fix-issue-64:
All GitHub workflows were cancelled due to failure one of the required jobs. |
* master: Snowbridge: Support bridging native ETH (#6855) adding warning when using default substrateWeight in production (#7046) release: unset SKIP_WASM_BUILD (#7074) fix typos (#7068) Fix defensive! macro to be used in umbrella crates (#7069) rewrite some flaky zombienet polkadot tests to zombienet-sdk (#6757) Implement NetworkRequest for litep2p (#7073) migrate pallet-node-authorization to use umbrella crate (#7040)
@bkchr any feedback on the questions and the implementation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic looks good. I went ahead and paranoid verified some scenarios manually (spoiler: everything worked :D).
- Upgrade relay chain with system_version < 3
- Upgrade relay chain with system_version >= 3
- Upgrade parachain
For these I verified each time that the correct code is being used.
Do we want to pass IgnorePendingCode regardless in the higher level APIs?
Currently I don't see a use case for it. If needed, we could add it later IMO. In 99% of cased, we want to use the normal :code
. Only to advance the state :pending_code
is relevant, so seems niche.
Do we want to emit an event when pending code is set?
Currently we should emit Event::ValidationFunctionStored
already when this happens no?
Should the system_version check also be done on the node side (block production and import)?
Not sure about this one, do you think it would be useful? It looks like :pending_code
will not play a role with system_version < 3, so node will ignore it automatically.
BTW, I saw that we don't check the system_version for parachains, did we have a discussion about that?
@@ -172,7 +172,11 @@ where | |||
|
|||
let Ok(Some(code)) = | |||
params.para_client.state_at(parent_hash).map_err(drop).and_then(|s| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Why do we do this map_err(drop)
here? Seems overengineered 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, but seems like to satisfy types. Either way, not introduced here :)
* origin: (325 commits) Add an extra_constant to pallet-treasury (#7918) Bump the ci_dependencies group across 1 directory with 4 updates (#7855) remove compromised action (#7934) Fixing token-economics dead link (#5302) [pallet-revive] Fix pallet-revive-fixtures build.rs (#7928) cumulus: fix pov exporter format (#7923) sp-api: Support `mut` in `impl_runtime_apis!` (#7924) Remove clones from block seal function (#7917) [pallet-revive] precompiles 2->9 (#7810) Use non-native token to benchmark xcm on asset hub (#7893) [CI] bump timeout wait for build in zombienet workflows. (#7871) taplo: split long array line to multiline array (#7905) [pallet-revive] fixture as dev dep (#7844) notifications/libp2p: Punish notification protocol misbehavior on outbound substreams (#7781) [Release|CI/CD] Update version of the cache action in the Publish docker ci (#7892) Remove `pallet::getter` usage from bridges/modules (#7120) [pallet-revive] Support blocktag in eth_getLogs RPC (#7879) Improve error message in benchmark macro (#7873) staking: add `manual_slash` extrinsic (#7805) Remove execute_with_origin implementation in the XCM executor (#7889) ...
…into ao-fix-issue-64 * 'ao-fix-issue-64' of github.com:paritytech/polkadot-sdk:
Closes #64
This PR implements approach 4 outlined in the issue and polkadot-fellows/RFCs#123.
Unresolved questions:
CallContext::{Offchain, Onchain}
determine whether it's runtime calls / (block production or import)?IgnorePendingCode
regardless in the higher level APIs? Nomaybe_apply_pending_code_upgrade
?TODO: