After-merge fixups
- workaround new issue with capturing program logs - cargo fmt - cleanups
This commit is contained in:
parent
06db4551f5
commit
7406bd34ec
|
@ -50,7 +50,11 @@ pub fn log_voter_info(
|
|||
let voting_mint_config = ®istrar.voting_mints[deposit.voting_mint_config_idx as usize];
|
||||
let locking_info = (seconds_left > 0).then(|| LockingInfo {
|
||||
amount: deposit.amount_locked(curr_ts),
|
||||
end_timestamp: if lockup.kind != LockupKind::Constant {Some(end_ts)} else {None},
|
||||
end_timestamp: if lockup.kind != LockupKind::Constant {
|
||||
Some(end_ts)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
vesting: lockup.kind.is_vesting().then(|| VestingInfo {
|
||||
rate: deposit
|
||||
.amount_initially_locked_native
|
||||
|
|
|
@ -79,11 +79,13 @@ impl GovernanceCookie {
|
|||
&community_token_mint.pubkey.unwrap(),
|
||||
&payer.pubkey(),
|
||||
None,
|
||||
Some(spl_governance::state::realm::GoverningTokenConfigAccountArgs {
|
||||
voter_weight_addin: Some(*voter_weight_addin),
|
||||
max_voter_weight_addin: None,
|
||||
token_type: spl_governance::state::realm_config::GoverningTokenType::Liquid
|
||||
}),
|
||||
Some(
|
||||
spl_governance::state::realm::GoverningTokenConfigAccountArgs {
|
||||
voter_weight_addin: Some(*voter_weight_addin),
|
||||
max_voter_weight_addin: None,
|
||||
token_type: spl_governance::state::realm_config::GoverningTokenType::Liquid,
|
||||
},
|
||||
),
|
||||
None,
|
||||
name.to_string(),
|
||||
0,
|
||||
|
@ -170,16 +172,20 @@ impl GovernanceRealmCookie {
|
|||
&authority.pubkey(),
|
||||
Some(voter.voter_weight_record),
|
||||
spl_governance::state::governance::GovernanceConfig {
|
||||
community_vote_threshold: spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
community_vote_threshold:
|
||||
spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
min_community_weight_to_create_proposal: 1000,
|
||||
min_transaction_hold_up_time: 0,
|
||||
voting_base_time: 10,
|
||||
community_vote_tipping: spl_governance::state::enums::VoteTipping::Disabled,
|
||||
council_vote_threshold: spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
council_veto_vote_threshold: spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
council_vote_threshold:
|
||||
spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
council_veto_vote_threshold:
|
||||
spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
min_council_weight_to_create_proposal: 1,
|
||||
council_vote_tipping: spl_governance::state::enums::VoteTipping::Disabled,
|
||||
community_veto_vote_threshold: spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
community_veto_vote_threshold:
|
||||
spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
voting_cool_off_time: 0,
|
||||
deposit_exempt_proposal_count: 10,
|
||||
},
|
||||
|
@ -229,16 +235,20 @@ impl GovernanceRealmCookie {
|
|||
&authority.pubkey(),
|
||||
Some(voter.voter_weight_record),
|
||||
spl_governance::state::governance::GovernanceConfig {
|
||||
community_vote_threshold: spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
community_vote_threshold:
|
||||
spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
min_community_weight_to_create_proposal: 1000,
|
||||
min_transaction_hold_up_time: 0,
|
||||
voting_base_time: 10,
|
||||
community_vote_tipping: spl_governance::state::enums::VoteTipping::Disabled,
|
||||
council_vote_threshold: spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
council_veto_vote_threshold: spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
council_vote_threshold:
|
||||
spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
council_veto_vote_threshold:
|
||||
spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
min_council_weight_to_create_proposal: 1,
|
||||
council_vote_tipping: spl_governance::state::enums::VoteTipping::Disabled,
|
||||
community_veto_vote_threshold: spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
community_veto_vote_threshold:
|
||||
spl_governance::state::enums::VoteThreshold::YesVotePercentage(50),
|
||||
voting_cool_off_time: 0,
|
||||
deposit_exempt_proposal_count: 10,
|
||||
},
|
||||
|
|
|
@ -67,6 +67,14 @@ impl Log for LoggerWrapper {
|
|||
.starts_with("solana_runtime::message_processor")
|
||||
{
|
||||
let msg = record.args().to_string();
|
||||
|
||||
// Weird bug where logs are logged twice. Workaround by clearing on new invoke.
|
||||
if msg.ends_with(&" invoke [1]") {
|
||||
let mut lock = self.output.write().unwrap();
|
||||
lock.logs.clear();
|
||||
lock.data.clear();
|
||||
}
|
||||
|
||||
if let Some(data) = msg.strip_prefix("Program log: ") {
|
||||
self.output.write().unwrap().logs.push(data.into());
|
||||
} else if let Some(data) = msg.strip_prefix("Program data: ") {
|
||||
|
|
|
@ -32,13 +32,6 @@ impl SolanaCookie {
|
|||
let mut context = self.context.borrow_mut();
|
||||
let recent_blockhash = context.banks_client.get_latest_blockhash().await.unwrap();
|
||||
|
||||
let old_blockhash = context.last_blockhash;
|
||||
let blockhash = context
|
||||
.banks_client
|
||||
.get_new_latest_blockhash(&old_blockhash)
|
||||
.await?;
|
||||
context.last_blockhash = blockhash;
|
||||
|
||||
let mut transaction =
|
||||
Transaction::new_with_payer(&instructions, Some(&context.payer.pubkey()));
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#![cfg(feature = "test-sbf")]
|
||||
|
||||
use std::println;
|
||||
|
||||
use anchor_spl::token::TokenAccount;
|
||||
use program_test::*;
|
||||
use solana_program_test::*;
|
||||
|
|
Loading…
Reference in New Issue