use cost model to limit new account creation (#21369)
* use cost model to limit new account creation * handle every system instruction * remove & * simplify match * simplify match * add datapoint for account data size * add postgres error handling * handle accounts:unlock_accounts
This commit is contained in:
committed by
GitHub
parent
025a5a3b9c
commit
90f41fd9b7
@@ -45,6 +45,7 @@ enum TransactionErrorType {
|
||||
UNSUPPORTED_VERSION = 18;
|
||||
INVALID_WRITABLE_ACCOUNT = 19;
|
||||
WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 20;
|
||||
WOULD_EXCEED_MAX_ACCOUNT_DATA_COST_LIMIT = 21;
|
||||
}
|
||||
|
||||
message InstructionError {
|
||||
|
@@ -567,6 +567,7 @@ impl TryFrom<tx_by_addr::TransactionError> for TransactionError {
|
||||
18 => TransactionError::UnsupportedVersion,
|
||||
19 => TransactionError::InvalidWritableAccount,
|
||||
20 => TransactionError::WouldExceedMaxAccountCostLimit,
|
||||
21 => TransactionError::WouldExceedMaxAccountDataCostLimit,
|
||||
_ => return Err("Invalid TransactionError"),
|
||||
})
|
||||
}
|
||||
@@ -637,6 +638,9 @@ impl From<TransactionError> for tx_by_addr::TransactionError {
|
||||
TransactionError::WouldExceedMaxAccountCostLimit => {
|
||||
tx_by_addr::TransactionErrorType::WouldExceedMaxAccountCostLimit
|
||||
}
|
||||
TransactionError::WouldExceedMaxAccountDataCostLimit => {
|
||||
tx_by_addr::TransactionErrorType::WouldExceedMaxAccountDataCostLimit
|
||||
}
|
||||
} as i32,
|
||||
instruction_error: match transaction_error {
|
||||
TransactionError::InstructionError(index, ref instruction_error) => {
|
||||
|
Reference in New Issue
Block a user