-
Notifications
You must be signed in to change notification settings - Fork 13
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
Use staleness for pricing #87
Conversation
// Get the estimated compute unit price and wrap it so it stays below the maximum total | ||
// compute unit fee. We additionally divide such price by 2 to make sure a spike | ||
// doesn't get propagated forever. | ||
let estimated_price = (estimated_recent_price >> 1).min(maximum_unit_price); |
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.
hardcore division 😎
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. left a couple comments but feel free to address in a separate PR
|
||
// Use exponentially higher price if this publisher hasn't published in a while for the accounts | ||
// in this batch. This will use the maximum total compute unit fee if the publisher | ||
// hasn't updated for >= MAXIMUM_SLOT_GAP_FOR_DYNAMIC_COMPUTE_UNIT_PRICE slots. |
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 is pretty much guaranteed to use the maximum price when the market opens each day right?
I think that behavior is fine -- I think the max price isn't so high that we can't afford 1 of these transactions per day per price feed or whatever -- though probably worth a comment justifying 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.
Yeah it was a certain challenge. I think we should see how it will work with the other dynamic mechanism (which is decaying) and make sure it won't get very expensive.
src/agent/solana/exporter.rs
Outdated
@@ -88,6 +87,7 @@ const UPDATE_PRICE_NO_FAIL_ON_ERROR: i32 = 13; | |||
// measure while using dynamic compute price to prevent the exporter from paying too much for a | |||
// single transaction | |||
const MAXIMUM_TOTAL_COMPUTE_UNIT_FEE_MICRO_LAMPORTS: u64 = 1_000_000_000_000; | |||
const MAXIMUM_SLOT_GAP_FOR_DYNAMIC_COMPUTE_UNIT_PRICE: u64 = 25; |
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 suggest putting both of these consts into the config. these are the kind of thing that we'll probably want to tune easily in an emergency.
This commit adds dynamic (exponential) pricing based on staleness of the feeds that the publishers publish. This feature, combined with the recent fees for the price updates causes the spike on fee to last some time before going away.
d2a9808
to
ff26d55
Compare
This PR adds dynamic (exponential) pricing based on staleness of the feeds that the publishers publish. This feature, combined with the recent fees for the price updates causes the spike on fee to last some time before going away.
The second commit contains a little refactoring to fix warnings. Please review commit-by-commit.