mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-14 00:18:03 -05:00
19 lines
550 B
Go
19 lines
550 B
Go
package utils
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/scroll-tech/go-ethereum/common"
|
|
"github.com/scroll-tech/go-ethereum/crypto"
|
|
)
|
|
|
|
// ComputeBatchID compute a unique hash for a batch using "endBlockHash" & "endBlockHash in last batch"
|
|
// & "batch height", following the logic in `_computeBatchId` in contracts/src/L1/rollup/ZKRollup.sol
|
|
func ComputeBatchID(endBlockHash common.Hash, lastEndBlockHash common.Hash, index *big.Int) string {
|
|
return crypto.Keccak256Hash(
|
|
endBlockHash.Bytes(),
|
|
lastEndBlockHash.Bytes(),
|
|
index.Bytes(),
|
|
).String()
|
|
}
|