Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidu28 committed Jan 25, 2024
1 parent 882b112 commit 4ebfb96
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 188 deletions.
4 changes: 0 additions & 4 deletions beacon/shared.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package beacon

import (
"fmt"
"math/big"

"github.com/Layr-Labs/eigenpod-proofs-generation/common"
Expand Down Expand Up @@ -161,8 +160,6 @@ func ProveWithdrawalAgainstExecutionPayload(
return nil, err
}

fmt.Println("LENGTH OF withdrawalListAgainstExecutionPayloadProof is", len(withdrawalListAgainstExecutionPayloadProof))

// prove the withdrawal against the withdrawal list
withdrawalAgainstWithdrawalListProof, err := ProveWithdrawalAgainstWithdrawalList(withdrawals, withdrawalIndex)
if err != nil {
Expand All @@ -171,7 +168,6 @@ func ProveWithdrawalAgainstExecutionPayload(

//NOTE: Ensure that these proofs are being appended in the right order
fullWithdrawalProof := append(withdrawalAgainstWithdrawalListProof, withdrawalListAgainstExecutionPayloadProof...)
fmt.Println("LENGTH OF fullWithdrawalProof is", len(fullWithdrawalProof))
return fullWithdrawalProof, nil
}

Expand Down
2 changes: 1 addition & 1 deletion generation/generate_balance_update_proof.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package generation
package main

import (
"encoding/hex"
Expand Down
2 changes: 1 addition & 1 deletion generation/generate_validator_proof.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package generation
package main

import (
"encoding/hex"
Expand Down
2 changes: 1 addition & 1 deletion generation/generate_withdrawal_fields_proof.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package generation
package main

import (
"encoding/hex"
Expand Down
Binary file added generation/generation
Binary file not shown.
2 changes: 1 addition & 1 deletion generation/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package generation
package main

import (
"flag"
Expand Down
4 changes: 1 addition & 3 deletions generation/proof_utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package generation
package main

import (
"encoding/hex"
Expand Down Expand Up @@ -204,8 +204,6 @@ func ExtractBlockHeader(blockHeaderFile string) (phase0.BeaconBlockHeader, error
return phase0.BeaconBlockHeader{}, err
}

fmt.Println(inputData.Data.Header.Message)

return inputData.Data.Header.Message, nil
}

Expand Down
161 changes: 0 additions & 161 deletions generation/withdrawal_proof_302913.json

This file was deleted.

22 changes: 6 additions & 16 deletions merkle_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ func TestGetHistoricalSummariesBlockRootsProofProof(t *testing.T) {
}

//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, ie, 7421952 mod 8192 = 0
// its the state that was merklized to create a historical summary containing the slot that has that withdrawal
//, ie, 7421952 mod 8192 = 0 and 7421952 - 7421951 < 8192
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_7421951.json")

if err != nil {
Expand All @@ -219,27 +219,20 @@ func TestGetHistoricalSummariesBlockRootsProofProof(t *testing.T) {

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

currentBeaconStateTopLevelRoots, _ := beacon.ComputeBeaconStateTopLevelRootsDeneb(&currentBeaconState)
//oldBeaconStateTopLevelRoots, _ := ComputeBeaconStateTopLevelRoots(&oldBeaconState)

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

historicalSummaryIndex := uint64(271)
historicalSummaryIndex := uint64(271) //7421951 - FIRST_CAPELLA_SLOT_GOERLI // 8192
beaconBlockHeaderToVerifyIndex = 8191 //(7421951 mod 8192)
beaconBlockHeaderToVerify, err := blockHeader.HashTreeRoot()
if err != nil {
fmt.Println("error", err)
}

// fmt.Println("THESE SHOULD BE", hex.EncodeToString(beaconBlockHeaderToVerify[:]))
// fmt.Println("THE SAME", hex.EncodeToString(beaconBlockHeaderToVerify[:]))
// fmt.Println("THESE SHOULD BE", hex.EncodeToString(oldBeaconStateTopLevelRoots.BlockRootsRoot[:]))
// fmt.Println("THE SAME", hex.EncodeToString(currentBeaconState.HistoricalSummaries[146].BlockSummaryRoot[:]))

oldBlockRoots := oldBeaconState.BlockRoots

historicalSummaryBlockHeaderProof, err := beacon.ProveBlockRootAgainstBeaconStateViaHistoricalSummaries(
Expand Down Expand Up @@ -297,7 +290,6 @@ func TestGetHistoricalSummariesBlockRootsProofProofCapellaAgainstDeneb(t *testin

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

currentBeaconStateTopLevelRoots, _ := beacon.ComputeBeaconStateTopLevelRootsDeneb(&currentBeaconState)
//oldBeaconStateTopLevelRoots, _ := ComputeBeaconStateTopLevelRoots(&oldBeaconState)
Expand Down Expand Up @@ -489,19 +481,17 @@ func TestStateRootAgainstLatestBlockHeaderProof(t *testing.T) {

//the state from the prev slot which contains shit we wanna prove about
stateToProveJSON, err := parseJSONFile("data/deneb_goerli_slot_7413760.json")
if err != nil {
fmt.Println("error with parsing JSON state file", err)
}

var stateToProve deneb.BeaconState
ParseDenebBeaconStateFromJSON(*stateToProveJSON, &stateToProve)

roots, _ := stateToProve.HashTreeRoot()
fmt.Println("THIS IS ROOT", roots)
proof, err := beacon.ProveStateRootAgainstBlockHeader(&blockHeader)
if err != nil {
fmt.Println("Error in generating proof", err)
}

fmt.Println(len(stateToProve.Validators))

root, err := blockHeader.HashTreeRoot()
if err != nil {
fmt.Println("this error", err)
Expand Down

0 comments on commit 4ebfb96

Please sign in to comment.