Skip to content

Conversation

@ckartik
Copy link
Contributor

@ckartik ckartik commented Jun 20, 2024

Motivation

Preconfirmations can trivially be satisfied by most block builders by placing the transactions at the bottom of the block. This is known as an inclusion preconfirmation. However, most preconfirmations are meant for contested state, like doing cex-dex arbitrage to bring the price an on-chain DEX or AMM into parity with the external world. In such cases, it's important to ensure the provider doesn't simply include the preconfirmation, but also ensures its successful execution.

Implementation Details

We alter the data stored in our LRU cache to also keep track of the status of the transaction (success v.s failure). We subsequently continue our preconfirmation validation as normal, with the additional check of successful execution before the disbursement of rewards.

Roadmap and relevance

This is not a required check, as builders generally provide revert protection. This one of two PRs in this theme, that will introduce a bid expression where parties to can dictate which transactions are required to succeed and which ones can revert. The subsequent PR will deal with adding support for bid expressions, along with the first bid expression being the ability to specify which transactions in a bundle are ok to revert.

@ckartik ckartik marked this pull request as ready for review June 20, 2024 14:44
@ckartik
Copy link
Contributor Author

ckartik commented Jun 20, 2024

Relates to the Bid Expression discussion occurring here.

@ckartik ckartik requested a review from mrekucci July 2, 2024 20:24
@ckartik ckartik requested a review from aloknerurkar July 3, 2024 17:08
type EthClient interface {
BlockNumber(ctx context.Context) (uint64, error)
HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this required? This interface is a subset of the methods of the EthClient. We dont use the BlockByNumber in this pkg. You can still pass your retry client to this pkg even after removing this.

Copy link
Collaborator

@aloknerurkar aloknerurkar left a comment

Choose a reason for hiding this comment

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

Apart from the nitpicks, things LGTM! Before checking in just fix the 2 comments.

  1. Remove the additional method from the EthClient interface
  2. Add check for errorCode == 429 everywhere in the retry logic.

@ckartik ckartik force-pushed the ckartik/add-revertibility-check branch 4 times, most recently from fb1c4ae to 30b909c Compare July 4, 2024 16:08
@ckartik ckartik force-pushed the ckartik/add-revertibility-check branch from 011fb9d to a220daa Compare July 5, 2024 16:47
@ckartik ckartik merged commit a6094d7 into main Jul 5, 2024
@ckartik ckartik deleted the ckartik/add-revertibility-check branch July 5, 2024 18:03
@ckartik ckartik restored the ckartik/add-revertibility-check branch July 9, 2024 18:00
@aloknerurkar aloknerurkar deleted the ckartik/add-revertibility-check branch April 10, 2025 12: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.

5 participants