Platform: Code4rena
Start Date: 30/05/2023
Pot Size: $300,500 USDC
Total HM: 79
Participants: 101
Period: about 1 month
Judge: Trust
Total Solo HM: 36
Id: 242
League: ETH
Rank: 85/101
Findings: 1
Award: $62.33
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Raihan
Also found by: 0x11singh99, 0xAnah, 0xSmartContract, 0xn006e7, Aymen0909, DavidGiladi, IllIllI, JCN, Jorgect, MohammedRizwan, Rageur, ReyAdmirado, Rickard, Rolezn, SAQ, SM3_SS, Sathish9098, TheSavageTeddy, hunter_w3b, kaveyjoe, lsaudit, matrix_0wl, naman1778, petrichor, shamsulhaq123, wahedtalash77
62.3314 USDC - $62.33
uint256
like uint8
so the best way is to put them in struct. It should be noted that in a struct, uint8 DOES cost less than a traditional uint, because of the tight packing feature. Also be sure that your uints are next to your other uints.24: uint256 internal constant week = 86400 * 7;
26: uint256 internal constant base = 1000;
28: uint256 internal constant max_tail_emission = 100;
29: uint256 internal constant max_dao_share = 300;
42: uint256 public override daoShare = 100;
43: uint256 public override tailEmission = 20;
https://github.com/code-423n4/2023-05-maia/blob/main/src/hermes/minters/BaseV2Minter.sol
143: uint256 internal _unlocked = 1;
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/BaseBranchRouter.sol#L143
49: uint256 public poolId = 1;
52: uint256 public tokenId = 1;
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-amm/factories/UlyssesFactory.sol#L49-L52
139: if (_liquidity > 0) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/talos/TalosStrategyVanilla.sol#L139
118: if (_deposit > 0) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/ArbitrumBranchPort.sol#L118
160: if (gasRemaining > 0) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/ArbitrumBranchBridgeAgent.sol#L160
234: if (accruedRewards > 0) rewardToken.safeTransfer(msg.sender, accruedRewards);
https://github.com/code-423n4/2023-05-maia/blob/main/src/rewards/rewards/FlywheelGaugeRewards.sol#L234
struct DepositInput { //Deposit Info uint24 toChain; //Destination chain for interaction. uint256 amount; //Amount of Local hTokens deposited for interaction. uint256 deposit; //Amount of native tokens deposited for interaction. address hToken; //Input Local hTokens Address. address token; //Input Native / underlying Token Address. }
struct Deposit { uint128 depositedGas; uint256[] deposits; uint256[] amounts; address owner; address[] hTokens; address[] tokens; DepositStatus status; }
struct DepositMultipleInput { //Deposit Info uint24 toChain; //Destination chain for interaction. uint256[] amounts; //Amount of Local hTokens deposited for interaction. uint256[] deposits; //Amount of native tokens deposited for interaction. address[] hTokens; //Input Local hTokens Address. address[] tokens; //Input Native / underlying Token Address. }
struct DepositParams { //Deposit Info uint24 toChain; //Destination chain for interaction. uint32 depositNonce; //Deposit nonce. uint128 depositedGas; //BRanch chain gas token amount sent with request. uint256 amount; //Amount of Local hTokens deposited for interaction. uint256 deposit; //Amount of native tokens deposited for interaction. address hToken; //Input Local hTokens Address. address token; //Input Native / underlying Token Address. }
struct DepositMultipleParams { //Deposit Info uint8 numberOfAssets; //Number of assets to deposit. uint24 toChain; //Destination chain for interaction. uint32 depositNonce; //Deposit nonce. uint128 depositedGas; //BRanch chain gas token amount sent with request. uint256[] amounts; //Amount of Local hTokens deposited for interaction. uint256[] deposits; //Amount of native tokens deposited for interaction. address[] hTokens; //Input Local hTokens Address. address[] tokens; //Input Native / underlying Token Address. }
struct SettlementParams { uint32 settlementNonce; uint256 amount; uint256 deposit; address recipient; address hToken; address token; }
struct SettlementMultipleParams { uint8 numberOfAssets; //Number of assets to deposit. uint32 settlementNonce; uint256[] amounts; uint256[] deposits; address recipient; address[] hTokens; address[] tokens; }
struct GasPoolInfo { //zeroForOne when swapping gas from branch chain into root chain gas uint24 priceImpactPercentage; //Price impact percentage address poolAddress; //Uniswap V3 Pool Address bool zeroForOneOnInflow; }
==All of the follwing struct
should be fixed.==
https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/ulysses-omnichain/interfaces/IRootBridgeAgent.sol#L31-L82
==And==
https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/uni-v3-staker/interfaces/IUniswapV3Staker.sol#L61C4-L80
struct GasPoolInfo { uint24 priceImpactPercentage; address gasTokenGlobalAddress; address poolAddress; bool zeroForOneOnInflow; }
function callOutAndBridgeMultiple( address _owner, address _recipient, bytes memory _data, address[] memory _globalAddresses, uint256[] memory _amounts, uint256[] memory _deposits, uint24 _toChain ) external payable;
268: function bridgeIn(address _recipient, DepositParams memory _dParams, uint24 _fromChain) external;
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/interfaces/IRootBridgeAgent.sol#L268
function addNewChain( address _pledger, uint256 _pledgedInitialAmount, address _coreBranchBridgeAgentAddress, uint24 _chainId, string memory _wrappedGasTokenName, string memory _wrappedGasTokenSymbol, uint24 _fee, uint24 _priceImpactPercentage, uint160 _sqrtPriceX96, address _nonFungiblePositionManagerAddress, address _newLocalBranchWrappedNativeTokenAddress, address _newUnderlyingBranchWrappedNativeTokenAddress ) external;
function bridgeOutMultiple( address _depositor, address[] memory _localAddresses, address[] memory _underlyingAddresses, uint256[] memory _amounts, uint256[] memory _deposits ) external;
all of this page https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/interfaces/IRootRouter.sol
event LogCallin(bytes1 selector, bytes data, uint24 fromChainId); event LogCallout(bytes1 selector, bytes data, uint256, uint24 toChainId); event LogCalloutFail(bytes1 selector, bytes data, uint24 toChainId);
463: if (canExceedMax && account.code.length == 0) revert Errors.NonContractError();
https://github.com/code-423n4/2023-05-maia/blob/main/src/erc-20/ERC20Gauges.sol#L464
273:if (amount0 == 0 && amount1 == 0) revert AmountsAreZero();
https://github.com/code-423n4/2023-05-maia/blob/main/src/talos/base/TalosBaseStrategy.sol#L273
https://github.com/code-423n4/2023-05-maia/blob/main/src/governance/GovernorBravoDelegateMaia.sol
48: for (uint256 i = 0; i < calls.length; i++) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/VirtualAccount.sol#L48
99: for (uint256 i = 0; i < length;) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-amm/factories/UlyssesFactory.sol#L99
107: for (uint256 i = 0; i < length;) {
110: for (uint256 j = 0; j < length;) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-amm/factories/UlyssesFactory.sol#L107-L110
123: for (uint256 i = 0; i < length;) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-amm/factories/UlyssesFactory.sol#L123
145: for (uint256 i = 0; i < length;) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-amm/factories/UlyssesFactory.sol#L145
101: for (uint256 i = 0; i < _localAddresses.length;) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/ArbitrumBranchPort.sol#L101
176: for (uint256 i = 0; i < size; i++) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/rewards/rewards/FlywheelGaugeRewards.sol#L176
311: for (uint256 i = 0; i < outputParams.outputTokens.length;) {
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/MulticallRootRouter.sol#L311
// next cycle is always the next even divisor of the cycle length above current block timestamp. uint32 currentCycle = (block.timestamp.toUint32() / gaugeCycleLength) * gaugeCycleLength; uint32 lastCycle = gaugeCycle; // ensure new cycle has begun if (currentCycle <= lastCycle) revert CycleError();
// next cycle is always the next even divisor of the cycle length above current block timestamp. uint32 currentCycle = (block.timestamp.toUint32() / gaugeCycleLength) * gaugeCycleLength; uint32 lastCycle = gaugeCycle; // ensure new cycle has begun if (currentCycle <= lastCycle) revert CycleError();
Upgrade to the latest solidity version 0.8.19 to get additional gas savings.
https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L2
... See the latest release for reference: https://blog.soliditylang.org/2023/02/22/solidity-0.8.19-release-announcement/
#0 - c4-judge
2023-07-09T16:35:41Z
trust1995 marked the issue as grade-b