Skip to content

Commit

Permalink
pusing files
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidu28 committed Jan 19, 2024
1 parent 5873d71 commit 5f3e0aa
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified data/.DS_Store
Binary file not shown.
Binary file added data/deneb_goerli_slot_7413760.json.zip
Binary file not shown.
Binary file added data/deneb_goerli_slot_7416760.json.zip
Binary file not shown.
1 change: 1 addition & 0 deletions data/goerli_block_header_7413660.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"execution_optimistic":false,"finalized":true,"data":{"root":"0x357fdc73451a49189f83380b095af76d9c7a8b20c97393818c63d17d3fa1a1b9","canonical":true,"header":{"message":{"slot":"7413660","proposer_index":"292070","parent_root":"0x7a2ba1dd6323f6e86457979547e458e5b1e3fceceb0bb80e51090a4c1ce2be27","state_root":"0xc48a60a132370ecfeb36d5701a62859209bec8c5b63dbf3023a7de0e4fa23e39","body_root":"0x4e663d9078a396ecd193fe7d95de3bfe4c5b2e85160d78b0242ce8d5aefb8cc9"},"signature":"0xacfb8fe3f6dda14474d56747b11760047d1d4c7f7b5fea627bb1003f7c1112f26031abd449e60776113012b50b62f3780af913048a0045fe6322d155bf57a1a540fa348c9c722b14d255096dcd077e46f118d5e2208c86de6c8a5056ad984d63"}}}
18 changes: 9 additions & 9 deletions merkle_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ func TestMain(m *testing.M) {

func setupSuite() {
log.Println("Setting up suite")
// stateFile := "data/goerli_slot_6399998.json"
// headerFile := "data/goerli_block_header_6376200.json"
// bodyFile := "data/goerli_block_6376200.json"
stateFile := "data/deneb_slot_7426414.json"
stateFile := "data/deneb_goerli_slot_7413760.json"
headerFile := "data/deneb_goerli_block_header_7426113.json"
bodyFile := "data/deneb_goerli_block_7426113.json"

Expand Down Expand Up @@ -189,21 +186,24 @@ func TestProveBeaconTopLevelRootAgainstBeaconState(t *testing.T) {

func TestGetHistoricalSummariesBlockRootsProofProof(t *testing.T) {

currentBeaconStateJSON, err := parseJSONFile("data/goerli_slot_6399998.json")
//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")

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/goerli_slot_6397952.json")
oldBeaconStateJSON, err := parseJSONFile("data/deneb_goerli_slot_7413760.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/goerli_block_header_6397852.json")
blockHeader, err = ExtractBlockHeader("data/goerli_block_header_7413660.json")

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

ParseDenebBeaconStateFromJSON(*currentBeaconStateJSON, &currentBeaconState)
ParseDenebBeaconStateFromJSON(*oldBeaconStateJSON, &oldBeaconState)
fmt.Println("currentBeacon state historical summary lentgh is", len(currentBeaconState.HistoricalSummaries))

currentBeaconStateTopLevelRoots, _ := ComputeBeaconStateTopLevelRoots(&currentBeaconState)
//oldBeaconStateTopLevelRoots, _ := ComputeBeaconStateTopLevelRoots(&oldBeaconState)
Expand All @@ -221,7 +222,7 @@ func TestGetHistoricalSummariesBlockRootsProofProof(t *testing.T) {
fmt.Println("error")
}

historicalSummaryIndex := uint64(146)
historicalSummaryIndex := uint64(270)
beaconBlockHeaderToVerifyIndex = 8092 //(6397852 mod 8192)
beaconBlockHeaderToVerify, err := blockHeader.HashTreeRoot()
if err != nil {
Expand Down Expand Up @@ -397,7 +398,6 @@ func TestStateRootAgainstLatestBlockHeaderProof(t *testing.T) {
// ParseCapellaBeaconStateFromJSON(*oracleStateJSON, &oracleState)

var blockHeader phase0.BeaconBlockHeader
//buf, err := os.ReadFile("data/goerli_block_header_6399998.json")
blockHeader, err := ExtractBlockHeader("data/deneb_goerli_block_header_7426414.json")
if err != nil {
fmt.Println("error with block header", err)
Expand Down

0 comments on commit 5f3e0aa

Please sign in to comment.