Skip to content

Commit

Permalink
Merge pull request #1678 from smartcontractkit/release/0.6.8
Browse files Browse the repository at this point in the history
Release/0.6.8
  • Loading branch information
se3000 authored Sep 19, 2019
2 parents 6fe2015 + 736a7d1 commit 572e659
Show file tree
Hide file tree
Showing 284 changed files with 4,256 additions and 7,388 deletions.
25 changes: 25 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ workflows:
- rust
- explorer
- build-explorer-image:
requires:
- go-sqlite
- go-sqlite-race
- go-postgres
- truffle
- geth-postgres
- parity-postgres
- operator-ui
- rust
- explorer
filters:
branches:
ignore: master
Expand All @@ -304,6 +314,14 @@ workflows:
- /^release\/.*/
- aws-ecr/build_and_push_image:
requires:
- go-sqlite
- go-sqlite-race
- go-postgres
- truffle
- geth-postgres
- parity-postgres
- operator-ui
- rust
- explorer
filters:
branches:
Expand All @@ -314,4 +332,11 @@ workflows:
- reportcoverage:
requires:
- go-sqlite
- go-sqlite-race
- go-postgres
- truffle
- geth-postgres
- parity-postgres
- operator-ui
- rust
- explorer
32 changes: 0 additions & 32 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ COPY explorer/package.json ./explorer/
COPY operator_ui/package.json ./operator_ui/
COPY styleguide/package.json ./styleguide/
COPY tools/prettier-config/package.json ./tools/prettier-config/
COPY tools/eslint-config/package.json ./tools/eslint-config/
RUN make yarndep

# Install chainlink
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.7
0.6.8
4 changes: 2 additions & 2 deletions core/cmd/remote_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ func (cli *Client) CreateServiceAgreement(c *clipkg.Context) error {

buf, err := getBufferFromJSON(c.Args().First())
if err != nil {
return cli.errorOut(err)
return cli.errorOut(errors.Wrap(err, "while extracting json to buffer"))
}

resp, err := cli.HTTP.Post("/v2/service_agreements", buf)
if err != nil {
return cli.errorOut(err)
return cli.errorOut(errors.Wrap(err, "from initializing service-agreement-creation request"))
}
defer resp.Body.Close()

Expand Down
5 changes: 4 additions & 1 deletion core/cmd/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,15 @@ func (rt RendererTable) renderAccountBalances(balances []presenters.AccountBalan
}

func (rt RendererTable) renderServiceAgreement(sa presenters.ServiceAgreement) error {
table := rt.newTable([]string{"ID", "Created At", "Payment", "Expiration"})
table := rt.newTable([]string{"ID", "Created At", "Payment", "Expiration", "Aggregator", "AggInit", "AggFulfill"})
table.Append([]string{
sa.ID,
sa.FriendlyCreatedAt(),
sa.FriendlyPayment(),
sa.FriendlyExpiration(),
sa.FriendlyAggregator(),
sa.FriendlyAggregatorInitMethod(),
sa.FriendlyAggregatorFulfillMethod(),
})
render("Service Agreement", table)
return nil
Expand Down
14 changes: 10 additions & 4 deletions core/cmd/renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/smartcontractkit/chainlink/core/store/presenters"
"github.com/smartcontractkit/chainlink/core/web"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestRendererJSON_RenderJobs(t *testing.T) {
Expand Down Expand Up @@ -265,6 +266,8 @@ func TestRendererTable_Render_Txs(t *testing.T) {
assert.Contains(t, output, fmt.Sprint(txs[0].Confirmed))
}

func checkPresence(t *testing.T, s, output string) { assert.Regexp(t, regexp.MustCompile(s), output) }

func TestRendererTable_ServiceAgreementShow(t *testing.T) {
t.Parallel()

Expand All @@ -275,11 +278,14 @@ func TestRendererTable_ServiceAgreementShow(t *testing.T) {
buffer := bytes.NewBufferString("")
r := cmd.RendererTable{Writer: buffer}

assert.NoError(t, r.Render(&psa))
require.NoError(t, r.Render(&psa))
output := buffer.String()
assert.Regexp(t, regexp.MustCompile("0x[0-9a-zA-Z]{64}"), output)
assert.Regexp(t, regexp.MustCompile("1.000000000000000000 LINK"), output)
assert.Regexp(t, regexp.MustCompile("300 seconds"), output)
checkPresence(t, "0x[0-9a-zA-Z]{64}", output)
checkPresence(t, "1.000000000000000000 LINK", output)
checkPresence(t, "300 seconds", output)
checkPresence(t, "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", output) // Aggregator address
checkPresence(t, "0xd0771e55", output) // AggInitiateJobSelector
checkPresence(t, "0xbadc0de5", output) // AggFulfillSelector
}

func TestRendererTable_PatchResponse(t *testing.T) {
Expand Down
5 changes: 4 additions & 1 deletion core/cmd/testdata/hello_world_agreement.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"payment": "1000000000000000000",
"expiration": 300,
"oracles": ["0x3cb8e3FD9d27e39a5e9e6852b0e96160061fd4ea", "0xa0788FC17B1dEe36f057c42B6F373A34B014687e"],
"endAt": "2019-10-19T22:17:19Z"
"endAt": "2019-10-19T22:17:19Z",
"aggregator": "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF",
"aggInitiateJobSelector": "0xd0771e55",
"aggFulfillSelector": "0xbadc0de5"
}
13 changes: 12 additions & 1 deletion core/internal/cltest/factories.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,21 @@ func CreateTx(
store *strpkg.Store,
from common.Address,
sentAt uint64,
) *models.Tx {
return CreateTxWithNonce(t, store, from, sentAt, 0)
}

// CreateTxWithNonce creates a Tx from a specified address, sentAt, and nonce
func CreateTxWithNonce(
t testing.TB,
store *strpkg.Store,
from common.Address,
sentAt uint64,
nonce uint64,
) *models.Tx {
data := make([]byte, 36)
binary.LittleEndian.PutUint64(data, sentAt)
ethTx := types.NewTransaction(0, common.Address{}, big.NewInt(0), 250000, big.NewInt(1), data)
ethTx := types.NewTransaction(nonce, common.Address{}, big.NewInt(0), 250000, big.NewInt(1), data)
tx, err := store.CreateTx(null.String{}, ethTx, &from, sentAt)
require.NoError(t, err)
return tx
Expand Down
2 changes: 1 addition & 1 deletion core/internal/cltest/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ func NewHTTPMockServer(
server := httptest.NewServer(handler)
return server, func() {
server.Close()
assert.True(t, called)
assert.True(t, called, "expected call Mock HTTP endpoint '%s'", server.URL)
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/internal/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func TestIntegration_RunLog(t *testing.T) {
newHeads <- models.BlockHeader{Number: cltest.BigHexInt(safeNumber)}
confirmedReceipt := models.TxReceipt{
Hash: runlog.TxHash,
BlockHash: test.receiptBlockHash,
BlockHash: &test.receiptBlockHash,
BlockNumber: cltest.Int(creationHeight),
}
eth.Context("validateOnMainChain", func(ethMock *cltest.EthMock) {
Expand Down Expand Up @@ -460,7 +460,7 @@ func TestIntegration_ExternalAdapter_RunLogInitiated(t *testing.T) {

confirmedReceipt := models.TxReceipt{
Hash: runlog.TxHash,
BlockHash: runlog.BlockHash,
BlockHash: &runlog.BlockHash,
BlockNumber: cltest.Int(logBlockNumber),
}
eth.Context("validateOnMainChain", func(ethMock *cltest.EthMock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
}
],
"payment": "1000000000000000000",
"expiration": 300
"expiration": 300,
"aggregator": "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF",
"aggInitiateJobSelector": "0xd0771e55",
"aggFulfillSelector": "0xbadc0de5"
}
5 changes: 4 additions & 1 deletion core/internal/fixtures/web/noop_agreement.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"payment": "1000000000000000000",
"expiration": 300,
"oracles": ["0x3cb8e3FD9d27e39a5e9e6852b0e96160061fd4ea", "0xa0788FC17B1dEe36f057c42B6F373A34B014687e"],
"endAt": "2019-10-19T22:17:19Z"
"endAt": "2019-10-19T22:17:19Z",
"aggregator": "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF",
"aggInitiateJobSelector": "0xd0771e55",
"aggFulfillSelector": "0xbadc0de5"
}
2 changes: 1 addition & 1 deletion core/services/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func validateOnMainChain(jr *models.JobRun, taskRun *models.TaskRun, store *stor

func invalidRequest(request models.RunRequest, receipt *models.TxReceipt) bool {
return receipt.Unconfirmed() ||
(request.BlockHash != nil && *request.BlockHash != receipt.BlockHash)
(request.BlockHash != nil && *request.BlockHash != *receipt.BlockHash)
}

func meetsMinimumConfirmations(
Expand Down
2 changes: 1 addition & 1 deletion core/services/runs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ func TestExecuteJobWithRunRequest_fromRunLog_Happy(t *testing.T) {

confirmedReceipt := models.TxReceipt{
Hash: initiatingTxHash,
BlockHash: test.receiptBlockHash,
BlockHash: &test.receiptBlockHash,
BlockNumber: cltest.Int(3),
}
eth.Context("validateOnMainChain", func(ethMock *cltest.EthMock) {
Expand Down
5 changes: 4 additions & 1 deletion core/services/testdata/hello_world_agreement.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"payment": "1000000000000000000",
"expiration": 300,
"oracles": ["0x3cb8e3FD9d27e39a5e9e6852b0e96160061fd4ea", "0xa0788FC17B1dEe36f057c42B6F373A34B014687e"],
"endAt": "2019-10-19T22:17:19Z"
"endAt": "2019-10-19T22:17:19Z",
"aggregator": "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF",
"aggInitiateJobSelector": "0xd0771e55",
"aggFulfillSelector": "0xbadc0de5"
}
5 changes: 5 additions & 0 deletions core/store/migrations/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/smartcontractkit/chainlink/core/store/migrations/migration1566498796"
"github.com/smartcontractkit/chainlink/core/store/migrations/migration1566915476"
"github.com/smartcontractkit/chainlink/core/store/migrations/migration1567029116"
"github.com/smartcontractkit/chainlink/core/store/migrations/migration1568280052"
gormigrate "gopkg.in/gormigrate.v1"
)

Expand Down Expand Up @@ -100,6 +101,10 @@ func Migrate(db *gorm.DB) error {
ID: "1567029116",
Migrate: migration1567029116.Migrate,
},
{
ID: "1568280052",
Migrate: migration1568280052.Migrate,
},
}

m := gormigrate.New(db, &options, migrations)
Expand Down
59 changes: 59 additions & 0 deletions core/store/migrations/migration1568280052/migrate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package migration1568280052

import (
"github.com/jinzhu/gorm"
"github.com/pkg/errors"
"github.com/smartcontractkit/chainlink/core/store/migrations/migration1565877314"
"github.com/smartcontractkit/chainlink/core/store/models"
)

type ExternalInitiator struct {
*gorm.Model
Name string `gorm:"not null;unique"`
URL models.WebURL `gorm:"not null"`
AccessKey string `gorm:"not null"`
Salt string `gorm:"not null"`
HashedSecret string `gorm:"not null"`
OutgoingSecret string `gorm:"not null"`
OutgoingToken string `gorm:"not null"`
}

// newExternalInitiator returns a copy of the old struct with the fields untouched.
func newExternalInitiator(arg migration1565877314.ExternalInitiator) ExternalInitiator {
return ExternalInitiator{
Model: arg.Model,
Name: arg.AccessKey,
URL: arg.URL,
AccessKey: arg.AccessKey,
Salt: arg.Salt,
HashedSecret: arg.HashedSecret,
OutgoingSecret: arg.OutgoingSecret,
OutgoingToken: arg.OutgoingToken,
}
}

// Migrate adds External Initiator Name and URL fields.
func Migrate(tx *gorm.DB) error {
var exis []migration1565877314.ExternalInitiator
if err := tx.Find(&exis).Error; err != nil {
return errors.Wrap(err, "could not load all External Intitiators")
}

// Make new table
if err := tx.DropTable(migration1565877314.ExternalInitiator{}).Error; err != nil {
return errors.Wrap(err, "could not drop old External Intitiator table")
}
if err := tx.AutoMigrate(&ExternalInitiator{}).Error; err != nil {
return errors.Wrap(err, "could not create new External Intitiator table")
}

// Copy
for _, old := range exis {
exi := newExternalInitiator(old)
if err := tx.Save(exi).Error; err != nil {
return errors.Wrap(err, "could not save migrated version of External Initiator")
}
}

return nil
}
Loading

0 comments on commit 572e659

Please sign in to comment.