diff --git a/pkg/capabilities/consensus/ocr3/datafeeds/securemint_aggregator.go b/pkg/capabilities/consensus/ocr3/datafeeds/securemint_aggregator.go index 8613595d08..9c12b3b6d3 100644 --- a/pkg/capabilities/consensus/ocr3/datafeeds/securemint_aggregator.go +++ b/pkg/capabilities/consensus/ocr3/datafeeds/securemint_aggregator.go @@ -126,7 +126,7 @@ func (f *evmReportFormatter) packReport(lggr logger.Logger, report *secureMintRe map[EVMEncoderKey]any{ DataIDOutputFieldName: f.dataID, AnswerOutputFieldName: smReportAsAnswer, - TimestampOutputFieldName: uint32(report.Block), + TimestampOutputFieldName: uint32(report.SeqNr), }, } @@ -166,13 +166,13 @@ func (f *solanaReportFormatter) packReport(lggr logger.Logger, report *secureMin accountContextHash := sha256.Sum256(accounts) lggr.Debugw("calculated account context hash", "accountContextHash", accountContextHash) - if report.Block > (1<<32 - 1) { // timestamp must fit in u32 in solana - return nil, fmt.Errorf("timestamp exceeds u32 bounds: %v", report.Block) + if report.SeqNr > (1<<32 - 1) { // timestamp must fit in u32 in solana + return nil, fmt.Errorf("timestamp exceeds u32 bounds: %v", report.SeqNr) } toWrap := []any{ map[SolanaEncoderKey]any{ - SolTimestampOutputFieldName: uint32(report.Block), // TODO: Verify with Michael/Geert timestamp should be block number? + SolTimestampOutputFieldName: uint32(report.SeqNr), SolAnswerOutputFieldName: smReportAsAnswer, SolDataIDOutputFieldName: f.dataID, }, diff --git a/pkg/capabilities/consensus/ocr3/datafeeds/securemint_aggregator_test.go b/pkg/capabilities/consensus/ocr3/datafeeds/securemint_aggregator_test.go index d4e25ea223..da871d80a9 100644 --- a/pkg/capabilities/consensus/ocr3/datafeeds/securemint_aggregator_test.go +++ b/pkg/capabilities/consensus/ocr3/datafeeds/securemint_aggregator_test.go @@ -37,6 +37,7 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { dataID string solAccounts [][32]byte previousOutcome *types.AggregationOutcome + seqNr uint64 observations map[ocrcommon.OracleID][]values.Value f int expectedShouldReport bool @@ -69,7 +70,7 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { assert.NotNil(t, answer) timestamp := report[TimestampOutputFieldName].(int64) - assert.Equal(t, int64(1000), timestamp) + assert.Equal(t, int64(tc.seqNr), timestamp) } solReportAssertFn := func(t *testing.T, tc tcase, topLevelMap map[string]any) { @@ -100,7 +101,7 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { assert.NotNil(t, answer) timestamp := report[SolTimestampOutputFieldName].(int64) - assert.Equal(t, int64(1000), timestamp) + assert.Equal(t, int64(tc.seqNr), timestamp) } tests := []tcase{ @@ -108,6 +109,7 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { name: "successful eth report extraction", chainSelector: "16015286601757825753", dataID: "0x01c508f42b0201320000000000000000", + seqNr: 10, observations: createSecureMintObservations(t, []ocrTriggerEventData{ { chainSelector: ethSepoliaChainSelector, @@ -121,10 +123,10 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { }, { chainSelector: bnbTestnetChainSelector, - seqNr: 11, + seqNr: 10, report: &secureMintReport{ ConfigDigest: ocr2types.ConfigDigest{0: 2, 31: 3}, - SeqNr: 11, + SeqNr: 10, Block: 1100, Mintable: big.NewInt(200), }, @@ -139,6 +141,7 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { name: "no matching chain selector found", chainSelector: "16015286601757825753", dataID: "0x01c508f42b0201320000000000000000", + seqNr: 10, observations: createSecureMintObservations(t, []ocrTriggerEventData{ { chainSelector: bnbTestnetChainSelector, @@ -160,6 +163,7 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { name: "no observations", chainSelector: "16015286601757825753", dataID: "0x01c508f42b0201320000000000000000", + seqNr: 10, observations: map[ocrcommon.OracleID][]values.Value{}, f: 1, expectError: true, @@ -169,6 +173,7 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { name: "successful sol report extraction", chainSelector: "16423721717087811551", // solana devnet dataID: "0x01c508f42b0201320000000000000000", + seqNr: 10, solAccounts: [][32]byte{acc1, acc2}, observations: createSecureMintObservations(t, []ocrTriggerEventData{ { @@ -183,10 +188,10 @@ func TestSecureMintAggregator_Aggregate(t *testing.T) { }, { chainSelector: bnbTestnetChainSelector, - seqNr: 11, + seqNr: 10, report: &secureMintReport{ ConfigDigest: ocr2types.ConfigDigest{0: 2, 31: 3}, - SeqNr: 11, + SeqNr: 10, Block: 1100, Mintable: big.NewInt(200), },