Skip to content

Commit

Permalink
configure min withdrawal limit with signature
Browse files Browse the repository at this point in the history
  • Loading branch information
salman01zp committed Feb 10, 2024
1 parent 13a8932 commit 9e0f8c2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions evm-test-utils/src/v_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,41 @@ impl VAnchorBridgeDeploymentConfig {
let hashed_data: H256 = keccak256(&unsigned_data).into();
let signature = self.deployer.sign_hash(hashed_data)?;

bridge
.execute_proposal_with_signature(
unsigned_data.into(),
signature.to_vec().into(),
)
.send()
.await?;

// Configure minimal withdrawal limit.

let function_sig_bytes =
v_anchor_contract::ConfigureMinimalWithdrawalLimitCall::selector()
.to_vec();
buf.copy_from_slice(&function_sig_bytes);
let function_sig = FunctionSignature::from(buf);

let mut min_withdrawl_limit_bytes = [0u8; 32];
min_withdrawal_limit.to_big_endian(&mut min_withdrawl_limit_bytes);

let nonce = vanchor
.proposal_nonce()
.await?
.checked_add(1u64.into())
.unwrap_or_default();
let nonce = Nonce(nonce.as_u32());

let mut unsigned_data = Vec::new();
unsigned_data.extend_from_slice(&vanchor_resource_id.to_bytes());
unsigned_data.extend_from_slice(&function_sig.to_bytes());
unsigned_data.extend_from_slice(&nonce.to_bytes());
unsigned_data.extend_from_slice(&min_withdrawl_limit_bytes);

let hashed_data: H256 = keccak256(&unsigned_data).into();
let signature = self.deployer.sign_hash(hashed_data)?;

bridge
.execute_proposal_with_signature(
unsigned_data.into(),
Expand Down

0 comments on commit 9e0f8c2

Please sign in to comment.