Skip to content

Commit

Permalink
Merge branch 'develop' into BCI-4097-Update-the-TXM-confirmation-logi…
Browse files Browse the repository at this point in the history
…c-to-use-the-mined-nonce
  • Loading branch information
amit-momin committed Oct 4, 2024
2 parents 65781d8 + e82fb0c commit e1f31f3
Show file tree
Hide file tree
Showing 62 changed files with 1,455 additions and 146 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-bulldogs-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#added Use ApplyDefaultsAndValidate
5 changes: 5 additions & 0 deletions .changeset/moody-trains-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#added graceful shutdown for ccip oracles
5 changes: 5 additions & 0 deletions .changeset/orange-humans-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Support Zircuit fraud transactions detection and zk overflow detection #added
5 changes: 5 additions & 0 deletions .changeset/smooth-queens-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Add compute capability #internal
5 changes: 5 additions & 0 deletions .changeset/three-otters-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Hedera chain type: broadcast transactions only to a single healthy RPC instead of all healthy RPCs to avoid redundant relay fees. #changed
24 changes: 24 additions & 0 deletions .github/workflows/llm-action-error-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: LLM Action Error Reporter
on:
workflow_run:
workflows: ["CI Core"] # This workflow will be triggered as soon as one of worfklows is completed
types:
- completed

jobs:
analyze_logs:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
repository-projects: read
actions: read
steps:
- name: Analyze logs
uses: smartcontractkit/.github/actions/llm-action-error-reporter@5efdd03d4a3311e7a0954e5b3061dbb57596ca10 # v0.2.0
with:
parent-workflow-conclusion: ${{ github.event.workflow_run.conclusion }}
edit-comment: true
gh-token: ${{ secrets.GITHUB_TOKEN }}
openai-model: 'gpt-4-turbo-2024-04-09'
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ override*.toml
ocr_soak_report.csv

vendor/*

*.wasm
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ linters-settings:
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).AssumptionViolationf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Tracef
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Criticalf
errorlint:
# Allow formatting of errors without %w
errorf: false
revive:
confidence: 0.8
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto"

"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"

"github.com/stretchr/testify/assert"
Expand All @@ -19,7 +20,6 @@ import (

sel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/chainlink-ccip/execute/exectypes"
"github.com/smartcontractkit/chainlink-ccip/pkg/contractreader"
"github.com/smartcontractkit/chainlink-ccip/pkg/reader"
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"
Expand Down Expand Up @@ -74,97 +74,97 @@ func Test_USDCReader_MessageHashes(t *testing.T) {

tt := []struct {
name string
tokens map[exectypes.MessageTokenID]cciptypes.RampTokenAmount
tokens map[reader.MessageTokenID]cciptypes.RampTokenAmount
sourceChain cciptypes.ChainSelector
destChain cciptypes.ChainSelector
expectedMsgIDs []exectypes.MessageTokenID
expectedMsgIDs []reader.MessageTokenID
}{
{
name: "empty messages should return empty response",
tokens: map[exectypes.MessageTokenID]cciptypes.RampTokenAmount{},
tokens: map[reader.MessageTokenID]cciptypes.RampTokenAmount{},
sourceChain: ethereumChain,
destChain: avalancheChain,
expectedMsgIDs: []exectypes.MessageTokenID{},
expectedMsgIDs: []reader.MessageTokenID{},
},
{
name: "single token message",
tokens: map[exectypes.MessageTokenID]cciptypes.RampTokenAmount{
exectypes.NewMessageTokenID(1, 1): {
tokens: map[reader.MessageTokenID]cciptypes.RampTokenAmount{
reader.NewMessageTokenID(1, 1): {
ExtraData: reader.NewSourceTokenDataPayload(11, ethereumDomainCCTP).ToBytes(),
},
},
sourceChain: ethereumChain,
destChain: avalancheChain,
expectedMsgIDs: []exectypes.MessageTokenID{exectypes.NewMessageTokenID(1, 1)},
expectedMsgIDs: []reader.MessageTokenID{reader.NewMessageTokenID(1, 1)},
},
{
name: "single token message but different chain",
tokens: map[exectypes.MessageTokenID]cciptypes.RampTokenAmount{
exectypes.NewMessageTokenID(1, 2): {
tokens: map[reader.MessageTokenID]cciptypes.RampTokenAmount{
reader.NewMessageTokenID(1, 2): {
ExtraData: reader.NewSourceTokenDataPayload(31, ethereumDomainCCTP).ToBytes(),
},
},
sourceChain: ethereumChain,
destChain: polygonChain,
expectedMsgIDs: []exectypes.MessageTokenID{exectypes.NewMessageTokenID(1, 2)},
expectedMsgIDs: []reader.MessageTokenID{reader.NewMessageTokenID(1, 2)},
},
{
name: "message without matching nonce",
tokens: map[exectypes.MessageTokenID]cciptypes.RampTokenAmount{
exectypes.NewMessageTokenID(1, 1): {
tokens: map[reader.MessageTokenID]cciptypes.RampTokenAmount{
reader.NewMessageTokenID(1, 1): {
ExtraData: reader.NewSourceTokenDataPayload(1234, ethereumDomainCCTP).ToBytes(),
},
},
sourceChain: ethereumChain,
destChain: avalancheChain,
expectedMsgIDs: []exectypes.MessageTokenID{},
expectedMsgIDs: []reader.MessageTokenID{},
},
{
name: "message without matching source domain",
tokens: map[exectypes.MessageTokenID]cciptypes.RampTokenAmount{
exectypes.NewMessageTokenID(1, 1): {
tokens: map[reader.MessageTokenID]cciptypes.RampTokenAmount{
reader.NewMessageTokenID(1, 1): {
ExtraData: reader.NewSourceTokenDataPayload(11, avalancheDomainCCTP).ToBytes(),
},
},
sourceChain: ethereumChain,
destChain: avalancheChain,
expectedMsgIDs: []exectypes.MessageTokenID{},
expectedMsgIDs: []reader.MessageTokenID{},
},
{
name: "message with multiple tokens",
tokens: map[exectypes.MessageTokenID]cciptypes.RampTokenAmount{
exectypes.NewMessageTokenID(1, 1): {
tokens: map[reader.MessageTokenID]cciptypes.RampTokenAmount{
reader.NewMessageTokenID(1, 1): {
ExtraData: reader.NewSourceTokenDataPayload(11, ethereumDomainCCTP).ToBytes(),
},
exectypes.NewMessageTokenID(1, 2): {
reader.NewMessageTokenID(1, 2): {
ExtraData: reader.NewSourceTokenDataPayload(21, ethereumDomainCCTP).ToBytes(),
},
},
sourceChain: ethereumChain,
destChain: avalancheChain,
expectedMsgIDs: []exectypes.MessageTokenID{
exectypes.NewMessageTokenID(1, 1),
exectypes.NewMessageTokenID(1, 2),
expectedMsgIDs: []reader.MessageTokenID{
reader.NewMessageTokenID(1, 1),
reader.NewMessageTokenID(1, 2),
},
},
{
name: "message with multiple tokens, one without matching nonce",
tokens: map[exectypes.MessageTokenID]cciptypes.RampTokenAmount{
exectypes.NewMessageTokenID(1, 1): {
tokens: map[reader.MessageTokenID]cciptypes.RampTokenAmount{
reader.NewMessageTokenID(1, 1): {
ExtraData: reader.NewSourceTokenDataPayload(11, ethereumDomainCCTP).ToBytes(),
},
exectypes.NewMessageTokenID(1, 2): {
reader.NewMessageTokenID(1, 2): {
ExtraData: reader.NewSourceTokenDataPayload(12, ethereumDomainCCTP).ToBytes(),
},
exectypes.NewMessageTokenID(1, 3): {
reader.NewMessageTokenID(1, 3): {
ExtraData: reader.NewSourceTokenDataPayload(31, ethereumDomainCCTP).ToBytes(),
},
},
sourceChain: ethereumChain,
destChain: avalancheChain,
expectedMsgIDs: []exectypes.MessageTokenID{
exectypes.NewMessageTokenID(1, 1),
exectypes.NewMessageTokenID(1, 3),
expectedMsgIDs: []reader.MessageTokenID{
reader.NewMessageTokenID(1, 1),
reader.NewMessageTokenID(1, 3),
},
},
}
Expand Down
5 changes: 5 additions & 0 deletions core/capabilities/ccip/configs/evm/contract_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ var DestReaderConfig = evmrelaytypes.ChainReaderConfig{
ChainSpecificName: mustGetMethodName("getVersionedConfig", rmnRemoteABI),
ReadType: evmrelaytypes.Method,
},
// TODO: to uncomment when the latest version of the contract will be merged.
// consts.MethodNameGetReportDigestHeader: {
// ChainSpecificName: mustGetMethodName("getReportDigestHeader", rmnRemoteABI),
// ReadType: evmrelaytypes.Method,
// },
},
},
},
Expand Down
5 changes: 3 additions & 2 deletions core/capabilities/ccip/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import (

ragep2ptypes "github.com/smartcontractkit/libocr/ragep2p/types"

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
ccipreaderpkg "github.com/smartcontractkit/chainlink-ccip/pkg/reader"
"github.com/smartcontractkit/chainlink-common/pkg/sqlutil"
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives"

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
ccipreaderpkg "github.com/smartcontractkit/chainlink-ccip/pkg/reader"

chainsel "github.com/smartcontractkit/chain-selectors"

cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
Expand Down
16 changes: 12 additions & 4 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"math/big"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
chainsel "github.com/smartcontractkit/chain-selectors"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper"

"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm"
Expand All @@ -20,8 +22,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml"

chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/libocr/commontypes"
libocr3 "github.com/smartcontractkit/libocr/offchainreporting2plus"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"
Expand Down Expand Up @@ -203,7 +203,15 @@ func (i *pluginOracleCreator) Create(donID uint32, config cctypes.OCR3ConfigWith
if err != nil {
return nil, err
}
return oracle, nil

closers := make([]io.Closer, 0, len(contractReaders)+len(chainWriters))
for _, cr := range contractReaders {
closers = append(closers, cr)
}
for _, cw := range chainWriters {
closers = append(closers, cw)
}
return newWrappedOracle(oracle, closers), nil
}

func (i *pluginOracleCreator) createFactoryAndTransmitter(
Expand Down Expand Up @@ -372,7 +380,7 @@ func decodeAndValidateOffchainConfig(
if err1 != nil {
return offChainConfig{}, fmt.Errorf("failed to decode commit offchain config: %w, raw: %s", err1, string(publicConfig.ReportingPluginConfig))
}
if err2 := commitOffchainCfg.Validate(); err2 != nil {
if err2 := commitOffchainCfg.ApplyDefaultsAndValidate(); err2 != nil {
return offChainConfig{}, fmt.Errorf("failed to validate commit offchain config: %w", err2)
}
ofc.commitOffchainConfig = &commitOffchainCfg
Expand Down
42 changes: 42 additions & 0 deletions core/capabilities/ccip/oraclecreator/wrapped_oracle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package oraclecreator

import (
"errors"
"fmt"
"io"

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

cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types"
)

// wrappedOracle is a wrapper for cctypes.CCIPOracle that allows custom actions on Oracle shutdown.
type wrappedOracle struct {
baseOracle cctypes.CCIPOracle

// closableResources will be closed after calling baseOracle.Close()
closableResources []io.Closer
}

func newWrappedOracle(baseOracle cctypes.CCIPOracle, closableResources []io.Closer) cctypes.CCIPOracle {
return &wrappedOracle{
baseOracle: baseOracle,
closableResources: closableResources,
}
}

func (o *wrappedOracle) Start() error {
return o.baseOracle.Start()
}

func (o *wrappedOracle) Close() error {
errs := make([]error, 0)

if err := o.baseOracle.Close(); err != nil {
errs = append(errs, fmt.Errorf("close base oracle: %w", err))
}

errs = append(errs, services.CloseAll(o.closableResources...))

return errors.Join(errs...)
}
Loading

0 comments on commit e1f31f3

Please sign in to comment.