Skip to content

Commit a18f464

Browse files
committed
feat: adds txn receipts to tests
1 parent 407f946 commit a18f464

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

oracle/pkg/updater/updater_test.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,14 @@ func TestUpdaterIgnoreCommitments(t *testing.T) {
576576
8: types.NewBlock(&types.Header{}, txns, nil, nil, NewHasher()),
577577
10: types.NewBlock(&types.Header{}, txns, nil, nil, NewHasher()),
578578
},
579+
receipts: make(map[string]*types.Receipt),
580+
}
581+
for _, txn := range txns {
582+
receipt := &types.Receipt{
583+
Status: types.ReceiptStatusSuccessful,
584+
TxHash: txn.Hash(),
585+
}
586+
l1Client.receipts[txn.Hash().Hex()] = receipt
579587
}
580588

581589
pcABI, err := abi.JSON(strings.NewReader(preconf.PreconfcommitmentstoreABI))
@@ -798,7 +806,8 @@ func (t *testWinnerRegister) AddEncryptedCommitment(
798806
}
799807

800808
type testEVMClient struct {
801-
blocks map[int64]*types.Block
809+
blocks map[int64]*types.Block
810+
receipts map[string]*types.Receipt
802811
}
803812

804813
func (t *testEVMClient) BlockByNumber(ctx context.Context, blkNum *big.Int) (*types.Block, error) {
@@ -810,7 +819,11 @@ func (t *testEVMClient) BlockByNumber(ctx context.Context, blkNum *big.Int) (*ty
810819
}
811820

812821
func (t *testEVMClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) {
813-
return &types.Receipt{Status: 1}, nil
822+
receipt, found := t.receipts[txHash.Hex()]
823+
if !found {
824+
return nil, fmt.Errorf("receipt for transaction hash %s not found", txHash.Hex())
825+
}
826+
return receipt, nil
814827
}
815828

816829
type processedCommitment struct {

0 commit comments

Comments
 (0)