Add runtime support for address table lookups (backport #22223) (#22354)

This commit is contained in:
Justin Starry
2022-01-08 07:57:04 +08:00
committed by GitHub
parent 662c6be51e
commit 1f00926874
21 changed files with 663 additions and 159 deletions

View File

@@ -47,6 +47,10 @@ enum TransactionErrorType {
WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 20;
WOULD_EXCEED_MAX_ACCOUNT_DATA_COST_LIMIT = 21;
TOO_MANY_ACCOUNT_LOCKS = 22;
ADDRESS_LOOKUP_TABLE_NOT_FOUND = 23;
INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 24;
INVALID_ADDRESS_LOOKUP_TABLE_DATA = 25;
INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 26;
}
message InstructionError {

View File

@@ -570,6 +570,10 @@ impl TryFrom<tx_by_addr::TransactionError> for TransactionError {
20 => TransactionError::WouldExceedMaxAccountCostLimit,
21 => TransactionError::WouldExceedMaxAccountDataCostLimit,
22 => TransactionError::TooManyAccountLocks,
23 => TransactionError::AddressLookupTableNotFound,
24 => TransactionError::InvalidAddressLookupTableOwner,
25 => TransactionError::InvalidAddressLookupTableData,
26 => TransactionError::InvalidAddressLookupTableIndex,
_ => return Err("Invalid TransactionError"),
})
}
@@ -646,6 +650,18 @@ impl From<TransactionError> for tx_by_addr::TransactionError {
TransactionError::TooManyAccountLocks => {
tx_by_addr::TransactionErrorType::TooManyAccountLocks
}
TransactionError::AddressLookupTableNotFound => {
tx_by_addr::TransactionErrorType::AddressLookupTableNotFound
}
TransactionError::InvalidAddressLookupTableOwner => {
tx_by_addr::TransactionErrorType::InvalidAddressLookupTableOwner
}
TransactionError::InvalidAddressLookupTableData => {
tx_by_addr::TransactionErrorType::InvalidAddressLookupTableData
}
TransactionError::InvalidAddressLookupTableIndex => {
tx_by_addr::TransactionErrorType::InvalidAddressLookupTableIndex
}
} as i32,
instruction_error: match transaction_error {
TransactionError::InstructionError(index, ref instruction_error) => {