Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions devnet-sdk/shell/env/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
ChainNameVar = "DEVNET_CHAIN_NAME"
NodeIndexVar = "DEVNET_NODE_INDEX"
ExpectPreconditionsMet = "DEVNET_EXPECT_PRECONDITIONS_MET"
EnvCtrlVar = "DEVNET_ENV_CTRL"
)

type ChainConfig struct {
Expand Down
16 changes: 12 additions & 4 deletions devnet-sdk/shell/env/devnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"math/big"
"net/url"
"os"
"strings"

"github.com/ethereum-optimism/optimism/devnet-sdk/controller/kt"
Expand Down Expand Up @@ -77,10 +78,17 @@ func LoadDevnetFromURL(devnetURL string) (*DevnetEnv, error) {
}

var ctrl surfaceGetter
// we're safe here as fetchDevnetData above ensures the scheme is supported
ctrlFactory := schemeToBackend[parsedURL.Scheme].ctrlFactory
if ctrlFactory != nil {
ctrl = ctrlFactory(env)
scheme := parsedURL.Scheme
if val, ok := os.LookupEnv(EnvCtrlVar); ok {
scheme = val
}
backend, ok := schemeToBackend[scheme]
if !ok {
return nil, fmt.Errorf("invalid scheme to lookup control interface: %s", scheme)
}

if backend.ctrlFactory != nil {
ctrl = backend.ctrlFactory(env)
}

return &DevnetEnv{
Expand Down