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

cli: Add transaction-history #9614

Merged
merged 4 commits into from
Apr 21, 2020
Merged

cli: Add transaction-history #9614

merged 4 commits into from
Apr 21, 2020

Conversation

mvines
Copy link
Contributor

@mvines mvines commented Apr 20, 2020

Show historical transactions affecting the given address, ordered based on the slot in which they were confirmed in from lowest to highest slot

$  solana transaction-history  <ADDRESS> [optional start slot] [optional end slot]

The output is just a list of transaction signatures. One could then run solana confirm -v <signature> to decode the full historical transaction. I opted to not plumb an option to decode the transactions directly into solana transaction-history for now, to avoid adding a ton of unintentional load to the RPC servers

Fixes #9453

cli/src/cluster_query.rs Outdated Show resolved Hide resolved
println!(
"Transactions affecting {} within slots [{},{}]",
address, start_slot, end_slot
);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is one subcommand for which it could be useful to return json. Could we create a Cli type and impl Display for niceties like this print statement and the signatures count below? (a la #9478 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that but didn't go for it since this command really is just cli window dressing over the same JSON RPC API. But my mind is open to be convinced

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, fair. I think since this has the potential to return a whole heap of data, request for json might come up, but we can refactor then.

@@ -42,6 +42,9 @@ pub enum RpcRequest {
MinimumLedgerSlot,
}

pub const MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS: usize = 256;
pub const MAX_GET_CONFIRMED_SIGNATURES_FOR_ADDRESS_SLOT_RANGE: u64 = 10_000;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to move this around the tree a little

@mvines
Copy link
Contributor Author

mvines commented Apr 21, 2020

The last commit changes the CLI interface to:

# last 10k slots
$ solana transaction-history LunaFpQkZsZVJL2P2BUqNDJqyVYqrw9buQnjQtMLXdK

# last 10 slots 
$ solana transaction-history LunaFpQkZsZVJL2P2BUqNDJqyVYqrw9buQnjQtMLXdK --limit 10 

# 10k slots ending at 123456
$ solana transaction-history LunaFpQkZsZVJL2P2BUqNDJqyVYqrw9buQnjQtMLXdK 123456 

# 10 slots ending at 123456
$ solana transaction-history LunaFpQkZsZVJL2P2BUqNDJqyVYqrw9buQnjQtMLXdK 123456 --limit 10 

wdyt?

Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Nice, I like this much better

println!(
"Transactions affecting {} within slots [{},{}]",
address, start_slot, end_slot
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, fair. I think since this has the potential to return a whole heap of data, request for json might come up, but we can refactor then.

@mvines mvines added automerge Merge this Pull Request automatically once CI passes and removed v1.0 labels Apr 21, 2020
@codecov
Copy link

codecov bot commented Apr 21, 2020

Codecov Report

Merging #9614 into master will decrease coverage by 0.0%.
The diff coverage is 18.9%.

@@           Coverage Diff            @@
##           master   #9614     +/-   ##
========================================
- Coverage    80.5%   80.5%   -0.1%     
========================================
  Files         279     279             
  Lines       63658   63708     +50     
========================================
+ Hits        51282   51290      +8     
- Misses      12376   12418     +42     

@solana-grimes solana-grimes merged commit 914b022 into solana-labs:master Apr 21, 2020
mergify bot pushed a commit that referenced this pull request Apr 21, 2020
automerge

(cherry picked from commit 914b022)
solana-grimes pushed a commit that referenced this pull request Apr 21, 2020
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.

Validator Unable to get Transaction/Account History
3 participants