|
@@ -3361,7 +3361,7 @@ fn validator_flags(
|
|
));
|
|
));
|
|
};
|
|
};
|
|
|
|
|
|
- let mut pubkeys = value
|
|
|
|
|
|
+ let pubkeys = value
|
|
.as_array()
|
|
.as_array()
|
|
.unwrap()
|
|
.unwrap()
|
|
.iter()
|
|
.iter()
|
|
@@ -3370,36 +3370,33 @@ fn validator_flags(
|
|
Pubkey::from_str(address)
|
|
Pubkey::from_str(address)
|
|
.map_err(|_| anyhow!("Invalid pubkey {}", address))
|
|
.map_err(|_| anyhow!("Invalid pubkey {}", address))
|
|
})
|
|
})
|
|
- .collect::<Result<HashSet<Pubkey>>>()?;
|
|
|
|
-
|
|
|
|
- let accounts_keys = pubkeys.iter().cloned().collect::<Vec<_>>();
|
|
|
|
- let accounts = client.get_multiple_accounts(&accounts_keys)?;
|
|
|
|
-
|
|
|
|
- // Check if there are program accounts
|
|
|
|
- for (account, acc_key) in accounts.iter().zip(accounts_keys) {
|
|
|
|
- if let Some(account) = account {
|
|
|
|
- if account.owner == bpf_loader_upgradeable::id() {
|
|
|
|
- let upgradable: UpgradeableLoaderState = account
|
|
|
|
- .deserialize_data()
|
|
|
|
- .map_err(|_| anyhow!("Invalid program account {}", acc_key))?;
|
|
|
|
-
|
|
|
|
- if let UpgradeableLoaderState::Program {
|
|
|
|
- programdata_address,
|
|
|
|
- } = upgradable
|
|
|
|
|
|
+ .collect::<Result<HashSet<Pubkey>>>()?
|
|
|
|
+ .into_iter()
|
|
|
|
+ .collect::<Vec<_>>();
|
|
|
|
+ let accounts = client.get_multiple_accounts(&pubkeys)?;
|
|
|
|
+
|
|
|
|
+ for (pubkey, account) in pubkeys.into_iter().zip(accounts) {
|
|
|
|
+ match account {
|
|
|
|
+ Some(account) => {
|
|
|
|
+ // Use a different flag for program accounts to fix the problem
|
|
|
|
+ // described in https://github.com/anza-xyz/agave/issues/522
|
|
|
|
+ if account.owner == bpf_loader_upgradeable::id()
|
|
|
|
+ // Only programs are supported with `--clone-upgradeable-program`
|
|
|
|
+ && matches!(
|
|
|
|
+ account.deserialize_data::<UpgradeableLoaderState>()?,
|
|
|
|
+ UpgradeableLoaderState::Program { .. }
|
|
|
|
+ )
|
|
{
|
|
{
|
|
- pubkeys.insert(programdata_address);
|
|
|
|
|
|
+ flags.push("--clone-upgradeable-program".to_string());
|
|
|
|
+ flags.push(pubkey.to_string());
|
|
|
|
+ } else {
|
|
|
|
+ flags.push("--clone".to_string());
|
|
|
|
+ flags.push(pubkey.to_string());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- return Err(anyhow!("Account {} not found", acc_key));
|
|
|
|
|
|
+ _ => return Err(anyhow!("Account {} not found", pubkey)),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- for pubkey in &pubkeys {
|
|
|
|
- // Push the clone flag for each array entry
|
|
|
|
- flags.push("--clone".to_string());
|
|
|
|
- flags.push(pubkey.to_string());
|
|
|
|
- }
|
|
|
|
} else if key == "deactivate_feature" {
|
|
} else if key == "deactivate_feature" {
|
|
// Verify that the feature flags are valid pubkeys
|
|
// Verify that the feature flags are valid pubkeys
|
|
let pubkeys_result: Result<Vec<Pubkey>, _> = value
|
|
let pubkeys_result: Result<Vec<Pubkey>, _> = value
|