-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: store total transaction size in blocks table #2204
Conversation
Vercel deployment URL: https://stacks-blockchain-8kcg3xjul-hirosystems.vercel.app 🚀 |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
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.
Generally looks great!
Only weird to see tx_total_size: 1,
in the tests, I'm assuming they don't have a "real" transaction with a correct size?
thanks @janniks , exactly, they're only simulated values for tests |
exports.up = pgm => { | ||
pgm.addColumn('blocks', { | ||
tx_total_size: { | ||
type: 'int', | ||
notNull: true, | ||
default: 0, | ||
}, | ||
}); | ||
pgm.sql(` | ||
UPDATE blocks | ||
SET tx_total_size = ( | ||
SELECT SUM(OCTET_LENGTH(raw_tx)) | ||
FROM txs | ||
WHERE index_block_hash = blocks.index_block_hash | ||
) | ||
`); |
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.
My gut feeling is that this will result in a several hour long migration for most external deployments (e.g. exchanges). Seems like it would be fine to let the new column be nullable and we'd only have this available for new blocks.
## [8.6.0-beta.1](v8.5.0...v8.6.0-beta.1) (2025-01-28) ### Features * consider tenure block fullness for transaction fee estimations ([#2203](#2203)) ([396e2ea](396e2ea)) * store total transaction size in blocks table ([#2204](#2204)) ([ac7c41b](ac7c41b)) ### Bug Fixes * make tx_total_size column nullable ([#2207](#2207)) ([77bd2f8](77bd2f8))
🎉 This PR is included in version 8.6.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This is computed by the sum of all confirmed transaction byte sizes, and will be necessary to calculate tenure fullness in fee estimations.