diff --git a/contracts/src/v0.8/dev/KeeperRegistryBase.sol b/contracts/src/v0.8/dev/KeeperRegistryBase.sol index 0b9ebdad3b0..cc6b94a4159 100644 --- a/contracts/src/v0.8/dev/KeeperRegistryBase.sol +++ b/contracts/src/v0.8/dev/KeeperRegistryBase.sol @@ -29,13 +29,13 @@ abstract contract KeeperRegistryBase is ConfirmedOwner, ExecutionPrevention, Ree uint32 internal constant UINT32_MAX = type(uint32).max; uint96 internal constant LINK_TOTAL_SUPPLY = 1e27; UpkeepFormat internal constant UPKEEP_TRANSCODER_VERSION_BASE = UpkeepFormat.V2; - // L1_FEE_DATA_PADDING includes 35 bytes for L1 data padding for Optimism - bytes public L1_FEE_DATA_PADDING = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; + bytes internal constant L1_FEE_DATA_PADDING = + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; // MAX_INPUT_DATA represents the estimated max size of the sum of L1 data padding and msg.data in performUpkeep // function, which includes 4 bytes for function selector, 32 bytes for upkeep id, 35 bytes for data padding, and // 64 bytes for estimated perform data - bytes public MAX_INPUT_DATA = + bytes internal constant MAX_INPUT_DATA = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; address[] internal s_keeperList; diff --git a/core/logger/critical.go b/core/logger/critical.go index 31aa8cb3d67..7904b1897ac 100644 --- a/core/logger/critical.go +++ b/core/logger/critical.go @@ -2,7 +2,7 @@ package logger import "go.uber.org/zap/zapcore" -// encodeLevel is a zapcore.EncodeLevel that encodes crit in place of dpanic for our custom Critical* level. +// encodeLevel is a zapcore.EncodeLevel that encodes 'crit' in place of dpanic for our custom Critical* level. func encodeLevel(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder) { if l == zapcore.DPanicLevel { enc.AppendString("crit") diff --git a/core/logger/fields_test.go b/core/logger/fields_test.go index a5cdd5b70bb..90e7f1b376b 100644 --- a/core/logger/fields_test.go +++ b/core/logger/fields_test.go @@ -3,8 +3,9 @@ package logger_test import ( "testing" - "github.com/smartcontractkit/chainlink/core/logger" "github.com/stretchr/testify/assert" + + "github.com/smartcontractkit/chainlink/core/logger" ) func TestFields_Merge(t *testing.T) { diff --git a/core/logger/helpers_test.go b/core/logger/helpers_test.go deleted file mode 100644 index e253f63866a..00000000000 --- a/core/logger/helpers_test.go +++ /dev/null @@ -1,5 +0,0 @@ -package logger - -func ToMap(args []interface{}) (m map[string]interface{}) { - return toMap(args) -} diff --git a/core/logger/logger.go b/core/logger/logger.go index 8127f6110a6..b6e0b553d22 100644 --- a/core/logger/logger.go +++ b/core/logger/logger.go @@ -40,18 +40,18 @@ func init() { // Loggers should be injected (and usually Named as well): e.g. lggr.Named("") // // Tests -// - Tests should use a TestLogger, with NewLogger being reserved for actual -// runtime and limited direct testing. +// - Tests should use a TestLogger, with NewLogger being reserved for actual +// runtime and limited direct testing. // // Levels -// - Fatal: Logs and then calls os.Exit(1). Be careful about using this since it does NOT unwind the stack and may exit uncleanly. -// - Panic: Unrecoverable error. Example: invariant violation, programmer error -// - Critical: Requires quick action from the node op, obviously these should happen extremely rarely. Example: failed to listen on TCP port -// - Error: Something bad happened, and it was clearly on the node op side. No need for immediate action though. Example: database write timed out -// - Warn: Something bad happened, not clear who/what is at fault. Node ops should have a rough look at these once in a while to see whether anything stands out. Example: connection to peer was closed unexpectedly. observation timed out. -// - Info: High level information. First level we’d expect node ops to look at. Example: entered new epoch with leader, made an observation with value, etc. -// - Debug: Useful for forensic debugging, but we don't expect nops to look at this. Example: Got a message, dropped a message, ... -// - Trace: Only included if compiled with the trace tag. For example: go test -tags trace ... +// - Fatal: Logs and then calls os.Exit(1). Be careful about using this since it does NOT unwind the stack and may exit uncleanly. +// - Panic: Unrecoverable error. Example: invariant violation, programmer error +// - Critical: Requires quick action from the node op, obviously these should happen extremely rarely. Example: failed to listen on TCP port +// - Error: Something bad happened, and it was clearly on the node op side. No need for immediate action though. Example: database write timed out +// - Warn: Something bad happened, not clear who/what is at fault. Node ops should have a rough look at these once in a while to see whether anything stands out. Example: connection to peer was closed unexpectedly. observation timed out. +// - Info: High level information. First level we’d expect node ops to look at. Example: entered new epoch with leader, made an observation with value, etc. +// - Debug: Useful for forensic debugging, but we don't expect nops to look at this. Example: Got a message, dropped a message, ... +// - Trace: Only included if compiled with the trace tag. For example: go test -tags trace ... // // Node Operator Docs: https://docs.chain.link/docs/configuration-variables/#log_level type Logger interface { diff --git a/core/logger/sentry_test.go b/core/logger/sentry_test.go index 03f4d57b8e0..28cdaf81386 100644 --- a/core/logger/sentry_test.go +++ b/core/logger/sentry_test.go @@ -1,9 +1,8 @@ -package logger_test +package logger import ( "testing" - "github.com/smartcontractkit/chainlink/core/logger" "github.com/stretchr/testify/assert" ) @@ -13,7 +12,7 @@ func Test_toMap(t *testing.T) { "foo", 1, "bar", 42.43, "boggly", "str", } - m := logger.ToMap(keysAndValues) + m := toMap(keysAndValues) assert.Equal(t, map[string]interface{}{"bar": 42.43, "boggly": "str", "foo": 1}, m) }) @@ -23,7 +22,7 @@ func Test_toMap(t *testing.T) { "foo", 1, "bar", 42.43, "boggly", "str", "odd", } - m := logger.ToMap(keysAndValues) + m := toMap(keysAndValues) assert.Equal(t, map[string]interface{}{"bar": 42.43, "boggly": "str", "foo": 1}, m) }) diff --git a/core/logger/zap.go b/core/logger/zap.go index 36ec831ec81..715eea801b3 100644 --- a/core/logger/zap.go +++ b/core/logger/zap.go @@ -74,7 +74,7 @@ func (l *zapLogger) Helper(skip int) Logger { } func (l *zapLogger) sugaredHelper(skip int) *zap.SugaredLogger { - return l.SugaredLogger.Desugar().WithOptions(zap.AddCallerSkip(skip)).Sugar() + return l.SugaredLogger.WithOptions(zap.AddCallerSkip(skip)) } func (l *zapLogger) ErrorIf(err error, msg string) { diff --git a/go.mod b/go.mod index 3937e18375a..29c27243b01 100644 --- a/go.mod +++ b/go.mod @@ -78,7 +78,7 @@ require ( go.dedis.ch/kyber/v3 v3.0.13 go.uber.org/atomic v1.9.0 go.uber.org/multierr v1.8.0 - go.uber.org/zap v1.21.0 + go.uber.org/zap v1.23.0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa golang.org/x/exp v0.0.0-20220608143224-64259d1afd70 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 diff --git a/go.sum b/go.sum index cc7d40de1bf..f8f2416ace5 100644 --- a/go.sum +++ b/go.sum @@ -1837,6 +1837,8 @@ go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= +go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/integration-tests/contracts/contract_deployer.go b/integration-tests/contracts/contract_deployer.go index 69e0476446a..d9122decc64 100644 --- a/integration-tests/contracts/contract_deployer.go +++ b/integration-tests/contracts/contract_deployer.go @@ -371,14 +371,14 @@ func (e *EthereumContractDeployer) DeployMockETHLINKFeed(answer *big.Int) (MockE auth *bind.TransactOpts, backend bind.ContractBackend, ) (common.Address, *types.Transaction, interface{}, error) { - return ethereum.DeployMockV3AggregatorContract(auth, backend, 18, answer) + return ethereum.DeployMockETHLINKAggregator(auth, backend, answer) }) if err != nil { return nil, err } return &EthereumMockETHLINKFeed{ client: e.client, - feed: instance.(*ethereum.MockV3AggregatorContract), + feed: instance.(*ethereum.MockETHLINKAggregator), address: address, }, err } @@ -481,7 +481,7 @@ func (e *EthereumContractDeployer) DeployKeeperRegistry( auth *bind.TransactOpts, backend bind.ContractBackend, ) (common.Address, *types.Transaction, interface{}, error) { - return ethereum.DeployKeeperRegistry( + return ethereum.DeployKeeperRegistry12( auth, backend, common.HexToAddress(opts.LinkAddr), @@ -510,7 +510,7 @@ func (e *EthereumContractDeployer) DeployKeeperRegistry( client: e.client, version: ethereum.RegistryVersion_1_2, registry1_1: nil, - registry1_2: instance.(*ethereum.KeeperRegistry), + registry1_2: instance.(*ethereum.KeeperRegistry12), address: address, }, err diff --git a/integration-tests/contracts/ethereum_contracts.go b/integration-tests/contracts/ethereum_contracts.go index cdc08e78eeb..0334c211f39 100644 --- a/integration-tests/contracts/ethereum_contracts.go +++ b/integration-tests/contracts/ethereum_contracts.go @@ -16,6 +16,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/contracts/ethereum" + "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/testreporters" ) @@ -989,7 +990,7 @@ func (v *EthereumVRF) ProofLength(ctxt context.Context) (*big.Int, error) { // EthereumMockETHLINKFeed represents mocked ETH/LINK feed contract type EthereumMockETHLINKFeed struct { client blockchain.EVMClient - feed *ethereum.MockV3AggregatorContract + feed *ethereum.MockETHLINKAggregator address *common.Address } @@ -1005,7 +1006,7 @@ func (v *EthereumMockETHLINKFeed) LatestRoundData() (*big.Int, error) { if err != nil { return nil, err } - return data.Answer, nil + return data.Ans, nil } // EthereumMockGASFeed represents mocked Gas feed contract diff --git a/integration-tests/contracts/ethereum_keeper_contracts.go b/integration-tests/contracts/ethereum_keeper_contracts.go index 9d50deb62f7..e41f6e31ae7 100644 --- a/integration-tests/contracts/ethereum_keeper_contracts.go +++ b/integration-tests/contracts/ethereum_keeper_contracts.go @@ -6,9 +6,8 @@ import ( "fmt" "math/big" "strconv" - "time" - "strings" + "time" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -18,6 +17,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/contracts/ethereum" + "github.com/smartcontractkit/chainlink/integration-tests/testreporters" ) @@ -149,7 +149,7 @@ type EthereumKeeperRegistry struct { client blockchain.EVMClient version ethereum.KeeperRegistryVersion registry1_1 *ethereum.KeeperRegistry11 - registry1_2 *ethereum.KeeperRegistry + registry1_2 *ethereum.KeeperRegistry12 address *common.Address } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index eb80fb4c185..9c72b119691 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -12,8 +12,8 @@ require ( github.com/rs/zerolog v1.27.0 github.com/satori/go.uuid v1.2.0 github.com/slack-go/slack v0.11.2 - github.com/smartcontractkit/chainlink-env v0.2.35 - github.com/smartcontractkit/chainlink-testing-framework v1.5.8 + github.com/smartcontractkit/chainlink-env v0.2.36 + github.com/smartcontractkit/chainlink-testing-framework v1.5.10 github.com/smartcontractkit/libocr v0.0.0-20220701150323-d815c8d0eab8 github.com/stretchr/testify v1.8.0 go.uber.org/atomic v1.9.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 5e52b3caf48..c31a26346c9 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -537,10 +537,10 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/slack-go/slack v0.11.2 h1:IWl90Rk+jqPEVyiBytH27CSN/TFAg2vuDDfoPRog/nc= github.com/slack-go/slack v0.11.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= -github.com/smartcontractkit/chainlink-env v0.2.35 h1:xveefHkVsyavsEQAI7pO9uCAfoED7izhqnme1lGeFI4= -github.com/smartcontractkit/chainlink-env v0.2.35/go.mod h1:pPMIcVvyS9owsJ2e1zqFsfaDjeoUlpsWtV+Ndm3/JN8= -github.com/smartcontractkit/chainlink-testing-framework v1.5.8 h1:bAOP5KcHXwbcysScCXq4Ovgufs4HyDxWkUkyVhGhcfY= -github.com/smartcontractkit/chainlink-testing-framework v1.5.8/go.mod h1:xv840sOjnMYkR+YUYta/sVr0HF1Tb52vUJ777yYEaXc= +github.com/smartcontractkit/chainlink-env v0.2.36 h1:FzYcjQ/siMOvJxUC7G2+SLquEvx4/uPYjx2xVprfjdE= +github.com/smartcontractkit/chainlink-env v0.2.36/go.mod h1:pPMIcVvyS9owsJ2e1zqFsfaDjeoUlpsWtV+Ndm3/JN8= +github.com/smartcontractkit/chainlink-testing-framework v1.5.10 h1:ZoA0xVweFs0k1AfU2J1brqomQFLfUrYJKzs3Pk7G6AU= +github.com/smartcontractkit/chainlink-testing-framework v1.5.10/go.mod h1:+rKGnT70sk5LXzvLZ0+Wjn3kMycYIJhf0lb9OFYyBgA= github.com/smartcontractkit/libocr v0.0.0-20220701150323-d815c8d0eab8 h1:raZou4k7yhqym37dqOV5xGV730G/xvBK0gDHjWHuTJw= github.com/smartcontractkit/libocr v0.0.0-20220701150323-d815c8d0eab8/go.mod h1:5JnCHuYgmIP9ZyXzgAfI5Iwu0WxBtBKp+ApeT5o1Cjw= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=