Skip to content

Conversation

@ericvelazquez
Copy link
Contributor

@ericvelazquez ericvelazquez commented Oct 21, 2024

Ticket

What does this PR do?

  • Summary: Backfilling provider scaffolder
  • Key Changes:
    • Scaffolder of the backfill provider
    • Adds metafiller URL to the config

Does this PR introduce any breaking changes (API/schema)?

  • No

Do any environment variables need to be updated or added before deployment?

  • Yes:
    • METAFILLER_URL

How can this PR be tested?

Unit & integration tests

@linear
Copy link

linear bot commented Oct 21, 2024

SEQ-204 Scaffolder: OP-translator <-> Metafiller

We need to scaffold the connection between the OP-translator and the Metafiller as part of the backfilling process . At this stage, we are uncertain about the exact data the Metafiller will return and the mechanism by which the OP-translator will communicate with the Metafiller.

This ticket focuses on building the scaffolding on the OP-translator side to prepare for this connection. Once more information is available regarding the interaction details and data structure, we will update and refine the implementation accordingly.

AC:

  • Prepare the codebase for integration with Metafiller once data and connection specs are clarified.
  • Update configuration to include block number of the cutoff.
  • Unit tests

@ericvelazquez ericvelazquez marked this pull request as ready for review October 22, 2024 16:20
@ericvelazquez ericvelazquez changed the title feat: metafiller scaffolder feat: backfill provider scaffolder Oct 22, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking about moving this to its own folder /pkg/backfill. Any thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

support that since I don't believe the backfiller is specific to OP, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would leave it in the translator package, since it's not used anywhere else, but either is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved it to its own package since it isn't specific to the translator

Copy link
Collaborator

@jorgemmsilva jorgemmsilva left a comment

Choose a reason for hiding this comment

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

nice 👍

}

var data *BackFillData
err = json.Unmarshal(body, &data)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a thought, I know we haven't designed the backfiller-indexer service yet.
Could we just write/read raw binary data in the response body? That would save us some overhead on producing / unpacking JSON and hex strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could but we need the EpochHash too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could set it in the http headers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will need to think more about this. Don't love the header solution. But will work on a solution when working on this ticket: https://linear.app/syndicate/issue/SEQ-209/write-logic-in-op-translator-for-switching-between-data-retrieval

Copy link
Collaborator

@daniilrrr daniilrrr left a comment

Choose a reason for hiding this comment

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

misc stuff from me, great work

func InitBackFillerProvider(cfg *config.Config) *BackFillProvider {
return &BackFillProvider{
MetafillerURL: cfg.MetafillerURL,
Client: &http.Client{},
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you add a TODO comment referencing SEQ-141

}

type BackFillData struct {
Data string `json:"data"` // Hex format
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: you could enforce that it's a hex string with a custom type, something like

type BackFillData struct {
    Data HexString `json:"data"`
    EpochHash common.Hash `json:"epochHash"`
}
...
func isHex(s string) bool {
    // Remove 0x prefix if present
    s = strings.TrimPrefix(s, "0x")
    _, err := hex.DecodeString(s)
    return err == nil
}

and use alongside the existing std hex package

Copy link
Collaborator

Choose a reason for hiding this comment

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

alt approach might be to make the data field private and add getter and setter, where you do isHex() validation in the setter. Though that might be more annoying than valuable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will leave it like this for now for simplicity reasons but will spin up a ticket to look at best ways to handle hex values. That would be useful in the whole app, not just this file.

@ericvelazquez ericvelazquez merged commit b00865f into main Oct 23, 2024
2 checks passed
@ericvelazquez ericvelazquez deleted the SEQ-204 branch October 23, 2024 16:39
@ericvelazquez ericvelazquez restored the SEQ-204 branch October 23, 2024 21:07
@ericvelazquez ericvelazquez deleted the SEQ-204 branch November 25, 2024 23:58
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