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

fix(s3): R2 Copy compatibility + Remove sync checks #38

Merged
merged 9 commits into from
Mar 18, 2025
Merged

Conversation

samcm
Copy link
Member

@samcm samcm commented Mar 18, 2025

  • Removes sync checks based on the node status. This is one of the learnings from Holesky. We can't trust the beacon node to accurately report it's sync status, and would prefer to over-index data instead of dropping it. We now take a different approach, comparing the wall clock slot with the slot from the event stream to determine if we should fetch data.
  • Fixes permanent block storage on R2, which requires a download/upload instead of a server-side copy

samcm added 3 commits March 18, 2025 13:46
This commit introduces several enhancements to the block storage mechanism and improves compatibility with S3-like storage solutions, particularly R2.

- Adds the 'Slot' field to the 'PermanentStoreBlock' struct and uses it for organizing blocks in the permanent storage location.
- Modifies the S3 store to properly URL-escape the source path during copy operations, ensuring compatibility with R2 and other S3-like services.
- Updates the indexer to include the block slot when queuing blocks for permanent storage and purging old blocks.
This change introduces a sync tolerance mechanism to the agent,
allowing it to ignore events from slots that are too far behind
the current head. This prevents the agent from fetching blocks
that are unlikely to be relevant.

The sync tolerance is configurable via the `syncToleranceSlots`
parameter in the Ethereum configuration. The `ShouldIgnoreEventFromSlot`
method in the `Node` struct checks if an event's slot is within
the tolerance window.

fix(store): fix S3 copy source encoding for R2 compatibility

The S3 copy source encoding was not properly handling URL escaping,
leading to issues with R2 compatibility. This change ensures that
the copy source is correctly encoded, allowing for seamless
operation with R2 and other S3-compatible services.
This commit introduces a fallback mechanism for the S3Store's Copy
function to support R2 storage, which has limitations with
server-side copy operations. When a regular server-side copy fails,
the code now attempts to perform a manual copy by first retrieving
the source object using GetObject, then uploading it to the
destination using PutObject. This workaround ensures compatibility
with R2 and other S3-compatible services that may not fully support
server-side copy. The code also preserves metadata during the
GetObject+PutObject fallback.
@samcm samcm requested a review from Savid as a code owner March 18, 2025 04:48
@samcm samcm changed the title fix(s3): R2 Copy compatibility fix(s3): R2 Copy compatibility + Remove sync checks Mar 18, 2025
samcm added 6 commits March 18, 2025 15:05
This commit introduces a metrics server for the agent and a create
beacon block endpoint.

The agent now exposes metrics via a metrics server, which can be
configured via the MetricsAddr config option.

The create beacon block endpoint allows clients to create new beacon
blocks.
This commit introduces a new database model, `PermanentBlock`, to
track blocks that have been copied to permanent storage. It also
modifies the permanent store logic to record blocks in the database
after they are copied.

The permanent location is changed to not include the slot in the path.
The linter was complaining about the use of int64 for slot.
Added //nolint:gosec to the lines that were causing the issue.
This commit refactors the block processing logic to check if a block
already exists in the database before proceeding with further
processing. This change optimizes the workflow by avoiding
unnecessary operations on already recorded blocks.
refactor(persistence): remove redundant initialization of values slice in DistinctPermanentBlockValues
@samcm samcm merged commit d9d02de into master Mar 18, 2025
5 checks passed
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.

1 participant