Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use cumulus_primitives_core::ParaId;
use laos_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT};
use fp_evm::GenesisAccount;
use laos_runtime::{AccountId, AuraId, Precompiles, Signature, EXISTENTIAL_DEPOSIT};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -190,6 +191,12 @@ fn testnet_genesis(
// let alice = get_from_seed::<sr25519::Public>("Alice");
// let bob = get_from_seed::<sr25519::Public>("Bob");

// This is the simplest bytecode to revert without returning any data.
// We will pre-deploy it under all of our precompiles to ensure they can be called from
// within contracts.
// (PUSH1 0x00 PUSH1 0x00 REVERT)
let revert_bytecode = vec![0x60, 0x00, 0x60, 0x00, 0xFD];

laos_runtime::RuntimeGenesisConfig {
system: laos_runtime::SystemConfig {
code: laos_runtime::WASM_BINARY
Expand Down Expand Up @@ -259,7 +266,21 @@ fn testnet_genesis(
evm_chain_id: laos_runtime::EVMChainIdConfig { chain_id: 1000, ..Default::default() },
evm: laos_runtime::EVMConfig {
accounts: {
let mut map = BTreeMap::new();
let mut map: BTreeMap<_, _> = Precompiles::used_addresses()
.iter()
.map(|&address| {
(
address.into(),
GenesisAccount {
nonce: Default::default(),
balance: Default::default(),
storage: Default::default(),
code: revert_bytecode.clone(),
},
)
})
.collect();

map.insert(
// H160 address of Alice dev account
// Derived from SS58 (42 prefix) address
Expand Down
2 changes: 2 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ pub type Executive = frame_executive::Executive<
AllPalletsWithSystem,
>;

pub type Precompiles = FrontierPrecompiles<Runtime>;

/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
/// node's balance type.
///
Expand Down