-
Notifications
You must be signed in to change notification settings - Fork 13
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
Cannot get logs from HRC20 transactions #1
Comments
As we discussed with Matt, Dennis, might even go on core level, because when getTransactionReceipt is performed it uses core GetReceipts method https://github.com/harmony-one/harmony/blob/master/internal/hmyapi/transactionpool.go#L283 which just wraps core GetReceiptsByHash method https://github.com/harmony-one/harmony/blob/master/core/blockchain.go#L720 which is pretty straightforward on how it should fetch tx logs. |
I compared it with Ethereum implementation for https://github.com/ethereum/go-ethereum/blob/master/core/blockchain.go#L758 GetReceipts, Log and Receipt struct and they look almost identical with not significant changes. But still Receipts returned with no logs for txs or they incorrectly formed at the beggining when transaction is added to block. Need to debug core level. |
https://github.com/harmony-one/harmony/blob/master/internal/hmyapi/filters/api.go#L272 this is proper method to fetch blocks which uses FilterCriteria as param.https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs how it works for Ethereum. It subscribes to logs for smart contract or just returns past logs for it. |
Harmony-SDK uses that here https://github.com/harmony-one/sdk/blob/master/packages/harmony-network/src/subscriptions/LogSub.ts and https://github.com/harmony-one/sdk/blob/master/packages/harmony-contract/src/events/event.ts. |
Still it doesn't answer question why logs on hmy_getTransactionReceipt are not returned and why they not fetched from core. blockchain API simply forwards it from core. |
How can we debug it @mattlockyer @denniswon @john-harmony. Any engineer can set some debug utils logging at blockchain core method GetReceiptsByHash and see if len of logs fetched for some block when using hmy_getTransactionReceipt not zero. If it's zero then really discuss with core engineers and set up milestone to develop and debug this issue because in that case it's not gonna be fast fix. |
Debugging the core protocol at: I added the following: Using a deployment of https://github.com/harmony-one/HRC/blob/master/build/contracts/HarmonyERC20.json I called the transfer function, which emits an event (it should be in the logs)! Here are the logs after 1 contract deployment and transfer: And after a second contract deployment and HRC20 transfer: In both cases there are NEVER any logs for the receipts... There are differences between Ethereum: And Harmony's implementation: My conclusion would be that there's something mis-matched in how we store and retrieve the logs. This may also explain why every TX has a logsBloom of some length but filled with zeros... |
@LeoHChen your thoughts? |
@john-harmony @mattlockyer @LeoHChen as it's not properly processed very deep at core level probably we should give a task to dedicated core engineer to work on that but we might be out of hands now |
Probably in some testing someone commented this line in the core protocol: Uncommenting this yields the desired result from an HRC20 token transfer: In case this was done purposefully... We will need someone involved in with the core protocol to uncomment and properly stress test the emission and storage of logs on our network. |
This issue is tracking the lack of logs returned by Harmony Core SDK + RPC calls from the core protocol.
Specifically, the absence of logs for transactions.
See #2 for issues related directly to SDK / RPC
When calling directly via RPC by using the transaction id:
The response has no logs and an odd logsBloom value:
Will be uploading an example and some tests to HRC repo shortly.
The text was updated successfully, but these errors were encountered: