node icon indicating copy to clipboard operation
node copied to clipboard

Use stateful precompile contracts to process ZEVM inbound instead of event parsing

Open lumtis opened this issue 1 year ago • 0 comments

Describe the Issue

To process inbounds on the ZEVM we currently have a "pull" model where the function call emits event and the events are parsed in the PostTx hook.

A more intuitive model and potentially much simpler would be to use a "push" model where the inbound can directly validated by calling a precompile smart contract.

The smart contract would only be callable by the gateway contract.

Let's call it cctxCreator here

interface ICCTXCreator {
  function validateInbound(...) bool
} 
func ValidateInbound(...) {
  if caller != gatewayAddress {
    return false
  }

  crosschainkeeper.ValidateInbound(....)
}

lumtis avatar Aug 20 '24 09:08 lumtis