Skip to content

Commit

Permalink
add withdrawal & consolidation request details to validator details page
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Nov 29, 2024
1 parent 0f74f94 commit 2d524c2
Show file tree
Hide file tree
Showing 17 changed files with 773 additions and 59 deletions.
5 changes: 5 additions & 0 deletions db/consolidation_request_txs.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ func GetConsolidationRequestTxsFiltered(offset uint64, limit uint32, canonicalFo
fmt.Fprintf(&sql, " %v dequeue_block <= $%v", filterOp, len(args))
filterOp = "AND"
}
if len(filter.PublicKey) > 0 {
args = append(args, filter.PublicKey)
fmt.Fprintf(&sql, " %v (source_pubkey = $%v OR target_pubkey = $%v) ", filterOp, len(args), len(args))
filterOp = "AND"
}
if len(filter.SourceAddress) > 0 {
args = append(args, filter.SourceAddress)
fmt.Fprintf(&sql, " %v source_address = $%v", filterOp, len(args))
Expand Down
5 changes: 5 additions & 0 deletions db/consolidation_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func GetConsolidationRequestsFiltered(offset uint64, limit uint32, finalizedBloc
fmt.Fprintf(&sql, " %v slot_number <= $%v", filterOp, len(args))
filterOp = "AND"
}
if len(filter.PublicKey) > 0 {
args = append(args, filter.PublicKey)
fmt.Fprintf(&sql, " %v (source_pubkey = $%v OR target_pubkey = $%v) ", filterOp, len(args), len(args))
filterOp = "AND"
}
if len(filter.SourceAddress) > 0 {
args = append(args, filter.SourceAddress)
fmt.Fprintf(&sql, " %v source_address = $%v", filterOp, len(args))
Expand Down
5 changes: 5 additions & 0 deletions db/withdrawal_request_txs.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ func GetWithdrawalRequestTxsFiltered(offset uint64, limit uint32, canonicalForkI
fmt.Fprintf(&sql, " %v dequeue_block <= $%v", filterOp, len(args))
filterOp = "AND"
}
if len(filter.PublicKey) > 0 {
args = append(args, filter.PublicKey)
fmt.Fprintf(&sql, " %v validator_pubkey = $%v ", filterOp, len(args))
filterOp = "AND"
}
if len(filter.SourceAddress) > 0 {
args = append(args, filter.SourceAddress)
fmt.Fprintf(&sql, " %v source_address = $%v", filterOp, len(args))
Expand Down
5 changes: 5 additions & 0 deletions db/withdrawal_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ func GetWithdrawalRequestsFiltered(offset uint64, limit uint32, finalizedBlock u
fmt.Fprintf(&sql, " %v slot_number <= $%v", filterOp, len(args))
filterOp = "AND"
}
if len(filter.PublicKey) > 0 {
args = append(args, filter.PublicKey)
fmt.Fprintf(&sql, " %v validator_pubkey = $%v ", filterOp, len(args))
filterOp = "AND"
}
if len(filter.SourceAddress) > 0 {
args = append(args, filter.SourceAddress)
fmt.Fprintf(&sql, " %v source_address = $%v", filterOp, len(args))
Expand Down
4 changes: 4 additions & 0 deletions dbtypes/other.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type SlashingFilter struct {
type WithdrawalRequestFilter struct {
MinSlot uint64
MaxSlot uint64
PublicKey []byte
SourceAddress []byte
MinIndex uint64
MaxIndex uint64
Expand All @@ -110,6 +111,7 @@ type WithdrawalRequestFilter struct {
type WithdrawalRequestTxFilter struct {
MinDequeue uint64
MaxDequeue uint64
PublicKey []byte
SourceAddress []byte
MinIndex uint64
MaxIndex uint64
Expand All @@ -122,6 +124,7 @@ type WithdrawalRequestTxFilter struct {
type ConsolidationRequestFilter struct {
MinSlot uint64
MaxSlot uint64
PublicKey []byte
SourceAddress []byte
MinSrcIndex uint64
MaxSrcIndex uint64
Expand All @@ -135,6 +138,7 @@ type ConsolidationRequestFilter struct {
type ConsolidationRequestTxFilter struct {
MinDequeue uint64
MaxDequeue uint64
PublicKey []byte
SourceAddress []byte
MinSrcIndex uint64
MaxSrcIndex uint64
Expand Down
31 changes: 18 additions & 13 deletions handlers/pageData.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,25 @@ func createMenuItems(active string) []types.MainMenuItem {
},
},
})
validatorMenu = append(validatorMenu, types.NavigationGroup{
Links: []types.NavigationLink{
{
Label: "Withdrawal Requests",
Path: "/validators/el_withdrawals",
Icon: "fa-money-bill-transfer",
},
{
Label: "Consolidation Requests",
Path: "/validators/el_consolidations",
Icon: "fa-square-plus",

chainState := services.GlobalBeaconService.GetChainState()
specs := chainState.GetSpecs()
if specs != nil && specs.ElectraForkEpoch != nil && uint64(chainState.CurrentEpoch()) >= *specs.ElectraForkEpoch {
validatorMenu = append(validatorMenu, types.NavigationGroup{
Links: []types.NavigationLink{
{
Label: "Withdrawal Requests",
Path: "/validators/el_withdrawals",
Icon: "fa-money-bill-transfer",
},
{
Label: "Consolidation Requests",
Path: "/validators/el_consolidations",
Icon: "fa-square-plus",
},
},
},
})
})
}

submitLinks := []types.NavigationLink{}
if utils.Config.Frontend.ShowSubmitDeposit {
Expand Down
Loading

0 comments on commit 2d524c2

Please sign in to comment.