snowbridge icon indicating copy to clipboard operation
snowbridge copied to clipboard

Gas Optimization: Channel addresses

Open vgeddes opened this issue 4 years ago • 0 comments

Currently our apps read channel addresses from memory every time a message or user instruction is acted upon. Since a Channel struct contains 2 addresses (both inbound and outbound), reading this costs 1600 gas (2 x 800).

This isn't necessary as the channel addresses could really just be stored as constants.

So we need a way to deploy the channels at the same address on each network (mainnet, ropsten, etc). Much like how the OpenZeppeling ERC777 contract refers to the ERC820 contract using a constant: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC777/ERC777.sol#L31

vgeddes avatar Mar 01 '21 14:03 vgeddes