onflow / cadence-tools

Developer tools for Cadence
https://www.onflow.org/
Apache License 2.0
24 stars 20 forks source link

[Testing Framework] Reports extra events for `FungibleToken.Deposited` #337

Closed joshuahannan closed 3 months ago

joshuahannan commented 3 months ago

Current Behavior

The Cadence testing framework would be telling me that there are 43 FungibleToken.Deposited events in a single mint transaction, when there should only be one. This error happens when using the FungibleToken contract that is deployed to the emulator by default. When deploying it manually and using that version (which is the same exact code), I see the correct 1 event.

Expected Behavior

FungibleToken.Deposited is the standard event that is emitted from a pre-condition every time a FungibleToken.Receiver.deposit() happens. This transaction is only doing one deposit, so the max it should emit is 2, 1 for the deposit in the transaction, and maybe one for tx fees.

Steps To Reproduce

  1. Pull down the cadence-1 branch from this repo.
  2. Run make test.
  3. This is from this part of the test.

Testing this transaction.

with the FiatToken contract.

Environment

- Network: Emulator

github.com/onflow/cadence v1.0.0-preview.19
github.com/onflow/cadence-tools/test v1.0.0-preview.13
github.com/onflow/flow-emulator v1.0.0-preview.16