Skip to content

Commit

Permalink
fix: hex encode deposit auth sig (#2046)
Browse files Browse the repository at this point in the history
* fix hex encode deposit auth sig

* fix: z2 deployer tx signer address must be signed over in deposit auth sig

* fix replace staking-address with signing-address

* fix: update signer address in get_node_deposit_commands

* chore: clippy
  • Loading branch information
86667 authored Dec 19, 2024
1 parent b25a54a commit 148805c
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions z2/src/deployer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use cliclack::MultiProgress;
use colored::Colorize;
use strum::Display;
use tokio::{fs, sync::Semaphore, task};
use zilliqa::crypto::SecretKey;

use crate::{
address::EthereumAddress,
Expand Down Expand Up @@ -237,14 +238,20 @@ pub async fn get_node_deposit_commands(genesis_private_key: &str, node: &ChainNo
println!("\t--public-key {} \\", node_ethereum_address.bls_public_key);
println!(
"\t--deposit-auth-signature {} \\",
node_ethereum_address.secret_key.deposit_auth_signature(
node.chain_id(),
node_ethereum_address.secret_key.to_evm_address()
hex::encode(
node_ethereum_address
.secret_key
.deposit_auth_signature(
node.chain_id(),
SecretKey::from_hex(genesis_private_key)?.to_evm_address()
)
.as_raw_value()
.to_compressed()
)
);
println!("\t--private-key {} \\", genesis_private_key);
println!("\t--reward-address {} \\", ZERO_ACCOUNT);
println!("\t--staking-address {} \\", ZERO_ACCOUNT);
println!("\t--signing-address {} \\", ZERO_ACCOUNT);
println!("\t--amount {VALIDATOR_DEPOSIT_IN_MILLIONS}\n");

Ok(())
Expand Down Expand Up @@ -293,13 +300,16 @@ pub async fn run_deposit(config_file: &str, node_selection: bool) -> Result<()>
let validator = validators::Validator::new(
&node_ethereum_address.peer_id,
&node_ethereum_address.bls_public_key,
&node_ethereum_address
.secret_key
.deposit_auth_signature(
node.chain_id(),
node_ethereum_address.secret_key.to_evm_address(),
)
.to_string(),
&hex::encode(
node_ethereum_address
.secret_key
.deposit_auth_signature(
node.chain_id(),
SecretKey::from_hex(&genesis_private_key)?.to_evm_address(),
)
.as_raw_value()
.to_compressed(),
),
)?;
let stake = validators::StakeDeposit::new(
validator,
Expand Down

0 comments on commit 148805c

Please sign in to comment.