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

SearchTx timeouts #1415

Closed
dimiandre opened this issue Apr 28, 2023 · 4 comments · Fixed by #1411
Closed

SearchTx timeouts #1415

dimiandre opened this issue Apr 28, 2023 · 4 comments · Fixed by #1411
Milestone

Comments

@dimiandre
Copy link
Member

dimiandre commented Apr 28, 2023

I'm trying to search a CreateValidator Tx

With the current code, the HTTP request always timeout or get socket hang up

        let client = await StargateClient.connect("https://rpc-juno.mib.tech")

        let txs = await client.searchTx({
            tags: [{ key: "create_validator.validator", value: "junovaloper1hvhyunq7qvykzvrcnhjj4xnkcla58xusk6r60g" }],
        });

errors

cloudflare proxy

(node:11661) UnhandledPromiseRejectionWarning: Error: Request failed with status code 502

direct tcp

(node:11835) UnhandledPromiseRejectionWarning: Error: socket hang up

Using Juno CLI to query instead is always almost instant
junod q txs --events create_validator.validator=junovaloper1hvhyunq7qvykzvrcnhjj4xnkcla58xusk6r60g

that made me wonder why, so I did some logs and I notice some differences between the RPC call made by cosmjs and the one made from CLI

CosmJS:

{
  jsonrpc: '2.0',
  id: 483169536733,
  method: 'tx_search',
  params: {
    query: "create_validator.validator='junovaloper1hvhyunq7qvykzvrcnhjj4xnkcla58xusk6r60g' AND tx.height>=0 AND tx.height<=9007199254740991",
    page: '1'
  }
}

CLI:

{
  jsonrpc: '2.0',
  id: 0,
  method: 'tx_search',
  params: {
    order_by: '',
    page: '1',
    per_page: '30',
    prove: true,
    query: "create_validator.validator='junovaloper1hvhyunq7qvykzvrcnhjj4xnkcla58xusk6r60g'"
  }
}

The default value for max tx.height is too high! By manually setting it in fact the 502 error is gone

       let client = await StargateClient.connect("https://rpc-juno.mib.tech")

        let txs = await client.searchTx({
            tags: [{ key: "create_validator.validator", value: "junovaloper1hvhyunq7qvykzvrcnhjj4xnkcla58xusk6r60g" }],
        }, { maxHeight: 8027955})
        
        // all good 

I think we should entirely remove height filters if not specified

@dimiandre
Copy link
Member Author

Additional note, this example code is super quick (<100 ms per query)

let response = await axios.post("https://rpc-juno.mib.tech/", {
            jsonrpc: "2.0",
            id: 0,
            method: 'tx_search',
            params: {
                query: `create_validator.validator='${val.operator_address}'`,
                page: "1"
            }
        })
        ```

@webmaster128
Copy link
Member

Thank you for debugging this. This sounds like a Tendermint bug to me then. Why should an additional numeric filter cause such a behaviour?

@dimiandre
Copy link
Member Author

Thank you for debugging this. This sounds like a Tendermint bug to me then. Why should an additional numeric filter cause such a behaviour?

that's a good question, I'll try to dig more into this

@webmaster128
Copy link
Member

I think the current abstraction level of searchTx is unsustainable anyways. I am considering to replace it with a much lower level version that avoids this sort of magic.

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

Successfully merging a pull request may close this issue.

2 participants