Skip to content

Commit

Permalink
Merge branch 'develop' into CAPPL-403
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-cordenier committed Jan 22, 2025
2 parents 0284768 + e7033b5 commit ca9fe40
Show file tree
Hide file tree
Showing 77 changed files with 538 additions and 230 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-knives-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Bump chainlink-solana and chainlink-framework dependencies, and add NewHeadsPollInterval to MultiNode and documentation. #internal #added
5 changes: 5 additions & 0 deletions .changeset/mean-pianos-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#nops change chainType from metis to optimismBedrock
1 change: 0 additions & 1 deletion ccip/config/evm/Metis_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Metis is an L2 chain based on Optimism.
ChainID = '1088'
ChainType = 'optimismBedrock'
# Sequencer offers absolute finality
# High variation on finality depth triggered a commitee to investigate
# and set 500 as a secure finality depth.
Expand Down
1 change: 0 additions & 1 deletion ccip/config/evm/Metis_Sepolia.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ChainID = '59902'
ChainType = 'optimismBedrock'
# FT and FD are both present here because the dev effort rely only on FinalityTagEnabled are still in progress.
# We expect to be able to rely only on FinalityTagEnabled=true in the short future.
# https://chainlink-core.slack.com/archives/C05CS33N08N/p1715102940763339?thread_ts=1715102478.537529&cid=C05CS33N08N
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/client/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
pkgerrors "github.com/pkg/errors"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
client "github.com/smartcontractkit/chainlink-solana/pkg/solana/client/multinode"
client "github.com/smartcontractkit/chainlink-framework/multinode"

"github.com/smartcontractkit/chainlink-framework/multinode"
"github.com/smartcontractkit/chainlink-framework/multinode/mocks"
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/client/rpc_client_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-framework/multinode"
client "github.com/smartcontractkit/chainlink-solana/pkg/solana/client/multinode"
client "github.com/smartcontractkit/chainlink-framework/multinode"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/chaintype"
"github.com/smartcontractkit/chainlink/v2/core/logger"
)
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Metis_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Metis is an L2 chain based on Optimism.
ChainID = '1088'
ChainType = 'metis'
ChainType = 'optimismBedrock'
# Sequencer offers absolute finality
FinalityDepth = 10
FinalityTagEnabled = true
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Metis_Sepolia.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ChainID = '59902'
ChainType = 'metis'
ChainType = 'optimismBedrock'
FinalityDepth = 10
FinalityTagEnabled = true
MinIncomingConfirmations = 1
Expand Down
4 changes: 4 additions & 0 deletions core/config/capabilities_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

type CapabilitiesExternalRegistry interface {
Expand All @@ -22,6 +23,9 @@ type CapabilitiesWorkflowRegistry interface {
Address() string
NetworkID() string
ChainID() string
MaxEncryptedSecretsSize() utils.FileSize
MaxBinarySize() utils.FileSize
MaxConfigSize() utils.FileSize
RelayID() types.RelayID
}

Expand Down
2 changes: 2 additions & 0 deletions core/config/docs/chains-solana.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ SyncThreshold = 5 # Default
NodeIsSyncingEnabled = false # Default
# LeaseDuration is the max duration a node can be leased for.
LeaseDuration = '1m0s' # Default
# NewHeadsPollInterval is the rate to poll for new heads.
NewHeadsPollInterval = '10s' # Default
# FinalizedBlockPollInterval is the rate to poll for the finalized block.
FinalizedBlockPollInterval = '10s' # Default
# EnforceRepeatableRead enforces the repeatable read guarantee for multinode.
Expand Down
6 changes: 6 additions & 0 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,12 @@ Address = '0x0' # Example
NetworkID = 'evm' # Default
# ChainID identifies the target chain id where the remote registry is located.
ChainID = '1' # Default
# MaxBinarySize is the maximum size of a binary that can be fetched from the registry.
MaxBinarySize = '20.00mb' # Default
# MaxEncryptedSecretsSize is the maximum size of encrypted secrets that can be fetched from the given secrets url.
MaxEncryptedSecretsSize = '26.40kb' # Default
# MaxConfigSize is the maximum size of a config that can be fetched from the given config url.
MaxConfigSize = '50.00kb' # Default

[Capabilities.ExternalRegistry]
# Address is the address for the capabilities registry contract.
Expand Down
21 changes: 18 additions & 3 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1476,9 +1476,12 @@ func (r *ExternalRegistry) setFrom(f *ExternalRegistry) {
}

type WorkflowRegistry struct {
Address *string
NetworkID *string
ChainID *string
Address *string
NetworkID *string
ChainID *string
MaxBinarySize *utils.FileSize
MaxEncryptedSecretsSize *utils.FileSize
MaxConfigSize *utils.FileSize
}

func (r *WorkflowRegistry) setFrom(f *WorkflowRegistry) {
Expand All @@ -1493,6 +1496,18 @@ func (r *WorkflowRegistry) setFrom(f *WorkflowRegistry) {
if f.ChainID != nil {
r.ChainID = f.ChainID
}

if f.MaxBinarySize != nil {
r.MaxBinarySize = f.MaxBinarySize
}

if f.MaxEncryptedSecretsSize != nil {
r.MaxEncryptedSecretsSize = f.MaxEncryptedSecretsSize
}

if f.MaxConfigSize != nil {
r.MaxConfigSize = f.MaxConfigSize
}
}

type Dispatcher struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type InternalEVM2EVMMessage struct {
Data []byte
TokenAmounts []ClientEVMTokenAmount
SourceTokenData [][]byte
MessageId [32]byte
MessageID [32]byte
}

type ClientEVMTokenAmount struct {
Expand Down
14 changes: 7 additions & 7 deletions core/scripts/ccip/manual-execution/helpers/contractwrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,17 @@ func FilterExecutionStateChanged(
opts *bind.FilterOpts,
offRampAddr string,
sequenceNumber []uint64,
messageId [][32]byte,
messageID [][32]byte,
) (int, error) {
var sequenceNumberRule []interface{}
sequenceNumberRule := make([]interface{}, 0, len(sequenceNumber))
for _, sequenceNumberItem := range sequenceNumber {
sequenceNumberRule = append(sequenceNumberRule, sequenceNumberItem)
}
var messageIdRule []interface{}
for _, messageIdItem := range messageId {
messageIdRule = append(messageIdRule, messageIdItem)
messageIDRule := make([]interface{}, 0, len(messageID))
for _, messageIDItem := range messageID {
messageIDRule = append(messageIDRule, messageIDItem)
}
offRamp, logs, sub, err := DecodeEvents(chain, opts, offRampAddr, OffRampABI, "ExecutionStateChanged", sequenceNumberRule, messageIdRule)
offRamp, logs, sub, err := DecodeEvents(chain, opts, offRampAddr, OffRampABI, "ExecutionStateChanged", sequenceNumberRule, messageIDRule)
if err != nil {
return 0, err
}
Expand All @@ -167,7 +167,7 @@ func FilterExecutionStateChanged(
}

if executionState == -1 {
return 0, fmt.Errorf("no ExecutionStateChanged found for seq num %v and msg id %v", sequenceNumber, messageId)
return 0, fmt.Errorf("no ExecutionStateChanged found for seq num %v and msg id %v", sequenceNumber, messageID)
}
return executionState, nil
}
Expand Down
6 changes: 3 additions & 3 deletions core/scripts/ccip/manual-execution/helpers/execReport.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ func (t *LeafHasher) ParseEVM2EVMLog(log types.Log) (*SendRequestedEvent, error)
return event, err
}

func NewLeafHasher(sourceChainId uint64, destChainId uint64, onRampId common.Address, ctx Ctx[[32]byte]) *LeafHasher {
func NewLeafHasher(sourceChainID uint64, destChainId uint64, onRampId common.Address, ctx Ctx[[32]byte]) *LeafHasher {
geABI, _ := abi.JSON(strings.NewReader(OnRampABI))
return &LeafHasher{
geABI: geABI,
metaDataHash: getMetaDataHash(ctx, ctx.Hash([]byte("EVM2EVMMessageHashV2")), sourceChainId, onRampId, destChainId),
metaDataHash: getMetaDataHash(ctx, ctx.Hash([]byte("EVM2EVMMessageHashV2")), sourceChainID, onRampId, destChainId),
ctx: ctx,
}
}
Expand Down Expand Up @@ -301,7 +301,7 @@ func proveSingleLayer[H Hash](layer []H, indices []int) singleLayerProof[H] {
}
j++
}
var subProof []H
subProof := make([]H, 0, len(authIndices))
for _, i := range authIndices {
subProof = append(subProof, layer[i])
}
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/ccip/manual-execution/helpers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func WaitForSuccessfulTxReceipt(client ethereum.TransactionReader, hash common.H
return fmt.Errorf("[MINING] ERROR tx reverted %s", hash.Hex())
}
if receipt.Status == types.ReceiptStatusSuccessful {
log.Println("[MINING] tx mined %s successful", hash.Hex())
log.Printf("[MINING] tx mined %s successful\n", hash.Hex())
return nil
}
}
Expand Down
24 changes: 13 additions & 11 deletions core/scripts/ccip/manual-execution/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/hex"
"encoding/json"
"errors"
"flag"
"fmt"
"log"
Expand Down Expand Up @@ -259,7 +260,7 @@ func (args *execArgs) execute() error {
return err
}
leaves = append(leaves, hash)
if event.Message.SequenceNumber == seqNr && event.Message.MessageId == args.msgID {
if event.Message.SequenceNumber == seqNr && event.Message.MessageID == args.msgID {
log.Printf("Found proving %d %+v\n\n", curr, event.Message)
msgs = append(msgs, event.Message)

Expand All @@ -280,7 +281,7 @@ func (args *execArgs) execute() error {
return fmt.Errorf("unable to find msg with seqNr %d", seqNr)
}

expectedNumberOfLeaves := int(commitReport.Interval.Max) - int(commitReport.Interval.Min) + 1
expectedNumberOfLeaves := int(commitReport.Interval.Max - commitReport.Interval.Min + 1)
if len(leaves) != expectedNumberOfLeaves {
return fmt.Errorf("not enough leaves gather to build a commit root - want %d got %d. Please set NumberOfBlocks const to a higher value", expectedNumberOfLeaves, len(leaves))
}
Expand All @@ -290,7 +291,7 @@ func (args *execArgs) execute() error {
return err
}
if tree.Root() != commitReport.MerkleRoot {
return fmt.Errorf("root doesn't match. cannot execute")
return errors.New("root doesn't match. cannot execute")
}

proof := tree.Prove([]int{prove})
Expand Down Expand Up @@ -332,7 +333,7 @@ func (args *execArgs) execute() error {
return err
}
if changed != 2 {
return fmt.Errorf("manual execution did not result in ExecutionStateChanged as success")
return errors.New("manual execution did not result in ExecutionStateChanged as success")
}
return nil
}
Expand All @@ -350,7 +351,7 @@ func (args *execArgs) seqNumFromCCIPSendRequested(logs []*types.Log) error {
}
}
if topic0 == (common.Hash{}) {
return fmt.Errorf("no CCIPSendRequested event found in ABI")
return errors.New("no CCIPSendRequested event found in ABI")
}
var sendRequestedLogs []types.Log
for _, sendReqLog := range logs {
Expand All @@ -374,16 +375,16 @@ func (args *execArgs) seqNumFromCCIPSendRequested(logs []*types.Log) error {
}

if args.cfg.CCIPMsgID != "" &&
"0x"+hex.EncodeToString(event.Message.MessageId[:]) != args.cfg.CCIPMsgID {
"0x"+hex.EncodeToString(event.Message.MessageID[:]) != args.cfg.CCIPMsgID {
continue
}

args.seqNum = event.Message.SequenceNumber
args.msgID = event.Message.MessageId
args.msgID = event.Message.MessageID
return nil
}

return fmt.Errorf("send request not found in logs")
return errors.New("send request not found in logs")
}

func (args *execArgs) approxDestStartBlock() error {
Expand Down Expand Up @@ -412,7 +413,8 @@ func (args *execArgs) approxDestStartBlock() error {
// break if the difference in timestamp is lesser than 1 minute
if timeDiff < 60 {
break
} else if closestBlockHdr.Time > sendTxTime {
}
if closestBlockHdr.Time > sendTxTime {
maxBlockNum = blockNum - 1
} else {
minBlockNum = blockNum + 1
Expand All @@ -428,9 +430,9 @@ func (args *execArgs) approxDestStartBlock() error {
if closestBlockHdr.Time <= sendTxTime {
break
}
closestBlockNum = closestBlockNum - blockOffset
closestBlockNum -= blockOffset
if closestBlockNum <= 0 {
return fmt.Errorf("approx destination blocknumber not found")
return errors.New("approx destination blocknumber not found")
}
closestBlockHdr, err = args.destChain.HeaderByNumber(context.Background(), big.NewInt(int64(closestBlockNum)))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ require (
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e // indirect
github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250121195549-294ec6a40b92 // indirect
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250115203616-a2ea5e50b260 // indirect
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250121205514-f73e2f86c23b // indirect
github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 // indirect
github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 // indirect
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20250121160515-90cd5f22a133 // indirect
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250121222331-a7010b4b8ce5 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20250117224137-afdcdd75070d // indirect
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect
Expand Down
8 changes: 4 additions & 4 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1182,14 +1182,14 @@ github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6An
github.com/smartcontractkit/chainlink-feeds v0.1.1/go.mod h1:55EZ94HlKCfAsUiKUTNI7QlE/3d3IwTlsU3YNa/nBb4=
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250121195549-294ec6a40b92 h1:lJi0dWfgNJl4Um5KzeZZPVBi//CPDfzzeVmv4Z2OGNY=
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250121195549-294ec6a40b92/go.mod h1:tHem58EihQh63kR2LlAOKDAs9Vbghf1dJKZRGy6LG8g=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250115203616-a2ea5e50b260 h1:See2isL6KdrTJDlVKWv8qiyYqWhYUcubU2e5yKXV1oY=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250115203616-a2ea5e50b260/go.mod h1:4JqpgFy01LaqG1yM2iFTzwX3ZgcAvW9WdstBZQgPHzU=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250121205514-f73e2f86c23b h1:TO1pwFeQKDOmv3loFiLJvYhtymuTgQUw9WgtwK1rueg=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250121205514-f73e2f86c23b/go.mod h1:4JqpgFy01LaqG1yM2iFTzwX3ZgcAvW9WdstBZQgPHzU=
github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 h1:0ewLMbAz3rZrovdRUCgd028yOXX8KigB4FndAUdI2kM=
github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0/go.mod h1:/dVVLXrsp+V0AbcYGJo3XMzKg3CkELsweA/TTopCsKE=
github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 h1:ZBat8EBvE2LpSQR9U1gEbRV6PfAkiFdINmQ8nVnXIAQ=
github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20250121160515-90cd5f22a133 h1:gXlYJF+MtfS/jupkZXfLILmH+z1sRHYFT2Du8j0I95I=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20250121160515-90cd5f22a133/go.mod h1:uHVnYLMgJ1rTcNoVxhBpy38t69gXq0j+LN3TkcIVE3U=
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250121222331-a7010b4b8ce5 h1:U49UgM8oEbssmKXDVkp8OpIr4h5YDwSLdpw2XUBsIfA=
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250121222331-a7010b4b8ce5/go.mod h1:51o1f86HFbQb8aovFxjIhOgj2z7v0iLN7pnRKfvBLpQ=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20250117224137-afdcdd75070d h1:hf1Ust1ub9r3+PgRgiry3065QXCXmw6P7YImnue1NEw=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20250117224137-afdcdd75070d/go.mod h1:lgG9JT2P19KnYuBheKIis5ZeCO+AaSta+RfzvwDQS2Y=
github.com/smartcontractkit/chainlink-testing-framework/framework v0.4.2-0.20250110073248-456673e8eea2 h1:nTUoe7GZLw17nPLV5t3Vgf4U4pf+VW0Uko5xpNiKdKU=
Expand Down
21 changes: 18 additions & 3 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,24 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
lggr := globalLogger.Named("WorkflowRegistrySyncer")
fetcher := syncer.NewFetcherService(lggr, gatewayConnectorWrapper)

eventHandler := syncer.NewEventHandler(lggr, syncer.NewWorkflowRegistryDS(opts.DS, globalLogger),
fetcher.Fetch, workflowstore.NewDBStore(opts.DS, lggr, clockwork.NewRealClock()), opts.CapabilitiesRegistry,
custmsg.NewLabeler(), clockwork.NewRealClock(), keys[0], workflowRateLimiter)
eventHandler := syncer.NewEventHandler(
lggr,
syncer.NewWorkflowRegistryDS(opts.DS, globalLogger),
fetcher.Fetch,
workflowstore.NewDBStore(opts.DS, lggr, clockwork.NewRealClock()),
opts.CapabilitiesRegistry,
custmsg.NewLabeler(),
clockwork.NewRealClock(),
keys[0],
workflowRateLimiter,
syncer.WithMaxArtifactSize(
syncer.ArtifactConfig{
MaxBinarySize: uint64(cfg.Capabilities().WorkflowRegistry().MaxBinarySize()),
MaxSecretsSize: uint64(cfg.Capabilities().WorkflowRegistry().MaxEncryptedSecretsSize()),
MaxConfigSize: uint64(cfg.Capabilities().WorkflowRegistry().MaxConfigSize()),
},
),
)

globalLogger.Debugw("Creating WorkflowRegistrySyncer")
wfSyncer := syncer.NewWorkflowRegistry(
Expand Down
13 changes: 13 additions & 0 deletions core/services/chainlink/config_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink/v2/core/config"
"github.com/smartcontractkit/chainlink/v2/core/config/toml"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

var _ config.Capabilities = (*capabilitiesConfig)(nil)
Expand Down Expand Up @@ -140,6 +141,18 @@ func (c *capabilitiesWorkflowRegistry) Address() string {
return *c.c.Address
}

func (c *capabilitiesWorkflowRegistry) MaxEncryptedSecretsSize() utils.FileSize {
return *c.c.MaxEncryptedSecretsSize
}

func (c *capabilitiesWorkflowRegistry) MaxBinarySize() utils.FileSize {
return *c.c.MaxBinarySize
}

func (c *capabilitiesWorkflowRegistry) MaxConfigSize() utils.FileSize {
return *c.c.MaxConfigSize
}

type gatewayConnector struct {
c toml.GatewayConnector
}
Expand Down
Loading

0 comments on commit ca9fe40

Please sign in to comment.