hyperion-history-api icon indicating copy to clipboard operation
hyperion-history-api copied to clipboard

[BUG] When there are more than 2 identical actions in the same Transaction, there will only be one data

Open devmoondev opened this issue 1 year ago • 2 comments

Case

Send rewards to users. The two rewards are generated from different activities, so they need to be sent separately. However, the amount of the rewards is the same, resulting in two identical actions in the same transaction.

Sample code

await api.transact({
    actions: [{
        account: "eosio.token",
        name: 'transfer',
        authorization: [{
            actor: 'accountaaaaaa',
            permission: 'active',
        }],
        data: {
            from: 'accountaaaaaa',
            to: 'accountbbbbbb',
            quantity: '0.0001 SYS',
            memo: 'transfer'
        },
    },
    {
        account: "eosio.token",
        name: 'transfer',
        authorization: [{
            actor: 'accountaaaaaa',
            permission: 'active',
        }],
        data: {
            from: 'accountaaaaaa',
            to: 'accountbbbbbb',
            quantity: '0.0001 SYS',
            memo: 'transfer'
        },
    },
],
})

Querying the data in ES reveals that there is only one action record in this transaction, and the second will be lost.

devmoondev avatar May 14 '24 01:05 devmoondev

Unfortunately, on the current version the deduplication happens based on the act_digest per action inside a transaction. Removing the deduplication can greatly increase storage needs for all operators due to misuse of receipt notifications and also spamming.

We are working on improved processing and optimizations for future releases.

@devmoondev my recommendation for the smart contract developer is to use a different memo if this data is important to be indexed, this will make the act_digest be different and you should get both actions in

igorls avatar May 18 '24 06:05 igorls

@devmoondev my recommendation for the smart contract developer is to use a different memo if this data is important to be indexed, this will make the act_digest be different and you should get both actions in

Thank you for your patient reply. This problem can be avoided once discovered, but for those who encounter it for the first time, there will be a lot of misunderstandings, thinking that their coins are lost. I currently separate actions into different transactions.

devmoondev avatar May 31 '24 05:05 devmoondev