diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 307ec65663..0000000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Cancel - -on: - push: - branches: - - '**' - - '!master' - - '!polkadot-v**' - -jobs: - cancel: - name: 'Cancel previous runs' - runs-on: ubuntu-latest - timeout-minutes: 3 - steps: - - uses: styfle/cancel-workflow-action@0.12.1 - with: - workflow_id: 1303397 - access_token: ${{ github.token }} diff --git a/.github/workflows/editorconfig.yml b/.github/workflows/editorconfig.yml index 495e19d326..8151a5e31d 100644 --- a/.github/workflows/editorconfig.yml +++ b/.github/workflows/editorconfig.yml @@ -16,12 +16,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Submodules - run: git submodule update --init --recursive - - name: Init - run: | - wget https://github.com/editorconfig-checker/editorconfig-checker/releases/download/2.1.0/ec-linux-amd64.tar.gz - tar xvf ec-linux-amd64.tar.gz - chmod +x bin/ec-linux-amd64 - - name: Check - run: bin/ec-linux-amd64 + - uses: editorconfig-checker/action-editorconfig-checker@main + - run: editorconfig-checker diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..fcd045522f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,58 @@ +name: Lint + +on: + push: + branches: + - master + - 'polkadot-v**' + pull_request: + branches: + - master + - 'polkadot-v**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + RUSTC_WRAPPER: "sccache" + SCCACHE_GHA_ENABLED: "true" + +jobs: + lint: + name: Run Code Lint + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Cache cargo registry & git sources + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.os }}-cargo-lint- + ${{ runner.os }}-cargo- + + - name: Run sccache + uses: mozilla-actions/sccache-action@v0.0.4 + + - name: Install Rust toolchain + run: make setup + + - name: Install protoc + uses: arduino/setup-protoc@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check code format + run: make fmt-check + + - name: Run clippy + run: make clippy-release diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index b7e000f60c..0000000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Rust - -on: - push: - branches: - - master - - 'polkadot-v**' - pull_request: - branches: - - master - - 'polkadot-v**' - -jobs: - build: - name: 'Run Rust tests' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Rust Setup - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2024-01-22 - target: wasm32-unknown-unknown - override: true - components: rust-src - - name: Install protoc - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Run tests - run: cargo test --release --locked --verbose --all - - integration: - name: 'Run integration tests' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Rust Setup - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2024-01-22 - target: wasm32-unknown-unknown - override: true - components: rust-src - - name: Install protoc - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Build client - run: | - cd template/node - cargo build --release --locked --verbose - - name: Use Node.js 18 - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Install functional tests typescript - run: cd ts-tests && npm install - - name: Check functional tests format - run: cd ts-tests && npm run fmt-check - - name: Run functional tests - run: cd ts-tests && npm run build && npm run test - - name: Run functional tests (sql) - run: cd ts-tests && npm run build && npm run test-sql - - lint: - name: 'Run lints' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Rust Setup - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2024-01-22 - target: wasm32-unknown-unknown - override: true - components: rustfmt, clippy, rust-src - - name: Install protoc - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Check Cargo.toml Format - run: | - if taplo --version &> /dev/null; then - echo "taplo-cli is already installed" - else - cargo install taplo-cli - fi - taplo fmt --check - - name: Rustfmt - run: cargo fmt --all -- --check - - name: Clippy - run: cargo clippy --release --all --tests --features runtime-benchmarks,try-runtime -- -D warnings diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..b685046f5a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,97 @@ +name: Test + +on: + push: + branches: + - master + - 'polkadot-v**' + pull_request: + branches: + - master + - 'polkadot-v**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + RUSTC_WRAPPER: "sccache" + SCCACHE_GHA_ENABLED: "true" + +jobs: + unit-test: + name: Run Unit Tests + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Cache cargo registry & git sources + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-unittest-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-unittest-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.os }}-cargo-unittest- + ${{ runner.os }}-cargo- + + - name: Run sccache + uses: mozilla-actions/sccache-action@v0.0.4 + + - name: Install Rust toolchain + run: make setup + + - name: Install protoc + uses: arduino/setup-protoc@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run unit tests + run: make test-release + + integration-test: + name: Run Integration Tests + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Cache cargo registry & git sources + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-integration-test-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-integration-test-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.os }}-cargo-integration-test- + ${{ runner.os }}-cargo- + + - name: Run sccache + uses: mozilla-actions/sccache-action@v0.0.4 + + - name: Install Rust toolchain + run: make setup + + - name: Install protoc + uses: arduino/setup-protoc@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build client + run: make build-release + + - name: Setup node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Run integration tests + run: make integration-test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..ff5d0550d4 --- /dev/null +++ b/Makefile @@ -0,0 +1,81 @@ +.PHONY: setup +# Setup development environment +setup: + bash ./scripts/setup-dev.sh + +.PHONY: clean +# Cleanup compilation outputs +clean: + cargo clean + +.PHONY: fmt-check fmt +# Check the code format +fmt-check: + taplo fmt --check + cargo fmt --all -- --check +# Format the code +fmt: + taplo fmt + cargo fmt --all + +.PHONY: clippy clippy-release +# Run rust clippy with debug profile +clippy: + cargo clippy --all --all-targets --features=runtime-benchmarks,try-runtime -- -D warnings +# Run rust clippy with release profile +clippy-release: + cargo clippy --release --all --all-targets --features=runtime-benchmarks,try-runtime -- -D warnings + +.PHONY: check check-release +# Check code with debug profile +check: + cargo check +# Check code with release profile +check-release: + cargo check --release + +.PHONY: build build-release +# Build all binaries with debug profile +build: + WASM_BUILD_TYPE=debug cargo build +# Build all binaries with release profile +build-release: + WASM_BUILD_TYPE=release cargo build --release + +.PHONY: test test-release +# Run all unit tests with debug profile +test: + cargo test --lib --all + cargo test --lib --all --features=runtime-benchmarks +# Run all unit tests with release profile +test-release: + cargo test --release --lib --all + cargo test --release --lib --all --features=runtime-benchmarks + +.PHONY: integration-test integration-test-lint +# Check code format and lint of integration tests +integration-test-lint: + cd ts-tests && npm install && npm run fmt-check +# Run all integration tests +integration-test: build-release integration-test-lint + cd ts-tests && npm run build && npm run test && npm run test-sql + +.PHONY: help +# Show help +help: + @echo '' + @echo 'Usage:' + @echo ' make [target]' + @echo '' + @echo 'Targets:' + @awk '/^[a-zA-Z\-\_0-9]+:/ { \ + helpMessage = match(lastLine, /^# (.*)/); \ + if (helpMessage) { \ + helpCommand = substr($$1, 0, index($$1, ":")); \ + helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \ + printf "\033[36m%-30s\033[0m %s\n", helpCommand,helpMessage; \ + } \ + } \ + { lastLine = $$0 }' $(MAKEFILE_LIST) + +.DEFAULT_GOAL := help diff --git a/README.md b/README.md index 393c27af07..4da3030855 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,14 @@ Frontier is the EVM backbone of Polkadot. ## Features -Frontier provides a compatibility layer of EVM, so that you can run any Ethereum dapps on Polkadot, unmodified. Using Frontier, you get access to all of the Ethereum RPC APIs you are already familiar with, and therefore you can continue to develop your dapps in your favourite Ethereum developer tools. As a bonus, you can even run many Ethereum L2s inside Frontier! For those looking to become acquainted with Frontier, consult the documentation provided [here](./docs/). Additionally, a [template node](./template/README.md) is available to facilitate a more comprehensive technical exploration. +Frontier provides a compatibility layer of EVM, so that you can run any Ethereum dapps on Polkadot, unmodified. +Using Frontier, you get access to all the Ethereum RPC APIs you are already familiar with, and therefore you can continue to develop your dapps in your favourite Ethereum developer tools. +As a bonus, you can even run many Ethereum L2s inside Frontier! +For those looking to become acquainted with Frontier, consult the documentation provided [here](./docs). +Additionally, a [template node](./template/README.md) is available to facilitate a more comprehensive technical exploration. -Frontier is also a migration framework. Besides the common strategy of direct state export/import and transaction-level replays, Frontier's Pre-Log Wrapper Block feature provides a possible method for a zero-downtime live migration. +Frontier is also a migration framework. +Besides the common strategy of direct state export/import and transaction-level replays, Frontier's Pre-Log Wrapper Block feature provides a possible method for a zero-downtime live migration. ## Development workflow @@ -19,9 +24,12 @@ All changes (except new releases) are handled through pull requests. ### Versioning -Frontier follows [Semantic Versioning](https://semver.org/). An unreleased crate in the repository will have the `-dev` suffix in the end, and we do rolling releases. +Frontier follows [Semantic Versioning](https://semver.org/). +An unreleased crate in the repository will have the `-dev` suffix in the end, and we do rolling releases. -When you make a pull request against this repository, please also update the affected crates' versions, using the following rules. Note that the rules should be applied recursively -- if a change modifies any upper crate's dependency (even just the `Cargo.toml` file), then the upper crate will also need to apply those rules. +When you make a pull request against this repository, please also update the affected crates' versions, using the following rules. +Note that the rules should be applied recursively -- if a change modifies any upper crate's dependency (even just the `Cargo.toml` file), +then the upper crate will also need to apply those rules. Additionally, if your change is notable, then you should also modify the corresponding `CHANGELOG.md` file, in the "Unreleased" section. @@ -37,4 +45,4 @@ If the affected crate does not yet have `-dev` suffix: * If your change introduces a new feature, then bump the minor version, and add `-dev` suffix. * If your change modifies the current interface, then bump the major version, and add `-dev` suffix. -If your pull request introduces a new crate, please set its version to `1.0.0-dev`. \ No newline at end of file +If your pull request introduces a new crate, please set its version to `1.0.0-dev`. diff --git a/docs/accounts.md b/docs/accounts.md index 49673a2c15..207a06d768 100644 --- a/docs/accounts.md +++ b/docs/accounts.md @@ -9,6 +9,7 @@ The first strategy consists of of a truncated hash scheme, where the first 160 L `AccountId32` is the Account type used for `frame_system::pallet::Config::AccountId`. The Runtime's `Signature` type is configured as [`sp_runtime::MultiSignature`](https://docs.rs/sp-runtime/2.0.1/sp_runtime/enum.MultiSignature.html), which means signatures can be: + - `Sr25519` - `Ed25519` - `ECDSA` @@ -17,4 +18,4 @@ The Runtime's `Signature` type is configured as [`sp_runtime::MultiSignature`](h The second strategy consists of using `fp-account` so that `AccountId20` is the Account type used for `frame_system::pallet::Config::AccountId`. -The Runtime's `Signature` type is configured as `EthereumSigner`, which means only `ECDSA` signatures are supported. \ No newline at end of file +The Runtime's `Signature` type is configured as `EthereumSigner`, which means only `ECDSA` signatures are supported. diff --git a/docs/overview.md b/docs/overview.md index d93bb5da79..9954fe6c6f 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -2,30 +2,45 @@ Frontier is the suite that provides an Ethereum compatibility layer for Substrate. It has two components that can be activated separately: -- Pallet EVM: This is the pallet that enables functionality of running EVM contracts. Existing EVM code can be used from there, using addresses and values mapped directly to Substrate. -- Pallet Ethereum with Ethereum compatible RPC methods: The pallet, combined with the RPC module, enables Ethereum block emulation, validates Ethereum-encoded transactions, and allows existing dapps to be deployed on a Substrate blockchain with minimal modifications. +- Pallet EVM: + This is the pallet that enables functionality of running EVM contracts. + Existing EVM code can be used from there, using addresses and values mapped directly to Substrate. +- Pallet Ethereum with Ethereum compatible RPC methods: + The pallet, combined with the RPC module, enables Ethereum block emulation, validates Ethereum-encoded transactions, + and allows existing dapps to be deployed on a Substrate blockchain with minimal modifications. ## EVM execution only -In many situations, a Substrate blockchain may only want to include EVM execution capatibilities. In this way, it functions similarly to `pallet-contracts`, integrates with Substrate better and is less intrusive. The module, and its EVM execution capatibilties, can be added or removed at any moment via forkless upgrades. With EVM execution only, Substrate uses its account model fully and signs transactions on behalf of EVM accounts. +In many situations, a Substrate blockchain may only want to include EVM execution capabilities. +In this way, it functions similarly to `pallet-contracts`, integrates with Substrate better and is less intrusive. +The module, and its EVM execution capabilities, can be added or removed at any moment via forkless upgrades. +With EVM execution only, Substrate uses its account model fully and signs transactions on behalf of EVM accounts. -In this model, however, Ethereum RPCs are not available, and dapps must rewrite their frontend using the Substrate API. If this is the intended way of usage, take a look at the [`pallet-evm`](./pallet-evm.md) documentation. +In this model, however, Ethereum RPCs are not available, and dapps must rewrite their frontend using the Substrate API. +If this is the intended way of usage, take a look at the [`pallet-evm`](../frame/evm/README.md) documentation. ## Post-block generation -On other situations, a full emulation of Ethereum may be desired so that Ethereum RPCs become available. In this model, a full Ethereum block is emulated within the Substrate runtime, and is generated post-block for the consumption rest of the APIs. In addition to Substrate account signing, traditional Ethereum transactions are also processed and validated. +On other situations, a full emulation of Ethereum may be desired so that Ethereum RPCs become available. +In this model, a full Ethereum block is emulated within the Substrate runtime, and is generated post-block for the consumption rest of the APIs. +In addition to Substrate account signing, traditional Ethereum transactions are also processed and validated. -If this is the intended way of usage, take a look at the [`pallet-ethereum`](./pallet-ethereum.md) documentation. +If this is the intended way of usage, take a look at the [`pallet-ethereum`](../frame/ethereum/README.md) documentation. ## Pre-block feeding -An Ethereum-based blockchain can use the pre-block feeding strategy to migrate to Substrate. In the post-block generation model, the Ethereum block is generated *after* runtime execution. In the pre-block feeding model, the Ethereum block is feeded in *before* runtime execution. +An Ethereum-based blockchain can use the pre-block feeding strategy to migrate to Substrate. +In the post-block generation model, the Ethereum block is generated *after* runtime execution. +In the pre-block feeding model, the Ethereum block is feeded in *before* runtime execution. -A blockchain can first use pre-block feeding with empty extrinsic requirement. In this way, because no other external information is feeded, combined with a suitable consensus engine, one Ethereum block -will have an exact corresponding Substrate block. This is called the [wrapper block](https://corepaper.org/substrate/wrapper/) strategy, and it allows Frontier to function as a normal Ethereum client. +A blockchain can first use pre-block feeding with empty extrinsic requirement. +In this way, because no other external information is feeded, combined with a suitable consensus engine, one Ethereum block will have an exact corresponding Substrate block. +This is called the [wrapper block](https://corepaper.org/substrate/wrapper/) strategy, and it allows Frontier to function as a normal Ethereum client. -With a sufficient number of the network running a Frontier node, the blockchain can then initiate a hard fork, allowing extrinsic to be added in. From there on, the blockchain is migrated to Substrate and can enjoy Substrate-specific features like on-chain governance and forkless upgrade. +With a sufficient number of the network running a Frontier node, the blockchain can then initiate a hard fork, allowing extrinsic to be added in. +From there on, the blockchain is migrated to Substrate and can enjoy Substrate-specific features like on-chain governance and forkless upgrade. -A complete in-storage pre-block feeding requires using Substrate's child storage. It can also be implemented using the stateless client strategy to eliminate that need. +A complete in-storage pre-block feeding requires using Substrate's child storage. +It can also be implemented using the stateless client strategy to eliminate that need. -Pre-block feeding is still work-in-progress. \ No newline at end of file +Pre-block feeding is still work-in-progress. diff --git a/frame/dynamic-fee/README.md b/frame/dynamic-fee/README.md index 415d62f459..dc39cf0240 100644 --- a/frame/dynamic-fee/README.md +++ b/frame/dynamic-fee/README.md @@ -4,13 +4,19 @@ The dynamic fee pallet allows a Substrate blockchain with Frontier to simulate t ## Overview -The pallet works by keeping track of the current minimum gas price in a Substrate storage `MinGasPrice`. Each Substrate block, the proposer can submit an inherent extrinsic `note_min_gas_price_target`. When a block is built, the minimum gas price is adjusted similar to Ethereum's algorithm. +The pallet works by keeping track of the current minimum gas price in a Substrate storage `MinGasPrice`. +Each Substrate block, the proposer can submit an inherent extrinsic `note_min_gas_price_target`. +When a block is built, the minimum gas price is adjusted similar to Ethereum's algorithm. ## Usage -To use the dynamic fee pallet, first include the pallet in runtime by implementing `pallet_dynamic_fee::Config`. The `MinGasPriceBoundDivisor` is a divisor used to set how much the minimum gas price is adjusted each block. You can set it to `1024` to get the same algorithm as Ethereum. After implementing `pallet_dynamic_fee::Config`, include the pallet in the runtime definition. +To use the dynamic fee pallet, first include the pallet in runtime by implementing `pallet_dynamic_fee::Config`. +The `MinGasPriceBoundDivisor` is a divisor used to set how much the minimum gas price is adjusted each block. +You can set it to `1024` to get the same algorithm as Ethereum. After implementing `pallet_dynamic_fee::Config`, include the pallet in the runtime definition. -With the pallet in place, you can now extend the node to allow it to vote on the minimum gas price target, via the inherent data providers. Locate in the node service code where the `InherentDataProviders` struct is built, and add `pallet_dynamic_fee`'s inherent data provider. The inherent data provider requires a target gas price parameter to be provided. For that, you simply need to add a new custom command line argument. +With the pallet in place, you can now extend the node to allow it to vote on the minimum gas price target, via the inherent data providers. +Locate in the node service code where the `InherentDataProviders` struct is built, and add `pallet_dynamic_fee`'s inherent data provider. +The inherent data provider requires a target gas price parameter to be provided. For that, you simply need to add a new custom command line argument. An example code snippet is shown below: @@ -29,4 +35,6 @@ fn inherent_data_providers( Ok(inherent_data_providers) } -``` \ No newline at end of file +``` + +License: Apache-2.0 diff --git a/frame/ethereum/README.md b/frame/ethereum/README.md index f44991c940..5a6cf6c0d5 100644 --- a/frame/ethereum/README.md +++ b/frame/ethereum/README.md @@ -1,4 +1,5 @@ # Ethereum pallet -The Ethereum pallet enables full Ethereum block emulation, allowing -Ethereum RPCs to be activated. +The Ethereum pallet enables full Ethereum block emulation, allowing Ethereum RPCs to be activated. + +License: Apache-2.0 diff --git a/frame/evm/README.md b/frame/evm/README.md index 0050915291..0b18973e02 100644 --- a/frame/evm/README.md +++ b/frame/evm/README.md @@ -8,8 +8,9 @@ The EVM pallet uses [`SputnikVM`](https://github.com/rust-blockchain/evm) as the ## Execution lifecycle -There are a separate set of accounts managed by the EVM pallet. Substrate based accounts can call the EVM pallet to deposit or withdraw balance from the Substrate base-currency into a different balance managed and used by the EVM pallet. Once a user has populated -their balance, they can create and call smart contracts using this pallet. +There are a separate set of accounts managed by the EVM pallet. +Substrate based accounts can call the EVM pallet to deposit or withdraw balance from the Substrate base-currency into a different balance managed and used by the EVM pallet. +Once a user has populated their balance, they can create and call smart contracts using this pallet. Substrate accounts and EVM external accounts are mapped via customizable conversion functions. @@ -22,6 +23,9 @@ Observable differences include: * The available length of block hashes may not be 256 depending on the configuration of the System pallet in the Substrate runtime. * Difficulty and coinbase, which do not make sense in this pallet and is currently hard coded to zero. -We currently do not aim to make unobservable behaviors, such as state root, to be the same. We also don't aim to follow the exact same transaction / receipt format. However, given one Ethereum transaction and one Substrate account's private key, one should be able to convert any Ethereum transaction into a transaction compatible with this pallet. +We currently do not aim to make unobservable behaviors, such as state root, to be the same. We also don't aim to follow the exact same transaction / receipt format. +However, given one Ethereum transaction and one Substrate account's private key, one should be able to convert any Ethereum transaction into a transaction compatible with this pallet. The gas configurations are configurable. Right now, a pre-defined Shanghai hard fork configuration option is provided. + +License: Apache-2.0 diff --git a/frame/evm/src/benchmarking.rs b/frame/evm/src/benchmarking.rs index aed23c57ec..95a66c33d1 100644 --- a/frame/evm/src/benchmarking.rs +++ b/frame/evm/src/benchmarking.rs @@ -18,7 +18,7 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; -use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; +use frame_benchmarking::benchmarks; type CurrencyOf = ::Currency; @@ -146,4 +146,4 @@ benchmarks! { } } -impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::mock::Test); +// impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::mock::Test); diff --git a/frame/hotfix-sufficients/README.md b/frame/hotfix-sufficients/README.md index fd533feeb7..d9f31d832f 100644 --- a/frame/hotfix-sufficients/README.md +++ b/frame/hotfix-sufficients/README.md @@ -1,6 +1,6 @@ # Hotfix sufficients pallet -The Hotfix sufficients pallet allows hotfixing account inconsistency to patch existing accounts that have a non-zero `nonce` but a zero `sufficients` value. +The Hotfix sufficients pallet allows hotfixing account inconsistency to patch existing accounts that have a non-zero `nonce` but a zero `sufficients` value. The accounts' `sufficients` values also need to be non-zero to be consistent. ## Description @@ -13,4 +13,4 @@ and incrementing their `sufficients` reference counter. Any addresses that do not have a zero reference count, will be unaffected. -License: Apache-2.0 \ No newline at end of file +License: Apache-2.0 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7d34d12c51..cf934f2541 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,8 +1,8 @@ [toolchain] # Stable -#channel = "1.75.0" # rustc 1.75.0 (82e1608df 2023-12-21) +#channel = "1.75.0" # rustc 1.75.0 (82e1608df 2023-12-21) # Nightly -channel = "nightly-2024-01-22" # rustc 1.77.0-nightly (ef71f1047 2024-01-21) -components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] -profile = "minimal" -targets = ["wasm32-unknown-unknown"] +channel = "nightly-2024-01-22" # rustc 1.77.0-nightly (ef71f1047 2024-01-21) +components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src", "rust-docs"] +profile = "minimal" +targets = ["wasm32-unknown-unknown"] diff --git a/scripts/setup-dev.sh b/scripts/setup-dev.sh new file mode 100755 index 0000000000..6aa5740d40 --- /dev/null +++ b/scripts/setup-dev.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +function install_rustup { + echo "Installing Rust toolchain..." + if rustup --version &> /dev/null; then + echo "Rust toolchain is already installed" + else + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source "$HOME"/.cargo/env + fi + rustup show +} + +function install_cargo_binary { + CRATE_NAME=$1 + BIN_NAME=${2:-$1} + if command -v "$BIN_NAME" &> /dev/null; then + echo "$CRATE_NAME is already installed" + else + cargo install "$CRATE_NAME" --force --locked + fi +} + +install_rustup +install_cargo_binary "taplo-cli" "taplo"