From f9c386940a07527b7d16d4b228d670e4e280d326 Mon Sep 17 00:00:00 2001
From: Jaden Foldesi
Date: Thu, 23 Jan 2025 13:44:24 -0500
Subject: [PATCH] Add Monad Testnet Config and Error Mapping (#15993)
* add monad testnet
* add remaining config
* nit
* bump down no new heads
* remove redundant
* update finality setting from product
* fix error classification
---
.changeset/three-meals-promise.md | 5 +
core/chains/evm/client/errors.go | 6 +-
core/chains/evm/client/errors_test.go | 2 +
.../config/toml/defaults/Monad_Testnet.toml | 24 ++++
docs/CONFIG.md | 107 ++++++++++++++++++
5 files changed, 143 insertions(+), 1 deletion(-)
create mode 100644 .changeset/three-meals-promise.md
create mode 100644 core/chains/evm/config/toml/defaults/Monad_Testnet.toml
diff --git a/.changeset/three-meals-promise.md b/.changeset/three-meals-promise.md
new file mode 100644
index 00000000000..e59999c4407
--- /dev/null
+++ b/.changeset/three-meals-promise.md
@@ -0,0 +1,5 @@
+---
+"chainlink": patch
+---
+
+#added Monad Testnet Config
diff --git a/core/chains/evm/client/errors.go b/core/chains/evm/client/errors.go
index 4359b8a081b..8816244ef66 100644
--- a/core/chains/evm/client/errors.go
+++ b/core/chains/evm/client/errors.go
@@ -296,6 +296,10 @@ var sei = ClientErrors{
Fatal: regexp.MustCompile(`(: |^)'*out of gas|insufficient fee|Tx too large. Max size is \d+, but got \d+|: insufficient funds`),
}
+var monad = ClientErrors{
+ Fatal: regexp.MustCompile("Gas limit too low"),
+}
+
const TerminallyStuckMsg = "transaction terminally stuck"
// Tx.Error messages that are set internally so they are not chain or client specific
@@ -303,7 +307,7 @@ var internal = ClientErrors{
TerminallyStuck: regexp.MustCompile(TerminallyStuckMsg),
}
-var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, treasure, mantle, aStar, hedera, gnosis, sei, internal}
+var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, treasure, mantle, aStar, hedera, gnosis, sei, monad, internal}
// ClientErrorRegexes returns a map of compiled regexes for each error type
func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors {
diff --git a/core/chains/evm/client/errors_test.go b/core/chains/evm/client/errors_test.go
index 2a28fe3c2c8..65cca33b96e 100644
--- a/core/chains/evm/client/errors_test.go
+++ b/core/chains/evm/client/errors_test.go
@@ -452,6 +452,8 @@ func Test_Eth_Errors_Fatal(t *testing.T) {
{"Tx too large. Max size is 2048576, but got 2097431", true, "Sei"},
{": insufficient funds", true, "Sei"},
{"insufficient fee", true, "Sei"},
+
+ {"Gas limit too low", true, "monad"},
}
for _, test := range tests {
diff --git a/core/chains/evm/config/toml/defaults/Monad_Testnet.toml b/core/chains/evm/config/toml/defaults/Monad_Testnet.toml
new file mode 100644
index 00000000000..b6382f406b7
--- /dev/null
+++ b/core/chains/evm/config/toml/defaults/Monad_Testnet.toml
@@ -0,0 +1,24 @@
+ChainID = '10143'
+# finality_depth was: 0
+FinalityDepth = 120
+# block_time was: 1s, adding 1 second buffer
+LogPollInterval = '2s'
+# No WS Support
+LogBroadcasterEnabled = false
+FinalityTagEnabled = false
+# finality_depth * block_time / 60 secs = < 1 min (finality time)
+NoNewFinalizedHeadsThreshold = '1m'
+NoNewHeadsThreshold = '1m'
+
+[GasEstimator]
+EIP1559DynamicFees = false
+Mode = 'FeeHistory'
+
+[GasEstimator.FeeHistory]
+CacheTimeout = '2s'
+
+[GasEstimator.BlockHistory]
+BlockHistorySize = 100
+
+[NodePool]
+NewHeadsPollInterval = '4s'
diff --git a/docs/CONFIG.md b/docs/CONFIG.md
index 71a68889385..f5e329565c4 100644
--- a/docs/CONFIG.md
+++ b/docs/CONFIG.md
@@ -8526,6 +8526,113 @@ GasLimitDefault = 400000
+Monad Testnet (10143)
+
+```toml
+AutoCreateKey = true
+BlockBackfillDepth = 10
+BlockBackfillSkip = false
+FinalityDepth = 120
+FinalityTagEnabled = false
+LogBackfillBatchSize = 1000
+LogPollInterval = '2s'
+LogKeepBlocksDepth = 100000
+LogPrunePageSize = 0
+BackupLogPollerBlockDelay = 100
+MinIncomingConfirmations = 3
+MinContractPayment = '0.00001 link'
+NonceAutoSync = true
+NoNewHeadsThreshold = '1m0s'
+LogBroadcasterEnabled = false
+RPCDefaultBatchSize = 250
+RPCBlockQueryDelay = 1
+FinalizedBlockOffset = 0
+NoNewFinalizedHeadsThreshold = '1m0s'
+
+[Transactions]
+Enabled = true
+ForwardersEnabled = false
+MaxInFlight = 16
+MaxQueued = 250
+ReaperInterval = '1h0m0s'
+ReaperThreshold = '168h0m0s'
+ResendAfterThreshold = '1m0s'
+
+[Transactions.AutoPurge]
+Enabled = false
+
+[Transactions.TransactionManagerV2]
+Enabled = false
+
+[BalanceMonitor]
+Enabled = true
+
+[GasEstimator]
+Mode = 'FeeHistory'
+PriceDefault = '20 gwei'
+PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether'
+PriceMin = '1 gwei'
+LimitDefault = 500000
+LimitMax = 500000
+LimitMultiplier = '1'
+LimitTransfer = 21000
+EstimateLimit = false
+BumpMin = '5 gwei'
+BumpPercent = 20
+BumpThreshold = 3
+EIP1559DynamicFees = false
+FeeCapDefault = '100 gwei'
+TipCapDefault = '1 wei'
+TipCapMin = '1 wei'
+
+[GasEstimator.BlockHistory]
+BatchSize = 25
+BlockHistorySize = 100
+CheckInclusionBlocks = 12
+CheckInclusionPercentile = 90
+TransactionPercentile = 60
+
+[GasEstimator.FeeHistory]
+CacheTimeout = '2s'
+
+[HeadTracker]
+HistoryDepth = 100
+MaxBufferSize = 3
+SamplingInterval = '1s'
+MaxAllowedFinalityDepth = 10000
+FinalityTagBypass = true
+PersistenceEnabled = true
+
+[NodePool]
+PollFailureThreshold = 5
+PollInterval = '10s'
+SelectionMode = 'HighestHead'
+SyncThreshold = 5
+LeaseDuration = '0s'
+NodeIsSyncingEnabled = false
+FinalizedBlockPollInterval = '5s'
+EnforceRepeatableRead = true
+DeathDeclarationDelay = '1m0s'
+NewHeadsPollInterval = '4s'
+
+[OCR]
+ContractConfirmations = 4
+ContractTransmitterTransmitTimeout = '10s'
+DatabaseTimeout = '10s'
+DeltaCOverride = '168h0m0s'
+DeltaCJitterOverride = '1h0m0s'
+ObservationGracePeriod = '1s'
+
+[OCR2]
+[OCR2.Automation]
+GasLimit = 5400000
+
+[Workflow]
+GasLimitDefault = 400000
+```
+
+
+
Gnosis Chiado (10200)
```toml