Skip to content
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: block history estimator #688

Merged
merged 9 commits into from
Jun 5, 2024
Merged

feat: block history estimator #688

merged 9 commits into from
Jun 5, 2024

Conversation

aalu1418
Copy link
Collaborator

@aalu1418 aalu1418 commented Apr 30, 2024

https://smartcontract-it.atlassian.net/browse/BCI-2811

  • estimator
  • test cases
    • unit
    • integration (creating multiple runs to test both estimators - big changes are indentation changes)
  • configs (polling + bumping)

upstream:

downstream:

@aalu1418 aalu1418 force-pushed the feat/block-history-est branch from 76e322c to 1a46fe4 Compare May 24, 2024 15:45
lock sync.RWMutex
}

// NewBlockHistoryEstimator creates a new fee estimator that parses historical fees from a fetched block

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// NewBlockHistoryEstimator creates a new fee estimator that parses historical fees from a fetched block
// NewBlockHistoryEstimator creates a new fee estimator that parses historical fees from the latest block

@@ -148,9 +148,12 @@ func (txm *Txm) sendWithRetry(chanCtx context.Context, baseTx solanaGo.Transacti
// https://github.com/gagliardetto/solana-go/blob/main/transaction.go#L252
key := baseTx.Message.AccountKeys[0].String()

// only calculate base price once

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if bumping occurs after a new block is produced, wouldn't re-calculating the base be helpful?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's true - but there is also the possibility that the base value decreases and then the bumped value could be lower than the previous value.

only calculating the base once guarantees that the fee will always increase

augustbleeds
augustbleeds previously approved these changes Jun 5, 2024
Copy link

@augustbleeds augustbleeds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@aalu1418 aalu1418 force-pushed the feat/block-history-est branch from 157da2b to 666b610 Compare June 5, 2024 16:26
@aalu1418 aalu1418 enabled auto-merge (squash) June 5, 2024 16:35
@aalu1418 aalu1418 merged commit 555ff58 into develop Jun 5, 2024
25 checks passed
@aalu1418 aalu1418 deleted the feat/block-history-est branch June 5, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants