Skip to content

Commit

Permalink
Post merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-sekara committed Jan 10, 2025
1 parent 7ea7b6d commit 0e3e10d
Show file tree
Hide file tree
Showing 74 changed files with 1,051 additions and 1,149 deletions.
1 change: 1 addition & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ packages:
config:
dir: core/services/relay/evm/mocks
ContractWriter:
ContractReader:
github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_onramp:
config:
dir: core/gethwrappers/ccip/mocks/
Expand Down
3 changes: 3 additions & 0 deletions core/chains/evm/client/config_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ func TestClientConfigBuilder(t *testing.T) {
require.Equal(t, deathDeclarationDelay, nodePool.DeathDeclarationDelay())
require.Equal(t, pollInterval, nodePool.FinalizedBlockPollInterval())
require.Equal(t, newHeadsPollInterval, nodePool.NewHeadsPollInterval())

// Validate node configs
require.Equal(t, *nodeConfigs[0].Name, *nodes[0].Name)
require.Equal(t, *nodeConfigs[0].WSURL, (*nodes[0].WSURL).String())
require.Equal(t, *nodeConfigs[0].HTTPURL, (*nodes[0].HTTPURL).String())

// Validate chain config
Expand Down
38 changes: 19 additions & 19 deletions core/chains/evm/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ func TestChainScopedConfig_GasEstimator(t *testing.T) {
assert.Equal(t, assets.GWei(20), ge.PriceDefault())
assert.Equal(t, assets.GWei(500), ge.PriceMax())
assert.Equal(t, assets.GWei(1), ge.PriceMin())
assert.Equal(t, uint64(8_000_000), ge.LimitDefault())
assert.Equal(t, uint64(8_000_000), ge.LimitMax())
assert.Equal(t, uint64(500000), ge.LimitDefault())
assert.Equal(t, uint64(500000), ge.LimitMax())
assert.Equal(t, float32(1), ge.LimitMultiplier())
assert.Equal(t, uint64(21000), ge.LimitTransfer())
assert.Equal(t, assets.GWei(5), ge.BumpMin())
Expand Down Expand Up @@ -305,23 +305,23 @@ func TestChainScopedConfig_Profiles(t *testing.T) {
expectedGasLimitDefault uint64
expectedMinimumContractPayment string
}{
{"default", 0, 8_000_000, "0.00001"},
{"mainnet", 1, 8_000_000, "0.1"},
{"kovan", 42, 8_000_000, "0.1"},

{"optimism", 10, 8_000_000, "0.00001"},
{"optimism", 69, 8_000_000, "0.00001"},
{"optimism", 420, 8_000_000, "0.00001"},

{"bscMainnet", 56, 8_000_000, "0.00001"},
{"hecoMainnet", 128, 8_000_000, "0.00001"},
{"fantomMainnet", 250, 8_000_000, "0.00001"},
{"fantomTestnet", 4002, 8_000_000, "0.00001"},
{"polygonMatic", 800001, 8_000_000, "0.00001"},
{"harmonyMainnet", 1666600000, 8_000_000, "0.00001"},
{"harmonyTestnet", 1666700000, 8_000_000, "0.00001"},

{"gnosisMainnet", 100, 8_000_000, "0.00001"},
{"default", 0, 500000, "0.00001"},
{"mainnet", 1, 500000, "0.1"},
{"kovan", 42, 500000, "0.1"},

{"optimism", 10, 500000, "0.00001"},
{"optimism", 69, 500000, "0.00001"},
{"optimism", 420, 500000, "0.00001"},

{"bscMainnet", 56, 500000, "0.00001"},
{"hecoMainnet", 128, 500000, "0.00001"},
{"fantomMainnet", 250, 500000, "0.00001"},
{"fantomTestnet", 4002, 500000, "0.00001"},
{"polygonMatic", 800001, 500000, "0.00001"},
{"harmonyMainnet", 1666600000, 500000, "0.00001"},
{"harmonyTestnet", 1666700000, 500000, "0.00001"},

{"gnosisMainnet", 100, 500000, "0.00001"},
}
for _, test := range tests {
tt := test
Expand Down
1 change: 0 additions & 1 deletion core/chains/evm/gas/chain_specific.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func chainSpecificIsUsable(tx evmtypes.Transaction, baseFee *assets.Wei, chainTy
return false
}
}

if chainType == chaintype.ChainZkSync {
// zKSync specific type for contract deployment & priority transactions
// https://era.zksync.io/docs/reference/concepts/transactions.html#eip-712-0x71
Expand Down
4 changes: 2 additions & 2 deletions core/chains/evm/logpoller/disabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ func (disabled) Name() string { return "disabledLogPoller" }

func (disabled) Start(ctx context.Context) error { return ErrDisabled }

func (disabled) Close() error { return ErrDisabled }

func (disabled) Healthy() error {
return ErrDisabled
}

func (disabled) Close() error { return ErrDisabled }

func (disabled) Ready() error { return ErrDisabled }

func (disabled) HealthReport() map[string]error {
Expand Down
36 changes: 0 additions & 36 deletions core/chains/evm/logpoller/observability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package logpoller

import (
"fmt"
"math"
"math/big"
"testing"
"time"
Expand Down Expand Up @@ -149,41 +148,6 @@ func TestCountersAreProperlyPopulatedForWrites(t *testing.T) {
assert.Equal(t, float64(2), testutil.ToFloat64(orm.blocksInserted.WithLabelValues("420")))
}

func TestCounterAreProperlyPopulatedForDeletes(t *testing.T) {
ctx := testutils.Context(t)
orm := createObservedORM(t, 420)
logs := generateRandomLogs(420, 20)

for _, log := range logs {
err := orm.InsertLogsWithBlock(ctx, []Log{log}, NewLogPollerBlock(utils.RandomBytes32(), log.BlockNumber, time.Now(), 0))
require.NoError(t, err)
}

// Delete 5 logs
removed, err := orm.DeleteBlocksBefore(ctx, logs[4].BlockNumber, 100)
require.NoError(t, err)
assert.Equal(t, int64(5), removed)
assert.Equal(t, float64(5), testutil.ToFloat64(orm.datasetSize.WithLabelValues("420", "DeleteBlocksBefore", "delete")))

// Delete 1 more log
removed, err = orm.DeleteBlocksBefore(ctx, logs[5].BlockNumber, 100)
require.NoError(t, err)
assert.Equal(t, int64(1), removed)
assert.Equal(t, float64(1), testutil.ToFloat64(orm.datasetSize.WithLabelValues("420", "DeleteBlocksBefore", "delete")))

// Delete all
removed, err = orm.DeleteBlocksBefore(ctx, logs[len(logs)-1].BlockNumber, 0)
require.NoError(t, err)
assert.Equal(t, int64(14), removed)
assert.Equal(t, float64(14), testutil.ToFloat64(orm.datasetSize.WithLabelValues("420", "DeleteBlocksBefore", "delete")))

// Nothing to be deleted
removed, err = orm.DeleteBlocksBefore(ctx, math.MaxInt, 0)
require.NoError(t, err)
assert.Equal(t, int64(0), removed)
assert.Equal(t, float64(0), testutil.ToFloat64(orm.datasetSize.WithLabelValues("420", "DeleteBlocksBefore", "delete")))
}

func generateRandomLogs(chainId, count int) []Log {
logs := make([]Log, count)
for i := range logs {
Expand Down
1 change: 0 additions & 1 deletion core/chains/evm/txmgr/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func (c *evmTxmClient) BatchGetReceipts(ctx context.Context, attempts []TxAttemp
for _, req := range reqs {
txErr = append(txErr, req.Error)
}

return txReceipt, txErr, nil
}

Expand Down
19 changes: 1 addition & 18 deletions core/chains/evm/txmgr/stuck_tx_detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func TestStuckTxDetector_DetectStuckTransactionsZircuit(t *testing.T) {
feeEstimator := gasmocks.NewEvmFeeEstimator(t)
// Return 10 gwei as market gas price
marketGasPrice := tenGwei
fee := gas.EvmFee{Legacy: marketGasPrice}
fee := gas.EvmFee{GasPrice: marketGasPrice}
feeEstimator.On("GetFee", mock.Anything, []byte{}, uint64(0), mock.Anything, mock.Anything, mock.Anything).Return(fee, uint64(0), nil)
ethClient := testutils.NewEthClientMockWithDefaultChain(t)
autoPurgeThreshold := uint32(5)
Expand Down Expand Up @@ -563,23 +563,6 @@ func mustInsertUnconfirmedTxWithBroadcastAttemptsContainsEmptyBroadcastBeforeBlo
return etx
}

// helper function for edge case where broadcast attempt contains empty pointer
func mustInsertUnconfirmedTxWithBroadcastAttemptsContainsEmptyBroadcastBeforeBlockNum(t *testing.T, txStore txmgr.TestEvmTxStore, nonce int64, fromAddress common.Address, numAttempts uint32, latestGasPrice *assets.Wei) txmgr.Tx {
ctx := tests.Context(t)
etx := cltest.MustInsertUnconfirmedEthTx(t, txStore, nonce, fromAddress)
// Insert attempts from oldest to newest
for i := int64(numAttempts - 1); i >= 0; i-- {
attempt := cltest.NewLegacyEthTxAttempt(t, etx.ID)
attempt.State = txmgrtypes.TxAttemptBroadcast
attempt.BroadcastBeforeBlockNum = nil
attempt.TxFee = gas.EvmFee{Legacy: latestGasPrice.Sub(assets.NewWeiI(i))}
require.NoError(t, txStore.InsertTxAttempt(ctx, &attempt))
}
etx, err := txStore.FindTxWithAttempts(ctx, etx.ID)
require.NoError(t, err)
return etx
}

func mustInsertFatalErrorTxWithError(t *testing.T, txStore txmgr.TestEvmTxStore, nonce int64, fromAddress common.Address, blockNum int64) txmgr.Tx {
etx := cltest.NewEthTx(fromAddress)
etx.State = txmgrcommon.TxFatalError
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/utils/ethabi.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func ABIEncode(abiStr string, values ...interface{}) ([]byte, error) {
return res[4:], nil
}

// ABIDecode is the equivalent of abi.decode.
// ABIEncode is the equivalent of abi.decode.
// See a full set of examples https://github.com/ethereum/go-ethereum/blob/420b78659bef661a83c5c442121b13f13288c09f/accounts/abi/packing_test.go#L31
func ABIDecode(abiStr string, data []byte) ([]interface{}, error) {
inDef := fmt.Sprintf(`[{ "name" : "method", "type": "function", "outputs": %s}]`, abiStr)
Expand Down
3 changes: 0 additions & 3 deletions core/gethwrappers/go_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ package gethwrappers
//go:generate go generate ./liquiditymanager
//go:generate go generate ./workflow

// CCIP
//go:generate go generate ./ccip

// Mocks that contain only events and functions to emit them
// These contracts are used in testing Atlas flows. The contracts contain no logic, only events, structures, and functions to emit them.
// The flow is as follows:
Expand Down
1 change: 0 additions & 1 deletion core/services/blockheaderfeeder/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"go.uber.org/multierr"

"github.com/smartcontractkit/chainlink-common/pkg/services"

"github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm"
"github.com/smartcontractkit/chainlink/v2/core/config"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store"
Expand Down
1 change: 1 addition & 0 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/bridges"
"github.com/smartcontractkit/chainlink/v2/core/build"
"github.com/smartcontractkit/chainlink/v2/core/capabilities"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip"
gatewayconnector "github.com/smartcontractkit/chainlink/v2/core/capabilities/gateway_connector"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/remote"
remotetypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types"
Expand Down
4 changes: 0 additions & 4 deletions core/services/chainlink/config_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ func (f *featureConfig) UICSAKeys() bool {
return *f.c.UICSAKeys
}

func (f *featureConfig) CCIP() bool {
return *f.c.CCIP
}

func (f *featureConfig) MultiFeedsManagers() bool {
return *f.c.MultiFeedsManagers
}
4 changes: 2 additions & 2 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ func TestConfig_Marshal(t *testing.T) {
LogBackfillBatchSize: ptr[uint32](17),
LogPollInterval: &minute,
LogKeepBlocksDepth: ptr[uint32](100000),
LogPrunePageSize: ptr[uint32](10000),
LogPrunePageSize: ptr[uint32](0),
BackupLogPollerBlockDelay: ptr[uint64](532),
MinContractPayment: commonassets.NewLinkFromJuels(math.MaxInt64),
MinIncomingConfirmations: ptr[uint32](13),
Expand Down Expand Up @@ -1106,7 +1106,7 @@ LinkContractAddress = '0x538aAaB4ea120b2bC2fe5D296852D948F07D849e'
LogBackfillBatchSize = 17
LogPollInterval = '1m0s'
LogKeepBlocksDepth = 100000
LogPrunePageSize = 10000
LogPrunePageSize = 0
BackupLogPollerBlockDelay = 532
MinIncomingConfirmations = 13
MinContractPayment = '9.223372036854775807 link'
Expand Down
2 changes: 1 addition & 1 deletion core/services/chainlink/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ LinkContractAddress = '0x538aAaB4ea120b2bC2fe5D296852D948F07D849e'
LogBackfillBatchSize = 17
LogPollInterval = '1m0s'
LogKeepBlocksDepth = 100000
LogPrunePageSize = 10000
LogPrunePageSize = 0
BackupLogPollerBlockDelay = 532
MinIncomingConfirmations = 13
MinContractPayment = '9.223372036854775807 link'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ LinkContractAddress = '0x514910771AF9Ca656af840dff83E8264EcF986CA'
LogBackfillBatchSize = 1000
LogPollInterval = '15s'
LogKeepBlocksDepth = 100000
LogPrunePageSize = 10000
LogPrunePageSize = 0
BackupLogPollerBlockDelay = 100
MinIncomingConfirmations = 3
MinContractPayment = '0.1 link'
Expand Down Expand Up @@ -339,8 +339,8 @@ Mode = 'BlockHistory'
PriceDefault = '20 gwei'
PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether'
PriceMin = '1 gwei'
LimitDefault = 8000000
LimitMax = 8000000
LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateLimit = false
Expand Down Expand Up @@ -417,7 +417,7 @@ LinkContractAddress = '0xa36085F69e2889c224210F603D836748e7dC0088'
LogBackfillBatchSize = 1000
LogPollInterval = '15s'
LogKeepBlocksDepth = 100000
LogPrunePageSize = 10000
LogPrunePageSize = 0
BackupLogPollerBlockDelay = 100
MinIncomingConfirmations = 3
MinContractPayment = '0.1 link'
Expand Down Expand Up @@ -450,8 +450,8 @@ Mode = 'BlockHistory'
PriceDefault = '9.223372036854775807 ether'
PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether'
PriceMin = '1 gwei'
LimitDefault = 8000000
LimitMax = 8000000
LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateLimit = false
Expand Down Expand Up @@ -523,7 +523,7 @@ LinkContractAddress = '0xb0897686c545045aFc77CF20eC7A532E3120E0F1'
LogBackfillBatchSize = 1000
LogPollInterval = '1s'
LogKeepBlocksDepth = 100000
LogPrunePageSize = 10000
LogPrunePageSize = 0
BackupLogPollerBlockDelay = 100
MinIncomingConfirmations = 5
MinContractPayment = '0.00001 link'
Expand Down Expand Up @@ -555,8 +555,8 @@ Mode = 'FixedPrice'
PriceDefault = '30 gwei'
PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether'
PriceMin = '30 gwei'
LimitDefault = 8000000
LimitMax = 8000000
LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateLimit = false
Expand Down
26 changes: 13 additions & 13 deletions core/services/feeds/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const (
type PluginType string

const (
PluginTypeCommit PluginType = "COMMIT"
PluginTypeExecute PluginType = "EXECUTE"
PluginTypeMedian PluginType = "MEDIAN"
PluginTypeMercury PluginType = "MERCURY"
PluginTypeLiquidityManager PluginType = "LIQUIDITYMANAGER"
PluginTypeUnknown PluginType = "UNKNOWN"
PluginTypeCommit PluginType = "COMMIT"
PluginTypeExecute PluginType = "EXECUTE"
PluginTypeMedian PluginType = "MEDIAN"
PluginTypeMercury PluginType = "MERCURY"
PluginTypeRebalancer PluginType = "REBALANCER"
PluginTypeUnknown PluginType = "UNKNOWN"
)

func FromPluginTypeInput(pt PluginType) string {
Expand All @@ -47,19 +47,19 @@ func ToPluginType(s string) (PluginType, error) {
return PluginTypeMedian, nil
case "mercury":
return PluginTypeMercury, nil
case "liquiditymanager":
return PluginTypeLiquidityManager, nil
case "rebalancer":
return PluginTypeRebalancer, nil
default:
return PluginTypeUnknown, errors.New("unknown plugin type")
}
}

type Plugins struct {
Commit bool `json:"commit"`
Execute bool `json:"execute"`
Median bool `json:"median"`
Mercury bool `json:"mercury"`
LiquidityManager bool `json:"liquiditymanager"`
Commit bool `json:"commit"`
Execute bool `json:"execute"`
Median bool `json:"median"`
Mercury bool `json:"mercury"`
Rebalancer bool `json:"rebalancer"`
}

func (p Plugins) Value() (driver.Value, error) {
Expand Down
Loading

0 comments on commit 0e3e10d

Please sign in to comment.