Skip to content

Commit

Permalink
fix: benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigoriy Simonov committed Apr 18, 2023
1 parent 2f7bbce commit 2a94e33
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

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

8 changes: 7 additions & 1 deletion frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,9 +1044,15 @@ impl From<InvalidEvmTransactionError> for InvalidTransactionWrapper {
}
}

#[derive(TypeInfo, PartialEq, Eq, Clone, Debug, Encode, Decode)]
#[derive(TypeInfo, PartialEq, Eq, Clone, Debug, Encode, Decode, Default)]
pub struct FakeTransactionFinalizer<T>(PhantomData<T>);

impl<T> FakeTransactionFinalizer<T> {
pub fn new() -> Self {
Self(Default::default())
}
}

impl<T: Config + TypeInfo + core::fmt::Debug + Send + Sync> sp_runtime::traits::SignedExtension
for FakeTransactionFinalizer<T>
{
Expand Down
2 changes: 2 additions & 0 deletions template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ substrate-frame-rpc-system = { workspace = true }
frame-benchmarking = { workspace = true, optional = true }
frame-benchmarking-cli = { workspace = true, optional = true }
frame-system = { workspace = true }
pallet-ethereum = { workspace = true }
pallet-transaction-payment = { workspace = true }

# Frontier
Expand Down Expand Up @@ -92,4 +93,5 @@ runtime-benchmarks = [
"frame-benchmarking-cli/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"frontier-template-runtime/runtime-benchmarks",
"pallet-ethereum/runtime-benchmarks",
]
2 changes: 2 additions & 0 deletions template/node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ pub fn create_benchmark_extrinsic(
frame_system::CheckNonce::<runtime::Runtime>::from(nonce),
frame_system::CheckWeight::<runtime::Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0),
pallet_ethereum::FakeTransactionFinalizer::<runtime::Runtime>::new(),
);

let raw_payload = runtime::SignedPayload::from_raw(
Expand All @@ -165,6 +166,7 @@ pub fn create_benchmark_extrinsic(
(),
(),
(),
(),
),
);
let signature = raw_payload.using_encoded(|e| sender.sign(e));
Expand Down

0 comments on commit 2a94e33

Please sign in to comment.