Skip to content

Commit

Permalink
Merge branch 'release/2.10.0' into jtw/cherry-pick-zkSync-error-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
snehaagni authored Mar 27, 2024
2 parents c535dfa + a0affa3 commit a072f57
Show file tree
Hide file tree
Showing 15 changed files with 271 additions and 214 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-turtles-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Add rebalancer support for feeds manager ocr2 plugins
19 changes: 18 additions & 1 deletion .github/workflows/operator-ui-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Operator UI CI
on:
pull_request:

env:
TARGET_BRANCH_NAME: ${{ github.event.pull_request.base.ref }}

jobs:
check-gql:
permissions:
Expand Down Expand Up @@ -37,10 +40,24 @@ jobs:
with:
url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }}

- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- name: Get operator-ui tag
id: get-operator-ui-tag
shell: bash
run: |
if [[ $TARGET_BRANCH_NAME == release/* ]]; then
TAG=$(cat ./operator_ui/TAG)
echo "TAG=$TAG" >> $GITHUB_OUTPUT
else
echo "TAG=main" >> $GITHUB_OUTPUT
fi
- uses: convictional/trigger-workflow-and-wait@f69fa9eedd3c62a599220f4d5745230e237904be #v1.6.5
with:
owner: smartcontractkit
repo: operator-ui
github_token: ${{ steps.get-gh-token.outputs.access-token }}
workflow_file_name: chainlink-ci.yml
client_payload: '{"ref": "${{ github.event.pull_request.head.sha }}"}'
client_payload: '{"ref": "${{ github.event.pull_request.head.sha }}", "tag": "${{ steps.get-operator-ui-tag.outputs.TAG }}"}'
22 changes: 13 additions & 9 deletions core/services/feeds/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ const (
type PluginType string

const (
PluginTypeCommit PluginType = "COMMIT"
PluginTypeExecute PluginType = "EXECUTE"
PluginTypeMedian PluginType = "MEDIAN"
PluginTypeMercury PluginType = "MERCURY"
PluginTypeUnknown PluginType = "UNKNOWN"
PluginTypeCommit PluginType = "COMMIT"
PluginTypeExecute PluginType = "EXECUTE"
PluginTypeMedian PluginType = "MEDIAN"
PluginTypeMercury PluginType = "MERCURY"
PluginTypeRebalancer PluginType = "REBALANCER"
PluginTypeUnknown PluginType = "UNKNOWN"
)

func FromPluginTypeInput(pt PluginType) string {
Expand All @@ -44,16 +45,19 @@ func ToPluginType(s string) (PluginType, error) {
return PluginTypeMedian, nil
case "mercury":
return PluginTypeMercury, nil
case "rebalancer":
return PluginTypeRebalancer, nil
default:
return PluginTypeUnknown, errors.New("unknown plugin type")
}
}

type Plugins struct {
Commit bool `json:"commit"`
Execute bool `json:"execute"`
Median bool `json:"median"`
Mercury bool `json:"mercury"`
Commit bool `json:"commit"`
Execute bool `json:"execute"`
Median bool `json:"median"`
Mercury bool `json:"mercury"`
Rebalancer bool `json:"rebalancer"`
}

func (p Plugins) Value() (driver.Value, error) {
Expand Down
49 changes: 29 additions & 20 deletions core/services/feeds/models_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func Test_ToPluginType(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, pt, PluginTypeMercury)

pt, err = ToPluginType("rebalancer")
require.NoError(t, err)
assert.Equal(t, pt, PluginTypeRebalancer)

pt, err = ToPluginType("xxx")
require.Error(t, err)
assert.Equal(t, pt, PluginTypeUnknown)
Expand All @@ -77,6 +81,7 @@ func Test_FromPluginType(t *testing.T) {
assert.Equal(t, "execute", FromPluginTypeInput(PluginTypeExecute))
assert.Equal(t, "median", FromPluginTypeInput(PluginTypeMedian))
assert.Equal(t, "mercury", FromPluginTypeInput(PluginTypeMercury))
assert.Equal(t, "rebalancer", FromPluginTypeInput(PluginTypeRebalancer))
assert.Equal(t, "unknown", FromPluginTypeInput(PluginTypeUnknown))
}

Expand Down Expand Up @@ -241,12 +246,13 @@ func Test_Plugins_Value(t *testing.T) {

var (
give = Plugins{
Commit: true,
Execute: true,
Median: false,
Mercury: true,
Commit: true,
Execute: true,
Median: false,
Mercury: true,
Rebalancer: false,
}
want = `{"commit":true,"execute":true,"median":false,"mercury":true}`
want = `{"commit":true,"execute":true,"median":false,"mercury":true,"rebalancer":false}`
)

val, err := give.Value()
Expand All @@ -262,12 +268,13 @@ func Test_Plugins_Scan(t *testing.T) {
t.Parallel()

var (
give = `{"commit":true,"execute":true,"median":false,"mercury":true}`
give = `{"commit":true,"execute":true,"median":false,"mercury":true,"rebalancer":false}`
want = Plugins{
Commit: true,
Execute: true,
Median: false,
Mercury: true,
Commit: true,
Execute: true,
Median: false,
Mercury: true,
Rebalancer: false,
}
)

Expand All @@ -290,13 +297,14 @@ func Test_OCR2Config_Value(t *testing.T) {
P2PPeerID: null.StringFrom("peerid"),
KeyBundleID: null.StringFrom("ocrkeyid"),
Plugins: Plugins{
Commit: true,
Execute: true,
Median: false,
Mercury: true,
Commit: true,
Execute: true,
Median: false,
Mercury: true,
Rebalancer: false,
},
}
want = `{"enabled":true,"is_bootstrap":false,"multiaddr":"multiaddr","forwarder_address":"forwarderaddress","p2p_peer_id":"peerid","key_bundle_id":"ocrkeyid","plugins":{"commit":true,"execute":true,"median":false,"mercury":true}}`
want = `{"enabled":true,"is_bootstrap":false,"multiaddr":"multiaddr","forwarder_address":"forwarderaddress","p2p_peer_id":"peerid","key_bundle_id":"ocrkeyid","plugins":{"commit":true,"execute":true,"median":false,"mercury":true,"rebalancer":false}}`
)

val, err := give.Value()
Expand All @@ -312,7 +320,7 @@ func Test_OCR2Config_Scan(t *testing.T) {
t.Parallel()

var (
give = `{"enabled":true,"is_bootstrap":false,"multiaddr":"multiaddr","forwarder_address":"forwarderaddress","p2p_peer_id":"peerid","key_bundle_id":"ocrkeyid","plugins":{"commit":true,"execute":true,"median":false,"mercury":true}}`
give = `{"enabled":true,"is_bootstrap":false,"multiaddr":"multiaddr","forwarder_address":"forwarderaddress","p2p_peer_id":"peerid","key_bundle_id":"ocrkeyid","plugins":{"commit":true,"execute":true,"median":false,"mercury":true,"rebalancer":false}}`
want = OCR2ConfigModel{
Enabled: true,
IsBootstrap: false,
Expand All @@ -321,10 +329,11 @@ func Test_OCR2Config_Scan(t *testing.T) {
P2PPeerID: null.StringFrom("peerid"),
KeyBundleID: null.StringFrom("ocrkeyid"),
Plugins: Plugins{
Commit: true,
Execute: true,
Median: false,
Mercury: true,
Commit: true,
Execute: true,
Median: false,
Mercury: true,
Rebalancer: false,
},
}
)
Expand Down
Loading

0 comments on commit a072f57

Please sign in to comment.