Skip to content

Commit

Permalink
(NOBIDS) fix wrong deposit amount on landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbitfly committed Sep 27, 2023
1 parent 43f3615 commit 0d49ac4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions cmd/misc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func main() {
case "migrate-last-attestation-slot-bigtable":
migrateLastAttestationSlotToBigtable()
case "export-genesis-validators":
logrus.Infof("retrieving genesis validator state")
validators, err := rpcClient.GetValidatorState(0)
if err != nil {
logrus.Fatalf("error retrieving genesis validator state")
Expand Down Expand Up @@ -282,20 +283,19 @@ func main() {
}
}

_, err = db.WriterDb.Exec(`
INSERT INTO blocks_deposits (block_slot, block_index, publickey, withdrawalcredentials, amount, signature, valid_signature)
SELECT
0 as block_slot,
v.validatorindex as block_index,
v.pubkey as publickey,
v.withdrawalcredentials,
32*1e9 as amount,
'\x'::bytea as signature,
true
FROM validators v ON CONFLICT DO NOTHING`)
if err != nil {
logrus.Fatal(err)
for _, validator := range validators.Data {
logrus.Infof("exporting deposit data for genesis validator %v", validator.Index)
_, err = db.WriterDb.Exec(`INSERT INTO blocks_deposits (block_slot, block_root, block_index, publickey, withdrawalcredentials, amount, signature)
VALUES (0, '\x01', $1, $2, $3, $4, $5) ON CONFLICT DO NOTHING`,
validator.Index, utils.MustParseHex(validator.Validator.Pubkey), utils.MustParseHex(validator.Validator.WithdrawalCredentials), validator.Balance, []byte{0x0},
)
if err != nil {
logrus.Errorf("error exporting genesis-deposits: %v", err)
time.Sleep(time.Second * 60)
continue
}
}

_, err = db.WriterDb.Exec(`
INSERT INTO blocks (epoch, slot, blockroot, parentroot, stateroot, signature, syncaggregate_participation, proposerslashingscount, attesterslashingscount, attestationscount, depositscount, withdrawalcount, voluntaryexitscount, proposer, status, exec_transactions_count, eth1data_depositcount)
VALUES (0, 0, '\x'::bytea, '\x'::bytea, '\x'::bytea, '\x'::bytea, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ func getIndexPageData() (*types.IndexPageData, error) {
}

data.DepositThreshold = float64(utils.Config.Chain.Config.MinGenesisActiveValidatorCount) * 32
data.DepositedTotal = float64(deposit.Total) * 32
data.DepositedTotal = float64(deposit.Total)

data.ValidatorsRemaining = (data.DepositThreshold - data.DepositedTotal) / 32
genesisDelay := time.Duration(int64(utils.Config.Chain.Config.GenesisDelay) * 1000 * 1000 * 1000) // convert seconds to nanoseconds
Expand Down

0 comments on commit 0d49ac4

Please sign in to comment.