Skip to content

[oracle] Add combined vote and prevote tx to reduce block usage#56

Merged
udpatil merged 4 commits intomasterfrom
combined_vote
Jun 28, 2022
Merged

[oracle] Add combined vote and prevote tx to reduce block usage#56
udpatil merged 4 commits intomasterfrom
combined_vote

Conversation

@udpatil
Copy link
Collaborator

@udpatil udpatil commented Jun 24, 2022

I tested this via CLI with localsei to verify behavior. Not sure what the best way to verify REST endpoint behavior is.

aggregatePrevote, err := ms.GetAggregateExchangeRatePrevote(ctx, valAddr)
// if there isn't a prevote, we want to no-op the vote so we don't get an error
// this way, it is safe to use combined vote regardless of a missed vote window
if err == nil && (uint64(ctx.BlockHeight())/params.VotePeriod)-(aggregatePrevote.SubmitBlock/params.VotePeriod) == 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit we can put (uint64(ctx.BlockHeight())/params.VotePeriod)-(aggregatePrevote.SubmitBlock/params.VotePeriod) == 1 to a helper function called something like IsPrevoteCurrent for readability

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@LCyson
Copy link
Contributor

LCyson commented Jun 27, 2022

after removing prevote, how do we guarantee validators won't simply copy others' price feeds by looking at their combinedVote here

Copy link
Contributor

@philipsu522 philipsu522 left a comment

Choose a reason for hiding this comment

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

let's also add tests.
We'd also want to check the behavior regarding providing a hash and leaving it out

Args: cobra.RangeArgs(4, 5),
Short: "Submit an oracle aggregate vote AND prevote for the exchange rates",
Long: strings.TrimSpace(`
Submit an oracle aggregate vote and prevote for the exchange rates of the base denom denominated in multiple denoms. The vote is a companian to a prevote from the previous vote window.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - "while the prevote is for the current window"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the prevote is performed in the current window, but is for the vote in the next window

@udpatil
Copy link
Collaborator Author

udpatil commented Jun 27, 2022

@LCyson we're not removing prevote, the combined vote performs a vote for the current window, and a prevote for the next window. the prevote for the next window protects against other validators copying the exchange rates.

@LCyson
Copy link
Contributor

LCyson commented Jun 27, 2022

@LCyson we're not removing prevote, the combined vote performs a vote for the current window, and a prevote for the next window. the prevote for the next window protects against other validators copying the exchange rates.

what's the workflow for combinedVote in this case?
previously it's 1) val sends prevote tx 2) val sends vote tx 3) compare prevote and vote in the endblock
now is it 1) val sends a combinedVote tx 2) compare prevote and vote included in the combinedVote in the endblock

@udpatil
Copy link
Collaborator Author

udpatil commented Jun 27, 2022

now it's, val sends combined vote, if there isn't a prevote from previous block, the vote is a no-op, and then prevote for the next block is performed.

@LCyson
Copy link
Contributor

LCyson commented Jun 27, 2022

now it's, val sends combined vote, if there isn't a prevote from previous block, the vote is a no-op, and then prevote for the next block is performed.

oh ic, so the combinedVote consists of (n - 1) prevote + n vote, that makes sense

@udpatil udpatil merged commit 2619767 into master Jun 28, 2022
@udpatil udpatil deleted the combined_vote branch June 28, 2022 14:21
masih pushed a commit that referenced this pull request Sep 26, 2025
* Allow passing ctx in return values of submsg handler (#52)

* Revert "Fix context assignment (#53)"

This reverts commit 434130f3d1bf5d0a2ee853abe9bf7a5384417031.

* Revert "Allow passing ctx in return values of submsg handler (#52)"

This reverts commit d14d7fbe8b4c56341da3cae29d5de78e038d7b67.
masih pushed a commit that referenced this pull request Sep 26, 2025
* Allow passing ctx in return values of submsg handler (#52)

* Revert "Revert #52 and #53 (#56)"

This reverts commit 007b839.
masih pushed a commit that referenced this pull request Sep 29, 2025
## Describe your changes and provide context
* Adds the AnteHandlers Dependency Decorators for the decorators that
have read/write operations to/from keepers
* Moves the MsgCompletion signaling to the end of RunTx. The main issue
is that the signaling SHOULD happen after the write() calls so that
dependent transactions have the updated data.
* We can make it more granular in the future but for now we should just
move it out so that its easier to reason/

## Testing performed to validate your change
With this branch - able to run a couple of rounds of load testing before
running into the app hash error due to different gas consumed for the
same TX on validators, this is with concurrency enabled
#309
masih pushed a commit that referenced this pull request Sep 30, 2025
## Describe your changes and provide context
* Adds the AnteHandlers Dependency Decorators for the decorators that
have read/write operations to/from keepers
* Moves the MsgCompletion signaling to the end of RunTx. The main issue
is that the signaling SHOULD happen after the write() calls so that
dependent transactions have the updated data.
* We can make it more granular in the future but for now we should just
move it out so that its easier to reason/

## Testing performed to validate your change
With this branch - able to run a couple of rounds of load testing before
running into the app hash error due to different gas consumed for the
same TX on validators, this is with concurrency enabled
#309
masih pushed a commit that referenced this pull request Oct 9, 2025
[SeiDB] Fix MemIAVL Race Condition during snapshot reload
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.

4 participants