solana-devnet init multiple guardians
This commit is contained in:
parent
1b7ce3451e
commit
33298ca722
|
@ -32,6 +32,7 @@ use solana_clap_utils::{
|
|||
keypair_of,
|
||||
pubkey_of,
|
||||
value_of,
|
||||
values_of,
|
||||
},
|
||||
input_validators::{
|
||||
is_keypair,
|
||||
|
@ -256,7 +257,8 @@ fn main() {
|
|||
.takes_value(true)
|
||||
.index(2)
|
||||
.required(true)
|
||||
.help("Address of the initial guardian"),
|
||||
.require_delimiter(true)
|
||||
.help("Addresses of the initial guardians, comma delimited."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("guardian_set_expiration")
|
||||
|
@ -357,21 +359,24 @@ fn main() {
|
|||
let _ = match matches.subcommand() {
|
||||
("create-bridge", Some(arg_matches)) => {
|
||||
let bridge = pubkey_of(arg_matches, "bridge").unwrap();
|
||||
let initial_guardian: String = value_of(arg_matches, "guardian").unwrap();
|
||||
let initial_data = hex::decode(initial_guardian).unwrap();
|
||||
let initial_guardians = values_of::<String>(arg_matches, "guardian").unwrap();
|
||||
let initial_data: Vec<Vec<u8>> = initial_guardians
|
||||
.into_iter()
|
||||
.map(|key| hex::decode(key).unwrap())
|
||||
.collect::<Vec<Vec<u8>>>();
|
||||
let guardians: Vec<[u8; 20]> = initial_data
|
||||
.into_iter()
|
||||
.map(|key| {
|
||||
let mut guardian = [0u8; 20];
|
||||
guardian.copy_from_slice(&key);
|
||||
guardian
|
||||
})
|
||||
.collect::<Vec<[u8; 20]>>();
|
||||
let guardian_expiration: u32 =
|
||||
value_of(arg_matches, "guardian_set_expiration").unwrap();
|
||||
let msg_fee: u64 = value_of(arg_matches, "message_fee").unwrap();
|
||||
|
||||
let mut guardian = [0u8; 20];
|
||||
guardian.copy_from_slice(&initial_data);
|
||||
command_deploy_bridge(
|
||||
&config,
|
||||
&bridge,
|
||||
vec![guardian],
|
||||
guardian_expiration,
|
||||
msg_fee,
|
||||
)
|
||||
command_deploy_bridge(&config, &bridge, guardians, guardian_expiration, msg_fee)
|
||||
}
|
||||
("upgrade-authority", Some(arg_matches)) => {
|
||||
let bridge = pubkey_of(arg_matches, "bridge").unwrap();
|
||||
|
|
|
@ -30,10 +30,14 @@ cli_address=6sbzC1eH4FTujJXWj51eQe25cYvr4xfXbJ1vAj7j2k5J
|
|||
bridge_address=Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o
|
||||
nft_bridge_address=NFTWqJR8YnRVqPDvTJrYuLrQDitTG5AScqbeghi4zSA
|
||||
token_bridge_address=B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE
|
||||
initial_guardian=befa429d57cd18b7f8a4d91a2da9ab4af05d0fbe
|
||||
recipient_address=90F8bf6A479f320ead074411a4B0e7944Ea8c9C1
|
||||
chain_id_ethereum=2
|
||||
|
||||
# load the .env file with the devent init data
|
||||
source .env
|
||||
# remove brackets and double quotes, transform json list of strings to CSV with no quotes.
|
||||
guardians=$(echo $INIT_SIGNERS | sed -r 's/(\[|\]|\")//g')
|
||||
|
||||
retry () {
|
||||
while ! $@; do
|
||||
sleep 1
|
||||
|
@ -83,24 +87,25 @@ token-bridge-client create-meta "$nft" "Not a PUNK 2🎸" "PUNK2🎸" "https://w
|
|||
|
||||
# Create the bridge contract at a known address
|
||||
# OK to fail on subsequent attempts (already created).
|
||||
retry client create-bridge "$bridge_address" "$initial_guardian" 86400 100
|
||||
retry client create-bridge "$bridge_address" "$guardians" 86400 100
|
||||
|
||||
# Initialize the token bridge
|
||||
retry token-bridge-client create-bridge "$token_bridge_address" "$bridge_address"
|
||||
# Initialize the NFT bridge
|
||||
retry token-bridge-client create-bridge "$nft_bridge_address" "$bridge_address"
|
||||
|
||||
# pass the chain registration VAAs sourced from .env to the client's execute-governance command:
|
||||
pushd /usr/src/clients/token_bridge
|
||||
# Register the Token Bridge Endpoint on ETH
|
||||
node main.js solana execute_governance_vaa $(node main.js generate_register_chain_vaa 2 0x0000000000000000000000000290FB167208Af455bB137780163b7B7a9a10C16)
|
||||
node main.js solana execute_governance_vaa $(node main.js generate_register_chain_vaa 3 0x000000000000000000000000784999135aaa8a3ca5914468852fdddbddd8789d)
|
||||
node main.js solana execute_governance_vaa $(node main.js generate_register_chain_vaa 4 0x0000000000000000000000000290FB167208Af455bB137780163b7B7a9a10C16)
|
||||
node main.js solana execute_governance_vaa "$REGISTER_ETH_TOKEN_BRIDGE_VAA"
|
||||
node main.js solana execute_governance_vaa "$REGISTER_TERRA_TOKEN_BRIDGE_VAA"
|
||||
node main.js solana execute_governance_vaa "$REGISTER_BSC_TOKEN_BRIDGE_VAA"
|
||||
popd
|
||||
|
||||
pushd /usr/src/clients/nft_bridge
|
||||
# Register the NFT Bridge Endpoint on ETH
|
||||
node main.js solana execute_governance_vaa $(node main.js generate_register_chain_vaa 2 0x00000000000000000000000026b4afb60d6c903165150c6f0aa14f8016be4aec)
|
||||
node main.js solana execute_governance_vaa $(node main.js generate_register_chain_vaa 3 0x0000000000000000000000000fe5c51f539a651152ae461086d733777a54a134)
|
||||
node main.js solana execute_governance_vaa "$REGISTER_ETH_NFT_BRIDGE_VAA"
|
||||
node main.js solana execute_governance_vaa "$REGISTER_TERRA_NFT_BRIDGE_VAA"
|
||||
popd
|
||||
|
||||
# Let k8s startup probe succeed
|
||||
|
|
Loading…
Reference in New Issue