Skip to content

Commit

Permalink
Remove wrong requirement in exec (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkouv authored Jan 31, 2025
1 parent f56c795 commit d5bc1fe
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
4 changes: 0 additions & 4 deletions execute/plugin_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 44 additions & 1 deletion execute/plugin_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,6 @@ func Test_getConsensusObservation(t *testing.T) {
want exectypes.Observation
wantErr assert.ErrorAssertionFunc
}{

{
name: "empty",
args: args{
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit d5bc1fe

Please sign in to comment.