gravity-bridge
gravity-bridge copied to clipboard
Peggy.sol Gas Savings
A while back I was reviewing the smart contracts and seeing how this bridge handles unlocking user funds. It seems that all array data to functions that unlock tokens is stored in memory which is very expensive. I would propose wrapping those memory fields in a struct that is passed as calldata and has array fields to carry signatures and token recipients and amounts.
Additionally, if you can make both submitBatch and submitLogicCall external instead of public functions and use calldata for all arrays for those functions, that should cut down on gas costs.