diff --git a/pkg/types/ccipocr3/plugin_execute_types.go b/pkg/types/ccipocr3/plugin_execute_types.go index 9ea1aefc6..8b4b5ad3c 100644 --- a/pkg/types/ccipocr3/plugin_execute_types.go +++ b/pkg/types/ccipocr3/plugin_execute_types.go @@ -33,6 +33,10 @@ func (eri ExecuteReportInfo) Encode() ([]byte, error) { // DecodeExecuteReportInfo is a version aware decode function for the execute // report info bytes. func DecodeExecuteReportInfo(data []byte) (ExecuteReportInfo, error) { + if len(data) == 0 { + return ExecuteReportInfo{}, nil + } + switch data[0] { case 1: var result ExecuteReportInfo diff --git a/pkg/types/ccipocr3/plugin_execute_types_test.go b/pkg/types/ccipocr3/plugin_execute_types_test.go index 974fd3b35..dffb438a9 100644 --- a/pkg/types/ccipocr3/plugin_execute_types_test.go +++ b/pkg/types/ccipocr3/plugin_execute_types_test.go @@ -28,6 +28,13 @@ func TestDecodeExecuteReportInfo(t *testing.T) { _, err := DecodeExecuteReportInfo(data) require.ErrorContains(t, err, "object") // not super helpful... } + + // empty + { + ri, err := DecodeExecuteReportInfo(nil) + require.NoError(t, err) + require.Equal(t, ExecuteReportInfo{}, ri) + } } func TestExecuteReportInfo_EncodeDecode(t *testing.T) {