-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
op-program: Nasty start to fetching preimages.
- Loading branch information
Showing
7 changed files
with
386 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/ethereum-optimism/optimism/op-node/eth" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
) | ||
|
||
type StubOracle struct { | ||
t *testing.T | ||
|
||
// Blocks maps block hash to eth.BlockInfo | ||
Blocks map[common.Hash]eth.BlockInfo | ||
|
||
// Txs maps block hash to transactions | ||
Txs map[common.Hash]types.Transactions | ||
|
||
// Rcpts maps Block hash to receipts | ||
Rcpts map[common.Hash]types.Receipts | ||
} | ||
|
||
func NewStubOracle(t *testing.T) *StubOracle { | ||
return &StubOracle{ | ||
t: t, | ||
Blocks: make(map[common.Hash]eth.BlockInfo), | ||
Txs: make(map[common.Hash]types.Transactions), | ||
Rcpts: make(map[common.Hash]types.Receipts), | ||
} | ||
} | ||
func (o StubOracle) HeaderByBlockHash(blockHash common.Hash) eth.BlockInfo { | ||
info, ok := o.Blocks[blockHash] | ||
if !ok { | ||
o.t.Fatalf("unknown block %s", blockHash) | ||
} | ||
return info | ||
} | ||
|
||
func (o StubOracle) TransactionsByBlockHash(blockHash common.Hash) (eth.BlockInfo, types.Transactions) { | ||
txs, ok := o.Txs[blockHash] | ||
if !ok { | ||
o.t.Fatalf("unknown txs %s", blockHash) | ||
} | ||
return o.HeaderByBlockHash(blockHash), txs | ||
} | ||
|
||
func (o StubOracle) ReceiptsByBlockHash(blockHash common.Hash) (eth.BlockInfo, types.Receipts) { | ||
rcpts, ok := o.Rcpts[blockHash] | ||
if !ok { | ||
o.t.Fatalf("unknown rcpts %s", blockHash) | ||
} | ||
return o.HeaderByBlockHash(blockHash), rcpts | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.