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

[contract subscription] #688

Open
tools4com opened this issue Sep 27, 2024 · 3 comments
Open

[contract subscription] #688

tools4com opened this issue Sep 27, 2024 · 3 comments

Comments

@tools4com
Copy link

The filed functionName in contract_transaction_receipts table is always null.
The processing returns all the values correctly except this field
Below an example for a transaction record returned by a contract subscription

{
records: [
{
chainId: 97,
blockNumber: 44242489,
contractAddress: "0xef8a7558396bc99b9b5a385385870b2104d03d38",
contractId: "97:0xef8a7558396bc99b9b5a385385870b2104d03d38",
transactionHash: "0x56f47c99cde9d66464b3bf8bb85572ada67824a5e3b9ada4d18ddced92c954b6",
blockHash: "0x35e4584bfe69181c21092663a0b939b4bb3d6868b74b7f50524a8e943bec18c7",
timestamp: "2024-09-27 14:42:44",
data: "0x32434a2e0000000000000000000000000391b35d7e1374e4abfdb54df4ca3953285bc482000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000103132333435363738412e544e2e62326200000000000000000000000000000000",
to: "0xef8a7558396bc99b9b5a385385870b2104d03d38",
from: "0xf728a22feaac6a993eee648ee34dfa7e09067adf",
value: "0",
transactionIndex: 1,
gasUsed: "269227",
effectiveGasPrice: "5500000000",
status: 1,
createdAt: "2024-09-27 14:42:46.428",
updatedAt: "2024-09-27 14:42:46.428",
functionName: null
}
],
results: 1
}
@tools4com
Copy link
Author

A litlle change should be applyed to processTransactionReceiptsWorker.js under worker/tasks

let functionName = await getFunctionName({ contract: config.contract, data: transaction.input, }); if (config.functions.length > 0) { if (!config.functions.includes(functionName)) { // This transaction is not for a subscribed function name. continue; } }
and add :
functionName:functionName,

@arcoraven
Copy link
Contributor

Is your contract subscription set up to filter transaction receipts for a particular function name?

There's an undocumented behavior here:
functionName is not parsed if your contract subscription is not filtering on any function names. The reason an optimization to not query the function name unless it was critical.

That said this call is highly cached so it shouldn't have that much of a performance impact. Here's a PR that will always parse the function name for all receipts, even if you aren't filtering by any.

@tools4com
Copy link
Author

tools4com commented Oct 1, 2024

Thx for ur response,
I think you should modify receipts.push to add
functionName:functionName,

image

regards,

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