-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into NOBIDS/public-vali-dashboard-api
# Conflicts: # backend/pkg/api/data_access/user.go # backend/pkg/api/handlers/internal.go # backend/pkg/api/router.go
- Loading branch information
Showing
161 changed files
with
4,851 additions
and
2,459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
backend/db_migrations/20240412154432_blocksdeposits_validators.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
-- +goose Up | ||
-- +goose StatementBegin | ||
CREATE TABLE IF NOT EXISTS | ||
blocks_deposits ( | ||
block_slot INT NOT NULL, | ||
block_index INT NOT NULL, | ||
block_root bytea NOT NULL DEFAULT '', | ||
proof bytea[], | ||
publickey bytea NOT NULL, | ||
withdrawalcredentials bytea NOT NULL, | ||
amount BIGINT NOT NULL, | ||
signature bytea NOT NULL, | ||
valid_signature bool NOT NULL DEFAULT TRUE, | ||
PRIMARY KEY (block_slot, block_index) | ||
); | ||
CREATE INDEX IF NOT EXISTS idx_blocks_deposits_publickey ON blocks_deposits (publickey); | ||
CREATE INDEX IF NOT EXISTS idx_blocks_deposits_block_slot_block_root ON public.blocks_deposits USING btree (block_slot, block_root); | ||
CREATE INDEX IF NOT EXISTS idx_blocks_deposits_block_root_publickey ON public.blocks_deposits USING btree (block_root, publickey); | ||
|
||
DROP TABLE IF EXISTS validators; | ||
CREATE TABLE IF NOT EXISTS | ||
validators ( | ||
validatorindex INT NOT NULL, | ||
pubkey bytea NOT NULL, | ||
pubkeyhex TEXT NOT NULL DEFAULT '', | ||
withdrawableepoch BIGINT NOT NULL, | ||
withdrawalcredentials bytea NOT NULL, | ||
balance BIGINT NOT NULL, | ||
balanceactivation BIGINT, | ||
effectivebalance BIGINT NOT NULL, | ||
slashed bool NOT NULL, | ||
activationeligibilityepoch BIGINT NOT NULL, | ||
activationepoch BIGINT NOT NULL, | ||
exitepoch BIGINT NOT NULL, | ||
lastattestationslot BIGINT, | ||
status VARCHAR(20) NOT NULL DEFAULT '', | ||
PRIMARY KEY (validatorindex) | ||
); | ||
CREATE INDEX IF NOT EXISTS idx_validators_pubkey ON validators (pubkey); | ||
CREATE INDEX IF NOT EXISTS idx_validators_pubkeyhex ON validators (pubkeyhex); | ||
CREATE INDEX IF NOT EXISTS idx_validators_pubkeyhex_pattern_pos ON validators (pubkeyhex varchar_pattern_ops); | ||
CREATE INDEX IF NOT EXISTS idx_validators_status ON validators (status); | ||
CREATE INDEX IF NOT EXISTS idx_validators_balanceactivation ON validators (balanceactivation); | ||
CREATE INDEX IF NOT EXISTS idx_validators_activationepoch ON validators (activationepoch); | ||
CREATE INDEX IF NOT EXISTS validators_is_offline_vali_idx ON validators (validatorindex, lastattestationslot, pubkey); | ||
CREATE INDEX IF NOT EXISTS idx_validators_withdrawalcredentials ON validators (withdrawalcredentials, validatorindex); | ||
CREATE INDEX IF NOT EXISTS idx_validators_exitepoch ON validators (exitepoch); | ||
CREATE INDEX IF NOT EXISTS idx_validators_withdrawableepoch ON validators (withdrawableepoch); | ||
CREATE INDEX IF NOT EXISTS idx_validators_lastattestationslot ON validators (lastattestationslot); | ||
CREATE INDEX IF NOT EXISTS idx_validators_activationepoch_status ON public.validators USING btree (activationepoch, status); | ||
CREATE INDEX IF NOT EXISTS idx_validators_activationeligibilityepoch ON public.validators USING btree (activationeligibilityepoch); | ||
|
||
do | ||
$$ | ||
begin | ||
if not exists (select * from pg_roles where rolname = 'alloydbsuperuser') then | ||
create role alloydbsuperuser; | ||
end if; | ||
if not exists (select * from pg_roles where rolname = 'readaccess') then | ||
create role readaccess; | ||
end if; | ||
end | ||
$$ | ||
; | ||
|
||
-- +goose StatementEnd | ||
|
||
-- +goose Down | ||
-- +goose StatementBegin | ||
|
||
DROP TABLE IF EXISTS blocks_deposits; | ||
DROP INDEX IF EXISTS idx_blocks_deposits_publickey; | ||
DROP INDEX IF EXISTS idx_blocks_deposits_block_slot_block_root; | ||
DROP INDEX IF EXISTS idx_blocks_deposits_block_root_publickey; | ||
|
||
DROP TABLE IF EXISTS validators; | ||
DROP INDEX IF EXISTS idx_validators_pubkey; | ||
DROP INDEX IF EXISTS idx_validators_pubkeyhex; | ||
DROP INDEX IF EXISTS idx_validators_pubkeyhex_pattern_pos; | ||
DROP INDEX IF EXISTS idx_validators_status; | ||
DROP INDEX IF EXISTS idx_validators_balanceactivation; | ||
DROP INDEX IF EXISTS idx_validators_activationepoch; | ||
DROP INDEX IF EXISTS validators_is_offline_vali_idx; | ||
DROP INDEX IF EXISTS idx_validators_withdrawalcredentials; | ||
DROP INDEX IF EXISTS idx_validators_exitepoch; | ||
DROP INDEX IF EXISTS idx_validators_withdrawableepoch; | ||
DROP INDEX IF EXISTS idx_validators_lastattestationslot; | ||
DROP INDEX IF EXISTS idx_validators_activationepoch_status; | ||
DROP INDEX IF EXISTS idx_validators_activationeligibilityepoch; | ||
|
||
-- +goose StatementEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.env | ||
config.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.