-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use extended contract reader, set onramp correctly in cciptypes.Message #52
Changes from all commits
89cb3fa
709cfcd
cf729b2
bdeecfa
b73fd31
5fd1084
3c35f38
7d40fc4
d1cd066
d90a90b
8140ddf
e2f3b82
f14cc3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,12 @@ func Test_getPendingExecutedReports(t *testing.T) { | |
// CommitReportsGTETimestamp(ctx, dest, ts, 1000) -> ([]cciptypes.CommitPluginReportWithMeta, error) | ||
// for each chain selector: | ||
// ExecutedMessageRanges(ctx, selector, dest, seqRange) -> ([]cciptypes.SeqNumRange, error) | ||
got, got1, err := getPendingExecutedReports(context.Background(), mockReader, 123, time.Now()) | ||
got, got1, err := getPendingExecutedReports( | ||
context.Background(), | ||
mockReader, | ||
123, | ||
time.Now(), | ||
logger.Test(t)) | ||
if !tt.wantErr(t, err, "getPendingExecutedReports(...)") { | ||
return | ||
} | ||
|
@@ -286,6 +291,7 @@ func TestPlugin_Observation_EligibilityCheckFailure(t *testing.T) { | |
p := &Plugin{ | ||
homeChain: setupHomeChainPoller(lggr, []reader.ChainConfigInfo{}), | ||
oracleIDToP2pID: map[commontypes.OracleID]libocrtypes.PeerID{}, | ||
lggr: lggr, | ||
} | ||
|
||
_, err := p.Observation(context.Background(), ocr3types.OutcomeContext{}, nil) | ||
|
@@ -326,6 +332,7 @@ func TestPlugin_Outcome_HomeChainError(t *testing.T) { | |
|
||
p := &Plugin{ | ||
homeChain: homeChain, | ||
lggr: logger.Test(t), | ||
} | ||
_, err := p.Outcome(ocr3types.OutcomeContext{}, nil, []types.AttributedObservation{}) | ||
require.Error(t, err) | ||
|
@@ -367,6 +374,7 @@ func TestPlugin_Outcome_MessagesMergeError(t *testing.T) { | |
|
||
p := &Plugin{ | ||
homeChain: homeChain, | ||
lggr: logger.Test(t), | ||
} | ||
|
||
// map[cciptypes.ChainSelector]map[cciptypes.SeqNum]cciptypes.Message | ||
|
@@ -416,8 +424,11 @@ func TestPlugin_ShouldAcceptAttestedReport_DoesNotDecode(t *testing.T) { | |
Return(cciptypes.ExecutePluginReport{}, fmt.Errorf("test error")) | ||
p := &Plugin{ | ||
reportCodec: codec, | ||
lggr: logger.Test(t), | ||
} | ||
_, err := p.ShouldAcceptAttestedReport(context.Background(), 0, ocr3types.ReportWithInfo[[]byte]{}) | ||
_, err := p.ShouldAcceptAttestedReport(context.Background(), 0, ocr3types.ReportWithInfo[[]byte]{ | ||
Report: []byte("will not decode"), // faked out, see mock above | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this parameter needed or informational? I thought the mocked function would be enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its needed since I updated the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And it gives a more informative log in that scenario |
||
}) | ||
require.Error(t, err) | ||
assert.Contains(t, err.Error(), "decode commit plugin report: test error") | ||
} | ||
|
@@ -430,7 +441,9 @@ func TestPlugin_ShouldAcceptAttestedReport_NoReports(t *testing.T) { | |
lggr: logger.Test(t), | ||
reportCodec: codec, | ||
} | ||
result, err := p.ShouldAcceptAttestedReport(context.Background(), 0, ocr3types.ReportWithInfo[[]byte]{}) | ||
result, err := p.ShouldAcceptAttestedReport(context.Background(), 0, ocr3types.ReportWithInfo[[]byte]{ | ||
Report: []byte("empty report"), // faked out, see mock above | ||
}) | ||
require.NoError(t, err) | ||
require.False(t, result) | ||
} | ||
|
@@ -447,7 +460,9 @@ func TestPlugin_ShouldAcceptAttestedReport_ShouldAccept(t *testing.T) { | |
lggr: logger.Test(t), | ||
reportCodec: codec, | ||
} | ||
result, err := p.ShouldAcceptAttestedReport(context.Background(), 0, ocr3types.ReportWithInfo[[]byte]{}) | ||
result, err := p.ShouldAcceptAttestedReport(context.Background(), 0, ocr3types.ReportWithInfo[[]byte]{ | ||
Report: []byte("report"), // faked out, see mock above | ||
}) | ||
require.NoError(t, err) | ||
require.True(t, result) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use sprintf instead of a key/value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the oracle ID in the log message is much quicker to parse than having it in the fields; so I want a formatted string as the log message but still want to JSON encode the log fields.