thehubbleproject / hubble-contracts

Hubble optimistic rollup
https://thehubbleproject.github.io/docs/
MIT License
133 stars 28 forks source link

Pass correct result on dispute invalid post state root #678

Closed b-tarczynski closed 2 years ago

b-tarczynski commented 2 years ago

It would be nice to emit RollbackTriggered with correct result when rollback is triggered by invalid post state root(right now it's Types.Result.Ok).

I added simple if statement in dispute functions, but I can change processCommit function for each batch type to accept additional postStateRoot as argument and return only Types.Result instead of postStateRoot and result. What do you think? @jacque006

jacque006 commented 2 years ago

Definitely like this change, improves clarity of rollback reason in that case.

but I can change processCommit function for each batch type to accept additional postStateRoot as argument and return only Types.Result instead of postStateRoot and result.

^ I think this is the way to go to encapsulate the validation logic in process*Commit functions. However, I would double check the gas cost difference to make sure it doesn't change that significantly.

And finally, if it's feasible test cases for this new Result state would be appreciated :)

b-tarczynski commented 2 years ago

I changed process*Commit functions to be responsible for validation. Gas cost of disputeTransition* functions are the same as before changes.