Skip to content
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 an option '--remote-node-deploy' to treat remote nodes like local nodes #248

Merged
merged 1 commit into from
Jan 24, 2024
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
3 changes: 2 additions & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2021 Kaleido, Inc.
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -263,5 +263,6 @@ func init() {
initCmd.PersistentFlags().StringVar(&initOptions.IPFSMode, "ipfs-mode", "private", fmt.Sprintf("Set the mode in which IFPS operates. Options are: %v", fftypes.FFEnumValues(types.IPFSMode)))
initCmd.PersistentFlags().StringArrayVar(&initOptions.OrgNames, "org-name", []string{}, "Organization name")
initCmd.PersistentFlags().StringArrayVar(&initOptions.NodeNames, "node-name", []string{}, "Node name")
initCmd.PersistentFlags().BoolVar(&initOptions.RemoteNodeDeploy, "remote-node-deploy", false, "Enable or disable deployment of FireFly contracts on remote nodes")
rootCmd.AddCommand(initCmd)
}
9 changes: 8 additions & 1 deletion internal/blockchain/ethereum/remoterpc/remoterpc_provider.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2022 Kaleido, Inc.
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -94,6 +94,13 @@ func (p *RemoteRPCProvider) PostStart(fistTimeSetup bool) error {
}

func (p *RemoteRPCProvider) DeployFireFlyContract() (*types.ContractDeploymentResult, error) {
if p.stack.RemoteNodeDeploy {
contract, err := ethereum.ReadFireFlyContract(p.ctx, p.stack)
if err != nil {
return nil, err
}
return p.connector.DeployContract(contract, "FireFly", p.stack.Members[0], nil)
}
return nil, fmt.Errorf("you must pre-deploy your FireFly contract when using a remote RPC endpoint")
}

Expand Down
1 change: 1 addition & 0 deletions internal/stacks/stack_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func (s *StackManager) InitStack(options *types.InitOptions) (err error) {
ChannelName: options.ChannelName,
ChaincodeName: options.ChaincodeName,
CustomPinSupport: options.CustomPinSupport,
RemoteNodeDeploy: options.RemoteNodeDeploy,
}

tokenProviders, err := types.FFEnumArray(s.ctx, options.TokenProviders)
Expand Down
3 changes: 2 additions & 1 deletion pkg/types/options.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2022 Kaleido, Inc.
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -63,6 +63,7 @@ type InitOptions struct {
ChannelName string
ChaincodeName string
CustomPinSupport bool
RemoteNodeDeploy bool
}

const IPFSMode = "ipfs_mode"
Expand Down
3 changes: 2 additions & 1 deletion pkg/types/stack.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2021 Kaleido, Inc.
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -49,6 +49,7 @@ type Stack struct {
ChannelName string `json:"channelName,omitempty"`
ChaincodeName string `json:"chaincodeName,omitempty"`
CustomPinSupport bool `json:"customPinSupport,omitempty"`
RemoteNodeDeploy bool `json:"remoteNodeDeploy,omitempty"`
InitDir string `json:"-"`
RuntimeDir string `json:"-"`
StackDir string `json:"-"`
Expand Down
Loading