From d5bc1fe65739f5e6b8a191f761778e2de209aa5f Mon Sep 17 00:00:00 2001 From: dimitris Date: Fri, 31 Jan 2025 16:20:57 +0200 Subject: [PATCH] Remove wrong requirement in exec (#533) --- execute/plugin_functions.go | 4 --- execute/plugin_functions_test.go | 45 +++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/execute/plugin_functions.go b/execute/plugin_functions.go index 8493a6e89..8b7874e76 100644 --- a/execute/plugin_functions.go +++ b/execute/plugin_functions.go @@ -619,10 +619,6 @@ func getConsensusObservation( F int, destChain cciptypes.ChainSelector, ) (exectypes.Observation, error) { - if len(aos) < F { - return exectypes.Observation{}, fmt.Errorf("below F threshold") - } - observedFChains := make(map[cciptypes.ChainSelector][]int) for _, ao := range aos { obs := ao.Observation diff --git a/execute/plugin_functions_test.go b/execute/plugin_functions_test.go index d094884f6..6d78c73c3 100644 --- a/execute/plugin_functions_test.go +++ b/execute/plugin_functions_test.go @@ -761,7 +761,6 @@ func Test_getConsensusObservation(t *testing.T) { want exectypes.Observation wantErr assert.ErrorAssertionFunc }{ - { name: "empty", args: args{ @@ -795,6 +794,50 @@ func Test_getConsensusObservation(t *testing.T) { }, wantErr: assert.NoError, }, + { + name: "consensus when exactly f+1", + args: args{ + observation: []exectypes.Observation{ + { + Nonces: exectypes.NonceObservations{dstChain: {"0x1": 1}}, + FChain: map[cciptypes.ChainSelector]int{dstChain: 2}, + }, + { + Nonces: exectypes.NonceObservations{dstChain: {"0x1": 1}}, + FChain: map[cciptypes.ChainSelector]int{dstChain: 2}, + }, + { + Nonces: exectypes.NonceObservations{dstChain: {"0x1": 1}}, + FChain: map[cciptypes.ChainSelector]int{dstChain: 2}, + }, + }, + }, + want: exectypes.Observation{ + Nonces: exectypes.NonceObservations{ + 1: { + "0x1": 1, + }, + }, + }, + wantErr: assert.NoError, + }, + { + name: "no consensus when less than f+1", + args: args{ + observation: []exectypes.Observation{ + { + Nonces: exectypes.NonceObservations{dstChain: {"0x1": 1}}, + FChain: map[cciptypes.ChainSelector]int{dstChain: 2}, + }, + { + Nonces: exectypes.NonceObservations{dstChain: {"0x1": 1}}, + FChain: map[cciptypes.ChainSelector]int{dstChain: 2}, + }, + }, + }, + want: exectypes.Observation{}, + wantErr: assert.NoError, + }, { name: "one ignored consensus observation", args: args{