-
Notifications
You must be signed in to change notification settings - Fork 679
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
Feat/txindex #5661
base: develop
Are you sure you want to change the base?
Feat/txindex #5661
Conversation
@@ -643,16 +643,8 @@ impl<'a> ChainstateTx<'a> { | |||
events: &[StacksTransactionReceipt], | |||
) { | |||
if *TRANSACTION_LOG { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just get rid of this variable entirely I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but also add a clear message about this change to the changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, but I think we should drop the old TRANSACTION_LOG
variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some minor comments.
"INSERT INTO transactions (txid, index_block_hash, tx_hex, result) VALUES (?, ?, ?, ?)"; | ||
let txid = tx_receipt.transaction.txid(); | ||
let tx_hex = tx_receipt.transaction.serialize_to_dbstring(); | ||
let result = tx_receipt.result.to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is just replicating the old behavior, but while we're changing things, do we know if anyone who wants to use this feature would want to save any other metadata besides just the result, e.g. the events emitted or the cost?
@@ -643,16 +643,8 @@ impl<'a> ChainstateTx<'a> { | |||
events: &[StacksTransactionReceipt], | |||
) { | |||
if *TRANSACTION_LOG { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but also add a clear message about this change to the changelog.
@@ -620,6 +620,7 @@ impl RunLoop { | |||
require_affirmed_anchor_blocks: moved_config | |||
.node | |||
.require_affirmed_anchor_blocks, | |||
txindex: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't this get the value from the config?
@rdeioris have you done a genesis sync with this change? I'd be curious to understand the storage impact of enabling this feature. |
Pretty huge, was about 20G on testnet with the older patch |
@diwakergupta i think we can eventually avoid to store the tx body (as an option) and let the user retrieve it by the block itself using the index_block_hash |
From the call: we're still waiting for feedback from the builders who will use this before it's ready for review. |
Description
This is a reengineering of #5484 based on feedbacks from both the initial code review and nakamoto meetings.
In this first draft it just covers the infrastructure for adding a new "txindex" (boolean) option in the node config and deprecation of the old STACKS_TRANSACTION_LOG environment variable.
This option injects into the nakamoto coordinator and adds a parameter to NakamotoChainState::process_next_nakamoto_block enabling/disabling the record of a transaction.
Note that enabling both txindex and STACKS_TRANSACTION_LOG will trigger an error on startup prevending the system to enable both.
Once this first draft is approved i will add back the rpc endpoints features (that should be way more simple now)
TODO/Questions:
Applicable issues
Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml