Skip to content

Commit 14efa5b

Browse files
committed
wip: remove legacy
1 parent 263e073 commit 14efa5b

File tree

145 files changed

+47
-68117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+47
-68117
lines changed

framework/examples/myproject/fork_plus_offchain.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11

22
[blockchain_src]
33
chain_id = "1337"
4-
docker_cmd_params = ["--steps-tracing", "--fork-block-number", "25335999", "--fork-url", "https://rpcs.cldev.sh/base/sepolia/archive", "--auto-impersonate"]
5-
# docker_cmd_params = ["-b", "1", "--steps-tracing"]
4+
port = "8545"
5+
docker_cmd_params = ["-b", "1"]
6+
type = "anvil"
7+
8+
[blockchain_dst]
9+
chain_id = "2337"
10+
port = "8555"
11+
docker_cmd_params = ["-b", "1"]
612
type = "anvil"
713

814
[contracts_src]

framework/examples/myproject/fork_plus_offchain_test.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
type CfgForkChainsOffChain struct {
2020
ContractsSrc *onchain.Input `toml:"contracts_src" validate:"required"`
2121
BlockchainSrc *blockchain.Input `toml:"blockchain_src" validate:"required"`
22+
BlockchainDst *blockchain.Input `toml:"blockchain_dst" validate:"required"`
2223
// off-chain components
2324
NodeSets []*ns.Input `toml:"nodesets" validate:"required"`
2425
}
@@ -31,19 +32,35 @@ func TestOffChainAndFork(t *testing.T) {
3132
bcSrc, err := blockchain.NewBlockchainNetwork(in.BlockchainSrc)
3233
require.NoError(t, err)
3334

35+
bcDst, err := blockchain.NewBlockchainNetwork(in.BlockchainDst)
36+
require.NoError(t, err)
37+
3438
// create configs for 2 EVM networks
3539
srcNetworkCfg, err := clnode.NewNetworkCfg(&clnode.EVMNetworkConfig{
3640
MinIncomingConfirmations: 1,
3741
MinContractPayment: "0.00001 link",
3842
ChainID: bcSrc.ChainID,
3943
EVMNodes: []*clnode.EVMNode{
4044
{
45+
Name: "one",
4146
SendOnly: false,
4247
Order: 100,
4348
},
4449
},
4550
}, bcSrc)
46-
in.NodeSets[0].NodeSpecs[0].Node.TestConfigOverrides = srcNetworkCfg
51+
dstNetworkCfg, err := clnode.NewNetworkCfg(&clnode.EVMNetworkConfig{
52+
MinIncomingConfirmations: 1,
53+
MinContractPayment: "0.00001 link",
54+
ChainID: bcDst.ChainID,
55+
EVMNodes: []*clnode.EVMNode{
56+
{
57+
Name: "two",
58+
SendOnly: false,
59+
Order: 100,
60+
},
61+
},
62+
}, bcDst)
63+
in.NodeSets[0].NodeSpecs[0].Node.TestConfigOverrides = srcNetworkCfg + dstNetworkCfg
4764

4865
_, err = ns.NewSharedDBNodeSet(in.NodeSets[0], bcSrc)
4966
require.NoError(t, err)

lib/blockchain/ethereum.go

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"go.uber.org/atomic"
3333
"golang.org/x/sync/errgroup"
3434

35-
"github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/environment"
3635
"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/conversions"
3736
)
3837

@@ -1395,25 +1394,6 @@ func NewEVMClientFromNetwork(networkSettings EVMNetwork, logger zerolog.Logger)
13951394
return wrappedClient, nil
13961395
}
13971396

1398-
// NewEVMClient returns a multi-node EVM client connected to the specified network
1399-
// Note: This should mostly be deprecated in favor of ConnectEVMClient. This is really only used when needing to connect
1400-
// to simulated networks
1401-
func NewEVMClient(networkSettings EVMNetwork, env *environment.Environment, logger zerolog.Logger) (EVMClient, error) {
1402-
if env == nil {
1403-
return nil, fmt.Errorf("environment nil, use ConnectEVMClient or provide a non-nil environment")
1404-
}
1405-
1406-
if networkSettings.Simulated {
1407-
if _, ok := env.URLs[networkSettings.Name]; !ok {
1408-
return nil, fmt.Errorf("network %s not found in environment", networkSettings.Name)
1409-
}
1410-
networkSettings.URLs = env.URLs[networkSettings.Name]
1411-
networkSettings.HTTPURLs = env.URLs[networkSettings.Name+"_http"]
1412-
}
1413-
1414-
return ConnectEVMClient(networkSettings, logger)
1415-
}
1416-
14171397
// ConnectEVMClient returns a multi-node EVM client connected to a specified network, using only URLs.
14181398
// Should mostly be used for inside K8s, non-simulated tests.
14191399
func ConnectEVMClient(networkSettings EVMNetwork, logger zerolog.Logger) (EVMClient, error) {
@@ -1485,54 +1465,6 @@ func ConnectEVMClient(networkSettings EVMNetwork, logger zerolog.Logger) (EVMCli
14851465
return wrappedClient, nil
14861466
}
14871467

1488-
// ConcurrentEVMClient returns a multi-node EVM client connected to a specified network
1489-
// It is used for concurrent interactions from different threads with the same network and from same owner
1490-
// account. This ensures that correct nonce value is fetched when an instance of EVMClient is initiated using this method.
1491-
// This is mainly useful for simulated networks as we don't use global nonce manager for them.
1492-
func ConcurrentEVMClient(networkSettings EVMNetwork, env *environment.Environment, existing EVMClient, logger zerolog.Logger) (EVMClient, error) {
1493-
// if not simulated use the NewEVMClient
1494-
if !networkSettings.Simulated {
1495-
return ConnectEVMClient(networkSettings, logger)
1496-
}
1497-
ecl := &EthereumMultinodeClient{}
1498-
if env != nil {
1499-
if _, ok := env.URLs[existing.GetNetworkConfig().Name]; !ok {
1500-
return nil, fmt.Errorf("network %s not found in environment", existing.GetNetworkConfig().Name)
1501-
}
1502-
networkSettings.URLs = env.URLs[existing.GetNetworkConfig().Name]
1503-
}
1504-
for idx, networkURL := range networkSettings.URLs {
1505-
networkSettings.URL = networkURL
1506-
ec, err := newEVMClient(networkSettings, logger)
1507-
if err != nil {
1508-
logger.Info().
1509-
Err(err).
1510-
Str("URL Suffix", networkURL[len(networkURL)-6:]).
1511-
Msg("failed to create new EVM client")
1512-
continue
1513-
}
1514-
// a call to BalanceAt (can be any on chain call) to ensure the client is connected
1515-
_, err = ec.BalanceAt(context.Background(), ec.GetDefaultWallet().address)
1516-
if err == nil {
1517-
ec.SyncNonce(existing)
1518-
ec.SetID(idx)
1519-
ecl.Clients = append(ecl.Clients, ec)
1520-
break
1521-
}
1522-
}
1523-
if len(ecl.Clients) == 0 {
1524-
return nil, fmt.Errorf("failed to create new EVM client")
1525-
}
1526-
ecl.DefaultClient = ecl.Clients[0]
1527-
wrappedClient := wrapMultiClient(networkSettings, ecl)
1528-
ecl.SetWallets(existing.GetWallets())
1529-
if err := ecl.SetDefaultWalletByAddress(existing.GetDefaultWallet().address); err != nil {
1530-
return nil, err
1531-
}
1532-
// no need to fund the account as it is already funded in the existing client
1533-
return wrappedClient, nil
1534-
}
1535-
15361468
// SetDefaultWalletByAddress sets default wallet by address if it exists, else returns error
15371469
func (e *EthereumMultinodeClient) SetDefaultWalletByAddress(address common.Address) error {
15381470
return e.DefaultClient.SetDefaultWalletByAddress(address)

0 commit comments

Comments
 (0)