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: ignore the first tx (connect oracle extension tx) #14

Merged
merged 4 commits into from
Nov 29, 2024

Conversation

rustcandy
Copy link

Description

@hallazzang found that the skip oracle injects their oracle data at tx[0] always:
https://github.com/skip-mev/connect/blob/7a115b15fd218eae84e42195941c5a3b0761d2eb/abci/proposals/proposals.go#L222

We need to skip this tx for milkyway chain

Checklist

  • Targeted PR against correct branch.
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote unit tests.
  • Re-reviewed Files changed in the Github PR explorer.

@hallazzang
Copy link

hallazzang commented Nov 28, 2024

Just to provide others with more information about this: Skip's oracle rejects a proposal when there isn't an injected tx(which essentially is the current block's extended commit info): ref. So if we have a Connect-enabled chain then we can assure that every blocks in the chain will have this injected transaction as their first transaction in the list.

node/config/config_test.go Outdated Show resolved Hide resolved
Copy link

@hallazzang hallazzang left a comment

Choose a reason for hiding this comment

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

LGTM

for i, tmTx := range block.Block.Txs {
txs := block.Block.Txs
if cp.ignoreConnectVoteExtensionTx && len(block.Block.Txs) > 0 {
txs = block.Block.Txs[1:]
Copy link
Collaborator

Choose a reason for hiding this comment

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

One issue that I have with this implementation is: what if we don't have vote extensions in all blocks?

I think it would be better to instead skip transactions when trying to de-serialize them rather than here. So, inside the Tx method rather than Txs: if ignoreConnectVoteExtensionTx is true and we get a wire type error, then we ignore that transaction. Otherwise we proceed as usual.

What do you think @hallazzang @rustcandy?

Copy link
Author

Choose a reason for hiding this comment

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

It looks like always at the first place of txs according to the code @hallazzang found above. Do you think there's still possibility it's missing somewhere?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, for example in a chain that supports VoteExtensions but is not able to fetch the prices. I am not sure whether the transaction in that case would be there or not. For example a single-validator chain that only enables connect at height 20: for all previous blocks there shouldn't be that kind of transaction. Or am I wrong?

Copy link
Author

Choose a reason for hiding this comment

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

There's error on My localnet: is this the case?
3:48PM ERR oracle returned nil prices for vote extension; returning empty vote extension height=2601 module=server
This case, there's still tx[0] exist.

Copy link
Author

Choose a reason for hiding this comment

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

But I think it's good to check wire type error inside of this logic. I'll add it

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think by simply checking the wire type error we also prevent any possible other case (e.g. multiple injected transactions)

Choose a reason for hiding this comment

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

@RiccardoM Actually that was a valid concern. There is a configuration called abci.vote_extensions_enable_height inside ConsensusParams so I think this is true:

For example a single-validator chain that only enables connect at height 20: for all previous blocks there shouldn't be that kind of transaction

@rustcandy
Copy link
Author

@RiccardoM should I check just wire type only?

@RiccardoM RiccardoM merged commit 00427f1 into main Nov 29, 2024
4 checks passed
@RiccardoM RiccardoM deleted the rustcandy/skip-oracle branch November 29, 2024 01:40
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.

3 participants