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

Colocation Notify - failed simulation #2013

Merged
merged 11 commits into from
Nov 1, 2023
Merged

Conversation

sunce86
Copy link
Contributor

@sunce86 sunce86 commented Oct 24, 2023

Description

Implements (2) from #1891

Changes

  • Simulation failure error (together with tx data) propagated from the driver to the solvers.

Unfortunately, not all data can (and should) be populated to support the legacy version. block_number is one of those that is needed but it is not provided by simulators. This is the never ending issue we generally have with doing simulations on a specific block number.

The easiest fix would be to add get_block_number() call to each web3 simulation (enso and tenderly seem to give block_number in their responses), but it wouldn't be accurate.

At the moment I decided to skip it, since, after all, solvers can pretty much figure out the block number on their own, there are usually 1 or 2 candidates...

@sunce86 sunce86 requested a review from a team as a code owner October 24, 2023 22:11
crates/driver/src/infra/simulator/mod.rs Outdated Show resolved Hide resolved
crates/driver/src/infra/solver/dto/notification.rs Outdated Show resolved Hide resolved
crates/solvers/src/api/routes/notify/dto/notification.rs Outdated Show resolved Hide resolved
crates/solvers/src/boundary/legacy.rs Outdated Show resolved Hide resolved
from: tx.from.into(),
to: tx.to.into(),
data: tx.input.clone().into(),
internalization: InternalizationStrategy::SkipInternalizableInteraction,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the internalization flag should probably not be hardcoded. The simulation could also only fail if internalized AFAIK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I aimed here to actually drop the internalization flag as it is not needed IMO, since all solver engines are sending raw interactions to the driver and, in case of simulation failure, they get the failed transaction with calldata, so that would be enough to see if it was internalized or not (if the calldata in notification differs from what they sent to us, and they have solution id to match on).

So, I just want to be careful and add the bare minimum of data needed (to reduce complexity).

Here, I would rather add additional variant InternalizationStrategy::Undefined or similar, to make the code accurate and not misleading, instead of providing actual value.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added InternalizationStrategy::Unknown

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, saw the follow up comments too late.
Wouldn't it then make more sense to drop the internalization here altogether? Seems like in all the existing use cases having the Unknown variant doesn't really make sense and therefore compromising the use of an existing type for this doesn't seem worth it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we can definitely drop it. Maybe I was too cautious to not cause any backward compatibility issues since this is after all a debugging feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried removing but we are using this field to recreate tenderly link in the non-colocated driver also, so we will have to remove it only once the colocation is activated.
I added the comment in the code to remember this.

crates/solvers/src/boundary/legacy.rs Show resolved Hide resolved
crates/solvers/src/domain/eth/mod.rs Outdated Show resolved Hide resolved
crates/solvers/src/util/bytes.rs Show resolved Hide resolved
Copy link
Contributor

@fedgiac fedgiac left a comment

Choose a reason for hiding this comment

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

I find it a bit strange that we introduce a few new identical Tx types rather than reusing eth::Tx.
I also don't understand the impact of populating the legacy notification with fake data for block_number and tx_index.
Except for this, I've nothing more to add.

crates/solvers/src/boundary/legacy.rs Outdated Show resolved Hide resolved
@sunce86
Copy link
Contributor Author

sunce86 commented Nov 1, 2023

Merging so I can observe it in staging before tomorrow colocation run in prod. @fedgiac feel free to add more comments

@sunce86 sunce86 merged commit 7922749 into main Nov 1, 2023
7 checks passed
@sunce86 sunce86 deleted the colocation-notify-simulation branch November 1, 2023 09:36
@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants