diff --git a/.changeset/hungry-cats-scream.md b/.changeset/hungry-cats-scream.md new file mode 100644 index 00000000000..2c9f66115f3 --- /dev/null +++ b/.changeset/hungry-cats-scream.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +The `xdai` `ChainType` has been renamed to `gnosis` to match the chain's new name. The old value is still supported but has been deprecated and will be removed in v2.13.0. diff --git a/common/config/chaintype.go b/common/config/chaintype.go index 9ef4864b86e..29bab2a91e2 100644 --- a/common/config/chaintype.go +++ b/common/config/chaintype.go @@ -11,24 +11,33 @@ type ChainType string // nolint const ( ChainArbitrum ChainType = "arbitrum" + ChainCelo ChainType = "celo" + ChainGnosis ChainType = "gnosis" + ChainKroma ChainType = "kroma" ChainMetis ChainType = "metis" ChainOptimismBedrock ChainType = "optimismBedrock" - ChainXDai ChainType = "xdai" - ChainCelo ChainType = "celo" + ChainScroll ChainType = "scroll" ChainWeMix ChainType = "wemix" - ChainKroma ChainType = "kroma" + ChainXDai ChainType = "xdai" // Deprecated: use ChainGnosis instead ChainZkSync ChainType = "zksync" - ChainScroll ChainType = "scroll" ) var ErrInvalidChainType = fmt.Errorf("must be one of %s or omitted", strings.Join([]string{ - string(ChainArbitrum), string(ChainMetis), string(ChainXDai), string(ChainOptimismBedrock), string(ChainCelo), - string(ChainKroma), string(ChainWeMix), string(ChainZkSync), string(ChainScroll)}, ", ")) + string(ChainArbitrum), + string(ChainCelo), + string(ChainGnosis), + string(ChainKroma), + string(ChainMetis), + string(ChainOptimismBedrock), + string(ChainScroll), + string(ChainWeMix), + string(ChainZkSync), +}, ", ")) // IsValid returns true if the ChainType value is known or empty. func (c ChainType) IsValid() bool { switch c { - case "", ChainArbitrum, ChainMetis, ChainOptimismBedrock, ChainXDai, ChainCelo, ChainKroma, ChainWeMix, ChainZkSync, ChainScroll: + case "", ChainArbitrum, ChainCelo, ChainGnosis, ChainKroma, ChainMetis, ChainOptimismBedrock, ChainScroll, ChainWeMix, ChainXDai, ChainZkSync: return true } return false @@ -41,9 +50,6 @@ func (c ChainType) IsL2() bool { switch c { case ChainArbitrum, ChainMetis: return true - - case ChainXDai: - fallthrough default: return false } diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index 07fe392b69c..0f3e0a9a9f8 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -336,7 +336,7 @@ func TestChainScopedConfig_Profiles(t *testing.T) { {"harmonyMainnet", 1666600000, 500000, "0.00001"}, {"harmonyTestnet", 1666700000, 500000, "0.00001"}, - {"xDai", 100, 500000, "0.00001"}, + {"gnosisMainnet", 100, 500000, "0.00001"}, } for _, test := range tests { tt := test diff --git a/core/chains/evm/config/toml/defaults/Gnosis_Chiado.toml b/core/chains/evm/config/toml/defaults/Gnosis_Chiado.toml index 4770e104fbb..72c4ed13ae0 100644 --- a/core/chains/evm/config/toml/defaults/Gnosis_Chiado.toml +++ b/core/chains/evm/config/toml/defaults/Gnosis_Chiado.toml @@ -1,7 +1,7 @@ ChainID = '10200' # Gnoisis Finality is approx 8 minutes @ 12 blocks per minute, so 96 blocks FinalityDepth = 100 -ChainType = 'xdai' +ChainType = 'gnosis' LogPollInterval = '5s' [GasEstimator] diff --git a/core/chains/evm/config/toml/defaults/Gnosis_Mainnet.toml b/core/chains/evm/config/toml/defaults/Gnosis_Mainnet.toml index cc4e27e7ff4..6e180c52e39 100644 --- a/core/chains/evm/config/toml/defaults/Gnosis_Mainnet.toml +++ b/core/chains/evm/config/toml/defaults/Gnosis_Mainnet.toml @@ -6,7 +6,7 @@ # With xDai's current maximum of 19 validators then 40 blocks is the maximum possible re-org) # The mainnet default of 50 blocks is ok here ChainID = '100' -ChainType = 'xdai' +ChainType = 'gnosis' LinkContractAddress = '0xE2e73A1c69ecF83F464EFCE6A5be353a37cA09b2' LogPollInterval = '5s' diff --git a/core/chains/evm/gas/block_history_estimator_test.go b/core/chains/evm/gas/block_history_estimator_test.go index 7c467d1b36f..f5ab06fc913 100644 --- a/core/chains/evm/gas/block_history_estimator_test.go +++ b/core/chains/evm/gas/block_history_estimator_test.go @@ -886,12 +886,12 @@ func TestBlockHistoryEstimator_Recalculate_NoEIP1559(t *testing.T) { require.Equal(t, assets.NewWeiI(70), price) }) - t.Run("takes into account zero priced transactions if chain is not xDai", func(t *testing.T) { + t.Run("takes into account zero priced transactions if chain is not Gnosis", func(t *testing.T) { // Because everyone loves free gas! ethClient := evmtest.NewEthClientMockWithDefaultChain(t) cfg := gas.NewMockConfig() - bhCfg := newBlockHistoryConfig() + bhCfg := newBlockHistoryConfig() bhCfg.TransactionPercentileF = uint16(50) geCfg := &gas.MockGasEstimatorConfig{} @@ -908,7 +908,7 @@ func TestBlockHistoryEstimator_Recalculate_NoEIP1559(t *testing.T) { Number: 0, Hash: b1Hash, ParentHash: common.Hash{}, - Transactions: cltest.LegacyTransactionsFromGasPrices(0, 0, 0, 0, 100), + Transactions: cltest.LegacyTransactionsFromGasPrices(0, 0, 25, 50, 100), }, } @@ -917,24 +917,22 @@ func TestBlockHistoryEstimator_Recalculate_NoEIP1559(t *testing.T) { bhe.Recalculate(cltest.Head(0)) price := gas.GetGasPrice(bhe) - require.Equal(t, assets.NewWeiI(0), price) + require.Equal(t, assets.NewWeiI(25), price) }) - t.Run("ignores zero priced transactions on xDai", func(t *testing.T) { - chainID := big.NewInt(100) - + t.Run("ignores zero priced transactions only on Gnosis", func(t *testing.T) { ethClient := evmtest.NewEthClientMock(t) cfg := gas.NewMockConfig() - bhCfg := newBlockHistoryConfig() + bhCfg := newBlockHistoryConfig() bhCfg.TransactionPercentileF = uint16(50) geCfg := &gas.MockGasEstimatorConfig{} geCfg.EIP1559DynamicFeesF = false geCfg.PriceMaxF = maxGasPrice - geCfg.PriceMinF = assets.NewWeiI(100) + geCfg.PriceMinF = assets.NewWeiI(11) // Has to be set as Gnosis will only ignore transactions below this price - ibhe := newBlockHistoryEstimatorWithChainID(t, ethClient, cfg, geCfg, bhCfg, *chainID) + ibhe := newBlockHistoryEstimator(t, ethClient, cfg, geCfg, bhCfg) bhe := gas.BlockHistoryEstimatorFromInterface(ibhe) b1Hash := utils.NewHash() @@ -944,16 +942,24 @@ func TestBlockHistoryEstimator_Recalculate_NoEIP1559(t *testing.T) { Number: 0, Hash: b1Hash, ParentHash: common.Hash{}, - Transactions: cltest.LegacyTransactionsFromGasPrices(0, 0, 0, 0, 100), + Transactions: cltest.LegacyTransactionsFromGasPrices(0, 0, 0, 0, 80), }, } - gas.SetRollingBlockHistory(bhe, blocks) + // chainType is not set - GasEstimator should not ignore zero priced transactions and instead default to PriceMin==11 bhe.Recalculate(cltest.Head(0)) + require.Equal(t, assets.NewWeiI(11), gas.GetGasPrice(bhe)) - price := gas.GetGasPrice(bhe) - require.Equal(t, assets.NewWeiI(100), price) + // Set chainType to Gnosis - GasEstimator should now ignore zero priced transactions + cfg.ChainTypeF = string(config.ChainGnosis) + bhe.Recalculate(cltest.Head(0)) + require.Equal(t, assets.NewWeiI(80), gas.GetGasPrice(bhe)) + + // Same for xDai (deprecated) + cfg.ChainTypeF = string(config.ChainXDai) + bhe.Recalculate(cltest.Head(0)) + require.Equal(t, assets.NewWeiI(80), gas.GetGasPrice(bhe)) }) t.Run("handles unreasonably large gas prices (larger than a 64 bit int can hold)", func(t *testing.T) { diff --git a/core/chains/evm/gas/chain_specific.go b/core/chains/evm/gas/chain_specific.go index c989cd0aa98..c64441cc142 100644 --- a/core/chains/evm/gas/chain_specific.go +++ b/core/chains/evm/gas/chain_specific.go @@ -9,9 +9,9 @@ import ( // chainSpecificIsUsable allows for additional logic specific to a particular // Config that determines whether a transaction should be used for gas estimation func chainSpecificIsUsable(tx evmtypes.Transaction, baseFee *assets.Wei, chainType config.ChainType, minGasPriceWei *assets.Wei) bool { - if chainType == config.ChainXDai { + if chainType == config.ChainGnosis || chainType == config.ChainXDai { // GasPrice 0 on most chains is great since it indicates cheap/free transactions. - // However, xDai reserves a special type of "bridge" transaction with 0 gas + // However, Gnosis reserves a special type of "bridge" transaction with 0 gas // price that is always processed at top priority. Ordinary transactions // must be priced at least 1GWei, so we have to discard anything priced // below that (unless the contract is whitelisted). diff --git a/core/config/docs/chains-evm.toml b/core/config/docs/chains-evm.toml index 5359fe4b22b..7ddd24276c6 100644 --- a/core/config/docs/chains-evm.toml +++ b/core/config/docs/chains-evm.toml @@ -14,14 +14,16 @@ BlockBackfillDepth = 10 # Default # BlockBackfillSkip enables skipping of very long backfills. BlockBackfillSkip = false # Default # ChainType is automatically detected from chain ID. Set this to force a certain chain type regardless of chain ID. -# Available types: arbitrum, metis, optimismBedrock, xdai, celo, kroma, wemix, zksync, scroll +# Available types: `arbitrum`, `celo`, `gnosis`, `kroma`, `metis`, `optimismBedrock`, `scroll`, `wemix`, `zksync` +# +# `xdai` has been deprecated and will be removed in v2.13.0, use `gnosis` instead. ChainType = 'arbitrum' # Example -# FinalityDepth is the number of blocks after which an ethereum transaction is considered "final". Note that the default is automatically set based on chain ID so it should not be necessary to change this under normal operation. +# FinalityDepth is the number of blocks after which an ethereum transaction is considered "final". Note that the default is automatically set based on chain ID, so it should not be necessary to change this under normal operation. # BlocksConsideredFinal determines how deeply we look back to ensure that transactions are confirmed onto the longest chain # There is not a large performance penalty to setting this relatively high (on the order of hundreds) # It is practically limited by the number of heads we store in the database and should be less than this with a comfortable margin. # If a transaction is mined in a block more than this many blocks ago, and is reorged out, we will NOT retransmit this transaction and undefined behaviour can occur including gaps in the nonce sequence that require manual intervention to fix. -# Therefore this number represents a number of blocks we consider large enough that no re-org this deep will ever feasibly happen. +# Therefore, this number represents a number of blocks we consider large enough that no re-org this deep will ever feasibly happen. # # Special cases: # `FinalityDepth`=0 would imply that transactions can be final even before they were mined into a block. This is not supported. @@ -229,7 +231,7 @@ FeeCapDefault = '100 gwei' # Default TipCapDefault = '1 wei' # Default # TipCapMinimum is the minimum gas tip to use when submitting transactions to the blockchain. # -# Only applies to EIP-1559 transactions) +# (Only applies to EIP-1559 transactions) TipCapMin = '1 wei' # Default [EVM.GasEstimator.LimitJobType] @@ -267,7 +269,7 @@ CheckInclusionPercentile = 90 # Default # **ADVANCED** # EIP1559FeeCapBufferBlocks controls the buffer blocks to add to the current base fee when sending a transaction. By default, the gas bumping threshold + 1 block is used. # -# Only applies to EIP-1559 transactions) +# (Only applies to EIP-1559 transactions) EIP1559FeeCapBufferBlocks = 13 # Example # TransactionPercentile specifies gas price to choose. E.g. if the block history contains four transactions with gas prices `[100, 200, 300, 400]` then picking 25 for this number will give a value of 200. If the calculated gas price is higher than `GasPriceDefault` then the higher price will be used as the base price for new transactions. # diff --git a/core/services/chainlink/config.go b/core/services/chainlink/config.go index 6cd2732ece8..b77a54f39a8 100644 --- a/core/services/chainlink/config.go +++ b/core/services/chainlink/config.go @@ -12,6 +12,7 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/solana" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + commoncfg "github.com/smartcontractkit/chainlink/v2/common/config" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/config/docs" "github.com/smartcontractkit/chainlink/v2/core/config/env" @@ -76,7 +77,16 @@ func (c *Config) valueWarnings() (err error) { // deprecationWarnings returns an error if the Config contains deprecated fields. // This is typically used before defaults have been applied, with input from the user. func (c *Config) deprecationWarnings() (err error) { - // none + // ChainType xdai is deprecated and has been renamed to gnosis + for _, evm := range c.EVM { + if evm.ChainType != nil && *evm.ChainType == string(commoncfg.ChainXDai) { + err = multierr.Append(err, config.ErrInvalid{ + Name: "EVM.ChainType", + Value: *evm.ChainType, + Msg: "deprecated and will be removed in v2.13.0, use 'gnosis' instead", + }) + } + } return } diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 4d6ab0993e3..4422a743689 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -20,12 +20,12 @@ import ( commonassets "github.com/smartcontractkit/chainlink-common/pkg/assets" "github.com/smartcontractkit/chainlink-common/pkg/config" commoncfg "github.com/smartcontractkit/chainlink-common/pkg/config" - commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink-common/pkg/utils/hex" coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config" "github.com/smartcontractkit/chainlink-solana/pkg/solana" solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" @@ -67,7 +67,7 @@ var ( }, Database: toml.Database{ Listener: toml.DatabaseListener{ - FallbackPollInterval: commonconfig.MustNewDuration(2 * time.Minute), + FallbackPollInterval: commoncfg.MustNewDuration(2 * time.Minute), }, }, Log: toml.Log{ @@ -76,16 +76,16 @@ var ( }, JobPipeline: toml.JobPipeline{ HTTPRequest: toml.JobPipelineHTTPRequest{ - DefaultTimeout: commonconfig.MustNewDuration(30 * time.Second), + DefaultTimeout: commoncfg.MustNewDuration(30 * time.Second), }, }, OCR2: toml.OCR2{ Enabled: ptr(true), - DatabaseTimeout: commonconfig.MustNewDuration(20 * time.Second), + DatabaseTimeout: commoncfg.MustNewDuration(20 * time.Second), }, OCR: toml.OCR{ Enabled: ptr(true), - BlockchainTimeout: commonconfig.MustNewDuration(5 * time.Second), + BlockchainTimeout: commoncfg.MustNewDuration(5 * time.Second), }, P2P: toml.P2P{ IncomingMessageBufferSize: ptr[int64](999), @@ -195,10 +195,10 @@ var ( ) func TestConfig_Marshal(t *testing.T) { - zeroSeconds := *commonconfig.MustNewDuration(time.Second * 0) - second := *commonconfig.MustNewDuration(time.Second) - minute := *commonconfig.MustNewDuration(time.Minute) - hour := *commonconfig.MustNewDuration(time.Hour) + zeroSeconds := *commoncfg.MustNewDuration(time.Second * 0) + second := *commoncfg.MustNewDuration(time.Second) + minute := *commoncfg.MustNewDuration(time.Minute) + hour := *commoncfg.MustNewDuration(time.Hour) mustPeerID := func(s string) *p2pkey.PeerID { id, err := p2pkey.MakePeerID(s) require.NoError(t, err) @@ -220,7 +220,7 @@ func TestConfig_Marshal(t *testing.T) { Core: toml.Core{ InsecureFastScrypt: ptr(true), RootDir: ptr("test/root/dir"), - ShutdownGracePeriod: commonconfig.MustNewDuration(10 * time.Second), + ShutdownGracePeriod: commoncfg.MustNewDuration(10 * time.Second), Insecure: toml.Insecure{ DevWebServer: ptr(false), OCRDevelopmentMode: ptr(false), @@ -261,17 +261,17 @@ func TestConfig_Marshal(t *testing.T) { UICSAKeys: ptr(true), } full.Database = toml.Database{ - DefaultIdleInTxSessionTimeout: commonconfig.MustNewDuration(time.Minute), - DefaultLockTimeout: commonconfig.MustNewDuration(time.Hour), - DefaultQueryTimeout: commonconfig.MustNewDuration(time.Second), + DefaultIdleInTxSessionTimeout: commoncfg.MustNewDuration(time.Minute), + DefaultLockTimeout: commoncfg.MustNewDuration(time.Hour), + DefaultQueryTimeout: commoncfg.MustNewDuration(time.Second), LogQueries: ptr(true), MigrateOnStartup: ptr(true), MaxIdleConns: ptr[int64](7), MaxOpenConns: ptr[int64](13), Listener: toml.DatabaseListener{ - MaxReconnectDuration: commonconfig.MustNewDuration(time.Minute), - MinReconnectInterval: commonconfig.MustNewDuration(5 * time.Minute), - FallbackPollInterval: commonconfig.MustNewDuration(2 * time.Minute), + MaxReconnectDuration: commoncfg.MustNewDuration(time.Minute), + MinReconnectInterval: commoncfg.MustNewDuration(5 * time.Minute), + FallbackPollInterval: commoncfg.MustNewDuration(2 * time.Minute), }, Lock: toml.DatabaseLock{ Enabled: ptr(false), @@ -290,8 +290,8 @@ func TestConfig_Marshal(t *testing.T) { Logging: ptr(true), BufferSize: ptr[uint16](1234), MaxBatchSize: ptr[uint16](4321), - SendInterval: commonconfig.MustNewDuration(time.Minute), - SendTimeout: commonconfig.MustNewDuration(5 * time.Second), + SendInterval: commoncfg.MustNewDuration(time.Minute), + SendTimeout: commoncfg.MustNewDuration(5 * time.Second), UseBatchSend: ptr(true), Endpoints: []toml.TelemetryIngressEndpoint{{ Network: ptr("EVM"), @@ -316,14 +316,14 @@ func TestConfig_Marshal(t *testing.T) { AuthenticationMethod: ptr("local"), AllowOrigins: ptr("*"), BridgeResponseURL: mustURL("https://bridge.response"), - BridgeCacheTTL: commonconfig.MustNewDuration(10 * time.Second), - HTTPWriteTimeout: commonconfig.MustNewDuration(time.Minute), + BridgeCacheTTL: commoncfg.MustNewDuration(10 * time.Second), + HTTPWriteTimeout: commoncfg.MustNewDuration(time.Minute), HTTPPort: ptr[uint16](56), SecureCookies: ptr(true), - SessionTimeout: commonconfig.MustNewDuration(time.Hour), - SessionReaperExpiration: commonconfig.MustNewDuration(7 * 24 * time.Hour), + SessionTimeout: commoncfg.MustNewDuration(time.Hour), + SessionReaperExpiration: commoncfg.MustNewDuration(7 * 24 * time.Hour), HTTPMaxSize: ptr(utils.FileSize(uint64(32770))), - StartTimeout: commonconfig.MustNewDuration(15 * time.Second), + StartTimeout: commoncfg.MustNewDuration(15 * time.Second), ListenIP: mustIP("192.158.1.37"), MFA: toml.WebServerMFA{ RPID: ptr("test-rpid"), @@ -331,8 +331,8 @@ func TestConfig_Marshal(t *testing.T) { }, LDAP: toml.WebServerLDAP{ ServerTLS: ptr(true), - SessionTimeout: commonconfig.MustNewDuration(15 * time.Minute), - QueryTimeout: commonconfig.MustNewDuration(2 * time.Minute), + SessionTimeout: commoncfg.MustNewDuration(15 * time.Minute), + QueryTimeout: commoncfg.MustNewDuration(2 * time.Minute), BaseUserAttr: ptr("uid"), BaseDN: ptr("dc=custom,dc=example,dc=com"), UsersDN: ptr("ou=users"), @@ -344,15 +344,15 @@ func TestConfig_Marshal(t *testing.T) { RunUserGroupCN: ptr("NodeRunners"), ReadUserGroupCN: ptr("NodeReadOnly"), UserApiTokenEnabled: ptr(false), - UserAPITokenDuration: commonconfig.MustNewDuration(240 * time.Hour), - UpstreamSyncInterval: commonconfig.MustNewDuration(0 * time.Second), - UpstreamSyncRateLimit: commonconfig.MustNewDuration(2 * time.Minute), + UserAPITokenDuration: commoncfg.MustNewDuration(240 * time.Hour), + UpstreamSyncInterval: commoncfg.MustNewDuration(0 * time.Second), + UpstreamSyncRateLimit: commoncfg.MustNewDuration(2 * time.Minute), }, RateLimit: toml.WebServerRateLimit{ Authenticated: ptr[int64](42), - AuthenticatedPeriod: commonconfig.MustNewDuration(time.Second), + AuthenticatedPeriod: commoncfg.MustNewDuration(time.Second), Unauthenticated: ptr[int64](7), - UnauthenticatedPeriod: commonconfig.MustNewDuration(time.Minute), + UnauthenticatedPeriod: commoncfg.MustNewDuration(time.Minute), }, TLS: toml.WebServerTLS{ CertPath: ptr("tls/cert/path"), @@ -365,14 +365,14 @@ func TestConfig_Marshal(t *testing.T) { } full.JobPipeline = toml.JobPipeline{ ExternalInitiatorsEnabled: ptr(true), - MaxRunDuration: commonconfig.MustNewDuration(time.Hour), + MaxRunDuration: commoncfg.MustNewDuration(time.Hour), MaxSuccessfulRuns: ptr[uint64](123456), - ReaperInterval: commonconfig.MustNewDuration(4 * time.Hour), - ReaperThreshold: commonconfig.MustNewDuration(7 * 24 * time.Hour), + ReaperInterval: commoncfg.MustNewDuration(4 * time.Hour), + ReaperThreshold: commoncfg.MustNewDuration(7 * 24 * time.Hour), ResultWriteQueueDepth: ptr[uint32](10), HTTPRequest: toml.JobPipelineHTTPRequest{ MaxSize: ptr[utils.FileSize](100 * utils.MB), - DefaultTimeout: commonconfig.MustNewDuration(time.Minute), + DefaultTimeout: commoncfg.MustNewDuration(time.Minute), }, } full.FluxMonitor = toml.FluxMonitor{ @@ -382,11 +382,11 @@ func TestConfig_Marshal(t *testing.T) { full.OCR2 = toml.OCR2{ Enabled: ptr(true), ContractConfirmations: ptr[uint32](11), - BlockchainTimeout: commonconfig.MustNewDuration(3 * time.Second), - ContractPollInterval: commonconfig.MustNewDuration(time.Hour), - ContractSubscribeInterval: commonconfig.MustNewDuration(time.Minute), - ContractTransmitterTransmitTimeout: commonconfig.MustNewDuration(time.Minute), - DatabaseTimeout: commonconfig.MustNewDuration(8 * time.Second), + BlockchainTimeout: commoncfg.MustNewDuration(3 * time.Second), + ContractPollInterval: commoncfg.MustNewDuration(time.Hour), + ContractSubscribeInterval: commoncfg.MustNewDuration(time.Minute), + ContractTransmitterTransmitTimeout: commoncfg.MustNewDuration(time.Minute), + DatabaseTimeout: commoncfg.MustNewDuration(8 * time.Second), KeyBundleID: ptr(models.MustSha256HashFromHex("7a5f66bbe6594259325bf2b4f5b1a9c9")), CaptureEATelemetry: ptr(false), CaptureAutomationCustomTelemetry: ptr(true), @@ -396,10 +396,10 @@ func TestConfig_Marshal(t *testing.T) { } full.OCR = toml.OCR{ Enabled: ptr(true), - ObservationTimeout: commonconfig.MustNewDuration(11 * time.Second), - BlockchainTimeout: commonconfig.MustNewDuration(3 * time.Second), - ContractPollInterval: commonconfig.MustNewDuration(time.Hour), - ContractSubscribeInterval: commonconfig.MustNewDuration(time.Minute), + ObservationTimeout: commoncfg.MustNewDuration(11 * time.Second), + BlockchainTimeout: commoncfg.MustNewDuration(3 * time.Second), + ContractPollInterval: commoncfg.MustNewDuration(time.Hour), + ContractSubscribeInterval: commoncfg.MustNewDuration(time.Minute), DefaultTransactionQueueDepth: ptr[uint32](12), KeyBundleID: ptr(models.MustSha256HashFromHex("acdd42797a8b921b2910497badc50006")), SimulateTransactions: ptr(true), @@ -419,8 +419,8 @@ func TestConfig_Marshal(t *testing.T) { {PeerID: "12D3KooWMoejJznyDuEk5aX6GvbjaG12UzeornPCBNzMRqdwrFJw", Addrs: []string{"foo:42", "bar:10"}}, {PeerID: "12D3KooWMoejJznyDuEk5aX6GvbjaG12UzeornPCBNzMRqdwrFJw", Addrs: []string{"test:99"}}, }, - DeltaDial: commonconfig.MustNewDuration(time.Minute), - DeltaReconcile: commonconfig.MustNewDuration(time.Second), + DeltaDial: commoncfg.MustNewDuration(time.Minute), + DeltaReconcile: commoncfg.MustNewDuration(time.Second), ListenAddresses: &[]string{"foo", "bar"}, }, } @@ -434,7 +434,7 @@ func TestConfig_Marshal(t *testing.T) { Registry: toml.KeeperRegistry{ CheckGasOverhead: ptr[uint32](90), PerformGasOverhead: ptr[uint32](math.MaxUint32), - SyncInterval: commonconfig.MustNewDuration(time.Hour), + SyncInterval: commoncfg.MustNewDuration(time.Hour), SyncUpkeepQueueSize: ptr[uint32](31), MaxPerformDataSize: ptr[uint32](5000), }, @@ -442,9 +442,9 @@ func TestConfig_Marshal(t *testing.T) { full.AutoPprof = toml.AutoPprof{ Enabled: ptr(true), ProfileRoot: ptr("prof/root"), - PollInterval: commonconfig.MustNewDuration(time.Minute), - GatherDuration: commonconfig.MustNewDuration(12 * time.Second), - GatherTraceDuration: commonconfig.MustNewDuration(13 * time.Second), + PollInterval: commoncfg.MustNewDuration(time.Minute), + GatherDuration: commoncfg.MustNewDuration(12 * time.Second), + GatherTraceDuration: commoncfg.MustNewDuration(13 * time.Second), MaxProfileSize: ptr[utils.FileSize](utils.GB), CPUProfileRate: ptr[int64](7), MemProfileRate: ptr[int64](9), @@ -566,8 +566,8 @@ func TestConfig_Marshal(t *testing.T) { ContractConfirmations: ptr[uint16](11), ContractTransmitterTransmitTimeout: &minute, DatabaseTimeout: &second, - DeltaCOverride: commonconfig.MustNewDuration(time.Hour), - DeltaCJitterOverride: commonconfig.MustNewDuration(time.Second), + DeltaCOverride: commoncfg.MustNewDuration(time.Hour), + DeltaCJitterOverride: commoncfg.MustNewDuration(time.Second), ObservationGracePeriod: &second, }, OCR2: evmcfg.OCR2{ @@ -664,9 +664,9 @@ func TestConfig_Marshal(t *testing.T) { } full.Mercury = toml.Mercury{ Cache: toml.MercuryCache{ - LatestReportTTL: commonconfig.MustNewDuration(100 * time.Second), - MaxStaleAge: commonconfig.MustNewDuration(101 * time.Second), - LatestReportDeadline: commonconfig.MustNewDuration(102 * time.Second), + LatestReportTTL: commoncfg.MustNewDuration(100 * time.Second), + MaxStaleAge: commoncfg.MustNewDuration(101 * time.Second), + LatestReportDeadline: commoncfg.MustNewDuration(102 * time.Second), }, TLS: toml.MercuryTLS{ CertFile: ptr("/path/to/cert.pem"), @@ -1140,7 +1140,7 @@ func TestConfig_full(t *testing.T) { } for n := range got.EVM[c].Nodes { if got.EVM[c].Nodes[n].WSURL == nil { - got.EVM[c].Nodes[n].WSURL = new(commonconfig.URL) + got.EVM[c].Nodes[n].WSURL = new(commoncfg.URL) } if got.EVM[c].Nodes[n].SendOnly == nil { got.EVM[c].Nodes[n].SendOnly = ptr(true) @@ -1196,7 +1196,7 @@ func TestConfig_Validate(t *testing.T) { - 1: 6 errors: - ChainType: invalid value (Foo): must not be set with this chain id - Nodes: missing: must have at least one node - - ChainType: invalid value (Foo): must be one of arbitrum, metis, xdai, optimismBedrock, celo, kroma, wemix, zksync, scroll or omitted + - ChainType: invalid value (Foo): must be one of arbitrum, celo, gnosis, kroma, metis, optimismBedrock, scroll, wemix, zksync or omitted - HeadTracker.HistoryDepth: invalid value (30): must be equal to or greater than FinalityDepth - GasEstimator: 2 errors: - FeeCapDefault: invalid value (101 wei): must be equal to PriceMax (99 wei) since you are using FixedPrice estimation with gas bumping disabled in EIP1559 mode - PriceMax will be used as the FeeCap for transactions instead of FeeCapDefault @@ -1205,7 +1205,7 @@ func TestConfig_Validate(t *testing.T) { - 2: 5 errors: - ChainType: invalid value (Arbitrum): only "optimismBedrock" can be used with this chain id - Nodes: missing: must have at least one node - - ChainType: invalid value (Arbitrum): must be one of arbitrum, metis, xdai, optimismBedrock, celo, kroma, wemix, zksync, scroll or omitted + - ChainType: invalid value (Arbitrum): must be one of arbitrum, celo, gnosis, kroma, metis, optimismBedrock, scroll, wemix, zksync or omitted - FinalityDepth: invalid value (0): must be greater than or equal to 1 - MinIncomingConfirmations: invalid value (0): must be greater than or equal to 1 - 3.Nodes: 5 errors: @@ -1262,8 +1262,8 @@ func TestConfig_Validate(t *testing.T) { } } -func mustURL(s string) *commonconfig.URL { - var u commonconfig.URL +func mustURL(s string) *commoncfg.URL { + var u commoncfg.URL if err := u.UnmarshalText([]byte(s)); err != nil { panic(err) } @@ -1554,6 +1554,13 @@ func TestConfig_warnings(t *testing.T) { }, expectedErrors: []string{"Tracing.TLSCertPath: invalid value (/path/to/cert.pem): must be empty when Tracing.Mode is 'unencrypted'"}, }, + { + name: "Value warning - ChainType=xdai is deprecated", + config: Config{ + EVM: evmcfg.EVMConfigs{{Chain: evmcfg.Chain{ChainType: ptr(string(commonconfig.ChainXDai))}}}, + }, + expectedErrors: []string{"EVM.ChainType: invalid value (xdai): deprecated and will be removed in v2.13.0, use 'gnosis' instead"}, + }, } for _, tt := range tests { diff --git a/core/services/ocr/contract_tracker.go b/core/services/ocr/contract_tracker.go index 9eabf93a834..4c3260511d5 100644 --- a/core/services/ocr/contract_tracker.go +++ b/core/services/ocr/contract_tracker.go @@ -402,7 +402,7 @@ func (t *OCRContractTracker) LatestBlockHeight(ctx context.Context) (blockheight // care about the block height; we have no way of getting the L1 block // height anyway return 0, nil - case "", config.ChainArbitrum, config.ChainCelo, config.ChainOptimismBedrock, config.ChainXDai, config.ChainKroma, config.ChainWeMix, config.ChainZkSync, config.ChainScroll: + case "", config.ChainArbitrum, config.ChainCelo, config.ChainGnosis, config.ChainKroma, config.ChainOptimismBedrock, config.ChainScroll, config.ChainWeMix, config.ChainXDai, config.ChainZkSync: // continue } latestBlockHeight := t.getLatestBlockHeight() diff --git a/core/services/ocrcommon/block_translator.go b/core/services/ocrcommon/block_translator.go index dcac83fd2bd..bc7242a6019 100644 --- a/core/services/ocrcommon/block_translator.go +++ b/core/services/ocrcommon/block_translator.go @@ -21,7 +21,7 @@ func NewBlockTranslator(cfg Config, client evmclient.Client, lggr logger.Logger) switch cfg.ChainType() { case config.ChainArbitrum: return NewArbitrumBlockTranslator(client, lggr) - case config.ChainXDai, config.ChainMetis, config.ChainOptimismBedrock: + case "", config.ChainCelo, config.ChainGnosis, config.ChainKroma, config.ChainMetis, config.ChainOptimismBedrock, config.ChainScroll, config.ChainWeMix, config.ChainXDai, config.ChainZkSync: fallthrough default: return &l1BlockTranslator{} diff --git a/docs/CONFIG.md b/docs/CONFIG.md index eee414f461f..37c130e46b2 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -2606,7 +2606,7 @@ GasLimit = 5400000 AutoCreateKey = true BlockBackfillDepth = 10 BlockBackfillSkip = false -ChainType = 'xdai' +ChainType = 'gnosis' FinalityDepth = 50 FinalityTagEnabled = false LinkContractAddress = '0xE2e73A1c69ecF83F464EFCE6A5be353a37cA09b2' @@ -4450,7 +4450,7 @@ GasLimit = 6500000 AutoCreateKey = true BlockBackfillDepth = 10 BlockBackfillSkip = false -ChainType = 'xdai' +ChainType = 'gnosis' FinalityDepth = 100 FinalityTagEnabled = false LogBackfillBatchSize = 1000 @@ -6078,18 +6078,20 @@ BlockBackfillSkip enables skipping of very long backfills. ChainType = 'arbitrum' # Example ``` ChainType is automatically detected from chain ID. Set this to force a certain chain type regardless of chain ID. -Available types: arbitrum, metis, optimismBedrock, xdai, celo, kroma, wemix, zksync, scroll +Available types: `arbitrum`, `celo`, `gnosis`, `kroma`, `metis`, `optimismBedrock`, `scroll`, `wemix`, `zksync` + +`xdai` has been deprecated and will be removed in v2.13.0, use `gnosis` instead. ### FinalityDepth ```toml FinalityDepth = 50 # Default ``` -FinalityDepth is the number of blocks after which an ethereum transaction is considered "final". Note that the default is automatically set based on chain ID so it should not be necessary to change this under normal operation. +FinalityDepth is the number of blocks after which an ethereum transaction is considered "final". Note that the default is automatically set based on chain ID, so it should not be necessary to change this under normal operation. BlocksConsideredFinal determines how deeply we look back to ensure that transactions are confirmed onto the longest chain There is not a large performance penalty to setting this relatively high (on the order of hundreds) It is practically limited by the number of heads we store in the database and should be less than this with a comfortable margin. If a transaction is mined in a block more than this many blocks ago, and is reorged out, we will NOT retransmit this transaction and undefined behaviour can occur including gaps in the nonce sequence that require manual intervention to fix. -Therefore this number represents a number of blocks we consider large enough that no re-org this deep will ever feasibly happen. +Therefore, this number represents a number of blocks we consider large enough that no re-org this deep will ever feasibly happen. Special cases: `FinalityDepth`=0 would imply that transactions can be final even before they were mined into a block. This is not supported. @@ -6484,7 +6486,7 @@ TipCapMin = '1 wei' # Default ``` TipCapMinimum is the minimum gas tip to use when submitting transactions to the blockchain. -Only applies to EIP-1559 transactions) +(Only applies to EIP-1559 transactions) ## EVM.GasEstimator.LimitJobType ```toml @@ -6584,7 +6586,7 @@ EIP1559FeeCapBufferBlocks = 13 # Example ``` EIP1559FeeCapBufferBlocks controls the buffer blocks to add to the current base fee when sending a transaction. By default, the gas bumping threshold + 1 block is used. -Only applies to EIP-1559 transactions) +(Only applies to EIP-1559 transactions) ### TransactionPercentile ```toml