diff --git a/chain/evm/compass.go b/chain/evm/compass.go index 96f378a..70b8268 100644 --- a/chain/evm/compass.go +++ b/chain/evm/compass.go @@ -1238,23 +1238,16 @@ func (t compass) provideTxProof(ctx context.Context, queueTypeName string, rawMs var serializedReceipt []byte - msg, ok := rawMsg.Msg.(*evmtypes.Message) - // If this is a turnstone message, we may need additional info - if ok { - switch msg.GetAction().(type) { - case *evmtypes.Message_UploadUserSmartContract: - // For UserUploadSmartContract messages, we need the transaction - // receipt, so that paloma can use the generated events to get the - // contract address - receipt, err := t.evm.TransactionReceipt(ctx, tx.Hash()) - if err != nil { - return err - } + // If this is a turnstone message, we need to get the tx receipt + if _, ok := rawMsg.Msg.(*evmtypes.Message); ok { + receipt, err := t.evm.TransactionReceipt(ctx, tx.Hash()) + if err != nil { + return err + } - serializedReceipt, err = receipt.MarshalBinary() - if err != nil { - return err - } + serializedReceipt, err = receipt.MarshalBinary() + if err != nil { + return err } } diff --git a/chain/evm/compass_test.go b/chain/evm/compass_test.go index b33642f..6cb84d7 100644 --- a/chain/evm/compass_test.go +++ b/chain/evm/compass_test.go @@ -70,6 +70,10 @@ var ( return tx }() + sampleReceiptTx1 = ðtypes.Receipt{ + Status: ethtypes.ReceiptStatusSuccessful, + } + eventIdAtomic = atomic.Int64{} ) @@ -1915,9 +1919,14 @@ func TestProvidingEvidenceForAMessage(t *testing.T) { setup: func(t *testing.T) (*mockEvmClienter, *evmmocks.PalomaClienter) { evm, paloma := newMockEvmClienter(t), evmmocks.NewPalomaClienter(t) evm.On("TransactionByHash", mock.Anything, mock.Anything).Return(sampleTx1, false, nil) + evm.On("TransactionReceipt", mock.Anything, mock.Anything). + Return(sampleReceiptTx1, nil) paloma.On("AddMessageEvidence", mock.Anything, queue.QueueSuffixTurnstone, uint64(555), - &types.TxExecutedProof{SerializedTX: whoops.Must(sampleTx1.MarshalBinary())}, + &types.TxExecutedProof{ + SerializedTX: whoops.Must(sampleTx1.MarshalBinary()), + SerializedReceipt: whoops.Must(sampleReceiptTx1.MarshalBinary()), + }, ).Return( nil, )