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

Inconsistent provided data #205

Open
moreei opened this issue Feb 6, 2025 · 2 comments
Open

Inconsistent provided data #205

moreei opened this issue Feb 6, 2025 · 2 comments

Comments

@moreei
Copy link

moreei commented Feb 6, 2025

Hey, I'm currently playing with your stuff, that's really cool, but I'm having a strange behavior when I'm using the decodeTransaction() method.

I use that transaction for testing:

https://etherscan.io/tx/0x3bc3e038a3934b4273bb532ee72f01546109a65b9f5e772083a43ddafed1cb0f

Sometimes is doesn't giving me all the actual transfers, an error is shown on that case:

timestamp=2025-02-05T08:57:34.093Z level=ERROR fiber=#4 message="Logs decode errors: [{"message":"Could not decode log 0x456FB056a8D118300B624D3AEE3864e685ae086C Encoded event signature "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1" not found on ABI.\nMake sure you are using the correct ABI and that the event exists on it.\nYou can look up the signature here: ...

[
  {
    type: 'ERC20',
    name: 'Tether USD',
    symbol: 'USDT',
    address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
    amount: '861.50328',
    to: '0x3b42df4D64623468349b817DC25d0B633855f1eA',
    from: '0x11b815efB8f581194ae79006d24E0d814B7697F6'
  }
]

But sometimes, I run the same thing and it works, no error displayed:

[
  {
    type: 'ERC20',
    name: 'Capsule Coin',
    symbol: 'CAPS',
    address: '0x03Be5C903c727Ee2C8C4e9bc0AcC860Cca4715e2',
    amount: '20000',
    to: '0x456FB056a8D118300B624D3AEE3864e685ae086C',
    from: '0x3b42df4D64623468349b817DC25d0B633855f1eA'
  },
  {
    type: 'ERC20',
    name: 'Wrapped Ether',
    symbol: 'WETH',
    address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
    amount: '0.491934254582490252',
    to: '0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B',
    from: '0x456FB056a8D118300B624D3AEE3864e685ae086C'
  },
  {
    type: 'ERC20',
    name: 'Tether USD',
    symbol: 'USDT',
    address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
    amount: '861.50328',
    to: '0x3b42df4D64623468349b817DC25d0B633855f1eA',
    from: '0x11b815efB8f581194ae79006d24E0d814B7697F6'
  },
  {
    type: 'ERC20',
    name: 'Wrapped Ether',
    symbol: 'WETH',
    address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
    amount: '0.491934254582490252',
    to: '0x11b815efB8f581194ae79006d24E0d814B7697F6',
    from: '0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B'
  }
]

I'm trying to detect when it has an error, to retry if this is the case, but the DecodedTransaction.errors property is empty when that error case is happening. Looks like the errors come from this:

const logsErrors = decodedLogs.filter(Either.isLeft).map((r) => r.left)

But that data is not available on the final DecodedTransaction object given.

@Ferossgp
Copy link
Member

Ferossgp commented Feb 8, 2025

Hey @moreei, thanks for filling up this issue. Just to confirm, are you using an in-memory caching?

At the moment, loop decoder will slurp all the errors related to contract loading. By default, Etherscan will limit API to 5 requests per second, and on first run when all contract are missing in cache it will send 7 requests for this transaction. We are looking to add a rate limit to our batching and a retry on the ABI loader strategy.

With a persistent database of ABI's the transaction should decode successfully https://loop-decoder-web.vercel.app/decode/1/0x3bc3e038a3934b4273bb532ee72f01546109a65b9f5e772083a43ddafed1cb0f

In the meantime, if you are using Effect API, you can start with built-in SQL and an SQLite database https://loop-decoder.3loop.io/guides/sql-stores/

@moreei
Copy link
Author

moreei commented Feb 10, 2025

Hey @Ferossgp, thanks for your reply. I was indeed using the simple Vanilla implementation with no database.
I implemented the Effect version with the persistent database, that's better, it just fails the first time, when there's nothing in the database. It should be related to the max requests per second that you are talking about as I see the database grow after running the command a second time for the same transaction.

Ferossgp added a commit that referenced this issue Feb 11, 2025
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