Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge develop #48

Merged
merged 61 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f370113
test: fix superchain erc20 invariants (#11688)
agusduha Aug 30, 2024
814c9de
feat: add createX preinstall (#29) (#11618)
agusduha Aug 30, 2024
3e68cf0
Update contracts publish job to use env vars rather than contexts (#1…
mslipper Aug 30, 2024
18f6453
op-program: Prune L1 blocks after advancing origin (#11530)
ajsutton Aug 31, 2024
96ecb2e
npmrc: delete (#11699)
tynes Aug 31, 2024
c198a89
Increase executor size on contract publisher (#11701)
mslipper Aug 31, 2024
8ab4d3d
feat(op-program): Use `PebbleDB` for `DiskKV` (#11705)
clabby Sep 2, 2024
4c211fa
Revert "feat(op-program): Use `PebbleDB` for `DiskKV` (#11705)" (#11707)
ajsutton Sep 2, 2024
9452aa6
op-service/txmgr: multiple fixes / improvements (#11614)
Sep 2, 2024
42085ce
chore(op-service): Remove `reth` receipts source (#11706)
clabby Sep 2, 2024
375b976
fix: op-challenger move.go cli command wasn't cancellable (#11716)
samlaf Sep 3, 2024
957e13d
feat: add ERC-5202 Blueprint library with initial tests (#11700)
mds1 Sep 3, 2024
5b907dc
chore: Fix lint error (#11714)
ajsutton Sep 3, 2024
669a0fb
maint: no kontrol summaries in PRs (#11725)
smartcontracts Sep 3, 2024
337749f
feat: check interface differences in CI (#11677)
smartcontracts Sep 4, 2024
72eff5f
add comment to SingularBatch.Timestamp (#11720)
zhiqiangxu Sep 4, 2024
e80d23b
op-program: Use PebbleDB for DiskKV (Reapply with fixes) (#11709)
ajsutton Sep 4, 2024
5a1a18d
fix: SuperchainWETH fuzz flake with bad sender (#11728)
smartcontracts Sep 4, 2024
f8b421b
Fix copy-paste typo (#11731)
geoknee Sep 4, 2024
e0f6e1e
maint: add interfaces for legacy contracts (#11625)
smartcontracts Sep 4, 2024
2f10fb7
Slim down contracts-bedrock package (#11723)
mslipper Sep 4, 2024
1f0d8a8
fix: properly check all interfaces (#11734)
smartcontracts Sep 4, 2024
31f408b
feat: update interface validation script to check semver (#11740)
smartcontracts Sep 4, 2024
3410109
challenger: Introduce StateConverter to abstract loading VM states (#…
ajsutton Sep 4, 2024
f63cba6
fix: flake tests (#11742)
0xDiscotech Sep 4, 2024
2272a5d
repo: bump foundry (#11746)
tynes Sep 4, 2024
3f7a8ad
Revert "challenger: Introduce StateConverter to abstract loading VM s…
clabby Sep 4, 2024
c2d0911
cannon: Run expensive tests in parallel (#11739)
Inphi Sep 5, 2024
224c5fd
op-node: sequencer should clear inconsistent asyncGossip buffer on se…
protolambda Sep 5, 2024
df4d723
Reapply "challenger: Introduce StateConverter to abstract loading VM …
ajsutton Sep 5, 2024
ec06858
contracts-bedrock: Add OPSM file I/O for superchain deployments (#11750)
mslipper Sep 5, 2024
51150d8
maint: update solidity vscode extension (#11751)
smartcontracts Sep 5, 2024
91c7ed0
op-conductor: adds raft log snapshot configs (#11745)
zhwrd Sep 5, 2024
ffd9ed4
fix: initialization tests (#11674)
smartcontracts Sep 5, 2024
e7e5229
Update VERSIONING.md (#11761)
mds1 Sep 5, 2024
f85f189
Fix contracts-bedrock-docker-publish build (#11755)
mslipper Sep 5, 2024
ac19f2f
op-node: op-node interop block verification (devnet-1 scope) (#11611)
protolambda Sep 5, 2024
67ba188
cannon: Support binary serialisation for snapshots (#11718)
ajsutton Sep 6, 2024
31444eb
op-node: sanity-check the forkchoice updates (#11780)
protolambda Sep 6, 2024
247b399
Use local logger in data source (#11756)
joshklop Sep 6, 2024
85c79a5
fix: small typo fixes to DeploySuperchain.s.sol. (#11758)
blmalone Sep 6, 2024
873a4ea
cannon: Port audit fixes (#11697)
mbaxter Sep 6, 2024
ccf9d3e
ci: pull cached artifacts for contracts tests (#11771)
smartcontracts Sep 6, 2024
afcc51a
test: more blueprint tests (#11782)
mds1 Sep 6, 2024
49a4e9f
op-chain-ops: prep / utils for interop genesis work (#11790)
protolambda Sep 6, 2024
8733626
Add Maintenance Trigger for Cascading Updates (#11619)
axelKingsley Sep 6, 2024
4562b60
Update and cleanup CODEOWNERS with expert teams (#11786)
sebastianst Sep 6, 2024
75c7326
Catch 'header not found' string in L2BlockRefByLabel (#11759)
emhane Sep 6, 2024
f954cbb
ci: speed up CI by up to 50% (#11794)
smartcontracts Sep 6, 2024
1824499
dependabot(gomod): bump github.com/prometheus/client_golang (#11764)
dependabot[bot] Sep 6, 2024
52336b4
fix(challenger): `asterisc-kona` trace type (#11789)
clabby Sep 7, 2024
fb735d6
dependabot(gomod): bump golang.org/x/crypto from 0.26.0 to 0.27.0 (#1…
dependabot[bot] Sep 7, 2024
747c9e7
Add Admin RPC for Adding New Chain Monitors (#11792)
axelKingsley Sep 7, 2024
4fbe14f
semgrep: try to fix CI timeout (#11798)
protolambda Sep 7, 2024
9170e93
maint: move existing interfaces to folders (#11749)
smartcontracts Sep 8, 2024
40750a5
op-challenger: Support binary and JSON snapshots (#11754)
ajsutton Sep 8, 2024
c27aead
Remove hardcoded entrypoint (#11801)
mslipper Sep 9, 2024
e0f8589
Allow cheatcodes on DeploySuperchain.s.sol (#11802)
mslipper Sep 9, 2024
c05f5ad
op-program: Add recent op-program versions to reproducibility check (…
ajsutton Sep 9, 2024
29dc095
Merge branch 'develop' into chore/merge-develop
0xDiscotech Sep 9, 2024
9055e3e
fix: conflicts and broken imports
0xDiscotech Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
op-program: Use PebbleDB for DiskKV (Reapply with fixes) (ethereum-op…
…timism#11709)

* feat(op-program): Use `PebbleDB` for `DiskKV` (ethereum-optimism#11705)

* feat(op-program): Use `PebbleDB` for `DiskKV`

* close db

* fix `testFaultProofProgramScenario` tests

* switch to snappy compression

cockroachdb/pebble#3434

* fix tempdir

* update compat release

* defer k/v until preimage server and hinter have both exited

* Only open preimage source when actually needing preimages.

Avoids concurrent access to the pebbledb.

* op-program: Handle interrupts in host

Ensures the preimage kv store is closed cleanly even when the process is sent an interrupt signal.
Enables non-blocking IO so that read calls return io.EOF when a file handle is closed rather than blocking forever.

* op-program: Restore file based kv store. Add pebble as an additional option.

* op-program: Add option to specify KV store format to use

* op-program: Switch pebble to perform sync writes.

* op-program: Rename disk kv to file kv

* op-program: Rename DBFormat to DataFormat for consistency.

---------

Co-authored-by: clabby <ben@clab.by>
  • Loading branch information
ajsutton and clabby authored Sep 4, 2024
commit e80d23b64ceb207e8f70c2a497f9d6d49155e7ac
22 changes: 21 additions & 1 deletion cannon/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,29 @@ func (p *ProcessPreimageOracle) Close() error {
if p.cmd == nil {
return nil
}

tryWait := func(dur time.Duration) (bool, error) {
ctx, cancel := context.WithTimeout(context.Background(), dur)
defer cancel()
select {
case <-ctx.Done():
return false, nil
case err := <-p.waitErr:
return true, err
}
}
// Give the pre-image server time to exit cleanly before killing it.
time.Sleep(time.Second * 1)
if exited, err := tryWait(1 * time.Second); exited {
return err
}
// Politely ask the process to exit and give it some more time
_ = p.cmd.Process.Signal(os.Interrupt)
if exited, err := tryWait(30 * time.Second); exited {
return err
}

// Force the process to exit
_ = p.cmd.Process.Signal(os.Kill)
return <-p.waitErr
}

Expand Down
28 changes: 16 additions & 12 deletions op-challenger/game/fault/trace/asterisc/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ type AsteriscTraceProvider struct {

func NewTraceProvider(logger log.Logger, m vm.Metricer, cfg vm.Config, vmCfg vm.OracleServerExecutor, prestateProvider types.PrestateProvider, asteriscPrestate string, localInputs utils.LocalGameInputs, dir string, gameDepth types.Depth) *AsteriscTraceProvider {
return &AsteriscTraceProvider{
logger: logger,
dir: dir,
prestate: asteriscPrestate,
generator: vm.NewExecutor(logger, m, cfg, vmCfg, asteriscPrestate, localInputs),
gameDepth: gameDepth,
preimageLoader: utils.NewPreimageLoader(kvstore.NewDiskKV(vm.PreimageDir(dir)).Get),
logger: logger,
dir: dir,
prestate: asteriscPrestate,
generator: vm.NewExecutor(logger, m, cfg, vmCfg, asteriscPrestate, localInputs),
gameDepth: gameDepth,
preimageLoader: utils.NewPreimageLoader(func() utils.PreimageSource {
return kvstore.NewFileKV(vm.PreimageDir(dir))
}),
PrestateProvider: prestateProvider,
}
}
Expand Down Expand Up @@ -174,12 +176,14 @@ type AsteriscTraceProviderForTest struct {

func NewTraceProviderForTest(logger log.Logger, m vm.Metricer, cfg *config.Config, localInputs utils.LocalGameInputs, dir string, gameDepth types.Depth) *AsteriscTraceProviderForTest {
p := &AsteriscTraceProvider{
logger: logger,
dir: dir,
prestate: cfg.AsteriscAbsolutePreState,
generator: vm.NewExecutor(logger, m, cfg.Asterisc, vm.NewOpProgramServerExecutor(), cfg.AsteriscAbsolutePreState, localInputs),
gameDepth: gameDepth,
preimageLoader: utils.NewPreimageLoader(kvstore.NewDiskKV(vm.PreimageDir(dir)).Get),
logger: logger,
dir: dir,
prestate: cfg.AsteriscAbsolutePreState,
generator: vm.NewExecutor(logger, m, cfg.Asterisc, vm.NewOpProgramServerExecutor(), cfg.AsteriscAbsolutePreState, localInputs),
gameDepth: gameDepth,
preimageLoader: utils.NewPreimageLoader(func() utils.PreimageSource {
return kvstore.NewFileKV(vm.PreimageDir(dir))
}),
}
return &AsteriscTraceProviderForTest{p}
}
Expand Down
28 changes: 16 additions & 12 deletions op-challenger/game/fault/trace/cannon/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ type CannonTraceProvider struct {

func NewTraceProvider(logger log.Logger, m vm.Metricer, cfg vm.Config, vmCfg vm.OracleServerExecutor, prestateProvider types.PrestateProvider, prestate string, localInputs utils.LocalGameInputs, dir string, gameDepth types.Depth) *CannonTraceProvider {
return &CannonTraceProvider{
logger: logger,
dir: dir,
prestate: prestate,
generator: vm.NewExecutor(logger, m, cfg, vmCfg, prestate, localInputs),
gameDepth: gameDepth,
preimageLoader: utils.NewPreimageLoader(kvstore.NewDiskKV(vm.PreimageDir(dir)).Get),
logger: logger,
dir: dir,
prestate: prestate,
generator: vm.NewExecutor(logger, m, cfg, vmCfg, prestate, localInputs),
gameDepth: gameDepth,
preimageLoader: utils.NewPreimageLoader(func() utils.PreimageSource {
return kvstore.NewFileKV(vm.PreimageDir(dir))
}),
PrestateProvider: prestateProvider,
}
}
Expand Down Expand Up @@ -178,12 +180,14 @@ type CannonTraceProviderForTest struct {

func NewTraceProviderForTest(logger log.Logger, m vm.Metricer, cfg *config.Config, localInputs utils.LocalGameInputs, dir string, gameDepth types.Depth) *CannonTraceProviderForTest {
p := &CannonTraceProvider{
logger: logger,
dir: dir,
prestate: cfg.CannonAbsolutePreState,
generator: vm.NewExecutor(logger, m, cfg.Cannon, vm.NewOpProgramServerExecutor(), cfg.CannonAbsolutePreState, localInputs),
gameDepth: gameDepth,
preimageLoader: utils.NewPreimageLoader(kvstore.NewDiskKV(vm.PreimageDir(dir)).Get),
logger: logger,
dir: dir,
prestate: cfg.CannonAbsolutePreState,
generator: vm.NewExecutor(logger, m, cfg.Cannon, vm.NewOpProgramServerExecutor(), cfg.CannonAbsolutePreState, localInputs),
gameDepth: gameDepth,
preimageLoader: utils.NewPreimageLoader(func() utils.PreimageSource {
return kvstore.NewFileKV(vm.PreimageDir(dir))
}),
}
return &CannonTraceProviderForTest{p}
}
Expand Down
23 changes: 16 additions & 7 deletions op-challenger/game/fault/trace/utils/preimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,20 @@ var (
ErrInvalidBlobKeyPreimage = errors.New("invalid blob key preimage")
)

type preimageSource func(key common.Hash) ([]byte, error)
type PreimageSource interface {
Get(key common.Hash) ([]byte, error)
Close() error
}

type PreimageSourceCreator func() PreimageSource

type PreimageLoader struct {
getPreimage preimageSource
makeSource PreimageSourceCreator
}

func NewPreimageLoader(getPreimage preimageSource) *PreimageLoader {
func NewPreimageLoader(makeSource PreimageSourceCreator) *PreimageLoader {
return &PreimageLoader{
getPreimage: getPreimage,
makeSource: makeSource,
}
}

Expand All @@ -57,7 +62,9 @@ func (l *PreimageLoader) loadBlobPreimage(proof *ProofData) (*types.PreimageOrac
// The key for a blob field element is a keccak hash of commitment++fieldElementIndex.
// First retrieve the preimage of the key as a keccak hash so we have the commitment and required field element
inputsKey := preimage.Keccak256Key(proof.OracleKey).PreimageKey()
inputs, err := l.getPreimage(inputsKey)
source := l.makeSource()
defer source.Close()
inputs, err := source.Get(inputsKey)
if err != nil {
return nil, fmt.Errorf("failed to get key preimage: %w", err)
}
Expand All @@ -74,7 +81,7 @@ func (l *PreimageLoader) loadBlobPreimage(proof *ProofData) (*types.PreimageOrac
for i := 0; i < params.BlobTxFieldElementsPerBlob; i++ {
binary.BigEndian.PutUint64(fieldElemKey[72:], uint64(i))
key := preimage.BlobKey(crypto.Keccak256(fieldElemKey)).PreimageKey()
fieldElement, err := l.getPreimage(key)
fieldElement, err := source.Get(key)
if err != nil {
return nil, fmt.Errorf("failed to load field element %v with key %v: %w", i, common.Hash(key), err)
}
Expand Down Expand Up @@ -105,7 +112,9 @@ func (l *PreimageLoader) loadBlobPreimage(proof *ProofData) (*types.PreimageOrac

func (l *PreimageLoader) loadPrecompilePreimage(proof *ProofData) (*types.PreimageOracleData, error) {
inputKey := preimage.Keccak256Key(proof.OracleKey).PreimageKey()
input, err := l.getPreimage(inputKey)
source := l.makeSource()
defer source.Close()
input, err := source.Get(inputKey)
if err != nil {
return nil, fmt.Errorf("failed to get key preimage: %w", err)
}
Expand Down
39 changes: 30 additions & 9 deletions op-challenger/game/fault/trace/utils/preimage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ import (
)

func TestPreimageLoader_NoPreimage(t *testing.T) {
loader := NewPreimageLoader(kvstore.NewMemKV().Get)
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
actual, err := loader.LoadPreimage(&ProofData{})
require.NoError(t, err)
require.Nil(t, actual)
}

func TestPreimageLoader_LocalPreimage(t *testing.T) {
loader := NewPreimageLoader(kvstore.NewMemKV().Get)
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
proof := &ProofData{
OracleKey: common.Hash{byte(preimage.LocalKeyType), 0xaa, 0xbb}.Bytes(),
OracleValue: nil,
Expand All @@ -48,7 +54,10 @@ func TestPreimageLoader_SimpleTypes(t *testing.T) {
for _, keyType := range tests {
keyType := keyType
t.Run(fmt.Sprintf("type-%v", keyType), func(t *testing.T) {
loader := NewPreimageLoader(kvstore.NewMemKV().Get)
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
proof := &ProofData{
OracleKey: common.Hash{byte(keyType), 0xaa, 0xbb}.Bytes(),
OracleValue: []byte{1, 2, 3, 4, 5, 6},
Expand Down Expand Up @@ -90,7 +99,9 @@ func TestPreimageLoader_BlobPreimage(t *testing.T) {

t.Run("NoKeyPreimage", func(t *testing.T) {
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(kv.Get)
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
proof := &ProofData{
OracleKey: common.Hash{byte(preimage.BlobKeyType), 0xaf}.Bytes(),
OracleValue: proof.OracleValue,
Expand All @@ -102,7 +113,9 @@ func TestPreimageLoader_BlobPreimage(t *testing.T) {

t.Run("InvalidKeyPreimage", func(t *testing.T) {
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(kv.Get)
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
proof := &ProofData{
OracleKey: common.Hash{byte(preimage.BlobKeyType), 0xad}.Bytes(),
OracleValue: proof.OracleValue,
Expand All @@ -115,7 +128,9 @@ func TestPreimageLoader_BlobPreimage(t *testing.T) {

t.Run("MissingBlobs", func(t *testing.T) {
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(kv.Get)
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
proof := &ProofData{
OracleKey: common.Hash{byte(preimage.BlobKeyType), 0xae}.Bytes(),
OracleValue: proof.OracleValue,
Expand All @@ -128,7 +143,9 @@ func TestPreimageLoader_BlobPreimage(t *testing.T) {

t.Run("Valid", func(t *testing.T) {
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(kv.Get)
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
storeBlob(t, kv, gokzg4844.KZGCommitment(commitment), gokzg4844.Blob(blob))
actual, err := loader.LoadPreimage(proof)
require.NoError(t, err)
Expand Down Expand Up @@ -161,13 +178,17 @@ func TestPreimageLoader_PrecompilePreimage(t *testing.T) {

t.Run("NoInputPreimage", func(t *testing.T) {
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(kv.Get)
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
_, err := loader.LoadPreimage(proof)
require.ErrorIs(t, err, kvstore.ErrNotFound)
})
t.Run("Valid", func(t *testing.T) {
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(kv.Get)
loader := NewPreimageLoader(func() PreimageSource {
return kv
})
require.NoError(t, kv.Put(preimage.Keccak256Key(proof.OracleKey).PreimageKey(), input))
actual, err := loader.LoadPreimage(proof)
require.NoError(t, err)
Expand Down
26 changes: 20 additions & 6 deletions op-preimage/filechan.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package preimage

import (
"errors"
"fmt"
"io"
"os"
"syscall"
)

// FileChannel is a unidirectional channel for file I/O
Expand Down Expand Up @@ -41,10 +44,14 @@ func (rw *ReadWritePair) Writer() *os.File {
}

func (rw *ReadWritePair) Close() error {
var combinedErr error
if err := rw.r.Close(); err != nil {
return err
combinedErr = errors.Join(fmt.Errorf("failed to close reader: %w", err))
}
return rw.w.Close()
if err := rw.w.Close(); err != nil {
combinedErr = errors.Join(fmt.Errorf("failed to close writer: %w", err))
}
return combinedErr
}

// CreateBidirectionalChannel creates a pair of FileChannels that are connected to each other.
Expand All @@ -68,14 +75,21 @@ const (
)

func ClientHinterChannel() *ReadWritePair {
r := os.NewFile(HClientRFd, "preimage-hint-read")
w := os.NewFile(HClientWFd, "preimage-hint-write")
r := newFileNonBlocking(HClientRFd, "preimage-hint-read")
w := newFileNonBlocking(HClientWFd, "preimage-hint-write")
return NewReadWritePair(r, w)
}

// ClientPreimageChannel returns a FileChannel for the preimage oracle in a detached context
func ClientPreimageChannel() *ReadWritePair {
r := os.NewFile(PClientRFd, "preimage-oracle-read")
w := os.NewFile(PClientWFd, "preimage-oracle-write")
r := newFileNonBlocking(PClientRFd, "preimage-oracle-read")
w := newFileNonBlocking(PClientWFd, "preimage-oracle-write")
return NewReadWritePair(r, w)
}

func newFileNonBlocking(fd int, name string) *os.File {
// Try to enable non-blocking mode for IO so that read calls return when the file is closed
// This may not be possible on all systems so errors are ignored.
_ = syscall.SetNonblock(fd, true)
return os.NewFile(uintptr(fd), name)
}
24 changes: 5 additions & 19 deletions op-program/client/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,24 @@ import (
"io"
"os"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"

"github.com/ethereum-optimism/optimism/op-node/rollup"
preimage "github.com/ethereum-optimism/optimism/op-preimage"
"github.com/ethereum-optimism/optimism/op-program/client/claim"
cldr "github.com/ethereum-optimism/optimism/op-program/client/driver"
"github.com/ethereum-optimism/optimism/op-program/client/l1"
"github.com/ethereum-optimism/optimism/op-program/client/l2"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
)

// Main executes the client program in a detached context and exits the current process.
// The client runtime environment must be preset before calling this function.
func Main(logger log.Logger) {
log.Info("Starting fault proof program client")
preimageOracle := CreatePreimageChannel()
preimageHinter := CreateHinterChannel()
preimageOracle := preimage.ClientPreimageChannel()
preimageHinter := preimage.ClientHinterChannel()
if err := RunProgram(logger, preimageOracle, preimageHinter); errors.Is(err, claim.ErrClaimNotValid) {
log.Error("Claim is invalid", "err", err)
os.Exit(1)
Expand Down Expand Up @@ -76,16 +75,3 @@ func runDerivation(logger log.Logger, cfg *rollup.Config, l2Cfg *params.ChainCon
}
return claim.ValidateClaim(logger, l2ClaimBlockNum, eth.Bytes32(l2Claim), l2Source)
}

func CreateHinterChannel() preimage.FileChannel {
r := os.NewFile(HClientRFd, "preimage-hint-read")
w := os.NewFile(HClientWFd, "preimage-hint-write")
return preimage.NewReadWritePair(r, w)
}

// CreatePreimageChannel returns a FileChannel for the preimage oracle in a detached context
func CreatePreimageChannel() preimage.FileChannel {
r := os.NewFile(PClientRFd, "preimage-oracle-read")
w := os.NewFile(PClientWFd, "preimage-oracle-write")
return preimage.NewReadWritePair(r, w)
}
Loading