Skip to content

Commit

Permalink
Merge pull request #593 from jjyr/fix-deploy-with-multisig
Browse files Browse the repository at this point in the history
Fix deploy with multisig
  • Loading branch information
doitian authored Mar 27, 2024
2 parents 6b793d2 + b6c3c67 commit fd87f8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/subcommands/deploy/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub struct Cell {
pub name: String,
pub location: CellLocation,
pub enable_type_id: bool,
#[serde(default)]
pub force_redeploy: bool,
}

#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
Expand Down
3 changes: 2 additions & 1 deletion src/subcommands/deploy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,8 @@ fn load_cells(
let lock_script_unchanged = lock_script.as_slice() == old_lock_script.as_slice();
let type_id_unchanged = old_recipe.type_id.is_some() == config.enable_type_id;
// NOTE: we trust `old_recipe.data_hash` here
if data_unchanged && lock_script_unchanged && type_id_unchanged {
if data_unchanged && lock_script_unchanged && type_id_unchanged && !cell.force_redeploy
{
StateChange::Unchanged {
data,
data_hash,
Expand Down
14 changes: 3 additions & 11 deletions src/subcommands/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,17 +811,9 @@ impl TryFrom<ReprMultisigConfig> for MultisigConfig {
.sighash_addresses
.into_iter()
.map(|address_string| {
if let AddressPayload::Short { index, hash } =
Address::from_str(&address_string).map(|addr| addr.payload().clone())?
{
if index == CodeHashIndex::Sighash {
Ok(hash)
} else {
Err(format!("invalid address: {}", address_string))
}
} else {
Err(format!("invalid address: {}", address_string))
}
Address::from_str(&address_string)
.map(|addr| H160::from_slice(addr.payload().args().as_ref()))?
.map_err(|err| format!("invalid address: {address_string} error: {err:?}"))
})
.collect::<Result<Vec<_>, String>>()?;
MultisigConfig::new_with(sighash_addresses, repr.require_first_n, repr.threshold)
Expand Down

0 comments on commit fd87f8f

Please sign in to comment.