diff --git a/cmd/replay/main.go b/cmd/replay/main.go index 2fb13ceed8..e923b59f54 100644 --- a/cmd/replay/main.go +++ b/cmd/replay/main.go @@ -29,6 +29,7 @@ import ( "github.com/offchainlabs/nitro/arbutil" "github.com/offchainlabs/nitro/cmd/chaininfo" "github.com/offchainlabs/nitro/das/dastree" + "github.com/offchainlabs/nitro/espresso" "github.com/offchainlabs/nitro/gethhook" "github.com/offchainlabs/nitro/wavmio" ) @@ -46,6 +47,19 @@ func getBlockHeaderByHash(hash common.Hash) *types.Header { return header } +func getHotShotHeaderByHash(hash common.Hash) *espresso.Header { + enc, err := wavmio.ResolveTypedPreimage(arbutil.Keccak256PreimageType, hash) + if err != nil { + return nil + } + var header &espresso.Header + if err := json.Unmarshal(header, &enc); err != nil { + panic(fmt.Errorf("Error deserializing espresso header preimage")) + } + + return header +} + type WavmChainContext struct{} func (c WavmChainContext) Engine() consensus.Engine { @@ -152,6 +166,8 @@ func main() { db := state.NewDatabase(raw) lastBlockHash := wavmio.GetLastBlockHash() + lastHotShotHeaderHash := wavmio.GetLastHotShotHeaderHash() + lastHotShotHeader := getHotShotHeaderByHash(lastHotShotHeaderHash) var lastBlockHeader *types.Header var lastBlockStateRoot common.Hash @@ -238,7 +254,7 @@ func main() { batchFetcher := func(batchNum uint64) ([]byte, error) { return wavmio.ReadInboxMessage(batchNum), nil } - newBlock, _, err = arbos.ProduceBlock(message.Message, message.DelayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, batchFetcher) + newBlock, _, err = arbos.ProduceBlock(message.Message, message.DelayedMessagesRead, lastBlockHeader, lastHotShotHeader, statedb, chainContext, chainConfig, batchFetcher) if err != nil { panic(err) } diff --git a/execution/gethexec/executionengine.go b/execution/gethexec/executionengine.go index 5d099cee00..cf3c823434 100644 --- a/execution/gethexec/executionengine.go +++ b/execution/gethexec/executionengine.go @@ -294,7 +294,7 @@ func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes. txes, delayedMessagesRead, lastBlockHeader, - nil, + &header.BlockJustification.Header, statedb, s.bc, s.bc.Config(), @@ -447,7 +447,7 @@ func (s *ExecutionEngine) createBlockFromNextMessage(msg *arbostypes.MessageWith msg.Message, msg.DelayedMessagesRead, currentHeader, - nil, + &msg.Message.Header.BlockJustification.Header, statedb, s.bc, s.bc.Config(), diff --git a/wavmio/stub.go b/wavmio/stub.go index 0893f35250..9703a450fa 100644 --- a/wavmio/stub.go +++ b/wavmio/stub.go @@ -33,14 +33,15 @@ func (i *arrayFlags) Set(value string) error { } var ( - seqMsg []byte - seqMsgPos uint64 - posWithinMsg uint64 - delayedMsgs [][]byte - delayedMsgFirstPos uint64 - lastBlockHash common.Hash - preimages map[common.Hash][]byte - seqAdvanced uint64 + seqMsg []byte + seqMsgPos uint64 + posWithinMsg uint64 + delayedMsgs [][]byte + delayedMsgFirstPos uint64 + lastBlockHash common.Hash + lastHotShotHeaderHash common.Hash + preimages map[common.Hash][]byte + seqAdvanced uint64 ) func parsePreimageBytes(path string) { @@ -117,6 +118,10 @@ func GetLastBlockHash() (hash common.Hash) { return lastBlockHash } +func GetLastHotShotHeaderHash() (hash common.Hash) { + return lastHotShotHeaderHash +} + func ReadInboxMessage(msgNum uint64) []byte { if msgNum != seqMsgPos { panic(fmt.Sprintf("trying to read bad msg %d", msgNum))