Skip to content

Commit 53d0963

Browse files
committed
client: print sha256 of proposal wasm
1 parent 6b827ec commit 53d0963

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

crates/governance/src/storage/mod.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::collections::{BTreeMap, BTreeSet};
1212
use namada_core::address::Address;
1313
use namada_core::borsh::BorshDeserialize;
1414
use namada_core::collections::HashSet;
15+
use namada_core::hash::Hash;
1516
use namada_core::storage::Epoch;
1617
use namada_core::token;
1718
use namada_state::{
@@ -169,17 +170,29 @@ where
169170
let proposal_type: Option<ProposalType> =
170171
storage.read(&proposal_type_key)?;
171172

172-
let proposal = proposal_type.map(|proposal_type| StorageProposal {
173+
let proposal_type = if let Some(proposal_type) = proposal_type {
174+
if let ProposalType::DefaultWithWasm(_) = proposal_type {
175+
let proposal_code_key = governance_keys::get_proposal_code_key(id);
176+
let proposal_code: Vec<u8> =
177+
storage.read(&proposal_code_key)?.unwrap_or_default();
178+
let proposal_code_hash = Hash::sha256(proposal_code);
179+
ProposalType::DefaultWithWasm(proposal_code_hash)
180+
} else {
181+
proposal_type
182+
}
183+
} else {
184+
return Ok(None);
185+
};
186+
187+
Ok(Some(StorageProposal {
173188
id,
174189
content: content.unwrap(),
175190
author: author.unwrap(),
176191
r#type: proposal_type,
177192
voting_start_epoch: voting_start_epoch.unwrap(),
178193
voting_end_epoch: voting_end_epoch.unwrap(),
179194
activation_epoch: activation_epoch.unwrap(),
180-
});
181-
182-
Ok(proposal)
195+
}))
183196
}
184197

185198
/// Query all the votes for a proposal_id

crates/node/src/shell/governance.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,6 @@ where
122122
TallyResult::Passed => {
123123
let proposal_event = match proposal_type {
124124
ProposalType::Default => {
125-
let proposal_code =
126-
gov_api::get_proposal_code(&shell.state, id)?
127-
.unwrap_or_default();
128-
let _result = execute_default_proposal(
129-
shell,
130-
id,
131-
proposal_code.clone(),
132-
)?;
133125
tracing::info!(
134126
"Governance proposal #{} (default) has passed.",
135127
id,

0 commit comments

Comments
 (0)