Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 2.74 KB

__141345__-Q.md

File metadata and controls

65 lines (51 loc) · 2.74 KB

Event is missing indexed fields

Index event fields make the field more quickly accessible to off-chain tools that parse events. However, note that each index field costs extra gas during emission, so it's not necessarily best to index the maximum allowed per event (three fields). Each event should use three indexed fields if there are three or more fields, and gas usage is not particularly of concern for the events in question. If there are fewer than three fields, all of the fields should be indexed.

Instances number of this issue: 8

// ethereum/contracts/bridge/interfaces/IL1Bridge.sol
11    event WithdrawalFinalized(address indexed to, address indexed l1Token, uint256 amount);
13    event ClaimedFailedDeposit(address indexed to, address indexed l1Token, uint256 amount);

// ethereum/contracts/zksync/interfaces/IDiamondCut.sol
30-35
    event EmergencyDiamondCutApproved(
        address indexed _address,
        uint256 currentProposalId,
        uint256 securityCouncilEmergencyApprovals,
        bytes32 indexed proposedDiamondCutHash
    );

// ethereum/contracts/zksync/interfaces/IExecutor.sol
    event BlocksRevert(uint256 totalBlocksCommitted, uint256 totalBlocksVerified, uint256 totalBlocksExecuted);

// ethereum/contracts/zksync/interfaces/IGovernance.sol
48    event NewVerifierParams(VerifierParams oldVerifierParams, VerifierParams newVerifierParams);

// ethereum/contracts/zksync/interfaces/IMailbox.sol
95-101
    event NewPriorityRequest(
        uint256 txId,
        bytes32 txHash,
        uint64 expirationBlock,
        L2CanonicalTransaction transaction,
        bytes[] factoryDeps
    );

// ethereum/contracts/zksync/libraries/Diamond.sol
16    event DiamondCut(FacetCut[] facetCuts, address initAddress, bytes initCalldata);

// zksync/contracts/bridge/L2StandardERC20.sol
12    event BridgeInitialization(address indexed l1Token, string name, string symbol, uint8 decimals);

require() statement should emit some message

If the transaction reverts, the error message can provide some info for the user.

Instances number of this issue: 9

// ethereum/contracts/bridge/L1EthBridge.sol
145        require(amount != 0);
221        require(_message.length == 56);
224        require(bytes4(functionSignature) == this.finalizeWithdrawal.selector);
238        require(callSuccess);

// ethereum/contracts/zksync/facets/Executor.sol
43        require(expectedNumberOfLayer1Txs == _newBlock.numberOfLayer1Txs);
45        require(l2BlockTimestamp == _newBlock.timestamp);
297        require(_recurisiveAggregationInput.length == 4);

// zksync/contracts/bridge/L2ETHBridge.sol
50        require(_l1Token == CONVENTIONAL_ETH_ADDRESS);

// zksync/contracts/bridge/L2StandardERC20.sol
        require(msg.sender == l2Bridge);