eosrio / hyperion-history-api

Scalable Full History API Solution for Antelope (former EOSIO) based blockchains
https://hyperion.docs.eosrio.io
Other
125 stars 72 forks source link

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

Open devmoondev opened 4 months ago

devmoondev commented 4 months ago

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.

igorls commented 4 months ago

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

devmoondev commented 4 months ago

@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.