Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Decode native-program and sysvar accounts #11463

Merged
merged 6 commits into from
Aug 9, 2020

Conversation

CriesofCarrots
Copy link
Contributor

Problem

RPC endpoints getAccountInfo and getProgramAccounts support returning decoded account information for particular programs (Nonce, Vote, and SPL Token). Other native programs and sysvars need similar handling.

Summary of Changes

  • Decode Sysvar accounts
  • Decode Config program accounts (includes moving validator-info into this crate)
  • Decode Stake program accounts

Fixes #11206

@CriesofCarrots CriesofCarrots force-pushed the decode-native-accounts branch 3 times, most recently from 5508085 to 766bfb1 Compare August 8, 2020 03:16
@codecov
Copy link

codecov bot commented Aug 8, 2020

Codecov Report

Merging #11463 into master will increase coverage by 0.0%.
The diff coverage is 84.8%.

@@           Coverage Diff            @@
##           master   #11463    +/-   ##
========================================
  Coverage    81.7%    81.7%            
========================================
  Files         323      327     +4     
  Lines       74987    75398   +411     
========================================
+ Hits        61330    61668   +338     
- Misses      13657    13730    +73     

Copy link
Contributor

@jstarry jstarry left a comment

Choose a reason for hiding this comment

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

Looks awesome! My main gripe is around u64's in JSON. I think Slot, Epoch, and UnixTimestamp are all fine since they will never get larger than 2^53. But I think a convention could be always returning lamports as string (even if the rent fee will never be more than 2^53 lamports)

@CriesofCarrots CriesofCarrots force-pushed the decode-native-accounts branch 2 times, most recently from 2d31939 to 2cbb325 Compare August 8, 2020 17:11
@CriesofCarrots CriesofCarrots force-pushed the decode-native-accounts branch from 2cbb325 to 6181f17 Compare August 8, 2020 18:02
jstarry
jstarry previously approved these changes Aug 9, 2020
Copy link
Contributor

@jstarry jstarry left a comment

Choose a reason for hiding this comment

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

lgtm!

@CriesofCarrots CriesofCarrots force-pushed the decode-native-accounts branch from 6181f17 to a3918a0 Compare August 9, 2020 06:29
@mergify mergify bot dismissed jstarry’s stale review August 9, 2020 06:30

Pull request has been modified.

@CriesofCarrots CriesofCarrots added the automerge Merge this Pull Request automatically once CI passes label Aug 9, 2020
@CriesofCarrots
Copy link
Contributor Author

@mvines , post-merge comments welcome, but moving forward in order to sneak it in to the api node upgrade set tomorrow.

@mergify mergify bot merged commit a9f7686 into solana-labs:master Aug 9, 2020
mergify bot pushed a commit that referenced this pull request Aug 9, 2020
* Pass pubkey in to account-decoder for sysvars

* Decode sysvar accounts

* Decode config accounts; move validator-info lower

* Decode stake accounts

* Review comments

* Stringify any account lamports and epochs that can be set to u64::MAX

(cherry picked from commit a9f7686)

# Conflicts:
#	Cargo.lock
#	account-decoder/Cargo.toml
#	core/src/rpc.rs
mergify bot pushed a commit that referenced this pull request Aug 9, 2020
* Pass pubkey in to account-decoder for sysvars

* Decode sysvar accounts

* Decode config accounts; move validator-info lower

* Decode stake accounts

* Review comments

* Stringify any account lamports and epochs that can be set to u64::MAX

(cherry picked from commit a9f7686)

# Conflicts:
#	Cargo.lock
#	account-decoder/Cargo.toml
mergify bot added a commit that referenced this pull request Aug 9, 2020
* Decode native-program and sysvar accounts (#11463)

* Pass pubkey in to account-decoder for sysvars

* Decode sysvar accounts

* Decode config accounts; move validator-info lower

* Decode stake accounts

* Review comments

* Stringify any account lamports and epochs that can be set to u64::MAX

(cherry picked from commit a9f7686)

# Conflicts:
#	Cargo.lock
#	account-decoder/Cargo.toml

* Fix conflicts

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 Aug 9, 2020
* Decode native-program and sysvar accounts (#11463)

* Pass pubkey in to account-decoder for sysvars

* Decode sysvar accounts

* Decode config accounts; move validator-info lower

* Decode stake accounts

* Review comments

* Stringify any account lamports and epochs that can be set to u64::MAX

(cherry picked from commit a9f7686)

# Conflicts:
#	Cargo.lock
#	account-decoder/Cargo.toml
#	core/src/rpc.rs

* Fix conflicts

* Ignore clippy lint affecting rust <v1.44.0

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
@CriesofCarrots CriesofCarrots deleted the decode-native-accounts branch September 1, 2020 19:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support decoding additional account types (Stake, Config, sysvar, etc)
2 participants