Skip to content
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

Unknown source of extra Lovelace after unit test run #282

Open
Fiftyw3bs opened this issue Jan 21, 2024 · 2 comments
Open

Unknown source of extra Lovelace after unit test run #282

Fiftyw3bs opened this issue Jan 21, 2024 · 2 comments

Comments

@Fiftyw3bs
Copy link

Describe the bug

My test uses withWalletBalancesCheckSimple to validate the wallet balance after submitting transaction:

withWalletBalancesCheckSimple [w1 := valueSingleton
      ( case
            cAssetClass
          of
            Left _ -> GYLovelace
            Right x -> x
      ) 1 <> valueNegate (valueSingleton fakeGold 100) ] $ do mintOwnerTokenRun cSettings c

But I get the following result with an extra 1667970 lovelace

[error] Generic fail: Wallet: w1. 

Old balance: 1000000 02384095adfb494c4d3b53fad4fc44ce2da4db629c50cf627901b804.476f6c64 + 1000000 01f0ef87e344b733286dfce55cfd7e10c90b57a3b1825c984454ce6a.49726f6e + 1000000000000 lovelace. 

New balance: 1 569c5e8498ee05e8651ad68b6c81f9756852e218933db722ebc72b90.436f6c6f6e794f776e6572 + 999900 02384095adfb494c4d3b53fad4fc44ce2da4db629c50cf627901b804.476f6c64 + 1000000 01f0ef87e344b733286dfce55cfd7e10c90b57a3b1825c984454ce6a.49726f6e + 999998544685 lovelace. 

New balance after adding extra lovelaces 1 569c5e8498ee05e8651ad68b6c81f9756852e218933db722ebc72b90.436f6c6f6e794f776e6572 + 999900 02384095adfb494c4d3b53fad4fc44ce2da4db629c50cf627901b804.476f6c64 + 1000000 01f0ef87e344b733286dfce55cfd7e10c90b57a3b1825c984454ce6a.49726f6e + 1000001667970 lovelace. 

Expected balance difference of 1 569c5e8498ee05e8651ad68b6c81f9756852e218933db722ebc72b90.436f6c6f6e794f776e6572 + -100 02384095adfb494c4d3b53fad4fc44ce2da4db629c50cf627901b804.476f6c64, but the actual difference was 1 569c5e8498ee05e8651ad68b6c81f9756852e218933db722ebc72b90.436f6c6f6e794f776e6572 + -100 02384095adfb494c4d3b53fad4fc44ce2da4db629c50cf627901b804.476f6c64 + 1667970 lovelace

Expected behavior
Successful check of wallet balance.

Station (please complete the following information):

  • OS: Nix
  • Version 2.19.2
@Fiftyw3bs Fiftyw3bs changed the title Unknown source of Lovelace after unit test run Unknown source of extra Lovelace after unit test run Jan 21, 2024
@sourabhxyz
Copy link
Member

So your wallet was suppose to lose 100 of 02384095adfb494c4d3b53fad4fc44ce2da4db629c50cf627901b804.476f6c64 and gain one of 569c5e8498ee05e8651ad68b6c81f9756852e218933db722ebc72b90.436f6c6f6e794f776e6572, are you sure that in the operation you are doing, wallet is not suppose to receive any ada?

@Fiftyw3bs
Copy link
Author

Below is an excerpt of the off-chain code:

return $ fromJust (mustMint (GYMintScript $ colonyMintingPolicy' cSettings stepAddress treasuryAddress colony) redeemer
                             <$> tokenNameFromPlutus (fromMemberTypeToTokenName ColonyOwner)
                             <*> Just (toInteger (length creators)))
           <>
           foldMap mustBeSignedBy creators
           <>
           foldMap mustHaveOutput (GYTxOut <$> (addressFromPubKeyHash GYTestnetPreprod <$> creators)
                                          <*> [fromRight (valueFromLovelace 0) $ valueFromPlutus colonyOwnerToken]
                                          <*> [Just (colonyDatum, GYTxOutUseInlineDatum)]
                                          <*> [Nothing])
           <>
           mustHaveOutput (mkGYTxOut feeAddress (colonyCreationFee' cSettings) colonyDatum)

colonyCreationFee' is the 100 fakeGold (02384095adfb494c4d3b53fad4fc44ce2da4db629c50cf627901b804.476f6c64)
colonyOwnerToken is 569c5e8498ee05e8651ad68b6c81f9756852e218933db722ebc72b90.436f6c6f6e794f776e6572

Could it be that change is being returned to the creator's wallet?

BTW, how do I activate traces? I've stopped seeing them since I bumped atlas to v0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants