We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
++I
I++
UNCHECKED{++I}
FOR
WHILE
1- File: contracts/AxelarGateway.sol (line 195)
for (uint256 i; i < adminCount; ++i) {
2- File: contracts/AxelarGateway.sol (line 207)
for (uint256 i = 0; i < symbols.length; i++) {
3- File: contracts/AxelarGateway.sol (line 292)
for (uint256 i; i < commandsLength; ++i) {
4- File: contracts/gas-service/AxelarGasService.sol (line 123)
for (uint256 i; i < tokens.length; i++) {
5- File: contracts/deposit-service/AxelarDepositService.sol (line 114)
for (uint256 i; i < refundTokens.length; i++) {
6- File: contracts/deposit-service/AxelarDepositService.sol (line 168)
7- File: contracts/deposit-service/AxelarDepositService.sol (line 204)
8- File: contracts/auth/AxelarAuthWeighted.sol (line 17)
for (uint256 i; i < recentOperators.length; ++i) {
9- File: contracts/auth/AxelarAuthWeighted.sol (line 69)
for (uint256 i = 0; i < weightsLength; ++i) {
10- File: contracts/auth/AxelarAuthWeighted.sol (line 98)
for (uint256 i = 0; i < signatures.length; ++i) {
11- File: contracts/auth/AxelarAuthWeighted.sol (line 116)
for (uint256 i; i < accounts.length - 1; ++i) {
--I
I--
1- File: contracts/AxelarGateway.sol (line 207)
2- File: contracts/gas-service/AxelarGasService.sol (line 123)
3- File: contracts/deposit-service/AxelarDepositService.sol (line 114)
4- File: contracts/deposit-service/AxelarDepositService.sol (line 168)
5- File: contracts/deposit-service/AxelarDepositService.sol (line 204)
<ARRAY>.LENGTH
Even memory arrays incur the overhead of bit tests and bit shifts to calculate the array length
6- File: contracts/auth/AxelarAuthWeighted.sol (line 17)
7- File: contracts/auth/AxelarAuthWeighted.sol (line 98)
8- File: contracts/auth/AxelarAuthWeighted.sol (line 116)
CONSTANT
IMMUTABLE
Not overwriting the default for stack variables saves 8 gas. Storage and memory variables have larger savings
2- File: contracts/auth/AxelarAuthWeighted.sol (line 69)
3- File: contracts/auth/AxelarAuthWeighted.sol (line 98)
<X> += <Y>
<X> = <X> + <Y>
There are 2 instances of this issue:
File: contracts/auth/AxelarAuthWeighted.sol 70: totalWeight += newWeights[i]; 105: weight += weights[operatorIndex];
https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/auth/AxelarAuthWeighted.sol
The text was updated successfully, but these errors were encountered:
lucacez issue #69
bdfb5c5
Dup #2
Sorry, something went wrong.
Less than 300
No branches or pull requests
++I
/I++
SHOULD BEUNCHECKED{++I}
/UNCHECKED{++I}
WHEN IT IS NOT POSSIBLE FOR THEM TO OVERFLOW, AS IS THE CASE WHEN USED INFOR
- ANDWHILE
-LOOPS1- File: contracts/AxelarGateway.sol (line 195)
2- File: contracts/AxelarGateway.sol (line 207)
3- File: contracts/AxelarGateway.sol (line 292)
4- File: contracts/gas-service/AxelarGasService.sol (line 123)
5- File: contracts/deposit-service/AxelarDepositService.sol (line 114)
6- File: contracts/deposit-service/AxelarDepositService.sol (line 168)
7- File: contracts/deposit-service/AxelarDepositService.sol (line 204)
8- File: contracts/auth/AxelarAuthWeighted.sol (line 17)
9- File: contracts/auth/AxelarAuthWeighted.sol (line 69)
10- File: contracts/auth/AxelarAuthWeighted.sol (line 98)
11- File: contracts/auth/AxelarAuthWeighted.sol (line 116)
++I
COSTS LESS GAS THANI++
, ESPECIALLY WHEN IT’S USED INFOR
-LOOPS (--I
/I--
TOO)1- File: contracts/AxelarGateway.sol (line 207)
2- File: contracts/gas-service/AxelarGasService.sol (line 123)
3- File: contracts/deposit-service/AxelarDepositService.sol (line 114)
4- File: contracts/deposit-service/AxelarDepositService.sol (line 168)
5- File: contracts/deposit-service/AxelarDepositService.sol (line 204)
<ARRAY>.LENGTH
SHOULD NOT BE LOOKED UP IN EVERY LOOP OF AFOR
-LOOPEven memory arrays incur the overhead of bit tests and bit shifts to calculate the array length
1- File: contracts/AxelarGateway.sol (line 207)
2- File: contracts/gas-service/AxelarGasService.sol (line 123)
3- File: contracts/deposit-service/AxelarDepositService.sol (line 114)
4- File: contracts/deposit-service/AxelarDepositService.sol (line 168)
5- File: contracts/deposit-service/AxelarDepositService.sol (line 204)
6- File: contracts/auth/AxelarAuthWeighted.sol (line 17)
7- File: contracts/auth/AxelarAuthWeighted.sol (line 98)
8- File: contracts/auth/AxelarAuthWeighted.sol (line 116)
IT COSTS MORE GAS TO INITIALIZE NON-
CONSTANT
/NON-IMMUTABLE
VARIABLES TO ZERO THAN TO LET THE DEFAULT OF ZERO BE APPLIEDNot overwriting the default for stack variables saves 8 gas. Storage and memory variables have larger savings
1- File: contracts/AxelarGateway.sol (line 207)
2- File: contracts/auth/AxelarAuthWeighted.sol (line 69)
3- File: contracts/auth/AxelarAuthWeighted.sol (line 98)
<X> += <Y>
COSTS MORE GAS THAN<X> = <X> + <Y>
FOR STATE VARIABLESThere are 2 instances of this issue:
https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/auth/AxelarAuthWeighted.sol
The text was updated successfully, but these errors were encountered: