LiskArchive / lisk-sdk

🔩 Lisk software development kit
https://lisk.com
Apache License 2.0
2.72k stars 457 forks source link

"Key [...] does not exist" when calling `TokenMethod.transfer()` #9140

Closed emiliolisk closed 7 months ago

emiliolisk commented 7 months ago

Expected behavior

Tokens are transferred to the destination account.

Actual behavior

The following error appears:

 [moduleName=dex commandName=createPool err=Key 3c469e9d0000a55c80841228030ddd0c9ad1bbd5b93aeb59b9920400000000000000 does not exist. trace=Error: Key 3c469e9d0000a55c80841228030ddd0c9ad1bbd5b93aeb59b9920400000000000000 does not exist.

The error is thrown on this line of .transfer():

        let senderAccount;
        try {
            senderAccount = await userStore.get(methodContext, userStore.getKey(senderAddress, tokenID));

Steps to reproduce

Using this branch, run the node and manually send this transaction:

{
        module: 'dex',
        command: 'createPool',
        fee: BigInt(2000000000),
        params: {
            tokenID0: '0400000000000000',
            tokenID1: '0400001100000000',
            feeTier: 100,
            tickInitialPrice: 1,
            initialPosition: {
                tickLower: -887272,
                tickUpper: 887272,
                amount0Desired: '100000000',
                amount1Desired: BigInt(10000),
            },
            maxTimestampValid: BigInt(100000000000),
        }
    }

I already tried to add the token to the genesis assets, in case the account wasn't initialized for that tokenID:

                    {
                        "address": "lskkq73xxzrmzxusw3ot53swq9an5qqt7orzpubku",
                        "tokenID": "0400000000000000",
                        "availableBalance": "100000000000000",
                        "lockedBalances": []
                    },

And am getting this error while building the genesis block: Error: Stored total supply is non zero but cannot be computed.

I then proceeded to add this to the genesis assets:

                    {
                        "tokenID": "0400000000000000",
                        "totalSupply": "100000000000000"
                    },

But that didn't solve the issue.

Which version(s) does this affect? (Environment, OS, etc...)

Linux Ubuntu, x86_64

ishantiw commented 7 months ago

This issue was on DEX due to missing escrow account entry of Token module in genesis-assets