Skip to content
Closed
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
44 changes: 2 additions & 42 deletions core/scripts/chaincli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,13 @@ go build
Create the `.env` file based on the example `.env.example`, adding the node endpoint URLs and the private key of your wallet

### Keeper Registry
Next, use chaincli to deploy the registry:
Set `KEEPER_REGISTRY_ADDRESS` in `.env` to your deployed keeper registry.

Example:
```shell
./chaincli keeper registry deploy
```

Other options include:
Registry management commands:
- `./chaincli keeper registry update`: update existing keeper registry
- `./chaincli keeper registry withdraw`: cancel upkeeps and withdraw funds from registry
- `./chaincli keeper registry verify <contract-addr> <constructor-args>`: verify keeper registry contract

As the `keeper registry deploy` command executes, _two_ address are written to the terminal:

- KeeperRegistry2.0 Logic _(can be ignored)_
- KeeperRegistry2.0

The second address, `KeeperRegistry2.0` is the address you need; in the `.env` file, set `KEEPER_REGISTRY_ADDRESS` variable to the `KeeperRegistry2.0` address.

Note that this command doesn't run contract verification by default. If you want to run verification (eth, op and arb supported), config your .env and add the `--verify=true` flag in command.

If you already have keeper registry contract deployed and want to run only contract verification, you can use the following command:

```shell
./chaincli keeper registry verify <contract-addr> <constructor-args>
```

### Bootstrap Nodes
Run the following `bootstrap` command to start bootstrap nodes:

Expand All @@ -83,26 +63,6 @@ Other options include:
The output of this command will show the tcp address of the deployed bootstrap node in the following format: `<p2p-key>@bootstrap:8000`.
Copy this entire string, including the `@bootstrap:8000` suffix, and the set the `BOOTSTRAP_NODE_ADDR` variable to this address in the `.env` file.

### Keeper launch and test
Once the bootstrap node is running, run the following command to launch the ocr2keeper nodes:

Example:
```shell
./chaincli keeper launch-and-test
```

Other options include:
- `--withdraw | -w`: default `true`, if funds should be withdrawn and upkeeps should be canceled after the test
- `--export-logs | -l`: default `false`, if container logs should be exported to ./ directory
- `--force | -f`: default `false`, if existing containers should be forcefully removed

You can also combine the `bootstrap` and `launch-and-test` commands into a single command:

```shell
./chaincli keeper launch-and-test --bootstrap
```
In the output of this command, you will see the http address of the nodes, e.g. `http://localhost:6688`. This is the Chainlink Operator GUI. You can use the default username `notreal@fakeemail.ch` and password `fj293fbBnlQ!f9vNs` to log in.

### Logs
Now that the nodes are running, you can use the `logs` subcommand to stream the output of the containers to your local terminal:

Expand Down
26 changes: 0 additions & 26 deletions core/scripts/chaincli/command/keeper/deploy.go

This file was deleted.

53 changes: 0 additions & 53 deletions core/scripts/chaincli/command/keeper/launch.go

This file was deleted.

21 changes: 0 additions & 21 deletions core/scripts/chaincli/command/keeper/registry.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package keeper

import (
"log"

"github.com/spf13/cobra"

"github.com/smartcontractkit/chainlink/core/scripts/chaincli/config"
Expand All @@ -15,23 +13,6 @@ var registryCmd = &cobra.Command{
Long: `This command provides an interface to manage keeper registry.`,
}

var deployRegistryCmd = &cobra.Command{
Use: "deploy",
Short: "Deploy keeper registry",
Long: `This command deploys a new keeper registry.`,
Run: func(cmd *cobra.Command, args []string) {
cfg := config.New()
hdlr := handler.NewKeeper(cfg)

verify, err := cmd.Flags().GetBool("verify")
if err != nil {
log.Fatal("failed to get verify flag: ", err)
}

hdlr.DeployRegistry(cmd.Context(), verify)
},
}

var verifyRegistryCmd = &cobra.Command{
Use: "verify",
Short: "Verify keeper registry",
Expand Down Expand Up @@ -70,8 +51,6 @@ var withdrawFromRegistryCmd = &cobra.Command{
}

func init() {
deployRegistryCmd.Flags().BoolP("verify", "v", false, "Specify if contracts should be verified on Etherscan")
registryCmd.AddCommand(deployRegistryCmd)
registryCmd.AddCommand(verifyRegistryCmd)
registryCmd.AddCommand(updateRegistryCmd)
registryCmd.AddCommand(withdrawFromRegistryCmd)
Expand Down
3 changes: 0 additions & 3 deletions core/scripts/chaincli/command/keeper/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ var RootCmd = &cobra.Command{
}

func init() {
RootCmd.AddCommand(deployCmd)
RootCmd.AddCommand(debugCmd)
RootCmd.AddCommand(jobCmd)
RootCmd.AddCommand(logsCmd)
RootCmd.AddCommand(registryCmd)
RootCmd.AddCommand(launchAndTestCmd)
RootCmd.AddCommand(upkeepEventsCmd)
RootCmd.AddCommand(upkeepHistoryCmd)
RootCmd.AddCommand(ocr2UpkeepReportHistoryCmd)
RootCmd.AddCommand(ocr2UpdateConfigCmd)
RootCmd.AddCommand(scrapeNodes)
Expand Down
42 changes: 0 additions & 42 deletions core/scripts/chaincli/command/keeper/upkeep.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,43 +35,6 @@ var upkeepEventsCmd = &cobra.Command{
},
}

// upkeepHistoryCmd represents the command to run the upkeep history command
var upkeepHistoryCmd = &cobra.Command{
Use: "upkeep-history",
Short: "Print checkUpkeep history",
Long: `Print checkUpkeep status and keeper responsibility for a given upkeep in a set block range`,
Run: func(cmd *cobra.Command, args []string) {
upkeepIDStr, err := cmd.Flags().GetString("upkeep-id")
if err != nil {
log.Fatal("failed to get 'upkeep-id' flag: ", err)
}
upkeepID, ok := handler.ParseUpkeepID(upkeepIDStr)
if !ok {
log.Fatal("failed to parse upkeep-id")
}

fromBlock, err := cmd.Flags().GetUint64("from")
if err != nil {
log.Fatal("failed to get 'from' flag: ", err)
}

toBlock, err := cmd.Flags().GetUint64("to")
if err != nil {
log.Fatal("failed to get 'to' flag: ", err)
}

gasPrice, err := cmd.Flags().GetUint64("gas-price")
if err != nil {
log.Fatal("failed to get 'gas-price' flag: ", err)
}

cfg := config.New()
hdlr := handler.NewKeeper(cfg)

hdlr.UpkeepHistory(cmd.Context(), upkeepID, fromBlock, toBlock, gasPrice)
},
}

var ocr2UpkeepReportHistoryCmd = &cobra.Command{
Use: "ocr2-reports",
Short: "Print ocr2 automation reports",
Expand Down Expand Up @@ -125,11 +88,6 @@ var ocr2UpdateConfigCmd = &cobra.Command{
}

func init() {
upkeepHistoryCmd.Flags().String("upkeep-id", "", "upkeep ID")
upkeepHistoryCmd.Flags().Uint64("from", 0, "from block")
upkeepHistoryCmd.Flags().Uint64("to", 0, "to block")
upkeepHistoryCmd.Flags().Uint64("gas-price", 0, "gas price to use")

ocr2UpkeepReportHistoryCmd.Flags().StringSlice("tx-hashes", []string{}, "list of transaction hashes to get information for")
ocr2UpkeepReportHistoryCmd.Flags().String("csv", "", "path to csv file containing transaction hashes; first element per line should be transaction hash; file should not have headers")

Expand Down
45 changes: 0 additions & 45 deletions core/scripts/chaincli/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,36 +175,6 @@ func (h *baseHandler) buildTxOpts(ctx context.Context) *bind.TransactOpts {
return auth
}

// Send eth from prefunded account.
// Amount is number of wei.
func (k *Keeper) sendEth(ctx context.Context, to common.Address, amount *big.Int) error {
txOpts := k.buildTxOpts(ctx)

tx := ethtypes.NewTx(&ethtypes.LegacyTx{
Nonce: txOpts.Nonce.Uint64(),
To: &to,
Value: amount,
Gas: txOpts.GasLimit,
GasPrice: txOpts.GasPrice,
Data: nil,
})
signedTx, err := ethtypes.SignTx(tx, ethtypes.NewEIP155Signer(big.NewInt(k.cfg.ChainID)), k.privateKey)
if err != nil {
return fmt.Errorf("failed to sign tx: %w", err)
}

if err = k.client.SendTransaction(ctx, signedTx); err != nil {
return fmt.Errorf("failed to send tx: %w", err)
}

if err := k.waitTx(ctx, signedTx); err != nil {
log.Fatalf("Send ETH failed, error is %s", err.Error())
}
log.Println("Send ETH successfully")

return nil
}

func (h *baseHandler) waitDeployment(ctx context.Context, tx *ethtypes.Transaction) {
if _, err := bind.WaitDeployed(ctx, h.client, tx); err != nil {
log.Fatal("WaitDeployed failed: ", err, " ", helpers.ExplorerLink(h.cfg.ChainID, tx.Hash()))
Expand Down Expand Up @@ -565,21 +535,6 @@ func nodeRequest(ctx context.Context, client cmd.HTTPClient, path string) ([]byt
return raw, nil
}

// getNodeAddress returns chainlink node's wallet address
func getNodeAddress(ctx context.Context, client cmd.HTTPClient) (string, error) {
resp, err := nodeRequest(ctx, client, ethKeysEndpoint)
if err != nil {
return "", fmt.Errorf("failed to get ETH keys: %w", err)
}

var keys cmd.EthKeyPresenters
if err = jsonapi.Unmarshal(resp, &keys); err != nil {
return "", fmt.Errorf("failed to unmarshal response body: %w", err)
}

return keys[0].Address, nil
}

// getNodeOCR2Config returns chainlink node's OCR2 bundle key ID
func getNodeOCR2Config(ctx context.Context, client cmd.HTTPClient) (*cmd.OCR2KeyBundlePresenter, error) {
resp, err := nodeRequest(ctx, client, ocr2KeysEndpoint)
Expand Down
Loading
Loading