Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin committed Feb 12, 2024
1 parent 6c9363a commit c2418c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app/fraudproof/fraudproof.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ func (fpv *RollappFPV) InitFromFraudProof(fraudProof *fraudtypes.FraudProof) err

fpv.initCleanInstance()

fpv.runningApp.SetInitialHeight(fraudProof.BlockHeight + 1) //FIXME: why +1?
//using height+1 as the blockHeight is the last commited block
fpv.runningApp.SetInitialHeight(fraudProof.BlockHeight + 1)

cms := fpv.runningApp.CommitMultiStore().(*rootmulti.Store)
storeKeys := fpv.storeKeys
Expand Down Expand Up @@ -143,6 +144,8 @@ func (fpv *RollappFPV) VerifyFraudProof(fraudProof *fraudtypes.FraudProof) error
return ErrInvalidPreStateAppHash
}

SetRollappAddressPrefixes("ethm")

// Execute fraudulent state transition
if fraudProof.FraudulentBeginBlock != nil {
panic("fraudulent begin block not supported")
Expand All @@ -152,13 +155,12 @@ func (fpv *RollappFPV) VerifyFraudProof(fraudProof *fraudtypes.FraudProof) error
// Need to add some dummy begin block here since its a new app
fpv.runningApp.ResetDeliverState()
fpv.runningApp.SetBeginBlocker(nil)
fpv.runningApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: fraudProof.BlockHeight + 1}}) //FIXME: why +1?
fpv.runningApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: fraudProof.BlockHeight + 1}})
fmt.Println("appHash - dummy beginblock", hex.EncodeToString(fpv.runningApp.GetAppHashInternal()))

if fraudProof.FraudulentDeliverTx != nil {
// skip IncrementSequenceDecorator check in AnteHandler
fpv.runningApp.SetAnteHandler(nil)
SetRollappAddressPrefixes("ethm")

resp := fpv.runningApp.DeliverTx(*fraudProof.FraudulentDeliverTx)
if !resp.IsOK() {
Expand Down
2 changes: 1 addition & 1 deletion x/rollapp/keeper/fraudproof.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (k *Keeper) VerifyFraudProof(ctx sdk.Context, rollappID string, fp fraudtyp

// validate fraud proof preState Hash against the state update posted on the hub
func (k *Keeper) ValidateFraudProof(ctx sdk.Context, rollappID string, fp fraudtypes.FraudProof) error {
blockHeight := fp.BlockHeight + 1 //FIXME: why +1
blockHeight := fp.BlockHeight + 1
stateInfo, err := k.FindStateInfoByHeight(ctx, rollappID, uint64(blockHeight))
if err != nil {
return err
Expand Down

0 comments on commit c2418c5

Please sign in to comment.