Skip to content

Commit

Permalink
update build, fix fmt and tomls
Browse files Browse the repository at this point in the history
  • Loading branch information
KitHat committed Nov 3, 2024
1 parent ec0303a commit 12037b3
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 32 deletions.
8 changes: 4 additions & 4 deletions evm-template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[workspace]
members = ["node", "runtime", "template-fuzzer"]
members = [ "node", "runtime", "template-fuzzer" ]
resolver = "2"

[workspace.package]
authors = ["OpenZeppelin"]
authors = [ "OpenZeppelin" ]
description = "EVM Runtime template for Polkadot Para{chains, cores}"
edition = "2021"
license = "GPL-3.0-only"
repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates"

[workspace.dependencies]
clap = { version = "4.5.3", features = ["derive"] }
clap = { version = "4.5.3", features = [ "derive" ] }
color-print = "0.3.4"
futures = "0.3.30"
hex = "0.4.3"
hex-literal = "0.4.1"
jsonrpsee = { version = "0.23.2", features = ["server"] }
jsonrpsee = { version = "0.23.2", features = [ "server" ] }
log = { version = "0.4.21", default-features = false }
parity-scale-codec = { version = "3.6.12", default-features = false, features = [
"derive",
Expand Down
2 changes: 1 addition & 1 deletion evm-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ version = "1.0.0"
targets = [ "x86_64-unknown-linux-gnu" ]

[dependencies]
openzeppelin-procedural = {workspace = true}
hex-literal = { workspace = true, optional = true }
log = { workspace = true }
parity-scale-codec = { workspace = true, features = [ "derive" ] }
scale-info = { workspace = true, features = [ "derive" ] }
smallvec = { workspace = true }

openzeppelin-polkadot-wrappers = { workspace = true }
openzeppelin-procedural = { workspace = true }

# Substrate
frame-benchmarking = { workspace = true, optional = true }
Expand Down
20 changes: 14 additions & 6 deletions evm-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ use sp_core::H160;
pub use sp_runtime::BuildStorage;
use sp_runtime::{
impl_opaque_keys,
traits::{
DispatchInfoOf, Dispatchable, Get, PostDispatchInfoOf, UniqueSaturatedInto,
},
traits::{DispatchInfoOf, Dispatchable, Get, PostDispatchInfoOf, UniqueSaturatedInto},
transaction_validity::{TransactionValidity, TransactionValidityError},
};
pub use sp_runtime::{MultiAddress, Perbill, Permill};
Expand All @@ -45,11 +43,20 @@ pub use crate::{
AccountId, Balance, Block, BlockNumber, Executive, Nonce, Signature, UncheckedExtrinsic,
},
};
#[cfg(feature = "runtime-benchmarks")]
use crate::{
configs::{
asset_config::AssetType, xcm_config::RelayLocation, FeeAssetId, TransactionByteFee,
XcmExecutorConfig,
},
constants::currency::{CENTS, EXISTENTIAL_DEPOSIT},
types::{Address, AssetId},
};
#[cfg(feature = "async-backing")]
use crate::{constants::SLOT_DURATION, types::ConsensusHook};

#[cfg(feature = "runtime-benchmarks")]
use crate::{types::{RelayLocation, FeeAssetId, TransactionByteFee, AssetId, Address}, configs::{ExistentialDeposit, AssetType, xcm_config::XcmConfig}, constants::currency::CENTS};
type ExistentialDeposit = sp_core::ConstU128<EXISTENTIAL_DEPOSIT>;

impl fp_self_contained::SelfContainedCall for RuntimeCall {
type SignedInfo = H160;
Expand Down Expand Up @@ -212,7 +219,7 @@ mod apis {
mod evm {
type RuntimeCall = RuntimeCall;
type Executive = Executive;
type Ethereum = Ethereum;
type Ethereum = Ethereum;
}

#[abstraction]
Expand Down Expand Up @@ -257,12 +264,13 @@ mod apis {
type System = System;
type ExistentialDeposit = ExistentialDeposit;
type AssetId = AssetId;
type XCMConfig = XcmConfig;
type XCMConfig = XcmExecutorConfig;
type AccountId = AccountId;
type Cents = CENTS;
type FeeAssetId = FeeAssetId;
type TransactionByteFee = TransactionByteFee;
type Address = Address;
type Balances = Balances;
}
}

Expand Down
2 changes: 1 addition & 1 deletion generic-template/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions generic-template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[workspace]
members = ["node", "runtime", "template-fuzzer"]
members = [ "node", "runtime", "template-fuzzer" ]
resolver = "2"

[workspace.package]
authors = ["OpenZeppelin"]
authors = [ "OpenZeppelin" ]
description = "Generic runtime template for Polkadot Para{chains, cores}"
edition = "2021"
license = "GPL-3.0-only"
repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates"

[workspace.dependencies]
clap = { version = "4.5.3", features = ["derive"] }
clap = { version = "4.5.3", features = [ "derive" ] }
color-print = "0.3.4"
futures = "0.3.30"
hex-literal = "0.4.1"
jsonrpsee = { version = "0.23.2", features = ["server"] }
jsonrpsee = { version = "0.23.2", features = [ "server" ] }
log = { version = "0.4.21", default-features = false }
parity-scale-codec = { version = "3.6.12", default-features = false, features = [
"derive",
Expand Down
14 changes: 7 additions & 7 deletions generic-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ repository = { workspace = true }
version = "2.0.0"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = [ "x86_64-unknown-linux-gnu" ]

[dependencies]
hex-literal = { workspace = true, optional = true }
log = { workspace = true }
parity-scale-codec = { workspace = true, features = ["derive"] }
scale-info = { workspace = true, features = ["derive"] }
parity-scale-codec = { workspace = true, features = [ "derive" ] }
scale-info = { workspace = true, features = [ "derive" ] }
smallvec = { workspace = true }

openzeppelin-polkadot-wrappers = { workspace = true }
Expand Down Expand Up @@ -254,10 +254,10 @@ try-runtime = [
# A feature that should be enabled when the runtime should be built for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller, like logging for example.
on-chain-release-build = ["sp-api/disable-logging"]
on-chain-release-build = [ "sp-api/disable-logging" ]

async-backing = ["openzeppelin-procedural/async-backing"]
async-backing = [ "openzeppelin-procedural/async-backing" ]

default = ["std"]
default = [ "std" ]

metadata-hash = ["substrate-wasm-builder/metadata-hash"]
metadata-hash = [ "substrate-wasm-builder/metadata-hash" ]
20 changes: 12 additions & 8 deletions generic-template/runtime/src/apis.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
use openzeppelin_procedural::openzeppelin_runtime_apis;

#[cfg(feature = "runtime-benchmarks")]
use crate::constants::currency::{CENTS, EXISTENTIAL_DEPOSIT};
#[cfg(not(feature = "async-backing"))]
use crate::Aura;
#[cfg(feature = "async-backing")]
use crate::{constants::SLOT_DURATION, types::ConsensusHook};
#[cfg(feature = "runtime-benchmarks")]
use crate::{
constants::currency::CENTS, configs::xcm_config::XcmConfig, Address
};
use crate::{
constants::VERSION,
types::{AccountId, Balance, Block, Executive, Nonce},
InherentDataExt, ParachainSystem, Runtime, RuntimeCall, RuntimeGenesisConfig, SessionKeys,
System, TransactionPayment, RuntimeBlockWeights
InherentDataExt, ParachainSystem, Runtime, RuntimeBlockWeights, RuntimeCall,
RuntimeGenesisConfig, SessionKeys, System, TransactionPayment,
};

use openzeppelin_procedural::openzeppelin_runtime_apis;
#[cfg(feature = "runtime-benchmarks")]
type ExistentialDeposit = sp_core::ConstU128<EXISTENTIAL_DEPOSIT>;

#[openzeppelin_runtime_apis]
mod apis {
Expand Down Expand Up @@ -52,6 +53,8 @@ mod apis {

#[abstraction]
mod benchmarks {
use crate::configs::XcmExecutorConfig;

type AllPalletsWithSystem = AllPalletsWithSystem;
type Assets = Assets;
type AssetManager = AssetManager;
Expand All @@ -62,11 +65,12 @@ mod apis {
type System = System;
type ExistentialDeposit = ExistentialDeposit;
type AssetId = AssetId;
type XCMConfig = XcmConfig;
type XCMConfig = XcmExecutorConfig;
type AccountId = AccountId;
type Cents = CENTS;
type FeeAssetId = FeeAssetId;
type TransactionByteFee = TransactionByteFee;
type Address = Address;
type Balances = Balances;
}
}
4 changes: 3 additions & 1 deletion generic-template/runtime/src/configs/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ mod testing {
/// AssetManager::set_asset_type_asset_id() and should NOT be used in any production code.
impl From<Location> for CurrencyId {
fn from(location: Location) -> CurrencyId {
use xcm_primitives::AssetTypeGetter;
use xcm_primitives::{AsAssetType, AssetTypeGetter};

use crate::{configs::asset_config::AssetType, AssetManager};

// If it does not exist, for benchmarking purposes, we create the association
let asset_id = if let Some(asset_id) =
Expand Down

0 comments on commit 12037b3

Please sign in to comment.