Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 00a640d

Browse files
authored
Merge branch 'release/2.17.0-ccip1.5' into sish/cp-hashkey
2 parents 2458bbd + 386f02c commit 00a640d

34 files changed

+684
-76
lines changed

.changeset/clever-knives-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
#added Sei config and error mapping

.changeset/eighty-geckos-switch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
Reduce PriceMin on Avalanche to 1 gwei #nops

ccip/config/evm/Avalanche_Fuji.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ RPCBlockQueryDelay = 2
1010
NoNewFinalizedHeadsThreshold = '1m'
1111

1212
[GasEstimator]
13-
PriceDefault = '25 gwei'
14-
PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether'
15-
PriceMin = '25 gwei'
13+
PriceMin = '1 gwei'
14+
PriceDefault = '1 gwei'
1615

1716
[GasEstimator.BlockHistory]
1817
BlockHistorySize = 24

ccip/config/evm/Avalanche_Mainnet.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ RPCBlockQueryDelay = 2
1010
NoNewFinalizedHeadsThreshold = '1m'
1111

1212
[GasEstimator]
13-
PriceDefault = '25 gwei'
14-
PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether'
15-
PriceMin = '25 gwei'
13+
PriceMin = '1 gwei'
14+
PriceDefault = '1 gwei'
1615

1716
[GasEstimator.BlockHistory]
1817
# Average block time of 2s
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ChainID = '1328'
2+
ChainType = 'sei'
3+
# finality_depth: instant
4+
FinalityDepth = 10
5+
# block_time: ~0.4s, adding 1 second buffer
6+
LogPollInterval = '2s'
7+
# finality_depth * block_time / 60 secs = ~0.8 min (finality time)
8+
NoNewFinalizedHeadsThreshold = '5m'
9+
# "RPC node returned multiple missing blocks on query for block numbers [31592085 31592084] even though the WS subscription already sent us these blocks. It might help to increase EVM.RPCBlockQueryDelay (currently 1)"
10+
RPCBlockQueryDelay = 5
11+
12+
[GasEstimator]
13+
EIP1559DynamicFees = false
14+
Mode = 'BlockHistory'
15+
PriceMax = '3000 gwei' # recommended by ds&a
16+
17+
[GasEstimator.BlockHistory]
18+
BlockHistorySize = 200

core/build/platform_arch_guard.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//go:build !amd64 && !arm64
2+
package build
3+
"non-64-bits architectures are not supported"

core/chains/evm/client/errors.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,24 @@ var gnosis = ClientErrors{
284284
TransactionAlreadyInMempool: regexp.MustCompile(`(: |^)(alreadyknown)`),
285285
}
286286

287+
var sei = ClientErrors{
288+
// https://github.com/sei-protocol/sei-tendermint/blob/e9a22c961e83579d8a68cd045c532980d82fb2a0/types/mempool.go#L12
289+
TransactionAlreadyInMempool: regexp.MustCompile("tx already exists in cache"),
290+
// https://github.com/sei-protocol/sei-cosmos/blob/a4eb451c957b1ca7ca9118406682f93fe83d1f61/types/errors/errors.go#L50
291+
// https://github.com/sei-protocol/sei-cosmos/blob/a4eb451c957b1ca7ca9118406682f93fe83d1f61/types/errors/errors.go#L56
292+
// https://github.com/sei-protocol/sei-cosmos/blob/a4eb451c957b1ca7ca9118406682f93fe83d1f61/client/broadcast.go#L27
293+
// https://github.com/sei-protocol/sei-cosmos/blob/a4eb451c957b1ca7ca9118406682f93fe83d1f61/types/errors/errors.go#L32
294+
Fatal: regexp.MustCompile(`(: |^)'*out of gas|insufficient fee|Tx too large. Max size is \d+, but got \d+|: insufficient funds`),
295+
}
296+
287297
const TerminallyStuckMsg = "transaction terminally stuck"
288298

289299
// Tx.Error messages that are set internally so they are not chain or client specific
290300
var internal = ClientErrors{
291301
TerminallyStuck: regexp.MustCompile(TerminallyStuckMsg),
292302
}
293303

294-
var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, treasure, mantle, aStar, hedera, gnosis, internal}
304+
var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, treasure, mantle, aStar, hedera, gnosis, sei, internal}
295305

296306
// ClientErrorRegexes returns a map of compiled regexes for each error type
297307
func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors {

core/chains/evm/client/errors_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ func Test_Eth_Errors(t *testing.T) {
144144
{"client error transaction already in mempool", true, "tomlConfig"},
145145
{"alreadyknown", true, "Gnosis"},
146146
{"failed to forward tx to sequencer, please try again. Error message: 'already known'", true, "Mantle"},
147+
{"tx already exists in cache", true, "Sei"},
147148
}
148149
for _, test := range tests {
149150
err = evmclient.NewSendErrorS(test.message)
@@ -420,6 +421,11 @@ func Test_Eth_Errors_Fatal(t *testing.T) {
420421
{"client error fatal", true, "tomlConfig"},
421422
{"[Request ID: d9711488-4c1e-4af2-bc1f-7969913d7b60] Error invoking RPC: transaction [email protected] failed precheck with status INVALID_SIGNATURE", true, "hedera"},
422423
{"invalid chain id for signer", true, "Treasure"},
424+
425+
{": out of gas", true, "Sei"},
426+
{"Tx too large. Max size is 2048576, but got 2097431", true, "Sei"},
427+
{": insufficient funds", true, "Sei"},
428+
{"insufficient fee", true, "Sei"},
423429
}
424430

425431
for _, test := range tests {

core/chains/evm/client/helpers_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"math/big"
66
"net/url"
7+
"sync"
78
"testing"
89
"time"
910

@@ -219,6 +220,7 @@ const HeadResult = `{"difficulty":"0xf3a00","extraData":"0xd88301050384676574688
219220
type mockSubscription struct {
220221
unsubscribed bool
221222
Errors chan error
223+
unsub sync.Once
222224
}
223225

224226
func NewMockSubscription() *mockSubscription {
@@ -228,8 +230,10 @@ func NewMockSubscription() *mockSubscription {
228230
func (mes *mockSubscription) Err() <-chan error { return mes.Errors }
229231

230232
func (mes *mockSubscription) Unsubscribe() {
231-
mes.unsubscribed = true
232-
close(mes.Errors)
233+
mes.unsub.Do(func() {
234+
mes.unsubscribed = true
235+
close(mes.Errors)
236+
})
233237
}
234238

235239
func ParseTestNodeConfigs(nodes []NodeConfig) ([]*toml.Node, error) {

core/chains/evm/client/rpc_client.go

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"errors"
77
"fmt"
8+
"math"
89
"math/big"
910
"net/url"
1011
"strconv"
@@ -152,6 +153,7 @@ type rpcClient struct {
152153
latestChainInfo commonclient.ChainInfo
153154
}
154155

156+
// NewRPCCLient returns a new *rpcClient as commonclient.RPC
155157
// NewRPCCLient returns a new *rpcClient as commonclient.RPC
156158
func NewRPCClient(
157159
lggr logger.Logger,
@@ -167,6 +169,22 @@ func NewRPCClient(
167169
rpcTimeout time.Duration,
168170
chainType chaintype.ChainType,
169171
) RPCClient {
172+
return newRPCClient(lggr, wsuri, httpuri, name, id, chainID, tier, finalizedBlockPollInterval, newHeadsPollInterval, largePayloadRpcTimeout, rpcTimeout, chainType)
173+
}
174+
func newRPCClient(
175+
lggr logger.Logger,
176+
wsuri *url.URL,
177+
httpuri *url.URL,
178+
name string,
179+
id int,
180+
chainID *big.Int,
181+
tier commonclient.NodeTier,
182+
finalizedBlockPollInterval time.Duration,
183+
newHeadsPollInterval time.Duration,
184+
largePayloadRpcTimeout time.Duration,
185+
rpcTimeout time.Duration,
186+
chainType chaintype.ChainType,
187+
) *rpcClient {
170188
r := &rpcClient{
171189
largePayloadRpcTimeout: largePayloadRpcTimeout,
172190
rpcTimeout: rpcTimeout,
@@ -436,6 +454,10 @@ func (r *rpcClient) BatchCallContext(rootCtx context.Context, b []rpc.BatchElem)
436454
var requestedFinalizedBlock bool
437455
if r.chainType == chaintype.ChainAstar {
438456
for _, el := range b {
457+
if el.Method == "eth_getLogs" {
458+
r.rpcLog.Critical("evmclient.BatchCallContext: eth_getLogs is not supported")
459+
return errors.New("evmclient.BatchCallContext: eth_getLogs is not supported")
460+
}
439461
if !isRequestingFinalizedBlock(el) {
440462
continue
441463
}
@@ -555,10 +577,10 @@ func (r *rpcClient) SubscribeNewHead(ctx context.Context, channel chan<- *evmtyp
555577
r.logResult(lggr, err, duration, r.getRPCDomain(), "EthSubscribe")
556578
err = r.wrapWS(err)
557579
}()
558-
subForwarder := newSubForwarder(channel, func(head *evmtypes.Head) *evmtypes.Head {
580+
subForwarder := newSubForwarder(channel, func(head *evmtypes.Head) (*evmtypes.Head, error) {
559581
head.EVMChainID = ubig.New(r.chainID)
560582
r.onNewHead(ctx, chStopInFlight, head)
561-
return head
583+
return head, nil
562584
}, r.wrapRPCClientError)
563585
err = subForwarder.start(ws.rpc.EthSubscribe(ctx, subForwarder.srcCh, args...))
564586
if err != nil {
@@ -610,10 +632,10 @@ func (r *rpcClient) SubscribeToHeads(ctx context.Context) (ch <-chan *evmtypes.H
610632
}()
611633

612634
channel := make(chan *evmtypes.Head)
613-
forwarder := newSubForwarder(channel, func(head *evmtypes.Head) *evmtypes.Head {
635+
forwarder := newSubForwarder(channel, func(head *evmtypes.Head) (*evmtypes.Head, error) {
614636
head.EVMChainID = ubig.New(r.chainID)
615637
r.onNewHead(ctx, chStopInFlight, head)
616-
return head
638+
return head, nil
617639
}, r.wrapRPCClientError)
618640

619641
err = forwarder.start(ws.rpc.EthSubscribe(ctx, forwarder.srcCh, args...))
@@ -1291,8 +1313,11 @@ func (r *rpcClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (l [
12911313
l, err = ws.geth.FilterLogs(ctx, q)
12921314
err = r.wrapWS(err)
12931315
}
1294-
duration := time.Since(start)
12951316

1317+
if err == nil {
1318+
err = r.makeLogsValid(l)
1319+
}
1320+
duration := time.Since(start)
12961321
r.logResult(lggr, err, duration, r.getRPCDomain(), "FilterLogs",
12971322
"log", l,
12981323
)
@@ -1320,7 +1345,7 @@ func (r *rpcClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQu
13201345
r.logResult(lggr, err, duration, r.getRPCDomain(), "SubscribeFilterLogs")
13211346
err = r.wrapWS(err)
13221347
}()
1323-
sub := newSubForwarder(ch, nil, r.wrapRPCClientError)
1348+
sub := newSubForwarder(ch, r.makeLogValid, r.wrapRPCClientError)
13241349
err = sub.start(ws.geth.SubscribeFilterLogs(ctx, q, sub.srcCh))
13251350
if err != nil {
13261351
return
@@ -1548,3 +1573,38 @@ func ToBlockNumArg(number *big.Int) string {
15481573
}
15491574
return hexutil.EncodeBig(number)
15501575
}
1576+
1577+
func (r *rpcClient) makeLogsValid(logs []types.Log) error {
1578+
if r.chainType != chaintype.ChainSei {
1579+
return nil
1580+
}
1581+
1582+
for i := range logs {
1583+
var err error
1584+
logs[i], err = r.makeLogValid(logs[i])
1585+
if err != nil {
1586+
return err
1587+
}
1588+
}
1589+
1590+
return nil
1591+
}
1592+
1593+
func (r *rpcClient) makeLogValid(log types.Log) (types.Log, error) {
1594+
if r.chainType != chaintype.ChainSei {
1595+
return log, nil
1596+
}
1597+
1598+
if log.TxIndex > math.MaxUint32 {
1599+
return types.Log{}, fmt.Errorf("TxIndex of tx %s exceeds max supported value of %d", log.TxHash, math.MaxUint32)
1600+
}
1601+
1602+
if log.Index > math.MaxUint32 {
1603+
return types.Log{}, fmt.Errorf("log's index %d of tx %s exceeds max supported value of %d", log.Index, log.TxHash, math.MaxUint32)
1604+
}
1605+
1606+
// it's safe as we have a build guard to guarantee 64-bit system
1607+
newIndex := uint64(log.TxIndex<<32) | uint64(log.Index)
1608+
log.Index = uint(newIndex)
1609+
return log, nil
1610+
}

0 commit comments

Comments
 (0)