• clabby's avatar
    feat(op-program): L1 4844 blob fetcher in client (#9098) · d05494b7
    clabby authored
    * Add blob preimage type
    
    * 4844 blob fetcher
    
    key type
    
    * use params package constants
    
    * Add l1 ref timestamp to commitment hint
    
    * single preimage hint
    
    add log
    
    * Stub oracle
    
    * Pass in blobs fetcher
    
    * Encode hex in string hint route
    
    * Panic if blob reconstruction was faulty
    
    * @refcell review
    
    * rebase
    d05494b7
hints.go 1004 Bytes
package l1

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

	preimage "github.com/ethereum-optimism/optimism/op-preimage"
)

const (
	HintL1BlockHeader  = "l1-block-header"
	HintL1Transactions = "l1-transactions"
	HintL1Receipts     = "l1-receipts"
	HintL1Blob         = "l1-blob"
)

type BlockHeaderHint common.Hash

var _ preimage.Hint = BlockHeaderHint{}

func (l BlockHeaderHint) Hint() string {
	return HintL1BlockHeader + " " + (common.Hash)(l).String()
}

type TransactionsHint common.Hash

var _ preimage.Hint = TransactionsHint{}

func (l TransactionsHint) Hint() string {
	return HintL1Transactions + " " + (common.Hash)(l).String()
}

type ReceiptsHint common.Hash

var _ preimage.Hint = ReceiptsHint{}

func (l ReceiptsHint) Hint() string {
	return HintL1Receipts + " " + (common.Hash)(l).String()
}

type BlobHint []byte

var _ preimage.Hint = BlobHint{}

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