-
Notifications
You must be signed in to change notification settings - Fork 118
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: option to modify estimated fees in /v2/fees/transaction proxy #2172
Conversation
Vercel deployment URL: https://stacks-blockchain-8aav9b1mt-hirosystems.vercel.app 🚀 |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
// https://github.com/stacks-network/stacks-core/blob/20d5137438c7d169ea97dd2b6a4d51b8374a4751/stackslib/src/chainstate/stacks/db/blocks.rs#L338 | ||
const MINIMUM_TX_FEE_RATE_PER_BYTE = 1; | ||
|
||
function getFeeEstimationModifier(): number | null { |
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.
Can we do this in a lazy way? e.g. parse once and keep it cached in a global var
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.
Let me see if I can do that in a way that still lets the test configure it..
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.
Done
// Use the `node:http` agent for requests https://github.com/fastify/fastify-reply-from?tab=readme-ov-file#globalagent | ||
globalAgent: true, | ||
http: {}, |
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.
Fastify defaults to using Fetch/undici which isn't supported by the nock
testing lib used to mock network responses. These settings cause it to use the node:http
global agent. From what I understand, it's a bit slower but probably fine.
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.
Curious, have you tried using the MockAgent
? https://github.com/hirosystems/token-metadata-api/blob/0c02a159290925963d516403d712582e79c7db2d/tests/token-queue/process-smart-contract-job.test.ts#L44-L56
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.
Nice looks like that works 6ab509e
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.
LGTM!
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.
LGTM!
## [8.3.0-beta.1](v8.2.2...v8.3.0-beta.1) (2024-11-19) ### Features * option to modify estimated fees in /v2/fees/transaction proxy ([#2172](#2172)) ([9b7e97d](9b7e97d))
🎉 This PR is included in version 8.3.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 8.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Adds a hook to the
/v2/fees/transaction
endpoint in the RPC proxy.Configure using the env var
STACKS_CORE_FEE_ESTIMATION_MODIFIER
. The fee estimations returned by the stacks-node will be multiplied by this value.For example with
STACKS_CORE_FEE_ESTIMATION_MODIFIER=0.5
, if the response from stacks-core is:Then the modified response will be: