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

Unhandled error in liquidity pool search field #3616

Open
grctest opened this issue Jan 13, 2023 · 4 comments
Open

Unhandled error in liquidity pool search field #3616

grctest opened this issue Jan 13, 2023 · 4 comments

Comments

@grctest
Copy link
Contributor

grctest commented Jan 13, 2023

Describe the bug

I can't perform a search for the UIA to be converted to a liquidity pool token with my account 'nft.artist'.

I therefore can't create a liquidity pool with this account.

To Reproduce
Steps to reproduce the behavior:

Explore to the account nft.artist, then go to advanced -> pools -> Create.

Within the first field, search for NFTEA.

Nothing happens, however the console reports the following errors:

getAssetsByIssuer id =  nft.artist_10
{
    "code": 7,
    "message": "Execution error: Bad Cast: Invalid cast from type 'null_type' to Object",
    "data": {
        "code": 7,
        "name": "bad_cast_exception",
        "message": "Bad Cast",
        "stack": [
            {
                "context": {
                    "level": "error",
                    "file": "variant.cpp",
                    "line": 579,
                    "method": "get_string",
                    "hostname": "",
                    "thread_name": "th_a",
                    "timestamp": "2023-01-13T00:48:24"
                },
                "format": "Invalid cast from type '${type}' to Object",
                "data": {
                    "type": "null_type"
                }
            },
            {
                "context": {
                    "level": "warn",
                    "file": "object_id.hpp",
                    "line": 265,
                    "method": "from_variant",
                    "hostname": "",
                    "thread_name": "th_a",
                    "timestamp": "2023-01-13T00:48:24"
                },
                "format": "",
                "data": {
                    "var": null
                }
            }
        ]
    }
}

If I use another account which doesn't include a dot in the middle, the first field's search box works as expected.

Expected behavior
I'm able to create a liquidity pool token with this account, getting past the first field.

Desktop (please complete the following information):
Desktop, windows 11.
Occurs on web too.

@grctest grctest changed the title Liquidity pool tool doesn't like my username? Liquidity pool creation modal search field doesn't tolerate dots in usernames? Jan 13, 2023
@abitmore
Copy link
Member

abitmore commented Jan 14, 2023

It looks like the account nft.artist doesn't own any asset? Only the asset owner can create a liquidity pool with the asset as the share asset.

@grctest
Copy link
Contributor Author

grctest commented Jan 14, 2023

For an account with no issued assets and no dot in name, I get the following warnings when attempting to search in the first field:

onGetLiquidityPoolsAccount
getAssetsByIssuer id =  abcde12345_10
CreatePooModal marketsList:  Array(0)

But for nft.artist I get:

getAssetsByIssuer id =  nft.artist_10
Error in AssetActions.getAssetList:  Object

Similar for in.abit:

getAssetsByIssuer id =  in.abit_10
Error in AssetActions.getAssetList:  Object

Accounts without a dot in their username seem to work as expected, but those with a dot don't work?

@abitmore
Copy link
Member

abitmore commented Jan 15, 2023

Another difference is that the account abcde12345 owns one asset "id":"1.3.5544","symbol":"NORNS", but the account nft.artist doesn't own one.

I tried another account abcde1234, then got the same error Error in AssetActions.getAssetList: Object.

The RPC call sent to the API node is:

{"method":"call","params":[0,"get_assets_by_issuer",["abcde1234",null,10]],"id":1161}

It's the null in the call that caused the error.

Actually, according to the code in onPoolNameChange(getBackedAssets, e):

let account_name = this.props.account.get("name");
let assets = [...this.props.account.get("assets")];
let keys = [...this.props.account.keys()];
this.timer = setTimeout(() => {
lookupAccountAssets(
account_name,
toFind,
assets[0],
getBackedAssets,
this.getAssetsByIssuer,
this.setState
);
}, 1500);

on line 338, assets is assigned an empty array when the account doesn't own any asset, then asset[0] aka undefined is passed into lookupAccountAssets() on line 345, then:

function lookupAccountAssets(value, toFind, start, gatewayAssets = false, getAssetList, setState) {
if (!value && value !== "") return;
getAssetList(value, 10, start, gatewayAssets);
setState({lookupQuote: toFind});
}

undefined is passed as start to getAssetsByIssuer(issuer, count, start, includeGateways = false), then:

getAssetsByIssuer(issuer, count, start, includeGateways = false){
let id = issuer + "_" + count;
console.log("getAssetsByIssuer id = ", id);
return dispatch => {
if (!inProgress[id]) {
let assets;
inProgress[id] = true;
dispatch({loading: true});
assets = Apis.instance()
.db_api()
.exec("get_assets_by_issuer", [issuer, start, count])

null (converted from undefined) is passed to the get_assets_by_issuer API call.

So it is actually a UX issue. Simply adding a size check for assets will hide the error, but won't improve UX (still nothing happens if the account doesn't own an asset). We can show more text on the "create pool" page, e.g. the prerequisites to create a pool "the account need to own an asset which is a simple asset and has 0 supply and not linked to another liquidity pool", error message "you don't own any asset" or "you don't own an asset that contains [the input]", etc.

@grctest grctest changed the title Liquidity pool creation modal search field doesn't tolerate dots in usernames? Unhandled error in liquidity pool search field Jan 22, 2023
@grctest
Copy link
Contributor Author

grctest commented Feb 14, 2023

So it is actually a UX issue.

Idd, the current liquidity pool UX is poorly designed & the existence of this unhandled error indicates a lack of quality assurance.

The pool creation modal should be more descriptive and potentially ask for each in a wizard format rather than all up front. I had to ask others to realize I had to first create an UIA on an entirely different page for the liquidity pool asset to even exist, this was not clear at all from the UI.

There's also 3 separate pages to view liquidity pools, with the only difference being a 'create pool' button? A single page would've sufficed.

https://wallet.bitshares.org/#/pools (no create pool button)

https://wallet.bitshares.org/#/explorer/pools (no create pool button)

https://wallet.bitshares.org/#/account/nft.artist/pools (with create pool button, hidden under advanced)

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