Commit d5ebf81a authored by refcell's avatar refcell

use native uint64 big int check

parent 9c380bee
......@@ -5,8 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"math"
"math/big"
"os"
"path/filepath"
......@@ -91,7 +89,7 @@ func (p *CannonTraceProvider) SetMaxDepth(gameDepth uint64) {
func (p *CannonTraceProvider) Get(ctx context.Context, pos types.Position) (common.Hash, error) {
traceIndex := pos.TraceIndex(int(p.gameDepth))
if traceIndex.Cmp(new(big.Int).SetUint64(math.MaxUint64)) > 0 {
if !traceIndex.IsUint64() {
return common.Hash{}, errors.New("trace index out of bounds")
}
proof, err := p.loadProof(ctx, traceIndex.Uint64())
......@@ -108,7 +106,7 @@ func (p *CannonTraceProvider) Get(ctx context.Context, pos types.Position) (comm
func (p *CannonTraceProvider) GetStepData(ctx context.Context, pos types.Position) ([]byte, []byte, *types.PreimageOracleData, error) {
traceIndex := pos.TraceIndex(int(p.gameDepth))
if traceIndex.Cmp(new(big.Int).SetUint64(math.MaxUint64)) > 0 {
if !traceIndex.IsUint64() {
return nil, nil, nil, errors.New("trace index out of bounds")
}
proof, err := p.loadProof(ctx, traceIndex.Uint64())
......
......@@ -3,8 +3,6 @@ package outputs
import (
"context"
"fmt"
"math"
"math/big"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum-optimism/optimism/op-service/client"
......@@ -55,7 +53,7 @@ func NewTraceProviderFromInputs(logger log.Logger, rollupClient OutputRollupClie
func (o *OutputTraceProvider) Get(ctx context.Context, pos types.Position) (common.Hash, error) {
traceIndex := pos.TraceIndex(int(o.gameDepth))
if traceIndex.Cmp(new(big.Int).SetUint64(math.MaxUint64)) > 0 {
if !traceIndex.IsUint64() {
return common.Hash{}, fmt.Errorf("trace index %v is greater than max uint64", traceIndex)
}
outputBlock := traceIndex.Uint64() + o.prestateBlock + 1
......
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