Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sends extra config + chainlink-common bump #16247

Merged
merged 64 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
df3a6e8
Sends extra config + chainlink-common bump
vyzaldysanchez Feb 6, 2025
fe85d55
Fixes CI
vyzaldysanchez Feb 6, 2025
8b26176
Bumps chainlink-common
vyzaldysanchez Feb 6, 2025
6493975
Fixes CI
vyzaldysanchez Feb 6, 2025
1fc1d26
Fixes CI
vyzaldysanchez Feb 6, 2025
3b2c089
Fixes CI
vyzaldysanchez Feb 6, 2025
f927abc
gomods tidy
vyzaldysanchez Feb 6, 2025
841a687
Renames import
vyzaldysanchez Feb 11, 2025
328d25a
Renames Accept/Transmit fields into ShouldAccept/ShouldTransmit
vyzaldysanchez Feb 11, 2025
ae5d519
bumps `chainlink-common`
vyzaldysanchez Feb 11, 2025
ff897a8
bumps deps
vyzaldysanchez Feb 11, 2025
5189666
bumps deps
vyzaldysanchez Feb 11, 2025
736b6ff
bumps deps
vyzaldysanchez Feb 11, 2025
01e25d1
bumps deps
vyzaldysanchez Feb 11, 2025
c98bb1e
bumps deps
vyzaldysanchez Feb 11, 2025
f08b8d7
bumps deps
vyzaldysanchez Feb 11, 2025
371395e
Merge branch 'develop' into task/CRE-142/consensus-cap-config
vyzaldysanchez Feb 11, 2025
d75ea65
bumps deps
vyzaldysanchez Feb 11, 2025
3f5fc4e
Fixes test
vyzaldysanchez Feb 13, 2025
8ab2493
gomods tidy
vyzaldysanchez Feb 13, 2025
4709cb8
Merge branch 'develop' into task/CRE-142/consensus-cap-config
vyzaldysanchez Feb 13, 2025
374f6a3
Fixes test
vyzaldysanchez Feb 13, 2025
9a4ef2b
Merge branch 'develop' into task/CRE-142/consensus-cap-config
vyzaldysanchez Feb 13, 2025
c9d9128
Generates OCR3 config view (#16395)
vyzaldysanchez Feb 14, 2025
840de9d
Merge remote-tracking branch 'origin/develop' into task/CRE-142/conse…
vyzaldysanchez Feb 14, 2025
18df737
Fixes merge + gomods tidy
vyzaldysanchez Feb 14, 2025
a7efa3b
gomods tidy
vyzaldysanchez Feb 14, 2025
ae70da0
Fixes test
vyzaldysanchez Feb 14, 2025
897a796
Renames view field
vyzaldysanchez Feb 14, 2025
89c2284
Renames view field
vyzaldysanchez Feb 15, 2025
d61cb4a
Hex encodes view signers field values
vyzaldysanchez Feb 15, 2025
fb7bce5
Merge remote-tracking branch 'origin/develop' into task/CRE-142/conse…
vyzaldysanchez Feb 15, 2025
d700509
Fixes merge conflicts issues
vyzaldysanchez Feb 15, 2025
95f6bd3
gomods tidy
vyzaldysanchez Feb 15, 2025
0ff2738
Merge branch 'develop' into task/CRE-142/consensus-cap-config
vyzaldysanchez Feb 15, 2025
d103564
Fixes merge conflicts issues
vyzaldysanchez Feb 15, 2025
b0191b9
Fixes lint
vyzaldysanchez Feb 15, 2025
a82f2ea
Prevents break on 0 `RequestTimeout`
vyzaldysanchez Feb 18, 2025
99037dd
Prevents break on 0 `RequestTimeout`
vyzaldysanchez Feb 18, 2025
e6ac35e
gomods tidy
vyzaldysanchez Feb 19, 2025
adcf539
Merge branch 'develop' into task/CRE-142/consensus-cap-config
vyzaldysanchez Feb 19, 2025
a69f52d
git merge conflicts
vyzaldysanchez Feb 19, 2025
f75f744
fixes lint
vyzaldysanchez Feb 19, 2025
4c8b48d
Merge remote-tracking branch 'origin/develop' into task/CRE-142/conse…
vyzaldysanchez Feb 21, 2025
fe73352
gomods tidy
vyzaldysanchez Feb 21, 2025
9b05fb8
gomods tidy
vyzaldysanchez Feb 21, 2025
d4c0599
gomods tidy
vyzaldysanchez Feb 21, 2025
75eaa20
Fixes merge conflicts issues
vyzaldysanchez Feb 21, 2025
bba45b4
Fixes merge conflicts issues
vyzaldysanchez Feb 21, 2025
e9bc4d6
bumps chainlink-common + fixes(?)
vyzaldysanchez Feb 21, 2025
098d1b0
Merge branch 'develop' into task/CRE-142/consensus-cap-config
vyzaldysanchez Feb 21, 2025
34c2d51
gomods tidy
vyzaldysanchez Feb 21, 2025
769f47a
gomods tidy
vyzaldysanchez Feb 21, 2025
f7faf31
remove unused file
vyzaldysanchez Feb 21, 2025
569f7de
fixes conflicts
vyzaldysanchez Feb 21, 2025
a62d10a
Updates comment
vyzaldysanchez Feb 21, 2025
8b84cd8
gomods tidy
vyzaldysanchez Feb 21, 2025
e44dc3a
gomods tidy
vyzaldysanchez Feb 21, 2025
3ec8385
Renames property correctly
vyzaldysanchez Feb 22, 2025
058e3d9
Merge remote-tracking branch 'origin/develop' into task/CRE-142/conse…
vyzaldysanchez Feb 22, 2025
9eb823c
Merge branch 'develop' into task/CRE-142/consensus-cap-config
vyzaldysanchez Feb 24, 2025
97e2bfb
Sets lower `MaxBatchSize` on examples/tests
vyzaldysanchez Feb 24, 2025
6179fe7
Sets lower `MaxBatchSize` on examples/tests
vyzaldysanchez Feb 24, 2025
357a1cb
Fixes test
vyzaldysanchez Feb 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ replace github.com/smartcontractkit/chainlink/deployment => ../../deployment
// Using a separate `require` here to avoid surrounding line changes
// creating potential merge conflicts.
require (
github.com/smartcontractkit/chainlink/deployment v0.0.0-20250128231431-9279badae2f0
github.com/smartcontractkit/chainlink/v2 v2.19.0-ccip1.5.16-alpha.0.0.20250129223716-34cbaaab2d04
github.com/smartcontractkit/chainlink/deployment v0.0.0-20250221182743-098d1b0a763a
github.com/smartcontractkit/chainlink/v2 v2.0.0-20250221182743-098d1b0a763a
)

require (
Expand All @@ -34,7 +34,7 @@ require (
github.com/prometheus/client_golang v1.20.5
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221174903-e1e47fdb11b0
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5
github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250213145514-41d874782c02
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.22
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250224132459-c57ae4a97dcb h1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250224132459-c57ae4a97dcb/go.mod h1:Hht/OJq/PxC+gnBCIPyzHt4Otsw6mYwUVsmtOqIvlxo=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01 h1:R3OD6Phi0ULIQ2uvHiKVWYdgpi/O1Mt46CUK1UApcXU=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea h1:/1f/pWf7vSV9acTR9UPn2exPAwQG/LHGa4l9OywhS00=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221174903-e1e47fdb11b0 h1:BTN2nQgFKBxgas6oqY3ym82O+wT++WlpP1+a6KzIfY0=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221174903-e1e47fdb11b0/go.mod h1:YQuXIqQpmpAqstWV0LHaDTJ5nsSWuip5ivEM+Fisb+4=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5 h1:CvDfgWoLoYPapOumE/UZCplfCu5oNmy9BuH+6V6+fJ8=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5/go.mod h1:pDZagSGjs9U+l4YIFhveDznMHqxuuz+5vRxvVgpbdr8=
github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c=
Expand Down
6 changes: 3 additions & 3 deletions core/scripts/keystone/ocr_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"MaxQueryLengthBytes": 1000000,
"MaxObservationLengthBytes": 1000000,
"MaxReportLengthBytes": 1000000,
"MaxRequestBatchSize": 1000,
"MaxBatchSize": 20,
"UniqueReports": true,

"DeltaProgressMillis": 5000,
Expand All @@ -19,8 +19,8 @@
"MaxDurationQueryMillis": 1000,
"MaxDurationObservationMillis": 1000,
"MaxDurationReportMillis": 1000,
"MaxDurationAcceptMillis": 1000,
"MaxDurationTransmitMillis": 1000,
"MaxDurationShouldAcceptMillis": 1000,
"MaxDurationShouldTransmitMillis": 1000,

"MaxFaultyOracles": 1
}
Expand Down
6 changes: 3 additions & 3 deletions core/scripts/keystone/src/generate_local_ocr3_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (g *generateLocalOCR3Config) Run(args []string) {
"MaxQueryLengthBytes": 1000000,
"MaxObservationLengthBytes": 1000000,
"MaxReportLengthBytes": 1000000,
"MaxRequestBatchSize": 1000,
"MaxBatchSize": 20,
"UniqueReports": true,
"DeltaProgressMillis": 5000,
"DeltaResendMillis": 5000,
Expand All @@ -90,8 +90,8 @@ func (g *generateLocalOCR3Config) Run(args []string) {
"MaxDurationQueryMillis": 1000,
"MaxDurationObservationMillis": 1000,
"MaxDurationReportMillis": 1000,
"MaxDurationAcceptMillis": 1000,
"MaxDurationTransmitMillis": 1000,
"MaxDurationShouldAcceptMillis": 1000,
"MaxDurationShouldTransmitMillis": 1000,
"MaxFaultyOracles": 1}`)
var cfg changeset.OracleConfig
err = json.Unmarshal(config, &cfg)
Expand Down
8 changes: 5 additions & 3 deletions core/scripts/keystone/src/testdata/SampleConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"MaxQueryLengthBytes": 1000000,
"MaxObservationLengthBytes": 1000000,
"MaxReportLengthBytes": 1000000,
"MaxRequestBatchSize": 1000,
"MaxBatchSize": 20,
"UniqueReports": true,
"RequestTimeout": "30s",
"DeltaProgressMillis": 5000,
"DeltaResendMillis": 5000,
"DeltaInitialMillis": 5000,
Expand All @@ -19,8 +20,9 @@
"MaxDurationQueryMillis": 1000,
"MaxDurationObservationMillis": 1000,
"MaxDurationReportMillis": 1000,
"MaxDurationAcceptMillis": 1000,
"MaxDurationTransmitMillis": 1000,
"MaxDurationShouldAcceptMillis": 1000,
"MaxDurationShouldTransmitMillis": 1000,

"MaxFaultyOracles": 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/require"

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

"github.com/smartcontractkit/chainlink/v2/core/services/job"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types"
)
Expand Down
4 changes: 2 additions & 2 deletions deployment/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace github.com/smartcontractkit/chainlink/v2 => ../

// Using a separate inline `require` here to avoid surrounding line changes
// creating potential merge conflicts.
require github.com/smartcontractkit/chainlink/v2 v2.0.0-20250128231431-9279badae2f0
require github.com/smartcontractkit/chainlink/v2 v2.0.0-20250221182743-098d1b0a763a

require (
github.com/Khan/genqlient v0.7.0
Expand All @@ -32,7 +32,7 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.40
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250224132459-c57ae4a97dcb
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221174903-e1e47fdb11b0
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250211162441-3d6cea220efb
github.com/smartcontractkit/chainlink-integrations/evm v0.0.0-20250213145514-41d874782c02
github.com/smartcontractkit/chainlink-protos/job-distributor v0.9.0
Expand Down
4 changes: 2 additions & 2 deletions deployment/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250224132459-c57ae4a97dcb h1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250224132459-c57ae4a97dcb/go.mod h1:Hht/OJq/PxC+gnBCIPyzHt4Otsw6mYwUVsmtOqIvlxo=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01 h1:R3OD6Phi0ULIQ2uvHiKVWYdgpi/O1Mt46CUK1UApcXU=
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250214202341-4190f2db1c01/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea h1:/1f/pWf7vSV9acTR9UPn2exPAwQG/LHGa4l9OywhS00=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250214231858-f365e2bdecea/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221174903-e1e47fdb11b0 h1:BTN2nQgFKBxgas6oqY3ym82O+wT++WlpP1+a6KzIfY0=
github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221174903-e1e47fdb11b0/go.mod h1:YQuXIqQpmpAqstWV0LHaDTJ5nsSWuip5ivEM+Fisb+4=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5 h1:CvDfgWoLoYPapOumE/UZCplfCu5oNmy9BuH+6V6+fJ8=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5/go.mod h1:pDZagSGjs9U+l4YIFhveDznMHqxuuz+5vRxvVgpbdr8=
github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c=
Expand Down
4 changes: 1 addition & 3 deletions deployment/keystone/changeset/accept_ownership.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

"github.com/ethereum/go-ethereum/common"

kslib "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal"

"github.com/smartcontractkit/chainlink/deployment"
"github.com/smartcontractkit/chainlink/deployment/common/changeset"
)
Expand All @@ -25,7 +23,7 @@ func AcceptAllOwnershipsProposal(e deployment.Environment, req *AcceptAllOwnersh
chain := e.Chains[chainSelector]
addrBook := e.ExistingAddresses

r, err := kslib.GetContractSets(e.Logger, &kslib.GetContractSetsRequest{
r, err := GetContractSets(e.Logger, &GetContractSetsRequest{
Chains: map[uint64]deployment.Chain{
req.ChainSelector: chain,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (req *AppendNodeCapabilitiesRequest) convert(e deployment.Environment) (*in
return nil, nil, fmt.Errorf("failed to validate UpdateNodeCapabilitiesRequest: %w", err)
}
registryChain := e.Chains[req.RegistryChainSel] // exists because of the validation above
resp, err := internal.GetContractSets(e.Logger, &internal.GetContractSetsRequest{
resp, err := GetContractSets(e.Logger, &GetContractSetsRequest{
Chains: map[uint64]deployment.Chain{req.RegistryChainSel: registryChain},
AddressBook: e.ExistingAddresses,
})
Expand Down
17 changes: 0 additions & 17 deletions deployment/keystone/changeset/compatiblity.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@ type TopLevelConfigSource = internal.TopLevelConfigSource
// GenerateOCR3Config generates an OCR3 config
var GenerateOCR3Config = internal.GenerateOCR3Config

// FeedConsumer is a feed consumer contract type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused; validated by draft PR in CLD

var FeedConsumer = internal.FeedConsumer

// KeystoneForwarder is a keystone forwarder contract type
var KeystoneForwarder = internal.KeystoneForwarder

// GetContractSetsRequest is a request to get contract sets
type GetContractSetsRequest = internal.GetContractSetsRequest

// GetContractSetsResponse is a response to get contract sets
type GetContractSetsResponse = internal.GetContractSetsResponse

// GetContractSets gets contract sets
var GetContractSets = internal.GetContractSets

// RegisterNOPSRequest is a request to register NOPS
type RegisterNOPSRequest = internal.RegisterNOPSRequest

Expand Down Expand Up @@ -87,5 +72,3 @@ type DONCapabilityWithConfig = internal.DONCapabilityWithConfig

type DeployRequest = internal.DeployRequest
type DeployResponse = internal.DeployResponse

type ContractSet = internal.ContractSet
2 changes: 1 addition & 1 deletion deployment/keystone/changeset/deploy_forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func ConfigureForwardContracts(env deployment.Environment, req ConfigureForwardC
return deployment.ChangesetOutput{}, fmt.Errorf("failed to configure forward contracts: %w", err)
}

cresp, err := internal.GetContractSets(env.Logger, &internal.GetContractSetsRequest{
cresp, err := GetContractSets(env.Logger, &GetContractSetsRequest{
Chains: env.Chains,
AddressBook: env.ExistingAddresses,
})
Expand Down
2 changes: 1 addition & 1 deletion deployment/keystone/changeset/deploy_ocr3.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func ConfigureOCR3Contract(env deployment.Environment, cfg ConfigureOCR3Config)
if resp.Ops == nil {
return out, errors.New("expected MCMS operation to be non-nil")
}
r, err := kslib.GetContractSets(env.Logger, &kslib.GetContractSetsRequest{
r, err := GetContractSets(env.Logger, &GetContractSetsRequest{
Chains: env.Chains,
AddressBook: env.ExistingAddresses,
})
Expand Down
4 changes: 2 additions & 2 deletions deployment/keystone/changeset/internal/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func ConfigureOCR3Contract(env *deployment.Environment, chainSel uint64, dons []
return fmt.Errorf("failed to get contract set for chain %d", chainSel)
}

contract, err := contracts.GetOCR3Contract(nil)
contract, err := contracts.getOCR3Contract(nil)
if err != nil {
env.Logger.Errorf("failed to get OCR3 contract: %s", err)
return fmt.Errorf("failed to get OCR3 contract: %w", err)
Expand Down Expand Up @@ -375,7 +375,7 @@ func ConfigureOCR3ContractFromJD(env *deployment.Environment, cfg ConfigureOCR3C
return nil, fmt.Errorf("failed to get contract set for chain %d", cfg.ChainSel)
}

contract, err := contracts.GetOCR3Contract(cfg.Address)
contract, err := contracts.getOCR3Contract(cfg.Address)
if err != nil {
env.Logger.Errorf("%sfailed to get OCR3 contract at %s : %s", prefix, cfg.Address, err)
return nil, fmt.Errorf("failed to get OCR3 contract: %w", err)
Expand Down
88 changes: 76 additions & 12 deletions deployment/keystone/changeset/internal/ocr3config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ import (
"time"

"github.com/ethereum/go-ethereum/common"
mcmstypes "github.com/smartcontractkit/mcms/types"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/durationpb"

"github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper"
"github.com/smartcontractkit/libocr/offchainreporting2plus/types"
mcmstypes "github.com/smartcontractkit/mcms/types"

capocr3types "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types"

"github.com/smartcontractkit/chainlink/deployment"
"github.com/smartcontractkit/chainlink/deployment/common/proposalutils"
Expand All @@ -35,8 +39,12 @@ type OracleConfig struct {
MaxQueryLengthBytes uint32
MaxObservationLengthBytes uint32
MaxReportLengthBytes uint32
MaxRequestBatchSize uint32
MaxOutcomeLengthBytes uint32
MaxReportCount uint32
MaxBatchSize uint32
OutcomePruningThreshold uint64
UniqueReports bool
RequestTimeout time.Duration

DeltaProgressMillis uint32
DeltaResendMillis uint32
Expand All @@ -48,14 +56,50 @@ type OracleConfig struct {
MaxRoundsPerEpoch uint64
TransmissionSchedule []int

MaxDurationQueryMillis uint32
MaxDurationObservationMillis uint32
MaxDurationAcceptMillis uint32
MaxDurationTransmitMillis uint32
MaxDurationQueryMillis uint32
MaxDurationObservationMillis uint32
MaxDurationShouldAcceptMillis uint32
MaxDurationShouldTransmitMillis uint32

MaxFaultyOracles int
}

func (oc *OracleConfig) UnmarshalJSON(data []byte) error {
type aliasT OracleConfig
temp := &struct {
RequestTimeout string `json:"RequestTimeout"`
*aliasT
}{
aliasT: (*aliasT)(oc),
}
if err := json.Unmarshal(data, temp); err != nil {
return fmt.Errorf("failed to unmarshal OracleConfig: %w", err)
}

if temp.RequestTimeout == "" {
oc.RequestTimeout = 0
} else {
requestTimeout, err := time.ParseDuration(temp.RequestTimeout)
if err != nil {
return fmt.Errorf("failed to parse RequestTimeout: %w", err)
}
oc.RequestTimeout = requestTimeout
}

return nil
}

func (oc OracleConfig) MarshalJSON() ([]byte, error) {
type aliasT OracleConfig
return json.Marshal(&struct {
RequestTimeout string `json:"RequestTimeout"`
*aliasT
}{
RequestTimeout: oc.RequestTimeout.String(),
aliasT: (*aliasT)(&oc),
})
}

type NodeKeys struct {
EthAddress string `json:"EthAddress"`
AptosAccount string `json:"AptosAccount"`
Expand Down Expand Up @@ -202,7 +246,7 @@ func GenerateOCR3Config(cfg OracleConfig, nca []NodeKeys, secrets deployment.OCR
return OCR2OracleConfig{}, fmt.Errorf("wrong num elements copied from ocr2 offchain public key. expected %d but got %d", ed25519.PublicKeySize, nCopied)
}

offchainPubKeysBytes = append(offchainPubKeysBytes, types.OffchainPublicKey(pkBytesFixed))
offchainPubKeysBytes = append(offchainPubKeysBytes, pkBytesFixed)
}

configPubKeysBytes := []types.ConfigEncryptionPublicKey{}
Expand All @@ -218,7 +262,7 @@ func GenerateOCR3Config(cfg OracleConfig, nca []NodeKeys, secrets deployment.OCR
return OCR2OracleConfig{}, fmt.Errorf("wrong num elements copied from ocr2 config public key. expected %d but got %d", ed25519.PublicKeySize, n)
}

configPubKeysBytes = append(configPubKeysBytes, types.ConfigEncryptionPublicKey(pkBytesFixed))
configPubKeysBytes = append(configPubKeysBytes, pkBytesFixed)
}

identities := []confighelper.OracleIdentityExtra{}
Expand All @@ -234,6 +278,26 @@ func GenerateOCR3Config(cfg OracleConfig, nca []NodeKeys, secrets deployment.OCR
})
}

// let's keep reqTimeout as nil if it's 0, so we can use the default value within `chainlink-common`.
// See: https://github.com/smartcontractkit/chainlink-common/blob/main/pkg/capabilities/consensus/ocr3/factory.go#L73
var reqTimeout *durationpb.Duration
if cfg.RequestTimeout > 0 {
reqTimeout = durationpb.New(cfg.RequestTimeout)
}
cfgBytes, err := proto.Marshal(&capocr3types.ReportingPluginConfig{
MaxQueryLengthBytes: cfg.MaxQueryLengthBytes,
MaxObservationLengthBytes: cfg.MaxObservationLengthBytes,
MaxReportLengthBytes: cfg.MaxReportLengthBytes,
MaxOutcomeLengthBytes: cfg.MaxOutcomeLengthBytes,
MaxReportCount: cfg.MaxReportCount,
MaxBatchSize: cfg.MaxBatchSize,
OutcomePruningThreshold: cfg.OutcomePruningThreshold,
RequestTimeout: reqTimeout,
})
if err != nil {
return OCR2OracleConfig{}, fmt.Errorf("failed to marshal ReportingPluginConfig: %w", err)
}

signers, transmitters, f, onchainConfig, offchainConfigVersion, offchainConfig, err := ocr3confighelper.ContractSetConfigArgsDeterministic(
secrets.EphemeralSk,
secrets.SharedSecret,
Expand All @@ -247,12 +311,12 @@ func GenerateOCR3Config(cfg OracleConfig, nca []NodeKeys, secrets deployment.OCR
cfg.MaxRoundsPerEpoch,
cfg.TransmissionSchedule,
identities,
nil, // reportingPluginConfig
nil, // maxDurationInitialization
cfgBytes, // reportingPluginConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the deserialization of this by consumer? we write it to the contract - where is it read and how does it know to use the new proto defn?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deserialization happens here.

nil, // maxDurationInitialization
time.Duration(cfg.MaxDurationQueryMillis)*time.Millisecond,
time.Duration(cfg.MaxDurationObservationMillis)*time.Millisecond,
time.Duration(cfg.MaxDurationAcceptMillis)*time.Millisecond,
time.Duration(cfg.MaxDurationTransmitMillis)*time.Millisecond,
time.Duration(cfg.MaxDurationShouldAcceptMillis)*time.Millisecond,
time.Duration(cfg.MaxDurationShouldTransmitMillis)*time.Millisecond,
cfg.MaxFaultyOracles,
nil, // empty onChain config
)
Expand Down
Loading
Loading