Skip to content

Commit

Permalink
Merge pull request #200 from ethpandaops/pk910/validators-in-db
Browse files Browse the repository at this point in the history
Validator set persistence
  • Loading branch information
pk910 authored Feb 17, 2025
2 parents 935a6ff + f83ec3b commit 83f33f7
Show file tree
Hide file tree
Showing 36 changed files with 2,224 additions and 746 deletions.
1 change: 1 addition & 0 deletions cmd/dora-explorer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func main() {

utils.WaitForCtrlC()
logger.Println("exiting...")
services.GlobalBeaconService.StopService()
db.MustCloseDB()
}

Expand Down
24 changes: 24 additions & 0 deletions db/schema/pgsql/20241216124511_validator-set.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- +goose Up
-- +goose StatementBegin

CREATE TABLE IF NOT EXISTS public."validators" (
validator_index BIGINT NOT NULL,
pubkey bytea NOT NULL,
withdrawal_credentials bytea NOT NULL,
effective_balance BIGINT NOT NULL,
slashed BOOLEAN NOT NULL,
activation_eligibility_epoch BIGINT NOT NULL,
activation_epoch BIGINT NOT NULL,
exit_epoch BIGINT NOT NULL,
withdrawable_epoch BIGINT NOT NULL,
CONSTRAINT validators_pkey PRIMARY KEY (validator_index)
);

CREATE INDEX IF NOT EXISTS "validators_pubkey_idx"
ON public."validators" ("pubkey");

-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
SELECT 'NOT SUPPORTED';
-- +goose StatementEnd
24 changes: 24 additions & 0 deletions db/schema/sqlite/20241216124511_validator-set.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- +goose Up
-- +goose StatementBegin

CREATE TABLE IF NOT EXISTS "validators" (
validator_index BIGINT NOT NULL,
pubkey BLOB NOT NULL,
withdrawal_credentials BLOB NOT NULL,
effective_balance BIGINT NOT NULL,
slashed BOOLEAN NOT NULL,
activation_eligibility_epoch BIGINT NOT NULL,
activation_epoch BIGINT NOT NULL,
exit_epoch BIGINT NOT NULL,
withdrawable_epoch BIGINT NOT NULL,
PRIMARY KEY (validator_index)
);

CREATE INDEX IF NOT EXISTS "validators_pubkey_idx"
ON "validators" ("pubkey");

-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
SELECT 'NOT SUPPORTED';
-- +goose StatementEnd
Loading

0 comments on commit 83f33f7

Please sign in to comment.