gravity-bridge icon indicating copy to clipboard operation
gravity-bridge copied to clipboard

Peggy.sol Gas Savings

Open ElliotFriedman opened this issue 5 years ago • 0 comments

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.

ElliotFriedman avatar Mar 11 '21 00:03 ElliotFriedman