@@ -6,6 +6,7 @@ package main
66import (
77 "bytes"
88 "context"
9+ "encoding/base64"
910 "encoding/json"
1011 "errors"
1112 "fmt"
@@ -19,6 +20,7 @@ import (
1920 "github.com/cartesi/rollups-node/internal/model"
2021 "github.com/cartesi/rollups-node/internal/repository"
2122 "github.com/cartesi/rollups-node/internal/repository/factory"
23+ //"github.com/davecgh/go-spew/spew"
2224 "github.com/ethereum/go-ethereum/common"
2325 "github.com/ethereum/go-ethereum/common/hexutil"
2426 "github.com/spf13/cobra"
@@ -165,7 +167,7 @@ func replayInputsBatch(ctx context.Context, opts replayOptions, tmp string, inpu
165167
166168 args := []string {
167169 "--quiet" ,
168- "--no-rollback " ,
170+ "--no-revert " ,
169171 "--load=" + opts .Template ,
170172 fmt .Sprintf ("--cmio-advance-state=input:%s,input_index_begin:0,input_index_end:%d" ,
171173 filepath .Join (tmp , "input-%i.bin" ), len (inputs )),
@@ -374,7 +376,7 @@ func generateMachineProof(
374376
375377 args := []string {
376378 "--quiet" ,
377- "--no-rollback " ,
379+ "--no-revert " ,
378380 "--load=" + snapshot ,
379381 fmt .Sprintf ("--initial-proof=address:0x%x,log2_size:%d,filename:%s" , address , log2Size , tmpPath ),
380382 "--" ,
@@ -392,6 +394,23 @@ func generateMachineProof(
392394 if err := json .Unmarshal (raw , & proof ); err != nil {
393395 return nil , fmt .Errorf ("parse machine proof: %w" , err )
394396 }
397+
398+ // convert the file hashes from base64 to hex
399+ proof .RootHash , err = base64ToHex (proof .RootHash )
400+ if err != nil {
401+ return nil , err
402+ }
403+ proof .TargetHash , err = base64ToHex (proof .TargetHash )
404+ if err != nil {
405+ return nil , err
406+ }
407+ for i := range proof .SiblingHashes {
408+ proof .SiblingHashes [i ], err = base64ToHex (proof .SiblingHashes [i ])
409+ if err != nil {
410+ return nil , err
411+ }
412+ }
413+
395414 return & proof , nil
396415}
397416
@@ -478,3 +497,11 @@ func ensure0x(s string) string {
478497func strip0x (s string ) string {
479498 return strings .TrimPrefix (strings .TrimPrefix (s , "0x" ), "0X" )
480499}
500+
501+ func base64ToHex (s string ) (string , error ) {
502+ raw , err := base64 .StdEncoding .DecodeString (s )
503+ if err != nil {
504+ return "" , fmt .Errorf ("expected %s to be a hash in base64. %w" , s , err )
505+ }
506+ return common .Hash (raw ).Hex (), nil
507+ }
0 commit comments