Skip to content

indexer: add pagination metadata for deposit, withdrawal endpoints#2305

Merged
mslipper merged 1 commit intoethereum-optimism:developfrom
tuxcanfly:tux/indexer-tests
Mar 10, 2022
Merged

indexer: add pagination metadata for deposit, withdrawal endpoints#2305
mslipper merged 1 commit intoethereum-optimism:developfrom
tuxcanfly:tux/indexer-tests

Conversation

@tuxcanfly
Copy link
Contributor

Description
This PR adds pagination metadata to the /deposits and /withdrawals endpoints.

The indexer REST server host/port is now configurable via the vars REST_HOSTNAME, REST_PORT but defaults to 127.0.0.1:8080 like before.

Also a general cleanup, test fixes and docs. Most notably the file db.go is split by topic into different files.

@changeset-bot
Copy link

changeset-bot bot commented Mar 10, 2022

⚠️ No Changeset found

Latest commit: dd8b007

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tuxcanfly tuxcanfly requested a review from mslipper March 10, 2022 13:55
Copy link
Collaborator

@mslipper mslipper left a comment

Choose a reason for hiding this comment

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

Comments are non-blocking. Additional cleanup items:

  • Separate migrations into a standalone command rather than running them every time the daemon starts.
  • Separate the server and the background process into separate daemons.


return withdrawals, nil
}
const selectWithdrawalCountStatement = `
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd pull these constants out of the method definition. Will avoid them being recreated on every method call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, yeah they can be part of sql.go

var count uint64

err = txn(d.db, func(tx *sql.Tx) error {
queryStmt, err := tx.Prepare(selectWithdrawalCountStatement)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Separately - I don't think you need to do an explicit Prepare here, tx.QueryRow(selectWithdrawalCountStatement) will work fine. Prepared statements allow the DB engine to avoid re-parsing the query, which can improve performance somewhat but is a no-op here since the statement is re-prepared on every invocation of this method.

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 do.

@mslipper mslipper merged commit 317914c into ethereum-optimism:develop Mar 10, 2022
theochap pushed a commit that referenced this pull request Dec 10, 2025
## Overview

Plumbs in the reset request channel from #2312 into the
`SequencerActor`, and sends a reset request if there is a `Reset` error
during attributes building.

closes #2305
theochap pushed a commit that referenced this pull request Jan 14, 2026
## Overview

Plumbs in the reset request channel from #2312 into the
`SequencerActor`, and sends a reset request if there is a `Reset` error
during attributes building.

closes #2305
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.

2 participants