Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ab5c0d6
revive: bump polkavm
lrubasze Nov 21, 2025
56d2af4
revive: align to updated polkavm
lrubasze Nov 21, 2025
53ec86b
revive: disable polkavm logging
lrubasze Nov 21, 2025
2deab42
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Nov 21, 2025
fa32f59
revive: use instructions_with_isa
lrubasze Nov 21, 2025
f1e9b3a
revive: updates call_builder
lrubasze Nov 21, 2025
42c84c1
bump polkavm globally
lrubasze Nov 24, 2025
b6e3343
revive: Add pvm_logs flag to DebugSettings
lrubasze Nov 24, 2025
cf29625
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Nov 24, 2025
8d84b6a
fix prdoc
lrubasze Nov 24, 2025
370a3df
Merge remote-tracking branch 'origin/master' into lrubasze/disable-po…
lrubasze Nov 24, 2025
3d02063
pallet-revive: Use PVM Revive instructions
lrubasze Nov 24, 2025
b1fdac9
pallet-revive: refactor sbrk test
lrubasze Nov 24, 2025
a8fe524
pallet-revive-fixtures: cleanup
lrubasze Nov 24, 2025
8b987c6
pallet-revive-fixtures: cleanup 2
lrubasze Nov 24, 2025
e2acf38
fix prdoc
lrubasze Nov 25, 2025
23480ed
Merge remote-tracking branch 'origin/master' into lrubasze/disable-po…
lrubasze Nov 25, 2025
4b2689e
pallet-revive-fixtures: cleanup after merging master
lrubasze Nov 25, 2025
d3d1104
pallet-revive-fixtures: clippy
lrubasze Nov 25, 2025
c1f3190
fix build
lrubasze Nov 25, 2025
be83ba2
fix prdoc
lrubasze Nov 25, 2025
fd2c14e
fix prdoc
lrubasze Nov 25, 2025
50ea4d2
fix prdoc
lrubasze Nov 25, 2025
4a4bf41
Merge branch 'master' into lrubasze/disable-polkavm-logging
lrubasze Nov 26, 2025
519114e
pallet-revive-fixtures: bump polkavm in _Cargo.toml template
lrubasze Nov 26, 2025
c0bd94e
pallet-revive: add some comment
lrubasze Nov 26, 2025
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
40 changes: 27 additions & 13 deletions Cargo.lock

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

13 changes: 13 additions & 0 deletions prdoc/pr_10385.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: Disable polkavm logging in `pallet-revive`
doc:
- audience: Runtime Dev
description: |-
This PR disables logging in `polkavm` in `pallet-revive`.
This is to make sure massive `polkavm` logging don't impact the overall perfomance, which might be manifested with eg. long block proposal time.

details: https://github.com/paritytech/polkadot-sdk/issues/8760#issuecomment-3499548774

The fix requires bumping `polkavm` to `0.30.0` which includes a method that allows to disable logging.
crates:
- name: pallet-revive
bump: minor
4 changes: 2 additions & 2 deletions substrate/frame/revive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ num-bigint = { workspace = true }
num-integer = { workspace = true }
num-traits = { workspace = true }
paste = { workspace = true }
polkavm = { version = "0.29.1", default-features = false }
polkavm-common = { version = "0.29.0", default-features = false, features = ["alloc"] }
polkavm = { version = "0.30.0", default-features = false }
polkavm-common = { version = "0.30.0", default-features = false, features = ["alloc"] }
rand = { workspace = true, optional = true }
rand_pcg = { workspace = true, optional = true }
revm = { workspace = true }
Expand Down
12 changes: 10 additions & 2 deletions substrate/frame/revive/src/call_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,11 @@ impl VmBinaryModule {
}
}
text.push_str("ret\n");
let code = polkavm_common::assembler::assemble(&text).unwrap();
let code = polkavm_common::assembler::assemble(
Some(polkavm_common::program::InstructionSetKind::ReviveV1),
&text,
)
.unwrap();
Self::new(code)
}

Expand Down Expand Up @@ -478,7 +482,11 @@ impl VmBinaryModule {
ret
"
);
let code = polkavm_common::assembler::assemble(&text).unwrap();
let code = polkavm_common::assembler::assemble(
Some(polkavm_common::program::InstructionSetKind::ReviveV1),
&text,
)
.unwrap();
Self::new(code)
}

Expand Down
5 changes: 2 additions & 3 deletions substrate/frame/revive/src/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ pub mod code {
pvm_blob: Vec<u8>,
available_syscalls: &[&[u8]],
) -> Result<Vec<u8>, DispatchError> {
use polkavm::program::ISA64_V1 as ISA;
use polkavm_common::program::EstimateInterpreterMemoryUsageArgs;
use polkavm_common::program::{EstimateInterpreterMemoryUsageArgs, ISA_Latest64 as ISA};
Comment thread
lrubasze marked this conversation as resolved.
Outdated

let len: u64 = pvm_blob.len() as u64;
if len > crate::limits::code::BLOB_BYTES.into() {
Expand Down Expand Up @@ -190,7 +189,7 @@ pub mod code {
let mut block_size: u32 = 0;
let mut basic_block_count: u32 = 0;
let mut instruction_count: u32 = 0;
for inst in program.instructions(ISA) {
Comment thread
lrubasze marked this conversation as resolved.
for inst in program.instructions_with_isa(ISA) {
Comment thread
lrubasze marked this conversation as resolved.
Outdated
use polkavm::program::Instruction;
block_size += 1;
instruction_count += 1;
Expand Down
6 changes: 5 additions & 1 deletion substrate/frame/revive/src/vm/pvm/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ impl<T: Config> ContractBlob<T> {
aux_data_size: u32,
) -> Result<PreparedCall<E>, ExecError> {
let mut config = polkavm::Config::default();
// Log filtering by level with log::enabled! returns always true,
// passing all logs through impacting performance \
// (more details: https://github.com/paritytech/polkadot-sdk/issues/8760#issuecomment-3499548774)
// Let's disable polkavm logging.
config.set_imperfect_logger_filtering_workaround(true);
config.set_backend(Some(polkavm::BackendKind::Interpreter));
config.set_cache_enabled(false);
#[cfg(feature = "std")]
Expand All @@ -62,7 +67,6 @@ impl<T: Config> ContractBlob<T> {
let mut module_config = polkavm::ModuleConfig::new();
module_config.set_page_size(limits::PAGE_SIZE);
module_config.set_gas_metering(Some(polkavm::GasMeteringKind::Sync));
module_config.set_allow_sbrk(false);
module_config.set_aux_data_size(aux_data_size);
let module =
polkavm::Module::new(&engine, &module_config, self.code.into()).map_err(|err| {
Expand Down
Loading