Skip to content

Commit

Permalink
SPIKE - withdrawals e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
natebeauregard committed Sep 10, 2024
1 parent 7985c80 commit d18c336
Show file tree
Hide file tree
Showing 6 changed files with 419 additions and 38 deletions.
8 changes: 7 additions & 1 deletion bindings/L2ToL1MessagePasserExecuter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"math/big"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
Expand Down Expand Up @@ -45,7 +46,12 @@ func (e *L2ToL1MessagePasserExecuter) InitiateWithdrawal(
return fmt.Errorf("create initiateWithdrawal data: %v", err)
}

senderEthAddress := common.HexToAddress(sender)
// TODO: separate PR for withdrawal bug fix
senderCosmosAddress, err := sdk.AccAddressFromBech32(sender)
if err != nil {
return fmt.Errorf("convert sender to cosmos address: %v", err)
}
senderEthAddress := common.Address(senderCosmosAddress.Bytes())

_, err = e.Call(&monomerevm.CallParams{
Sender: &senderEthAddress,
Expand Down
39 changes: 23 additions & 16 deletions e2e/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,17 @@ type EventListener interface {
}

type StackConfig struct {
Ctx context.Context
Operator L1User
Users []L1User
L1Client *L1Client
L1Portal *bindings.OptimismPortal
L2Client *bftclient.HTTP
MonomerClient *MonomerClient
Ctx context.Context
Operator L1User
Users []L1User
L1Client *L1Client
L1Portal *bindings.OptimismPortal
L2Client *bftclient.HTTP
L2OutputOracleCaller *bindings.L2OutputOracleCaller
MonomerClient *MonomerClient
RollupConfig *rollup.Config
WaitL1 func(numBlocks int) error
WaitL2 func(numBlocks int) error
WaitL1 func(numBlocks int) error
WaitL2 func(numBlocks int) error
}

type stack struct {
Expand Down Expand Up @@ -238,6 +239,11 @@ func (s *stack) run(ctx context.Context, env *environment.Env) (*StackConfig, er
return nil, fmt.Errorf("new optimism portal: %v", err)
}

l2OutputOracleCaller, err := bindings.NewL2OutputOracleCaller(l1Deployments.L2OutputOracleProxy, l1Client)
if err != nil {
return nil, fmt.Errorf("new l2 output oracle caller: %v", err)
}

opStack := NewOPStack(
l1url,
s.monomerEngineURL,
Expand Down Expand Up @@ -291,13 +297,14 @@ func (s *stack) run(ctx context.Context, env *environment.Env) (*StackConfig, er
}

return &StackConfig{
Ctx: ctx,
L1Client: l1Client,
L1Portal: opPortal,
L2Client: l2Client,
MonomerClient: monomerClient,
Operator: l1users[0],
Users: l1users[1:],
Ctx: ctx,
L1Client: l1Client,
L1Portal: opPortal,
L2Client: l2Client,
L2OutputOracleCaller: l2OutputOracleCaller,
MonomerClient: monomerClient,
Operator: l1users[0],
Users: l1users[1:],
RollupConfig: rollupConfig,
WaitL1: func(numBlocks int) error {
return wait(numBlocks, 1)
Expand Down
Loading

0 comments on commit d18c336

Please sign in to comment.