Skip to content

Commit

Permalink
w
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Oct 16, 2024
1 parent e32c400 commit 9e2295b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.5
require (
github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241010121129-90d73545782e
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241010133059-164521b0d85b
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6Ng
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241010133059-164521b0d85b h1:KL3IWd8RFRxdKcEVsIi3dgzaia0tWfx1hJcdg88JtV8=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20241010133059-164521b0d85b/go.mod h1:+yz2So1Lp90C3ATfMmqMEJaIr3zfG8e4xHa/3u1kIDk=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241010121129-90d73545782e h1:6D1uTPgyTAaXGeO7Owu96cuOzQB8xnCMkjFKrjtHhY0=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241010121129-90d73545782e/go.mod h1:tsGgeEJc5SUSlfVGSX0wR0EkRU3pM58D6SKF97V68ko=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
Expand Down
1 change: 1 addition & 0 deletions llo/plugin_observation.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func (p *Plugin) observation(ctx context.Context, outctx ocr3types.OutcomeContex
}

if previousOutcome.LifeCycleStage == LifeCycleStageRetired {
// TODO: does this short-circuit potentially cause problems if a retirement report persist failed for this node?
return nil, fmt.Errorf("will not generate observations for retired protocol instance")
}

Expand Down
10 changes: 5 additions & 5 deletions mercury/onchain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ var onchainConfigVersionBig = big.NewInt(onchainConfigVersion)

const onchainConfigEncodedLength = 96 // 3x 32bit evm words, version + min + max

var _ mercury.OnchainConfigCodec = EVMOnchainConfigCodec{}
var _ mercury.OnchainConfigCodec = StandardOnchainConfigCodec{}

Check failure on line 19 in mercury/onchain_config.go

View workflow job for this annotation

GitHub Actions / ci-test

cannot use StandardOnchainConfigCodec{} (value of type StandardOnchainConfigCodec) as "github.com/smartcontractkit/chainlink-common/pkg/types/mercury".OnchainConfigCodec value in variable declaration: StandardOnchainConfigCodec does not implement "github.com/smartcontractkit/chainlink-common/pkg/types/mercury".OnchainConfigCodec (wrong type for method Decode)

Check failure on line 19 in mercury/onchain_config.go

View workflow job for this annotation

GitHub Actions / ci-lint

cannot use StandardOnchainConfigCodec{} (value of type StandardOnchainConfigCodec) as "github.com/smartcontractkit/chainlink-common/pkg/types/mercury".OnchainConfigCodec value in variable declaration: StandardOnchainConfigCodec does not implement "github.com/smartcontractkit/chainlink-common/pkg/types/mercury".OnchainConfigCodec (wrong type for method Decode)

Check failure on line 19 in mercury/onchain_config.go

View workflow job for this annotation

GitHub Actions / ci-lint

cannot use StandardOnchainConfigCodec{} (value of type StandardOnchainConfigCodec) as "github.com/smartcontractkit/chainlink-common/pkg/types/mercury".OnchainConfigCodec value in variable declaration: StandardOnchainConfigCodec does not implement "github.com/smartcontractkit/chainlink-common/pkg/types/mercury".OnchainConfigCodec (wrong type for method Decode)

// EVMOnchainConfigCodec provides a mercury-specific implementation of
// StandardOnchainConfigCodec provides a mercury-specific implementation of
// OnchainConfigCodec.
//
// An encoded onchain config is expected to be in the format
// <version><min><max>
// where version is a uint8 and min and max are in the format
// returned by EncodeValueInt192.
type EVMOnchainConfigCodec struct{}
type StandardOnchainConfigCodec struct{}

func (EVMOnchainConfigCodec) Decode(ctx context.Context, b []byte) (mercury.OnchainConfig, error) {
func (StandardOnchainConfigCodec) Decode(ctx context.Context, b []byte) (mercury.OnchainConfig, error) {
if len(b) != onchainConfigEncodedLength {
return mercury.OnchainConfig{}, fmt.Errorf("unexpected length of OnchainConfig, expected %v, got %v", onchainConfigEncodedLength, len(b))
}
Expand Down Expand Up @@ -56,7 +56,7 @@ func (EVMOnchainConfigCodec) Decode(ctx context.Context, b []byte) (mercury.Onch
return mercury.OnchainConfig{Min: min, Max: max}, nil
}

func (EVMOnchainConfigCodec) Encode(ctx context.Context, c mercury.OnchainConfig) ([]byte, error) {
func (StandardOnchainConfigCodec) Encode(ctx context.Context, c mercury.OnchainConfig) ([]byte, error) {
verBytes, err := bigbigendian.SerializeSigned(32, onchainConfigVersionBig)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions mercury/onchain_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func FuzzDecodeOnchainConfig(f *testing.F) {
valid, err := EVMOnchainConfigCodec{}.Encode(tests.Context(f), mercury.OnchainConfig{Min: big.NewInt(1), Max: big.NewInt(1000)})
valid, err := StandardOnchainConfigCodec{}.Encode(tests.Context(f), mercury.OnchainConfig{Min: big.NewInt(1), Max: big.NewInt(1000)})
if err != nil {
f.Fatalf("failed to construct valid OnchainConfig: %s", err)
}
Expand All @@ -19,12 +19,12 @@ func FuzzDecodeOnchainConfig(f *testing.F) {
f.Add(valid)
f.Fuzz(func(t *testing.T, encoded []byte) {
ctx := tests.Context(t)
decoded, err := EVMOnchainConfigCodec{}.Decode(ctx, encoded)
decoded, err := StandardOnchainConfigCodec{}.Decode(ctx, encoded)
if err != nil {
return
}

encoded2, err := EVMOnchainConfigCodec{}.Encode(ctx, decoded)
encoded2, err := StandardOnchainConfigCodec{}.Encode(ctx, decoded)
if err != nil {
t.Fatalf("failed to re-encode decoded input: %s", err)
}
Expand Down

0 comments on commit 9e2295b

Please sign in to comment.