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

Rpc: enable getConfirmedBlock and getConfirmedTransaction to return confirmed (not yet finalized) data #16142

Merged

Conversation

CriesofCarrots
Copy link
Contributor

@CriesofCarrots CriesofCarrots commented Mar 25, 2021

Problem

Despite their names, getConfirmedBlock and getConfirmedTransaction only return finalized data, forcing users to wait 30+ slots longer than necessary to get tx or block details.

Summary of Changes

  • Add Blockstore apis to return data for complete blocks and transactions, dropping the rooted requirement
  • Because the TransactionStatusService is async, add a method to track the highest slot with completely written statuses to ensure confirmed blocks are complete (will also need in getConfirmedSignaturesForAddress2)
  • Expose confirmed data in getConfirmedBlock and getConfirmedTransaction via the commitment parameter; default remains finalized
  • Return confirmed data in solana block <slot> and solana confirm <signature> -v

Follow-up work:

  • Support confirmed data in getConfirmedSignaturesForAddress2; handling in separate PR because blockstore api is so convoluted
  • Consider supporting confirmed data in getConfirmedBlocks and getConfirmedBlocksWithLimit; the former will need some rework a la Rpc: support extended config for getConfirmedBlock #15827 to retain backward compatibility while adding a config parameter
  • For v1.7, add getX methods and deprecate getConfirmedX methods

@CriesofCarrots
Copy link
Contributor Author

CriesofCarrots commented Mar 25, 2021

@carllin could you please review the first 3 commits, plus the logic identified in comment?

@CriesofCarrots CriesofCarrots force-pushed the truly-confirmed-block branch from c719a50 to 11bab32 Compare March 25, 2021 22:49
@codecov
Copy link

codecov bot commented Mar 26, 2021

Codecov Report

Merging #16142 (32d8d33) into master (17dca6d) will increase coverage by 0.0%.
The diff coverage is 85.9%.

@@            Coverage Diff            @@
##           master   #16142     +/-   ##
=========================================
  Coverage    79.9%    80.0%             
=========================================
  Files         409      410      +1     
  Lines      108093   109296   +1203     
=========================================
+ Hits        86457    87496   +1039     
- Misses      21636    21800    +164     

mvines
mvines previously approved these changes Mar 26, 2021
@mergify mergify bot dismissed mvines’s stale review March 26, 2021 18:22

Pull request has been modified.

@CriesofCarrots CriesofCarrots force-pushed the truly-confirmed-block branch from c925ac9 to 9bbeb60 Compare March 26, 2021 18:26
@CriesofCarrots CriesofCarrots force-pushed the truly-confirmed-block branch from 9bbeb60 to 32d8d33 Compare March 26, 2021 20:21
@CriesofCarrots CriesofCarrots merged commit 433f1ea into solana-labs:master Mar 26, 2021
mergify bot pushed a commit that referenced this pull request Mar 26, 2021
…onfirmed (not yet finalized) data (#16142)

* Add Blockstore block and tx apis that allow unrooted responses

* Add TransactionStatusMessage, and send on bank freeze; also refactor TransactionStatusSender

* Track highest slot with tx-status writes complete

* Rename and unpub fn

* Add commitment to GetConfirmed input configs

* Support confirmed blocks in getConfirmedBlock

* Support confirmed txs in getConfirmedTransaction

* Update sigs-for-addr2 comment

* Enable confirmed block in cli

* Enable confirmed transaction in cli

* Review comments

* Rename blockstore method

(cherry picked from commit 433f1ea)

# Conflicts:
#	core/src/replay_stage.rs
#	core/src/rpc.rs
#	core/src/validator.rs
mergify bot pushed a commit that referenced this pull request Mar 26, 2021
…onfirmed (not yet finalized) data (#16142)

* Add Blockstore block and tx apis that allow unrooted responses

* Add TransactionStatusMessage, and send on bank freeze; also refactor TransactionStatusSender

* Track highest slot with tx-status writes complete

* Rename and unpub fn

* Add commitment to GetConfirmed input configs

* Support confirmed blocks in getConfirmedBlock

* Support confirmed txs in getConfirmedTransaction

* Update sigs-for-addr2 comment

* Enable confirmed block in cli

* Enable confirmed transaction in cli

* Review comments

* Rename blockstore method

(cherry picked from commit 433f1ea)

# Conflicts:
#	core/src/replay_stage.rs
mergify bot added a commit that referenced this pull request Mar 27, 2021
…onfirmed (not yet finalized) data (bp #16142) (#16160)

* Rpc: enable getConfirmedBlock and getConfirmedTransaction to return confirmed (not yet finalized) data (#16142)

* Add Blockstore block and tx apis that allow unrooted responses

* Add TransactionStatusMessage, and send on bank freeze; also refactor TransactionStatusSender

* Track highest slot with tx-status writes complete

* Rename and unpub fn

* Add commitment to GetConfirmed input configs

* Support confirmed blocks in getConfirmedBlock

* Support confirmed txs in getConfirmedTransaction

* Update sigs-for-addr2 comment

* Enable confirmed block in cli

* Enable confirmed transaction in cli

* Review comments

* Rename blockstore method

(cherry picked from commit 433f1ea)

# Conflicts:
#	core/src/replay_stage.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 Mar 27, 2021
…onfirmed (not yet finalized) data (bp #16142) (#16159)

* Rpc: enable getConfirmedBlock and getConfirmedTransaction to return confirmed (not yet finalized) data (#16142)

* Add Blockstore block and tx apis that allow unrooted responses

* Add TransactionStatusMessage, and send on bank freeze; also refactor TransactionStatusSender

* Track highest slot with tx-status writes complete

* Rename and unpub fn

* Add commitment to GetConfirmed input configs

* Support confirmed blocks in getConfirmedBlock

* Support confirmed txs in getConfirmedTransaction

* Update sigs-for-addr2 comment

* Enable confirmed block in cli

* Enable confirmed transaction in cli

* Review comments

* Rename blockstore method

(cherry picked from commit 433f1ea)

# Conflicts:
#	core/src/replay_stage.rs
#	core/src/rpc.rs
#	core/src/validator.rs

* Fix conflicts

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
@CriesofCarrots CriesofCarrots deleted the truly-confirmed-block branch March 30, 2021 16:21
@brooksprumo brooksprumo mentioned this pull request Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants