Skip to content

Commit

Permalink
enable our chain extension
Browse files Browse the repository at this point in the history
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
  • Loading branch information
xermicus committed Jan 9, 2024
1 parent 735f840 commit 68d4554
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions parachain-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ pallet-contracts-primitives = { workspace = true }
pallet-insecure-randomness-collective-flip = { workspace = true }
pallet-assets = { workspace = true }

# Chain extension
bn = { workspace = true, default-features = false }
ff_wasm_unknown_unknown = { workspace = true, features = ["derive"] }

[features]
default = [
"std",
Expand Down
4 changes: 2 additions & 2 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ pallet-insecure-randomness-collective-flip = { workspace = true }
pallet-assets = { workspace = true }

# Chain extension
bn = { package = "substrate-bn", version = "0.6", default-features = false }
ff_wasm_unknown_unknown = { features = ["derive"], version = "0.12.2" }
bn = { workspace = true, default-features = false }
ff_wasm_unknown_unknown = { workspace = true, features = ["derive"] }

# Used for the node template's RPCs
frame-system-rpc-runtime-api = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/chain_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use pallet_contracts::chain_extension::{
use sp_core::crypto::UncheckedFrom;
use sp_runtime::DispatchError;

use super::Randomness;
use crate::{mimc::mimc_feistel, Runtime};
use frame_support::traits::Randomness;

pub(crate) enum InvalidArgument {
NotInField = 1,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/contracts_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl pallet_contracts::Config for Runtime {
type CallStack = [pallet_contracts::Frame<Self>; 23];
type WeightPrice = pallet_transaction_payment::Pallet<Self>;
type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
type ChainExtension = ();
type ChainExtension = crate::chain_ext::FetchRandomExtension;
type Schedule = Schedule;
type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
// This node is geared towards development and testing of contracts.
Expand Down
4 changes: 4 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
mod assets_config;
mod contracts_config;

mod bn128;
mod chain_ext;
mod mimc;

use frame_support::dispatch::DispatchClass;
use frame_system::limits::{BlockLength, BlockWeights};
use polkadot_runtime_common::SlowAdjustingFeeUpdate;
Expand Down

0 comments on commit 68d4554

Please sign in to comment.