diff --git a/op-chain-ops/cmd/withdrawals/main.go b/op-chain-ops/cmd/withdrawals/main.go index c950923b6bd5..518c0cf29911 100644 --- a/op-chain-ops/cmd/withdrawals/main.go +++ b/op-chain-ops/cmd/withdrawals/main.go @@ -25,6 +25,7 @@ import ( "github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/util" "github.com/ethereum-optimism/optimism/op-node/rollup" + opservice "github.com/ethereum-optimism/optimism/op-service" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -939,22 +940,20 @@ type contracts struct { // newContracts will create a contracts struct with the contract bindings // preconfigured func newContracts(ctx *cli.Context, l1Backend, l2Backend bind.ContractBackend) (*contracts, error) { - optimismPortalAddress := ctx.String("optimism-portal-address") - if len(optimismPortalAddress) == 0 { + optimismPortalAddr, err := opservice.ParseAddress(ctx.String("optimism-portal-address")) + if err != nil { return nil, errors.New("OptimismPortal address not configured") } - optimismPortalAddr := common.HexToAddress(optimismPortalAddress) portal, err := bindings.NewOptimismPortal(optimismPortalAddr, l1Backend) if err != nil { return nil, err } - l1xdmAddress := ctx.String("l1-crossdomain-messenger-address") - if l1xdmAddress == "" { + l1xdmAddr, err := opservice.ParseAddress(ctx.String("l1-crossdomain-messenger-address")) + if err != nil { return nil, errors.New("L1CrossDomainMessenger address not configured") } - l1xdmAddr := common.HexToAddress(l1xdmAddress) l1CrossDomainMessenger, err := bindings.NewL1CrossDomainMessenger(l1xdmAddr, l1Backend) if err != nil { diff --git a/op-challenger/config/config.go b/op-challenger/config/config.go index c4e738c21920..dd069ed8a734 100644 --- a/op-challenger/config/config.go +++ b/op-challenger/config/config.go @@ -9,6 +9,7 @@ import ( flags "github.com/ethereum-optimism/optimism/op-challenger/flags" + opservice "github.com/ethereum-optimism/optimism/op-service" oplog "github.com/ethereum-optimism/optimism/op-service/log" opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics" oppprof "github.com/ethereum-optimism/optimism/op-service/pprof" @@ -148,12 +149,12 @@ func NewConfigFromCLI(ctx *cli.Context) (*Config, error) { if rollupRpc == "" { return nil, ErrMissingRollupRpc } - l2ooAddress := common.HexToAddress(ctx.GlobalString(flags.L2OOAddressFlag.Name)) - if l2ooAddress == (common.Address{}) { + l2ooAddress, err := opservice.ParseAddress(ctx.GlobalString(flags.L2OOAddressFlag.Name)) + if err != nil { return nil, ErrMissingL2OOAddress } - dgfAddress := common.HexToAddress(ctx.GlobalString(flags.DGFAddressFlag.Name)) - if dgfAddress == (common.Address{}) { + dgfAddress, err := opservice.ParseAddress(ctx.GlobalString(flags.DGFAddressFlag.Name)) + if err != nil { return nil, ErrMissingDGFAddress }