Skip to content

Commit

Permalink
bump geth; replace common.Address.Hash() calls; restore standard log
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Jan 18, 2024
1 parent a075447 commit a7d1721
Show file tree
Hide file tree
Showing 16 changed files with 149 additions and 130 deletions.
4 changes: 2 additions & 2 deletions core/chains/evm/logpoller/log_poller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ func populateDatabase(t testing.TB, o *logpoller.DbORM, chainID *big.Int) (commo
EventSig: event1,
Topics: [][]byte{event1[:], logpoller.EvmWord(uint64(i + 1000*j)).Bytes()},
Address: addr,
TxHash: utils.RandomAddress().Hash(),
TxHash: utils.RandomHash(),
Data: logpoller.EvmWord(uint64(i + 1000*j)).Bytes(),
CreatedAt: blockTimestamp,
})

}
require.NoError(t, o.InsertLogs(logs))
require.NoError(t, o.InsertBlock(utils.RandomAddress().Hash(), int64((j+1)*1000-1), startDate.Add(time.Duration(j*1000)*time.Hour), 0))
require.NoError(t, o.InsertBlock(utils.RandomHash(), int64((j+1)*1000-1), startDate.Add(time.Duration(j*1000)*time.Hour), 0))
}

return event1, address1, address2
Expand Down
14 changes: 7 additions & 7 deletions core/chains/evm/logpoller/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ func TestSelectLatestBlockNumberEventSigsAddrsWithConfs(t *testing.T) {
GenLog(th.ChainID, 2, 2, utils.RandomAddress().String(), event2[:], address2),
GenLog(th.ChainID, 2, 3, utils.RandomAddress().String(), event2[:], address2),
}))
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 3, time.Now(), 1))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 3, time.Now(), 1))

tests := []struct {
name string
Expand Down Expand Up @@ -1205,9 +1205,9 @@ func TestSelectLogsCreatedAfter(t *testing.T) {
GenLogWithTimestamp(th.ChainID, 2, 2, utils.RandomAddress().String(), event[:], address, block2ts),
GenLogWithTimestamp(th.ChainID, 1, 3, utils.RandomAddress().String(), event[:], address, block3ts),
}))
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 1, block1ts, 0))
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 2, block2ts, 1))
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 3, block3ts, 2))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 1, block1ts, 0))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 2, block2ts, 1))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 3, block3ts, 2))

type expectedLog struct {
block int64
Expand Down Expand Up @@ -1309,7 +1309,7 @@ func TestNestedLogPollerBlocksQuery(t *testing.T) {
require.Len(t, logs, 0)

// Persist block
require.NoError(t, th.ORM.InsertBlock(utils.RandomAddress().Hash(), 10, time.Now(), 0))
require.NoError(t, th.ORM.InsertBlock(utils.RandomHash(), 10, time.Now(), 0))

// Check if query actually works well with provided dataset
logs, err = th.ORM.SelectIndexedLogs(address, event, 1, []common.Hash{event}, logpoller.Unconfirmed)
Expand Down Expand Up @@ -1542,12 +1542,12 @@ func Benchmark_LogsDataWordBetween(b *testing.B) {
EventSig: commitReportAccepted,
Topics: [][]byte{},
Address: commitStoreAddress,
TxHash: utils.RandomAddress().Hash(),
TxHash: utils.RandomHash(),
Data: data,
CreatedAt: time.Now(),
})
}
require.NoError(b, o.InsertBlock(utils.RandomAddress().Hash(), int64(numberOfReports*numberOfMessagesPerReport), time.Now(), int64(numberOfReports*numberOfMessagesPerReport)))
require.NoError(b, o.InsertBlock(utils.RandomHash(), int64(numberOfReports*numberOfMessagesPerReport), time.Now(), int64(numberOfReports*numberOfMessagesPerReport)))
require.NoError(b, o.InsertLogs(dbLogs))

b.ResetTimer()
Expand Down
6 changes: 6 additions & 0 deletions core/chains/evm/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ func RandomAddress() common.Address {
return common.BytesToAddress(b)
}

func RandomHash() common.Hash {
b := make([]byte, 32)
_, _ = rand.Read(b) // Assignment for errcheck. Only used in tests so we can ignore.
return common.BytesToHash(b)
}

// IsEmptyAddress checks that the address is empty, synonymous with the zero
// account/address. No logs can come from this address, as there is no contract
// present there.
Expand Down
7 changes: 7 additions & 0 deletions core/cmd/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"fmt"
"io"
"log/slog"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -56,6 +57,12 @@ import (
"github.com/smartcontractkit/chainlink/v2/plugins"
)

func init() {
// hack to undo geth's disruption of the std default logger
// remove with geth v1.13.10
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, nil)))
}

var (
initGlobalsOnce sync.Once
prometheus *ginprom.Prometheus
Expand Down
23 changes: 12 additions & 11 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replace github.com/smartcontractkit/chainlink/v2 => ../../
require (
github.com/docker/docker v24.0.7+incompatible
github.com/docker/go-connections v0.4.0
github.com/ethereum/go-ethereum v1.12.2
github.com/ethereum/go-ethereum v1.13.8
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.4.0
github.com/jmoiron/sqlx v1.3.5
Expand Down Expand Up @@ -50,14 +50,14 @@ require (
github.com/Depado/ginprom v1.8.0 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/VictoriaMetrics/fastcache v1.10.0 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/avast/retry-go/v4 v4.5.1 // indirect
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
Expand All @@ -70,13 +70,14 @@ require (
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft v0.37.2 // indirect
github.com/cometbft/cometbft-db v0.7.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.10.0 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect
github.com/cosmos/cosmos-sdk v0.47.4 // indirect
Expand All @@ -87,7 +88,8 @@ require (
github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab // indirect
github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/danielkov/gin-helmet v0.0.0-20171108135313-1387e224435e // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand All @@ -102,7 +104,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/esote/minmaxheap v1.0.0 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fxamacker/cbor/v2 v2.5.0 // indirect
Expand All @@ -111,6 +113,7 @@ require (
github.com/gagliardetto/solana-go v1.4.1-0.20220428092759-5250b4abbb27 // indirect
github.com/gagliardetto/treeout v0.1.4 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 // indirect
github.com/getsentry/sentry-go v0.19.0 // indirect
github.com/gin-contrib/cors v1.5.0 // indirect
Expand All @@ -131,7 +134,6 @@ require (
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.5 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-webauthn/webauthn v0.9.4 // indirect
github.com/go-webauthn/x v0.1.5 // indirect
github.com/goccy/go-json v0.10.2 // indirect
Expand Down Expand Up @@ -172,7 +174,7 @@ require (
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down Expand Up @@ -294,7 +296,7 @@ require (
go.uber.org/ratelimit v0.2.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/arch v0.6.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
Expand All @@ -314,7 +316,6 @@ require (
gopkg.in/guregu/null.v4 v4.0.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
pgregory.net/rapid v0.5.5 // indirect
Expand Down
Loading

0 comments on commit a7d1721

Please sign in to comment.