Skip to content

Commit

Permalink
Rename legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Dec 13, 2023
1 parent 9904d0e commit 90ea519
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions governance/remote_executor/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use {
PostVAAData,
},
Account,
Config,
Config as BridgeConfig,
FeeCollector,
GuardianSet,
VAA as PostedVAA,
Expand All @@ -84,9 +84,9 @@ fn main() -> Result<()> {
let vaa_bytes: Vec<u8> = base64::decode(vaa)?;
let wormhole = AnchorVaa::owner();

let wormhole_config = Config::key(&wormhole, ());
let wormhole_config = BridgeConfig::key(&wormhole, ());
let wormhole_config_data =
Config::try_from_slice(&rpc_client.get_account_data(&wormhole_config)?)?;
BridgeConfig::try_from_slice(&rpc_client.get_account_data(&wormhole_config)?)?;

let guardian_set = GuardianSet::key(&wormhole, wormhole_config_data.guardian_set_index);
let guardian_set_data =
Expand Down Expand Up @@ -163,10 +163,10 @@ fn main() -> Result<()> {
let wormhole = Pubkey::from_str("worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth")?;

let fee_collector = FeeCollector::key(&wormhole, ());
let wormhole_config = Config::key(&wormhole, ());
let wormhole_config = BridgeConfig::key(&wormhole, ());

let wormhole_config_data =
Config::try_from_slice(&rpc_client.get_account_data(&wormhole_config)?)?;
BridgeConfig::try_from_slice(&rpc_client.get_account_data(&wormhole_config)?)?;

let payload = ExecutorPayload {
header: GovernanceHeader::executor_governance_header(),
Expand Down
23 changes: 12 additions & 11 deletions target_chains/solana/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ use {
PostVAAData,
},
Account,
Config,
Config as BridgeConfig,
GuardianSet,
VAA,
VAA as LegacyPostedVaa,
},
};

Expand Down Expand Up @@ -93,10 +93,11 @@ fn main() -> Result<()> {
let (header, body): (Header, Body<&RawMessage>) = parsed_vaa.into();

println!("[2/5] Get wormhole guardian set configuration");
let wormhole_config = Config::key(&wormhole, ());
let wormhole_config = BridgeConfig::key(&wormhole, ());

let wormhole_config_data =
Config::try_from_slice(&rpc_client.get_account_data(&wormhole_config)?)?;
let wormhole_config_data = BridgeConfig::try_from_slice(
&rpc_client.get_account_data(&wormhole_config)?,
)?;

let guardian_set = Pubkey::find_program_address(
&[
Expand All @@ -113,7 +114,7 @@ fn main() -> Result<()> {
.expect("Keypair not found");

let vaa_hash = body.digest().unwrap().hash;
let vaa_pubkey = VAA::key(&wormhole, vaa_hash);
let vaa_pubkey = LegacyPostedVaa::key(&wormhole, vaa_hash);
let _vaa_account = match rpc_client.get_account_data(&vaa_pubkey) {
Ok(account_data) => {
println!("[3/5] VAA already posted on solana. Skipping verifying signatures step");
Expand Down Expand Up @@ -257,7 +258,7 @@ pub fn process_upgrade_guardian_set(
legacy_guardian_set: bool,
) -> Result<()> {
let posted_vaa =
process_post_vaa(rpc_client, vaa, wormhole, payer, legacy_guardian_set).unwrap();
process_legacy_post_vaa(rpc_client, vaa, wormhole, payer, legacy_guardian_set).unwrap();
let parsed_vaa: Vaa<&RawMessage> = serde_wormhole::from_slice(vaa).unwrap();
let (header, body): (Header, Body<&RawMessage>) = parsed_vaa.into();
let guardian_set_index_old = header.guardian_set_index;
Expand Down Expand Up @@ -291,7 +292,7 @@ fn deserialize_guardian_set(buf: &mut &[u8], legacy_guardian_set: bool) -> Resul
Ok(guardian_set)
}

pub fn process_post_vaa(
pub fn process_legacy_post_vaa(
rpc_client: &RpcClient,
vaa: &[u8],
wormhole: Pubkey,
Expand All @@ -301,10 +302,10 @@ pub fn process_post_vaa(
let parsed_vaa: Vaa<&RawMessage> = serde_wormhole::from_slice(vaa).unwrap();
let (header, body): (Header, Body<&RawMessage>) = parsed_vaa.into();

let wormhole_config = Config::key(&wormhole, ());
let wormhole_config = BridgeConfig::key(&wormhole, ());

let wormhole_config_data =
Config::try_from_slice(&rpc_client.get_account_data(&wormhole_config)?)?;
BridgeConfig::try_from_slice(&rpc_client.get_account_data(&wormhole_config)?)?;

let guardian_set = Pubkey::find_program_address(
&[
Expand All @@ -321,7 +322,7 @@ pub fn process_post_vaa(
)?;

let vaa_hash = body.digest().unwrap().hash;
let vaa_pubkey = VAA::key(&wormhole, vaa_hash);
let vaa_pubkey = LegacyPostedVaa::key(&wormhole, vaa_hash);

let signature_set_keypair = Keypair::new();

Expand Down

0 comments on commit 90ea519

Please sign in to comment.