Skip to content
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

feat: update to polkadot v1.1.0 release #1182

Merged
merged 30 commits into from
Mar 2, 2024
Merged

Conversation

ashutoshvarma
Copy link
Member

@ashutoshvarma ashutoshvarma commented Feb 27, 2024

Pull Request Summary
Update the dependencies to polkadot-sdk v1.1.0

Major Changes

XCM

  • The XCM barrier AllowPaidExecutionFrom now prevents using multiple currency for buying execution.

    • That means if you withdraw more than 1 asset into holding before BuyExecution that barrier will fail now.
    • This might break existing use cases which does the later like xtokens transfer_multicurrencies()
    // This will fail
    Xcm([
      WithdrawAsset { /* >1 asset */ }
      BuyExecution { .. }
    ])
    
    // This will pass
    Xcm([
      WithdrawAsset { /* 1 asset for fees */ }
      BuyExecution { .. }
      WithdrawAsset { /* other assets to use in the program */ }
    ])
  • Remove vendored xcm-builder code from primitives/xcm as it’s available in this uplift

  • The XCM instr decoding limit has been set to 100 - Add environmental variable to track decoded instructions paritytech/polkadot-sdk#1320

  • The following crates in the polkadot-sdk has been renamed

    • xcm -> staging-xcm
    • xcm-executor -> staging-xcm-executor
    • xcm-builder -> staging-xcm-builder
  • Thexcm_executor::traits::Convert is removed and sp_runtime conversion traits are use with the exception of multi-location conversions for which  xcm_executor::traits::ConvertLocation trait is used whose APIs different.

  • WeightTrader::buy_weight method takes an additional XcmContext parameter.

Frontier

Client

  • Native execution is no more and wasm is default, and the cli flags for native execution is deprecated and do nothing which will be removed in future.

Runtime

  • In frame_system::Config,

  • pallet_contracts : new configs to take into account - Contracts Add deposit for dependencies paritytech/substrate#14079

    • values for CodeHashLockupDepositPercent and MaxDelegateDependencies are taken from rococo
    // The percentage of the storage deposit that should be held for using a code hash.
    // Any action that inc code hash ref (like delegate_dependencies and instantiation) would be charge with percentage of code hash deposit
    type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
    // The maximum number of delegate_dependencies that a contract can lock with
    // On average it would be mostly 1 for proxy contracts but there might be some unique use cases
    // where it can be more than one and it's also protected by `CodeHashLockupDepositPercent`
    type MaxDelegateDependencies = MaxDelegateDependencies;
    
    type Migrations = ();
    // should be `()` for production chains
    type Debug = ();
    // only possible value for this is `()`
    type Environment = ();
  • hrmp::Config has a new associated type ChannelManager

    • This is a privilege origin that can manage channels, currently set to root
  • PoV value is taken into account by transaction pallet - Take into account proof size for transaction payment and priority paritytech/substrate#13958

    • Currently the max pov is taken from polkadot_primitives::MAX_POV_SIZE
  • Genesis config and removal of native runtime execution

    • Serde’s derive is required even in no-std for every type in Genesis
    • build_storage and assimilate_storage is now provided via sp_runtime::BuildStorage instead of frame_support::traits::GenesisBuild
  • pallet_xcm_benchmarks::generic::Config requires a new method alias_origin

Migrations

There are very big multi block migrations from pallet-contracts, from v11 we’ll be migrating to v15.

  • v12 - due to change contracts: switch to wasmi gas metering paritytech/substrate#14084, there is no need to store instrumented code anymore. It moves OwnerInfo to CodeInfo, add determinism field to the latter, clear CodeStorage and repay deposits.
  • v13 - due to change Contracts Add deposit for dependencies paritytech/substrate#14079 storage map ContractInfoOf receives a new field called delegate_dependencies. This is a map that stores all contract account that calls this account via low-level function delegate_call (e.g. used by contract upgrade scenario). What v13 migration does is just adds empty delegate_dependencies field to each ContractInfoOf element.
  • v14 - due to change Contracts: migrate to fungible traits paritytech/substrate#14020 pallet contract start to use Holds API over deprecated Reserve API. It changes nothing, other than that for each account that is the owner of the uploaded code, there will be hold set for all such accounts instead of reserve.
    • migration iterates over all members of CodeInfoOf map.
  • v15 - due to change Contracts remove deposit accounts paritytech/substrate#14589 that essentially reverts logic contracts: Don't rely on reserved balances keeping an account alive paritytech/substrate#13369 and v10 migration which added deposit_account field to ContractInfoOf. The reason it was needed in the first place was the change introduced in Substrate 0.9.43 version that required ED to be present on free funds. v15 migration iterates over all elements of ContractInfoOf map and:
    • decrease consumer counter for a deposit account (will throw error but can be safely ignored)
    • transfers all balance of the deposit account to the contract account,
    • hold that balance on the contract account,
    • reap deposit account.

TODO

Check list

  • added or updated unit tests
  • updated Astar official documentation
  • added OnRuntimeUpgrade hook for precompile revert code registration
  • added benchmarks & weights for any modified runtime logics.

@ashutoshvarma ashutoshvarma added shiden related to shiden runtime astar Related to Astar shibuya related to shibuya labels Feb 27, 2024
@ashutoshvarma ashutoshvarma changed the title feat: update to polkadot v1.1.0 release [DIFF FIXED] feat: update to polkadot v1.1.0 release Feb 27, 2024
@ashutoshvarma ashutoshvarma added the runtime This PR/Issue is related to the topic “runtime”. label Feb 27, 2024
@ashutoshvarma ashutoshvarma marked this pull request as ready for review February 27, 2024 15:47
bin/collator/src/cli.rs Show resolved Hide resolved
bin/xcm-tools/src/command.rs Show resolved Hide resolved
runtime/astar/src/lib.rs Outdated Show resolved Hide resolved
runtime/shiden/src/lib.rs Outdated Show resolved Hide resolved
runtime/astar/src/lib.rs Outdated Show resolved Hide resolved
PierreOssun
PierreOssun previously approved these changes Feb 28, 2024
Copy link
Member

@PierreOssun PierreOssun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

pallets/block-rewards-hybrid/src/lib.rs Show resolved Hide resolved
runtime/astar/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@Dinonard Dinonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

github-actions bot commented Mar 1, 2024

Code Coverage

Package Line Rate Branch Rate Health
precompiles/sr25519/src 64% 0%
precompiles/dapp-staking-v3/src 90% 0%
pallets/dapp-staking-migration/src 48% 0%
pallets/dapp-staking-v3/src 89% 0%
precompiles/dapps-staking/src 93% 0%
precompiles/xcm/src 73% 0%
chain-extensions/types/xvm/src 0% 0%
precompiles/substrate-ecdsa/src 74% 0%
pallets/astar-xcm-benchmarks/src/fungible 100% 0%
chain-extensions/types/assets/src 0% 0%
chain-extensions/pallet-assets/src 56% 0%
pallets/dapp-staking-v3/rpc/runtime-api/src 0% 0%
pallets/unified-accounts/src 85% 0%
primitives/src/xcm 65% 0%
pallets/dapp-staking-v3/src/benchmarking 99% 0%
primitives/src 61% 0%
pallets/xc-asset-config/src 64% 0%
pallets/static-price-provider/src 58% 0%
pallets/inflation/src 83% 0%
pallets/dapps-staking/src 89% 0%
pallets/astar-xcm-benchmarks/src 87% 0%
chain-extensions/unified-accounts/src 0% 0%
pallets/dynamic-evm-base-fee/src 92% 0%
pallets/dapps-staking/src/pallet 86% 0%
precompiles/assets-erc20/src 81% 0%
pallets/xvm/src 51% 0%
precompiles/xvm/src 74% 0%
chain-extensions/types/unified-accounts/src 0% 0%
pallets/ethereum-checked/src 79% 0%
pallets/astar-xcm-benchmarks/src/generic 100% 0%
pallets/dapp-staking-v3/src/test 0% 0%
pallets/collator-selection/src 91% 0%
chain-extensions/xvm/src 0% 0%
precompiles/dispatch-lockdrop/src 86% 0%
precompiles/unified-accounts/src 100% 0%
precompiles/dapp-staking-v3/src/test 0% 0%
pallets/block-rewards-hybrid/src 91% 0%
Summary 79% (4420 / 5575) 0% (0 / 0)

Minimum allowed line rate is 50%

Copy link
Member

@PierreOssun PierreOssun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! good for me

@ashutoshvarma ashutoshvarma merged commit d742022 into master Mar 2, 2024
8 checks passed
@ashutoshvarma ashutoshvarma deleted the feat/polkadot-1.0.0-fix branch March 2, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astar Related to Astar runtime This PR/Issue is related to the topic “runtime”. shibuya related to shibuya shiden related to shiden runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants