mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Add /eth/v1/beacon/deposit_snapshot endpoint (#13514)
* Add endpoint * Uncomment in InitializeRoutes * Add test * Add 404 * Add more checks * Test improvements * Ssz * Add ssz tags * Add DepositSnapshot to bazel * Fix tests * Fix max size * Resolve conflicts * Revert untouched code * Fix test + review * Lint * Oops * Preston + Radek' review * Only return 3 finalized roots * Change to deposit contract depth * Radek' review * Gaz --------- Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This commit is contained in:
@@ -1074,3 +1074,17 @@ func sszBytesToUint256String(b []byte) (string, error) {
|
||||
}
|
||||
return bi.String(), nil
|
||||
}
|
||||
|
||||
func DepositSnapshotFromConsensus(ds *eth.DepositSnapshot) *DepositSnapshot {
|
||||
finalized := make([]string, 0, len(ds.Finalized))
|
||||
for _, f := range ds.Finalized {
|
||||
finalized = append(finalized, hexutil.Encode(f))
|
||||
}
|
||||
return &DepositSnapshot{
|
||||
Finalized: finalized,
|
||||
DepositRoot: hexutil.Encode(ds.DepositRoot),
|
||||
DepositCount: fmt.Sprintf("%d", ds.DepositCount),
|
||||
ExecutionBlockHash: hexutil.Encode(ds.ExecutionHash),
|
||||
ExecutionBlockHeight: fmt.Sprintf("%d", ds.ExecutionDepth),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user