Skip to content

Commit

Permalink
Merge pull request #4104 from smartcontractkit/release/0.10.3
Browse files Browse the repository at this point in the history
Release 0.10.3
  • Loading branch information
tyrion70 committed Mar 22, 2021
2 parents 4097aac + 127189a commit 5dbbc21
Show file tree
Hide file tree
Showing 423 changed files with 26,687 additions and 8,433 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ commands:
# Use temporary keys to get account ID
accountID=$(aws sts get-caller-identity --output text --query 'Account')
# docker cli login to ECR
aws ecr get-login-password --region "${AWS_REGION}" --profile "default" | docker login --username AWS --password-stdin "${accountID}.dkr.ecr.us-west-2.amazonaws.com/chainlink"
aws ecr-public get-login-password --region "us-east-1" --profile "default" | docker login --username AWS --password-stdin "public.ecr.aws"
4 changes: 0 additions & 4 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ jobs:
if: always()
run: ./compose ${{ matrix.test }}:down
working-directory: ./tools/docker
- name: Capture logs on failure
if: failure()
run: ./compose logs:test:save
working-directory: ./tools/docker
- name: Store logs artifacts on failure
if: failure()
uses: actions/upload-artifact@v1
Expand Down
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ evm-contracts/ethers/**/*
evm-contracts/truffle/**/*

# solc_bin
solc_bin
solc_bin

docs/
2 changes: 2 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ contracts-operator-ui-build: # only compiles tsc and builds contracts and operat
yarn setup:chainlink
CHAINLINK_VERSION="$(VERSION)@$(COMMIT_SHA)" yarn workspace @chainlink/operator-ui build

.PHONY: abigen
abigen: tools/bin/abigen
tools/bin/abigen:
./tools/bin/build_abigen

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ yarn setup:contracts

```bash
go generate ./...
go run ./packr/main.go ./core/eth/
go run ./packr/main.go ./core/services/eth/
```

5. Prepare your development environment:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.10.2
0.10.3
2 changes: 1 addition & 1 deletion core/adapters/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func TestBridgeResponse_TooLarge(t *testing.T) {
defer cfgCleanup()
config.Set("DEFAULT_HTTP_LIMIT", "1")

store, cleanup := cltest.NewStoreWithConfig(config)
store, cleanup := cltest.NewStoreWithConfig(t, config)
defer cleanup()

largePayload := `{"pending": true}`
Expand Down
7 changes: 7 additions & 0 deletions core/adapters/eth_tx.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package adapters

import (
"context"
"encoding/json"
"math/big"
"reflect"
Expand Down Expand Up @@ -152,6 +153,12 @@ func (e *EthTx) insertEthTx(input models.RunInput, store *strpkg.Store) models.R
gasLimit = e.GasLimit
}

if err := utils.CheckOKToTransmit(context.Background(), store.MustSQLDB(), fromAddress, store.Config.EthMaxUnconfirmedTransactions()); err != nil {
err = errors.Wrap(err, "number of unconfirmed transactions exceeds ETH_MAX_UNCONFIRMED_TRANSACTIONS")
logger.Error(err)
return models.NewRunOutputError(err)
}

if err := store.IdempotentInsertEthTaskRunTx(taskRunID, fromAddress, toAddress, encodedPayload, gasLimit); err != nil {
err = errors.Wrap(err, "insertEthTx failed")
logger.Error(err)
Expand Down
28 changes: 21 additions & 7 deletions core/cmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewApp(client *Client) *cli.App {
},
},

cli.Command{
{
Name: "agreements",
Aliases: []string{"agree"},
Usage: "Commands for handling service agreements",
Expand All @@ -75,7 +75,7 @@ func NewApp(client *Client) *cli.App {
},
},

cli.Command{
{
Name: "attempts",
Aliases: []string{"txas"},
Usage: "Commands for managing Ethereum Transaction Attempts",
Expand Down Expand Up @@ -186,6 +186,17 @@ func NewApp(client *Client) *cli.App {
Name: "jobs",
Usage: "Commands for managing Jobs (V2)",
Subcommands: []cli.Command{
{
Name: "list",
Usage: "List all V2 jobs",
Action: client.ListJobsV2,
Flags: []cli.Flag{
cli.IntFlag{
Name: "page",
Usage: "page of results to display",
},
},
},
{
Name: "create",
Usage: "Create a V2 job",
Expand All @@ -207,7 +218,7 @@ func NewApp(client *Client) *cli.App {
Name: "keys",
Usage: "Commands for managing various types of keys used by the Chainlink node",
Subcommands: []cli.Command{
cli.Command{
{
Name: "eth",
Usage: "Local commands for administering the node's Ethereum keys",
Subcommands: cli.Commands{
Expand Down Expand Up @@ -264,7 +275,8 @@ func NewApp(client *Client) *cli.App {
},
},
},
cli.Command{

{
Name: "p2p",
Usage: "Remote commands for administering the node's p2p keys",
Subcommands: cli.Commands{
Expand Down Expand Up @@ -323,7 +335,8 @@ func NewApp(client *Client) *cli.App {
},
},
},
cli.Command{

{
Name: "ocr",
Usage: "Remote commands for administering the node's off chain reporting keys",
Subcommands: cli.Commands{
Expand Down Expand Up @@ -382,7 +395,8 @@ func NewApp(client *Client) *cli.App {
},
},
},
cli.Command{

{
Name: "vrf",
Usage: format(`Local commands for administering the database of VRF proof
keys. These commands will not affect the extant in-memory keys of
Expand Down Expand Up @@ -577,7 +591,7 @@ func NewApp(client *Client) *cli.App {
},
},

cli.Command{
{
Name: "initiators",
Usage: "Commands for managing External Initiators",
Hidden: !client.Config.Dev() && !client.Config.FeatureExternalInitiators(),
Expand Down
61 changes: 40 additions & 21 deletions core/cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ func (cli *Client) errorOut(err error) error {

// AppFactory implements the NewApplication method.
type AppFactory interface {
NewApplication(*orm.Config, ...func(chainlink.Application)) chainlink.Application
NewApplication(*orm.Config, ...func(chainlink.Application)) (chainlink.Application, error)
}

// ChainlinkAppFactory is used to create a new Application.
type ChainlinkAppFactory struct{}

// NewApplication returns a new instance of the node with the given config.
func (n ChainlinkAppFactory) NewApplication(config *orm.Config, onConnectCallbacks ...func(chainlink.Application)) chainlink.Application {
func (n ChainlinkAppFactory) NewApplication(config *orm.Config, onConnectCallbacks ...func(chainlink.Application)) (chainlink.Application, error) {
var ethClient eth.Client
if config.EthereumDisabled() {
logger.Info("ETH_DISABLED is set, using Null eth.Client")
Expand All @@ -77,7 +77,7 @@ func (n ChainlinkAppFactory) NewApplication(config *orm.Config, onConnectCallbac
var err error
ethClient, err = eth.NewClient(config.EthereumURL(), config.EthereumSecondaryURLs()...)
if err != nil {
logger.Fatal(fmt.Sprintf("Unable to create ETH client: %+v", err))
return nil, err
}
}

Expand Down Expand Up @@ -162,18 +162,20 @@ type HTTPClient interface {
}

type authenticatedHTTPClient struct {
config orm.ConfigReader
client *http.Client
cookieAuth CookieAuthenticator
config orm.ConfigReader
client *http.Client
cookieAuth CookieAuthenticator
sessionRequest models.SessionRequest
}

// NewAuthenticatedHTTPClient uses the CookieAuthenticator to generate a sessionID
// which is then used for all subsequent HTTP API requests.
func NewAuthenticatedHTTPClient(config orm.ConfigReader, cookieAuth CookieAuthenticator) HTTPClient {
func NewAuthenticatedHTTPClient(config orm.ConfigReader, cookieAuth CookieAuthenticator, sessionRequest models.SessionRequest) HTTPClient {
return &authenticatedHTTPClient{
config: config,
client: &http.Client{},
cookieAuth: cookieAuth,
config: config,
client: &http.Client{},
cookieAuth: cookieAuth,
sessionRequest: sessionRequest,
}
}

Expand Down Expand Up @@ -203,11 +205,6 @@ func (h *authenticatedHTTPClient) Delete(path string) (*http.Response, error) {
}

func (h *authenticatedHTTPClient) doRequest(verb, path string, body io.Reader, headerArgs ...map[string]string) (*http.Response, error) {
cookie, err := h.cookieAuth.Cookie()
if err != nil {
return nil, err
}

var headers map[string]string
if len(headerArgs) > 0 {
headers = headerArgs[0]
Expand All @@ -224,8 +221,30 @@ func (h *authenticatedHTTPClient) doRequest(verb, path string, body io.Reader, h
for key, value := range headers {
request.Header.Add(key, value)
}
request.AddCookie(cookie)
return h.client.Do(request)
cookie, err := h.cookieAuth.Cookie()
if err != nil {
return nil, err
} else if cookie != nil {
request.AddCookie(cookie)
}

response, err := h.client.Do(request)
if err != nil {
return response, err
}
if response.StatusCode == http.StatusUnauthorized && (h.sessionRequest.Email != "" || h.sessionRequest.Password != "") {
var cookieerr error
cookie, err = h.cookieAuth.Authenticate(h.sessionRequest)
if cookieerr != nil {
return response, err
}
request.AddCookie(cookie)
response, err = h.client.Do(request)
if err != nil {
return response, err
}
}
return response, nil
}

// CookieAuthenticator is the interface to generating a cookie to authenticate
Expand Down Expand Up @@ -323,14 +342,14 @@ func (d DiskCookieStore) Save(cookie *http.Cookie) error {
func (d DiskCookieStore) Retrieve() (*http.Cookie, error) {
b, err := ioutil.ReadFile(d.cookiePath())
if err != nil {
return nil, multierr.Append(errors.New("unable to retrieve credentials, have you logged in?"), err)
return nil, multierr.Append(errors.New("unable to retrieve credentials, you must first login through the CLI"), err)
}
header := http.Header{}
header.Add("Cookie", string(b))
request := http.Request{Header: header}
cookies := request.Cookies()
if len(cookies) == 0 {
return nil, errors.New("Cookie not in file, have you logged in?")
return nil, errors.New("Cookie not in file, you must first login through the CLI")
}
return request.Cookies()[0], nil
}
Expand Down Expand Up @@ -442,11 +461,11 @@ func (f fileAPIInitializer) Initialize(store *store.Store) (models.User, error)
return user, store.SaveUser(&user)
}

var errNoCredentialFile = errors.New("no API user credential file was passed")
var ErrNoCredentialFile = errors.New("no API user credential file was passed")

func credentialsFromFile(file string) (models.SessionRequest, error) {
if len(file) == 0 {
return models.SessionRequest{}, errNoCredentialFile
return models.SessionRequest{}, ErrNoCredentialFile
}

logger.Debug("Initializing API credentials from ", file)
Expand Down
2 changes: 1 addition & 1 deletion core/cmd/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestTerminalAPIInitializer_InitializeWithoutAPIUser(t *testing.T) {
tai := cmd.NewPromptingAPIInitializer(mock)

// Remove fixture user
_, err := store.DeleteUser()
err := store.DeleteUser()
require.NoError(t, err)

user, err := tai.Initialize(store)
Expand Down
Loading

0 comments on commit 5dbbc21

Please sign in to comment.