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

Snowbridge - Ethereum Electra Upgrade Support #7075

Draft
wants to merge 58 commits into
base: master
Choose a base branch
from

Conversation

claravanstaden
Copy link
Contributor

@claravanstaden claravanstaden commented Jan 7, 2025

Description

Adds support for the upcoming Ethereum Electra upgrade, while maintaining backwards compatibility for the current Deneb fork.

Integration

Relayers should be updated to send updated Electra consensus data structures.

Review Notes

The Ethereum Electra hard-fork consensus changes affecting the Ethereum light client are mainly isolated to the Generalized Indexes of data structures changing. Before Electra, these values were hardcoded in config. For Electra, these values change and needed to the updated. Methods were added to return the correct g-index for the current fork version.

Data structures used by the Ethereum client did not change in this hard-fork. The BeaconState container has been updated with additional changes, but because the on-chain code does not reference the BeaconState directly (only indirectly through merkle proofs), it is not a concern. Off-chain relayers use the BeaconState to generate proofs, and so the relayer code has been updated accordingly.

Companion PR for off-chain relayers

Snowfork/snowbridge#1283

claravanstaden and others added 30 commits February 8, 2024 13:37
* pallet order

* fmt

* adds test for bridge order

* revert unintended change

---------

Co-authored-by: claravanstaden <Cats 4 life!>
* fix coverage

* fix codecov config

---------

Co-authored-by: claravanstaden <Cats 4 life!>
# Conflicts:
#	.github/workflows/check-labels.yml
#	.github/workflows/check-prdoc.yml
#	.github/workflows/check-workspace.yml
#	.github/workflows/gitspiegel-trigger.yml
#	.github/workflows/release-99_notif-published.yml
#	bridges/snowbridge/README.md
#	bridges/snowbridge/runtime/test-common/src/lib.rs
#	bridges/snowbridge/scripts/contribute-upstream.sh
#	cumulus/parachains/runtimes/assets/test-utils/src/test_cases_over_bridge.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs
#	polkadot/node/subsystem-bench/src/approval/mod.rs
#	polkadot/node/subsystem-bench/src/availability/mod.rs
#	polkadot/node/subsystem-bench/src/cli.rs
#	polkadot/node/subsystem-bench/src/core/environment.rs
#	polkadot/node/subsystem-bench/src/subsystem-bench.rs
* extract ethereum chain id

* remove cargo.toml

* fix chain id data type

* fix missing chain id param

* fix missing chain id param

* fix coverage and missing param

* fix CI

* fix CI

* revert scripts

* revert coverage jobs

* revert formatting

---------

Co-authored-by: claravanstaden <Cats 4 life!>
* Ignore rewarding when funds unavailable

* More tests

* Fix taplo

* Fix emulated test

* Improve comments

* Update bridges/snowbridge/pallets/inbound-queue/src/lib.rs

Co-authored-by: Vincent Geddes <[email protected]>

* Fix format

---------

Co-authored-by: Vincent Geddes <[email protected]>
* test e2e scripts in GA

* fix GA

* test current dir

* fix path

* install moreutils

* sponge

* install go

* export path

* try something else

* run nix

* switch branch

* nix develop

* check setup

* use nix setup

* e2e stack script

* e2e stack script

* run command

* check current dir

* correct dir

* correct dir

* just cd

* try something else

* rn e2e script

* adds submodules

* ls

* print vars

* remove ls

* cd instead of pushdir

* try checking out differently

* ls

* ls

* change checkout order

* check what is in a dir

* check what is in a dir

* check something

* check something

* try something

* try something

* try e2e script again

* remove ls

* cleanup script

* adds ssz gen

* install js components

* install js components

* fix dir

* adds output dir

* create dir

* try something else

* bump

* fix config paths

* test output dir

* adds wasm target

* check wasm target

* setup rustup in nix

* missing quote

* install rustup stable

* adds e2e script in again

* remove skip wasm flag

* comment out things

* start lodestar

* print out log

* print out log

* print out lodestar

* check geth version

* bump

* remove commented out code

* update go files

* adds smoketests

* create dir

* adjust scripts

* only redirect start-services.sh output

* only redirect start-services.sh output

* switch dir

* permissions

* check script

* allow service to be down

* bump

* last run, hopefully

* fix tests

* fixes

* bump

* fix

* check lodestar

* check lodestar

* check lodestar

* bump

* bump

* try again

* try again

* bump

* bump

* update go

* update go

* cleanup

* check what is happening now

* lodestar should run the background

* run init.sh

* check what happens with the download

* change OS check

* remove other steps to see what is happening

* bump

* run smoketests

* run smoketests

* cleanup jobs

* extract ethereum chain id

* remove cargo.toml

* fix chain id data type

* fix missing chain id param

* fix missing chain id param

* fix coverage and missing param

* fix CI

* fix CI

* revert scripts

* revert coverage jobs

* revert formatting

* check log

* fix log

* separate steps

* cleanup job

* remove running smoketests on a PR, only when merged

* update branch

* remove http endpoint from relayer

* update nightly, revert unrelated changes

* check rust version

* chaneg branch for testing

* adds beacon relay log

* increase slot time

* increase block time check

* lower block check count

* only run smoketests on merge to snowbridge

---------

Co-authored-by: claravanstaden <Cats 4 life!>
* Sync execution update on demand

* Fix updating LatestExecutionState

* Revert change unrelated

* Remove unused

* Remove execution header from update & Remove LatestExecutionState
* adds finalized header gap check

* fix comment

* fmt

* use constant for max gap

* remove redundant config

* fmt

* fix tests

* fix again

* fmt

* test works

* revert change

* Update bridges/snowbridge/pallets/ethereum-client/src/lib.rs

Co-authored-by: Vincent Geddes <[email protected]>

* fmt

---------

Co-authored-by: claravanstaden <Cats 4 life!>
Co-authored-by: Vincent Geddes <[email protected]>
…ion header storage (paritytech#125)

* Remove execution header storage & submit inbound message with execution update

* Fix ci breaking

* More refactoring

* Update beacon test fixtures

* Format code

* Initialize storage with finalized checkpoint for benchmark

* Update weights include verify the execution proof

* Fix breaking test

* Remove fixture not in use

* Add detail for InvalidExecutionProof

* Initialize checkpoint for tests on demand

* Revert error as NotBootstrapped for submit_update_with_missing_bootstrap

* Add verify_execution_header tests back

* Add error test back

* Cleanup templates

* Update bridges/snowbridge/primitives/beacon/src/types.rs

Co-authored-by: Vincent Geddes <[email protected]>

* Narrowed inputs

* Remove fields irrelevant from proof

* Update bridges/snowbridge/primitives/core/src/inbound.rs

Co-authored-by: Vincent Geddes <[email protected]>

* Update bridges/snowbridge/pallets/ethereum-client/src/impls.rs

Co-authored-by: Vincent Geddes <[email protected]>

* Polish

---------

Co-authored-by: Vincent Geddes <[email protected]>
* fix smoketests ci

* remove merge from upstream

* first commit before pulling from master

---------

Co-authored-by: claravanstaden <Cats 4 life!>
* Add fee multiplier

* fmt

* fmt

* Update test mock

* Swap order for parameters to calculate_fee

---------

Co-authored-by: claravanstaden <Cats 4 life!>
# Conflicts:
#	.github/scripts/check-workspace.py
#	.github/scripts/common/lib.sh
#	.github/workflows/check-licenses.yml
#	.github/workflows/check-prdoc.yml
#	.github/workflows/release-50_publish-docker.yml
#	.github/workflows/release-99_notif-published.yml
#	Cargo.lock
#	bridges/snowbridge/pallets/ethereum-client/Cargo.toml
#	bridges/snowbridge/pallets/ethereum-client/src/tests.rs
#	bridges/snowbridge/pallets/inbound-queue/Cargo.toml
#	bridges/snowbridge/pallets/inbound-queue/src/mock.rs
#	bridges/snowbridge/pallets/outbound-queue/Cargo.toml
#	bridges/snowbridge/pallets/outbound-queue/merkle-tree/Cargo.toml
#	bridges/snowbridge/pallets/outbound-queue/runtime-api/Cargo.toml
#	bridges/snowbridge/pallets/outbound-queue/src/lib.rs
#	bridges/snowbridge/pallets/system/Cargo.toml
#	bridges/snowbridge/pallets/system/runtime-api/Cargo.toml
#	bridges/snowbridge/primitives/beacon/Cargo.toml
#	bridges/snowbridge/primitives/core/Cargo.toml
#	bridges/snowbridge/primitives/ethereum/Cargo.toml
#	bridges/snowbridge/runtime/runtime-common/Cargo.toml
#	bridges/snowbridge/runtime/test-common/Cargo.toml
# Conflicts:
#	.github/CODEOWNERS
#	.github/scripts/common/lib.sh
#	bridges/snowbridge/pallets/ethereum-client/src/tests.rs
#	bridges/snowbridge/pallets/inbound-queue/fixtures/src/register_token_with_insufficient_fee.rs
#	cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs
* forward message id to destination chain

* fix import
Co-authored-by: claravanstaden <Cats 4 life!>
# Conflicts:
#	.github/scripts/common/lib.sh
#	.github/workflows/check-links.yml
#	.github/workflows/srtool.yml
#	.github/workflows/subsystem-benchmarks.yml
#	bridges/snowbridge/pallets/inbound-queue/src/lib.rs
#	cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs
* update rust version to stable

* pin to rust 1.76

* fix tests and warning

* fix import

* update nightly version

---------

Co-authored-by: claravanstaden <Cats 4 life!>
paritytech#145)

* sync committee handover fix

* remove comment

* Update bridges/snowbridge/pallets/ethereum-client/src/lib.rs

Co-authored-by: Vincent Geddes <[email protected]>

* add extra check

* move checks around

* remove extra validation

* fix compiler error

* reject updates in next period without sync committee

* fix test

* polish

* Update bridges/snowbridge/pallets/ethereum-client/src/lib.rs

Co-authored-by: Vincent Geddes <[email protected]>

---------

Co-authored-by: Vincent Geddes <[email protected]>
# Conflicts:
#	.github/workflows/check-features.yml
#	.github/workflows/check-licenses.yml
#	.github/workflows/issues-auto-label.yml
#	.github/workflows/misc-notify-burnin-label.yml
#	.github/workflows/misc-review-bot-merge-queue.yml
#	.github/workflows/publish-check-crates.yml
#	.github/workflows/publish-claim-crates.yml
#	.github/workflows/publish-subsystem-benchmarks.yml
#	.github/workflows/release-99_notif-published.yml
#	.github/workflows/release-build-and-attach-runtimes.yml
#	.github/workflows/release-check-runtimes.yml
#	.github/workflows/release-srtool.yml
#	.github/workflows/review-bot.yml
#	.github/workflows/review-trigger.yml
#	cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs
* add channel id to events

* fixed channel

* fix formatting
* cleanup

* cleanup ethereum mods

* start on migration work

* migration tests

* more test refining

* finish off feature

* fixes

* fmt

* fix missing feature

* zepter

* taplo

* remove workflow files

* Updates weights

* remove comment

* updates weight

* fix weights
* Enable bridge config on westend

* Update bridge config for asset hub westend

* Use BridgeHubMessageRouter

* Add unit tests

* Update asset hub config

* Add emulated test
# Conflicts:
#	.github/review-bot.yml
#	.github/scripts/check-workspace.py
#	.github/scripts/common/lib.sh
#	.github/workflows/check-licenses.yml
#	.github/workflows/check-links.yml
#	.github/workflows/check-prdoc.yml
#	.github/workflows/check-runtime-migration.yml
#	.github/workflows/check-semver.yml
#	.github/workflows/checks-quick.yml
#	.github/workflows/misc-sync-templates.yml
#	.github/workflows/publish-check-crates.yml
#	.github/workflows/publish-claim-crates.yml
#	.github/workflows/release-10_rc-automation.yml
#	.github/workflows/release-30_publish_release_draft.yml
#	.github/workflows/release-50_publish-docker.yml
#	.github/workflows/release-srtool.yml
#	.github/workflows/tests-linux-stable.yml
#	.github/workflows/tests.yml
#	Cargo.lock
#	bridges/snowbridge/pallets/ethereum-client/Cargo.toml
#	bridges/snowbridge/pallets/ethereum-client/src/mock.rs
#	cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml
#	cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/Cargo.toml
#	cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/lib.rs
#	cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml
#	cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/xcm_config.rs
claravanstaden and others added 28 commits July 24, 2024 15:56
* free finalized updates

* update comment

* fix check

* fixes

* tests

* fixes

* fmt

* finishing touches

* comments

* adds missing impl

* adds test

* fixes

* fix
* Enable fast runtime by default

* Add genesis config for EthereumSystem

* Enable meta-hash extension

* Fix test to construct extrinsic
* Short epoch

* allow bridge hub assets

---------

Co-authored-by: Alistair Singh <[email protected]>
* Register token from polkadot

* Extract AssetRegistrarMetadata

* ReserveTransfer from AssetHub

* Transfer DOT back to AssetHub

* Fix breaking tests

* Fix register token

* Increase dispatch_gas to cover the actual cost for register token

* Add ConvertAssetId to outbound router

* Rename to SendForeignToken

* Update cost

* Move Command.RegisterToken to top level

* Use VersionedLocation for storage

* Use versioned location

* TokenIdOf follow the same pattern as AgentIdOf

* Rename MintToken to TransferNativeToken

* Rename as SendNativeToken

* More refactoring

* Remove AgentExecuteCommand

* Remove TokenExists check

* Update cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs

Co-authored-by: Clara van Staden <[email protected]>

* Benchmark register_token

* More checks for the events

* More tests for send native token

* More tests describe tokenID

* More asset identifiers

* Add LocationToToken & Always use VersionedLocation

* Fix breaking tests

* Update gas cost for registering polkadot token

* Add AgentExecuteCommand back for compatibility

* Split into 2 tests each covers one direction

* Revert the change on AH

* Switch to native token on penpal for the integration

* Make fee asset as configuration parameter of the Channel

* Revert fee_asset_id as channel property

* Short epoch

* Fix integration tests

* Fix format

* Cleanup

* Register relay token

* Use relay token as fee asset

* Fix clippy

* Fix missing dependency

* Remove reanchored prefix from asset_id

* Fix test

* Fix the instruction

* Fix test

* Multi hop transfer

* Fix tests

* allow bridge hub assets

* Register token from BH directly and remove force_register_token

* Decrease gas estimation for PNA

* Cleanup

* Store Location rather than VersionedLocation

* Fix test

* Add more tests

* Revamp reanchor logic

* Improve reanchor & Fix tests

* Use secondary governance channel to register PNA

* Rename as asset location

* Use BoundVec limit size of name&symbol

* Describe location of PNA & more tests

* Add test

* Fix taplo

* More tests

* Cleanup

* Format code

* Batch rename token command

* Remove agent_id

* Rename as AssetMetadata

* Add test for penpal native token

---------

Co-authored-by: Clara van Staden <[email protected]>
Co-authored-by: Alistair Singh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants