stake-monitor: Add 1 SOL grace, to allow for a complaint system account to fund a reasonable number of transactions. (bp #9359) (#9363)
automerge
This commit is contained in:
@ -12,3 +12,6 @@ In terms of `solana` command-line subcommands:
|
|||||||
* `delegate-stake` / `deactivate-stake` / `stake-authorize` / `split-stake`: These commands do not affect compliance
|
* `delegate-stake` / `deactivate-stake` / `stake-authorize` / `split-stake`: These commands do not affect compliance
|
||||||
* `withdraw-stake` / `stake-set-lockup`: These commands will cause non-compliance
|
* `withdraw-stake` / `stake-set-lockup`: These commands will cause non-compliance
|
||||||
* `transfer`: Any additional funds transferred after `create-stake-account` are excluded from the "compliant balance"
|
* `transfer`: Any additional funds transferred after `create-stake-account` are excluded from the "compliant balance"
|
||||||
|
|
||||||
|
System accounts can also be manually enrolled with the `solana-stake-monitor enroll` subcommand.
|
||||||
|
An enrolled system account must always maintain a balance greater than the balance it had at enrollment minus 1 SOL.
|
||||||
|
@ -3,8 +3,8 @@ use serde::{Deserialize, Serialize};
|
|||||||
use solana_client::{client_error::Result as ClientResult, rpc_client::RpcClient};
|
use solana_client::{client_error::Result as ClientResult, rpc_client::RpcClient};
|
||||||
use solana_metrics::{datapoint_error, datapoint_info};
|
use solana_metrics::{datapoint_error, datapoint_info};
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
clock::Slot, program_utils::limited_deserialize, pubkey::Pubkey, signature::Signature,
|
clock::Slot, native_token::LAMPORTS_PER_SOL, program_utils::limited_deserialize,
|
||||||
transaction::Transaction,
|
pubkey::Pubkey, signature::Signature, transaction::Transaction,
|
||||||
};
|
};
|
||||||
use solana_stake_program::{stake_instruction::StakeInstruction, stake_state::Lockup};
|
use solana_stake_program::{stake_instruction::StakeInstruction, stake_state::Lockup};
|
||||||
use solana_transaction_status::{ConfirmedBlock, RpcTransactionStatusMeta, TransactionEncoding};
|
use solana_transaction_status::{ConfirmedBlock, RpcTransactionStatusMeta, TransactionEncoding};
|
||||||
@ -203,7 +203,9 @@ fn process_transaction(
|
|||||||
for (index, account_pubkey) in message.account_keys.iter().enumerate() {
|
for (index, account_pubkey) in message.account_keys.iter().enumerate() {
|
||||||
if let Some(mut account_info) = accounts.get_mut(&account_pubkey.to_string()) {
|
if let Some(mut account_info) = accounts.get_mut(&account_pubkey.to_string()) {
|
||||||
let post_balance = meta.post_balances[index];
|
let post_balance = meta.post_balances[index];
|
||||||
if account_info.compliant_since.is_some() && post_balance < account_info.lamports {
|
if account_info.compliant_since.is_some()
|
||||||
|
&& post_balance <= account_info.lamports.saturating_sub(LAMPORTS_PER_SOL)
|
||||||
|
{
|
||||||
account_info.compliant_since = None;
|
account_info.compliant_since = None;
|
||||||
account_info.transactions.push(AccountTransactionInfo {
|
account_info.transactions.push(AccountTransactionInfo {
|
||||||
op: AccountOperation::FailedToMaintainMinimumBalance,
|
op: AccountOperation::FailedToMaintainMinimumBalance,
|
||||||
|
Reference in New Issue
Block a user