Sdk: start to appease clippy's integer arithmetic check (#15736)

* Move to module-level clippy allowance

* Fix stake_weighted_timestamp math

* Fix genesis_config

* Fix shred_version

* Fix hard_forks

* Fix process_instruction

* Add ArithmeticOverflow ix error

* Fix nonce_keyed_account

* Update BankSlotDelta frozen abi due to new ix error
This commit is contained in:
Tyera Eulberg
2021-03-08 18:37:57 -07:00
committed by GitHub
parent cae8f61952
commit e3e8179f2d
15 changed files with 41 additions and 18 deletions

View File

@@ -117,4 +117,5 @@ pub enum InstructionErrorType {
BorshIoError = 44,
AccountNotRentExempt = 45,
InvalidAccountOwner = 46,
ArithmeticOverflow = 47,
}

View File

@@ -509,6 +509,7 @@ impl TryFrom<tx_by_addr::TransactionError> for TransactionError {
44 => InstructionError::BorshIoError(String::new()),
45 => InstructionError::AccountNotRentExempt,
46 => InstructionError::InvalidAccountOwner,
47 => InstructionError::ArithmeticOverflow,
_ => return Err("Invalid InstructionError"),
};
@@ -735,6 +736,9 @@ impl From<TransactionError> for tx_by_addr::TransactionError {
InstructionError::InvalidAccountOwner => {
tx_by_addr::InstructionErrorType::InvalidAccountOwner
}
InstructionError::ArithmeticOverflow => {
tx_by_addr::InstructionErrorType::ArithmeticOverflow
}
} as i32,
custom: match instruction_error {
InstructionError::Custom(custom) => {

View File

@@ -96,6 +96,7 @@ enum InstructionErrorType {
BORSH_IO_ERROR = 44;
ACCOUNT_NOT_RENT_EXEMPT = 45;
INVALID_ACCOUNT_OWNER = 46;
ARITHMETIC_OVERFLOW = 47;
}
message UnixTimestamp {