Skip to content

Commit 0bc53b6

Browse files
committed
Adjust
1 parent b94c390 commit 0bc53b6

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

lib/config/testconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func (c *TestConfig) ReadFromEnvVar() error {
231231
c.Network.RpcHttpUrls = rpcHttpUrls
232232
}
233233

234-
if !c.Network.ForceHttp {
234+
if !c.Network.ForceHttp || !c.Seth.ForceHTTP {
235235
rpcWsUrls := ReadEnvVarGroupedMap(E2E_TEST_RPC_WS_URL_ENV, E2E_TEST_RPC_WS_URLS_ENV)
236236
if len(rpcWsUrls) > 0 {
237237
if c.Network == nil {

lib/networks/known_networks.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,8 +1104,8 @@ func SetNetworks(networkCfg config.NetworkConfig) ([]blockchain.EVMNetwork, erro
11041104
// if network is not simulated or forked, use the rpc urls and wallet keys from config
11051105
if !strings.Contains(networkName, "SIMULATED") && !forked {
11061106
var ok bool
1107-
1108-
if !networkCfg.ForceHttp {
1107+
// If we are forcinf htto but also have WSs available add them in case we need them
1108+
if !networkCfg.ForceHttp || (networkCfg.RpcWsUrls[selectedNetworks[i]] != nil && len(networkCfg.RpcWsUrls[selectedNetworks[i]]) > 0) {
11091109
wsUrls, ok = networkCfg.RpcWsUrls[selectedNetworks[i]]
11101110
if !ok {
11111111
return nil, fmt.Errorf("no rpc ws urls found in config for '%s' network", selectedNetworks[i])
@@ -1125,7 +1125,7 @@ func SetNetworks(networkCfg config.NetworkConfig) ([]blockchain.EVMNetwork, erro
11251125
// if evm_network config is found, use it
11261126
if networkCfg.EVMNetworks != nil {
11271127
if network, ok := networkCfg.EVMNetworks[networkName]; ok && network != nil {
1128-
if err := NewEVMNetwork(network, walletKeys, httpUrls, wsUrls, networkCfg.ForceHttp); err != nil {
1128+
if err := NewEVMNetwork(network, walletKeys, httpUrls, wsUrls); err != nil {
11291129
return nil, err
11301130
}
11311131
networks = append(networks, *network)
@@ -1134,7 +1134,7 @@ func SetNetworks(networkCfg config.NetworkConfig) ([]blockchain.EVMNetwork, erro
11341134
}
11351135
// if there is no evm_network config, use the known networks to find the network config from the map
11361136
if knownNetwork, valid := MappedNetworks[networkName]; valid {
1137-
err := NewEVMNetwork(&knownNetwork, walletKeys, httpUrls, wsUrls, networkCfg.ForceHttp)
1137+
err := NewEVMNetwork(&knownNetwork, walletKeys, httpUrls, wsUrls)
11381138
if err != nil {
11391139
return nil, err
11401140
}
@@ -1152,14 +1152,12 @@ func SetNetworks(networkCfg config.NetworkConfig) ([]blockchain.EVMNetwork, erro
11521152
}
11531153

11541154
// NewEVMNetwork sets the network's private key(s) and rpc urls
1155-
func NewEVMNetwork(network *blockchain.EVMNetwork, walletKeys, httpUrls, wsUrls []string, forceHttp bool) error {
1155+
func NewEVMNetwork(network *blockchain.EVMNetwork, walletKeys, httpUrls, wsUrls []string) error {
11561156
if len(httpUrls) > 0 {
11571157
network.HTTPURLs = httpUrls
11581158
}
1159-
if !forceHttp {
1160-
if len(wsUrls) > 0 {
1161-
network.URLs = wsUrls
1162-
}
1159+
if len(wsUrls) > 0 {
1160+
network.URLs = wsUrls
11631161
}
11641162
if len(walletKeys) > 0 {
11651163
if err := setKeys(network, walletKeys); err != nil {

lib/networks/known_networks_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestNewEVMNetwork(t *testing.T) {
3939

4040
t.Run("valid networkKey", func(t *testing.T) {
4141
network := MappedNetworks["VALID_KEY"]
42-
err := NewEVMNetwork(&network, nil, nil, nil, false)
42+
err := NewEVMNetwork(&network, nil, nil, nil)
4343
require.NoError(t, err)
4444
require.Equal(t, MappedNetworks["VALID_KEY"].HTTPURLs, network.HTTPURLs)
4545
require.Equal(t, MappedNetworks["VALID_KEY"].URLs, network.URLs)
@@ -50,8 +50,7 @@ func TestNewEVMNetwork(t *testing.T) {
5050
httpUrls := []string{"http://newurl.com"}
5151
wsUrls := []string{"ws://newwsurl.com"}
5252
network := MappedNetworks["VALID_KEY"]
53-
forceHttp := true
54-
err := NewEVMNetwork(&network, walletKeys, httpUrls, wsUrls, forceHttp)
53+
err := NewEVMNetwork(&network, walletKeys, httpUrls, wsUrls)
5554
require.NoError(t, err)
5655
require.Equal(t, httpUrls, network.HTTPURLs)
5756
require.Equal(t, wsUrls, network.URLs)

lib/utils/seth/seth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ func MergeSethAndEvmNetworkConfigs(evmNetwork blockchain.EVMNetwork, sethConfig
174174
break
175175
} else if isSameNetwork(conf, evmNetwork) {
176176
conf.PrivateKeys = evmNetwork.PrivateKeys
177-
// forceHttp should override urlssecret
178177
if sethConfig.ForceHTTP {
179178
conf.URLs = evmNetwork.HTTPURLs
180-
} else if len(conf.URLs) == 0 {
179+
}
180+
if len(conf.URLs) == 0 {
181181
conf.URLs = evmNetwork.URLs
182182
}
183183

0 commit comments

Comments
 (0)