-
Notifications
You must be signed in to change notification settings - Fork 2
Add Canton Support #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Canton Support #577
Changes from all commits
781cdc3
e6f0234
c5b21cd
d5735c9
da74bcc
6196fc1
991d2bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,3 +16,7 @@ indexer/secrets.toml | |
|
|
||
| # Ignore all log directories | ||
| **/logs/ | ||
|
|
||
| # Go workspace file | ||
| go.work | ||
| go.work.sum | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,15 +13,18 @@ import ( | |
|
|
||
| "github.com/smartcontractkit/chainlink-ccv/protocol/common/logging" | ||
| "github.com/smartcontractkit/chainlink-common/pkg/logger" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm/provider/rpcclient" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/datastore" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/deployment" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/operations" | ||
| "github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" | ||
|
|
||
| chainsel "github.com/smartcontractkit/chain-selectors" | ||
|
|
||
| cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain" | ||
| cldf_canton "github.com/smartcontractkit/chainlink-deployments-framework/chain/canton" | ||
| cldf_canton_provider "github.com/smartcontractkit/chainlink-deployments-framework/chain/canton/provider" | ||
| cldf_evm_provider "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm/provider" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm/provider/rpcclient" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/datastore" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/deployment" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/operations" | ||
| ) | ||
|
|
||
| var Plog = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).Level(zerolog.DebugLevel).With().Fields(map[string]any{"component": "ccv"}).Logger() | ||
|
|
@@ -47,53 +50,86 @@ func NewCLDFOperationsEnvironment(bc []*blockchain.Input, dataStore datastore.Da | |
| selectors := make([]uint64, 0) | ||
| defaultTxTimeout := 30 * time.Second | ||
| for _, b := range bc { | ||
| if b.Type == blockchain.TypeCanton { | ||
| // Canton CLDF is not supported yet | ||
| continue | ||
| } | ||
|
|
||
| chainID := b.Out.ChainID | ||
| rpcWSURL := b.Out.Nodes[0].ExternalWSUrl | ||
| rpcHTTPURL := b.Out.Nodes[0].ExternalHTTPUrl | ||
|
|
||
| d, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainsel.FamilyEVM) | ||
| family, err := blockchain.TypeToFamily(b.Type) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can just switch on
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically they're two different consts - they match 1:1 right now but ideally CTF would just re-use the chainselector constants |
||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| selectors = append(selectors, d.ChainSelector) | ||
|
|
||
| var confirmer cldf_evm_provider.ConfirmFunctor | ||
| switch b.Type { | ||
| case blockchain.TypeAnvil: | ||
| confirmer = cldf_evm_provider.ConfirmFuncGeth(defaultTxTimeout, cldf_evm_provider.WithTickInterval(5*time.Millisecond)) | ||
| case blockchain.TypeGeth: | ||
| confirmer = cldf_evm_provider.ConfirmFuncGeth(defaultTxTimeout) | ||
| default: | ||
| panic(fmt.Sprintf("blockchain type %s is not supported", b.Type)) | ||
| return nil, nil, fmt.Errorf("unable to determine blockchain type: %w", err) | ||
| } | ||
|
|
||
| p, err := cldf_evm_provider.NewRPCChainProvider( | ||
| d.ChainSelector, | ||
| cldf_evm_provider.RPCChainProviderConfig{ | ||
| DeployerTransactorGen: cldf_evm_provider.TransactorFromRaw( | ||
| getNetworkPrivateKey(), | ||
| ), | ||
| RPCs: []rpcclient.RPC{ | ||
| { | ||
| Name: "default", | ||
| WSURL: rpcWSURL, | ||
| HTTPURL: rpcHTTPURL, | ||
| PreferredURLScheme: rpcclient.URLSchemePreferenceHTTP, | ||
| switch family { | ||
| case blockchain.FamilyEVM: | ||
| chainID := b.Out.ChainID | ||
| rpcWSURL := b.Out.Nodes[0].ExternalWSUrl | ||
| rpcHTTPURL := b.Out.Nodes[0].ExternalHTTPUrl | ||
|
|
||
| d, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainsel.FamilyEVM) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| selectors = append(selectors, d.ChainSelector) | ||
|
|
||
| var confirmer cldf_evm_provider.ConfirmFunctor | ||
| switch b.Type { | ||
| case blockchain.TypeAnvil: | ||
| confirmer = cldf_evm_provider.ConfirmFuncGeth(defaultTxTimeout, cldf_evm_provider.WithTickInterval(5*time.Millisecond)) | ||
| case blockchain.TypeGeth: | ||
| confirmer = cldf_evm_provider.ConfirmFuncGeth(defaultTxTimeout) | ||
| default: | ||
| panic(fmt.Sprintf("EVM blockchain type %s is not supported", b.Type)) | ||
| } | ||
|
|
||
| p, err := cldf_evm_provider.NewRPCChainProvider( | ||
| d.ChainSelector, | ||
| cldf_evm_provider.RPCChainProviderConfig{ | ||
| DeployerTransactorGen: cldf_evm_provider.TransactorFromRaw( | ||
| getNetworkPrivateKey(), | ||
| ), | ||
| RPCs: []rpcclient.RPC{ | ||
| { | ||
| Name: "default", | ||
| WSURL: rpcWSURL, | ||
| HTTPURL: rpcHTTPURL, | ||
| PreferredURLScheme: rpcclient.URLSchemePreferenceHTTP, | ||
| }, | ||
| }, | ||
| UsersTransactorGen: GenerateUserTransactors(getUserPrivateKeys()), | ||
| ConfirmFunctor: confirmer, | ||
| }, | ||
| UsersTransactorGen: GenerateUserTransactors(getUserPrivateKeys()), | ||
| ConfirmFunctor: confirmer, | ||
| }, | ||
| ).Initialize(context.Background()) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| ).Initialize(context.Background()) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| providers = append(providers, p) | ||
| case blockchain.FamilyCanton: | ||
| d, err := chainsel.GetChainDetailsByChainIDAndFamily(b.Out.ChainID, chainsel.FamilyCanton) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| selectors = append(selectors, d.ChainSelector) | ||
|
|
||
| var ( | ||
| endpoints []cldf_canton.ParticipantEndpoints | ||
| jwtProviders []cldf_canton.JWTProvider | ||
| ) | ||
| for _, p := range b.Out.NetworkSpecificData.CantonEndpoints.Participants { | ||
| endpoints = append(endpoints, cldf_canton.ParticipantEndpoints{ | ||
| JSONLedgerAPIURL: p.JSONLedgerAPIURL, | ||
| GRPCLedgerAPIURL: p.GRPCLedgerAPIURL, | ||
| AdminAPIURL: p.AdminAPIURL, | ||
| ValidatorAPIURL: p.ValidatorAPIURL, | ||
| }) | ||
| jwtProviders = append(jwtProviders, cldf_canton.NewStaticJWTProvider(p.JWT)) | ||
| } | ||
|
|
||
| p, err := cldf_canton_provider.NewRPCChainProvider(d.ChainSelector, cldf_canton_provider.RPCChainProviderConfig{ | ||
| Endpoints: endpoints, | ||
| JWTProviders: jwtProviders, | ||
| }).Initialize(context.TODO()) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| providers = append(providers, p) | ||
| default: | ||
| return nil, nil, fmt.Errorf("unsupported blockchain family: %s", family) | ||
| } | ||
| providers = append(providers, p) | ||
| } | ||
|
|
||
| blockchains := cldf_chain.NewBlockChainsFromSlice(providers) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,6 +155,12 @@ execution_interval = 15_000_000_000 | |
| port = "8565" | ||
| type = "anvil" | ||
|
|
||
| [[blockchains]] | ||
| type = "canton" | ||
| chain_id = "LocalNet" | ||
| number_of_canton_validators = 5 | ||
| port = "8088" | ||
|
Comment on lines
+158
to
+162
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may increase CI time for the smoke test significantly and is currently not needed - we can create a new config for Canton/EVM until we figure out how to best set up the test matrices for the full E2E tests. |
||
|
|
||
| [fake] | ||
| image = "ccv-fakes:dev" | ||
| port = 9111 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are both Family() and ChainFamily() needed?