Skip to content

Commit

Permalink
TestStateRootAgainstLatestBlockHeaderProof working
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidu28 committed Jan 19, 2024
1 parent 78815e8 commit 577b4ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
14 changes: 12 additions & 2 deletions data/deneb_goerli_block_header_7426414.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{
"execution_optimistic": false,
"finalized": true,
"data": {
"root": "0xc84b253c816b028a2d3712bb0e51d35fc89c7494bf82cbc86013633f85f6e3b3",
"canonical": true,
"header": {
"message": {
"slot": "7426414",
"proposer_index": "159320",
"parent_root": "0xfa586c486340d7f587d394e88e3bcf716ea4f114ade2c1fc4a34cee4639bac3c",
"state_root": "0x5e4b30444a386c0b96d0c06d02281c72294b98c1d5def533c325de54496cab4a",
"body_root": "0x9f29bd12c85f8936a56e5d3dc63d594ae935695ea7325d7434fa019189d7c65c"
}

},
"signature": "0xa2fc10e1a762fa7947e7d2cac625af8f9f084c78850845950d22e103a9c0e01020dcf25dda9271e11c6489053b84d519194eeb385155f73a22678c0dd95658f304bceca6c27c56966704092a4af372597e1a55fe77d20b7b3bcd37cb9ebc9737"
}
}
}
13 changes: 5 additions & 8 deletions merkle_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,19 +397,16 @@ func TestStateRootAgainstLatestBlockHeaderProof(t *testing.T) {
// ParseCapellaBeaconStateFromJSON(*oracleStateJSON, &oracleState)

var blockHeader phase0.BeaconBlockHeader
// buf, err := os.ReadFile("data/goerli_block_header_6399998.json")
buf, err := os.ReadFile("data/deneb_goerli_block_header_7426414.json")
//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("read error with header file")
}
err = blockHeader.UnmarshalJSON(buf)
if err != nil {
fmt.Println("blockHeader.UnmarshalJSON error", err)
fmt.Println("error with block header", err)
}

//the state from the prev slot which contains shit we wanna prove about
// stateToProveJSON, err := parseJSONFile("data/goerli_slot_6399998.json")
stateToProveJSON, err := parseJSONFile("data/deneb_slot_7426414.json")

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

Expand All @@ -431,7 +428,7 @@ func TestStateRootAgainstLatestBlockHeaderProof(t *testing.T) {

flag := ValidateProof(root, proof, leaf, 3)
if flag != true {
fmt.Println("this 2 error")
fmt.Println("this error")
}
assert.True(t, flag, "Proof %v failed")
}
Expand Down

0 comments on commit 577b4ad

Please sign in to comment.