Commit 95653ba4 authored by Andreas Bigger's avatar Andreas Bigger

Fix small suggestions

parent 12829cb6
...@@ -63,7 +63,6 @@ func (o *OutputTraceProvider) Get(ctx context.Context, traceIndex uint64) (commo ...@@ -63,7 +63,6 @@ func (o *OutputTraceProvider) Get(ctx context.Context, traceIndex uint64) (commo
} }
// AbsolutePreStateCommitment returns the absolute prestate at the configured prestateBlock. // AbsolutePreStateCommitment returns the absolute prestate at the configured prestateBlock.
// For Optimism Mainnet, this is the first block after bedrock.
func (o *OutputTraceProvider) AbsolutePreStateCommitment(ctx context.Context) (hash common.Hash, err error) { func (o *OutputTraceProvider) AbsolutePreStateCommitment(ctx context.Context) (hash common.Hash, err error) {
output, err := o.rollupClient.OutputAtBlock(ctx, o.prestateBlock) output, err := o.rollupClient.OutputAtBlock(ctx, o.prestateBlock)
if err != nil { if err != nil {
......
...@@ -22,6 +22,18 @@ var ( ...@@ -22,6 +22,18 @@ var (
) )
func TestGet(t *testing.T) { func TestGet(t *testing.T) {
t.Run("PrePrestateErrors", func(t *testing.T) {
provider, _ := setupWithTestData(t, 0, poststateBlock)
_, err := provider.Get(context.Background(), 0)
require.ErrorAs(t, fmt.Errorf("no output at block %d", 1), &err)
})
t.Run("MisconfiguredPoststateErrors", func(t *testing.T) {
provider, _ := setupWithTestData(t, 0, 0)
_, err := provider.Get(context.Background(), 0)
require.ErrorAs(t, fmt.Errorf("no output at block %d", 0), &err)
})
t.Run("FirstBlockAfterPrestate", func(t *testing.T) { t.Run("FirstBlockAfterPrestate", func(t *testing.T) {
provider, _ := setupWithTestData(t, prestateBlock, poststateBlock) provider, _ := setupWithTestData(t, prestateBlock, poststateBlock)
value, err := provider.Get(context.Background(), 0) value, err := provider.Get(context.Background(), 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment