Skip to content

Commit

Permalink
feat(template): enable insecure_zero_ed feature of pallet-balances (p…
Browse files Browse the repository at this point in the history
…olkadot-evm#1270)

- enable insecure_zero_ed feature of pallet-balances by default
 - enable rpc-binary-search-estimate feature by default
 - update integration tests
  • Loading branch information
koushiro authored Jan 8, 2024
1 parent 8bd49e5 commit d4aa56a
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Build client
run: |
cd template/node
cargo build --release --locked --verbose --features rpc-binary-search-estimate
cargo build --release --locked --verbose
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion frame/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ hex = { workspace = true }
libsecp256k1 = { workspace = true, features = ["static-context", "hmac"] }
rlp = { workspace = true }
# Substrate
pallet-balances = { workspace = true, features = ["default"] }
pallet-balances = { workspace = true, features = ["default", "insecure_zero_ed"] }
pallet-timestamp = { workspace = true, features = ["default"] }
sp-core = { workspace = true, features = ["default"] }
# Frontier
Expand Down
2 changes: 1 addition & 1 deletion frame/ethereum/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ impl frame_system::Config for Test {
}

parameter_types! {
pub const ExistentialDeposit: u64 = 0;
// For weight estimation, we assume that the most locks on an individual account will be 50.
// This number may need to be adjusted in the future if this assumption no longer holds true.
pub const MaxLocks: u32 = 50;
pub const ExistentialDeposit: u64 = 500;
}

impl pallet_balances::Config for Test {
Expand Down
1 change: 1 addition & 0 deletions template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ default = [
"rocksdb",
"sql",
"txpool",
"rpc-binary-search-estimate",
]
rocksdb = [
"sc-cli/rocksdb",
Expand Down
2 changes: 1 addition & 1 deletion template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ frame-system = { workspace = true }
frame-system-benchmarking = { workspace = true, optional = true }
frame-system-rpc-runtime-api = { workspace = true }
pallet-aura = { workspace = true }
pallet-balances = { workspace = true }
pallet-balances = { workspace = true, features = ["insecure_zero_ed"] }
pallet-grandpa = { workspace = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl pallet_timestamp::Config for Runtime {
}

parameter_types! {
pub const ExistentialDeposit: u128 = 500;
pub const ExistentialDeposit: u128 = 0;
// For weight estimation, we assume that the most locks on an individual account will be 50.
// This number may need to be adjusted in the future if this assumption no longer holds true.
pub const MaxLocks: u32 = 50;
Expand Down
2 changes: 1 addition & 1 deletion ts-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Each group will start a `frontier test node` with a given `spec` before executin
## Build the node for tests

```bash
cargo build --release --features rpc-binary-search-estimate
cargo build --release
```

## Installation
Expand Down
4 changes: 2 additions & 2 deletions ts-tests/tests/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const GENESIS_ACCOUNT = "0x6be02d1d3665660d22ff9624b7be0551ee1ac91b";
export const GENESIS_ACCOUNT_PRIVATE_KEY = "0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E342";
export const GENESIS_ACCOUNT_BALANCE = "340282366920938463463374607431768210955";
export const GENESIS_ACCOUNT_BALANCE = "340282366920938463463374607431768211455";

export const FIRST_CONTRACT_ADDRESS = "0xc2bf5f29a4384b1ab0c063e1c666f02121b6084a";

Expand All @@ -13,7 +13,7 @@ export const RUNTIME_IMPL_VERSION = 1;
export const CHAIN_ID = 42;
export const BLOCK_TIMESTAMP = 6; // 6 seconds per block
export const BLOCK_HASH_COUNT = 256;
export const EXISTENTIAL_DEPOSIT = 500; // The minimum amount required to keep an account open
export const EXISTENTIAL_DEPOSIT = 0; // The minimum amount required to keep an account open
export const ETH_BLOCK_GAS_LIMIT = 75000000; // The same configuration as runtime
export const ETH_BLOCK_POV_LIMIT = 5 * 1024 * 1024; // The same configuration as runtime

Expand Down
3 changes: 1 addition & 2 deletions ts-tests/tests/test-block-tags.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { expect } from "chai";
import { step } from "mocha-steps";

import { GENESIS_ACCOUNT, GENESIS_ACCOUNT_PRIVATE_KEY, GENESIS_ACCOUNT_BALANCE, EXISTENTIAL_DEPOSIT } from "./config";
import { createAndFinalizeBlock, describeWithFrontier, customRequest } from "./util";
import { createAndFinalizeBlock, describeWithFrontier } from "./util";

describeWithFrontier("Frontier RPC (BlockNumber tags)", (context) => {
before("Send some transactions across blocks", async function () {
Expand Down
4 changes: 2 additions & 2 deletions ts-tests/tests/test-state-override.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describeWithFrontier("Frontier RPC (StateOverride)", (context) => {
expect(balance.gten(1000), "balance was not above 1000 tether").to.be.true;
});

it("should have a sender balance of 4500 with state override", async function () {
it("should have a sender balance of 5000 with state override", async function () {
const { result } = await customRequest(context.web3, "eth_call", [
{
from: GENESIS_ACCOUNT,
Expand All @@ -82,7 +82,7 @@ describeWithFrontier("Frontier RPC (StateOverride)", (context) => {
},
},
]);
expect(Web3.utils.hexToNumberString(result)).to.equal("4500"); // 500 is consumed as gas
expect(Web3.utils.hexToNumberString(result)).to.equal("5000");
});

it("should have availableFunds of 100 without state override", async function () {
Expand Down

0 comments on commit d4aa56a

Please sign in to comment.