Skip to content

Commit

Permalink
Removes vp updates
Browse files Browse the repository at this point in the history
  • Loading branch information
grarco committed Feb 8, 2024
1 parent 4209a74 commit 62330ac
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
43 changes: 22 additions & 21 deletions wasm/wasm_source/src/tx_update_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@ fn apply_tx(ctx: &mut Ctx, tx: Tx) -> TxResult {
let owner = &tx_data.addr;
debug_log!("update VP for: {:#?}", tx_data.addr);

if let Some(hash) = tx_data.vp_code_hash {
let vp_code_sec = signed
.get_section(&hash)
.ok_or_err_msg("vp code section not found")
.map_err(|err| {
ctx.set_commitment_sentinel();
err
})?
.extra_data_sec()
.ok_or_err_msg("vp code section must be tagged as extra")
.map_err(|err| {
ctx.set_commitment_sentinel();
err
})?;

ctx.update_validity_predicate(
owner,
vp_code_sec.code.hash(),
&vp_code_sec.tag,
)?;
}
// TODO: commented out for now cause we don't want to support vp changes
// if let Some(hash) = tx_data.vp_code_hash {
// let vp_code_sec = signed
// .get_section(&hash)
// .ok_or_err_msg("vp code section not found")
// .map_err(|err| {
// ctx.set_commitment_sentinel();
// err
// })?
// .extra_data_sec()
// .ok_or_err_msg("vp code section must be tagged as extra")
// .map_err(|err| {
// ctx.set_commitment_sentinel();
// err
// })?;

// ctx.update_validity_predicate(
// owner,
// vp_code_sec.code.hash(),
// &vp_code_sec.tag,
// )?;
// }

if let Some(threshold) = tx_data.threshold {
let threshold_key = account::threshold_key(owner);
Expand Down
7 changes: 5 additions & 2 deletions wasm/wasm_source/src/vp_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ fn validate_tx(
KeyType::PgfSteward(address) => address != &addr || *valid_sig,
KeyType::GovernanceVote(voter) => voter != &addr || *valid_sig,
KeyType::Vp(owner) => {
let has_post: bool = ctx.has_key_post(key)?;
if owner == &addr {
has_post && *valid_sig
// TODO: disabled cause we don't want to support vp changes
// for now let has_post: bool =
// ctx.has_key_post(key)?; has_post &&
// *valid_sig
false
} else {
true
}
Expand Down

0 comments on commit 62330ac

Please sign in to comment.