Skip to content

Commit

Permalink
fixed HistoricalSummaries test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidu28 committed Jan 19, 2024
1 parent 5353ed1 commit 92d2933
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ data/goerli_slot_6399998.json
data/deneb_slot_7426414.json
data/deneb_goerli_slot_7416760.json
data/deneb_goerli_slot_7413760.json
data/deneb_goerli_slot_7421952.json
data/deneb_goerli_slot_7431952.json
1 change: 1 addition & 0 deletions data/deneb_goerli_block_header_7421951.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"execution_optimistic":false,"finalized":true,"data":{"root":"0xaafa3e5ace765c9b0a31090e98df340aa416fff8772f2aff60985a6716c0828a","canonical":true,"header":{"message":{"slot":"7421951","proposer_index":"92813","parent_root":"0x273d5cec9b06327f6b83f079e34df0678d905713326e4ac2fe3afe8b12d4af22","state_root":"0x5c9667611db0c7828741bfd6b4c37c20f2c5a354e04af741f429f0f26bf1b865","body_root":"0xcdc38bff1d0dd202e216af7bef303aa7e0da814190066fb2fe082e3110355a50"},"signature":"0xb243ef52d522779359cb8bccbd1b0be62beb03371ccec254778272d45853f571ddc3643d945478412835667f0dfacd7917434a915a4575500c413d9960e27cb013bd271f3730619515a4a9246347a9ddea9f8f9a273fa2d1ab8e04b931fe1780"}}}
Binary file added data/deneb_goerli_slot_7421952.json.zip
Binary file not shown.
Binary file added data/deneb_goerli_slot_7431952.json.zip
Binary file not shown.
10 changes: 5 additions & 5 deletions merkle_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,22 @@ func TestProveBeaconTopLevelRootAgainstBeaconState(t *testing.T) {
func TestGetHistoricalSummariesBlockRootsProofProof(t *testing.T) {

//curl -H "Accept: application/json" https://data.spiceai.io/goerli/beacon/eth/v2/debug/beacon/states/7416760 -o deneb_goerli_slot_7416760.json --header 'X-API-Key: 343035|8b6ddd9b31f54c07b3fc18282b30f61c'
currentBeaconStateJSON, err := parseJSONFile("data/deneb_goerli_slot_7416760.json")
currentBeaconStateJSON, err := parseJSONFile("data/deneb_goerli_slot_7431952.json")

if err != nil {
fmt.Println("error parsing currentBeaconStateJSON")
}

//this is not the beacon state of the slot containing the old withdrawal we want to proof but rather
// its the state that was merklized to create a historical summary containing the slot that has that withdrawal
oldBeaconStateJSON, err := parseJSONFile("data/deneb_goerli_slot_7413760.json")
oldBeaconStateJSON, err := parseJSONFile("data/deneb_goerli_slot_7421952.json")
if err != nil {
fmt.Println("error parsing oldBeaconStateJSON")
}

var blockHeader phase0.BeaconBlockHeader
//blockHeader, err = ExtractBlockHeader("data/goerli_block_header_6397852.json")
blockHeader, err = ExtractBlockHeader("data/deneb_goerli_block_header_7413660.json")
blockHeader, err = ExtractBlockHeader("data/deneb_goerli_block_header_7421951.json")

if err != nil {
fmt.Println("blockHeader.UnmarshalJSON error", err)
Expand All @@ -222,8 +222,8 @@ func TestGetHistoricalSummariesBlockRootsProofProof(t *testing.T) {
fmt.Println("error")
}

historicalSummaryIndex := uint64(270)
beaconBlockHeaderToVerifyIndex = 8092 //(6397852 mod 8192)
historicalSummaryIndex := uint64(271)
beaconBlockHeaderToVerifyIndex = 8191 //(6397852 mod 8192)
beaconBlockHeaderToVerify, err := blockHeader.HashTreeRoot()
if err != nil {
fmt.Println("error", err)
Expand Down

0 comments on commit 92d2933

Please sign in to comment.