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

Restore getProgramAccounts spl-token secondary-index functionality #20993

Merged
merged 5 commits into from
Oct 26, 2021

Conversation

CriesofCarrots
Copy link
Contributor

@CriesofCarrots CriesofCarrots commented Oct 26, 2021

Problem

#20185 changed the comparison in get_spl_token_owner_filter() and get_spl_token_mint_filter() to check for MemcmpEncodedBytes::Base58, which no longer matches the default when the field is not provided (MemcmpEncodedBytes::Binary). This broke a lot of users querying for token accounts by owner and mint, since the Tokenkeg program-owner secondary index is excluded on mainnet-beta RPC nodes.

Summary of Changes

Optimize filters earlier in order to allow get_spl_token_owner_filter() and get_spl_token_mint_filter() to match on any provided encoding.
Also, compress rpc_filter match statements, which bothered me.

t-nelson
t-nelson previously approved these changes Oct 26, 2021
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

rpc/src/rpc.rs Show resolved Hide resolved
rpc/src/rpc.rs Show resolved Hide resolved
client/src/rpc_filter.rs Show resolved Hide resolved
@mergify mergify bot dismissed t-nelson’s stale review October 26, 2021 18:56

Pull request has been modified.

@CriesofCarrots CriesofCarrots added the automerge Merge this Pull Request automatically once CI passes label Oct 26, 2021
@codecov
Copy link

codecov bot commented Oct 26, 2021

Codecov Report

Merging #20993 (235b7a8) into master (43168e6) will decrease coverage by 0.0%.
The diff coverage is 45.1%.

@@            Coverage Diff            @@
##           master   #20993     +/-   ##
=========================================
- Coverage    81.5%    81.5%   -0.1%     
=========================================
  Files         496      496             
  Lines      139850   139854      +4     
=========================================
- Hits       114037   114029      -8     
- Misses      25813    25825     +12     

@mergify mergify bot merged commit b2f6cfb into solana-labs:master Oct 26, 2021
mergify bot pushed a commit that referenced this pull request Oct 26, 2021
…20993)

* Allow get_spl_token_X_filters to match on any encoding, and optimize earlier

* Remove redundant optimize calls

* Compress match statements

* Add method docs, including note to use optimize_filters before spl-token checks

* Add logs

(cherry picked from commit b2f6cfb)

# Conflicts:
#	rpc/src/rpc.rs
mergify bot pushed a commit that referenced this pull request Oct 26, 2021
…20993)

* Allow get_spl_token_X_filters to match on any encoding, and optimize earlier

* Remove redundant optimize calls

* Compress match statements

* Add method docs, including note to use optimize_filters before spl-token checks

* Add logs

(cherry picked from commit b2f6cfb)

# Conflicts:
#	rpc/src/rpc.rs
mergify bot added a commit that referenced this pull request Oct 26, 2021
…ackport #20993) (#21005)

* Restore getProgramAccounts spl-token secondary-index functionality (#20993)

* Allow get_spl_token_X_filters to match on any encoding, and optimize earlier

* Remove redundant optimize calls

* Compress match statements

* Add method docs, including note to use optimize_filters before spl-token checks

* Add logs

(cherry picked from commit b2f6cfb)

# Conflicts:
#	rpc/src/rpc.rs

* Fix conflict

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
mergify bot added a commit that referenced this pull request Oct 27, 2021
…ackport #20993) (#21004)

* Restore getProgramAccounts spl-token secondary-index functionality (#20993)

* Allow get_spl_token_X_filters to match on any encoding, and optimize earlier

* Remove redundant optimize calls

* Compress match statements

* Add method docs, including note to use optimize_filters before spl-token checks

* Add logs

(cherry picked from commit b2f6cfb)

# Conflicts:
#	rpc/src/rpc.rs

* Fix conflict

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
dankelleher pushed a commit to identity-com/solana that referenced this pull request Nov 24, 2021
…olana-labs#20993)

* Allow get_spl_token_X_filters to match on any encoding, and optimize earlier

* Remove redundant optimize calls

* Compress match statements

* Add method docs, including note to use optimize_filters before spl-token checks

* Add logs
frits-metalogix added a commit to identity-com/solana that referenced this pull request Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants