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

Ensure tx search returns useful error messages #1126

Closed
cwgoes opened this issue Jun 3, 2018 · 17 comments
Closed

Ensure tx search returns useful error messages #1126

cwgoes opened this issue Jun 3, 2018 · 17 comments

Comments

@cwgoes
Copy link
Contributor

cwgoes commented Jun 3, 2018

We should make sure searching for transactions, if the node wouldn't have indexed a transaction with the tag being searched for, returns an error instead of just returning no transactions.

@zramsay
Copy link
Contributor

zramsay commented Jun 4, 2018

related to #1021

@tnachen
Copy link
Contributor

tnachen commented Aug 30, 2019

@cwgoes Is this already fixed? Wonder if we can close this

@cwgoes
Copy link
Contributor Author

cwgoes commented Aug 30, 2019

@cwgoes Is this already fixed? Wonder if we can close this

I'm not sure - this issue is more than a year old - but not specifically to my knowledge.

@alexanderbez
Copy link
Contributor

alexanderbez commented Sep 2, 2019

You'll get the following response when querying for txs by bogus or non-existing events:

{
    "count": "0",
    "limit": "30",
    "page_number": "1",
    "page_total": "0",
    "total_count": "0",
    "txs": []
}

What exactly are you looking to add and under which scenarios @cwgoes ?

@cwgoes
Copy link
Contributor Author

cwgoes commented Sep 2, 2019

Ah, the question was not that, but rather what happens when you query for an event that a node is not configured to index, and so will return no transactions even if transactions would have matched had the node indeed been indexing that event (tag).

@alexanderbez
Copy link
Contributor

@cwgoes I see. Sounds like you want a friendly error returned signaling that the underlying RPC node either has indexing disabled or not enabled for those events types? Correct me if I'm wrong.

@cwgoes
Copy link
Contributor Author

cwgoes commented Sep 3, 2019

@cwgoes I see. Sounds like you want a friendly error returned signaling that the underlying RPC node either has indexing disabled or not enabled for those events types? Correct me if I'm wrong.

Precisely!

@alexanderbez
Copy link
Contributor

alexanderbez commented Sep 3, 2019

Got it. One immediate way to do this would be to read/load the Tendermint TxIndex config into the CLIContext and use this info when processing requests in QueryTxsByEvents.

@jackzampolin jackzampolin added this to the v0.38.0 milestone Sep 5, 2019
@alexanderbez alexanderbez removed this from the v0.38.0 milestone Nov 30, 2019
@tac0turtle tac0turtle removed the REST label May 9, 2022
@cipherzzz
Copy link
Contributor

@alexanderbez @tac0turtle - you can assign this to me. I will work on it when I finish - #13703

@tac0turtle
Copy link
Member

done, let us know if you need any help

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 20, 2023

done, let us know if you need any help

wow, amazing long-term issue management 🎉

@cipherzzz
Copy link
Contributor

cipherzzz commented Feb 18, 2023

Got it. One immediate way to do this would be to read/load the Tendermint TxIndex config into the CLIContext and use this info when processing requests in QueryTxsByEvents.

Can you explain this to me a little more? Not sure where to read the TxConfig in from Comet and how to add it to the Context @alexanderbez

@alexanderbez
Copy link
Contributor

So this would probably happen somewhere in the server package. You already have access to the entire CometBFT config in interceptConfigs. There you could grab the CometBFT's indexing config and push that into the Context.

I will note however, I'm not sure what CometBFT's long-term plans are on the indexer.

@cipherzzz
Copy link
Contributor

Ok, so I think that I'm grabbing the list of events to index correctly here @alexanderbez

Query.go

// QueryTxsByEventsCmd returns a command to search through transactions by events.
func QueryTxsByEventsCmd() *cobra.Command {
....
			clientCtx, err := client.GetClientQueryContext(cmd)
			if err != nil {
				return err
			}

                         # Is this correct?
			cfg, err := config.GetConfig(clientCtx.Viper)
			if err != nil {
				return err
			}
			fmt.Println("indexEvents", cfg.IndexEvents)
...

The issue is that the slice is empty - which I guess according to this line would mean that all events are indexed?

Config.go

// BaseConfig defines the server's basic configuration
type BaseConfig struct {
...

	// IndexEvents defines the set of events in the form {eventType}.{attributeKey},
	// which informs CometBFT what to index. If empty, all events will be indexed.
	IndexEvents []string `mapstructure:"index-events"`
...

Is it reasonable to assume that if no events are returned for a given query and the IndexEvents are empty that

  • The event does not exist
  • It was removed in pruned tx(s)

Also, if there are events defined, we can check against them to verify they are an indexed event...

@alexanderbez
Copy link
Contributor

@cipherzzz I know you spent some time thinking about this problem, but I simply don't know if tackling this is worth it. First, the indexer config relates to Comet's (now legacy) proprietary indexer. It can also change over time and not watch what has been indexed thus far. Simply put, the config can change all the time and can sometimes not relate to what's actually indexed.

@cipherzzz
Copy link
Contributor

Yeah, that's fine - thanks for the response. I'm definitely not looking to waste anyone's time if this is a moving target. I guess we can close this issue

@tac0turtle
Copy link
Member

now that we pass everything to comet, we shouldnt do extra wrapping. thanks for looking into the issue ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants