chore: Upgrade Anchor to 0.26.0

This commit is contained in:
Sebastian Bor 2022-12-21 12:41:09 +00:00
parent 55b5ea2390
commit fd850016e6
6 changed files with 2184 additions and 635 deletions

2772
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
voter-stake-registry = { path = "../programs/voter-stake-registry", features = ["no-entrypoint"] }
anchor-lang = "0.24.2"
anchor-lang = "0.26.0"
serde = "^1.0"
serde_json = "^1.0"

View File

@ -21,8 +21,8 @@ test-bpf = []
[dependencies]
# a) for deployment use these
anchor-lang = { version = "0.24.2", features = ["init-if-needed"] }
anchor-spl = { version = "0.24.2" }
anchor-lang = { version = "0.26.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.26.0" }
# b) while testing, use below dependencies for debugging instead of above ones
# anchor-lang = { git = "https://github.com/microwavedcola1/anchor.git", branch = "master-debug" }
# anchor-spl = { git = "https://github.com/microwavedcola1/anchor.git", branch = "master-debug", features = ["governance"]}
@ -39,13 +39,13 @@ bytemuck = "1.9.1"
spl-governance = { version = "=2.2.1", features = ["no-entrypoint"] }
spl-governance-addin-api = "=0.1.1"
solana-program = "~1.9.13"
solana-program = "1.14.10"
static_assertions = "1.1"
[dev-dependencies]
solana-sdk = "~1.9.13"
solana-program-test = "~1.9.13"
solana-logger = "~1.9.13"
solana-sdk = "1.14.10"
solana-program-test = "1.14.10"
solana-logger = "1.14.10"
spl-token = { version = "^3.0.0", features = ["no-entrypoint"] }
spl-associated-token-account = { version = "^1.0.3", features = ["no-entrypoint"] }
bytemuck = "^1.7.2"

View File

@ -1,7 +1,7 @@
use std::sync::Arc;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::transport::TransportError;
use solana_sdk::{
instruction::Instruction,
signature::{Keypair, Signer},
@ -234,7 +234,7 @@ impl AddinCookie {
start_ts: Option<u64>,
periods: u32,
allow_clawback: bool,
) -> std::result::Result<(), TransportError> {
) -> std::result::Result<(), BanksClientError> {
let vault = voter.vault_address(&voting_mint);
let data = anchor_lang::InstructionData::data(
@ -287,7 +287,7 @@ impl AddinCookie {
token_address: Pubkey,
deposit_entry_index: u8,
amount: u64,
) -> std::result::Result<(), TransportError> {
) -> std::result::Result<(), BanksClientError> {
let vault = voter.vault_address(&voting_mint);
let data =
@ -336,7 +336,7 @@ impl AddinCookie {
deposit_token: Pubkey,
token_authority: &Keypair,
grant_authority: &Keypair,
) -> std::result::Result<VoterCookie, TransportError> {
) -> std::result::Result<VoterCookie, BanksClientError> {
let (voter, voter_bump) = Pubkey::find_program_address(
&[
&registrar.address.to_bytes(),
@ -417,7 +417,7 @@ impl AddinCookie {
realm_authority: &Keypair,
token_address: Pubkey,
deposit_entry_index: u8,
) -> std::result::Result<(), TransportError> {
) -> std::result::Result<(), BanksClientError> {
let vault = voter.vault_address(&voting_mint);
let data =
@ -461,7 +461,7 @@ impl AddinCookie {
token_address: Pubkey,
deposit_entry_index: u8,
amount: u64,
) -> std::result::Result<(), TransportError> {
) -> std::result::Result<(), BanksClientError> {
let vault = voter.vault_address(&voting_mint);
let data =
@ -505,7 +505,7 @@ impl AddinCookie {
voter: &VoterCookie,
voting_mint: &VotingMintConfigCookie,
voter_authority: &Keypair,
) -> std::result::Result<(), TransportError> {
) -> std::result::Result<(), BanksClientError> {
let vault = voter.vault_address(&voting_mint);
let data =
@ -568,7 +568,7 @@ impl AddinCookie {
&self,
registrar: &RegistrarCookie,
voter: &VoterCookie,
) -> std::result::Result<voter_stake_registry::state::VoterWeightRecord, TransportError> {
) -> std::result::Result<voter_stake_registry::state::VoterWeightRecord, BanksClientError> {
let instructions = vec![self.update_voter_weight_record_instruction(registrar, voter)];
self.solana.process_transaction(&instructions, None).await?;
@ -587,7 +587,7 @@ impl AddinCookie {
voter: &VoterCookie,
authority: &Keypair,
deposit_entry_index: u8,
) -> Result<(), TransportError> {
) -> Result<(), BanksClientError> {
let data = anchor_lang::InstructionData::data(
&voter_stake_registry::instruction::CloseDepositEntry {
deposit_entry_index,
@ -625,7 +625,7 @@ impl AddinCookie {
deposit_entry_index: u8,
kind: voter_stake_registry::state::LockupKind,
periods: u32,
) -> Result<(), TransportError> {
) -> Result<(), BanksClientError> {
let data =
anchor_lang::InstructionData::data(&voter_stake_registry::instruction::ResetLockup {
deposit_entry_index,
@ -665,7 +665,7 @@ impl AddinCookie {
source_deposit_entry_index: u8,
target_deposit_entry_index: u8,
amount: u64,
) -> Result<(), TransportError> {
) -> Result<(), BanksClientError> {
let data = anchor_lang::InstructionData::data(
&voter_stake_registry::instruction::InternalTransferLocked {
source_deposit_entry_index,
@ -706,7 +706,7 @@ impl AddinCookie {
source_deposit_entry_index: u8,
target_deposit_entry_index: u8,
amount: u64,
) -> Result<(), TransportError> {
) -> Result<(), BanksClientError> {
let data = anchor_lang::InstructionData::data(
&voter_stake_registry::instruction::InternalTransferUnlocked {
source_deposit_entry_index,

View File

@ -258,7 +258,7 @@ impl GovernanceRealmCookie {
voter: &VoterCookie,
payer: &Keypair,
vwr_instruction: Instruction,
) -> std::result::Result<ProposalCookie, TransportError> {
) -> std::result::Result<ProposalCookie, BanksClientError> {
let proposal = spl_governance::state::proposal::get_proposal_address(
&self.governance.program_id,
&governance,
@ -325,7 +325,7 @@ impl GovernanceRealmCookie {
authority: &Keypair,
payer: &Keypair,
vwr_instruction: Instruction,
) -> std::result::Result<(), TransportError> {
) -> std::result::Result<(), BanksClientError> {
let instructions = vec![
vwr_instruction,
spl_governance::instruction::cast_vote(
@ -364,7 +364,7 @@ impl GovernanceRealmCookie {
token_owner_record: Pubkey,
authority: &Keypair,
beneficiary: Pubkey,
) -> std::result::Result<(), TransportError> {
) -> std::result::Result<(), BanksClientError> {
let instructions = vec![spl_governance::instruction::relinquish_vote(
&self.governance.program_id,
&governance,

View File

@ -11,7 +11,6 @@ use solana_sdk::{
pubkey::Pubkey,
signature::{Keypair, Signer},
transaction::Transaction,
transport::TransportError,
};
use spl_token::*;
@ -27,7 +26,7 @@ impl SolanaCookie {
&self,
instructions: &[Instruction],
signers: Option<&[&Keypair]>,
) -> Result<(), TransportError> {
) -> Result<(), BanksClientError> {
*self.program_output.write().unwrap() = super::ProgramOutput::default();
let mut context = self.context.borrow_mut();