Limit number of accounts that a transaction can lock (#22201)

This commit is contained in:
Justin Starry
2022-01-04 14:25:23 +08:00
committed by GitHub
parent 8b6310b179
commit 2b5e00d36d
10 changed files with 250 additions and 113 deletions

View File

@ -46,6 +46,7 @@ enum TransactionErrorType {
INVALID_WRITABLE_ACCOUNT = 19;
WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 20;
WOULD_EXCEED_MAX_ACCOUNT_DATA_COST_LIMIT = 21;
TOO_MANY_ACCOUNT_LOCKS = 22;
}
message InstructionError {

View File

@ -569,6 +569,7 @@ impl TryFrom<tx_by_addr::TransactionError> for TransactionError {
19 => TransactionError::InvalidWritableAccount,
20 => TransactionError::WouldExceedMaxAccountCostLimit,
21 => TransactionError::WouldExceedMaxAccountDataCostLimit,
22 => TransactionError::TooManyAccountLocks,
_ => return Err("Invalid TransactionError"),
})
}
@ -642,6 +643,9 @@ impl From<TransactionError> for tx_by_addr::TransactionError {
TransactionError::WouldExceedMaxAccountDataCostLimit => {
tx_by_addr::TransactionErrorType::WouldExceedMaxAccountDataCostLimit
}
TransactionError::TooManyAccountLocks => {
tx_by_addr::TransactionErrorType::TooManyAccountLocks
}
} as i32,
instruction_error: match transaction_error {
TransactionError::InstructionError(index, ref instruction_error) => {