OpenST / mosaic-contracts

Mosaic-0: Gateways and anchors on top of Ethereum to scale DApps
https://discuss.openst.org/c/mosaic
MIT License
114 stars 31 forks source link

Gateways should store roots in ring buffer #698

Closed schemar closed 5 years ago

schemar commented 5 years ago

To have a constant size O(1) instead of a linear size O(n) depending on messages that will be sent with the gateways, the storage roots in gateway base should be stored in a circular buffer that prunes old storage roots.

In GatewayBase the messagebox offset should be made public, such that the proof generation can query the offset.

Was potentially done in #669

Regenerate the proof using the tool from #711

0xsarvesh commented 5 years ago

CircularBufferUint.sol has an implementation of the circular buffer. If the GatewayBase extends CircularBufferUint.sol then the position of message box in the EVM storage will change because of the variables declared in the CircularBufferUint.sol

The position of message box i.e. MESSAGE_OUTBOX_OFFSET in the outbox is used to generate Merkel proofs. This change looks like an interface change to me. Maybe there is a workaround of this, not sure though.

benjaminbollen commented 5 years ago

I suggest we use the inherited contract approach. It is clearer to understand the storage layout, even if it changes the position.