Skip to content

feat: conflict resolution scaffolding#687

Merged
smrz2001 merged 19 commits into
mainfrom
feat/conflict-resolution
May 26, 2025
Merged

feat: conflict resolution scaffolding#687
smrz2001 merged 19 commits into
mainfrom
feat/conflict-resolution

Conversation

@nathanielc

@nathanielc nathanielc commented Mar 19, 2025

Copy link
Copy Markdown
Contributor

The meat of this PR can be found in its comments. There are several TODO comments. At a high level there are two halfs to completing conflict resolution:

  1. Annotate conclusion events with their before times.
  2. Implement a conflict resolver UDF that uses the set of event tips to determine the winning tip.

The conflict resolver will need the before time data as well as the previous fields in addition to the data already present on the event_states table. Getting previous field will be straightforward as the conclusion_events already have that data but its not preserved into the event_states table.

Annotation the conclusion events with their before times has two challenges. First while we validate events we promptly forget the block time stamp of the event time proof. We need to preserve that information. Second its not clear how to propagate the before conclusion from time events to data events if that is even needed. I would recommend starting on part two to understand exactly what data the resolver UDF needs and then work backwards to the concluder to determine how to get that information.

Comment thread pipeline/src/concluder/mod.rs
@dav1do dav1do force-pushed the feat/conflict-resolution branch 3 times, most recently from 054952e to 5cbbbb0 Compare April 11, 2025 22:15
Comment thread event-svc/src/blockchain/eth_rpc/http.rs Outdated
Comment thread event-svc/src/event/service.rs Outdated
Comment thread event-svc/src/event/service.rs Outdated
Comment thread event-svc/src/event/service.rs Outdated
reason: String,
},
/// 'Soft error' -> should not kill recon conversation but should not be persisted
/// A time event could not be validated because no RPC provider was available

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// A time event could not be validated because no RPC provider was available
/// E.g. a time event could not be validated because no RPC provider was available

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm considering removing this error (and actually have for now but let's discuss).

Do we want to let the Recon conversation continue if a Time Event couldn't be validated?

  • If it's a transient issue (like RPC rate limiting), then it'll eventually go away.
  • If it's a Time Event for which the node should have a RPC endpoint configured but doesn't, then we want the failure to be loud so that the operator fixes their configuration.
  • If it's a bad Time Event, then the Recon conversation should be terminated.

WDYT?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think validation needs to raise different types of errors for those different cases. Transient errors should let the conversation continue, permanent errors should kill the conversation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, I'm adding a TODO here to look at in the next PR.

Comment thread event-svc/src/event/validator/event.rs Outdated
Comment thread event-svc/src/store/sql/query.rs Outdated
Comment thread pipeline/src/concluder/event.rs Outdated
Comment thread pipeline/src/schemas.rs Outdated
Comment thread pipeline/src/resolver/mod.rs Outdated
type Result = anyhow::Result<Option<StreamState>>;
}

/// State of a single stream

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm surprised we don't already have a type for this? Don't we already have a stream_states table that must have a type for this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The pipeline naming is generally a bit confusing, and also, there are two instances of this struct, one in the Aggregator (aggregator.rs) and another in the Resolver (resolver.rs).

In the Aggregator (which applies commit patches), it's used with the event_states table, while in the Resolver, it's used with the stream_states table.

I could rename it to EventState in the Aggregator. It isn't really the stream state at that stage of the pipeline because the true stream state can only be determined after conflict resolution in the Resolver.

WDYT?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

definitely think they should have different names if they have different meanings. Maybe this one is ResolvedStreamState or something like that?

Comment thread pipeline/src/resolver/mod.rs
@smrz2001 smrz2001 force-pushed the feat/conflict-resolution branch from 5cbbbb0 to cf69d03 Compare May 14, 2025 20:07
@smrz2001 smrz2001 changed the title wip: adds scaffold for resolver actor feat: conflict resolution scaffolding May 14, 2025
@smrz2001 smrz2001 marked this pull request as ready for review May 14, 2025 20:48
@smrz2001 smrz2001 requested review from a team and dav1do as code owners May 14, 2025 20:48
@smrz2001 smrz2001 requested review from stephhuynh18 and removed request for a team May 14, 2025 20:48
@smrz2001 smrz2001 temporarily deployed to tnet-prod-2024 May 14, 2025 21:49 — with GitHub Actions Inactive
@smrz2001 smrz2001 temporarily deployed to tnet-prod-2024 May 20, 2025 22:20 — with GitHub Actions Inactive
@smrz2001 smrz2001 temporarily deployed to tnet-prod-2024 May 20, 2025 22:58 — with GitHub Actions Inactive
@smrz2001 smrz2001 requested a review from stbrody May 21, 2025 19:03
@smrz2001 smrz2001 temporarily deployed to tnet-prod-2024 May 21, 2025 21:34 — with GitHub Actions Inactive
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 26, 2025
@smrz2001 smrz2001 force-pushed the feat/conflict-resolution branch from 79d62c2 to d65b9e2 Compare May 26, 2025 10:47
@smrz2001 smrz2001 enabled auto-merge May 26, 2025 10:47
@smrz2001 smrz2001 temporarily deployed to tnet-prod-2024 May 26, 2025 11:12 — with GitHub Actions Inactive
@smrz2001 smrz2001 added this pull request to the merge queue May 26, 2025
Merged via the queue into main with commit 4c6defb May 26, 2025
27 of 29 checks passed
@smrz2001 smrz2001 deleted the feat/conflict-resolution branch May 26, 2025 11:48
This was referenced May 26, 2025
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