Skip to content

std/testing: realms while testing does not receive coins #3381

Closed
@MikaelVallenet

Description

Description

This issue arose with the PR: #3119

This code works well

func IsReceivingCoinsWorking() {
	sentCoins := std.GetOrigSend()
	banker := std.GetBanker(std.BankerTypeOrigSend)
	realmAddr := std.CurrentRealm().Addr()

	receivedCoins := banker.GetCoins(realmAddr)
	if receivedCoins.String() != sentCoins.String() {
		panic(receivedCoins.String() + " != " + sentCoins.String())
	}
}

Problem

If i run the function in testing it will panic, that's not the problem since it already panicked before
The problem is before, the banker coins was set to 200000000ugnot, but now it set to 0 (the receivedCoins var in my code above)

before: panic: 200000000ugnot != 1000ugnot

after: panic: != 1000ugnot

In my case i had a test that used the surplus of coin sended to buy a GRC20 token, to send it back to the user.
This case was working since the banker coins was set to 200000000ugnot. that was greater than what the user sent anyway so the banker had enough coins to send back.

I wonder why the banker here does not have instead of 200000000ugnot or 0,but should have just the coins set in the std.TestSetOrigSend(coins, nil), is it because the testing does not handle coins transfer ?

Solution

I'm looking into it right now, i will open PR ASAP

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions