Closed Walter-Phillips closed 11 months ago
@Walter-Phillips What network are you on? And just to be sure, you can't start indexing at blocks greater than 4,000,000, but you're still able to index blocks greater than that, right?
Hey @deekerno we're on beta-4. I haven't let the indexer run long enough to get to blocks past 4,000,000 from block 1, so I'm not sure.
Can you start indexing from a number lower than 4,000,000 but still close to it (e.g. 3.9M, 3.5M, etc.) and see if it indexes past that point?
@deekerno, doing that now and will let you know how it goes.π«‘
@deekerno This is what ended up happening, didn't make it very far. Tried form 3.9 and 3.99.
I'll take a look at your repo and see if I can replicate the issue.
Thank you, appreciate itππΎ
@Walter-Phillips: Oddly enough, I was able to replicate your issue with the main
branch of your repository on a few blocks:
block 3909602
2023-10-20T19:25:45.727653Z ERROR fuel_indexer::executor: 980: Indexer(sail.sail_indexer) WASM execution failed: Panic.
2023-10-20T19:25:45.730670Z ERROR fuel_indexer::service: 396: Indexer(sail.sail_indexer) terminated with an error: panicked at src/lib.rs:4:1:
Failed decoding.: InvalidData("tried to read 64 bytes from response but only had 32 remaining!")
block 3911066
2023-10-20T19:30:17.896587Z ERROR fuel_indexer::executor: 980: Indexer(sail.sail_indexer) WASM execution failed: Panic.
2023-10-20T19:30:17.898488Z ERROR fuel_indexer::service: 396: Indexer(sail.sail_indexer) terminated with an error: panicked at src/lib.rs:4:1:
Failed decoding.: InvalidData("tried to read 64 bytes from response but only had 40 remaining!")
block 3911068
2023-10-20T19:33:01.166614Z ERROR fuel_indexer::executor: 980: Indexer(sail.sail_indexer) WASM execution failed: Panic.
2023-10-20T19:33:01.168039Z ERROR fuel_indexer::service: 396: Indexer(sail.sail_indexer) terminated with an error: panicked at src/lib.rs:4:1:
Failed decoding.: Utf8Error(Utf8Error { valid_up_to: 14, error_len: Some(1) })
block 3911093
2023-10-20T19:34:18.374232Z ERROR fuel_indexer::executor: 980: Indexer(sail.sail_indexer) WASM execution failed: Panic.
2023-10-20T19:34:18.375747Z ERROR fuel_indexer::service: 396: Indexer(sail.sail_indexer) terminated with an error: panicked at src/lib.rs:4:1:
Failed decoding.: InvalidData("tried to read 64 bytes from response but only had 40 remaining!")
But I do not see the same errors when running a more complex indexer (in this case, that would be our block explorer). That leads me to believe that the indexer module on the main
branch has something that's causing these errors. I'm not exactly sure what that is yet, but I figured I'd share it with you first.
@deekerno Cool, thank you. I'll remake the indexer that we have from scratch and see what happens
@deekerno I remade an indexer from the quickstart guide. I incrementally made changes and it failed whenever I added an abi. I've tried two abis but they are both ones from projects I've built. Going to try it with something from Sway applications. Could it be an incompatibility with the version of sway the abi gets made from and the indexer?
@Walter-Phillips I'll look into the ABI idea today. ππ½
@Walter-Phillips Can you invite @lostman to your repository as well? That way, you can have the entire indexer team looking into the problem (I'm also up to my neck in revamping our GraphQL functionality π).
@deekerno no problem. Just sent the invite to @lostman. Good luck with the revamp :)).
@Walter-Phillips How are str[64]
ID fields constructed for your structs? I adjusted our codegen to output the type upon a failed decode:
block 3909602
Failed decoding.: InvalidData("tried to read 64 bytes from response but only had 32 remaining!")
-> Decoding CancelLimitOrder
block 3911066
Failed decoding.: InvalidData("tried to read 64 bytes from response but only had 40 remaining!")
-> Decoding TakeMarketOrder
block 3911068
Failed decoding.: Utf8Error(Utf8Error { valid_up_to: 14, error_len: Some(1) })
-> Decoding CreatePostOnly
block 3911093
Failed decoding.: InvalidData("tried to read 64 bytes from response but only had 40 remaining!")
-> Decoding TakeMarketOrder
It seems that there may be some issue around your strings?
@deekerno This is the sway struct. Right now in the client, we use the predicate address and convert it to a string. We're calling the uid helper on it in the handler which we no longer need, which could be the problem. I'll drop the uid helper and try indexing again from 4,000,000.
I am a bit confused about it trying to decode Market Orders and Post Onlys, we haven't created any on testnet
Also, how were you able to edit the codegen?
That's certainly interesting. π€ and I'm fairly sure that dropping the UID helper (I'd recommend to use something like the get_or_create()
method here [which I have yet to document]) will help as the decoding failure is happening in the #[indexer]
macro at the ABI decoding step from the SDK; specifically, it's happening here:
let decoded = ABIDecoder::decode_single(&#type_tokens::param_type(), &data).expect("Failed decoding.");
let obj = #type_tokens::from_token(decoded).expect("Failed detokenizing.");
self.#name.push(obj);
So it's definitely within code that we wrote; I'm just wondering if there's something special that you guys have done that we should try to replicate.
re: editing the codegen -- I just adjusted the above part of the code in the fuel-indexer
repository and rebuilt your indexer module to log the tokens for the failed type.
@deekerno Tried doing it like that and got the same error, without using the id from our client. There isn't anything special we're doing as far as I know. I also attached examples of us creating the limit order struct in rust and ts, in our tests.
Yeah, I think it's definitely something on our side. We'll put our proverbial heads together and see what we can find in the next day or so. ππ½
Thank you. I know you guys are busy so I really appreciate it. Let me know if you need anything from me.
@Walter-Phillips Could you share the link to your repo btw? (I know you invited us to the repo, but I don't remember the link)
@Walter-Phillips I noticed that your contracts are using forc
versions ranging from v0.42.1
to v0.45.0
. There were a few changes to how strings are represented starting with v0.46.0
. Additionally, the indexer does its best to keep up with the latest versions of the Fuel ecosystem, so when there's a disparity between a contract's ABI and what the indexer has been developed for, it can potentially result in things like this. Do you mind updating your contracts to use the latest forc
version available through the beta-4
channel through fuelup
? You may need to adjust your contracts to incorporate the String
improvements.
@deekerno I'll look into that and see if it helps, would explain why it's an issue even for types we haven't logged to testnet yet
@deekerno updated to 0.46 and had the same error. I am still using string arrays for the IDs, should I be using string slices?
@deekerno Where are we on this? @Walter-Phillips Did you ever get this figured out?
@ra0x3 I was able to fix this by changing how we were handling logs in our contracts and updating everything to newer versions. @deekerno Thanks for the help.
Issue
Thanks for opening an issue on the Fuel Indexer project.
*If you're an internal FuelLabs contributor, please feel free to remove this template when creating issues, as this template is meant for external users and contributors.
Prerequisites
Description
Steps to Reproduce
Please list the steps required to reproduce your issue in detail.
Expected behavior: Able to index from any block
Actual behavior: Can only index from blocks less than 4000000
Versions
Please list what version of indexer components you're using. Latest is currently .
fuel-indexer
: 0.21.0forc-index
: 0.21.0The staging branch should have everything you will need