hints.go 1.14 KB
Newer Older
1 2 3 4 5
package l2

import (
	"github.com/ethereum/go-ethereum/common"

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

9 10 11 12 13
const (
	HintL2BlockHeader  = "l2-block-header"
	HintL2Transactions = "l2-transactions"
	HintL2Code         = "l2-code"
	HintL2StateNode    = "l2-state-node"
14
	HintL2Output       = "l2-output"
15 16
)

17 18 19 20 21
type BlockHeaderHint common.Hash

var _ preimage.Hint = BlockHeaderHint{}

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

type TransactionsHint common.Hash

var _ preimage.Hint = TransactionsHint{}

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

type CodeHint common.Hash

var _ preimage.Hint = CodeHint{}

func (l CodeHint) Hint() string {
38
	return HintL2Code + " " + (common.Hash)(l).String()
39 40 41 42 43 44 45
}

type StateNodeHint common.Hash

var _ preimage.Hint = StateNodeHint{}

func (l StateNodeHint) Hint() string {
46
	return HintL2StateNode + " " + (common.Hash)(l).String()
47
}
48 49 50 51 52 53 54 55

type L2OutputHint common.Hash

var _ preimage.Hint = L2OutputHint{}

func (l L2OutputHint) Hint() string {
	return HintL2Output + " " + (common.Hash)(l).String()
}