Skip to content

Commit

Permalink
Merge pull request #3864 from smartcontractkit/release/0.9.9
Browse files Browse the repository at this point in the history
Release/0.9.9
  • Loading branch information
tyrion70 authored Jan 18, 2021
2 parents 8133319 + 36fd626 commit 3ccbf49
Show file tree
Hide file tree
Showing 278 changed files with 9,494 additions and 5,486 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
usePrettierrc: true,
},
],
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-empty-interface': 'off',
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.8
0.9.9
7 changes: 4 additions & 3 deletions belt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@
"@0x/sol-compiler": "^4.0.8",
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/plugin-help": "^2",
"@oclif/plugin-help": "^3",
"@oclif/plugin-not-found": "^1.2.3",
"@typechain/ethers-v4": "^4.0.0",
"chalk": "^4.1.0",
"cli-ux": "^5.5.0",
"debug": "^4.1.1",
"ethers": "^4.0.45",
"inquirer": "^7.3.3",
"shelljs": "^0.8.3",
"ts-generator": "^0.1.1",
"tslib": "^1",
"typechain": "^1.0.5",
"typechain-target-ethers": "^1.0.4"
"typechain": "^4.0.1"
},
"devDependencies": {
"@oclif/dev-cli": "^1",
Expand Down
2 changes: 1 addition & 1 deletion belt/src/services/compilers/ethers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function compiler(
rawConfig: {
files: join(artifactsDir, subDir, '**', '*.json'),
outDir: join(contractAbstractionDir, 'ethers', subDir),
target: 'ethers',
target: 'ethers-v4',
},
})
}
12 changes: 10 additions & 2 deletions core/adapters/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"net/http"
"testing"

"github.com/smartcontractkit/chainlink/core/services/eth"

"github.com/smartcontractkit/chainlink/core/adapters"
"github.com/smartcontractkit/chainlink/core/internal/cltest"
"github.com/smartcontractkit/chainlink/core/store"
Expand Down Expand Up @@ -46,12 +48,18 @@ func TestBridge_PerformEmbedsParamsInData(t *testing.T) {
}

func setupJobRunAndStore(t *testing.T, txHash []byte, blockHash []byte) (*store.Store, *models.ID, func()) {
app, cleanup := cltest.NewApplication(t, cltest.LenientEthMock)
rpcClient, gethClient, _, assertMocksCalled := cltest.NewEthMocksWithStartupAssertions(t)
app, cleanup := cltest.NewApplication(t,
eth.NewClientWith(rpcClient, gethClient),
)
app.Store.Config.Set("BRIDGE_RESPONSE_URL", cltest.WebURL(t, ""))
require.NoError(t, app.Start())
jr := app.MustCreateJobRun(txHash, blockHash)

return app.Store, jr.ID, cleanup
return app.Store, jr.ID, func() {
assertMocksCalled()
cleanup()
}
}

func TestBridge_IncludesMetaIfJobRunIsInDB(t *testing.T) {
Expand Down
15 changes: 8 additions & 7 deletions core/adapters/eth_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func TestEthTxAdapter_Perform_BPTXM(t *testing.T) {

store, cleanup := cltest.NewStore(t)
defer cleanup()
_, fromAddress := cltest.MustAddRandomKeyToKeystore(t, store, 0)

toAddress := cltest.NewAddress()
gasLimit := uint64(42)
Expand Down Expand Up @@ -162,7 +163,7 @@ func TestEthTxAdapter_Perform_BPTXM(t *testing.T) {
}
jobRunID := models.NewID()
taskRunID := cltest.MustInsertTaskRun(t, store)
etx := cltest.MustInsertUnconfirmedEthTxWithBroadcastAttempt(t, store, 0)
etx := cltest.MustInsertUnconfirmedEthTxWithBroadcastAttempt(t, store, 0, fromAddress)
store.DB.Exec(`INSERT INTO eth_task_run_txes (task_run_id, eth_tx_id) VALUES ($1, $2)`, taskRunID.UUID(), etx.ID)
input := models.NewRunInputWithResult(jobRunID, taskRunID, "0x9786856756", models.RunStatusUnstarted)

Expand All @@ -182,7 +183,7 @@ func TestEthTxAdapter_Perform_BPTXM(t *testing.T) {
}
jobRunID := models.NewID()
taskRunID := cltest.MustInsertTaskRun(t, store)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 1, 1)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 1, 1, fromAddress)
store.DB.Exec(`INSERT INTO eth_task_run_txes (task_run_id, eth_tx_id) VALUES ($1, $2)`, taskRunID.UUID(), etx.ID)
input := models.NewRunInputWithResult(jobRunID, taskRunID, "0x9786856756", models.RunStatusUnstarted)

Expand All @@ -203,7 +204,7 @@ func TestEthTxAdapter_Perform_BPTXM(t *testing.T) {
}
jobRunID := models.NewID()
taskRunID := cltest.MustInsertTaskRun(t, store)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 2, 1)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 2, 1, fromAddress)

confirmedAttemptHash := etx.EthTxAttempts[0].Hash

Expand Down Expand Up @@ -232,7 +233,7 @@ func TestEthTxAdapter_Perform_BPTXM(t *testing.T) {
}
jobRunID := models.NewID()
taskRunID := cltest.MustInsertTaskRun(t, store)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 3, 1)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 3, 1, fromAddress)

confirmedAttemptHash := etx.EthTxAttempts[0].Hash

Expand Down Expand Up @@ -267,7 +268,7 @@ func TestEthTxAdapter_Perform_BPTXM(t *testing.T) {
}
jobRunID := models.NewID()
taskRunID := cltest.MustInsertTaskRun(t, store)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 4, 1)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 4, 1, fromAddress)

confirmedAttemptHash := etx.EthTxAttempts[0].Hash

Expand Down Expand Up @@ -296,7 +297,7 @@ func TestEthTxAdapter_Perform_BPTXM(t *testing.T) {
}
jobRunID := models.NewID()
taskRunID := cltest.MustInsertTaskRun(t, store)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 5, 1)
etx := cltest.MustInsertConfirmedEthTxWithAttempt(t, store, 5, 1, fromAddress)
attempt2 := cltest.MustInsertBroadcastEthTxAttempt(t, etx.ID, store, 2)

confirmedAttemptHash := attempt2.Hash
Expand Down Expand Up @@ -326,7 +327,7 @@ func TestEthTxAdapter_Perform_BPTXM(t *testing.T) {
}
jobRunID := models.NewID()
taskRunID := cltest.MustInsertTaskRun(t, store)
etx := cltest.MustInsertFatalErrorEthTx(t, store)
etx := cltest.MustInsertFatalErrorEthTx(t, store, fromAddress)
require.NoError(t, store.DB.Exec(`INSERT INTO eth_task_run_txes (task_run_id, eth_tx_id) VALUES ($1, $2)`, taskRunID.UUID(), etx.ID).Error)

input := models.NewRunInputWithResult(jobRunID, taskRunID, "0x9786856756", models.RunStatusUnstarted)
Expand Down
2 changes: 1 addition & 1 deletion core/adapters/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestHTTPGet_TimeoutAllowsRetries(t *testing.T) {

store := leanStore()
timeout := 30 * time.Millisecond
store.Config.Set("DEFAULT_HTTP_TIMEOUT", strconv.Itoa(int(timeout)))
store.Config.Set("DEFAULT_HTTP_TIMEOUT", timeout.String())
store.Config.Set("MAX_HTTP_ATTEMPTS", "2")

attempts := make(chan struct{}, 2)
Expand Down
99 changes: 96 additions & 3 deletions core/cmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewApp(client *Client) *cli.App {
Subcommands: []cli.Command{
{
Name: "chpass",
Usage: "Change your account password remotely",
Usage: "Change your API password remotely",
Action: client.ChangePassword,
},
{
Expand Down Expand Up @@ -214,13 +214,54 @@ func NewApp(client *Client) *cli.App {
{
Name: "create",
Usage: "Create an key in the node's keystore alongside the existing key; to create an original key, just run the node",
Action: client.CreateExtraKey,
Action: client.CreateETHKey,
},
{
Name: "list",
Usage: "Display the Account's address with its ETH & LINK balances",
Usage: "List available Ethereum accounts with their ETH & LINK balances, nonces, and other metadata",
Action: client.ListETHKeys,
},
{
Name: "delete",
Usage: format(`Deletes the ETH key matching the given address`),
Flags: []cli.Flag{
cli.BoolFlag{
Name: "yes, y",
Usage: "skip the confirmation prompt",
},
cli.BoolFlag{
Name: "hard",
Usage: "hard-delete the key instead of archiving (irreversible!)",
},
},
Action: client.DeleteETHKey,
},
{
Name: "import",
Usage: format(`Imports an ETH key from a JSON file`),
Flags: []cli.Flag{
cli.StringFlag{
Name: "oldpassword, p",
Usage: "the password that the key in the JSON file was encrypted with",
},
},
Action: client.ImportETHKey,
},
{
Name: "export",
Usage: format(`Exports an ETH key to a JSON file`),
Flags: []cli.Flag{
cli.StringFlag{
Name: "newpassword, p",
Usage: "the password with which to encrypt the key in the JSON file",
},
cli.StringFlag{
Name: "output, o",
Usage: "the path where the JSON file will be saved",
},
},
Action: client.ExportETHKey,
},
},
},
cli.Command{
Expand Down Expand Up @@ -254,6 +295,32 @@ func NewApp(client *Client) *cli.App {
Usage: format(`List available P2P keys`),
Action: client.ListP2PKeys,
},
{
Name: "import",
Usage: format(`Imports a P2P key from a JSON file`),
Flags: []cli.Flag{
cli.StringFlag{
Name: "oldpassword, p",
Usage: "the password that the key in the JSON file was encrypted with",
},
},
Action: client.ImportP2PKey,
},
{
Name: "export",
Usage: format(`Exports a P2P key to a JSON file`),
Flags: []cli.Flag{
cli.StringFlag{
Name: "newpassword, p",
Usage: "the password with which to encrypt the key in the JSON file",
},
cli.StringFlag{
Name: "output, o",
Usage: "the path where the JSON file will be saved",
},
},
Action: client.ExportP2PKey,
},
},
},
cli.Command{
Expand Down Expand Up @@ -287,6 +354,32 @@ func NewApp(client *Client) *cli.App {
Usage: format(`List available OCR key bundles`),
Action: client.ListOCRKeyBundles,
},
{
Name: "import",
Usage: format(`Imports an OCR key bundle from a JSON file`),
Flags: []cli.Flag{
cli.StringFlag{
Name: "oldpassword, p",
Usage: "the password that the key in the JSON file was encrypted with",
},
},
Action: client.ImportOCRKey,
},
{
Name: "export",
Usage: format(`Exports an OCR key bundle to a JSON file`),
Flags: []cli.Flag{
cli.StringFlag{
Name: "newpassword, p",
Usage: "the password with which to encrypt the key in the JSON file",
},
cli.StringFlag{
Name: "output, o",
Usage: "the path where the JSON file will be saved",
},
},
Action: client.ExportOCRKey,
},
},
},
cli.Command{
Expand Down
4 changes: 2 additions & 2 deletions core/cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (n ChainlinkAppFactory) NewApplication(config *orm.Config, onConnectCallbac
}

advisoryLock := postgres.NewAdvisoryLock(config.DatabaseURL())
return chainlink.NewApplication(config, ethClient, advisoryLock, onConnectCallbacks...)
return chainlink.NewApplication(config, ethClient, advisoryLock, store.StandardKeyStoreGen, onConnectCallbacks...)
}

// Runner implements the Run method.
Expand Down Expand Up @@ -529,7 +529,7 @@ func confirmAction(c *clipkg.Context) bool {
prompt := NewTerminalPrompter()
var answer string
for {
answer = prompt.Prompt("Are you sure? This action is irreversible! (yes/no)")
answer = prompt.Prompt("Are you sure? This action is irreversible! (yes/no) ")
if answer == "yes" {
return true
} else if answer == "no" {
Expand Down
9 changes: 5 additions & 4 deletions core/cmd/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package cmd_test
import (
"testing"

"github.com/smartcontractkit/chainlink/core/services/eth"

"github.com/smartcontractkit/chainlink/core/cmd"
"github.com/smartcontractkit/chainlink/core/internal/cltest"
"github.com/smartcontractkit/chainlink/core/store/models"
Expand Down Expand Up @@ -44,11 +46,10 @@ func TestTerminalCookieAuthenticator_AuthenticateWithoutSession(t *testing.T) {
func TestTerminalCookieAuthenticator_AuthenticateWithSession(t *testing.T) {
t.Parallel()

rpcClient, gethClient, _, assertMocksCalled := cltest.NewEthMocksWithStartupAssertions(t)
defer assertMocksCalled()
app, cleanup := cltest.NewApplication(t,
cltest.LenientEthMock,
cltest.EthMockRegisterChainID,
cltest.EthMockRegisterGetBlockByNumber,
cltest.EthMockRegisterGetBalance,
eth.NewClientWith(rpcClient, gethClient),
)
defer cleanup()
require.NoError(t, app.Start())
Expand Down
Loading

0 comments on commit 3ccbf49

Please sign in to comment.