├── .cargo └── config.toml ├── .dockerignore ├── .ecrc ├── .editorconfig ├── .github ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml ├── scripts │ └── coverage-report.py ├── workflow-templates │ ├── build-prod-binary │ │ └── action.yml │ ├── cargo-build │ │ └── action.yml │ ├── dev-tests │ │ └── action.yml │ └── publish-docker │ │ └── action.yml └── workflows │ ├── build.yml │ ├── check-benchmarks.yml │ ├── check-licenses.yml │ ├── client-release-issue.yml │ ├── coverage.yml │ ├── docs.yml │ ├── enforce-pr-labels.yml │ ├── prepare-binary.yml │ ├── publish-binary.yml │ ├── publish-docker-runtime.yml │ ├── publish-docker.yml │ ├── publish-runtime.yml │ ├── publish-types-bundle.yml │ ├── publish-typescript-api.yml │ ├── runtime-release-issue.yml │ ├── scout.yml │ ├── subxt-diff.yml │ ├── update-typescript-api.yml │ ├── version-bump.yml │ └── weight-diff-report.yml ├── .gitignore ├── .prettierignore ├── .rustfmt.toml ├── AUTOMATION.md ├── CONTRIBUTIONS.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── MBIPS ├── MBIP-1.md ├── MBIP-2.md ├── MBIP-3.md ├── MBIP-4.md ├── MBIP-5.md ├── MBIP-6.md └── template.md ├── PERF.md ├── README.md ├── RELEASE.md ├── benchmarking └── frame-weight-template.hbs ├── bin └── utils │ └── moonkey │ ├── Cargo.toml │ └── src │ └── main.rs ├── biome.json ├── bug-bounty.md ├── client ├── evm-tracing │ ├── Cargo.toml │ └── src │ │ ├── formatters │ │ ├── blockscout.rs │ │ ├── call_tracer.rs │ │ ├── mod.rs │ │ ├── raw.rs │ │ └── trace_filter.rs │ │ ├── lib.rs │ │ ├── listeners │ │ ├── call_list.rs │ │ ├── mod.rs │ │ └── raw.rs │ │ └── types │ │ ├── block.rs │ │ ├── mod.rs │ │ ├── serialization.rs │ │ └── single.rs ├── rpc-core │ ├── debug │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── trace │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── types │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── rpc │ ├── debug │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src │ │ │ └── lib.rs │ ├── dev │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── finality │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── trace │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs └── vrf │ ├── Cargo.toml │ └── src │ └── lib.rs ├── core-primitives ├── Cargo.toml └── src │ └── lib.rs ├── docker ├── moonbeam-production.Dockerfile ├── moonbeam-srtool.Dockerfile └── moonbeam.Dockerfile ├── docs ├── git-branches-conventions.md └── workspace-dependencies.md ├── file_header.txt ├── media ├── Banner.jpg ├── GLMR.svg ├── MOVR.svg ├── Moonbeam_Icon_White.svg ├── Moonbeam_Logo_White.svg ├── Moonriver_Icon_White.svg ├── Moonriver_Logo_White.svg └── README.md ├── node ├── Cargo.toml ├── cli-opt │ ├── Cargo.toml │ └── src │ │ ├── account_key.rs │ │ └── lib.rs ├── cli │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── cli.rs │ │ ├── command.rs │ │ └── lib.rs ├── service │ ├── Cargo.toml │ └── src │ │ ├── chain_spec │ │ ├── fake_spec.rs │ │ ├── mod.rs │ │ ├── moonbase.rs │ │ ├── moonbeam.rs │ │ ├── moonriver.rs │ │ └── test_spec.rs │ │ ├── client.rs │ │ ├── lazy_loading │ │ ├── backend.rs │ │ ├── call_executor.rs │ │ ├── client.rs │ │ ├── helpers.rs │ │ ├── lock.rs │ │ ├── manual_sealing.rs │ │ ├── mod.rs │ │ └── state_overrides.rs │ │ ├── lib.rs │ │ ├── rpc.rs │ │ └── rpc │ │ └── tracing.rs └── src │ └── main.rs ├── package.json ├── pallets ├── asset-manager │ ├── Cargo.toml │ └── src │ │ ├── benchmarks.rs │ │ ├── lib.rs │ │ ├── migrations.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ └── weights.rs ├── erc20-xcm-bridge │ ├── Cargo.toml │ └── src │ │ ├── erc20_matcher.rs │ │ ├── erc20_trap.rs │ │ ├── errors.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ └── xcm_holding_ext.rs ├── ethereum-xcm │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests │ │ ├── mod.rs │ │ ├── res │ │ └── erc20_contract_bytecode.txt │ │ ├── v1.rs │ │ ├── v1 │ │ ├── eip1559.rs │ │ ├── eip2930.rs │ │ └── legacy.rs │ │ └── v2.rs ├── moonbeam-foreign-assets │ ├── Cargo.toml │ ├── build.rs │ ├── resources │ │ ├── foreign_erc20.sol │ │ ├── foreign_erc20_initcode.bin │ │ └── foreign_erc20_initcode.hex │ └── src │ │ ├── benchmarks.rs │ │ ├── evm.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ └── weights.rs ├── moonbeam-lazy-migrations │ ├── Cargo.toml │ └── src │ │ ├── benchmarks.rs │ │ ├── foreign_asset.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ └── weights.rs ├── moonbeam-orbiters │ ├── Cargo.toml │ └── src │ │ ├── benchmarks.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ ├── types.rs │ │ └── weights.rs ├── moonbeam-xcm-benchmarks │ ├── Cargo.toml │ └── src │ │ ├── generic │ │ ├── benchmarking.rs │ │ ├── mock.rs │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── weights │ │ ├── fungible.rs │ │ ├── generic.rs │ │ └── mod.rs ├── parachain-staking │ ├── Cargo.toml │ ├── README.md │ ├── migrations.md │ └── src │ │ ├── auto_compound.rs │ │ ├── benchmarks.rs │ │ ├── delegation_requests.rs │ │ ├── inflation.rs │ │ ├── lib.rs │ │ ├── migrations.rs │ │ ├── mock.rs │ │ ├── set.rs │ │ ├── tests.rs │ │ ├── traits.rs │ │ ├── types.rs │ │ └── weights.rs ├── precompile-benchmarks │ ├── Cargo.toml │ ├── benchmark_proofs │ └── src │ │ ├── benchmarks.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── weights.rs ├── proxy-genesis-companion │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── xcm-bridge-router │ ├── Cargo.toml │ └── src │ │ ├── benchmarking.rs │ │ ├── impls.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ └── weights.rs ├── xcm-bridge │ ├── Cargo.toml │ └── src │ │ ├── benchmarking.rs │ │ ├── congestion.rs │ │ ├── dispatcher.rs │ │ ├── exporter.rs │ │ ├── lib.rs │ │ ├── migration.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ └── weights.rs ├── xcm-transactor │ ├── Cargo.toml │ └── src │ │ ├── benchmarks.rs │ │ ├── encode.rs │ │ ├── lib.rs │ │ ├── migrations.rs │ │ ├── mock.rs │ │ ├── relay_indices.rs │ │ ├── tests.rs │ │ └── weights.rs └── xcm-weight-trader │ ├── Cargo.toml │ └── src │ ├── benchmarking.rs │ ├── lib.rs │ ├── mock.rs │ ├── tests.rs │ └── weights.rs ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── precompiles ├── assets-erc20 │ ├── Cargo.toml │ ├── ERC20.sol │ ├── Permit.sol │ ├── Roles.sol │ └── src │ │ ├── eip2612.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── author-mapping │ ├── AuthorMappingInterface.sol │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── balances-erc20 │ ├── Cargo.toml │ ├── ERC20.sol │ ├── Permit.sol │ └── src │ │ ├── eip2612.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── batch │ ├── Batch.sol │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── call-permit │ ├── CallPermit.sol │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── collective │ ├── Cargo.toml │ ├── Collective.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── conviction-voting │ ├── Cargo.toml │ ├── ConvictionVoting.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── crowdloan-rewards │ ├── Cargo.toml │ ├── CrowdloanInterface.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── gmp │ ├── Cargo.toml │ ├── Gmp.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ └── types.rs ├── identity │ ├── Cargo.toml │ ├── Identity.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── p256verify │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── parachain-staking │ ├── Cargo.toml │ ├── StakingInterface.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── precompile-registry │ ├── Cargo.toml │ ├── PrecompileRegistry.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── preimage │ ├── Cargo.toml │ ├── Preimage.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── proxy │ ├── Cargo.toml │ ├── Proxy.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── randomness │ ├── Cargo.toml │ ├── Randomness.sol │ ├── RandomnessConsumer.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── solidity_types.rs │ │ └── tests.rs ├── referenda │ ├── Cargo.toml │ ├── Referenda.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs ├── relay-data-verifier │ ├── Cargo.toml │ ├── RelayDataVerifier.sol │ ├── proof │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ └── weights.rs ├── relay-encoder │ ├── Cargo.toml │ ├── RelayEncoder.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── test_relay_runtime.rs │ │ └── tests.rs ├── xcm-transactor │ ├── Cargo.toml │ └── src │ │ ├── functions.rs │ │ ├── lib.rs │ │ ├── mock.rs │ │ ├── tests.rs │ │ ├── v1 │ │ ├── XcmTransactorV1.sol │ │ └── mod.rs │ │ ├── v2 │ │ ├── XcmTransactorV2.sol │ │ └── mod.rs │ │ └── v3 │ │ ├── XcmTransactorV3.sol │ │ └── mod.rs ├── xcm-utils │ ├── Cargo.toml │ ├── XcmUtils.sol │ └── src │ │ ├── lib.rs │ │ ├── mock.rs │ │ └── tests.rs └── xtokens │ ├── Cargo.toml │ ├── Xtokens.sol │ └── src │ ├── lib.rs │ ├── mock.rs │ └── tests.rs ├── primitives ├── account │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── bridge │ ├── xcm-bridge-router │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── xcm-bridge │ │ ├── Cargo.toml │ │ └── src │ │ ├── call_info.rs │ │ └── lib.rs ├── ext │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── rpc │ ├── debug │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── evm-tracing-events │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── evm.rs │ │ │ ├── gasometer.rs │ │ │ ├── lib.rs │ │ │ └── runtime.rs │ └── txpool │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── storage-proof │ ├── Cargo.toml │ ├── benchmark_proofs │ ├── proof │ └── src │ │ ├── lib.rs │ │ └── tests.rs └── xcm │ ├── Cargo.toml │ └── src │ ├── asset_id_conversions.rs │ ├── constants.rs │ ├── ethereum_xcm.rs │ ├── filter_asset_max_fee.rs │ ├── get_by_key.rs │ ├── lib.rs │ ├── origin_conversion.rs │ └── transactor_traits.rs ├── runtime-diffs ├── README.md ├── moonbase │ ├── 2800.txt │ ├── 2801.txt │ ├── 2900.txt │ ├── 2901.txt │ ├── 2902.txt │ ├── 3000.txt │ ├── 3102.txt │ ├── 3200.txt │ ├── 3300.txt │ ├── 3400.txt │ ├── 3401.txt │ ├── 3500.txt │ ├── 3501.txt │ ├── 3600.txt │ ├── 3700.txt │ └── runtime-2700.txt ├── moonbeam │ ├── 2800.txt │ ├── 2801.txt │ ├── 2900.txt │ ├── 2901.txt │ ├── 2902.txt │ ├── 3000.txt │ ├── 3102.txt │ ├── 3200.txt │ ├── 3300.txt │ ├── 3400.txt │ ├── 3401.txt │ ├── 3500.txt │ ├── 3501.txt │ ├── 3600.txt │ └── 3700.txt └── moonriver │ ├── 2800.txt │ ├── 2801.txt │ ├── 2900.txt │ ├── 2901.txt │ ├── 2902.txt │ ├── 3000.txt │ ├── 3102.txt │ ├── 3200.txt │ ├── 3300.txt │ ├── 3400.txt │ ├── 3401.txt │ ├── 3500.txt │ ├── 3501.txt │ ├── 3600.txt │ └── 3700.txt ├── runtime ├── common │ ├── Cargo.toml │ └── src │ │ ├── apis.rs │ │ ├── benchmarking.rs │ │ ├── deal_with_fees.rs │ │ ├── impl_asset_conversion.rs │ │ ├── impl_moonbeam_xcm_call.rs │ │ ├── impl_moonbeam_xcm_call_tracing.rs │ │ ├── impl_multiasset_paymaster.rs │ │ ├── impl_on_charge_evm_transaction.rs │ │ ├── impl_self_contained_call.rs │ │ ├── impl_xcm_evm_runner.rs │ │ ├── lib.rs │ │ ├── migrations.rs │ │ ├── timestamp.rs │ │ ├── types.rs │ │ └── xcm_origins.rs ├── evm_tracer │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── moonbase │ ├── Cargo.toml │ ├── build.rs │ ├── src │ │ ├── asset_config.rs │ │ ├── genesis_config_preset.rs │ │ ├── governance │ │ │ ├── councils.rs │ │ │ ├── mod.rs │ │ │ ├── origins.rs │ │ │ ├── referenda.rs │ │ │ └── tracks.rs │ │ ├── lib.rs │ │ ├── migrations.rs │ │ ├── precompiles.rs │ │ ├── runtime_params.rs │ │ ├── weights │ │ │ ├── cumulus_pallet_parachain_system.rs │ │ │ ├── cumulus_pallet_xcmp_queue.rs │ │ │ ├── db │ │ │ │ ├── mod.rs │ │ │ │ └── rocksdb.rs │ │ │ ├── frame_system.rs │ │ │ ├── frame_system_extensions.rs │ │ │ ├── mod.rs │ │ │ ├── pallet_asset_manager.rs │ │ │ ├── pallet_assets.rs │ │ │ ├── pallet_author_inherent.rs │ │ │ ├── pallet_author_mapping.rs │ │ │ ├── pallet_author_slot_filter.rs │ │ │ ├── pallet_balances.rs │ │ │ ├── pallet_collective_open_tech_committee.rs │ │ │ ├── pallet_collective_treasury_council.rs │ │ │ ├── pallet_conviction_voting.rs │ │ │ ├── pallet_crowdloan_rewards.rs │ │ │ ├── pallet_evm.rs │ │ │ ├── pallet_identity.rs │ │ │ ├── pallet_message_queue.rs │ │ │ ├── pallet_moonbeam_foreign_assets.rs │ │ │ ├── pallet_moonbeam_lazy_migrations.rs │ │ │ ├── pallet_moonbeam_orbiters.rs │ │ │ ├── pallet_multiblock_migrations.rs │ │ │ ├── pallet_multisig.rs │ │ │ ├── pallet_parachain_staking.rs │ │ │ ├── pallet_parameters.rs │ │ │ ├── pallet_precompile_benchmarks.rs │ │ │ ├── pallet_preimage.rs │ │ │ ├── pallet_proxy.rs │ │ │ ├── pallet_randomness.rs │ │ │ ├── pallet_referenda.rs │ │ │ ├── pallet_relay_storage_roots.rs │ │ │ ├── pallet_scheduler.rs │ │ │ ├── pallet_sudo.rs │ │ │ ├── pallet_timestamp.rs │ │ │ ├── pallet_transaction_payment.rs │ │ │ ├── pallet_treasury.rs │ │ │ ├── pallet_utility.rs │ │ │ ├── pallet_whitelist.rs │ │ │ ├── pallet_xcm.rs │ │ │ ├── pallet_xcm_transactor.rs │ │ │ └── pallet_xcm_weight_trader.rs │ │ └── xcm_config.rs │ └── tests │ │ ├── common │ │ └── mod.rs │ │ ├── evm_tracing.rs │ │ ├── integration_test.rs │ │ ├── runtime_apis.rs │ │ ├── xcm_mock │ │ ├── mod.rs │ │ ├── parachain.rs │ │ ├── relay_chain.rs │ │ └── statemint_like.rs │ │ └── xcm_tests.rs ├── moonbeam │ ├── Cargo.toml │ ├── build.rs │ ├── src │ │ ├── asset_config.rs │ │ ├── genesis_config_preset.rs │ │ ├── governance │ │ │ ├── councils.rs │ │ │ ├── mod.rs │ │ │ ├── origins.rs │ │ │ ├── referenda.rs │ │ │ └── tracks.rs │ │ ├── lib.rs │ │ ├── migrations.rs │ │ ├── precompiles.rs │ │ ├── runtime_params.rs │ │ ├── weights │ │ │ ├── cumulus_pallet_parachain_system.rs │ │ │ ├── cumulus_pallet_xcmp_queue.rs │ │ │ ├── db │ │ │ │ ├── mod.rs │ │ │ │ └── rocksdb.rs │ │ │ ├── frame_system.rs │ │ │ ├── frame_system_extensions.rs │ │ │ ├── mod.rs │ │ │ ├── pallet_asset_manager.rs │ │ │ ├── pallet_assets.rs │ │ │ ├── pallet_author_inherent.rs │ │ │ ├── pallet_author_mapping.rs │ │ │ ├── pallet_author_slot_filter.rs │ │ │ ├── pallet_balances.rs │ │ │ ├── pallet_collective_open_tech_committee.rs │ │ │ ├── pallet_collective_treasury_council.rs │ │ │ ├── pallet_conviction_voting.rs │ │ │ ├── pallet_crowdloan_rewards.rs │ │ │ ├── pallet_evm.rs │ │ │ ├── pallet_identity.rs │ │ │ ├── pallet_message_queue.rs │ │ │ ├── pallet_moonbeam_foreign_assets.rs │ │ │ ├── pallet_moonbeam_lazy_migrations.rs │ │ │ ├── pallet_moonbeam_orbiters.rs │ │ │ ├── pallet_multiblock_migrations.rs │ │ │ ├── pallet_multisig.rs │ │ │ ├── pallet_parachain_staking.rs │ │ │ ├── pallet_parameters.rs │ │ │ ├── pallet_precompile_benchmarks.rs │ │ │ ├── pallet_preimage.rs │ │ │ ├── pallet_proxy.rs │ │ │ ├── pallet_randomness.rs │ │ │ ├── pallet_referenda.rs │ │ │ ├── pallet_relay_storage_roots.rs │ │ │ ├── pallet_scheduler.rs │ │ │ ├── pallet_timestamp.rs │ │ │ ├── pallet_transaction_payment.rs │ │ │ ├── pallet_treasury.rs │ │ │ ├── pallet_utility.rs │ │ │ ├── pallet_whitelist.rs │ │ │ ├── pallet_xcm.rs │ │ │ ├── pallet_xcm_transactor.rs │ │ │ └── pallet_xcm_weight_trader.rs │ │ └── xcm_config.rs │ └── tests │ │ ├── common │ │ └── mod.rs │ │ ├── evm_tracing.rs │ │ ├── integration_test.rs │ │ ├── runtime_apis.rs │ │ ├── xcm_mock │ │ ├── mod.rs │ │ ├── parachain.rs │ │ ├── relay_chain.rs │ │ └── statemint_like.rs │ │ └── xcm_tests.rs ├── moonriver │ ├── Cargo.toml │ ├── build.rs │ ├── src │ │ ├── asset_config.rs │ │ ├── genesis_config_preset.rs │ │ ├── governance │ │ │ ├── councils.rs │ │ │ ├── mod.rs │ │ │ ├── origins.rs │ │ │ ├── referenda.rs │ │ │ └── tracks.rs │ │ ├── lib.rs │ │ ├── migrations.rs │ │ ├── precompiles.rs │ │ ├── runtime_params.rs │ │ ├── weights │ │ │ ├── cumulus_pallet_parachain_system.rs │ │ │ ├── cumulus_pallet_xcmp_queue.rs │ │ │ ├── db │ │ │ │ ├── mod.rs │ │ │ │ └── rocksdb.rs │ │ │ ├── frame_system.rs │ │ │ ├── frame_system_extensions.rs │ │ │ ├── mod.rs │ │ │ ├── pallet_asset_manager.rs │ │ │ ├── pallet_assets.rs │ │ │ ├── pallet_author_inherent.rs │ │ │ ├── pallet_author_mapping.rs │ │ │ ├── pallet_author_slot_filter.rs │ │ │ ├── pallet_balances.rs │ │ │ ├── pallet_collective_open_tech_committee.rs │ │ │ ├── pallet_collective_treasury_council.rs │ │ │ ├── pallet_conviction_voting.rs │ │ │ ├── pallet_crowdloan_rewards.rs │ │ │ ├── pallet_evm.rs │ │ │ ├── pallet_identity.rs │ │ │ ├── pallet_message_queue.rs │ │ │ ├── pallet_moonbeam_foreign_assets.rs │ │ │ ├── pallet_moonbeam_lazy_migrations.rs │ │ │ ├── pallet_moonbeam_orbiters.rs │ │ │ ├── pallet_multiblock_migrations.rs │ │ │ ├── pallet_multisig.rs │ │ │ ├── pallet_parachain_staking.rs │ │ │ ├── pallet_parameters.rs │ │ │ ├── pallet_precompile_benchmarks.rs │ │ │ ├── pallet_preimage.rs │ │ │ ├── pallet_proxy.rs │ │ │ ├── pallet_randomness.rs │ │ │ ├── pallet_referenda.rs │ │ │ ├── pallet_relay_storage_roots.rs │ │ │ ├── pallet_scheduler.rs │ │ │ ├── pallet_timestamp.rs │ │ │ ├── pallet_transaction_payment.rs │ │ │ ├── pallet_treasury.rs │ │ │ ├── pallet_utility.rs │ │ │ ├── pallet_whitelist.rs │ │ │ ├── pallet_xcm.rs │ │ │ ├── pallet_xcm_transactor.rs │ │ │ └── pallet_xcm_weight_trader.rs │ │ └── xcm_config.rs │ └── tests │ │ ├── common │ │ └── mod.rs │ │ ├── evm_tracing.rs │ │ ├── integration_test.rs │ │ ├── runtime_apis.rs │ │ ├── xcm_mock │ │ ├── mod.rs │ │ ├── parachain.rs │ │ ├── relay_chain.rs │ │ └── statemine_like.rs │ │ └── xcm_tests.rs ├── relay-encoder │ ├── Cargo.toml │ └── src │ │ ├── kusama.rs │ │ ├── lib.rs │ │ ├── polkadot.rs │ │ └── westend.rs └── summarize-precompile-checks │ ├── Cargo.toml │ └── src │ └── main.rs ├── rust-toolchain ├── scripts ├── README.md ├── _init_var.sh ├── benchmarking.sh ├── build-last-tracing-runtime.sh ├── build-runtime-srtool.sh ├── bump-node-version.sh ├── check-cargo-toml-files-format.sh ├── check-forbid-evm-reentrancy.sh ├── create-substrate-fork.sh ├── embed-specs.sh ├── generate-parachain-specs.sh ├── generate-runtimes.sh ├── generate-session-keys.sh ├── register-parachain-local.sh ├── register-parachain.sh ├── run-alphanet-parachain.sh ├── run-benches-for-runtime.sh ├── run-moonbase-dev.sh ├── run-para-test-single.sh ├── run-tracing-tests.sh ├── toml-sort.sh └── verify-licenses.sh ├── specs ├── README.md ├── alphanet │ ├── parachain-embedded-specs-v8.json │ └── westend-embedded-specs-v8.json ├── moonbeam │ └── parachain-embedded-specs.json └── moonriver │ └── parachain-embedded-specs.json ├── test ├── .gitignore ├── .npmrc ├── .nvmrc ├── README.md ├── biome.json ├── configs │ ├── alphanet.yml │ ├── lazyLoadingStateOverrides.json │ ├── localZombie.json │ ├── moonbeam.yml │ ├── moonriver.yml │ ├── zombieAlphanet.json │ ├── zombieAlphanetRpc.json │ ├── zombieMoonbeam.json │ └── zombieMoonbeamRpc.json ├── contracts │ ├── README.md │ └── src │ │ ├── AccessListHelper.sol │ │ ├── BloatedContract.sol │ │ ├── BlockVariables.sol │ │ ├── CallBatchFromConstructor.sol │ │ ├── CallForwarder.sol │ │ ├── CallPermitDemo.sol │ │ ├── Collective.sol │ │ ├── ECContracts.sol │ │ ├── ERC20ExcessGas.sol │ │ ├── ERC20Instance.sol │ │ ├── ERC20WithInitialSupply.sol │ │ ├── EventEmitter.sol │ │ ├── FailingConstructor.sol │ │ ├── Fibonacci.sol │ │ ├── Gmp.sol │ │ ├── HasherChecker.sol │ │ ├── Incrementor.sol │ │ ├── Looper.sol │ │ ├── MultiplyBy7.sol │ │ ├── P256Verify.sol │ │ ├── ProxyCallStakingDemo.sol │ │ ├── ProxyForContractsDemo.sol │ │ ├── ProxyLeaderDemo.sol │ │ ├── RandomnessLotteryDemo.sol │ │ ├── ReferendaAutoUpgradeDemo.sol │ │ ├── ReferendaChecker.sol │ │ ├── RelayEncoderInstance.sol │ │ ├── SelfDestruct.sol │ │ ├── SimpleContractFactory.sol │ │ ├── SmartContractPrecompileCallTest.sol │ │ ├── StakingAttacker.sol │ │ ├── StateOverrideTest.sol │ │ ├── StaticSubcall.sol │ │ ├── Storage.sol │ │ ├── StorageCleaner.sol │ │ ├── StorageLoop.sol │ │ ├── SubCallOOG.sol │ │ ├── SubstrateTools.sol │ │ ├── TraceFilter.sol │ │ ├── XTokensInstance.sol │ │ ├── XcmInterface.sol │ │ ├── dancun │ │ ├── ProxySuicide.sol │ │ └── TransientStorage.sol │ │ └── wormhole │ │ ├── Getters.sol │ │ ├── Governance.sol │ │ ├── GovernanceStructs.sol │ │ ├── Implementation.sol │ │ ├── Messages.sol │ │ ├── Setters.sol │ │ ├── Setup.sol │ │ ├── State.sol │ │ ├── Structs.sol │ │ ├── Wormhole.sol │ │ ├── bridge │ │ ├── Bridge.sol │ │ ├── BridgeGetters.sol │ │ ├── BridgeGovernance.sol │ │ ├── BridgeImplementation.sol │ │ ├── BridgeSetters.sol │ │ ├── BridgeSetup.sol │ │ ├── BridgeState.sol │ │ ├── BridgeStructs.sol │ │ ├── TokenBridge.sol │ │ ├── interfaces │ │ │ └── IWETH.sol │ │ ├── mock │ │ │ └── MockWETH9.sol │ │ └── token │ │ │ ├── Token.sol │ │ │ ├── TokenImplementation.sol │ │ │ └── TokenState.sol │ │ ├── interfaces │ │ └── IWormhole.sol │ │ └── libraries │ │ └── external │ │ └── BytesLib.sol ├── helpers │ ├── accounts.ts │ ├── assets.ts │ ├── balances.ts │ ├── block.ts │ ├── common.ts │ ├── constants.ts │ ├── contracts.ts │ ├── crowdloan.ts │ ├── eth-transactions.ts │ ├── expect.ts │ ├── fees.ts │ ├── foreign-chains.ts │ ├── index.ts │ ├── modexp.ts │ ├── moonbase-tracing-samples.json │ ├── moonbeam-tracing-samples.json │ ├── moonriver-tracing-samples.json │ ├── pallets.ts │ ├── parameters.ts │ ├── precompile-contract-calls.ts │ ├── precompiles.ts │ ├── providers.ts │ ├── randomness.ts │ ├── referenda.ts │ ├── round.ts │ ├── runtimes.ts │ ├── shortfalls.ts │ ├── staking.ts │ ├── storageQueries.ts │ ├── tracer │ │ ├── blockscout_tracer.min.json │ │ └── blockscout_tracer_v2.min.json │ ├── tracing-txns.ts │ ├── tracingFns.ts │ ├── transactions.ts │ ├── voting.ts │ ├── wormhole.ts │ └── xcm.ts ├── moonwall.config.json ├── package.json ├── scripts │ ├── combine-imports.ts │ ├── compile-contracts.ts │ ├── compile-wasm.ts │ ├── download-polkadot.sh │ ├── fast-execute-chopstick-proposal.ts │ ├── get-sample-evm-txs.ts │ ├── modify-plain-specs.ts │ ├── preapprove-rt-rawspec.ts │ ├── prepare-chainspecs-for-zombie.sh │ ├── prepare-lazy-loading-overrides.ts │ ├── print-failed-tests.ts │ └── update-local-types.ts ├── suites │ ├── chopsticks │ │ └── test-upgrade-chain.ts │ ├── dev │ │ ├── common │ │ │ ├── test-block │ │ │ │ ├── test-block-1.ts │ │ │ │ ├── test-block-2.ts │ │ │ │ ├── test-block-gas.ts │ │ │ │ ├── test-block-genesis.ts │ │ │ │ └── test-block-mocked-relay.ts │ │ │ ├── test-contract │ │ │ │ └── test-contract-creation.ts │ │ │ ├── test-precompile │ │ │ │ ├── test-precompile-author-mapping-keys.ts │ │ │ │ ├── test-precompile-author-mapping-keys2.ts │ │ │ │ ├── test-precompile-author-mapping-keys3.ts │ │ │ │ ├── test-precompile-author-mapping-keys4.ts │ │ │ │ ├── test-precompile-author-mapping-keys5.ts │ │ │ │ ├── test-precompile-author-mapping-keys6.ts │ │ │ │ ├── test-precompile-author-mapping-keys7.ts │ │ │ │ ├── test-precompile-author-mapping-keys8.ts │ │ │ │ ├── test-precompile-author-mapping.ts │ │ │ │ ├── test-precompile-author-mapping2.ts │ │ │ │ ├── test-precompile-author-mapping3.ts │ │ │ │ ├── test-precompile-batch.ts │ │ │ │ ├── test-precompile-checks.ts │ │ │ │ ├── test-precompile-proxy-author-mapping.ts │ │ │ │ ├── test-precompile-proxy-non-transfer.ts │ │ │ │ └── test-precompile-proxy.ts │ │ │ ├── test-proxy │ │ │ │ ├── test-proxy-author-mapping.ts │ │ │ │ ├── test-proxy-balance.ts │ │ │ │ ├── test-proxy-for-contracts.ts │ │ │ │ └── test-proxy-governance.ts │ │ │ ├── test-transaction │ │ │ │ └── test-transaction-with-metadata-hash.ts │ │ │ └── test-xcm │ │ │ │ └── test-transactional-outcomes.ts │ │ ├── moonbase │ │ │ ├── archive │ │ │ │ ├── archive-length-fees.ts │ │ │ │ ├── archive-precompile-dispatch.ts │ │ │ │ └── archive-precompile-xcm-utils.ts │ │ │ ├── sample │ │ │ │ └── sample_basic.ts │ │ │ ├── test-assets │ │ │ │ ├── test-assets-drain-both.ts │ │ │ │ ├── test-assets-insufficients.ts │ │ │ │ ├── test-assets-transfer.ts │ │ │ │ ├── test-foreign-assets-balances.ts │ │ │ │ ├── test-foreign-assets-change-xcm-location.ts │ │ │ │ ├── test-foreign-assets-create.ts │ │ │ │ ├── test-foreign-assets-origin.ts │ │ │ │ ├── test-foreign-assets-xcm-1.ts │ │ │ │ ├── test-foreign-assets-xcm-2.ts │ │ │ │ ├── test-foreign-assets-xcm-3.ts │ │ │ │ ├── test-foreign-assets-xcm-change-loc.ts │ │ │ │ ├── test-foreign-assets-xcm-costs.ts │ │ │ │ ├── test-foreign-assets-xcm-create-max.ts │ │ │ │ ├── test-foreign-assets-xcm-create.ts │ │ │ │ └── test-foreign-assets-xcm-freeze.ts │ │ │ ├── test-author │ │ │ │ ├── test-author-double-registration.ts │ │ │ │ ├── test-author-failed-association.ts │ │ │ │ ├── test-author-first-time-keys.ts │ │ │ │ ├── test-author-missing-deposit-fail.ts │ │ │ │ ├── test-author-non-author-clearing.ts │ │ │ │ ├── test-author-non-author-rotate.ts │ │ │ │ ├── test-author-registered-clear.ts │ │ │ │ ├── test-author-registered-rotation.ts │ │ │ │ ├── test-author-removing-author.ts │ │ │ │ ├── test-author-removing-keys.ts │ │ │ │ ├── test-author-same-key-rotation.ts │ │ │ │ ├── test-author-simple-association.ts │ │ │ │ ├── test-author-unregistered-clear.ts │ │ │ │ ├── test-author-unregistered-rotation.ts │ │ │ │ ├── test-author-update-diff-keys.ts │ │ │ │ └── test-author-update-nimbus-key.ts │ │ │ ├── test-balance │ │ │ │ ├── test-balance-existential.ts │ │ │ │ ├── test-balance-extrinsics.ts │ │ │ │ ├── test-balance-genesis.ts │ │ │ │ ├── test-balance-reducible.ts │ │ │ │ ├── test-balance-transfer-txwrapper-substrate.ts │ │ │ │ ├── test-balance-transfer.ts │ │ │ │ └── test-balance-transferable.ts │ │ │ ├── test-chain │ │ │ │ └── test-fork-chain.ts │ │ │ ├── test-contract │ │ │ │ ├── test-contract-delegate-call.ts │ │ │ │ ├── test-contract-error.ts │ │ │ │ ├── test-contract-event.ts │ │ │ │ ├── test-contract-evm-limits.ts │ │ │ │ ├── test-contract-fibonacci.ts │ │ │ │ ├── test-contract-incr-loop.ts │ │ │ │ ├── test-contract-loop-cost.ts │ │ │ │ ├── test-contract-methods.ts │ │ │ │ ├── test-contract-variables.ts │ │ │ │ ├── test-eip-6780.ts │ │ │ │ ├── test-eip1153.ts │ │ │ │ └── test-self-destruct.ts │ │ │ ├── test-conviction-voting │ │ │ │ ├── test-conviction-batch-delegate-undelegate.ts │ │ │ │ ├── test-conviction-delegate-weight-fit.ts │ │ │ │ ├── test-conviction-delegation-batch.ts │ │ │ │ ├── test-conviction-delegation.ts │ │ │ │ ├── test-conviction-undelegate-weight-fit.ts │ │ │ │ ├── test-delegate.ts │ │ │ │ └── test-delegate2.ts │ │ │ ├── test-crowdloan │ │ │ │ ├── test-crowdloan--proxy-transfer.ts │ │ │ │ ├── test-crowdloan-claim-bal.ts │ │ │ │ ├── test-crowdloan-claim.ts │ │ │ │ ├── test-crowdloan-claim5blocks.ts │ │ │ │ ├── test-crowdloan-democracy.ts │ │ │ │ ├── test-crowdloan-dust.ts │ │ │ │ ├── test-crowdloan-identity.ts │ │ │ │ ├── test-crowdloan-init.ts │ │ │ │ ├── test-crowdloan-proxy-claim.ts │ │ │ │ ├── test-crowdloan-register-accs.ts │ │ │ │ ├── test-crowdloan-register-batch.ts │ │ │ │ ├── test-crowdloan-small-amt.ts │ │ │ │ ├── test-crowdloan-update-address-relay.ts │ │ │ │ └── test-crowdloan-update-address.ts │ │ │ ├── test-eth-call │ │ │ │ └── test-eth-call-state-override.ts │ │ │ ├── test-eth-fee │ │ │ │ ├── test-eth-fee-history.ts │ │ │ │ ├── test-eth-paysFee.ts │ │ │ │ └── test-eth-txn-weights.ts │ │ │ ├── test-eth-pool │ │ │ │ ├── test-eth-pool-discard.ts │ │ │ │ ├── test-eth-pool-error.ts │ │ │ │ ├── test-eth-pool-multiple.ts │ │ │ │ ├── test-eth-pool-nonce-future.ts │ │ │ │ └── test-eth-pool-resubmit-txn.ts │ │ │ ├── test-eth-rpc │ │ │ │ ├── test-eth-rpc-constants.ts │ │ │ │ ├── test-eth-rpc-deprecated.ts │ │ │ │ ├── test-eth-rpc-log-filtering.ts │ │ │ │ ├── test-eth-rpc-pending-transactions.ts │ │ │ │ ├── test-eth-rpc-transaction-receipt.ts │ │ │ │ ├── test-eth-rpc-tx-index.ts │ │ │ │ └── test-eth-rpc-version.ts │ │ │ ├── test-eth-tx │ │ │ │ ├── test-eth-tx-access-list.ts │ │ │ │ ├── test-eth-tx-native-transfer.ts │ │ │ │ ├── test-eth-tx-size.ts │ │ │ │ ├── test-eth-tx-types.ts │ │ │ │ └── test-test-tx-nonce.ts │ │ │ ├── test-ethers │ │ │ │ └── test-ethers.ts │ │ │ ├── test-evm │ │ │ │ ├── test-pallet-evm-overflow.ts │ │ │ │ └── test-pallet-evm-transfer.ts │ │ │ ├── test-fees │ │ │ │ ├── test-fee-multiplier-genesis.ts │ │ │ │ ├── test-fee-multiplier-max.ts │ │ │ │ ├── test-fee-multiplier-min.ts │ │ │ │ ├── test-fee-multiplier-xcm.ts │ │ │ │ ├── test-fees-repartition.ts │ │ │ │ ├── test-length-fees.ts │ │ │ │ └── test-length-fees2.ts │ │ │ ├── test-filter │ │ │ │ ├── test-filter-api-creation.ts │ │ │ │ ├── test-filter-api-pending.ts │ │ │ │ └── test-filter-api-polling.ts │ │ │ ├── test-gas │ │ │ │ ├── test-gas-contract-creation.ts │ │ │ │ ├── test-gas-estimation-allcontracts.ts │ │ │ │ ├── test-gas-estimation-contracts.ts │ │ │ │ ├── test-gas-estimation-multiply.ts │ │ │ │ └── test-gas-estimation-subcall-oog.ts │ │ │ ├── test-locks │ │ │ │ └── test-locks-multiple-locks.ts │ │ │ ├── test-maintenance │ │ │ │ ├── test-maintenance-filter.ts │ │ │ │ ├── test-maintenance-filter2.ts │ │ │ │ ├── test-maintenance-filter3.ts │ │ │ │ └── test-maintenance-mode.ts │ │ │ ├── test-moon │ │ │ │ └── test-moon-rpc.ts │ │ │ ├── test-moonbeam-lazy-migrations │ │ │ │ └── test-foreign-assets-migration.ts │ │ │ ├── test-multisigs │ │ │ │ └── test-multisigs.ts │ │ │ ├── test-node-rpc │ │ │ │ └── test-node-rpc-peer.ts │ │ │ ├── test-orbiters │ │ │ │ └── test-orbiters.ts │ │ │ ├── test-parameters │ │ │ │ ├── test-parameters-randomness.ts │ │ │ │ ├── test-parameters-runtime-FeesTreasuryProportion.ts │ │ │ │ └── test-parameters.ts │ │ │ ├── test-polkadot-js │ │ │ │ ├── test-polkadot-api.ts │ │ │ │ └── test-polkadot-chain-info.ts │ │ │ ├── test-pov │ │ │ │ ├── test-evm-over-pov.ts │ │ │ │ ├── test-evm-over-pov2.ts │ │ │ │ ├── test-precompile-over-pov.ts │ │ │ │ ├── test-precompile-over-pov2.ts │ │ │ │ └── test-xcm-to-evm-pov.ts │ │ │ ├── test-precompile │ │ │ │ ├── test-precompile-assets-erc20-local-assets-removal.ts │ │ │ │ ├── test-precompile-assets-erc20-low-level.ts │ │ │ │ ├── test-precompile-assets-erc20.ts │ │ │ │ ├── test-precompile-assets-erc20a.ts │ │ │ │ ├── test-precompile-assets-erc20b.ts │ │ │ │ ├── test-precompile-assets-erc20c.ts │ │ │ │ ├── test-precompile-assets-erc20d.ts │ │ │ │ ├── test-precompile-assets-erc20e.ts │ │ │ │ ├── test-precompile-assets-erc20f.ts │ │ │ │ ├── test-precompile-batch-gas-limit.ts │ │ │ │ ├── test-precompile-blake2.ts │ │ │ │ ├── test-precompile-bn128-bounds.ts │ │ │ │ ├── test-precompile-bn128add.ts │ │ │ │ ├── test-precompile-bn128mul.ts │ │ │ │ ├── test-precompile-bn128pairing.ts │ │ │ │ ├── test-precompile-call-permit-demo.ts │ │ │ │ ├── test-precompile-conviction-voting.ts │ │ │ │ ├── test-precompile-conviction-voting2.ts │ │ │ │ ├── test-precompile-conviction-voting3.ts │ │ │ │ ├── test-precompile-conviction-voting4.ts │ │ │ │ ├── test-precompile-conviction-voting5.ts │ │ │ │ ├── test-precompile-conviction-voting6.ts │ │ │ │ ├── test-precompile-democracy.ts │ │ │ │ ├── test-precompile-dummy-bytecode.ts │ │ │ │ ├── test-precompile-ecpairing.ts │ │ │ │ ├── test-precompile-ecrecover.ts │ │ │ │ ├── test-precompile-erc20-overflow.ts │ │ │ │ ├── test-precompile-erc20.ts │ │ │ │ ├── test-precompile-identity.ts │ │ │ │ ├── test-precompile-identity10.ts │ │ │ │ ├── test-precompile-identity11.ts │ │ │ │ ├── test-precompile-identity12.ts │ │ │ │ ├── test-precompile-identity13.ts │ │ │ │ ├── test-precompile-identity14.ts │ │ │ │ ├── test-precompile-identity2.ts │ │ │ │ ├── test-precompile-identity3.ts │ │ │ │ ├── test-precompile-identity4.ts │ │ │ │ ├── test-precompile-identity5.ts │ │ │ │ ├── test-precompile-identity6.ts │ │ │ │ ├── test-precompile-identity7.ts │ │ │ │ ├── test-precompile-identity8.ts │ │ │ │ ├── test-precompile-identity9.ts │ │ │ │ ├── test-precompile-modexp.ts │ │ │ │ ├── test-precompile-p256verify.ts │ │ │ │ ├── test-precompile-pallet-xcm-2.ts │ │ │ │ ├── test-precompile-pallet-xcm-with-asset-manager.ts │ │ │ │ ├── test-precompile-pallet-xcm.ts │ │ │ │ ├── test-precompile-preimage.ts │ │ │ │ ├── test-precompile-proxy-leader-demo.ts │ │ │ │ ├── test-precompile-proxy-leader-demo2.ts │ │ │ │ ├── test-precompile-proxy-leader-demo3.ts │ │ │ │ ├── test-precompile-proxy-staking-demo.ts │ │ │ │ ├── test-precompile-proxy-staking-demo2.ts │ │ │ │ ├── test-precompile-proxy-staking-demo3.ts │ │ │ │ ├── test-precompile-proxy-staking-demo4.ts │ │ │ │ ├── test-precompile-referenda-demo.ts │ │ │ │ ├── test-precompile-referenda.ts │ │ │ │ ├── test-precompile-relay-encoder.ts │ │ │ │ ├── test-precompile-relay-verifier.ts │ │ │ │ ├── test-precompile-revert-attack.ts │ │ │ │ ├── test-precompile-ripemd160.ts │ │ │ │ ├── test-precompile-sha3fips.ts │ │ │ │ ├── test-precompile-smart-contract-call.ts │ │ │ │ ├── test-precompile-smart-contract-call2.ts │ │ │ │ ├── test-precompile-smart-contract-call3.ts │ │ │ │ ├── test-precompile-smart-contract-call4.ts │ │ │ │ ├── test-precompile-smart-contract-call5.ts │ │ │ │ ├── test-precompile-staking.ts │ │ │ │ ├── test-precompile-staking2.ts │ │ │ │ ├── test-precompile-staking3.ts │ │ │ │ ├── test-precompile-staking4.ts │ │ │ │ ├── test-precompile-staking5.ts │ │ │ │ ├── test-precompile-staking6.ts │ │ │ │ ├── test-precompile-wormhole.ts │ │ │ │ ├── test-precompile-wormhole2.ts │ │ │ │ ├── test-precompile-xcm-transactor.ts │ │ │ │ ├── test-precompile-xcm-transactor10.ts │ │ │ │ ├── test-precompile-xcm-transactor11.ts │ │ │ │ ├── test-precompile-xcm-transactor12.ts │ │ │ │ ├── test-precompile-xcm-transactor2.ts │ │ │ │ ├── test-precompile-xcm-transactor3.ts │ │ │ │ ├── test-precompile-xcm-transactor4.ts │ │ │ │ ├── test-precompile-xcm-transactor5.ts │ │ │ │ ├── test-precompile-xcm-transactor6.ts │ │ │ │ ├── test-precompile-xcm-transactor7.ts │ │ │ │ ├── test-precompile-xcm-transactor8.ts │ │ │ │ ├── test-precompile-xcm-transactor9.ts │ │ │ │ ├── test-precompile-xcm-utils.ts │ │ │ │ └── test-precompile-xtokens.ts │ │ │ ├── test-preimage │ │ │ │ └── test-preimage.ts │ │ │ ├── test-proxy │ │ │ │ ├── test-proxy-identity.ts │ │ │ │ └── test-proxy.ts │ │ │ ├── test-randomness │ │ │ │ ├── test-randomness-babe-lottery.ts │ │ │ │ ├── test-randomness-babe-lottery2.ts │ │ │ │ ├── test-randomness-babe-lottery3.ts │ │ │ │ ├── test-randomness-babe-request.ts │ │ │ │ ├── test-randomness-babe-request2.ts │ │ │ │ ├── test-randomness-babe-request3.ts │ │ │ │ ├── test-randomness-result.ts │ │ │ │ ├── test-randomness-result2.ts │ │ │ │ ├── test-randomness-result3.ts │ │ │ │ ├── test-randomness-result4.ts │ │ │ │ ├── test-randomness-vrf-lottery.ts │ │ │ │ ├── test-randomness-vrf-lottery2.ts │ │ │ │ ├── test-randomness-vrf-lottery3.ts │ │ │ │ ├── test-randomness-vrf-lottery4.ts │ │ │ │ ├── test-randomness-vrf-lottery5.ts │ │ │ │ ├── test-randomness-vrf-lottery6.ts │ │ │ │ ├── test-randomness-vrf-request.ts │ │ │ │ ├── test-randomness-vrf-request2.ts │ │ │ │ ├── test-randomness-vrf-request3.ts │ │ │ │ ├── test-randomness-vrf-request4.ts │ │ │ │ ├── test-randomness-vrf-request5.ts │ │ │ │ └── test-randomness-vrf-request6.ts │ │ │ ├── test-receipt │ │ │ │ ├── test-receipt-revert.ts │ │ │ │ ├── test-receipt-root.ts │ │ │ │ └── test-receipt.ts │ │ │ ├── test-referenda │ │ │ │ ├── test-referenda-fast-general-admin.ts │ │ │ │ ├── test-referenda-general-admin.ts │ │ │ │ └── test-referenda-submit.ts │ │ │ ├── test-staking │ │ │ │ ├── test-candidate-force-join.ts │ │ │ │ ├── test-candidate-join.ts │ │ │ │ ├── test-candidate-join2.ts │ │ │ │ ├── test-candidate-join3.ts │ │ │ │ ├── test-candidate-leave.ts │ │ │ │ ├── test-candidate-leave2.ts │ │ │ │ ├── test-candidate-leave3.ts │ │ │ │ ├── test-candidate-leave4.ts │ │ │ │ ├── test-candidate-leave5.ts │ │ │ │ ├── test-candidate-leave6.ts │ │ │ │ ├── test-candidate-leave7.ts │ │ │ │ ├── test-candidate-leave8.ts │ │ │ │ ├── test-delegate-with-auto-compound.ts │ │ │ │ ├── test-delegate-with-auto-compound2.ts │ │ │ │ ├── test-delegate-with-auto-compound3.ts │ │ │ │ ├── test-delegate-with-auto-compound4.ts │ │ │ │ ├── test-delegate-with-auto-compound5.ts │ │ │ │ ├── test-delegate-with-auto-compound6.ts │ │ │ │ ├── test-delegate-with-auto-compound7.ts │ │ │ │ ├── test-delegation-scheduled-requests.ts │ │ │ │ ├── test-delegation-scheduled-requests10-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests10.ts │ │ │ │ ├── test-delegation-scheduled-requests11-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests11.ts │ │ │ │ ├── test-delegation-scheduled-requests12-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests12.ts │ │ │ │ ├── test-delegation-scheduled-requests2.ts │ │ │ │ ├── test-delegation-scheduled-requests3.ts │ │ │ │ ├── test-delegation-scheduled-requests4-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests4.ts │ │ │ │ ├── test-delegation-scheduled-requests5-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests5.ts │ │ │ │ ├── test-delegation-scheduled-requests6-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests6.ts │ │ │ │ ├── test-delegation-scheduled-requests7-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests7.ts │ │ │ │ ├── test-delegation-scheduled-requests8-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests8.ts │ │ │ │ ├── test-delegation-scheduled-requests9-bondless-collator.ts │ │ │ │ ├── test-delegation-scheduled-requests9.ts │ │ │ │ ├── test-delegator-bond-more.ts │ │ │ │ ├── test-delegator-bond-more2.ts │ │ │ │ ├── test-delegator-bond-more3.ts │ │ │ │ ├── test-delegator-join.ts │ │ │ │ ├── test-delegator-join2.ts │ │ │ │ ├── test-delegator-join3.ts │ │ │ │ ├── test-delegator-join4.ts │ │ │ │ ├── test-delegator-join5.ts │ │ │ │ ├── test-genesis.ts │ │ │ │ ├── test-parachain-bond.ts │ │ │ │ ├── test-rewards-auto-compound-pov.ts │ │ │ │ ├── test-rewards-auto-compound.ts │ │ │ │ ├── test-rewards-auto-compound10.ts │ │ │ │ ├── test-rewards-auto-compound2.ts │ │ │ │ ├── test-rewards-auto-compound3.ts │ │ │ │ ├── test-rewards-auto-compound4.ts │ │ │ │ ├── test-rewards-auto-compound5.ts │ │ │ │ ├── test-rewards-auto-compound6.ts │ │ │ │ ├── test-rewards-auto-compound7.ts │ │ │ │ ├── test-rewards-auto-compound8.ts │ │ │ │ ├── test-rewards-auto-compound9.ts │ │ │ │ ├── test-rewards.ts │ │ │ │ ├── test-rewards2.ts │ │ │ │ ├── test-rewards3.ts │ │ │ │ ├── test-rewards4.ts │ │ │ │ ├── test-rewards5.ts │ │ │ │ ├── test-set-auto-compound.ts │ │ │ │ ├── test-set-auto-compound2.ts │ │ │ │ ├── test-set-auto-compound3.ts │ │ │ │ ├── test-set-auto-compound4.ts │ │ │ │ ├── test-set-auto-compound5.ts │ │ │ │ ├── test-set-auto-compound6.ts │ │ │ │ ├── test-staking-consts.ts │ │ │ │ ├── test-staking-locks.ts │ │ │ │ ├── test-staking-locks10.ts │ │ │ │ ├── test-staking-locks11.ts │ │ │ │ ├── test-staking-locks12.ts │ │ │ │ ├── test-staking-locks2.ts │ │ │ │ ├── test-staking-locks3.ts │ │ │ │ ├── test-staking-locks4.ts │ │ │ │ ├── test-staking-locks6.ts │ │ │ │ ├── test-staking-locks7.ts │ │ │ │ ├── test-staking-locks8.ts │ │ │ │ ├── test-staking-locks9.ts │ │ │ │ ├── test-weights.ts │ │ │ │ ├── test-weights2.ts │ │ │ │ ├── test-weights3.ts │ │ │ │ ├── test-weights4.ts │ │ │ │ └── test-weights5.ts │ │ │ ├── test-storage-growth │ │ │ │ ├── test-block-storage-growth.ts │ │ │ │ ├── test-evm-create-storage-growth.ts │ │ │ │ ├── test-evm-store-storage-growth.ts │ │ │ │ └── test-precompile-storage-growth.ts │ │ │ ├── test-subscription │ │ │ │ ├── test-subscription-logs.ts │ │ │ │ ├── test-subscription-logs2.ts │ │ │ │ ├── test-subscription-past-events.ts │ │ │ │ ├── test-subscription-pending.ts │ │ │ │ └── test-subscription.ts │ │ │ ├── test-sudo │ │ │ │ └── test-sudo.ts │ │ │ ├── test-treasury │ │ │ │ ├── test-treasury-council-origin.ts │ │ │ │ ├── test-treasury-other-assets.ts │ │ │ │ └── test-treasury-root-origin.ts │ │ │ ├── test-txpool │ │ │ │ ├── test-txpool-fairness.ts │ │ │ │ ├── test-txpool-future.ts │ │ │ │ ├── test-txpool-limits.ts │ │ │ │ ├── test-txpool-limits2.ts │ │ │ │ ├── test-txpool-limits3.ts │ │ │ │ ├── test-txpool-limits4.ts │ │ │ │ ├── test-txpool-pending.ts │ │ │ │ ├── test-txpool-pending2.ts │ │ │ │ ├── test-txpool-reset.ts │ │ │ │ └── test-txpool-reset2.ts │ │ │ ├── test-xcm-v3 │ │ │ │ ├── test-mock-dmp-asset-transfer.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-1.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-2.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-3.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-4.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-5.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-6.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-1.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-2.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-3.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-4.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-5.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-6.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-8.ts │ │ │ │ ├── test-mock-hrmp-transact-1.ts │ │ │ │ ├── test-mock-hrmp-transact-2.ts │ │ │ │ ├── test-mock-hrmp-transact-3.ts │ │ │ │ ├── test-mock-hrmp-transact-4.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-1.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-10.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-11.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-12.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-2.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-3.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-4.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-5.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-6.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-7.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-8.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-9.ts │ │ │ │ ├── test-xcm-erc20-data-field-size.ts │ │ │ │ ├── test-xcm-erc20-excess-gas.ts │ │ │ │ ├── test-xcm-erc20-fees-and-trap.ts │ │ │ │ ├── test-xcm-erc20-v3-filter.ts │ │ │ │ ├── test-xcm-erc20-v3.ts │ │ │ │ ├── test-xcm-transactor-1.ts │ │ │ │ ├── test-xcm-transactor-2.ts │ │ │ │ ├── test-xcmv3-max-weight-instructions.ts │ │ │ │ └── test-xcmv3-new-instructions.ts │ │ │ └── test-xcm-v4 │ │ │ │ ├── test-auto-pause-xcm.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-1.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-2.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-3.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-4.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-5.ts │ │ │ │ ├── test-mock-dmp-error-and-appendix-6.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-1.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-2.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-3.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-4.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-5.ts │ │ │ │ ├── test-mock-hrmp-asset-transfer-6.ts │ │ │ │ ├── test-mock-hrmp-transact-1.ts │ │ │ │ ├── test-mock-hrmp-transact-2.ts │ │ │ │ ├── test-mock-hrmp-transact-3.ts │ │ │ │ ├── test-mock-hrmp-transact-4.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-1.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-10.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-2.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-4.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-5.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-6.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-7.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-8.ts │ │ │ │ ├── test-mock-hrmp-transact-ethereum-9.ts │ │ │ │ ├── test-xcm-dry-run-api.ts │ │ │ │ ├── test-xcm-erc20-transfer-two-ERC20.ts │ │ │ │ ├── test-xcm-erc20-transfer.ts │ │ │ │ ├── test-xcm-evm-fee-with-origin-token.ts │ │ │ │ ├── test-xcm-evm-with-dot.ts │ │ │ │ ├── test-xcm-location-to-account-api.ts │ │ │ │ ├── test-xcm-payment-api-transact-foreign.ts │ │ │ │ ├── test-xcm-payment-api-transact-native.ts │ │ │ │ ├── test-xcm-payment-api.ts │ │ │ │ ├── test-xcm-ver-conversion-1.ts │ │ │ │ └── test-xcm-ver-conversion-2.ts │ │ └── moonbeam │ │ │ └── test-precompile │ │ │ └── test-precompile-assets-erc20-local-assets-removal.ts │ ├── lazy-loading │ │ └── test-runtime-upgrade.ts │ ├── smoke │ │ ├── test-author-filter-consistency.ts │ │ ├── test-author-mapping-consistency.ts │ │ ├── test-balances-consistency.ts │ │ ├── test-block-finalized.ts │ │ ├── test-block-weights.ts │ │ ├── test-dynamic-fees.ts │ │ ├── test-eth-parent-hash-bad-block-fix.ts │ │ ├── test-ethereum-contract-code.ts │ │ ├── test-ethereum-current-consistency.ts │ │ ├── test-ethereum-db-mapping.ts │ │ ├── test-ethereum-failures.ts │ │ ├── test-foreign-asset-consistency.ts │ │ ├── test-foreign-xcm-failures.ts │ │ ├── test-historic-compatibility.ts │ │ ├── test-old-regressions.ts │ │ ├── test-orbiter-consistency.ts │ │ ├── test-polkadot-decoding.ts │ │ ├── test-proxy-consistency.ts │ │ ├── test-randomness-consistency.ts │ │ ├── test-relay-indices.ts │ │ ├── test-relay-xcm-fees.ts │ │ ├── test-staking-consistency.ts │ │ ├── test-staking-rewards.ts │ │ ├── test-staking-round-cleanup.ts │ │ ├── test-treasury-consistency.ts │ │ ├── test-xcm-autopause.ts │ │ └── test-xcm-failures.ts │ ├── tracing-tests │ │ ├── test-get-logs-limit.ts │ │ ├── test-trace-1.ts │ │ ├── test-trace-2.ts │ │ ├── test-trace-3.ts │ │ ├── test-trace-4.ts │ │ ├── test-trace-5.ts │ │ ├── test-trace-6.ts │ │ ├── test-trace-7.ts │ │ ├── test-trace-call.ts │ │ ├── test-trace-concurrency.ts │ │ ├── test-trace-erc20-xcm-2.ts │ │ ├── test-trace-erc20-xcm.ts │ │ ├── test-trace-ethereum-xcm-1.ts │ │ ├── test-trace-ethereum-xcm-2.ts │ │ ├── test-trace-ethereum-xcm-3.ts │ │ ├── test-trace-evm-foreign-asset-registration.ts │ │ ├── test-trace-filter-reorg.ts │ │ ├── test-trace-filter-weight-limits.ts │ │ ├── test-trace-filter.ts │ │ └── test-trace-gas.ts │ └── zombie │ │ └── test_para.ts └── tsconfig.json ├── toml-sort.toml ├── tools ├── README.md ├── block-tracker.ts ├── bots │ └── mission-control-bot │ │ ├── actions.ts │ │ ├── constants.ts │ │ ├── main.ts │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── types.ts │ │ └── utils.ts ├── extract-migration-logs.ts ├── generate-rpc-types.ts ├── gerald.ts ├── get-binary.ts ├── get-block.ts ├── github │ ├── generate-release-body.ts │ ├── generate-runtimes-body.ts │ ├── github-utils.ts │ ├── list-pr-labels.ts │ ├── print-client-release-issue.ts │ ├── print-runtime-release-issue.ts │ └── print-version-bump-info.ts ├── init-web3.ts ├── load-testing │ └── load-gas-loop.ts ├── moon-key.ts ├── package-lock.json ├── package.json ├── pov │ ├── README.md │ └── index.ts ├── test-constants.ts ├── test-scripts │ ├── create-erc20-contract.ts │ ├── test-alpha.ts │ ├── test-staking.ts │ └── test-wrong-contract-address.ts └── tsconfig.json ├── types-bundle ├── .gitignore ├── README.md ├── package.json ├── src │ ├── definitions.ts │ ├── rpc.ts │ └── types.ts └── tsconfig.json └── typescript-api ├── .gitignore ├── .npmignore ├── README.md ├── biome.json ├── package.json ├── scripts ├── runtime-upgrade.ts └── scrapeMetadata.ts ├── src ├── moonbase │ ├── index.ts │ ├── interfaces │ │ ├── augment-api-consts.ts │ │ ├── augment-api-errors.ts │ │ ├── augment-api-events.ts │ │ ├── augment-api-query.ts │ │ ├── augment-api-rpc.ts │ │ ├── augment-api-runtime.ts │ │ ├── augment-api-tx.ts │ │ ├── augment-api.ts │ │ ├── augment-types.ts │ │ ├── definitions.ts │ │ ├── index.ts │ │ ├── lookup.ts │ │ ├── moon │ │ │ ├── definitions.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── registry.ts │ │ ├── types-lookup.ts │ │ └── types.ts │ └── tsconfig.json ├── moonbeam │ ├── index.ts │ ├── interfaces │ │ ├── augment-api-consts.ts │ │ ├── augment-api-errors.ts │ │ ├── augment-api-events.ts │ │ ├── augment-api-query.ts │ │ ├── augment-api-rpc.ts │ │ ├── augment-api-runtime.ts │ │ ├── augment-api-tx.ts │ │ ├── augment-api.ts │ │ ├── augment-types.ts │ │ ├── definitions.ts │ │ ├── index.ts │ │ ├── lookup.ts │ │ ├── moon │ │ │ ├── definitions.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── registry.ts │ │ ├── types-lookup.ts │ │ └── types.ts │ └── tsconfig.json └── moonriver │ ├── index.ts │ ├── interfaces │ ├── augment-api-consts.ts │ ├── augment-api-errors.ts │ ├── augment-api-events.ts │ ├── augment-api-query.ts │ ├── augment-api-rpc.ts │ ├── augment-api-runtime.ts │ ├── augment-api-tx.ts │ ├── augment-api.ts │ ├── augment-types.ts │ ├── definitions.ts │ ├── index.ts │ ├── lookup.ts │ ├── moon │ │ ├── definitions.ts │ │ ├── index.ts │ │ └── types.ts │ ├── registry.ts │ ├── types-lookup.ts │ └── types.ts │ └── tsconfig.json ├── tsconfig.base.json └── tsup.config.ts /.dockerignore: -------------------------------------------------------------------------------- 1 | **/target/ 2 | **/node_modules/ 3 | Dockerfile 4 | -------------------------------------------------------------------------------- /.ecrc: -------------------------------------------------------------------------------- 1 | { 2 | "SpacesAftertabs": true 3 | } 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | 4 | 5 | [*.rs] 6 | indent_style=tab 7 | indent_size=tab 8 | max_line_length=100 9 | 10 | [*.ts] 11 | indent_style=space 12 | indent_size=2 13 | max_line_length=100 14 | 15 | [*.js] 16 | indent_style=space 17 | indent_size=2 18 | max_line_length=100 19 | 20 | [*.sh] 21 | indent_style=space 22 | indent_size=2 23 | 24 | [*.json] 25 | indent_style=space 26 | indent_size=2 27 | 28 | [*.md] 29 | trim_trailing_whitespace=false 30 | 31 | [*.expanded.rs] 32 | indent_style=off 33 | indent_size=off 34 | max_line_length=off 35 | 36 | [weights.rs] 37 | indent_style=off 38 | indent_size=off 39 | max_line_length=off 40 | 41 | [**/weights/*.rs] 42 | indent_style=off 43 | indent_size=off 44 | max_line_length=off -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | /.github/ @moonbeam-foundation/moonsong-perm @moonbeam-foundation/opslayer-devops 2 | /tools/github/ @moonbeam-foundation/moonsong-perm @moonbeam-foundation/opslayer-devops 3 | /docker/ @moonbeam-foundation/moonsong-perm @moonbeam-foundation/opslayer-devops 4 | /scripts/ @moonbeam-foundation/moonsong-perm @moonbeam-foundation/opslayer-devops 5 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### What does it do? 2 | 3 | ### What important points should reviewers know? 4 | 5 | ### Is there something left for follow-up PRs? 6 | 7 | ### What alternative implementations were considered? 8 | 9 | ### Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)? 10 | 11 | ### What value does it bring to the blockchain users? 12 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Enable version updates for github-actions 4 | - package-ecosystem: "github-actions" 5 | # Look for a `Dockerfile` in the `root` directory 6 | directory: "/" 7 | # Check for updates once a month 8 | schedule: 9 | interval: "monthly" 10 | labels: 11 | - "ci" 12 | - "B0-silent" 13 | - "D2-notlive" 14 | -------------------------------------------------------------------------------- /.github/workflows/check-licenses.yml: -------------------------------------------------------------------------------- 1 | name: Check licenses 2 | 3 | on: 4 | pull_request: 5 | workflow_dispatch: 6 | 7 | jobs: 8 | verify: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: read 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Install Rust toolchain 15 | uses: actions-rs/toolchain@v1 16 | with: 17 | toolchain: 1.78.0 18 | override: true 19 | - name: Verify Licenses 20 | run: | 21 | cargo install cargo-license 22 | ./scripts/verify-licenses.sh 23 | -------------------------------------------------------------------------------- /.github/workflows/version-bump.yml: -------------------------------------------------------------------------------- 1 | name: Create version bump ticket 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | from: 6 | description: "Polkadot version to bump from (ex: v1.3.0)" 7 | required: true 8 | to: 9 | description: "Polkadot version to bump to (ex: v1.7.2)" 10 | required: true 11 | 12 | jobs: 13 | create_bump_ticket: 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: read 17 | issues: write 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v4 21 | - name: Use Node.js 22 | uses: actions/setup-node@v4 23 | with: 24 | node-version-file: "test/.nvmrc" 25 | - name: Generate version bump issue 26 | env: 27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 | run: | 29 | cd tools 30 | yarn install 31 | yarn --silent run print-version-bump-info -- --from ${{ github.event.inputs.from }} --to ${{ github.event.inputs.to }} | tee ../version-bump.md 32 | - name: Create version bump issue 33 | uses: peter-evans/create-issue-from-file@v5 34 | with: 35 | title: Update polkadot-sdk from ${{ github.event.inputs.from }} to ${{ github.event.inputs.to }} 36 | content-filepath: ./version-bump.md 37 | labels: | 38 | automated issue 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # MacOS thing 2 | **/.DS_Store 3 | 4 | # Rust directories 5 | **/target 6 | **/scripts/tmp 7 | 8 | # Typescript directories 9 | **/node_modules 10 | **/.yarn 11 | **/dist 12 | 13 | # Spec/Wasm build directory 14 | /build/ 15 | 16 | # Moonbeam-Launch 17 | *.log 18 | tools/specFiles 19 | tools/*-local.json 20 | tools/*-local-raw.json 21 | tools/build 22 | 23 | # IDEs 24 | .idea/ 25 | .vscode/ -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # MacOS thing 2 | **/.DS_Store 3 | 4 | # Rust directories 5 | **/target 6 | **/scripts/tmp 7 | 8 | # Typescript directories 9 | **/node_modules 10 | **/.yarn 11 | test/tsconfig.json 12 | 13 | # Spec/Wasm build directory 14 | /build/ 15 | 16 | # Moonbeam-Launch 17 | *.log 18 | tools/specFiles 19 | tools/*-local.json 20 | tools/*-local-raw.json 21 | tools/build 22 | 23 | # Json minified files 24 | tests/util/tracer/blockscout_tracer* 25 | 26 | # Dist folders should not be formatted 27 | */dist/ 28 | 29 | # Typescript-api is autogenerated 30 | /typescript-api/ 31 | 32 | # Temporary Moonwall files 33 | **/contracts/out 34 | **/tmp/ 35 | **/html/ -------------------------------------------------------------------------------- /.rustfmt.toml: -------------------------------------------------------------------------------- 1 | # These formatting rules to try conform the Substrate style guidelines: 2 | # > https://wiki.parity.io/Substrate-Style-Guide 3 | 4 | reorder_imports = true 5 | hard_tabs = true 6 | max_width = 100 7 | 8 | # TODO: add template for license checking. 9 | # this will still fail for some licenses where e.g. Parity's license is used 10 | # license_template_path = "FILE_TEMPLATE" 11 | -------------------------------------------------------------------------------- /MBIPS/template.md: -------------------------------------------------------------------------------- 1 | --- 2 | mbip: 0 3 | title: title 4 | author(s): 5 | status: Draft 6 | created: 2023-05-11 7 | --- 8 | 9 | ## Abstract 10 | 11 | 12 | 13 | ## Motivation 14 | 15 | 16 | 17 | ## Goals 18 | 19 | 20 | 21 | ## Specification 22 | 23 | 24 | 25 | ## Impact 26 | 27 | 28 | 29 | ## Security Considerations 30 | 31 | 32 | -------------------------------------------------------------------------------- /bin/utils/moonkey/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonkey" 3 | authors = { workspace = true } 4 | description = "Moonbeam Key Tool" 5 | edition = "2021" 6 | homepage = "https://moonbeam.network" 7 | license = "GPL-3.0-only" 8 | repository = { workspace = true } 9 | version = "0.1.1" 10 | 11 | [[bin]] 12 | name = "moonkey" 13 | path = "src/main.rs" 14 | 15 | [dependencies] 16 | clap = { workspace = true } 17 | moonbeam-cli-opt = { workspace = true } 18 | -------------------------------------------------------------------------------- /bin/utils/moonkey/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! Generate an Ethereum account. 18 | 19 | use clap::Parser; 20 | use moonbeam_cli_opt::account_key::GenerateAccountKey; 21 | 22 | #[derive(Debug, Parser)] 23 | #[clap(author = "PureStake")] 24 | struct Opt { 25 | #[clap(flatten)] 26 | cmd: GenerateAccountKey, 27 | } 28 | 29 | impl Opt { 30 | fn run(&self) { 31 | self.cmd.run() 32 | } 33 | } 34 | 35 | fn main() { 36 | // Parses the options 37 | let cmd = Opt::parse(); 38 | cmd.run(); 39 | } 40 | -------------------------------------------------------------------------------- /bug-bounty.md: -------------------------------------------------------------------------------- 1 | # Bug Bounty 2 | 3 | The Moonbeam bug bounty program is focused on the Moonriver and Moonbeam Parachains (deployed to Kusama and Polkadot respectively) and dapps. We only accept bug bounty reports via the Immunefi program at [https://immunefi.com/bounty/moonbeamnetwork/](https://github.com/moonbeam-foundation/moonbeam.git) 4 | 5 | 6 | -------------------------------------------------------------------------------- /client/evm-tracing/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-client-evm-tracing" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | ethereum-types = { workspace = true, features = [ "std" ] } 12 | hex = { workspace = true, features = [ "serde" ] } 13 | serde = { workspace = true, features = [ "derive", "std" ] } 14 | serde_json = { workspace = true, default-features = true } 15 | log = { workspace = true } 16 | 17 | # Moonbeam 18 | evm-tracing-events = { workspace = true, features = [ "std" ] } 19 | moonbeam-rpc-primitives-debug = { workspace = true, features = [ "std" ] } 20 | 21 | # Substrate 22 | parity-scale-codec = { workspace = true, features = [ "std" ] } 23 | sp-std = { workspace = true, features = [ "std" ] } 24 | sp-runtime = { workspace = true, features = [ "std" ] } -------------------------------------------------------------------------------- /client/evm-tracing/src/formatters/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | pub mod blockscout; 18 | pub mod call_tracer; 19 | pub mod raw; 20 | pub mod trace_filter; 21 | 22 | pub use blockscout::Formatter as Blockscout; 23 | pub use call_tracer::Formatter as CallTracer; 24 | pub use raw::Formatter as Raw; 25 | pub use trace_filter::Formatter as TraceFilter; 26 | 27 | use evm_tracing_events::Listener; 28 | use serde::Serialize; 29 | 30 | pub trait ResponseFormatter { 31 | type Listener: Listener; 32 | type Response: Serialize; 33 | 34 | fn format(listener: Self::Listener) -> Option; 35 | } 36 | -------------------------------------------------------------------------------- /client/evm-tracing/src/formatters/raw.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use crate::listeners::raw::Listener; 18 | use crate::types::single::TransactionTrace; 19 | 20 | pub struct Formatter; 21 | 22 | impl super::ResponseFormatter for Formatter { 23 | type Listener = Listener; 24 | type Response = TransactionTrace; 25 | 26 | fn format(listener: Listener) -> Option { 27 | if listener.remaining_memory_usage.is_none() { 28 | None 29 | } else { 30 | Some(TransactionTrace::Raw { 31 | struct_logs: listener.struct_logs, 32 | gas: listener.final_gas.into(), 33 | return_value: listener.return_value, 34 | }) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /client/evm-tracing/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! This crate contains the client-side part that interacts with our "v2" tracing design. 18 | 19 | pub mod formatters; 20 | pub mod listeners; 21 | pub mod types; 22 | -------------------------------------------------------------------------------- /client/evm-tracing/src/listeners/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | pub mod call_list; 18 | pub mod raw; 19 | 20 | pub use call_list::Listener as CallList; 21 | pub use raw::Listener as Raw; 22 | -------------------------------------------------------------------------------- /client/rpc-core/debug/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-rpc-core-debug" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | ethereum = { workspace = true, features = [ "with-scale" ] } 12 | ethereum-types = { workspace = true, features = [ "std" ] } 13 | futures = { workspace = true, features = [ "compat" ] } 14 | jsonrpsee = { workspace = true, features = [ "macros", "server" ] } 15 | moonbeam-client-evm-tracing = { workspace = true } 16 | moonbeam-rpc-core-types = { workspace = true } 17 | serde = { workspace = true, features = [ "derive" ] } 18 | serde_json = { workspace = true, default-features = true } 19 | 20 | sp-core = { workspace = true, features = [ "std" ] } 21 | fc-rpc-core = { workspace = true } 22 | -------------------------------------------------------------------------------- /client/rpc-core/trace/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-rpc-core-trace" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.6.0" 9 | 10 | [dependencies] 11 | ethereum-types = { workspace = true, features = [ "std" ] } 12 | futures = { workspace = true, features = [ "compat" ] } 13 | jsonrpsee = { workspace = true, features = [ "macros", "server" ] } 14 | moonbeam-client-evm-tracing = { workspace = true } 15 | moonbeam-rpc-core-types = { workspace = true } 16 | serde = { workspace = true, features = [ "derive" ] } 17 | serde_json = { workspace = true, default-features = true } 18 | -------------------------------------------------------------------------------- /client/rpc-core/types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-rpc-core-types" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | ethereum-types = { workspace = true, features = [ "std" ] } 12 | serde = { workspace = true, features = [ "derive" ] } 13 | serde_json = { workspace = true, default-features = true } 14 | -------------------------------------------------------------------------------- /client/rpc/dev/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-dev-rpc" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | flume = { workspace = true } 12 | futures = { workspace = true, features = [ "compat" ] } 13 | hex-literal = { workspace = true } 14 | jsonrpsee = { workspace = true, features = [ "macros", "server" ] } 15 | parity-scale-codec = { workspace = true, features = [ "std" ] } 16 | tokio = { workspace = true, features = [ "sync", "time" ] } 17 | xcm = { workspace = true } 18 | 19 | cumulus-primitives-core = { workspace = true, features = [ "std" ] } 20 | xcm-primitives = { workspace = true, features = [ "std" ] } 21 | -------------------------------------------------------------------------------- /client/rpc/finality/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-finality-rpc" 3 | authors = { workspace = true } 4 | description = "An experimental RPC to check for block and transaction finality in the moonbeam parachain" 5 | edition = "2021" 6 | homepage = "https://moonbeam.network" 7 | license = "GPL-3.0-only" 8 | repository = { workspace = true } 9 | version = "0.1.0" 10 | 11 | [dependencies] 12 | async-trait = { workspace = true } 13 | jsonrpsee = { workspace = true, features = [ "macros", "server" ] } 14 | parity-scale-codec = { workspace = true, features = [ "std" ] } 15 | tokio = { workspace = true, features = [ "sync", "time" ] } 16 | 17 | fc-db = { workspace = true } 18 | fc-api = { workspace = true } 19 | fc-rpc = { workspace = true } 20 | sp-api = { workspace = true, features = [ "std" ] } 21 | sp-blockchain = { workspace = true } 22 | sp-core = { workspace = true, features = [ "std" ] } 23 | sp-runtime = { workspace = true, features = [ "std" ] } 24 | -------------------------------------------------------------------------------- /client/vrf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-vrf" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | # Substrate 12 | parity-scale-codec = { workspace = true, features = ["derive", "std"] } 13 | sp-api = { workspace = true, features = ["std"] } 14 | sp-application-crypto = { workspace = true } 15 | sp-core = { workspace = true, features = ["std"] } 16 | sp-keystore = { workspace = true } 17 | sp-runtime = { workspace = true } 18 | 19 | # Moonbeam 20 | session-keys-primitives = { workspace = true, features = ["std"] } 21 | 22 | # Nimbus 23 | nimbus-primitives = { workspace = true, features = ["std"] } 24 | 25 | # Polkadot 26 | polkadot-primitives = { workspace = true } 27 | 28 | # Other 29 | schnorrkel = { workspace = true, default-features = false, features = [ 30 | "preaudit_deprecated", 31 | ] } 32 | -------------------------------------------------------------------------------- /core-primitives/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-core-primitives" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.1" 9 | 10 | [dependencies] 11 | account = { workspace = true } 12 | fp-self-contained = { workspace = true } 13 | hex-literal = { workspace = true } 14 | sp-core = { workspace = true } 15 | sp-runtime = { workspace = true } 16 | 17 | [features] 18 | default = [ "std" ] 19 | std = [ 20 | "account/std", 21 | "fp-self-contained/std", 22 | "sp-core/std", 23 | "sp-runtime/std", 24 | ] 25 | -------------------------------------------------------------------------------- /docker/moonbeam-srtool.Dockerfile: -------------------------------------------------------------------------------- 1 | ARG SRTOOL_IMAGE_TAG 2 | 3 | FROM paritytech/srtool:${SRTOOL_IMAGE_TAG} 4 | 5 | USER root 6 | 7 | RUN apt-get update && \ 8 | apt-get install openssh-server -y 9 | 10 | USER 1001 11 | -------------------------------------------------------------------------------- /docker/moonbeam.Dockerfile: -------------------------------------------------------------------------------- 1 | # Moonbeam Binary 2 | # 3 | # Requires to run from repository root and to copy the binary in the build folder (part of the release workflow) 4 | 5 | FROM debian:stable AS builder 6 | 7 | RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates 8 | 9 | FROM debian:stable-slim 10 | LABEL maintainer="alan@moonsonglabs.com" 11 | LABEL description="Moonbeam Binary" 12 | 13 | RUN useradd -m -u 1000 -U -s /bin/sh -d /moonbeam moonbeam && \ 14 | mkdir -p /moonbeam/.local/share && \ 15 | mkdir /data && \ 16 | chown -R moonbeam:moonbeam /data && \ 17 | ln -s /data /moonbeam/.local/share/moonbeam && \ 18 | rm -rf /usr/sbin 19 | 20 | COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt 21 | 22 | USER moonbeam 23 | 24 | COPY --chown=moonbeam build/* /moonbeam 25 | RUN chmod uog+x /moonbeam/moonbeam* 26 | 27 | # 30333 for parachain p2p 28 | # 30334 for relaychain p2p 29 | # 9944 for Websocket & RPC call 30 | # 9615 for Prometheus (metrics) 31 | EXPOSE 30333 30334 9944 9615 32 | 33 | VOLUME ["/data"] 34 | 35 | ENTRYPOINT ["/moonbeam/moonbeam"] 36 | -------------------------------------------------------------------------------- /file_header.txt: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Moonbeam foundation 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | -------------------------------------------------------------------------------- /media/Banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonbeam-foundation/moonbeam/98c88d936c49d77d4e3f378e17920a884cd43248/media/Banner.jpg -------------------------------------------------------------------------------- /media/README.md: -------------------------------------------------------------------------------- 1 | # Brand Guidelines 2 | 3 | Please visit [Moonbeam Brand Guidelines](https://guidelines.moonbeam.foundation/) to download all assets. -------------------------------------------------------------------------------- /node/cli-opt/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-cli-opt" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | version = "0.46.0" 8 | 9 | [dependencies] 10 | bip32 = { workspace = true, features = ["bip39"] } 11 | clap = { workspace = true, features = ["derive"] } 12 | libsecp256k1 = { workspace = true, features = ["std"] } 13 | primitive-types = { workspace = true } 14 | sha3 = { workspace = true } 15 | tiny-bip39 = { workspace = true } 16 | url = { workspace = true } 17 | 18 | # Moonbeam 19 | account = { workspace = true, features = ["std"] } 20 | 21 | # Substrate 22 | sp-runtime = { workspace = true, features = ["std"] } 23 | -------------------------------------------------------------------------------- /node/cli/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; 18 | 19 | fn main() { 20 | generate_cargo_keys(); 21 | rerun_if_git_head_changed(); 22 | } 23 | -------------------------------------------------------------------------------- /node/cli/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | mod cli; 17 | mod command; 18 | pub use cli::*; 19 | pub use command::*; 20 | pub use sc_cli::{Error, Result}; 21 | -------------------------------------------------------------------------------- /node/service/src/lazy_loading/lock.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Moonbeam foundation 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; 18 | 19 | #[derive(Debug, Default)] 20 | pub struct ReadWriteLock(RwLock); 21 | 22 | impl ReadWriteLock { 23 | pub fn new(item: T) -> Self { 24 | ReadWriteLock(RwLock::new(item)) 25 | } 26 | 27 | pub fn read(&self) -> RwLockReadGuard { 28 | self.0.read() 29 | } 30 | 31 | pub fn write(&self) -> RwLockWriteGuard { 32 | self.0.write() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /node/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! Moonbase parachain collator 18 | 19 | #![warn(missing_docs)] 20 | 21 | fn main() -> moonbeam_cli::Result<()> { 22 | moonbeam_cli::run() 23 | } 24 | -------------------------------------------------------------------------------- /pallets/asset-manager/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pallet-asset-manager" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | version = "0.1.0" 6 | 7 | [dependencies] 8 | log = { workspace = true } 9 | serde = { workspace = true, optional = true } 10 | 11 | # Moonbeam 12 | xcm-primitives = { workspace = true } 13 | 14 | # Substrate 15 | frame-support = { workspace = true } 16 | frame-system = { workspace = true } 17 | parity-scale-codec = { workspace = true, features = [ "derive" ] } 18 | scale-info = { workspace = true, features = [ "derive" ] } 19 | sp-io = { workspace = true } 20 | sp-runtime = { workspace = true } 21 | sp-std = { workspace = true } 22 | 23 | # Polkadot 24 | xcm = { workspace = true } 25 | 26 | # Benchmarks 27 | frame-benchmarking = { workspace = true, optional = true } 28 | 29 | [dev-dependencies] 30 | pallet-balances = { workspace = true, features = [ "insecure_zero_ed", "std" ] } 31 | sp-core = { workspace = true, features = [ "std" ] } 32 | 33 | [features] 34 | default = [ "std" ] 35 | std = [ 36 | "frame-support/std", 37 | "frame-system/std", 38 | "parity-scale-codec/std", 39 | "scale-info/std", 40 | "serde", 41 | "sp-io/std", 42 | "sp-runtime/std", 43 | "sp-std/std", 44 | "xcm-primitives/std", 45 | "xcm/std", 46 | ] 47 | 48 | runtime-benchmarks = [ "frame-benchmarking", "xcm-primitives/runtime-benchmarks" ] 49 | try-runtime = [ "frame-support/try-runtime" ] 50 | -------------------------------------------------------------------------------- /pallets/asset-manager/src/migrations.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | -------------------------------------------------------------------------------- /pallets/ethereum-xcm/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | mod v1; 18 | mod v2; 19 | -------------------------------------------------------------------------------- /pallets/ethereum-xcm/src/tests/v1.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use frame_support::assert_ok; 18 | 19 | use crate::{mock::*, RawOrigin}; 20 | use ethereum_types::{H160, H256, U256}; 21 | 22 | mod eip1559; 23 | mod eip2930; 24 | mod legacy; 25 | -------------------------------------------------------------------------------- /pallets/moonbeam-foreign-assets/resources/foreign_erc20_initcode.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonbeam-foundation/moonbeam/98c88d936c49d77d4e3f378e17920a884cd43248/pallets/moonbeam-foreign-assets/resources/foreign_erc20_initcode.bin -------------------------------------------------------------------------------- /pallets/moonbeam-orbiters/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pallet-moonbeam-orbiters" 3 | authors = { workspace = true } 4 | description = "FRAME-based pallet for Moonbeam orbiters program." 5 | edition = "2021" 6 | version = "0.1.0" 7 | 8 | [dependencies] 9 | log = { workspace = true } 10 | 11 | # Substrate 12 | frame-benchmarking = { workspace = true, optional = true } 13 | frame-support = { workspace = true } 14 | frame-system = { workspace = true } 15 | parity-scale-codec = { workspace = true } 16 | scale-info = { workspace = true, features = [ "derive" ] } 17 | sp-runtime = { workspace = true } 18 | sp-std = { workspace = true } 19 | 20 | # Nimbus 21 | nimbus-primitives = { workspace = true } 22 | 23 | [dev-dependencies] 24 | pallet-balances = { workspace = true, features = [ "insecure_zero_ed", "std" ] } 25 | sp-core = { workspace = true, features = [ "std" ] } 26 | sp-io = { workspace = true, features = [ "std" ] } 27 | sp-runtime = { workspace = true } 28 | 29 | [features] 30 | default = [ "std" ] 31 | std = [ 32 | "frame-benchmarking/std", 33 | "frame-support/std", 34 | "frame-system/std", 35 | "nimbus-primitives/std", 36 | "parity-scale-codec/std", 37 | "scale-info/std", 38 | "sp-runtime/std", 39 | "sp-std/std", 40 | ] 41 | runtime-benchmarks = [ "frame-benchmarking" ] 42 | try-runtime = [ "frame-support/try-runtime" ] 43 | -------------------------------------------------------------------------------- /pallets/moonbeam-xcm-benchmarks/src/generic/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | pub use pallet::*; 18 | 19 | pub mod benchmarking; 20 | 21 | #[cfg(test)] 22 | pub mod mock; 23 | 24 | #[frame_support::pallet] 25 | pub mod pallet { 26 | #[pallet::config] 27 | pub trait Config: 28 | frame_system::Config + crate::Config + pallet_xcm_benchmarks::generic::Config 29 | { 30 | } 31 | 32 | #[pallet::pallet] 33 | pub struct Pallet(_); 34 | } 35 | -------------------------------------------------------------------------------- /pallets/moonbeam-xcm-benchmarks/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! Pallet that serves no other purpose than benchmarking raw messages [`Xcm`]. 18 | 19 | #![cfg_attr(not(feature = "std"), no_std)] 20 | 21 | #[cfg(feature = "runtime-benchmarks")] 22 | pub mod generic; 23 | 24 | #[cfg(test)] 25 | mod mock; 26 | 27 | // Only weights should be accesible, no need for the rest outside benchmarking 28 | pub mod weights; 29 | 30 | #[cfg(feature = "runtime-benchmarks")] 31 | /// A base trait for all individual pallets 32 | pub trait Config: frame_system::Config + pallet_xcm_benchmarks::Config {} 33 | -------------------------------------------------------------------------------- /pallets/parachain-staking/README.md: -------------------------------------------------------------------------------- 1 | # DPoS Pallet for Parachain Staking 2 | 3 | ## Formatting Rules 4 | 5 | - dependencies in alphabetical order in the `Cargo.toml` and at the top of each file 6 | - prefer explicit imports to glob import syntax i.e. prefer `use::crate::{Ex1, Ex2, ..};` to `use super::*;` 7 | 8 | ## Description 9 | 10 | Implements Delegated Proof of Stake to 11 | 12 | 1. select the active set of eligible block producers 13 | 2. reward block authors 14 | 3. enable delegators and collators to participate in inflationary rewards 15 | 16 | Links: 17 | 18 | - [Rust Documentation](https://moonbeam-foundation.github.io/moonbeam/pallet_parachain_staking/index.html) 19 | - [Unofficial Documentation](https://meta5.world/parachain-staking-docs/) 20 | - [(Outdated) Blog Post with Justification](https://meta5.world/posts/parachain-staking) 21 | 22 | ## History 23 | 24 | Since January 2021, Moonbeam's team has maintained this Delegated Proof of Stake (DPoS) pallet designed specifically for parachains. 25 | 26 | Since April 2021, the development of this pallet has been supported by [a Web3 Foundation grant](https://github.com/w3f/Grants-Program/pull/389). The [first milestone](https://github.com/w3f/Grant-Milestone-Delivery/pull/218) was approved in June 2021. 27 | -------------------------------------------------------------------------------- /pallets/precompile-benchmarks/benchmark_proofs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonbeam-foundation/moonbeam/98c88d936c49d77d4e3f378e17920a884cd43248/pallets/precompile-benchmarks/benchmark_proofs -------------------------------------------------------------------------------- /pallets/precompile-benchmarks/src/weights.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Moonbeam Foundation. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use frame_support::weights::Weight; 18 | 19 | /// Weight functions needed for pallet_precompile_benchmarks. 20 | pub trait WeightInfo { 21 | fn verify_entry(x: u32) -> Weight; 22 | fn latest_relay_block() -> Weight; 23 | fn p256_verify() -> Weight; 24 | } 25 | -------------------------------------------------------------------------------- /pallets/proxy-genesis-companion/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pallet-proxy-genesis-companion" 3 | authors = { workspace = true } 4 | description = "A simple pallet that expands pallet-proxy with a genesis configuration" 5 | edition = "2021" 6 | version = "0.1.0" 7 | 8 | [dependencies] 9 | frame-support = { workspace = true } 10 | frame-system = { workspace = true } 11 | pallet-proxy = { workspace = true } 12 | parity-scale-codec = { workspace = true } 13 | scale-info = { workspace = true, features = [ "derive" ] } 14 | sp-runtime = { workspace = true } 15 | sp-std = { workspace = true } 16 | 17 | [dev-dependencies] 18 | serde = { workspace = true } 19 | 20 | pallet-balances = { workspace = true, features = [ "insecure_zero_ed", "std" ] } 21 | sp-core = { workspace = true, features = [ "std" ] } 22 | sp-io = { workspace = true, features = [ "std" ] } 23 | 24 | pallet-evm-precompile-proxy = { workspace = true } 25 | 26 | [features] 27 | default = [ "std" ] 28 | std = [ 29 | "frame-support/std", 30 | "frame-system/std", 31 | "pallet-proxy/std", 32 | "scale-info/std", 33 | "sp-runtime/std", 34 | "sp-std/std", 35 | ] 36 | try-runtime = [ "frame-support/try-runtime" ] 37 | -------------------------------------------------------------------------------- /pallets/xcm-transactor/src/migrations.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "test" 3 | - "typescript-api" 4 | - "types-bundle" 5 | -------------------------------------------------------------------------------- /precompiles/gmp/Gmp.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | /// @dev The Gmp contract's address. 5 | address constant GMP_ADDRESS = 0x0000000000000000000000000000000000000816; 6 | 7 | /// @dev The Gmp contract's instance. 8 | Gmp constant GMP_CONTRACT = Gmp(GMP_ADDRESS); 9 | 10 | /// @author The Moonbeam Team 11 | /// @title Gmp precompile 12 | /// @dev Provides an endpoint to Gmp protocols which can automatically forward to XCM 13 | /// @custom:address 0x0000000000000000000000000000000000000816 14 | interface Gmp { 15 | // TODO: Here we would specify the endpoints for each GMP protocol on a case by case basis. 16 | // These endpoints are basically the hand offs for each protocol -- where they delegate to 17 | // the target contract. 18 | // 19 | // This design should allow users to interact with this precompile with no changes to the 20 | // underlying GMP protocols by simply specifying the correct precompile as the target. 21 | 22 | /// Receive a wormhole VAA and process it 23 | /// 24 | /// @custom:selector f53774ab 25 | function wormholeTransferERC20(bytes memory vaa) external; 26 | } 27 | -------------------------------------------------------------------------------- /precompiles/p256verify/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pallet-evm-precompile-p256verify" 3 | authors = { workspace = true } 4 | description = "secp256r1 elliptic curve precompile for EVM pallet." 5 | edition = "2021" 6 | version = "0.1.0" 7 | 8 | [dependencies] 9 | p256 = { workspace = true } 10 | 11 | # Frontier 12 | fp-evm = { workspace = true } 13 | 14 | frame-support = { workspace = true } 15 | 16 | [dev-dependencies] 17 | precompile-utils = { workspace = true, features = ["std", "testing"] } 18 | hex-literal = { workspace = true } 19 | 20 | [features] 21 | default = ["std"] 22 | std = [ 23 | # Frontier 24 | "fp-evm/std", 25 | "frame-support/std", 26 | ] 27 | -------------------------------------------------------------------------------- /precompiles/relay-data-verifier/proof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonbeam-foundation/moonbeam/98c88d936c49d77d4e3f378e17920a884cd43248/precompiles/relay-data-verifier/proof -------------------------------------------------------------------------------- /precompiles/xcm-transactor/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! Precompile to xcm transactor runtime methods via the EVM 18 | 19 | #![cfg_attr(not(feature = "std"), no_std)] 20 | 21 | #[cfg(test)] 22 | mod mock; 23 | #[cfg(test)] 24 | mod tests; 25 | 26 | mod functions; 27 | pub mod v1; 28 | pub mod v2; 29 | pub mod v3; 30 | -------------------------------------------------------------------------------- /primitives/account/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "account" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.1" 9 | 10 | [package.metadata.docs.rs] 11 | targets = ["x86_64-unknown-linux-gnu"] 12 | 13 | [dependencies] 14 | blake2-rfc = { workspace = true, optional = true } 15 | impl-serde = { workspace = true } 16 | libsecp256k1 = { workspace = true, features = ["hmac"] } 17 | log = { workspace = true } 18 | serde = { workspace = true, features = ["derive"] } 19 | sha3 = { workspace = true } 20 | 21 | # Substrate 22 | parity-scale-codec = { workspace = true } 23 | scale-info = { workspace = true } 24 | sp-core = { workspace = true } 25 | sp-io = { workspace = true } 26 | sp-runtime = { workspace = true } 27 | sp-runtime-interface = { workspace = true } 28 | sp-std = { workspace = true } 29 | 30 | [dev-dependencies] 31 | hex = { workspace = true } 32 | 33 | [features] 34 | default = ["std"] 35 | std = [ 36 | "full_crypto", 37 | "hex/std", 38 | "impl-serde/std", 39 | "libsecp256k1/std", 40 | "parity-scale-codec/std", 41 | "serde/std", 42 | "sha3/std", 43 | "sp-core/std", 44 | "sp-io/std", 45 | "sp-runtime/std", 46 | "sp-std/std", 47 | ] 48 | 49 | full_crypto = [ 50 | "blake2-rfc", 51 | "sp-runtime-interface/disable_target_static_assertions", 52 | ] 53 | -------------------------------------------------------------------------------- /primitives/bridge/xcm-bridge-router/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bp-xcm-bridge-router" 3 | description = "Primitives of the xcm-bridge-hub fee pallet." 4 | version = "0.1.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license = "GPL-3.0-or-later WITH Classpath-exception-2.0" 8 | repository.workspace = true 9 | 10 | [dependencies] 11 | parity-scale-codec = { features = ["bit-vec", "derive"], workspace = true } 12 | scale-info = { features = ["bit-vec", "derive"], workspace = true } 13 | 14 | # Substrate Dependencies 15 | sp-core = { workspace = true } 16 | sp-runtime = { workspace = true } 17 | 18 | # Polkadot Dependencies 19 | xcm = { workspace = true } 20 | 21 | [features] 22 | default = ["std"] 23 | std = [ 24 | "parity-scale-codec/std", 25 | "scale-info/std", 26 | "sp-core/std", 27 | "sp-runtime/std", 28 | "xcm/std", 29 | ] 30 | -------------------------------------------------------------------------------- /primitives/bridge/xcm-bridge/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bp-xcm-bridge" 3 | description = "Primitives of the xcm-bridge-hub pallet." 4 | version = "0.2.0" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license = "GPL-3.0-or-later WITH Classpath-exception-2.0" 8 | repository.workspace = true 9 | 10 | [dependencies] 11 | parity-scale-codec = { features = ["derive"], workspace = true } 12 | impl-trait-for-tuples = { workspace = true } 13 | scale-info = { features = ["derive"], workspace = true } 14 | serde = { features = ["alloc", "derive"], workspace = true } 15 | 16 | # Bridge Dependencies 17 | bp-messages = { workspace = true } 18 | bp-runtime = { workspace = true } 19 | 20 | # Substrate Dependencies 21 | frame-support = { workspace = true } 22 | sp-core = { workspace = true } 23 | sp-io = { workspace = true } 24 | sp-std = { workspace = true } 25 | 26 | # Polkadot Dependencies 27 | xcm = { workspace = true } 28 | 29 | [features] 30 | default = ["std"] 31 | std = [ 32 | "bp-messages/std", 33 | "bp-runtime/std", 34 | "parity-scale-codec/std", 35 | "frame-support/std", 36 | "scale-info/std", 37 | "serde/std", 38 | "sp-core/std", 39 | "sp-io/std", 40 | "sp-std/std", 41 | "xcm/std", 42 | ] 43 | -------------------------------------------------------------------------------- /primitives/ext/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-primitives-ext" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | ethereum-types = { workspace = true } 12 | 13 | # Moonbeam 14 | evm-tracing-events = { workspace = true } 15 | 16 | # Substrate 17 | parity-scale-codec = { workspace = true } 18 | sp-externalities = { workspace = true } 19 | sp-runtime-interface = { workspace = true } 20 | sp-std = { workspace = true } 21 | 22 | [features] 23 | default = [ "std" ] 24 | std = [ 25 | "ethereum-types/std", 26 | "evm-tracing-events/std", 27 | "parity-scale-codec/std", 28 | "sp-externalities/std", 29 | "sp-runtime-interface/std", 30 | "sp-std/std", 31 | ] 32 | -------------------------------------------------------------------------------- /primitives/rpc/debug/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-rpc-primitives-debug" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | environmental = { workspace = true } 12 | ethereum = { workspace = true } 13 | ethereum-types = { workspace = true } 14 | hex = { workspace = true, optional = true, features = [ "serde" ] } 15 | serde = { workspace = true, optional = true, features = [ "derive" ] } 16 | 17 | # Substrate 18 | parity-scale-codec = { workspace = true } 19 | sp-api = { workspace = true } 20 | sp-core = { workspace = true } 21 | sp-io = { workspace = true } 22 | sp-runtime = { workspace = true } 23 | sp-std = { workspace = true } 24 | 25 | [features] 26 | default = [ "std" ] 27 | std = [ 28 | "environmental/std", 29 | "ethereum-types/std", 30 | "ethereum/std", 31 | "hex", 32 | "parity-scale-codec/std", 33 | "serde", 34 | "sp-api/std", 35 | "sp-core/std", 36 | "sp-io/std", 37 | "sp-runtime/std", 38 | "sp-std/std", 39 | ] 40 | runtime-3000 = [] 41 | -------------------------------------------------------------------------------- /primitives/rpc/evm-tracing-events/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "evm-tracing-events" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | environmental = { workspace = true } 12 | 13 | # Substrate 14 | parity-scale-codec = { workspace = true } 15 | sp-runtime-interface = { workspace = true } 16 | 17 | # Ethereum 18 | ethereum = { workspace = true, features = [ "with-scale" ] } 19 | ethereum-types = { workspace = true } 20 | evm = { workspace = true, features = [ "with-codec" ] } 21 | evm-gasometer = { workspace = true } 22 | evm-runtime = { workspace = true } 23 | 24 | [features] 25 | default = [ "std" ] 26 | std = [ 27 | "environmental/std", 28 | "ethereum-types/std", 29 | "ethereum/std", 30 | "evm-gasometer/std", 31 | "evm-runtime/std", 32 | "evm/std", 33 | "parity-scale-codec/std", 34 | "sp-runtime-interface/std", 35 | ] 36 | evm-tracing = [ "evm-gasometer/tracing", "evm-runtime/tracing", "evm/tracing" ] 37 | -------------------------------------------------------------------------------- /primitives/rpc/txpool/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-rpc-primitives-txpool" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.6.0" 9 | 10 | [dependencies] 11 | ethereum = { workspace = true, features = [ "with-scale" ] } 12 | 13 | # Substrate 14 | parity-scale-codec = { workspace = true } 15 | scale-info = { workspace = true, features = [ "derive" ] } 16 | sp-api = { workspace = true } 17 | sp-io = { workspace = true } 18 | sp-runtime = { workspace = true } 19 | sp-std = { workspace = true } 20 | 21 | [features] 22 | default = [ "std" ] 23 | std = [ 24 | "ethereum/std", 25 | "scale-info/std", 26 | "sp-api/std", 27 | "sp-io/std", 28 | "sp-runtime/std", 29 | "sp-std/std", 30 | ] 31 | -------------------------------------------------------------------------------- /primitives/storage-proof/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "storage-proof-primitives" 3 | authors = { workspace = true } 4 | description = "Storage Proof Primitives" 5 | edition = "2021" 6 | version = "0.1.0" 7 | 8 | 9 | [dependencies] 10 | # Substrate 11 | cumulus-primitives-core = { workspace = true } 12 | frame-support = { workspace = true } 13 | sp-runtime = { workspace = true } 14 | sp-state-machine = { workspace = true } 15 | sp-core = { workspace = true } 16 | sp-std = { workspace = true } 17 | sp-trie = { workspace = true } 18 | 19 | [dev-dependencies] 20 | hex = { workspace = true } 21 | parity-scale-codec = { workspace = true } 22 | 23 | [features] 24 | default = ["std"] 25 | std = [ 26 | "cumulus-primitives-core/std", 27 | "frame-support/std", 28 | "parity-scale-codec/std", 29 | "sp-runtime/std", 30 | "sp-core/std", 31 | "sp-state-machine/std", 32 | "sp-std/std", 33 | "sp-trie/std", 34 | ] 35 | -------------------------------------------------------------------------------- /primitives/storage-proof/benchmark_proofs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonbeam-foundation/moonbeam/98c88d936c49d77d4e3f378e17920a884cd43248/primitives/storage-proof/benchmark_proofs -------------------------------------------------------------------------------- /primitives/storage-proof/proof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonbeam-foundation/moonbeam/98c88d936c49d77d4e3f378e17920a884cd43248/primitives/storage-proof/proof -------------------------------------------------------------------------------- /primitives/xcm/src/constants.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | pub const MAX_ASSETS: u32 = 20; 18 | -------------------------------------------------------------------------------- /runtime-diffs/moonbase/2801.txt: -------------------------------------------------------------------------------- 1 | Pallets: 2 | ~ ParachainStaking 3 | Constants: 4 | + BlockTime 5 | + SlotDuration 6 | Storage Entries: 7 | ~ Round (Changed: default value) 8 | - Staked 9 | ~ System 10 | Storage Entries: 11 | ~ Events (Changed: ) 12 | -------------------------------------------------------------------------------- /runtime-diffs/moonbase/2901.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonbase/2902.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonbase/3000.txt: -------------------------------------------------------------------------------- 1 | Pallets: 2 | ~ MoonbeamLazyMigrations 3 | Calls: 4 | - clear_local_assets_storage 5 | Storage Entries: 6 | - LocalAssetsMigrationCompleted 7 | ~ Multisig 8 | Calls: 9 | ~ as_multi 10 | ~ as_multi_threshold_1 11 | ~ OpenTechCommitteeCollective 12 | Calls: 13 | ~ execute 14 | ~ propose 15 | Storage Entries: 16 | ~ ProposalOf (Changed: ) 17 | ~ Proxy 18 | Calls: 19 | ~ proxy 20 | ~ proxy_announced 21 | ~ Scheduler 22 | Calls: 23 | ~ schedule 24 | ~ schedule_after 25 | ~ schedule_named 26 | ~ schedule_named_after 27 | ~ Sudo 28 | Calls: 29 | ~ sudo 30 | ~ sudo_as 31 | ~ sudo_unchecked_weight 32 | ~ TreasuryCouncilCollective 33 | Calls: 34 | ~ execute 35 | ~ propose 36 | Storage Entries: 37 | ~ ProposalOf (Changed: ) 38 | ~ Utility 39 | Calls: 40 | ~ as_derivative 41 | ~ batch 42 | ~ batch_all 43 | ~ dispatch_as 44 | ~ force_batch 45 | ~ with_weight 46 | ~ Whitelist 47 | Calls: 48 | ~ dispatch_whitelisted_call_with_preimage 49 | Runtime APIs: 50 | ~ DebugRuntimeApi 51 | -------------------------------------------------------------------------------- /runtime-diffs/moonbase/3401.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonbase/3501.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonbase/runtime-2700.txt: -------------------------------------------------------------------------------- 1 | Pallets: 2 | ~ EVM 3 | ~ ParachainStaking 4 | Storage Entries: 5 | ~ Round (Changed: default value) 6 | ~ System 7 | Storage Entries: 8 | ~ Events (Changed: ) 9 | -------------------------------------------------------------------------------- /runtime-diffs/moonbeam/2801.txt: -------------------------------------------------------------------------------- 1 | Pallets: 2 | ~ ParachainStaking 3 | Constants: 4 | + BlockTime 5 | + SlotDuration 6 | Storage Entries: 7 | ~ Round (Changed: default value) 8 | - Staked 9 | ~ System 10 | Storage Entries: 11 | ~ Events (Changed: ) 12 | -------------------------------------------------------------------------------- /runtime-diffs/moonbeam/2901.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonbeam/2902.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonbeam/3000.txt: -------------------------------------------------------------------------------- 1 | Pallets: 2 | + AsyncBacking 3 | ~ MoonbeamLazyMigrations 4 | Calls: 5 | - clear_local_assets_storage 6 | Storage Entries: 7 | - LocalAssetsMigrationCompleted 8 | ~ Multisig 9 | Calls: 10 | ~ as_multi 11 | ~ as_multi_threshold_1 12 | ~ OpenTechCommitteeCollective 13 | Calls: 14 | ~ execute 15 | ~ propose 16 | Storage Entries: 17 | ~ ProposalOf (Changed: ) 18 | ~ Proxy 19 | Calls: 20 | ~ proxy 21 | ~ proxy_announced 22 | ~ Scheduler 23 | Calls: 24 | ~ schedule 25 | ~ schedule_after 26 | ~ schedule_named 27 | ~ schedule_named_after 28 | ~ TreasuryCouncilCollective 29 | Calls: 30 | ~ execute 31 | ~ propose 32 | Storage Entries: 33 | ~ ProposalOf (Changed: ) 34 | ~ Utility 35 | Calls: 36 | ~ as_derivative 37 | ~ batch 38 | ~ batch_all 39 | ~ dispatch_as 40 | ~ force_batch 41 | ~ with_weight 42 | ~ Whitelist 43 | Calls: 44 | ~ dispatch_whitelisted_call_with_preimage 45 | Runtime APIs: 46 | ~ DebugRuntimeApi 47 | -------------------------------------------------------------------------------- /runtime-diffs/moonbeam/3401.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonbeam/3501.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonriver/2801.txt: -------------------------------------------------------------------------------- 1 | Pallets: 2 | ~ ParachainStaking 3 | Constants: 4 | + BlockTime 5 | + SlotDuration 6 | Storage Entries: 7 | ~ Round (Changed: default value) 8 | - Staked 9 | ~ System 10 | Storage Entries: 11 | ~ Events (Changed: ) 12 | -------------------------------------------------------------------------------- /runtime-diffs/moonriver/2901.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonriver/2902.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonriver/3000.txt: -------------------------------------------------------------------------------- 1 | Pallets: 2 | + AsyncBacking 3 | ~ MoonbeamLazyMigrations 4 | Calls: 5 | - clear_local_assets_storage 6 | Storage Entries: 7 | - LocalAssetsMigrationCompleted 8 | ~ Multisig 9 | Calls: 10 | ~ as_multi 11 | ~ as_multi_threshold_1 12 | ~ OpenTechCommitteeCollective 13 | Calls: 14 | ~ execute 15 | ~ propose 16 | Storage Entries: 17 | ~ ProposalOf (Changed: ) 18 | ~ Proxy 19 | Calls: 20 | ~ proxy 21 | ~ proxy_announced 22 | ~ Scheduler 23 | Calls: 24 | ~ schedule 25 | ~ schedule_after 26 | ~ schedule_named 27 | ~ schedule_named_after 28 | ~ TreasuryCouncilCollective 29 | Calls: 30 | ~ execute 31 | ~ propose 32 | Storage Entries: 33 | ~ ProposalOf (Changed: ) 34 | ~ Utility 35 | Calls: 36 | ~ as_derivative 37 | ~ batch 38 | ~ batch_all 39 | ~ dispatch_as 40 | ~ force_batch 41 | ~ with_weight 42 | ~ Whitelist 43 | Calls: 44 | ~ dispatch_whitelisted_call_with_preimage 45 | Runtime APIs: 46 | ~ DebugRuntimeApi 47 | -------------------------------------------------------------------------------- /runtime-diffs/moonriver/3401.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime-diffs/moonriver/3501.txt: -------------------------------------------------------------------------------- 1 | No difference in metadata found. 2 | -------------------------------------------------------------------------------- /runtime/common/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | #![cfg_attr(not(feature = "std"), no_std)] 18 | 19 | mod apis; 20 | #[cfg(feature = "runtime-benchmarks")] 21 | pub mod benchmarking; 22 | pub mod deal_with_fees; 23 | pub mod impl_asset_conversion; 24 | mod impl_moonbeam_xcm_call; 25 | mod impl_moonbeam_xcm_call_tracing; 26 | pub mod impl_multiasset_paymaster; 27 | mod impl_on_charge_evm_transaction; 28 | mod impl_self_contained_call; 29 | mod impl_xcm_evm_runner; 30 | pub mod migrations; 31 | pub mod timestamp; 32 | pub mod types; 33 | pub mod xcm_origins; 34 | -------------------------------------------------------------------------------- /runtime/common/src/xcm_origins.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Moonbeam Foundation. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use frame_support::traits::Contains; 18 | use xcm::latest::Location; 19 | use xcm::prelude::Parachain; 20 | 21 | pub struct AllowSiblingParachains; 22 | impl Contains for AllowSiblingParachains { 23 | fn contains(location: &Location) -> bool { 24 | matches!(location.unpack(), (1, [Parachain(_)])) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /runtime/evm_tracer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "moonbeam-evm-tracer" 3 | authors = { workspace = true } 4 | edition = "2021" 5 | homepage = "https://moonbeam.network" 6 | license = "GPL-3.0-only" 7 | repository = { workspace = true } 8 | version = "0.1.0" 9 | 10 | [dependencies] 11 | 12 | # Moonbeam 13 | evm-tracing-events = { workspace = true, features = [ "evm-tracing" ] } 14 | moonbeam-primitives-ext = { workspace = true } 15 | 16 | # Substrate 17 | parity-scale-codec = { workspace = true } 18 | sp-core = { workspace = true } 19 | sp-io = { workspace = true } 20 | sp-runtime = { workspace = true } 21 | sp-std = { workspace = true } 22 | 23 | # Frontier 24 | ethereum-types = { workspace = true } 25 | evm = { workspace = true } 26 | evm-gasometer = { workspace = true } 27 | evm-runtime = { workspace = true } 28 | fp-evm = { workspace = true } 29 | pallet-evm = { workspace = true, features = [ "forbid-evm-reentrancy" ] } 30 | 31 | [features] 32 | default = [ "std" ] 33 | std = [ 34 | "ethereum-types/std", 35 | "evm-gasometer/std", 36 | "evm-runtime/std", 37 | "evm-tracing-events/std", 38 | "evm/std", 39 | "evm/with-serde", 40 | "fp-evm/std", 41 | "moonbeam-primitives-ext/std", 42 | "pallet-evm/std", 43 | "parity-scale-codec/std", 44 | "sp-core/std", 45 | "sp-runtime/std", 46 | "sp-std/std", 47 | ] 48 | -------------------------------------------------------------------------------- /runtime/moonbase/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | #[cfg(not(feature = "metadata-hash"))] 20 | fn main() { 21 | WasmBuilder::new() 22 | .with_current_project() 23 | .export_heap_base() 24 | .import_memory() 25 | .build() 26 | } 27 | 28 | #[cfg(feature = "metadata-hash")] 29 | fn main() { 30 | WasmBuilder::new() 31 | .with_current_project() 32 | .export_heap_base() 33 | .import_memory() 34 | .enable_metadata_hash("DEV", 18) 35 | .build() 36 | } 37 | -------------------------------------------------------------------------------- /runtime/moonbase/src/governance/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! Governance configurations 18 | 19 | pub mod councils; 20 | pub mod referenda; 21 | 22 | use super::*; 23 | 24 | mod origins; 25 | pub use origins::{ 26 | custom_origins, GeneralAdmin, ReferendumCanceller, ReferendumKiller, WhitelistedCaller, 27 | }; 28 | mod tracks; 29 | pub use tracks::TracksInfo; 30 | -------------------------------------------------------------------------------- /runtime/moonbase/src/migrations.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Moonbeam Foundation.Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! # Moonbase specific Migrations 18 | 19 | use pallet_migrations::{GetMigrations, Migration}; 20 | use sp_std::{prelude::*, vec}; 21 | 22 | pub struct MoonbaseMigrations; 23 | 24 | impl GetMigrations for MoonbaseMigrations { 25 | fn get_migrations() -> Vec> { 26 | vec![] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /runtime/moonbase/src/weights/db/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Moonbeam foundation 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | pub mod rocksdb; 18 | -------------------------------------------------------------------------------- /runtime/moonbeam/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | #[cfg(not(feature = "metadata-hash"))] 20 | fn main() { 21 | WasmBuilder::new() 22 | .with_current_project() 23 | .export_heap_base() 24 | .import_memory() 25 | .build() 26 | } 27 | 28 | #[cfg(feature = "metadata-hash")] 29 | fn main() { 30 | WasmBuilder::new() 31 | .with_current_project() 32 | .export_heap_base() 33 | .import_memory() 34 | .enable_metadata_hash("GLMR", 18) 35 | .build() 36 | } 37 | -------------------------------------------------------------------------------- /runtime/moonbeam/src/governance/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! Governance configurations 18 | 19 | pub mod councils; 20 | pub mod referenda; 21 | 22 | use super::*; 23 | 24 | mod origins; 25 | pub use origins::{ 26 | custom_origins, GeneralAdmin, ReferendumCanceller, ReferendumKiller, WhitelistedCaller, 27 | }; 28 | mod tracks; 29 | pub use tracks::TracksInfo; 30 | -------------------------------------------------------------------------------- /runtime/moonbeam/src/migrations.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Moonbeam Foundation.Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! # Moonbeam specific Migrations 18 | use pallet_migrations::{GetMigrations, Migration}; 19 | use sp_std::{prelude::*, vec}; 20 | 21 | pub struct MoonbeamMigrations; 22 | 23 | impl GetMigrations for MoonbeamMigrations { 24 | fn get_migrations() -> Vec> { 25 | vec![] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /runtime/moonbeam/src/weights/db/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Moonbeam foundation 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | pub mod rocksdb; 18 | -------------------------------------------------------------------------------- /runtime/moonriver/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | use substrate_wasm_builder::WasmBuilder; 18 | 19 | #[cfg(not(feature = "metadata-hash"))] 20 | fn main() { 21 | WasmBuilder::new() 22 | .with_current_project() 23 | .export_heap_base() 24 | .import_memory() 25 | .build() 26 | } 27 | 28 | #[cfg(feature = "metadata-hash")] 29 | fn main() { 30 | WasmBuilder::new() 31 | .with_current_project() 32 | .export_heap_base() 33 | .import_memory() 34 | .enable_metadata_hash("MOVR", 18) 35 | .build() 36 | } 37 | -------------------------------------------------------------------------------- /runtime/moonriver/src/governance/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! Governance configurations 18 | 19 | pub mod councils; 20 | pub mod referenda; 21 | 22 | use super::*; 23 | 24 | mod origins; 25 | pub use origins::{ 26 | custom_origins, GeneralAdmin, ReferendumCanceller, ReferendumKiller, WhitelistedCaller, 27 | }; 28 | mod tracks; 29 | pub use tracks::TracksInfo; 30 | -------------------------------------------------------------------------------- /runtime/moonriver/src/migrations.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Moonbeam Foundation.Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! # Moonriver specific Migrations 18 | 19 | use pallet_migrations::{GetMigrations, Migration}; 20 | use sp_std::{prelude::*, vec}; 21 | 22 | pub struct MoonriverMigrations; 23 | 24 | impl GetMigrations for MoonriverMigrations { 25 | fn get_migrations() -> Vec> { 26 | vec![ 27 | // Runtime 3000 28 | // Box::new(PalletStakingMultiplyRoundLenBy2) 29 | ] 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /runtime/moonriver/src/weights/db/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Moonbeam foundation 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | pub mod rocksdb; 18 | -------------------------------------------------------------------------------- /runtime/relay-encoder/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2025 PureStake Inc. 2 | // This file is part of Moonbeam. 3 | 4 | // Moonbeam 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 | // Moonbeam 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 Moonbeam. If not, see . 16 | 17 | //! Encoder for relay runtimes 18 | #![cfg_attr(not(feature = "std"), no_std)] 19 | 20 | pub mod kusama; 21 | pub mod polkadot; 22 | pub mod westend; 23 | -------------------------------------------------------------------------------- /runtime/summarize-precompile-checks/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "summarize-precompile-checks" 3 | authors = { workspace = true } 4 | description = "Summarize precompile checks in all runtimes" 5 | edition = "2021" 6 | homepage = "https://moonbeam.network" 7 | license = "GPL-3.0-only" 8 | version = "0.0.0" 9 | 10 | [dependencies] 11 | clap = { version = "4.0.32", features = ["derive"] } 12 | moonbase-runtime = { path = "../moonbase" } 13 | moonbeam-runtime = { path = "../moonbeam" } 14 | moonriver-runtime = { path = "../moonriver" } 15 | precompile-utils = { workspace = true, features = [ "testing" ] } 16 | serde_json = "1.0" 17 | -------------------------------------------------------------------------------- /rust-toolchain: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "1.81.0" 3 | components = [ "rustfmt", "clippy", "rust-src" ] 4 | targets = [ "wasm32-unknown-unknown" ] 5 | profile = "minimal" 6 | -------------------------------------------------------------------------------- /scripts/build-last-tracing-runtime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LOCAL_GIT_BRANCH="$(git symbolic-ref HEAD 2>/dev/null)" 4 | LOCAL_GIT_BRANCH=${LOCAL_GIT_BRANCH##refs/heads/} 5 | 6 | echo ${1:-"$LOCAL_GIT_BRANCH"} 7 | 8 | rm -rf build/{moonbeam-runtime-overrides,wasm} 9 | mkdir -p build/wasm 10 | git clone --depth 1 -b master-without-wasm https://github.com/moonbeam-foundation/moonbeam-runtime-overrides build/moonbeam-runtime-overrides 11 | 12 | cd build/moonbeam-runtime-overrides 13 | ./scripts/import-tracing-runtime.sh local ${1:-"$LOCAL_GIT_BRANCH"} 14 | ./scripts/build-tracing-runtime.sh local moonbase 15 | mv wasm/moonbase-runtime-local-substitute-tracing.wasm ../wasm/moonbase-runtime-local-substitute-tracing.wasm 16 | -------------------------------------------------------------------------------- /scripts/bump-node-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$2" ]; then 4 | echo "Usage: $0 " 5 | echo "Ex: $0 0.8.3 0.8.5" 6 | exit 1 7 | fi 8 | 9 | FROM=$1 10 | TO=$2 11 | sed -i "s/moonbeam-foundation\/moonbeam:v$FROM/moonbeam-foundation\/moonbeam:v$TO/" README.md 12 | sed -i "s/^version = '$FROM'$/version = '$TO'/" node/Cargo.toml 13 | sed -i "s/^version = '$FROM'$/version = '$TO'/" node/cli/Cargo.toml 14 | sed -i "s/^version = '$FROM'$/version = '$TO'/" node/cli-opt/Cargo.toml 15 | sed -i "s/^version = '$FROM'$/version = '$TO'/" node/service/Cargo.toml 16 | 17 | sed -i "s/^version = '$FROM'$/version = '$TO'/" runtime/moonbase/Cargo.toml 18 | sed -i "s/^version = '$FROM'$/version = '$TO'/" runtime/moonriver/Cargo.toml 19 | sed -i "s/^version = '$FROM'$/version = '$TO'/" runtime/moonbeam/Cargo.toml 20 | 21 | cargo build --release -------------------------------------------------------------------------------- /scripts/check-cargo-toml-files-format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "Cargo.toml" -not -path "*/target/*" -exec toml-sort {} \; 4 | 5 | CMD="git diff --name-only" 6 | 7 | stdbuf -oL $CMD | { 8 | while IFS= read -r line; do 9 | echo ║ $line 10 | if [[ "$line" == *"Cargo.toml" ]]; then 11 | echo "Check fails: $line" 12 | echo "Please run './scripts/toml-sort.sh' to format Cargo.toml files properly." 13 | exit 1 14 | fi 15 | done 16 | } 17 | -------------------------------------------------------------------------------- /scripts/check-forbid-evm-reentrancy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while IFS= read -r path 4 | do 5 | echo "$path" 6 | 7 | # Detect single or multiline declarations of pallet-evm and pallet-ethereum to 8 | # contain the "forbid-evm-reentrancy" feature. 9 | matches=$(awk 'flag{ 10 | if (buf ~ /}/ && buf !~ /forbid-evm-reentrancy/) { 11 | printf "(line %d) %s", line, buf; flag=0; buf="" # single line declaration 12 | } else { 13 | buf = buf $0 ORS; 14 | if (flag && /}/ && buf !~ /forbid-evm-reentrancy/) { # multiline declaration 15 | printf "(line %d) %s", line, buf; flag=0; buf="" 16 | } 17 | } 18 | } 19 | /pallet-(ethereum|evm) = /{buf = $0 ORS; flag=1;line=NR}' "${path}") 20 | 21 | if [[ -n "$matches" ]]; then 22 | echo "Check failed. Please add 'forbid-evm-reentrancy' feature to 'pallet-evm' and 'pallet-ethereum'." 23 | echo "${matches}" 24 | exit 1 25 | fi 26 | done < <(find . -name "Cargo.toml" -not -path "*/target/*" -not -path "*/build/*") 27 | -------------------------------------------------------------------------------- /scripts/create-substrate-fork.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -z "$1" ]]; then 4 | echo "usage: ./scripts/create-substrate-fork.sh []"; 5 | exit 1; 6 | fi 7 | 8 | NEW_BRANCH=$1 9 | BASE_BRANCH=${2:-"moonbeam-polkadot-v0.9.17"} 10 | 11 | mkdir -p scripts/tmp 12 | cd scripts/tmp 13 | 14 | REPOS=( 15 | substrate 16 | polkadot 17 | cumulus 18 | nimbus 19 | open-runtime-module-library 20 | crowdloan-rewards 21 | frontier 22 | ) 23 | 24 | for REPO in ${REPOS[@]}; do 25 | git clone --depth 1 git@github.com:moonbeam-foundation/$REPO.git -b $BASE_BRANCH 26 | cd $REPO 27 | git checkout -b $NEW_BRANCH 28 | find . -name "Cargo.toml" -exec sed -i "s/\"$BASE_BRANCH\"/\"$NEW_BRANCH\"/g" {} \; 29 | git add . 30 | git commit -m "update git dependencies" 31 | git push -f origin $NEW_BRANCH 32 | cd .. 33 | rm -rf $REPO 34 | done 35 | 36 | cd ../.. 37 | rm -rf scripts/tmp 38 | git checkout -b $NEW_BRANCH 39 | -------------------------------------------------------------------------------- /scripts/embed-specs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script copies a raw spec file from a moonbeam network repository into the correct place in this repository to be embedded in the moonbeam binary. 3 | if [ -z "$2" ]; then 4 | echo "Usage: $0 [moonriver|alphanet] " 5 | echo "Ex: $0 alphanet sha-081b1aab-4" 6 | exit 1 7 | fi 8 | 9 | NETWORK=$1 10 | DOCKER_TAG=$2 11 | 12 | PARACHAIN_DOCKER=moonbeamfoundation/moonbase-${NETWORK}:${DOCKER_TAG} 13 | docker create --name moonbeam-tmp $PARACHAIN_DOCKER 14 | docker cp moonbeam-tmp:/moonbase-parachain/parachain-raw-specs.json specs/${NETWORK}/parachain-embedded-specs-${DOCKER_TAG}.json 15 | docker rm moonbeam-tmp 16 | -------------------------------------------------------------------------------- /scripts/generate-runtimes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Generates the runtime wasm for moonbase, moonriver and moonbeam 3 | set -e 4 | source scripts/_init_var.sh 5 | 6 | for runtime in moonbase moonriver moonbeam; do 7 | echo "=================== $runtime ===================" 8 | RUNTIME_BUILD_FOLDER=$BUILD_FOLDER/runtimes 9 | mkdir -p $RUNTIME_BUILD_FOLDER 10 | RUNTIME_WASM="$RUNTIME_BUILD_FOLDER/${runtime}-runtime.wasm" 11 | 12 | $MOONBEAM_BINARY export-genesis-wasm \ 13 | --chain "${runtime}-local" \ 14 | > $RUNTIME_WASM; 15 | echo $RUNTIME_WASM generated 16 | done -------------------------------------------------------------------------------- /scripts/run-para-test-single.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | # If you are in the scripts folder, go back to the root of the repository 4 | FOLDER="${PWD##*/}" 5 | if [[ "$FOLDER" == "scripts" ]]; then 6 | cd .. 7 | fi 8 | 9 | # Get relay binary 10 | ./scripts/get-alphanet-relay-image.sh 11 | 12 | # Move to tests folder 13 | cd tests 14 | 15 | # Execute single test file provided 16 | npm i 17 | node_modules/.bin/mocha -r ts-node/register "para-tests/$1" 18 | 19 | # if you were not in the scripts folder at the beginning, go back to the root of the repository 20 | if [[ "$FOLDER" != "scripts" ]]; then 21 | cd .. 22 | fi 23 | -------------------------------------------------------------------------------- /scripts/run-tracing-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pnpm i 4 | 5 | BUILD_LAST_TRACING_RUNTIME="no" 6 | 7 | if [ -e test/moonbase-overrides/moonbase-runtime-local-substitute-tracing.wasm ]; then 8 | if [[ "$1" == "-f" ]]; then 9 | BUILD_LAST_TRACING_RUNTIME="yes" 10 | fi 11 | else 12 | BUILD_LAST_TRACING_RUNTIME="yes" 13 | fi 14 | 15 | if [[ "$BUILD_LAST_TRACING_RUNTIME" == "yes" ]]; then 16 | ./scripts/build-last-tracing-runtime.sh 17 | mkdir -p test/moonbase-overrides/ 18 | mv build/wasm/moonbase-runtime-local-substitute-tracing.wasm test/moonbase-overrides/ 19 | else 20 | echo "The tracing runtime is not rebuilt, if you want to rebuild it, use the option '-f'." 21 | fi 22 | 23 | echo "Run tracing tests…" 24 | cd test || exit 25 | pnpm moonwall test dev_moonbase_tracing 26 | cd .. 27 | -------------------------------------------------------------------------------- /scripts/toml-sort.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # From the workspace directory, run : 4 | # ./scripts/toml-sort.sh 5 | # to format all Cargo.toml files, and 6 | # ./scripts/toml-sort.sh --check 7 | # to only check the formatting. 8 | 9 | if ! type "toml-sort" > /dev/null; then 10 | echo "Please install toml-sort with command 'cargo install --git https://github.com/moonsong-labs/toml_sort'" 11 | else 12 | find . -name "Cargo.toml" -not -path "*/target/*" -exec toml-sort {} $@ \; 13 | fi 14 | -------------------------------------------------------------------------------- /specs/README.md: -------------------------------------------------------------------------------- 1 | # Embedded Spec Files 2 | 3 | This directory contains chain specs for well-known public networks. 4 | 5 | ## Context 6 | 7 | The Moonbase node is designed to support multiple networks including Moonbase Alpha, MoonRiver 8 | (Kusama) and Moonbeam (Polkadot). Some of these networks are already live and others are planned. 9 | 10 | In order to support multiple networks with the same binary, Moonbase relies on a chain specification 11 | to know which network to sync. Rather than require node operators to obtain spec files separately, 12 | it is convenient to "bake" specs for popular networks into the node. 13 | 14 | ## Which specs will come pre-baked? 15 | 16 | - Moonbase Stage V6 - internal 17 | - Moonbase Alpha V6 - live 18 | - MoonRock - Potential future deployment to Rococo 19 | - MoonRiver - Future Kusama Deployment 20 | - Moonbeam - Future Polkadot deployment 21 | 22 | ## Relay chain specs 23 | 24 | Because Moonbase networks are parachains, each network instance requires both a parachain and a 25 | relay chain spec. For popular relay chains like kusama and polkadot, we rely on the specs being 26 | already included with Polkadot. For smaller relay chains, like the one that exists solely to support 27 | moonbase alpha, we also bake the relay spec into the moonbase binary. 28 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | tmp/* 2 | *.sqlite 3 | *.wasm 4 | *.zip 5 | 6 | moonbeam 7 | !suites/dev/moonbeam 8 | polkadot 9 | 10 | *spec.json 11 | html/ 12 | 13 | contracts/cache 14 | contracts/out 15 | wasm/precompiled* -------------------------------------------------------------------------------- /test/.npmrc: -------------------------------------------------------------------------------- 1 | ignore-workspace-root-check = true 2 | strict-peer-dependencies = false 3 | registry = https://registry.npmjs.org/ 4 | auto-install-peers = true 5 | engine-strict=true 6 | -------------------------------------------------------------------------------- /test/.nvmrc: -------------------------------------------------------------------------------- 1 | v22 -------------------------------------------------------------------------------- /test/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../biome.json" 4 | ], 5 | "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", 6 | "files": { 7 | "ignore": ["html"] 8 | } 9 | } -------------------------------------------------------------------------------- /test/configs/alphanet.yml: -------------------------------------------------------------------------------- 1 | endpoint: wss://wss.api.moonbase.moonbeam.network 2 | mock-signature-host: true 3 | db: ./tmp/db_mba.sqlite 4 | 5 | import-storage: 6 | System: 7 | Account: 8 | - - - "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac" 9 | - providers: 1 10 | data: 11 | free: "100000000000000000000000" 12 | OpenTechCommitteeCollective: 13 | Members: ["0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"] 14 | TreasuryCouncilCollective: 15 | Members: ["0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"] 16 | Sudo: 17 | Key: "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac" 18 | AuthorFilter: 19 | EligibleRatio: 100 20 | EligibleCount: 100 21 | -------------------------------------------------------------------------------- /test/configs/lazyLoadingStateOverrides.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /test/configs/moonbeam.yml: -------------------------------------------------------------------------------- 1 | endpoint: wss://wss.api.moonbeam.network 2 | mock-signature-host: true 3 | db: ./tmp/db_mb.sqlite 4 | 5 | import-storage: 6 | System: 7 | Account: 8 | - - - "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac" 9 | - providers: 1 10 | data: 11 | free: "100000000000000000000000" 12 | OpenTechCommitteeCollective: 13 | Members: ["0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"] 14 | TreasuryCouncilCollective: 15 | Members: ["0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"] 16 | AuthorFilter: 17 | EligibleRatio: 100 18 | EligibleCount: 100 19 | -------------------------------------------------------------------------------- /test/configs/moonriver.yml: -------------------------------------------------------------------------------- 1 | endpoint: wss://wss.moonriver.moonbeam.network 2 | mock-signature-host: true 3 | db: ./tmp/db_mr.sqlite 4 | 5 | import-storage: 6 | System: 7 | Account: 8 | - - - "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac" 9 | - providers: 1 10 | data: 11 | free: "100000000000000000000000" 12 | OpenTechCommitteeCollective: 13 | Members: ["0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"] 14 | TreasuryCouncilCollective: 15 | Members: ["0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"] 16 | AuthorFilter: 17 | EligibleRatio: 100 18 | EligibleCount: 100 19 | -------------------------------------------------------------------------------- /test/contracts/README.md: -------------------------------------------------------------------------------- 1 | # Building contracts 2 | 3 | 1. Run the script at: `/test/scripts/compile-contracts.ts` -------------------------------------------------------------------------------- /test/contracts/src/AccessListHelper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract AccessListHelper { 5 | uint256 private storedValue; 6 | 7 | // Function to set the stored value 8 | function setValue(uint256 _value) public { 9 | storedValue = _value; 10 | } 11 | 12 | // Function to load the stored value multiple times using assembly and sload 13 | function loadValueMultipleTimes(uint256 times) public view returns (uint256 total) { 14 | total = 0; 15 | uint256 loaded; 16 | for (uint256 i = 0; i < times; i++) { 17 | assembly { 18 | loaded := sload(storedValue.slot) 19 | } 20 | total += loaded; 21 | } 22 | 23 | return total; 24 | } 25 | } 26 | 27 | // pragma solidity ^0.8.0; 28 | 29 | // import "./AccessListHelper.sol"; 30 | 31 | contract AccessListHelperProxy { 32 | AccessListHelper accessListHelper; 33 | 34 | constructor(address helper) { 35 | accessListHelper = AccessListHelper(helper); 36 | } 37 | 38 | function callHelper(uint256 times) public view returns (uint256 value) { 39 | value = accessListHelper.loadValueMultipleTimes(times); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/contracts/src/BlockVariables.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | contract BlockVariables { 5 | uint256 public initialgaslimit; 6 | uint256 public initialchainid; 7 | uint256 public initialnumber; 8 | 9 | constructor() { 10 | initialgaslimit = block.gaslimit; 11 | initialchainid = block.chainid; 12 | initialnumber = block.number; 13 | } 14 | 15 | function getGasLimit() public view returns (uint256) { 16 | return block.gaslimit; 17 | } 18 | 19 | function getChainId() public view returns (uint256) { 20 | return block.chainid; 21 | } 22 | 23 | function getNumber() public view returns (uint256) { 24 | return block.number; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/contracts/src/CallBatchFromConstructor.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity ^0.8.10; 3 | 4 | import "../../../precompiles/batch/Batch.sol"; 5 | 6 | contract BatchCaller { 7 | function inner(address to, bytes[] memory callData) internal { 8 | address[] memory toAddress = new address[](1); 9 | toAddress[0] = to; 10 | uint256[] memory value = new uint256[](1); 11 | value[0] = 0; 12 | uint64[] memory gasLimit = new uint64[](1); 13 | gasLimit[0] = 0; 14 | BATCH_CONTRACT.batchAll(toAddress, value, callData, gasLimit); 15 | } 16 | } 17 | 18 | contract CallBatchPrecompileFromConstructor is BatchCaller { 19 | constructor(address to, bytes[] memory callData) { 20 | inner(to, callData); 21 | } 22 | } 23 | 24 | contract CallBatchPrecompileFromConstructorInSubCall { 25 | CallBatchPrecompileFromConstructor public addr; 26 | 27 | function simple(address to, bytes[] memory callData) external { 28 | addr = new CallBatchPrecompileFromConstructor(to, callData); 29 | } 30 | } -------------------------------------------------------------------------------- /test/contracts/src/CallForwarder.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | contract CallForwarder { 5 | function call( 6 | address target, 7 | bytes memory data 8 | ) public returns (bool, bytes memory) { 9 | return target.call(data); 10 | } 11 | 12 | function callRange(address first, address last) public { 13 | require(first < last, "invalid range"); 14 | while (first < last) { 15 | first.call(""); 16 | first = address(uint160(first) + 1); 17 | } 18 | } 19 | 20 | function delegateCall( 21 | address target, 22 | bytes memory data 23 | ) public returns (bool, bytes memory) { 24 | return target.delegatecall(data); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/contracts/src/Collective.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | import "../../../precompiles/collective/Collective.sol"; 5 | 6 | abstract contract CollectivePrecompile is Collective {} 7 | -------------------------------------------------------------------------------- /test/contracts/src/ERC20ExcessGas.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | import "./ERC20WithInitialSupply.sol"; 5 | 6 | contract ERC20ExcessGas is ERC20WithInitialSupply { 7 | uint public _gasHog; 8 | 9 | constructor( 10 | string memory name_, 11 | string memory symbol_, 12 | address initialAccount, 13 | uint256 initialSupply 14 | ) ERC20WithInitialSupply(name_, symbol_, initialAccount, initialSupply) {} 15 | 16 | function transfer( 17 | address to, 18 | uint256 amount 19 | ) public override returns (bool) { 20 | // Consume gas to over Erc20XcmBridgeTransferGasLimit 21 | for (uint i = 0; i < 2200; i++) { 22 | _gasHog += i; 23 | } 24 | 25 | address owner = msg.sender; 26 | _transfer(owner, to, amount); 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/contracts/src/EventEmitter.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | contract EventEmitter { 5 | event Constructed(address indexed owner); 6 | 7 | constructor() { 8 | emit Constructed(msg.sender); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/contracts/src/FailingConstructor.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | contract FailingConstructor { 5 | constructor() { 6 | require(false); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/contracts/src/Fibonacci.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | contract Fibonacci { 5 | function fib2(uint256 n) public pure returns (uint256 b) { 6 | if (n == 0) { 7 | return 0; 8 | } 9 | uint256 a = 1; 10 | b = 1; 11 | for (uint256 i = 2; i < n; i++) { 12 | uint256 c = a + b; 13 | a = b; 14 | b = c; 15 | } 16 | return b; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/contracts/src/Gmp.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | import "../../../precompiles/gmp/Gmp.sol"; 5 | 6 | abstract contract GmpPrecompile is Gmp {} 7 | -------------------------------------------------------------------------------- /test/contracts/src/Incrementor.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | contract Incrementor { 5 | uint256 public count; 6 | 7 | constructor() { 8 | count = 0; 9 | } 10 | 11 | function incr() public { 12 | count = count + 1; 13 | } 14 | 15 | function incr(uint256 num) public returns (uint256) { 16 | count = count + num; 17 | return count; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/contracts/src/Looper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | contract Looper { 5 | uint256 public count; 6 | 7 | function infinite() public pure { 8 | while (true) {} 9 | } 10 | 11 | function incrementalLoop(uint256 n) public { 12 | uint256 i = 0; 13 | while (i < n) { 14 | count = count + 1; 15 | i += 1; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/contracts/src/MultiplyBy7.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | contract MultiplyBy7 { 5 | function multiply(uint256 a) public pure returns (uint256 d) { 6 | return a * 7; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/contracts/src/ReferendaChecker.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | import "../../../precompiles/referenda/Referenda.sol"; 5 | import "../../../precompiles/preimage/Preimage.sol"; 6 | import "../../../precompiles/conviction-voting/ConvictionVoting.sol"; 7 | import "./SubstrateTools.sol"; 8 | 9 | /// @notice Smart contract to verify some of the precompile methods 10 | contract ReferendaChecker { 11 | /// @notice The id of the track used for root execution 12 | uint16 public rootTrackId; 13 | 14 | /// @notice The id of the referendum 15 | uint32 public referendumId; 16 | 17 | /// @notice construct the smart contract with the track id to send the proposal to 18 | constructor() { 19 | bytes memory remarkProposal = SubstrateTools.buildSystemRemarkProposal( 20 | "Referenda Test Contract" 21 | ); 22 | referendumId = REFERENDA_CONTRACT.submitAfter( 23 | rootTrackId, 24 | PREIMAGE_CONTRACT.notePreimage(remarkProposal), 25 | uint32(remarkProposal.length), 26 | 1 27 | ); 28 | } 29 | 30 | function test_1_check_referendum() external view { 31 | // TODO: implement referenda precompile getters 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/contracts/src/SmartContractPrecompileCallTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | import "../../../precompiles/proxy/Proxy.sol"; 5 | import "../../../precompiles/batch/Batch.sol"; 6 | 7 | /// @notice Smart contract to test precompile calls 8 | contract SmartContractPrecompileCallTest { 9 | uint256 public canaryValue = 255; 10 | 11 | function callProxy( 12 | address real, 13 | address to, 14 | bytes memory callData 15 | ) external { 16 | PROXY_CONTRACT.proxy(real, to, callData); 17 | } 18 | 19 | function callAddProxy(address delegate) external { 20 | PROXY_CONTRACT.addProxy(delegate, Proxy.ProxyType.Staking, 0); 21 | } 22 | 23 | function callBatch(address to, bytes[] memory callData) external { 24 | address[] memory toAddress = new address[](1); 25 | toAddress[0] = to; 26 | uint256[] memory value = new uint256[](1); 27 | value[0] = 0; 28 | uint64[] memory gasLimit = new uint64[](1); 29 | gasLimit[0] = 0; 30 | BATCH_CONTRACT.batchAll(toAddress, value, callData, gasLimit); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/contracts/src/StakingAttacker.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | import "../../../precompiles/parachain-staking/StakingInterface.sol"; 5 | 6 | contract StakingAttacker { 7 | /// The collator (ALITH) that this contract will benefit with delegations 8 | address public target = 0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac; 9 | 10 | /// Take advantage of the EVMs reversion logic and the fact that it doesn't extend to 11 | /// Substrate storage to score free delegations for a collator candidate of our choosing 12 | function score_a_free_delegation() public payable { 13 | // We delegate our target collator with all the tokens provided 14 | PARACHAIN_STAKING_CONTRACT.delegateWithAutoCompound(target, msg.value, 0, 1, 0, 1); 15 | revert( 16 | "By reverting this transaction, we return the eth to the caller" 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/contracts/src/StateOverrideTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.0; 3 | 4 | /// @notice Smart contract to help test state override 5 | contract StateOverrideTest { 6 | /// @notice The maxmium allowed value 7 | uint256 public MAX_ALLOWED = 3; 8 | uint256 public availableFunds; 9 | mapping(address => mapping(address => uint256)) public allowance; 10 | 11 | address owner; 12 | 13 | constructor(uint256 intialAmount) payable { 14 | owner = msg.sender; 15 | availableFunds = intialAmount; 16 | } 17 | 18 | function getBalance() external view returns (uint256) { 19 | return address(this).balance; 20 | } 21 | 22 | function getSenderBalance() external view returns (uint256) { 23 | return address(msg.sender).balance; 24 | } 25 | 26 | function getAllowance(address from, address who) 27 | external 28 | view 29 | returns (uint256) 30 | { 31 | return allowance[from][who]; 32 | } 33 | 34 | function setAllowance(address who, uint256 amount) external { 35 | allowance[address(msg.sender)][who] = amount; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/contracts/src/StaticSubcall.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | import "../../../precompiles/randomness/Randomness.sol"; 5 | 6 | contract StaticSubcall { 7 | Randomness public randomness = 8 | Randomness(0x0000000000000000000000000000000000000809); 9 | 10 | function staticFulfill(uint id) external { 11 | (bool success, bytes memory result) = address(this).staticcall( 12 | abi.encodeWithSelector(StaticSubcall.innerFulfill.selector, id) 13 | ); 14 | 15 | require(success, string(result)); 16 | } 17 | 18 | function innerFulfill(uint id) external { 19 | randomness.fulfillRequest(id); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/contracts/src/Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract Storage { 4 | mapping(uint256 => uint256) public map; 5 | 6 | function store(uint256 lower, uint256 upper) public { 7 | require(upper > lower, "Upper bound must be greater than or equal to lower bound"); 8 | for(uint i = lower; i < upper; i++) { 9 | map[i] = i; 10 | } 11 | } 12 | 13 | function retrieve(uint256 index) public view returns (uint256) { 14 | return map[index]; 15 | } 16 | 17 | function destroy() public { 18 | selfdestruct(payable(msg.sender)); 19 | } 20 | } -------------------------------------------------------------------------------- /test/contracts/src/StorageCleaner.sol: -------------------------------------------------------------------------------- 1 | /// SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | /// @dev The Storage Cleaner Precompile contract's address. 5 | address constant STORAGE_CLEANER_PRECOMPILE_ADDRESS = 0x0000000000000000000000000000000000000403; 6 | 7 | /// @dev The Storage Cleaner Precompile contract's instance. 8 | StorageCleaner constant STORAGE_CLEANER_PRECOMPILE_CONTRACT = StorageCleaner( 9 | STORAGE_CLEANER_PRECOMPILE_ADDRESS 10 | ); 11 | 12 | /// @title Storage Cleaner Precompile Interface 13 | /// @dev Interface for interacting with the Storage Cleaner precompile 14 | /// @custom:address 0x0000000000000000000000000000000000000403 15 | interface StorageCleaner { 16 | /// @dev Cleans storage entries based on the provided keys. 17 | /// @param contracts The addresses of the contracts to clean storage for. 18 | /// @param limit The maximum number of entries to clean in a single call. 19 | function clearSuicidedStorage( 20 | address[] calldata contracts, 21 | uint64 limit 22 | ) external; 23 | } 24 | -------------------------------------------------------------------------------- /test/contracts/src/StorageLoop.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity >=0.8.2 <0.9.0; 3 | 4 | contract StorageLoop { 5 | mapping(uint256 => uint256) public map; 6 | mapping(uint256 => uint256) public map2; 7 | 8 | function store(uint16 n) public { 9 | for (uint16 i = 0; i < n; i++) { 10 | map[i] = i + 1; 11 | } 12 | } 13 | 14 | function store2(uint256 i) public { 15 | map2[i] = i; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/contracts/src/SubCallOOG.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity >=0.8.3; 3 | 4 | interface IBloatedContract { 5 | function doSomething() external; 6 | } 7 | 8 | interface ILooper { 9 | function incrementalLoop(uint256 n) external; 10 | } 11 | 12 | contract SubCallOOG { 13 | event SubCallSucceed(); 14 | event SubCallFail(); 15 | 16 | function subCallPov(address[] memory addresses) public { 17 | for (uint256 i = 0; i < addresses.length; i++) { 18 | try IBloatedContract(addresses[i]).doSomething() { 19 | emit SubCallSucceed(); 20 | } catch (bytes memory) { 21 | emit SubCallFail(); 22 | } 23 | } 24 | } 25 | 26 | function subCallLooper(address target, uint256 n) public { 27 | try ILooper(target).incrementalLoop(n) { 28 | emit SubCallSucceed(); 29 | } catch (bytes memory) { 30 | emit SubCallFail(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/contracts/src/dancun/ProxySuicide.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-only 2 | pragma solidity ^0.8.24; 3 | 4 | contract ProxyDeployer { 5 | event ContractDestroyed(address destroyedAddress); 6 | 7 | // Function to deploy a new Suicide contract 8 | function deployAndDestroy(address target) public { 9 | Suicide newContract = new Suicide(); 10 | newContract.destroy(target); 11 | emit ContractDestroyed(address(newContract)); 12 | } 13 | 14 | } 15 | 16 | contract Suicide { 17 | constructor() payable { 18 | } 19 | 20 | function destroy(address target) public { 21 | selfdestruct(payable(target)); 22 | } 23 | } -------------------------------------------------------------------------------- /test/contracts/src/wormhole/Structs.sol: -------------------------------------------------------------------------------- 1 | // contracts/Structs.sol 2 | // skip-compilation 3 | // SPDX-License-Identifier: Apache 2 4 | 5 | pragma solidity ^0.8.0; 6 | 7 | interface Structs { 8 | struct Provider { 9 | uint16 chainId; 10 | uint16 governanceChainId; 11 | bytes32 governanceContract; 12 | } 13 | 14 | struct GuardianSet { 15 | address[] keys; 16 | uint32 expirationTime; 17 | } 18 | 19 | struct Signature { 20 | bytes32 r; 21 | bytes32 s; 22 | uint8 v; 23 | uint8 guardianIndex; 24 | } 25 | 26 | struct VM { 27 | uint8 version; 28 | uint32 timestamp; 29 | uint32 nonce; 30 | uint16 emitterChainId; 31 | bytes32 emitterAddress; 32 | uint64 sequence; 33 | uint8 consistencyLevel; 34 | bytes payload; 35 | uint32 guardianSetIndex; 36 | Signature[] signatures; 37 | bytes32 hash; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/contracts/src/wormhole/Wormhole.sol: -------------------------------------------------------------------------------- 1 | // contracts/Wormhole.sol 2 | // SPDX-License-Identifier: Apache 2 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; 7 | 8 | contract Wormhole is ERC1967Proxy { 9 | constructor (address setup, bytes memory initData) ERC1967Proxy( 10 | setup, 11 | initData 12 | ) { } 13 | } -------------------------------------------------------------------------------- /test/contracts/src/wormhole/bridge/BridgeImplementation.sol: -------------------------------------------------------------------------------- 1 | // contracts/Implementation.sol 2 | // SPDX-License-Identifier: Apache 2 3 | 4 | pragma solidity ^0.8.0; 5 | pragma experimental ABIEncoderV2; 6 | 7 | import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; 8 | 9 | import "./Bridge.sol"; 10 | 11 | 12 | contract BridgeImplementation is Bridge { 13 | // Beacon getter for the token contracts 14 | function implementation() public view returns (address) { 15 | return tokenImplementation(); 16 | } 17 | 18 | function initialize() initializer public virtual { 19 | // this function needs to be exposed for an upgrade to pass 20 | } 21 | 22 | modifier initializer() { 23 | address impl = ERC1967Upgrade._getImplementation(); 24 | 25 | require( 26 | !isInitialized(impl), 27 | "already initialized" 28 | ); 29 | 30 | setInitialized(impl); 31 | 32 | _; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/contracts/src/wormhole/bridge/BridgeSetup.sol: -------------------------------------------------------------------------------- 1 | // contracts/BridgeSetup.sol 2 | // SPDX-License-Identifier: Apache 2 3 | 4 | pragma solidity ^0.8.0; 5 | pragma experimental ABIEncoderV2; 6 | 7 | import "./BridgeGovernance.sol"; 8 | 9 | import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; 10 | 11 | contract BridgeSetup is BridgeSetters, ERC1967Upgrade { 12 | function setup( 13 | address implementation, 14 | uint16 chainId, 15 | address wormhole, 16 | uint16 governanceChainId, 17 | bytes32 governanceContract, 18 | address tokenImplementation, 19 | address WETH, 20 | uint8 finality, 21 | uint256 evmChainId 22 | ) public { 23 | setChainId(chainId); 24 | 25 | setWormhole(wormhole); 26 | 27 | setGovernanceChainId(governanceChainId); 28 | setGovernanceContract(governanceContract); 29 | 30 | setTokenImplementation(tokenImplementation); 31 | 32 | setWETH(WETH); 33 | 34 | setFinality(finality); 35 | 36 | setEvmChainId(evmChainId); 37 | 38 | _upgradeTo(implementation); 39 | 40 | // See https://github.com/wormhole-foundation/wormhole/issues/1930 for 41 | // why we set this here 42 | setInitialized(implementation); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test/contracts/src/wormhole/bridge/TokenBridge.sol: -------------------------------------------------------------------------------- 1 | // contracts/Wormhole.sol 2 | // SPDX-License-Identifier: Apache 2 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; 7 | 8 | contract TokenBridge is ERC1967Proxy { 9 | constructor (address implementation, bytes memory initData) 10 | ERC1967Proxy( 11 | implementation, 12 | initData 13 | ) 14 | {} 15 | } -------------------------------------------------------------------------------- /test/contracts/src/wormhole/bridge/interfaces/IWETH.sol: -------------------------------------------------------------------------------- 1 | // contracts/Bridge.sol 2 | // skip-compilation 3 | // SPDX-License-Identifier: Apache 2 4 | 5 | pragma solidity ^0.8.0; 6 | 7 | import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; 8 | 9 | interface IWETH is IERC20 { 10 | function deposit() external payable; 11 | 12 | function withdraw(uint amount) external; 13 | } 14 | -------------------------------------------------------------------------------- /test/contracts/src/wormhole/bridge/token/Token.sol: -------------------------------------------------------------------------------- 1 | // contracts/Structs.sol 2 | // SPDX-License-Identifier: Apache 2 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; 7 | 8 | contract BridgeToken is BeaconProxy { 9 | constructor(address beacon, bytes memory data) BeaconProxy(beacon, data) {} 10 | } 11 | -------------------------------------------------------------------------------- /test/helpers/accounts.ts: -------------------------------------------------------------------------------- 1 | import type { DevModeContext } from "@moonwall/cli"; 2 | import { 3 | GLMR, 4 | type KeyringPair, 5 | MIN_GLMR_STAKING, 6 | alith, 7 | generateKeyringPair, 8 | } from "@moonwall/util"; 9 | 10 | export async function createAccounts( 11 | context: DevModeContext, 12 | maxAccounts: number, 13 | amount: bigint = MIN_GLMR_STAKING + 1n * GLMR 14 | ): Promise { 15 | const randomAccounts = new Array(Number(maxAccounts)).fill(0).map(() => generateKeyringPair()); 16 | 17 | let alithNonce = await context 18 | .viem() 19 | .getTransactionCount({ address: alith.address as `0x${string}` }); 20 | await context.createBlock( 21 | randomAccounts.map((randomCandidate) => 22 | context 23 | .polkadotJs() 24 | .tx.sudo.sudo( 25 | context.polkadotJs().tx.balances.forceSetBalance(randomCandidate.address, amount) 26 | ) 27 | .signAsync(alith, { nonce: alithNonce++ }) 28 | ), 29 | { allowFailures: false } 30 | ); 31 | 32 | return randomAccounts; 33 | } 34 | -------------------------------------------------------------------------------- /test/helpers/balances.ts: -------------------------------------------------------------------------------- 1 | import { type DevModeContext, expect } from "@moonwall/cli"; 2 | 3 | export async function fundAccount(account: `0x${string}`, amount: bigint, context: DevModeContext) { 4 | await context.createBlock(context.polkadotJs().tx.balances.transferAllowDeath(account, amount), { 5 | allowFailures: false, 6 | }); 7 | 8 | const balance = (await context.polkadotJs().query.system.account(account)).data.free.toBigInt(); 9 | expect(balance >= amount).to.be.true; 10 | } 11 | 12 | export async function getReservedBalance(account: `0x${string}`, context: DevModeContext) { 13 | return (await context.polkadotJs().query.system.account(account)).data.reserved.toBigInt(); 14 | } 15 | 16 | export async function getFreeBalance(account: `0x${string}`, context: DevModeContext) { 17 | return (await context.polkadotJs().query.system.account(account)).data.free.toBigInt(); 18 | } 19 | -------------------------------------------------------------------------------- /test/helpers/crowdloan.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import type { DevModeContext } from "@moonwall/cli"; 3 | import { VESTING_PERIOD } from "./constants.js"; 4 | 5 | export async function calculate_vested_amount( 6 | totalReward: bigint, 7 | initialPayment: bigint, 8 | numberOfBlocks: bigint 9 | ) { 10 | const amountToVest = totalReward - initialPayment; 11 | // On average a parachain only gets a candidate into every other relay chain block. 12 | // In the dev service, where the relay block number is mocked, we get exactly two relay blocks. 13 | const elapsedRelayBlocks = numberOfBlocks * 2n; 14 | const amountForBlocks = (amountToVest * elapsedRelayBlocks) / VESTING_PERIOD; 15 | const shouldHaveVested = initialPayment + amountForBlocks; 16 | return shouldHaveVested; 17 | } 18 | 19 | // Return the unwrapped accountsPayable or null otherwise 20 | export const getAccountPayable = async ( 21 | context: DevModeContext, 22 | address: string 23 | ): Promise<{ 24 | totalReward: any; 25 | claimedReward: any; 26 | contributedRelayAddresses: any; 27 | } | null> => { 28 | const accountsPayable = await context 29 | .polkadotJs() 30 | .query.crowdloanRewards.accountsPayable(address); 31 | return accountsPayable.unwrapOr(null); 32 | }; 33 | -------------------------------------------------------------------------------- /test/helpers/fees.ts: -------------------------------------------------------------------------------- 1 | import { BN } from "@polkadot/util"; 2 | 3 | /// Recreation of fees.ration(burn_part, treasury_part) 4 | export const split = (value: BN, part1: BN, part2: BN): [BN, BN] => { 5 | const total = part1.add(part2); 6 | if (total.eq(new BN(0)) || value.eq(new BN(0))) { 7 | return [new BN(0), new BN(0)]; 8 | } 9 | const part1BN = value.mul(part1).div(total); 10 | const part2BN = value.sub(part1BN); 11 | return [part1BN, part2BN]; 12 | }; 13 | 14 | export const calculateFeePortions = ( 15 | feesTreasuryProportion: bigint, 16 | fees: bigint 17 | ): { 18 | burnt: bigint; 19 | treasury: bigint; 20 | } => { 21 | const feesBN = new BN(fees.toString()); 22 | const treasuryPartBN = new BN(feesTreasuryProportion.toString()); 23 | const burntPartBN = new BN(1e9).sub(treasuryPartBN); 24 | 25 | const [burntBN, treasuryBN] = split(feesBN, burntPartBN, treasuryPartBN); 26 | 27 | return { 28 | burnt: BigInt(burntBN.toString()), 29 | treasury: BigInt(treasuryBN.toString()), 30 | }; 31 | }; 32 | -------------------------------------------------------------------------------- /test/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accounts"; 2 | export * from "./assets"; 3 | export * from "./balances"; 4 | export * from "./block"; 5 | export * from "./common"; 6 | export * from "./constants"; 7 | export * from "./contracts"; 8 | export * from "./crowdloan"; 9 | export * from "./eth-transactions"; 10 | export * from "./expect"; 11 | export * from "./foreign-chains"; 12 | export * from "./modexp"; 13 | export * from "./pallets"; 14 | export * from "./precompile-contract-calls"; 15 | export * from "./precompiles"; 16 | export * from "./providers"; 17 | export * from "./randomness"; 18 | export * from "./referenda"; 19 | export * from "./round"; 20 | export * from "./shortfalls"; 21 | export * from "./staking"; 22 | export * from "./storageQueries"; 23 | export * from "./tracing-txns"; 24 | export * from "./transactions"; 25 | export * from "./voting"; 26 | export * from "./wormhole"; 27 | export * from "./xcm"; 28 | export * from "./tracingFns"; 29 | export * from "./fees.ts"; 30 | export * from "./parameters.ts"; 31 | -------------------------------------------------------------------------------- /test/helpers/pallets.ts: -------------------------------------------------------------------------------- 1 | import type { DevModeContext } from "@moonwall/cli"; 2 | 3 | export const getPalletIndex = async (name: string, context: DevModeContext): Promise => { 4 | const metadata = await context.polkadotJs().rpc.state.getMetadata(); 5 | return metadata.asLatest.pallets 6 | .find(({ name: palletName }) => palletName.toString() === name)! 7 | .index.toNumber(); 8 | }; 9 | -------------------------------------------------------------------------------- /test/helpers/parameters.ts: -------------------------------------------------------------------------------- 1 | import type { DevModeContext } from "@moonwall/cli"; 2 | 3 | export const getFeesTreasuryProportion = async (context: DevModeContext): Promise => { 4 | const parameter = await context.polkadotJs().query.parameters.parameters({ 5 | RuntimeConfig: "FeesTreasuryProportion", 6 | }); 7 | 8 | // 20% default value 9 | let feesTreasuryProportion = 200_000_000n; 10 | if (parameter.isSome) { 11 | feesTreasuryProportion = parameter.value.asRuntimeConfig.asFeesTreasuryProportion.toBigInt(); 12 | } 13 | return feesTreasuryProportion; 14 | }; 15 | -------------------------------------------------------------------------------- /test/helpers/providers.ts: -------------------------------------------------------------------------------- 1 | import type { LogsSubscription } from "node_modules/web3/lib/types/eth.exports.js"; 2 | import type { Log, Web3 } from "web3"; 3 | 4 | export async function web3SubscribeHistoricalLogs( 5 | web3: Web3, 6 | listenPeriodMs: number, 7 | filter?: object 8 | ) { 9 | const eventLogs: any[] = []; 10 | const sub = await web3.eth.subscribe("logs", filter); 11 | 12 | await new Promise(async (resolve, reject) => { 13 | const timeoutId = setTimeout(async () => { 14 | await sub.unsubscribe(); 15 | resolve("finished"); 16 | }, listenPeriodMs); 17 | 18 | sub.on("data", async (event) => { 19 | eventLogs.push(event); 20 | }); 21 | 22 | sub.on("error", (error) => { 23 | clearTimeout(timeoutId); 24 | console.log("Error when subscribing to New block header: ", error); 25 | sub.unsubscribe().catch((err) => console.error("Error unsubscribing:", err)); 26 | reject(error); 27 | }); 28 | }); 29 | 30 | return eventLogs; 31 | } 32 | 33 | export async function openWeb3LogsSub(web3: Web3, filter?: object): Promise { 34 | return await web3.eth.subscribe("logs", filter); 35 | } 36 | 37 | export async function onceWeb3Log(logSub: LogsSubscription): Promise { 38 | return new Promise((resolve) => { 39 | logSub.once("data", resolve); 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /test/helpers/staking.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import type { DevModeContext } from "@moonwall/cli"; 3 | 4 | export async function getRewardedAndCompoundedEvents(context: DevModeContext, blockHash: string) { 5 | return ( 6 | await (await context.polkadotJs().at(blockHash)).query.system.events() 7 | ).reduce( 8 | (acc, event: any) => { 9 | if (context.polkadotJs().events.parachainStaking.Rewarded.is(event.event)) { 10 | acc.rewarded.push({ 11 | account: event.event.data[0].toString(), 12 | amount: event.event.data[1], 13 | }); 14 | } else if (context.polkadotJs().events.parachainStaking.Compounded.is(event.event)) { 15 | acc.compounded.push({ 16 | candidate: event.event.data[0].toString(), 17 | delegator: event.event.data[1].toString(), 18 | amount: event.event.data[2], 19 | }); 20 | } 21 | return acc; 22 | }, 23 | { rewarded: [], compounded: [] } 24 | ); 25 | } 26 | 27 | interface StakingEvents { 28 | rewarded: { account: string; amount: any }[]; 29 | compounded: { candidate: string; delegator: string; amount: any }[]; 30 | } 31 | -------------------------------------------------------------------------------- /test/suites/dev/common/test-block/test-block-2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | 4 | describeSuite({ 5 | id: "D010402", 6 | title: "Block creation - suite 2", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it, log }) => { 9 | beforeAll(async () => { 10 | await context.createBlock(); 11 | await context.createBlock(); 12 | }); 13 | 14 | it({ 15 | id: "T01", 16 | title: "should be at block 2", 17 | test: async function () { 18 | expect(await context.viem().getBlockNumber()).toBe(2n); 19 | }, 20 | }); 21 | 22 | it({ 23 | id: "T02", 24 | title: "should include previous block hash as parent", 25 | test: async function () { 26 | const block = await context.viem().getBlock({ blockTag: "latest" }); 27 | const previousBlock = await context.viem().getBlock({ blockNumber: 1n }); 28 | expect(block.hash).to.not.equal(previousBlock.hash); 29 | expect(block.parentHash).to.equal(previousBlock.hash); 30 | }, 31 | }); 32 | }, 33 | }); 34 | -------------------------------------------------------------------------------- /test/suites/dev/common/test-precompile/test-precompile-author-mapping-keys8.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { FAITH_ADDRESS, FAITH_PRIVATE_KEY, getBlockExtrinsic } from "@moonwall/util"; 4 | import { setAuthorMappingKeysViaPrecompile } from "../../../../helpers"; 5 | 6 | describeSuite({ 7 | id: "D012817", 8 | title: "Precompile Author Mapping - Set Faith mapping with 0 keys", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it, log }) => { 11 | it({ 12 | id: "T01", 13 | title: "should revert", 14 | test: async function () { 15 | await setAuthorMappingKeysViaPrecompile( 16 | context, 17 | FAITH_ADDRESS, 18 | FAITH_PRIVATE_KEY, 19 | "0x", 20 | true 21 | ); 22 | const { extrinsic, events, resultEvent } = await getBlockExtrinsic( 23 | context.polkadotJs(), 24 | await context.polkadotJs().rpc.chain.getBlockHash(), 25 | "ethereum", 26 | "transact" 27 | ); 28 | 29 | expect(extrinsic).to.exist; 30 | expect(resultEvent?.method).to.equal("ExtrinsicSuccess"); 31 | expect( 32 | (events.find((e) => e.section === "ethereum" && e.method === "Executed")?.data[3] as any) 33 | .isRevert 34 | ).to.be.true; 35 | }, 36 | }); 37 | }, 38 | }); 39 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-assets/test-foreign-assets-balances.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import "@moonbeam-network/api-augment/moonbase"; 3 | import { describeSuite, expect } from "@moonwall/cli"; 4 | import { ALITH_ADDRESS, alith } from "@moonwall/util"; 5 | import { 6 | ARBITRARY_ASSET_ID, 7 | RELAY_SOURCE_LOCATION_V4, 8 | foreignAssetBalance, 9 | mockAssetBalance, 10 | registerForeignAsset, 11 | relayAssetMetadata, 12 | } from "../../../../helpers"; 13 | 14 | describeSuite({ 15 | id: "D010109", 16 | title: "XCM - Create new foreign asset", 17 | foundationMethods: "dev", 18 | testCases: ({ context, it, log }) => { 19 | it({ 20 | id: "T01", 21 | title: "should check balances consstency", 22 | test: async function () { 23 | const someBalance = 100_000_000_000_000n; 24 | const assetLocation = RELAY_SOURCE_LOCATION_V4; 25 | const assetId = ARBITRARY_ASSET_ID; 26 | 27 | // Register the asset 28 | await registerForeignAsset(context, assetId, assetLocation, relayAssetMetadata); 29 | // Mock asset balance 30 | await mockAssetBalance(context, someBalance, assetId, alith, ALITH_ADDRESS); 31 | 32 | const newBalance = await foreignAssetBalance(context, assetId, ALITH_ADDRESS); 33 | expect(newBalance).toBe(someBalance); 34 | }, 35 | }); 36 | }, 37 | }); 38 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-author/test-author-non-author-clearing.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { ALITH_ADDRESS, baltathar, BALTATHAR_SESSION_ADDRESS } from "@moonwall/util"; 4 | import { getMappingInfo } from "../../../../helpers"; 5 | 6 | describeSuite({ 7 | id: "D010205", 8 | title: "Author Mapping - non author clearing", 9 | foundationMethods: "dev", 10 | testCases: ({ context, log, it }) => { 11 | it({ 12 | id: "T01", 13 | title: "should not succeed in clearing an association for a non-author", 14 | test: async function () { 15 | const api = context.polkadotJs(); 16 | await context.createBlock(api.tx.authorMapping.addAssociation(BALTATHAR_SESSION_ADDRESS)); 17 | expect((await getMappingInfo(context, BALTATHAR_SESSION_ADDRESS))!.account).to.eq( 18 | ALITH_ADDRESS 19 | ); 20 | 21 | const { result } = await context.createBlock( 22 | api.tx.authorMapping.clearAssociation(BALTATHAR_SESSION_ADDRESS), 23 | { allowFailures: true, signer: baltathar } 24 | ); 25 | 26 | expect(result?.events.length === 4); 27 | expect(api.events.system.ExtrinsicFailed.is(result?.events[4].event)).to.be.true; 28 | }, 29 | }); 30 | }, 31 | }); 32 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-author/test-author-unregistered-clear.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { BALTATHAR_SESSION_ADDRESS } from "@moonwall/util"; 3 | import { expect, describeSuite } from "@moonwall/cli"; 4 | import { getMappingInfo } from "../../../../helpers"; 5 | 6 | describeSuite({ 7 | id: "D010213", 8 | title: "Author Mapping - unregistered author cannot clear association", 9 | foundationMethods: "dev", 10 | testCases: ({ context, log, it }) => { 11 | it({ 12 | id: "", 13 | title: "should not succeed in clearing an association for an unregistered author", 14 | test: async function () { 15 | expect(await getMappingInfo(context, BALTATHAR_SESSION_ADDRESS)).toBeUndefined(); 16 | const api = context.polkadotJs(); 17 | const { result } = await context.createBlock( 18 | api.tx.authorMapping.clearAssociation(BALTATHAR_SESSION_ADDRESS), 19 | { allowFailures: true } 20 | ); 21 | expect(result?.events.length === 6); 22 | expect(api.events.system.NewAccount.is(result?.events[2].event)).to.be.true; 23 | expect(api.events.balances.Endowed.is(result?.events[3].event)).to.be.true; 24 | expect(api.events.system.ExtrinsicFailed.is(result?.events[6].event)).to.be.true; 25 | }, 26 | }); 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-author/test-author-unregistered-rotation.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { BALTATHAR_SESSION_ADDRESS, CHARLETH_SESSION_ADDRESS, alith } from "@moonwall/util"; 4 | import { getMappingInfo } from "../../../../helpers"; 5 | 6 | describeSuite({ 7 | id: "D010214", 8 | title: "Author Mapping - unregistered cannot rotate", 9 | foundationMethods: "dev", 10 | testCases: ({ context, log, it }) => { 11 | it({ 12 | id: "T01", 13 | title: "should fail rotating account ids if not registered", 14 | test: async function () { 15 | await context.createBlock( 16 | context 17 | .polkadotJs() 18 | .tx.authorMapping.updateAssociation( 19 | BALTATHAR_SESSION_ADDRESS, 20 | CHARLETH_SESSION_ADDRESS 21 | ), 22 | { allowFailures: true, signer: alith } 23 | ); 24 | expect(await getMappingInfo(context, BALTATHAR_SESSION_ADDRESS)).toBeUndefined(); 25 | expect(await getMappingInfo(context, CHARLETH_SESSION_ADDRESS)).toBeUndefined(); 26 | 27 | await context.createBlock(); 28 | }, 29 | }); 30 | }, 31 | }); 32 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-balance/test-balance-genesis.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { expect, describeSuite } from "@moonwall/cli"; 3 | import { 4 | ALITH_ADDRESS, 5 | ALITH_GENESIS_FREE_BALANCE, 6 | ALITH_GENESIS_RESERVE_BALANCE, 7 | } from "@moonwall/util"; 8 | import { ALITH_GENESIS_TRANSFERABLE_BALANCE } from "../../../../helpers"; 9 | 10 | describeSuite({ 11 | id: "D010303", 12 | title: "Balance genesis", 13 | foundationMethods: "dev", 14 | testCases: ({ context, it }) => { 15 | it({ 16 | id: "T01", 17 | title: "should be accessible through web3", 18 | test: async function () { 19 | expect(await context.viem().getBalance({ address: ALITH_ADDRESS })).toBe( 20 | ALITH_GENESIS_TRANSFERABLE_BALANCE 21 | ); 22 | }, 23 | }); 24 | 25 | it({ 26 | id: "T02", 27 | title: "should be accessible through polkadotJs", 28 | test: async function () { 29 | const genesisHash = await context.polkadotJs().rpc.chain.getBlockHash(0); 30 | const account = await (await context.polkadotJs().at(genesisHash)).query.system.account( 31 | ALITH_ADDRESS 32 | ); 33 | expect(account.data.free.toBigInt()).toBe(ALITH_GENESIS_FREE_BALANCE); 34 | expect(account.data.reserved.toBigInt()).toBe(ALITH_GENESIS_RESERVE_BALANCE); 35 | }, 36 | }); 37 | }, 38 | }); 39 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-contract/test-eip1153.ts: -------------------------------------------------------------------------------- 1 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 2 | 3 | describeSuite({ 4 | id: "D010611", 5 | title: "EIP-1153 - Transient storage", 6 | foundationMethods: "dev", 7 | testCases: ({ context, it, log }) => { 8 | let contract: `0x${string}`; 9 | 10 | beforeAll(async function () { 11 | const { contractAddress } = await context.deployContract!("ReentrancyProtected", { 12 | gas: 1000000n, 13 | }); 14 | contract = contractAddress; 15 | }); 16 | 17 | it({ 18 | id: "T01", 19 | title: "should detect reentrant call and revert", 20 | test: async function () { 21 | try { 22 | await context.writeContract!({ 23 | contractName: "ReentrancyProtected", 24 | contractAddress: contract, 25 | functionName: "test", 26 | }); 27 | } catch (error) { 28 | return expect(error.details).to.be.eq( 29 | "VM Exception while processing transaction: revert Reentrant call detected." 30 | ); 31 | } 32 | expect.fail("Expected the contract call to fail"); 33 | }, 34 | }); 35 | }, 36 | }); 37 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-conviction-voting/test-conviction-delegate-weight-fit.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | import { type KeyringPair, alith } from "@moonwall/util"; 4 | import { createAccounts, expectSubstrateEvents } from "../../../../helpers"; 5 | 6 | describeSuite({ 7 | id: "D010702", 8 | title: "Conviction Voting - Delegate Weight Fit", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it }) => { 11 | let randomAccounts: KeyringPair[] = []; 12 | beforeAll(async () => { 13 | randomAccounts = await createAccounts(context, 100); 14 | }); 15 | 16 | it({ 17 | id: "T01", 18 | title: "should delegate at least 25 txs in a block", 19 | test: async function () { 20 | const blockResult = await context.createBlock( 21 | randomAccounts.map((account) => 22 | context 23 | .polkadotJs() 24 | .tx.convictionVoting.delegate(1, alith.address, 1, 1000000000000000000n) 25 | .signAsync(account) 26 | ) 27 | ); 28 | 29 | const delegatedEvents = expectSubstrateEvents(blockResult, "convictionVoting", "Delegated"); 30 | expect(delegatedEvents.length).to.be.greaterThanOrEqual(25); 31 | }, 32 | }); 33 | }, 34 | }); 35 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-eth-fee/test-eth-paysFee.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, extractInfo, expect, TransactionTypes } from "@moonwall/cli"; 3 | import { BALTATHAR_ADDRESS, GLMR, createRawTransfer } from "@moonwall/util"; 4 | 5 | // We use ethers library in this test as apparently web3js's types are not fully EIP-1559 6 | // compliant yet. 7 | describeSuite({ 8 | id: "D011002", 9 | title: "Ethereum - PaysFee", 10 | foundationMethods: "dev", 11 | testCases: ({ context, it, log }) => { 12 | for (const txnType of TransactionTypes) { 13 | it({ 14 | id: `T0${TransactionTypes.indexOf(txnType) + 1}`, 15 | title: `should be false for successful ethereum ${txnType} transactions`, 16 | test: async function () { 17 | const { result } = await context.createBlock( 18 | await createRawTransfer(context, BALTATHAR_ADDRESS, GLMR, { type: txnType }) 19 | ); 20 | const info = extractInfo(result?.events)!; 21 | expect(info).to.not.be.empty; 22 | expect(info.paysFee.isYes, "Transaction should be marked as paysFees === no").to.be.false; 23 | }, 24 | }); 25 | } 26 | }, 27 | }); 28 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-eth-rpc/test-eth-rpc-deprecated.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect, customDevRpcRequest } from "@moonwall/cli"; 3 | 4 | describeSuite({ 5 | id: "D011202", 6 | title: "Deprecated RPC", 7 | foundationMethods: "dev", 8 | testCases: ({ it }) => { 9 | const deprecatedMethods = [ 10 | { method: "eth_getCompilers", params: [] }, 11 | { method: "eth_compileLLL", params: ["(returnlll (suicide (caller)))"] }, 12 | { 13 | method: "eth_compileSolidity", 14 | params: ["contract test { function multiply(uint a) returns(uint d) {return a * 7;}}"], 15 | }, 16 | { method: "eth_compileSerpent", params: ["/* some serpent 🐍🐍🐍 */"] }, 17 | ]; 18 | 19 | for (const { method, params } of deprecatedMethods) { 20 | it({ 21 | id: `T0${deprecatedMethods.findIndex((item) => item.method === method) + 1}`, 22 | title: `${method} should be mark as not found`, 23 | test: async function () { 24 | expect(async () => await customDevRpcRequest(method, params)).rejects.toThrowError( 25 | "Method not found" 26 | ); 27 | }, 28 | }); 29 | } 30 | }, 31 | }); 32 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-eth-rpc/test-eth-rpc-tx-index.ts: -------------------------------------------------------------------------------- 1 | import { describeSuite, beforeAll, expect } from "@moonwall/cli"; 2 | import { BALTATHAR_ADDRESS, createRawTransfer } from "@moonwall/util"; 3 | 4 | describeSuite({ 5 | id: "D011206", 6 | title: "Transaction Index", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it, log }) => { 9 | beforeAll(async () => { 10 | await context.createBlock(createRawTransfer(context, BALTATHAR_ADDRESS, 0)); 11 | }); 12 | 13 | it({ 14 | id: "T01", 15 | title: "should get transaction by index", 16 | test: async function () { 17 | const block = 1n; 18 | const index = 0; 19 | const result = await context.viem().getTransaction({ blockNumber: block, index }); 20 | 21 | expect(result.transactionIndex).to.equal(index); 22 | }, 23 | }); 24 | it({ 25 | id: "T02", 26 | title: "should return out of bounds message", 27 | test: async function () { 28 | const block = 0n; 29 | const index = 0; 30 | 31 | expect( 32 | async () => await context.viem().getTransaction({ blockNumber: block, index }) 33 | ).rejects.toThrowError(`${index} is out of bounds`); 34 | }, 35 | }); 36 | }, 37 | }); 38 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-fees/test-fee-multiplier-genesis.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment/moonbase"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { ConstantStore } from "../../../../helpers"; 4 | 5 | describeSuite({ 6 | id: "D011601", 7 | title: "Genesis Fee Multiplier", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | it({ 11 | id: "T01", 12 | title: "should start with genesis value", 13 | test: async () => { 14 | const { specVersion } = await context.polkadotJs().consts.system.version; 15 | const GENESIS_BASE_FEE = ConstantStore(context).GENESIS_BASE_FEE.get( 16 | specVersion.toNumber() 17 | ); 18 | const initialValue = ( 19 | await context.polkadotJs().query.transactionPayment.nextFeeMultiplier() 20 | ).toBigInt(); 21 | expect(initialValue).to.equal(8_000_000_000_000_000_000n); 22 | 23 | const gasPrice = await context.viem().getGasPrice(); 24 | expect(gasPrice).to.eq(GENESIS_BASE_FEE); 25 | }, 26 | }); 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-filter/test-filter-api-pending.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { customDevRpcRequest, describeSuite, expect } from "@moonwall/cli"; 3 | import { fromHex } from "viem"; 4 | 5 | describeSuite({ 6 | id: "D011702", 7 | title: "Filter Pending Transaction API", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | it({ 11 | id: "T01", 12 | title: "should not be supported", 13 | // Looks like this is now supported 🎉 14 | test: async function () { 15 | const resp = await customDevRpcRequest("eth_newPendingTransactionFilter", []); 16 | expect(fromHex(resp, "bigint")).toBeGreaterThanOrEqual(0n); 17 | }, 18 | }); 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-gas/test-gas-contract-creation.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; 3 | import { ALITH_ADDRESS } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D011801", 7 | title: "Estimate Gas - Contract creation", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | it({ 11 | id: "T01", 12 | title: "should return contract creation gas cost", 13 | test: async function () { 14 | const { bytecode } = fetchCompiledContract("MultiplyBy7"); 15 | expect( 16 | await context.viem().estimateGas({ 17 | account: ALITH_ADDRESS, 18 | data: bytecode, 19 | }) 20 | ).to.equal(210541n); 21 | }, 22 | }); 23 | }, 24 | }); 25 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-node-rpc/test-node-rpc-peer.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { customDevRpcRequest, describeSuite, expect } from "@moonwall/cli"; 3 | 4 | describeSuite({ 5 | id: "D012401", 6 | title: "Node - RPC", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it }) => { 9 | it({ 10 | id: "T01", 11 | title: "should report peer count in hex", 12 | test: async function () { 13 | // this tests that the "net_peerCount" response comes back in hex and not decimal. 14 | // this seems a bit inconsistent amongst Ethereum APIs, but hex seems to be most common. 15 | 16 | // related: frontier commits 677548c and 78fb3bc 17 | const result = await customDevRpcRequest("net_peerCount", []); 18 | 19 | // TODO: this is really just testing that the result comes back as a string, not that it's 20 | // expressed in hex (as opposed to decimal) 21 | expect(result).to.be.equal("0x0"); 22 | expect(typeof result).to.be.equal("string"); 23 | }, 24 | }); 25 | }, 26 | }); 27 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-polkadot-js/test-polkadot-chain-info.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { customDevRpcRequest, describeSuite, expect } from "@moonwall/cli"; 3 | 4 | describeSuite({ 5 | id: "D012602", 6 | title: "Web3Api Information", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it, log }) => { 9 | it({ 10 | id: "T01", 11 | title: "should include client version", 12 | test: async function () { 13 | const version = (await customDevRpcRequest("web3_clientVersion", [])) as string; 14 | const specName = context.polkadotJs().runtimeVersion.specName.toString(); 15 | const specVersion = context.polkadotJs().runtimeVersion.specVersion.toString(); 16 | const implVersion = context.polkadotJs().runtimeVersion.implVersion.toString(); 17 | const expected = `${specName}/v${specVersion}.${implVersion}/fc-rpc-2.0.0-dev`; 18 | expect(version).toBe(expected); 19 | }, 20 | }); 21 | }, 22 | }); 23 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-blake2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | 3 | import { deployCreateCompiledContract, describeSuite } from "@moonwall/cli"; 4 | import { expectEVMResult } from "../../../../helpers"; 5 | 6 | import { createViemTransaction } from "@moonwall/util"; 7 | import { encodeFunctionData } from "viem"; 8 | 9 | describeSuite({ 10 | id: "D012823", 11 | title: "Precompiles - blake2", 12 | foundationMethods: "dev", 13 | testCases: ({ context, log, it }) => { 14 | it({ 15 | id: "T01", 16 | title: "should be accessible from a smart contract", 17 | test: async function () { 18 | const { abi } = await deployCreateCompiledContract(context, "HasherChecker"); 19 | 20 | // Execute the contract blake2 call 21 | const { result } = await context.createBlock( 22 | createViemTransaction(context, { 23 | data: encodeFunctionData({ 24 | abi, 25 | functionName: "blake2Check", 26 | }), 27 | }) 28 | ); 29 | 30 | expectEVMResult(result!.events, "Succeed"); 31 | }, 32 | }); 33 | }, 34 | }); 35 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-bn128add.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { deployCreateCompiledContract, describeSuite } from "@moonwall/cli"; 3 | import { createViemTransaction } from "@moonwall/util"; 4 | import { encodeFunctionData } from "viem"; 5 | import { expectEVMResult } from "../../../../helpers"; 6 | 7 | describeSuite({ 8 | id: "D012825", 9 | title: "Precompiles - bn128add", 10 | foundationMethods: "dev", 11 | testCases: ({ context, it, log }) => { 12 | it({ 13 | id: "T01", 14 | title: "should be accessible from a smart contract", 15 | test: async function () { 16 | const { abi, contractAddress } = await deployCreateCompiledContract( 17 | context, 18 | "HasherChecker" 19 | ); 20 | 21 | const { result } = await context.createBlock( 22 | createViemTransaction(context, { 23 | to: contractAddress, 24 | data: encodeFunctionData({ 25 | abi, 26 | functionName: "bn128AdditionCheck", 27 | }), 28 | }) 29 | ); 30 | 31 | expectEVMResult(result!.events, "Succeed"); 32 | }, 33 | }); 34 | }, 35 | }); 36 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-bn128mul.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { deployCreateCompiledContract, describeSuite } from "@moonwall/cli"; 3 | import { createViemTransaction } from "@moonwall/util"; 4 | import { encodeFunctionData } from "viem"; 5 | import { expectEVMResult } from "../../../../helpers"; 6 | 7 | describeSuite({ 8 | id: "D012826", 9 | title: "Precompiles - bn128mul", 10 | foundationMethods: "dev", 11 | testCases: ({ context, it, log }) => { 12 | it({ 13 | id: "T01", 14 | title: "should be accessible from a smart contract", 15 | test: async function () { 16 | const { abi, contractAddress } = await deployCreateCompiledContract( 17 | context, 18 | "HasherChecker" 19 | ); 20 | 21 | const { result } = await context.createBlock( 22 | createViemTransaction(context, { 23 | to: contractAddress, 24 | data: encodeFunctionData({ 25 | abi, 26 | functionName: "bn128MultiplyCheck", 27 | }), 28 | }) 29 | ); 30 | 31 | expectEVMResult(result!.events, "Succeed"); 32 | }, 33 | }); 34 | }, 35 | }); 36 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-bn128pairing.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { deployCreateCompiledContract, describeSuite } from "@moonwall/cli"; 3 | import { createViemTransaction } from "@moonwall/util"; 4 | import { encodeFunctionData } from "viem"; 5 | import { expectEVMResult } from "../../../../helpers"; 6 | 7 | describeSuite({ 8 | id: "D012827", 9 | title: "Precompiles - bn128pairing", 10 | foundationMethods: "dev", 11 | testCases: ({ context, it, log }) => { 12 | it({ 13 | id: "T01", 14 | title: "should be accessible from a smart contract", 15 | test: async function () { 16 | const { abi, contractAddress } = await deployCreateCompiledContract( 17 | context, 18 | "HasherChecker" 19 | ); 20 | 21 | const { result } = await context.createBlock( 22 | createViemTransaction(context, { 23 | to: contractAddress, 24 | data: encodeFunctionData({ 25 | abi, 26 | functionName: "bn128PairingCheck", 27 | }), 28 | }) 29 | ); 30 | 31 | expectEVMResult(result!.events, "Succeed"); 32 | }, 33 | }); 34 | }, 35 | }); 36 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-erc20-overflow.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { generateKeyringPair } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D012841", 7 | title: "Precompile ERC20 - Transfering through precompile", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | const randomAccount = generateKeyringPair(); 11 | it({ 12 | id: "T01", 13 | title: "should not allow overflowing the value", 14 | test: async function () { 15 | expect( 16 | async () => 17 | await context.writePrecompile!({ 18 | precompileName: "Batch", 19 | functionName: "batchAll", 20 | args: [ 21 | [randomAccount.address], 22 | [`${(2n ** 128n + 5_000_000_000_000_000_000n).toString()}`], 23 | [], 24 | [], 25 | ], 26 | }) 27 | ).rejects.toThrowError("evm error: OutOfFund"); 28 | }, 29 | }); 30 | }, 31 | }); 32 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-sha3fips.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | 4 | describeSuite({ 5 | id: "D012875", 6 | title: "Precompiles - sha3fips", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it, log }) => { 9 | // Test taken from https://github.com/binance-chain/bsc/pull/118 10 | it({ 11 | id: "T01", 12 | title: "sha3fips should be valid", 13 | test: async function () { 14 | expect( 15 | ( 16 | await context.viem().call({ 17 | to: "0x0000000000000000000000000000000000000400", 18 | data: ("0x0448250ebe88d77e0a12bcf530fe6a2cf1ac176945638d309b840d631940c93b78c2bd" + 19 | "6d16f227a8877e3f1604cd75b9c5a8ab0cac95174a8a0a0f8ea9e4c10bca") as `0x${string}`, 20 | }) 21 | ).data 22 | ).equals("0xc7647f7e251bf1bd70863c8693e93a4e77dd0c9a689073e987d51254317dc704"); 23 | }, 24 | }); 25 | }, 26 | }); 27 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-staking.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { ALITH_ADDRESS } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D012881", 7 | title: "Precompiles - Staking - Genesis", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | it({ 11 | id: "T01", 12 | title: "should include collator from the specs", 13 | test: async function () { 14 | expect( 15 | await context.readPrecompile!({ 16 | precompileName: "ParachainStaking", 17 | functionName: "isSelectedCandidate", 18 | args: [ALITH_ADDRESS], 19 | }) 20 | ).toBe(true); 21 | }, 22 | }); 23 | 24 | it({ 25 | id: "T02", 26 | title: "should have one collator", 27 | test: async function () { 28 | expect( 29 | await context.readPrecompile!({ 30 | precompileName: "ParachainStaking", 31 | functionName: "candidateCount", 32 | }) 33 | ).toBe(1n); 34 | }, 35 | }); 36 | }, 37 | }); 38 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-staking6.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | import { ALITH_ADDRESS, ETHAN_ADDRESS } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D012886", 7 | title: "Precompiles - Staking - AwardedPoints", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it }) => { 10 | beforeAll(async function () { 11 | await context.createBlock(); 12 | }); 13 | it({ 14 | id: "T01", 15 | title: "should get awarded points for ALITH", 16 | test: async function () { 17 | expect( 18 | await context.readPrecompile!({ 19 | precompileName: "ParachainStaking", 20 | functionName: "awardedPoints", 21 | args: [1, ALITH_ADDRESS], 22 | }) 23 | ).toBe(20); 24 | }, 25 | }); 26 | 27 | it({ 28 | id: "T02", 29 | title: "should get no awarded points for ETHAN", 30 | test: async function () { 31 | expect( 32 | await context.readPrecompile!({ 33 | precompileName: "ParachainStaking", 34 | functionName: "awardedPoints", 35 | args: [1, ETHAN_ADDRESS], 36 | }) 37 | ).toBe(0); 38 | }, 39 | }); 40 | }, 41 | }); 42 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-precompile/test-precompile-wormhole2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { expectEVMResult, extractRevertReason } from "../../../../helpers"; 4 | 5 | describeSuite({ 6 | id: "D012888", 7 | title: "Test GMP Killswitch", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | it({ 11 | id: "T01", 12 | title: "should fail with killswitch enabled by default", 13 | test: async function () { 14 | // payload should be irrelevant since the precompile will fail before attempting to decode 15 | const transferVAA = "deadbeef"; 16 | 17 | const rawTxn = await context.writePrecompile!({ 18 | precompileName: "Gmp", 19 | functionName: "wormholeTransferERC20", 20 | args: [transferVAA], 21 | gas: 500_000n, 22 | rawTxOnly: true, 23 | }); 24 | const result = await context.createBlock(rawTxn); 25 | 26 | expectEVMResult(result.result!.events, "Revert", "Reverted"); 27 | const revertReason = await extractRevertReason(context, result.result!.hash); 28 | expect(revertReason).to.contain("GMP Precompile is not enabled"); 29 | }, 30 | }); 31 | }, 32 | }); 33 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-randomness/test-randomness-babe-request3.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { GLMR, alith } from "@moonwall/util"; 4 | import { SIMPLE_SALT } from "../../../../helpers"; 5 | 6 | describeSuite({ 7 | id: "D013106", 8 | title: "Randomness Babe - Requesting a random number", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it, log }) => { 11 | it({ 12 | id: "T01", 13 | title: "should succeed for 100 random words", 14 | test: async function () { 15 | await context.writePrecompile!({ 16 | precompileName: "Randomness", 17 | functionName: "requestRelayBabeEpochRandomWords", 18 | args: [ 19 | alith.address, // refund address 20 | 1n * GLMR, // fee 21 | 120_000n, // gas limit 22 | SIMPLE_SALT, 23 | 100, // number of random words 24 | ], 25 | gas: 120_000n, 26 | }); 27 | await context.createBlock([], { signer: alith, allowFailures: false }); 28 | const randomnessRequests = await context.polkadotJs().query.randomness.requests.entries(); 29 | expect(randomnessRequests.length).to.equal(1); 30 | }, 31 | }); 32 | }, 33 | }); 34 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-randomness/test-randomness-vrf-lottery2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite } from "@moonwall/cli"; 3 | import { GLMR } from "@moonwall/util"; 4 | import { expectEVMResult, setupLotteryWithParticipants } from "../../../../helpers"; 5 | 6 | describeSuite({ 7 | id: "D013112", 8 | title: "Randomness VRF - Starting the Lottery Demo", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it, log }) => { 11 | let lotteryContract: `0x${string}`; 12 | 13 | beforeAll(async function () { 14 | lotteryContract = await setupLotteryWithParticipants(context, "VRF"); 15 | }); 16 | 17 | it({ 18 | id: "T01", 19 | title: "should be able to start", 20 | test: async function () { 21 | const rawTxn = await context.writeContract!({ 22 | contractName: "RandomnessLotteryDemo", 23 | contractAddress: lotteryContract, 24 | functionName: "startLottery", 25 | value: 1n * GLMR, 26 | gas: 300_000n, 27 | rawTxOnly: true, 28 | }); 29 | const { result } = await context.createBlock(rawTxn); 30 | expectEVMResult(result!.events, "Succeed"); 31 | }, 32 | }); 33 | }, 34 | }); 35 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-randomness/test-randomness-vrf-request.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment/moonbase"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { GLMR, alith } from "@moonwall/util"; 4 | import { SIMPLE_SALT } from "../../../../helpers"; 5 | 6 | describeSuite({ 7 | id: "D013117", 8 | title: "Randomness VRF - Requesting a random number", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it, log }) => { 11 | it({ 12 | id: "T01", 13 | title: "should be successful", 14 | test: async function () { 15 | const rawTxn = context.writePrecompile!({ 16 | precompileName: "Randomness", 17 | functionName: "requestLocalVRFRandomWords", 18 | args: [alith.address, 1n * GLMR, 100_000n, SIMPLE_SALT, 1, 2], 19 | gas: 120_000n, 20 | rawTxOnly: true, 21 | }); 22 | const { result } = await context.createBlock(rawTxn); 23 | 24 | expect(result!.successful).to.be.true; 25 | 26 | const randomnessRequests = await context.polkadotJs().query.randomness.requests.entries(); 27 | expect(randomnessRequests.length).to.equal(1); 28 | }, 29 | }); 30 | }, 31 | }); 32 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-receipt/test-receipt-revert.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { getAddress } from "viem"; 4 | 5 | describeSuite({ 6 | id: "D013201", 7 | title: "Receipt - Revert", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | it({ 11 | id: "T01", 12 | title: "should generate a receipt", 13 | test: async function () { 14 | const { hash } = await context.deployContract!("FailingConstructor", { gas: 300000n }); 15 | const receipt = await context.viem().getTransactionReceipt({ hash }); 16 | 17 | expect(receipt.status).toBe("reverted"); 18 | expect(receipt.blockNumber).toBe(1n); 19 | expect(getAddress(receipt.contractAddress!)).toBe( 20 | getAddress("0xc01Ee7f10EA4aF4673cFff62710E1D7792aBa8f3") 21 | ); 22 | expect(receipt.cumulativeGasUsed).toBe(54605n); 23 | expect(getAddress(receipt.from!)).toBe( 24 | getAddress("0xf24ff3a9cf04c71dbc94d0b566f7a27b94566cac") 25 | ); 26 | expect(receipt.gasUsed).toBe(54605n); 27 | expect(receipt.logs).toStrictEqual([]); 28 | expect(receipt.transactionHash).toBe(hash); 29 | expect(receipt.to).toBe(null); 30 | expect(receipt.transactionIndex).toBe(0); 31 | }, 32 | }); 33 | }, 34 | }); 35 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-staking/test-candidate-join2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | import { ALITH_ADDRESS, MIN_GLMR_DELEGATOR, MIN_GLMR_STAKING, alith, ethan } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D013403", 7 | title: "Staking - Candidate Join - already a delegator", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | beforeAll(async () => { 11 | await context.createBlock( 12 | context 13 | .polkadotJs() 14 | .tx.parachainStaking.delegateWithAutoCompound( 15 | ALITH_ADDRESS, 16 | MIN_GLMR_DELEGATOR, 17 | 0, 18 | 0, 19 | 0, 20 | 0 21 | ) 22 | .signAsync(ethan), 23 | { signer: alith, allowFailures: false } 24 | ); 25 | }); 26 | 27 | it({ 28 | id: "T01", 29 | title: "should fail", 30 | test: async () => { 31 | const block = await context.createBlock( 32 | context 33 | .polkadotJs() 34 | .tx.parachainStaking.joinCandidates(MIN_GLMR_STAKING, 1) 35 | .signAsync(ethan) 36 | ); 37 | expect(block.result!.successful).to.be.false; 38 | expect(block.result!.error!.name).to.equal("DelegatorExists"); 39 | }, 40 | }); 41 | }, 42 | }); 43 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-staking/test-candidate-leave.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | import { MIN_GLMR_STAKING, alith, ethan } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D013405", 7 | title: "Staking - Candidate Leave Schedule - hint too low", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | beforeAll(async () => { 11 | await context.createBlock( 12 | context 13 | .polkadotJs() 14 | .tx.parachainStaking.joinCandidates(MIN_GLMR_STAKING, 1) 15 | .signAsync(ethan), 16 | { signer: alith, allowFailures: false } 17 | ); 18 | }); 19 | 20 | it({ 21 | id: "T01", 22 | title: "should fail", 23 | test: async () => { 24 | const block = await context.createBlock( 25 | context.polkadotJs().tx.parachainStaking.scheduleLeaveCandidates(1).signAsync(ethan) 26 | ); 27 | expect(block.result!.successful).to.be.false; 28 | expect(block.result!.error!.name).to.equal("TooLowCandidateCountToLeaveCandidates"); 29 | }, 30 | }); 31 | }, 32 | }); 33 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-staking/test-candidate-leave2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | import { MIN_GLMR_STAKING, alith, ethan } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D013406", 7 | title: "Staking - Candidate Leave Schedule - already scheduled", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | beforeAll(async () => { 11 | await context.createBlock( 12 | context 13 | .polkadotJs() 14 | .tx.parachainStaking.joinCandidates(MIN_GLMR_STAKING, 1) 15 | .signAsync(ethan), 16 | { signer: alith, allowFailures: false } 17 | ); 18 | await context.createBlock( 19 | context.polkadotJs().tx.parachainStaking.scheduleLeaveCandidates(2).signAsync(ethan), 20 | { signer: alith, allowFailures: false } 21 | ); 22 | }); 23 | 24 | it({ 25 | id: "T01", 26 | title: "should fail", 27 | test: async () => { 28 | const block = await context.createBlock( 29 | context.polkadotJs().tx.parachainStaking.scheduleLeaveCandidates(2).signAsync(ethan) 30 | ); 31 | expect(block.result!.successful).to.be.false; 32 | expect(block.result!.error!.name).to.equal("CandidateAlreadyLeaving"); 33 | }, 34 | }); 35 | }, 36 | }); 37 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-staking/test-candidate-leave7.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | import { MIN_GLMR_STAKING, alith, ethan } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D013411", 7 | title: "Staking - Candidate Leave Cancel - leave not scheduled", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | beforeAll(async () => { 11 | await context.createBlock( 12 | context 13 | .polkadotJs() 14 | .tx.parachainStaking.joinCandidates(MIN_GLMR_STAKING, 1) 15 | .signAsync(ethan), 16 | { signer: alith, allowFailures: false } 17 | ); 18 | }); 19 | 20 | it({ 21 | id: "T01", 22 | title: "should fail", 23 | test: async () => { 24 | const block = await context.createBlock( 25 | context.polkadotJs().tx.parachainStaking.cancelLeaveCandidates(2).signAsync(ethan) 26 | ); 27 | expect(block.result!.error!.name).to.equal("CandidateNotLeaving"); 28 | }, 29 | }); 30 | }, 31 | }); 32 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-staking/test-set-auto-compound3.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | import { MIN_GLMR_DELEGATOR, alith, ethan } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D013467", 7 | title: "Staking - Set Auto-Compound - new config 101%", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it }) => { 10 | beforeAll(async () => { 11 | await context.createBlock( 12 | context 13 | .polkadotJs() 14 | .tx.parachainStaking.delegateWithAutoCompound( 15 | alith.address, 16 | MIN_GLMR_DELEGATOR, 17 | 0, 18 | 0, 19 | 0, 20 | 0 21 | ) 22 | .signAsync(ethan), 23 | { allowFailures: false } 24 | ); 25 | }); 26 | 27 | it({ 28 | id: "T01", 29 | title: "should fail", 30 | test: async () => { 31 | expect( 32 | async () => 33 | await context.createBlock( 34 | await context 35 | .polkadotJs() 36 | .tx.parachainStaking.setAutoCompound(alith.address, 101, 0, 1) 37 | .signAsync(ethan) 38 | ) 39 | ).rejects.toThrowError("Value is greater than allowed maximum!"); 40 | }, 41 | }); 42 | }, 43 | }); 44 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-staking/test-staking-locks2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { MIN_GLMR_STAKING, baltathar } from "@moonwall/util"; 4 | import { fromBytes } from "viem"; 5 | 6 | describeSuite({ 7 | id: "D013476", 8 | title: "Staking - Locks - join candidates", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it, log }) => { 11 | it({ 12 | id: "T01", 13 | title: 'should set "stkngcol" when when joining candidates', 14 | test: async function () { 15 | await context.createBlock( 16 | context 17 | .polkadotJs() 18 | .tx.parachainStaking.joinCandidates(MIN_GLMR_STAKING, 1) 19 | .signAsync(baltathar) 20 | ); 21 | 22 | const locks = await context.polkadotJs().query.balances.locks(baltathar.address); 23 | expect(locks.length).to.be.equal( 24 | 1, 25 | `Unexpected number of locks: ${locks.map((l) => l.id.toHuman()).join(` - `)}` 26 | ); 27 | expect(locks[0].amount.toBigInt()).to.be.equal(MIN_GLMR_STAKING); 28 | expect(fromBytes(locks[0].id.toU8a(), "string")).to.be.equal("stkngcol"); 29 | }, 30 | }); 31 | }, 32 | }); 33 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-storage-growth/test-block-storage-growth.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; 3 | import { createEthersTransaction, sendRawTransaction } from "@moonwall/util"; 4 | import { encodeDeployData } from "viem"; 5 | 6 | describeSuite({ 7 | id: "D013501", 8 | title: "Storage Block (160Kb) - Storage Growth Limit", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it, log }) => { 11 | it({ 12 | id: "T01", 13 | title: "should fill a block with 61 tx at most", 14 | test: async function () { 15 | const { abi, bytecode } = fetchCompiledContract("Fibonacci"); 16 | const deployData = encodeDeployData({ 17 | abi, 18 | bytecode, 19 | }); 20 | 21 | for (let i = 0; i < 300; i++) { 22 | const rawTxn = await createEthersTransaction(context, { 23 | data: deployData, 24 | nonce: i, 25 | gasLimit: 400000n, 26 | }); 27 | await sendRawTransaction(context, rawTxn); 28 | } 29 | 30 | await context.createBlock(); 31 | expect((await context.viem().getBlock()).transactions.length).toBe(264); 32 | }, 33 | }); 34 | }, 35 | }); 36 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-subscription/test-subscription-logs.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | 4 | describeSuite({ 5 | id: "D013601", 6 | title: "Subscription - Logs", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it, log }) => { 9 | it({ 10 | id: "T01", 11 | title: "should send a notification on new transaction", 12 | test: async function () { 13 | const logs: any[] = []; 14 | const sub = await context.web3().eth.subscribe("logs"); 15 | 16 | await new Promise(async (resolve, reject) => { 17 | sub.once("data", async (event) => { 18 | logs.push(event); 19 | resolve("success"); 20 | }); 21 | 22 | sub.once("error", (error) => { 23 | console.error(error); 24 | reject(error); 25 | }); 26 | 27 | await context.deployContract!("EventEmitter"); 28 | }); 29 | 30 | const block = await context.viem().getBlock(); 31 | 32 | expect(logs[0]).to.include({ 33 | blockHash: block.hash, 34 | blockNumber: block.number, 35 | data: "0x", 36 | logIndex: 0n, 37 | removed: false, 38 | transactionHash: block.transactions[0], 39 | transactionIndex: 0n, 40 | }); 41 | }, 42 | }); 43 | }, 44 | }); 45 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-subscription/test-subscription-pending.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { BALTATHAR_ADDRESS, GLMR, createRawTransfer, sendRawTransaction } from "@moonwall/util"; 4 | import { setTimeout } from "node:timers/promises"; 5 | 6 | describeSuite({ 7 | id: "D013604", 8 | title: "Subscription - Pending transactions", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it, log }) => { 11 | it({ 12 | id: "T01", 13 | title: "should return a valid subscriptionId", 14 | test: async function () { 15 | let response: any; 16 | const sub = await context.web3().eth.subscribe("newPendingTransactions"); 17 | 18 | sub.once("data", (data) => { 19 | response = data; 20 | }); 21 | 22 | const rawTx = await createRawTransfer(context, BALTATHAR_ADDRESS, GLMR); 23 | const hash = await sendRawTransaction(context, rawTx); 24 | await setTimeout(200); 25 | 26 | expect(response).not.toBeUndefined(); 27 | expect(response).toBe(hash); 28 | }, 29 | }); 30 | }, 31 | }); 32 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-txpool/test-txpool-limits.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | import { BALTATHAR_ADDRESS, createRawTransfer, sendRawTransaction } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D013903", 7 | title: "TxPool - Limits", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | it({ 11 | id: "T01", 12 | title: "should be able to fill a block with at least 2300 tx", 13 | test: async function () { 14 | for (let i = 0; i < 3000; i++) { 15 | const rawTxn = await createRawTransfer(context, BALTATHAR_ADDRESS, 1n, { 16 | nonce: i, 17 | }); 18 | await sendRawTransaction(context, rawTxn); 19 | } 20 | 21 | await context.createBlock(); 22 | const maxTxnLen = (await context.viem().getBlock()).transactions.length; 23 | log(`out ${maxTxnLen}`); 24 | expect(maxTxnLen).toBeGreaterThan(2300); 25 | }, 26 | }); 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-txpool/test-txpool-limits2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; 3 | import { createEthersTransaction } from "@moonwall/util"; 4 | import { encodeDeployData } from "viem"; 5 | 6 | describeSuite({ 7 | id: "D013904", 8 | title: "TxPool - Limits", 9 | foundationMethods: "dev", 10 | testCases: ({ context, it, log }) => { 11 | it({ 12 | id: "T01", 13 | title: "should be able to fill a block with 70 contract creations tx", 14 | test: async function () { 15 | const { abi, bytecode } = fetchCompiledContract("MultiplyBy7"); 16 | const deployData = encodeDeployData({ 17 | abi, 18 | bytecode, 19 | }); 20 | 21 | const txs = await Promise.all( 22 | new Array(300).fill(0).map((_, i) => 23 | createEthersTransaction(context, { 24 | data: deployData, 25 | nonce: i, 26 | gasLimit: 400000n, 27 | }) 28 | ) 29 | ); 30 | for (const tx of txs) { 31 | await context.viem().sendRawTransaction({ serializedTransaction: tx }); 32 | } 33 | 34 | await context.createBlock(); 35 | expect((await context.viem().getBlock()).transactions.length).toBe(284); 36 | }, 37 | }); 38 | }, 39 | }); 40 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-txpool/test-txpool-reset.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect } from "@moonwall/cli"; 3 | 4 | describeSuite({ 5 | id: "D013909", 6 | title: "TxPool - Genesis", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it, log }) => { 9 | it({ 10 | id: "T01", 11 | title: "should be empty", 12 | test: async function () { 13 | const inspect = (await context 14 | .viem() 15 | .transport.request({ method: "txpool_inspect" })) as any; 16 | expect(inspect.pending).to.be.empty; 17 | const content = (await context 18 | .viem() 19 | .transport.request({ method: "txpool_inspect" })) as any; 20 | expect(content.pending).to.be.empty; 21 | }, 22 | }); 23 | }, 24 | }); 25 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-txpool/test-txpool-reset2.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { describeSuite, expect, beforeAll } from "@moonwall/cli"; 3 | 4 | describeSuite({ 5 | id: "D013910", 6 | title: "TxPool - New block", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it, log }) => { 9 | beforeAll(async () => { 10 | await context.deployContract!("MultiplyBy7"); 11 | await context.createBlock(); 12 | }); 13 | 14 | it({ 15 | id: "T01", 16 | title: "should reset the txpool", 17 | test: async function () { 18 | const inspect = (await context 19 | .viem() 20 | .transport.request({ method: "txpool_inspect" })) as any; 21 | expect(inspect.pending).to.be.empty; 22 | const content = (await context 23 | .viem() 24 | .transport.request({ method: "txpool_inspect" })) as any; 25 | expect(content.pending).to.be.empty; 26 | }, 27 | }); 28 | }, 29 | }); 30 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-xcm-v3/test-xcm-transactor-1.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment"; 2 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 3 | import { alith } from "@moonwall/util"; 4 | 5 | describeSuite({ 6 | id: "D014037", 7 | title: "Precompiles - xcm transactor", 8 | foundationMethods: "dev", 9 | testCases: ({ context, it, log }) => { 10 | beforeAll(async () => { 11 | // register index 0 for Alith 12 | await context.createBlock( 13 | context 14 | .polkadotJs() 15 | .tx.sudo.sudo(context.polkadotJs().tx.xcmTransactor.register(alith.address, 0)) 16 | ); 17 | }); 18 | 19 | it({ 20 | id: "T01", 21 | title: "allows to retrieve index through precompiles", 22 | test: async function () { 23 | const resp = await context.polkadotJs().query.xcmTransactor.indexToAccount(0); 24 | expect(resp.toString()).to.eq(alith.address); 25 | }, 26 | }); 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /test/suites/dev/moonbase/test-xcm-v4/test-xcm-location-to-account-api.ts: -------------------------------------------------------------------------------- 1 | import { describeSuite, expect } from "@moonwall/cli"; 2 | import { RELAY_V3_SOURCE_LOCATION } from "../../../../helpers/assets"; 3 | 4 | describeSuite({ 5 | id: "D014136", 6 | title: "XCM - LocationToAccountApi", 7 | foundationMethods: "dev", 8 | testCases: ({ context, it }) => { 9 | it({ 10 | id: "T01", 11 | title: "Should succeed calling LocationToAccountApi::convertLocation", 12 | test: async function () { 13 | const convertLocation = await context 14 | .polkadotJs() 15 | .call.locationToAccountApi.convertLocation(RELAY_V3_SOURCE_LOCATION); 16 | 17 | expect(convertLocation.isOk).to.be.true; 18 | expect(convertLocation.asOk.toHuman()).to.eq("0x506172656E740000000000000000000000000000"); 19 | }, 20 | }); 21 | }, 22 | }); 23 | -------------------------------------------------------------------------------- /test/suites/smoke/test-xcm-autopause.ts: -------------------------------------------------------------------------------- 1 | import "@moonbeam-network/api-augment/moonbase"; 2 | import type { ApiPromise } from "@polkadot/api"; 3 | import { beforeAll, describeSuite, expect } from "@moonwall/cli"; 4 | 5 | describeSuite({ 6 | id: "S26", 7 | title: `XCM Mode should be equal to Normal`, 8 | foundationMethods: "read_only", 9 | testCases: ({ context, it, log }) => { 10 | let paraApi: ApiPromise; 11 | 12 | beforeAll(async function () { 13 | paraApi = context.polkadotJs("para"); 14 | }); 15 | 16 | it({ 17 | id: "C100", 18 | title: "XCM Mode should be equal to Normal", 19 | test: async function (context) { 20 | if (paraApi.consts.system.version.specVersion.toNumber() < 3200) { 21 | context.skip(); 22 | } 23 | 24 | // XCM Mode should be equal to Normal 25 | expect((await paraApi.query.emergencyParaXcm.mode()).isNormal).to.be.true; 26 | }, 27 | }); 28 | }, 29 | }); 30 | -------------------------------------------------------------------------------- /test/suites/tracing-tests/test-get-logs-limit.ts: -------------------------------------------------------------------------------- 1 | import { beforeAll, customDevRpcRequest, describeSuite, expect } from "@moonwall/cli"; 2 | 3 | describeSuite({ 4 | id: "T20", 5 | title: "Test eth_getLogs RPC", 6 | foundationMethods: "dev", 7 | testCases: ({ context, it }) => { 8 | // This variable needs to be modified if `--max-blocks-range` CLI parameter is changed 9 | // Using the default of 1024 10 | const BLOCKS_TO_CREATE = 1025; 11 | beforeAll(async () => { 12 | let blocksToCreate = BLOCKS_TO_CREATE; 13 | for (; blocksToCreate > 0; blocksToCreate--) { 14 | await context.createBlock(); 15 | } 16 | }); 17 | 18 | it({ 19 | id: "T01", 20 | title: "Validate eth_getLogs block range limit", 21 | test: async function () { 22 | await expect( 23 | async () => 24 | await customDevRpcRequest("eth_getLogs", [ 25 | { 26 | fromBlock: "0x0", 27 | toBlock: "latest", 28 | topics: [], 29 | }, 30 | ]) 31 | ).rejects.toThrowError("block range is too wide (maximum 1024)"); 32 | }, 33 | }); 34 | }, 35 | }); 36 | -------------------------------------------------------------------------------- /test/suites/tracing-tests/test-trace-evm-foreign-asset-registration.ts: -------------------------------------------------------------------------------- 1 | import { customDevRpcRequest, describeSuite, expect } from "@moonwall/cli"; 2 | import { 3 | ARBITRARY_ASSET_ID, 4 | registerForeignAsset, 5 | RELAY_SOURCE_LOCATION_V4, 6 | relayAssetMetadata, 7 | } from "../../helpers"; 8 | 9 | describeSuite({ 10 | id: "T17", 11 | title: "Trace ERC20 Foreign asset creation", 12 | foundationMethods: "dev", 13 | testCases: ({ context, it }) => { 14 | it({ 15 | id: "T01", 16 | title: "Ensure native ERC20 foreign asset creation is traceable", 17 | timeout: 50000, 18 | test: async function () { 19 | const assetLocation = RELAY_SOURCE_LOCATION_V4; 20 | const assetId = ARBITRARY_ASSET_ID; 21 | 22 | // Register the asset 23 | await registerForeignAsset(context, assetId, assetLocation, relayAssetMetadata); 24 | 25 | const number = await context.viem().getBlockNumber(); 26 | const traces = await customDevRpcRequest("debug_traceBlockByNumber", [ 27 | number.toString(), 28 | { tracer: "callTracer" }, 29 | ]); 30 | 31 | expect(traces).to.toMatchObject([ 32 | { 33 | result: { 34 | to: "0xffffffff1fcacbd218edc0eba20fc2308c778080", 35 | type: "CREATE", 36 | }, 37 | }, 38 | ]); 39 | }, 40 | }); 41 | }, 42 | }); 43 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": ["node"], 4 | 5 | // enable latest features 6 | "lib": ["esnext"], 7 | "module": "esnext", 8 | "target": "esnext", 9 | 10 | "moduleResolution": "bundler", 11 | "noEmit": true, 12 | "allowImportingTsExtensions": true, 13 | "moduleDetection": "force", 14 | "incremental": true, 15 | "baseUrl": "./", 16 | "importHelpers": true, 17 | "skipDefaultLibCheck": true, 18 | "preserveConstEnums": true, 19 | "sourceMap": true, 20 | "esModuleInterop": true, 21 | "resolveJsonModule": true, 22 | "strict": true, 23 | "forceConsistentCasingInFileNames": true, 24 | "skipLibCheck": true, 25 | "noImplicitAny": false 26 | 27 | // "paths": { 28 | // "@helpers/xcm": ["helpers/xcm.js"], 29 | // "@helpers/block": ["helpers/block.js"], 30 | // "@helpers/common": ["helpers/common.js"], 31 | // "@helpers/assets": ["helpers/assets.js"], 32 | // "@helpers/expect": ["helpers/expect.js"], 33 | // } // We can enable this if we commit to using bun.js 34 | }, 35 | "include": ["**/helpers/", "scripts"], 36 | "exclude": ["node_modules", "suites"] 37 | } 38 | -------------------------------------------------------------------------------- /toml-sort.toml: -------------------------------------------------------------------------------- 1 | keys = [ 2 | "workspace", 3 | "name", 4 | "package", 5 | "bin", 6 | "lib", 7 | "test", 8 | "dependencies", 9 | "dev-dependencies", 10 | "build-dependencies", 11 | "features", 12 | "default", 13 | "std", 14 | ] 15 | 16 | inline_keys = [ 17 | "package", 18 | "workspace", 19 | "path", 20 | "git", 21 | "branch", 22 | "rev", 23 | "version", 24 | "default-features", 25 | "optional", 26 | "features", 27 | ] 28 | 29 | sort_string_arrays = true -------------------------------------------------------------------------------- /tools/bots/mission-control-bot/constants.ts: -------------------------------------------------------------------------------- 1 | export const TOKEN_DECIMAL = 18n; 2 | export const EMBED_COLOR_CORRECT = 0x642f95; 3 | export const EMBED_COLOR_ERROR = 0xc0392b; 4 | 5 | export const params = { 6 | // Discord app information 7 | DISCORD_TOKEN: process.env.DISCORD_TOKEN, 8 | DISCORD_CHANNEL: process.env.DISCORD_CHANNEL, 9 | 10 | // Items for monitoring 11 | TESTS_DISCORD_CHANNEL: process.env.TESTS_DISCORD_CHANNEL, 12 | NOT_LIMITED_USERS: JSON.parse(process.env.NOT_LIMITED_USERS || "false"), 13 | BALANCE_MONITOR_INTERVAL: parseInt(process.env.BALANCE_MONITOR_INTERVAL || "3"), // minutes 14 | 15 | // Slack app information 16 | SLACK_WEBHOOK: process.env.SLACK_WEBHOOK, 17 | 18 | // Web3 RPC access 19 | RPC_URL: process.env.RPC_URL, 20 | ACCOUNT_ID: process.env.ACCOUNT_ID, 21 | ACCOUNT_KEY: process.env.ACCOUNT_KEY, 22 | WORKERS_MNEMONIC: process.env.WORKERS_MNEMONIC, 23 | 24 | // Token distribution 25 | TOKEN_COUNT: BigInt(process.env.TOKEN_COUNT || 10), // DEV 26 | WORKERS_COUNT: parseInt(process.env.WORKERS_COUNT || "10"), 27 | WORKER_MIN_BALANCE: BigInt(process.env.WORKER_MIN_BALANCE || 200), // DEV 28 | GAS_PRICE: BigInt(process.env.GAS_PRICE || 1), // wei 29 | FAUCET_SEND_INTERVAL: parseInt(process.env.FAUCET_SEND_INTERVAL || "24"), // hours 30 | BALANCE_ALERT_THRESHOLD: BigInt(process.env.BALANCE_ALERT_THRESHOLD || 800), // DEV 31 | }; 32 | -------------------------------------------------------------------------------- /tools/bots/mission-control-bot/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mission-control-discord-bot", 3 | "license": "MIT", 4 | "version": "2.0.0", 5 | "description": "Ground control to Major Tom", 6 | "main": "mission-control-discord-bot.js", 7 | "dependencies": { 8 | "bip39": "^3.0.4", 9 | "discord.js": "^12.5.3", 10 | "ethereumjs-wallet": "^1.0.1", 11 | "ts-node": "^9.1.1", 12 | "typescript": "^4.2.4", 13 | "web3": "^1.8.0" 14 | }, 15 | "devDependencies": {}, 16 | "scripts": { 17 | "test": "echo \"Error: no test specified\" && exit 1" 18 | }, 19 | "author": "PureStake" 20 | } 21 | -------------------------------------------------------------------------------- /tools/bots/mission-control-bot/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "moduleResolution": "node", 5 | "target": "esnext", 6 | "esModuleInterop": true 7 | }, 8 | "files": ["main.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /tools/bots/mission-control-bot/types.ts: -------------------------------------------------------------------------------- 1 | // Custom defined types for the mission-control-bot 2 | 3 | import { DMChannel, NewsChannel, TextChannel } from "discord.js"; 4 | 5 | export type Receivers = { 6 | [discordUser: string]: number; 7 | }; 8 | 9 | export type WorkerAccount = { 10 | address: string; 11 | privateKey: string; 12 | }; 13 | 14 | export type DiscordChannel = TextChannel | DMChannel | NewsChannel; 15 | 16 | export type FundsRequest = { 17 | discordUser: string; 18 | discordChannel: DiscordChannel; 19 | address: string; 20 | prevTimestampUser: number; 21 | prevTimestampAddress: number; 22 | }; 23 | -------------------------------------------------------------------------------- /tools/gerald.ts: -------------------------------------------------------------------------------- 1 | import { importAccount, web3, gerald, contractAddress } from "./init-web3"; 2 | 3 | const main = async () => { 4 | const nonce = await web3.eth.getTransactionCount(gerald.address); 5 | 6 | const chainId = await web3.eth.net.getId(); 7 | // Step 1: Creating the contract. 8 | console.log(`Using chain id: ${chainId}\n`); 9 | console.log(`Gerald account: ${gerald.address} (nonce: ${nonce})`); 10 | 11 | const contractAdd = contractAddress(gerald.address, 0); 12 | const code = await web3.eth.getCode(contractAdd); 13 | const storageAdd = await web3.eth.getBalance(contractAdd, "0"); 14 | console.log(`Gerald contract[0]: ${contractAdd} (code: ${code.length} bytes)`); 15 | console.log(` storage: ${storageAdd}`); 16 | }; 17 | 18 | main().catch((err) => { 19 | console.log("Error", err); 20 | }); 21 | -------------------------------------------------------------------------------- /tools/get-block.ts: -------------------------------------------------------------------------------- 1 | import Web3 from "web3"; 2 | const web3 = new Web3("http://localhost:9944"); 3 | 4 | let lastTime = Date.now(); 5 | const displayBlock = async (blockNumber) => { 6 | const diffTime = ((Date.now() - lastTime) / 1000).toFixed(1); 7 | lastTime = Date.now(); 8 | 9 | const block = await web3.eth.getBlock(blockNumber); 10 | console.log(`${blockNumber.toString().padStart(5, " ")}: ${block.hash} (${diffTime} s)`); 11 | block.transactions.forEach((t: any, index) => { 12 | console.log(` [${index}] ${t.hash} (input: ${t.input && t.input.length} bytes)`); 13 | console.log(` [${index}] from ${t.from} (nonce: ${t.nonce}) to ${t.to}`); 14 | console.log(` [${index}] value: ${t.value} gas: ${t.gas} gasPrice: ${t.gasPrice}`); 15 | if (t.creates) { 16 | console.log(` [${index}] creates: ${t.creates}`); 17 | } 18 | }); 19 | }; 20 | 21 | var myArgs = process.argv.slice(2); 22 | displayBlock(myArgs[0]); 23 | -------------------------------------------------------------------------------- /tools/moon-key.ts: -------------------------------------------------------------------------------- 1 | import { mnemonicToSeedSync, generateMnemonic } from "bip39"; 2 | import { hdkey } from "ethereumjs-wallet"; 3 | import yargs from "yargs"; 4 | 5 | const argv = yargs(process.argv.slice(2)) 6 | .usage('Usage: $0 [--mnemonic "..."] [--account-index x]') 7 | .version("1.0.0") 8 | .options({ 9 | mnemonic: { type: "string" }, 10 | "account-index": { type: "number", default: 0 }, 11 | strength: { type: "number", default: 256 }, 12 | }).argv; 13 | 14 | const account_index = argv["account-index"]; 15 | const strength = argv["strength"]; 16 | const mnemonic = argv["mnemonic"] || generateMnemonic(strength); 17 | 18 | const main = async () => { 19 | const hdwallet = hdkey.fromMasterSeed(mnemonicToSeedSync(mnemonic)); 20 | const path = `m/44'/60'/0'/0/${account_index}`; 21 | const wallet = hdwallet.derivePath(path).getWallet(); 22 | 23 | console.log(`Address: ${wallet.getAddressString()}`); 24 | console.log(`Mnemonic: ${mnemonic}`); 25 | console.log(`Private Key: ${wallet.getPrivateKeyString()}`); 26 | console.log(`Path: ${path}`); 27 | }; 28 | 29 | main(); 30 | -------------------------------------------------------------------------------- /tools/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "moonbeam-tools", 3 | "version": "0.0.1", 4 | "license": "GPL-3.0", 5 | "dependencies": { 6 | "@polkadot/api": "^6.6.1", 7 | "bip39": "^3.1.0", 8 | "eth-block-tracker": "^4.4.3", 9 | "ethereumjs-wallet": "^1.0.0", 10 | "ethjs-provider-http": "^0.1.6", 11 | "moonbeam-types-bundle": "^2.0.7", 12 | "octokit": "^1.0.6", 13 | "pkg": "^4.4.9", 14 | "polkadot-launch": "^2.3.0", 15 | "rlp": "^2.2.6", 16 | "solc": "^0.8.0", 17 | "ts-node": "^8.10.1", 18 | "typescript": "^4.4.3", 19 | "web3": "^1.8.0", 20 | "yargs": "^17.0.1" 21 | }, 22 | "devDependencies": { 23 | "@types/yargs": "^15.0.12" 24 | }, 25 | "scripts": { 26 | "package-moon-key": "node_modules/.bin/tsc moon-key.ts; node_modules/.bin/pkg -t node14 moon-key.js; rm moon-key.js", 27 | "launch": "ts-node launch", 28 | "get-binary": "ts-node get-binary", 29 | "list-pr-labels": "ts-node github/list-pr-labels.ts", 30 | "print-client-release-issue": "ts-node github/print-client-release-issue.ts", 31 | "print-runtime-release-issue": "ts-node github/print-runtime-release-issue.ts", 32 | "print-version-bump-info": "ts-node github/print-version-bump-info.ts" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tools/test-constants.ts: -------------------------------------------------------------------------------- 1 | export const GERALD = "0x6be02d1d3665660d22ff9624b7be0551ee1ac91b"; 2 | export const FAITH = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; 3 | export const ETHAN_PRIVKEY = "0x7dce9bc8babb68fec1409be38c8e1a52650206a7ed90ff956ae8a6d15eeaaef4"; 4 | export const ETHAN = "0xFf64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"; 5 | export const ALITH_PRIVKEY = "0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133"; 6 | export const ALITH = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; 7 | export const STAKING_AMOUNT = "1.0000 kUnit"; 8 | 9 | export const GLMR = 1_000_000_000_000_000_000n; 10 | export const MIN_GLMR_STAKING = 1000n * GLMR; 11 | export const MIN_GLMR_NOMINATOR = 5n * GLMR; 12 | export const DEFAULT_GENESIS_BALANCE = 2n ** 80n; 13 | export const DEFAULT_GENESIS_STAKING = 1_000n * GLMR; 14 | export const GENESIS_ACCOUNT_BALANCE = DEFAULT_GENESIS_BALANCE - DEFAULT_GENESIS_STAKING; 15 | -------------------------------------------------------------------------------- /tools/test-scripts/create-erc20-contract.ts: -------------------------------------------------------------------------------- 1 | import { gerald, web3, ERC20_BYTECODE, init } from "../init-web3"; 2 | init(); 3 | 4 | const main = async () => { 5 | console.log(`\nCreating contract using Eth RPC "sendTransaction" from gerald`); 6 | const createTransaction = await gerald.signTransaction({ 7 | data: ERC20_BYTECODE, 8 | value: "0x00", 9 | gasPrice: "0x00", 10 | gas: "0x100000", 11 | }); 12 | console.log("Transaction", { 13 | ...createTransaction, 14 | rawTransaction: `${createTransaction.rawTransaction.substring(0, 32)}... (${ 15 | createTransaction.rawTransaction.length 16 | } length)`, 17 | }); 18 | 19 | const createReceipt = await web3.eth.sendSignedTransaction(createTransaction.rawTransaction); 20 | console.log(`Contract deployed at address ${createReceipt.contractAddress}`); 21 | }; 22 | 23 | main().catch((err) => { 24 | console.log("Error", err); 25 | }); 26 | -------------------------------------------------------------------------------- /tools/test-scripts/test-alpha.ts: -------------------------------------------------------------------------------- 1 | import { ApiPromise, WsProvider } from "@polkadot/api"; 2 | import Web3 from "web3"; 3 | import { typesBundlePre900 } from "moonbeam-types-bundle"; 4 | import { FAITH } from "../test-constants"; 5 | const wsProviderUrl = `wss://wss.testnet.moonbeam.network`; 6 | 7 | export default async function test(ACC: string) { 8 | const web3 = new Web3(wsProviderUrl); 9 | let balance = await web3.eth.getBalance(ACC); 10 | console.log("BALANCE WEB3", balance.toString()); 11 | 12 | const wsProvider = new WsProvider(wsProviderUrl); 13 | const polkadotApi = await ApiPromise.create({ 14 | provider: wsProvider, 15 | typesBundle: typesBundlePre900 as any, 16 | }); 17 | const account = await polkadotApi.query.system.account(ACC); 18 | // console.log("BALANCE API", account.data.feeFrozen.toString()); 19 | // console.log("BALANCE API", account.data.miscFrozen.toString()); 20 | // console.log("BALANCE API", account.data.reserved.toString()); 21 | console.log("BALANCE API", account.data.free.toString()); 22 | 23 | const block = await web3.eth.getBlock("latest"); 24 | console.log("block", block); 25 | } 26 | test(FAITH); 27 | -------------------------------------------------------------------------------- /tools/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "esModuleInterop": true, 5 | "target": "es2020", 6 | "module": "commonjs" 7 | }, 8 | "exclude": ["node_modules", "tests"] 9 | } 10 | -------------------------------------------------------------------------------- /types-bundle/.gitignore: -------------------------------------------------------------------------------- 1 | # ignore files generated by typescript 2 | tsconfig.tsbuildinfo -------------------------------------------------------------------------------- /types-bundle/README.md: -------------------------------------------------------------------------------- 1 | # Moonbeam Types Bundle 2 | 3 | Exports npm package `@moonbeam-network/types-bundle`, formatted as per polkadot-js specification to use 4 | with the app or the API. 5 | 6 | # Development 7 | 8 | `typesBundlePre900` is of type OverrideBundleType to associate runtime names with correct definitions. 9 | 10 | `moonbeamDefinitions` is of types OverrideBundleDefinition and returns a different set of types for 11 | each runtime version. 12 | 13 | ## Print Types 14 | 15 | To print and save types JSON for a specific version run: 16 | `ts-node generateJSON.ts ` 17 | 18 | To print and save the latest: 19 | `ts-node generateJSON.ts latest` 20 | -------------------------------------------------------------------------------- /types-bundle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "incremental": false, 4 | "rootDir": "src", 5 | "outDir": "dist", 6 | "baseUrl": "./", 7 | "noEmit": false, 8 | "declaration": true, 9 | "declarationDir": "dist/types", 10 | "allowImportingTsExtensions": false, 11 | "typeRoots": ["node_modules/@types"], 12 | "skipLibCheck": true, 13 | "moduleResolution": "bundler", 14 | "module": "ESNext", 15 | "esModuleInterop": true, 16 | "resolveJsonModule": true 17 | }, 18 | "include": ["src/**/*"], 19 | "exclude": ["node_modules", "dist", "scripts"] 20 | } 21 | -------------------------------------------------------------------------------- /typescript-api/.gitignore: -------------------------------------------------------------------------------- 1 | metadata-*.json 2 | build 3 | *.tgz 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | .pnpm-debug.log* 13 | 14 | # Diagnostic reports (https://nodejs.org/api/report.html) 15 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 16 | 17 | # Runtime data 18 | pids 19 | *.pid 20 | *.seed 21 | *.pid.lock 22 | 23 | # Dependency directories 24 | node_modules/ 25 | 26 | # TypeScript cache 27 | *.tsbuildinfo 28 | 29 | # Optional npm cache directory 30 | .npm 31 | -------------------------------------------------------------------------------- /typescript-api/.npmignore: -------------------------------------------------------------------------------- 1 | metadata-*.json 2 | build 3 | # dist # Commented out to allow the dist directory to be included in the package 4 | *.tgz 5 | 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | .pnpm-debug.log* 14 | 15 | # Diagnostic reports (https://nodejs.org/api/report.html) 16 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Dependency directories 25 | node_modules/ 26 | 27 | # TypeScript cache 28 | *.tsbuildinfo 29 | 30 | # Optional npm cache directory 31 | .npm -------------------------------------------------------------------------------- /typescript-api/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "../biome.json" 4 | ], 5 | "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", 6 | "javascript": { 7 | "formatter": { 8 | "trailingCommas": "none", 9 | "semicolons": "always", 10 | "indentStyle": "space", 11 | "lineWidth": 100, 12 | "quoteStyle": "double" 13 | } 14 | }, 15 | "linter": { 16 | "rules": { 17 | "suspicious": { 18 | "noShadowRestrictedNames": "off" 19 | }, 20 | "complexity": { 21 | "noBannedTypes": "warn" 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /typescript-api/src/moonbase/index.ts: -------------------------------------------------------------------------------- 1 | import "./interfaces/types-lookup.js"; 2 | import "./interfaces/augment-api.js"; 3 | import "./interfaces/augment-types.js"; 4 | -------------------------------------------------------------------------------- /typescript-api/src/moonbase/interfaces/augment-api.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-chain`, do not edit 2 | /* eslint-disable */ 3 | 4 | import "./augment-api-consts.js"; 5 | import "./augment-api-errors.js"; 6 | import "./augment-api-events.js"; 7 | import "./augment-api-query.js"; 8 | import "./augment-api-tx.js"; 9 | import "./augment-api-rpc.js"; 10 | import "./augment-api-runtime.js"; 11 | -------------------------------------------------------------------------------- /typescript-api/src/moonbase/interfaces/definitions.ts: -------------------------------------------------------------------------------- 1 | export { default as moon } from "./moon/definitions.js"; 2 | -------------------------------------------------------------------------------- /typescript-api/src/moonbase/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonbase/interfaces/moon/definitions.ts: -------------------------------------------------------------------------------- 1 | import { moonbeamDefinitions } from "@moonbeam-network/types-bundle"; 2 | 3 | export default { 4 | types: {}, 5 | rpc: { 6 | ...moonbeamDefinitions.rpc?.moon 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /typescript-api/src/moonbase/interfaces/moon/index.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonbase/interfaces/moon/types.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export type PHANTOM_MOON = "moon"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonbase/interfaces/types.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./moon/types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonbase/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "baseUrl": "./", 6 | "outDir": "../../dist/moonbase", 7 | "declarationDir": "../../dist/moonbase", 8 | "declarationMap": true, 9 | "paths": { 10 | "@moonbeam-network/api-augment/moonbase/*": ["src/moonbase/*"], 11 | "@polkadot/api/augment": ["src/moonbase/interfaces/augment-api.ts"], 12 | "@polkadot/types/augment": ["src/moonbase/interfaces/augment-types.ts"], 13 | "@polkadot/types/lookup": ["src/moonbase/interfaces/types-lookup.ts"] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/index.ts: -------------------------------------------------------------------------------- 1 | import "./interfaces/types-lookup.js"; 2 | import "./interfaces/augment-api.js"; 3 | import "./interfaces/augment-types.js"; 4 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/interfaces/augment-api.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-chain`, do not edit 2 | /* eslint-disable */ 3 | 4 | import "./augment-api-consts.js"; 5 | import "./augment-api-errors.js"; 6 | import "./augment-api-events.js"; 7 | import "./augment-api-query.js"; 8 | import "./augment-api-tx.js"; 9 | import "./augment-api-rpc.js"; 10 | import "./augment-api-runtime.js"; 11 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/interfaces/definitions.ts: -------------------------------------------------------------------------------- 1 | export { default as moon } from "./moon/definitions.js"; 2 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/interfaces/moon/definitions.ts: -------------------------------------------------------------------------------- 1 | import { moonbeamDefinitions } from "@moonbeam-network/types-bundle"; 2 | 3 | export default { 4 | types: {}, 5 | rpc: { 6 | ...moonbeamDefinitions.rpc?.moon 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/interfaces/moon/index.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/interfaces/moon/types.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export type PHANTOM_MOON = "moon"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/interfaces/types.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./moon/types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonbeam/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "baseUrl": "./", 6 | "outDir": "../../dist/moonbeam", 7 | "declarationDir": "../../dist/moonbeam", 8 | "declarationMap": true, 9 | "paths": { 10 | "@moonbeam-network/api-augment/*": ["src/moonbeam/*"], 11 | "@polkadot/api/augment": ["src/moonbeam/interfaces/augment-api.ts"], 12 | "@polkadot/types/augment": ["src/moonbeam/interfaces/augment-types.ts"], 13 | "@polkadot/types/lookup": ["src/moonbeam/interfaces/types-lookup.ts"] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/index.ts: -------------------------------------------------------------------------------- 1 | import "./interfaces/types-lookup.js"; 2 | import "./interfaces/augment-api.js"; 3 | import "./interfaces/augment-types.js"; 4 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/interfaces/augment-api.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-chain`, do not edit 2 | /* eslint-disable */ 3 | 4 | import "./augment-api-consts.js"; 5 | import "./augment-api-errors.js"; 6 | import "./augment-api-events.js"; 7 | import "./augment-api-query.js"; 8 | import "./augment-api-tx.js"; 9 | import "./augment-api-rpc.js"; 10 | import "./augment-api-runtime.js"; 11 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/interfaces/definitions.ts: -------------------------------------------------------------------------------- 1 | export { default as moon } from "./moon/definitions.js"; 2 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/interfaces/moon/definitions.ts: -------------------------------------------------------------------------------- 1 | import { moonbeamDefinitions, types } from "@moonbeam-network/types-bundle"; 2 | 3 | export default { 4 | types: {}, 5 | rpc: { 6 | ...moonbeamDefinitions.rpc?.moon 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/interfaces/moon/index.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/interfaces/moon/types.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export type PHANTOM_MOON = "moon"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/interfaces/types.ts: -------------------------------------------------------------------------------- 1 | // Auto-generated via `yarn polkadot-types-from-defs`, do not edit 2 | /* eslint-disable */ 3 | 4 | export * from "./moon/types.js"; 5 | -------------------------------------------------------------------------------- /typescript-api/src/moonriver/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "baseUrl": "./", 6 | "outDir": "../../dist/moonriver", 7 | "declarationDir": "../../dist/moonriver", 8 | "declarationMap": true, 9 | "paths": { 10 | "@moonbeam-network/api-augment/moonriver/*": ["src/moonriver/*"], 11 | "@polkadot/api/augment": ["src/moonriver/interfaces/augment-api.ts"], 12 | "@polkadot/types/augment": ["src/moonriver/interfaces/augment-types.ts"], 13 | "@polkadot/types/lookup": ["src/moonriver/interfaces/types-lookup.ts"] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /typescript-api/tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "moduleResolution": "Bundler", 6 | "strict": true, 7 | "noImplicitAny": true, 8 | "noImplicitReturns": true, 9 | "esModuleInterop": true, 10 | "skipLibCheck": true, 11 | "baseUrl": ".", 12 | "composite": true, 13 | "declaration": true, 14 | "paths": { 15 | "moonbeam": ["moonbeam/src"], 16 | "moonriver": ["moonriver/src"], 17 | "moonbase": ["moonbase/src"] 18 | } 19 | }, 20 | "exclude": ["node_modules", "dist", "scripts"] 21 | } 22 | -------------------------------------------------------------------------------- /typescript-api/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "tsup"; 2 | import { execSync } from "node:child_process"; 3 | 4 | export default defineConfig([ 5 | { 6 | entry: ["src/moonbeam"], 7 | outDir: "dist/moonbeam", 8 | format: ["esm", "cjs"], 9 | splitting: false, 10 | clean: true, 11 | onSuccess: async () => { 12 | console.log("Running tsc for moonbeam..."); 13 | execSync("pnpm tsc -p src/moonbeam/tsconfig.json --emitDeclarationOnly", { 14 | stdio: "inherit" 15 | }); 16 | } 17 | }, 18 | { 19 | entry: ["src/moonriver"], 20 | outDir: "dist/moonriver", 21 | format: ["esm", "cjs"], 22 | splitting: false, 23 | clean: true, 24 | onSuccess: async () => { 25 | console.log("Running tsc for moonriver..."); 26 | execSync("pnpm tsc -p src/moonriver/tsconfig.json --emitDeclarationOnly", { 27 | stdio: "inherit" 28 | }); 29 | } 30 | }, 31 | { 32 | entry: ["src/moonbase"], 33 | outDir: "dist/moonbase", 34 | format: ["esm", "cjs"], 35 | splitting: false, 36 | clean: true, 37 | onSuccess: async () => { 38 | console.log("Running tsc for moonbase..."); 39 | execSync("pnpm tsc -p src/moonbase/tsconfig.json --emitDeclarationOnly", { 40 | stdio: "inherit" 41 | }); 42 | } 43 | } 44 | ]); 45 | --------------------------------------------------------------------------------