Skip to content

Commit d19ef71

Browse files
committed
fix: Preimage hash fix
1 parent 87e9c6c commit d19ef71

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/cli/referenda.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async fn submit_remark_proposal(
269269
origin_type: &str,
270270
execution_mode: crate::cli::common::ExecutionMode,
271271
) -> crate::error::Result<()> {
272-
use qp_poseidon::PoseidonHasher;
272+
use sp_runtime::traits::{BlakeTwo256, Hash};
273273

274274
log_print!("📝 Submitting System::remark Proposal to Referenda");
275275
log_print!(" 💬 Message: {}", message.bright_cyan());
@@ -288,9 +288,8 @@ async fn submit_remark_proposal(
288288

289289
log_verbose!("📝 Encoded call size: {} bytes", encoded_call.len());
290290

291-
// Compute preimage hash using Poseidon
292-
let preimage_hash: sp_core::H256 =
293-
<PoseidonHasher as sp_runtime::traits::Hash>::hash(&encoded_call);
291+
// Must match `frame_system::Config::Hashing` (BlakeTwo256) — same key as `pallet_preimage`.
292+
let preimage_hash: sp_core::H256 = BlakeTwo256::hash(&encoded_call);
294293

295294
log_print!("🔗 Preimage hash: {:?}", preimage_hash);
296295

src/cli/tech_referenda.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ async fn submit_runtime_upgrade_with_preimage(
360360
password_file: Option<String>,
361361
execution_mode: crate::cli::common::ExecutionMode,
362362
) -> crate::error::Result<()> {
363-
use qp_poseidon::PoseidonHasher;
363+
use sp_runtime::traits::{BlakeTwo256, Hash};
364364

365365
log_print!("📝 Submitting Runtime Upgrade Proposal to Tech Referenda");
366366
log_print!(" 📂 WASM file: {}", wasm_file.display().to_string().bright_cyan());
@@ -393,9 +393,8 @@ async fn submit_runtime_upgrade_with_preimage(
393393

394394
log_verbose!("📝 Encoded call size: {} bytes", encoded_call.len());
395395

396-
// Compute preimage hash using Poseidon (runtime uses PoseidonHasher)
397-
let preimage_hash: sp_core::H256 =
398-
<PoseidonHasher as sp_runtime::traits::Hash>::hash(&encoded_call);
396+
// Must match `frame_system::Config::Hashing` (BlakeTwo256) — same key as `pallet_preimage`.
397+
let preimage_hash: sp_core::H256 = BlakeTwo256::hash(&encoded_call);
399398

400399
log_print!("🔗 Preimage hash: {:?}", preimage_hash);
401400

0 commit comments

Comments
 (0)