Skip to content

Commit

Permalink
update based on pr 440 of bold
Browse files Browse the repository at this point in the history
  • Loading branch information
amsanghi committed Sep 19, 2023
1 parent 20b6f36 commit 46c81d2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 749 deletions.
28 changes: 12 additions & 16 deletions staker/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package staker

import (
"context"
"math/big"

solimpl "github.com/OffchainLabs/bold/chain-abstraction/sol-implementation"
challengemanager "github.com/OffchainLabs/bold/challenge-manager"
"github.com/OffchainLabs/bold/challenge-manager/types"
l2stateprovider "github.com/OffchainLabs/bold/layer2-state-provider"
"github.com/OffchainLabs/bold/solgen/go/challengeV2gen"
"github.com/OffchainLabs/bold/solgen/go/rollupgen"

Expand Down Expand Up @@ -52,43 +52,39 @@ func NewManager(
if err != nil {
return nil, err
}
bigStepEdgeHeight, err := managerBinding.LAYERZEROBIGSTEPEDGEHEIGHT(&callOpts)
if err != nil {
return nil, err
}
smallStepEdgeHeight, err := managerBinding.LAYERZEROSMALLSTEPEDGEHEIGHT(&callOpts)
if err != nil {
return nil, err
}
numBigStepLevel, err := managerBinding.NUMBIGSTEPLEVEL(&callOpts)
if err != nil {
return nil, err
}
challengeLeafHeights := make([]uint64, numBigStepLevel.Uint64()+2)
challengeLeafHeights := make([]l2stateprovider.Height, numBigStepLevel.Uint64()+2)
for i := uint64(0); i <= numBigStepLevel.Uint64()+1; i++ {
leafHeight, err := managerBinding.GetLayerZeroEndHeight(&callOpts, big.NewInt(i))
leafHeight, err := managerBinding.GetLayerZeroEndHeight(&callOpts, uint8(i))
if err != nil {
return nil, err
}
challengeLeafHeights[i] = leafHeight.Uint64()
challengeLeafHeights[i] = l2stateprovider.Height(leafHeight.Uint64())
}

stateManager, err := NewStateManager(
statelessBlockValidator,
nil,
smallStepEdgeHeight.Uint64(),
bigStepEdgeHeight.Uint64()*smallStepEdgeHeight.Uint64(),
historyCacheBaseDir,
challengeLeafHeights,
)
if err != nil {
return nil, err
}
provider := l2stateprovider.NewHistoryCommitmentProvider(
stateManager,
stateManager,
stateManager,
challengeLeafHeights,
stateManager,
)
manager, err := challengemanager.New(
ctx,
chain,
client,
stateManager,
provider,
rollupAddress,
challengemanager.WithMode(types.MakeMode),
)
Expand Down
Loading

0 comments on commit 46c81d2

Please sign in to comment.