mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-04-23 03:00:50 -04:00
update GetDiskRoot
This commit is contained in:
@@ -212,7 +212,7 @@ func (r *Layer2Relayer) initializeGenesis() error {
|
||||
if err = r.commitGenesisBatch(startFinalizedBatch.Hash, startFinalizedBatch.BatchHeader, diskRoot); err != nil {
|
||||
return fmt.Errorf("commit genesis batch failed: %v", err)
|
||||
}
|
||||
log.Info("import genesis transaction successfully", "batch index", startFinalizedBatchIndex, "batch hash", startFinalizedBatch.Hash, "end block number", endChunk.EndBlockNumber, "header root", diskRoot)
|
||||
log.Info("import genesis transaction successfully", "batch index", startFinalizedBatchIndex, "batch hash", startFinalizedBatch.Hash, "end block number", endChunk.EndBlockNumber, "header root", diskRoot.Hex())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -229,9 +229,7 @@ func measureTime(operation func() error) (time.Duration, error) {
|
||||
// GetDiskRoot retrieves the disk root for a given block number from the Ethereum node.
|
||||
func GetDiskRoot(ctx context.Context, cli *rpc.Client, blockNumber uint64) (common.Hash, error) {
|
||||
type DiskRootResponse struct {
|
||||
Result struct {
|
||||
DiskRoot string `json:"diskRoot"`
|
||||
} `json:"result"`
|
||||
DiskRoot string `json:"diskRoot"`
|
||||
}
|
||||
|
||||
var response DiskRootResponse
|
||||
@@ -241,6 +239,6 @@ func GetDiskRoot(ctx context.Context, cli *rpc.Client, blockNumber uint64) (comm
|
||||
return common.Hash{}, fmt.Errorf("failed to fetch disk root for block %d: %w", blockNumber, err)
|
||||
}
|
||||
|
||||
diskRoot := common.HexToHash(response.Result.DiskRoot)
|
||||
diskRoot := common.HexToHash(response.DiskRoot)
|
||||
return diskRoot, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user