kleros / vea

Vea bridge
https://vea.ninja
MIT License
10 stars 6 forks source link

Simplify Msg Encoding #94

Closed shotaronowhere closed 1 year ago

shotaronowhere commented 1 year ago

Putting the authenticated message sender as the first argument requires assembly level memory manipulation, bringing complexity and confusion for reviewers and potential bugs.

Solutions

  1. Use a global state variable for authenticate messages (eg. bytes32 slot = keccack256("MessageSender"))
  2. Require gateways to implement an interface like receiveMessage(address msgSender, bytes data) and the gateway will handle the data decoding

1) is simpler, but Clément advised against global state variables, though the design pattern is in the Arbitrum bridge and Gnosis AMB and others.

2) requires developers to use a peculiar interface for receiving messages

shotaronowhere commented 1 year ago

Resolved in a recent commit to dev branch.

Using original functional design of passing message sender as 1st param of gateway call