hints.go 1.18 KB
Newer Older
1 2 3 4
package l1

import (
	"github.com/ethereum/go-ethereum/common"
5
	"github.com/ethereum/go-ethereum/common/hexutil"
6

7
	preimage "github.com/ethereum-optimism/optimism/op-preimage"
8 9
)

10
const (
11 12 13 14 15
	HintL1BlockHeader  = "l1-block-header"
	HintL1Transactions = "l1-transactions"
	HintL1Receipts     = "l1-receipts"
	HintL1Blob         = "l1-blob"
	HintL1Precompile   = "l1-precompile"
16 17
)

18 19 20 21 22
type BlockHeaderHint common.Hash

var _ preimage.Hint = BlockHeaderHint{}

func (l BlockHeaderHint) Hint() string {
23
	return HintL1BlockHeader + " " + (common.Hash)(l).String()
24 25 26 27 28 29 30
}

type TransactionsHint common.Hash

var _ preimage.Hint = TransactionsHint{}

func (l TransactionsHint) Hint() string {
31
	return HintL1Transactions + " " + (common.Hash)(l).String()
32 33 34 35 36 37 38
}

type ReceiptsHint common.Hash

var _ preimage.Hint = ReceiptsHint{}

func (l ReceiptsHint) Hint() string {
39
	return HintL1Receipts + " " + (common.Hash)(l).String()
40
}
41 42 43 44 45 46 47 48

type BlobHint []byte

var _ preimage.Hint = BlobHint{}

func (l BlobHint) Hint() string {
	return HintL1Blob + " " + hexutil.Encode(l)
}
49

50
type PrecompileHint []byte
51

52
var _ preimage.Hint = PrecompileHint{}
53

54 55
func (l PrecompileHint) Hint() string {
	return HintL1Precompile + " " + hexutil.Encode(l)
56
}