Skip to content
Draft
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
73 changes: 42 additions & 31 deletions aggregator/aggregator.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,30 @@ pyroscope_url = "http://pyroscope:4040"
[committees]
[committees.default]
[committees.default.quorumConfigs]
[committees.default.quorumConfigs.12922642891491394802]
[committees.default.quorumConfigs.3379446385462418246]
committeeVerifierAddress = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
threshold = 2

[[committees.default.quorumConfigs.12922642891491394802.signers]]
[[committees.default.quorumConfigs.3379446385462418246.signers]]
participantID = "default-participant1"
addresses = ["0x2c127e1eea67c6ec6945652183d4f043141705b2"]

[[committees.default.quorumConfigs.12922642891491394802.signers]]
[[committees.default.quorumConfigs.3379446385462418246.signers]]
participantID = "default-participant2"
addresses = ["0x2a3e6b4676d01c5afdd710f01d2b8870bdef182d"]
[committees.default.quorumConfigs.3379446385462418246]
committeeVerifierAddress = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"

[committees.default.quorumConfigs.12922642891491394802]
committeeVerifierAddress = "0x809d550fca64d94Bd9F66E60752A544199cfAC3D"
threshold = 2

[[committees.default.quorumConfigs.3379446385462418246.signers]]
[[committees.default.quorumConfigs.12922642891491394802.signers]]
participantID = "default-participant1"
addresses = ["0x2c127e1eea67c6ec6945652183d4f043141705b2"]

[[committees.default.quorumConfigs.3379446385462418246.signers]]
[[committees.default.quorumConfigs.12922642891491394802.signers]]
participantID = "default-participant2"
addresses = ["0x2a3e6b4676d01c5afdd710f01d2b8870bdef182d"]

[committees.default.quorumConfigs.4793464827907405086]
committeeVerifierAddress = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
threshold = 2
Expand All @@ -78,75 +80,83 @@ pyroscope_url = "http://pyroscope:4040"
[[committees.default.quorumConfigs.4793464827907405086.signers]]
participantID = "default-participant2"
addresses = ["0x2a3e6b4676d01c5afdd710f01d2b8870bdef182d"]

[committees.default.sourceVerifierAddresses]
12922642891491394802 = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
3379446385462418246 = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
12922642891491394802 = "0x809d550fca64d94Bd9F66E60752A544199cfAC3D"
4793464827907405086 = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"

[committees.secondary]
[committees.secondary.quorumConfigs]
[committees.secondary.quorumConfigs.12922642891491394802]
[committees.secondary.quorumConfigs.3379446385462418246]
committeeVerifierAddress = "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d"
threshold = 2

[[committees.secondary.quorumConfigs.12922642891491394802.signers]]
[[committees.secondary.quorumConfigs.3379446385462418246.signers]]
participantID = "secondary-participant1"
addresses = ["0x947a3f54dc6a01a0d12f0cb4810266f2c7afe61a"]
addresses = ["0x947a3f54dc6a01a0d12f0cb48479346482790740508666f2c7afe61a"]

[[committees.secondary.quorumConfigs.12922642891491394802.signers]]
[[committees.secondary.quorumConfigs.3379446385462418246.signers]]
participantID = "secondary-participant2"
addresses = ["0x6775609f7a2510cde5e2faa62355b247e2db02d3"]
[committees.secondary.quorumConfigs.3379446385462418246]
committeeVerifierAddress = "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d"

[committees.secondary.quorumConfigs.12922642891491394802]
committeeVerifierAddress = "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154"
threshold = 2

[[committees.secondary.quorumConfigs.3379446385462418246.signers]]
[[committees.secondary.quorumConfigs.12922642891491394802.signers]]
participantID = "secondary-participant1"
addresses = ["0x947a3f54dc6a01a0d12f0cb4810266f2c7afe61a"]
addresses = ["0x947a3f54dc6a01a0d12f0cb48479346482790740508666f2c7afe61a"]

[[committees.secondary.quorumConfigs.3379446385462418246.signers]]
[[committees.secondary.quorumConfigs.12922642891491394802.signers]]
participantID = "secondary-participant2"
addresses = ["0x6775609f7a2510cde5e2faa62355b247e2db02d3"]

[committees.secondary.quorumConfigs.4793464827907405086]
committeeVerifierAddress = "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d"
committeeVerifierAddress = "0xBEc49fA140aCaA83533fB00A2BB19bDdd0290f25"
threshold = 2

[[committees.secondary.quorumConfigs.4793464827907405086.signers]]
participantID = "secondary-participant1"
addresses = ["0x947a3f54dc6a01a0d12f0cb4810266f2c7afe61a"]
addresses = ["0x947a3f54dc6a01a0d12f0cb48479346482790740508666f2c7afe61a"]

[[committees.secondary.quorumConfigs.4793464827907405086.signers]]
participantID = "secondary-participant2"
addresses = ["0x6775609f7a2510cde5e2faa62355b247e2db02d3"]

[committees.secondary.sourceVerifierAddresses]
12922642891491394802 = "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d"
3379446385462418246 = "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d"
4793464827907405086 = "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d"
12922642891491394802 = "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154"
4793464827907405086 = "0xBEc49fA140aCaA83533fB00A2BB19bDdd0290f25"

[committees.tertiary]
[committees.tertiary.quorumConfigs]
[committees.tertiary.quorumConfigs.12922642891491394802]
[committees.tertiary.quorumConfigs.3379446385462418246]
committeeVerifierAddress = "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"
threshold = 2

[[committees.tertiary.quorumConfigs.12922642891491394802.signers]]
[[committees.tertiary.quorumConfigs.3379446385462418246.signers]]
participantID = "tertiary-participant1"
addresses = ["0x1745efc64c2e61f2e250b7ef79f34c4ec9af092b"]

[[committees.tertiary.quorumConfigs.12922642891491394802.signers]]
[[committees.tertiary.quorumConfigs.3379446385462418246.signers]]
participantID = "tertiary-participant2"
addresses = ["0x313624fd004760c40323476003ac7789dd534f94"]
[committees.tertiary.quorumConfigs.3379446385462418246]
committeeVerifierAddress = "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"

[committees.tertiary.quorumConfigs.12922642891491394802]
committeeVerifierAddress = "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1"
threshold = 2

[[committees.tertiary.quorumConfigs.3379446385462418246.signers]]
[[committees.tertiary.quorumConfigs.12922642891491394802.signers]]
participantID = "tertiary-participant1"
addresses = ["0x1745efc64c2e61f2e250b7ef79f34c4ec9af092b"]

[[committees.tertiary.quorumConfigs.3379446385462418246.signers]]
[[committees.tertiary.quorumConfigs.12922642891491394802.signers]]
participantID = "tertiary-participant2"
addresses = ["0x313624fd004760c40323476003ac7789dd534f94"]

[committees.tertiary.quorumConfigs.4793464827907405086]
committeeVerifierAddress = "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"
committeeVerifierAddress = "0xfbC22278A96299D91d41C453234d97b4F5Eb9B2d"
threshold = 2

[[committees.tertiary.quorumConfigs.4793464827907405086.signers]]
Expand All @@ -156,10 +166,11 @@ pyroscope_url = "http://pyroscope:4040"
[[committees.tertiary.quorumConfigs.4793464827907405086.signers]]
participantID = "tertiary-participant2"
addresses = ["0x313624fd004760c40323476003ac7789dd534f94"]

[committees.tertiary.sourceVerifierAddresses]
12922642891491394802 = "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"
3379446385462418246 = "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"
4793464827907405086 = "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"
12922642891491394802 = "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1"
4793464827907405086 = "0xfbC22278A96299D91d41C453234d97b4F5Eb9B2d"

[Monitoring]
Enabled = true
Expand Down
102 changes: 84 additions & 18 deletions build/devenv/cldf.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ccv

import (
"context"
"fmt"
"os"
"sync"
"time"
Expand All @@ -11,6 +12,7 @@ import (
"go.uber.org/zap"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-deployments-framework/chain/evm"
"github.com/smartcontractkit/chainlink-deployments-framework/chain/evm/provider/rpcclient"
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
Expand Down Expand Up @@ -40,22 +42,41 @@ func (c *CLDF) AddAddresses(addresses string) {
c.Addresses = append(c.Addresses, addresses)
}

func NewCLDFOperationsEnvironment(bc []*blockchain.Input, dataStore datastore.DataStore) ([]uint64, *deployment.Environment, error) {
providers := make([]cldf_chain.BlockChain, 0)
selectors := make([]uint64, 0)
for _, b := range bc {
chainID := b.Out.ChainID
rpcWSURL := b.Out.Nodes[0].ExternalWSUrl
rpcHTTPURL := b.Out.Nodes[0].ExternalHTTPUrl
func NewCLDFOperationsEnvironment(
blockchains []*blockchain.Input,
virtualSelectors []*VirtualSelector,
dataStore datastore.DataStore,
) ([]uint64, *deployment.Environment, map[uint64]*PhysicalChainInfo, error) {
blockchainsByName := make(map[string]*blockchain.Input)
for i := range blockchains {
blockchainsByName[blockchains[i].ContainerName] = blockchains[i]
}

physicalProviders := make(map[string]evm.Chain)
for _, vs := range virtualSelectors {
physicalName := vs.PhysicalChain
if _, exists := physicalProviders[physicalName]; exists {
continue
}

bc := blockchainsByName[physicalName]
chainID := bc.Out.ChainID
rpcWSURL := bc.Out.Nodes[0].ExternalWSUrl
rpcHTTPURL := bc.Out.Nodes[0].ExternalHTTPUrl

d, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainsel.FamilyEVM)
physicalChainDetails, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainsel.FamilyEVM)
if err != nil {
return nil, nil, err
return nil, nil, nil, fmt.Errorf("get chain details for %s: %w", physicalName, err)
}
selectors = append(selectors, d.ChainSelector)

p, err := cldf_evm_provider.NewRPCChainProvider(
d.ChainSelector,
Plog.Info().
Str("ContainerName", physicalName).
Str("ChainID", chainID).
Uint64("PhysicalSelector", physicalChainDetails.ChainSelector).
Msg("Creating RPC provider for physical blockchain")

provider, err := cldf_evm_provider.NewRPCChainProvider(
physicalChainDetails.ChainSelector,
cldf_evm_provider.RPCChainProviderConfig{
DeployerTransactorGen: cldf_evm_provider.TransactorFromRaw(
getNetworkPrivateKey(),
Expand All @@ -72,28 +93,73 @@ func NewCLDFOperationsEnvironment(bc []*blockchain.Input, dataStore datastore.Da
},
).Initialize(context.Background())
if err != nil {
return nil, nil, err
return nil, nil, nil, fmt.Errorf("initialize provider for %s: %w", physicalName, err)
}

evmChain, ok := provider.(evm.Chain)
if !ok {
return nil, nil, nil, fmt.Errorf("provider for %s is not an evm.Chain", physicalName)
}
physicalProviders[physicalName] = evmChain
}

blockchainMap := make(map[uint64]cldf_chain.BlockChain)
selectors := make([]uint64, 0, len(virtualSelectors))
for _, vs := range virtualSelectors {
physicalProvider := physicalProviders[vs.PhysicalChain]

virtualChain := evm.Chain{
Selector: uint64(vs.Selector),
Client: physicalProvider.Client,
DeployerKey: physicalProvider.DeployerKey,
Confirm: physicalProvider.Confirm,
Users: physicalProvider.Users,
SignHash: physicalProvider.SignHash,
IsZkSyncVM: physicalProvider.IsZkSyncVM,
ClientZkSyncVM: physicalProvider.ClientZkSyncVM,
DeployerKeyZkSyncVM: physicalProvider.DeployerKeyZkSyncVM,
}
providers = append(providers, p)
blockchainMap[uint64(vs.Selector)] = virtualChain
selectors = append(selectors, uint64(vs.Selector))

bc := blockchainsByName[vs.PhysicalChain]
Plog.Info().
Uint64("VirtualSelector", uint64(vs.Selector)).
Str("VirtualName", vs.Name).
Str("PhysicalChain", vs.PhysicalChain).
Str("PhysicalChainID", bc.ChainID).
Msg("Virtual selector mapped to physical chain")
}

blockchains := cldf_chain.NewBlockChainsFromSlice(providers)
chains := cldf_chain.NewBlockChains(blockchainMap)

lggr, err := logger.NewWith(func(config *zap.Config) {
config.Development = true
config.Encoding = "console"
})
if err != nil {
return nil, nil, err
return nil, nil, nil, err
}

e := deployment.Environment{
GetContext: func() context.Context { return context.Background() },
Logger: lggr,
BlockChains: blockchains,
BlockChains: chains,
DataStore: dataStore,
}
return selectors, &e, nil

physicalChainMap := make(map[uint64]*PhysicalChainInfo)
for _, vs := range virtualSelectors {
bc := blockchainsByName[vs.PhysicalChain]
physicalChainMap[uint64(vs.Selector)] = &PhysicalChainInfo{
ChainID: bc.ChainID,
WSURL: bc.Out.Nodes[0].ExternalWSUrl,
HTTPURL: bc.Out.Nodes[0].ExternalHTTPUrl,
ContainerName: vs.PhysicalChain,
}
}

return selectors, &e, physicalChainMap, nil
}

// NewDefaultCLDFBundle creates a new default CLDF bundle.
Expand Down
Loading
Loading