|
1 | 1 | package eigenpodproofs_test |
2 | 2 |
|
3 | | -import ( |
4 | | - "math/big" |
5 | | - "testing" |
| 3 | +// func TestValidatorContainersProofOnChain(t *testing.T) { |
| 4 | +// validators, err := beaconState.Validators() |
| 5 | +// if err != nil { |
| 6 | +// t.Fatal(err) |
| 7 | +// } |
6 | 8 |
|
7 | | - BeaconChainProofsWrapper "github.com/Layr-Labs/eigenpod-proofs-generation/bindings/BeaconChainProofsWrapper" |
8 | | - "github.com/ethereum/go-ethereum/accounts/abi/bind" |
9 | | - "github.com/stretchr/testify/assert" |
10 | | -) |
| 9 | +// validatorIndices := []uint64{} |
| 10 | +// for i := int(0); i < len(validators); i += 100000000 { |
| 11 | +// validatorIndices = append(validatorIndices, uint64(i)) |
| 12 | +// } |
11 | 13 |
|
12 | | -func TestValidatorContainersProofOnChain(t *testing.T) { |
13 | | - validators, err := beaconState.Validators() |
14 | | - if err != nil { |
15 | | - t.Fatal(err) |
16 | | - } |
| 14 | +// verifyValidatorFieldsCallParams, err := epp.ProveValidatorContainers(beaconHeader, beaconState, validatorIndices) |
| 15 | +// if err != nil { |
| 16 | +// t.Fatal(err) |
| 17 | +// } |
17 | 18 |
|
18 | | - validatorIndices := []uint64{} |
19 | | - for i := int(0); i < len(validators); i += 100000000 { |
20 | | - validatorIndices = append(validatorIndices, uint64(i)) |
21 | | - } |
| 19 | +// blockRoot, err := beaconHeader.HashTreeRoot() |
| 20 | +// if err != nil { |
| 21 | +// t.Fatal(err) |
| 22 | +// } |
22 | 23 |
|
23 | | - verifyValidatorFieldsCallParams, err := epp.ProveValidatorContainers(beaconHeader, beaconState, validatorIndices) |
24 | | - if err != nil { |
25 | | - t.Fatal(err) |
26 | | - } |
| 24 | +// err = beaconChainProofsWrapper.VerifyStateRoot( |
| 25 | +// &bind.CallOpts{}, |
| 26 | +// blockRoot, |
| 27 | +// BeaconChainProofsWrapper.BeaconChainProofsStateRootProof{ |
| 28 | +// BeaconStateRoot: verifyValidatorFieldsCallParams.StateRootProof.BeaconStateRoot, |
| 29 | +// Proof: verifyValidatorFieldsCallParams.StateRootProof.Proof.ToByteSlice(), |
| 30 | +// }, |
| 31 | +// ) |
| 32 | +// assert.Nil(t, err) |
27 | 33 |
|
28 | | - blockRoot, err := beaconHeader.HashTreeRoot() |
29 | | - if err != nil { |
30 | | - t.Fatal(err) |
31 | | - } |
| 34 | +// for i := 0; i < len(verifyValidatorFieldsCallParams.ValidatorFields); i++ { |
| 35 | +// validatorFields := [][32]byte{} |
| 36 | +// for _, field := range verifyValidatorFieldsCallParams.ValidatorFields[i] { |
| 37 | +// validatorFields = append(validatorFields, field) |
| 38 | +// } |
32 | 39 |
|
33 | | - err = beaconChainProofsWrapper.VerifyStateRoot( |
34 | | - &bind.CallOpts{}, |
35 | | - blockRoot, |
36 | | - BeaconChainProofsWrapper.BeaconChainProofsStateRootProof{ |
37 | | - BeaconStateRoot: verifyValidatorFieldsCallParams.StateRootProof.BeaconStateRoot, |
38 | | - Proof: verifyValidatorFieldsCallParams.StateRootProof.Proof.ToByteSlice(), |
39 | | - }, |
40 | | - ) |
41 | | - assert.Nil(t, err) |
| 40 | +// err = beaconChainProofsWrapper.VerifyValidatorFields( |
| 41 | +// &bind.CallOpts{}, |
| 42 | +// uint64(0), |
| 43 | +// verifyValidatorFieldsCallParams.StateRootProof.BeaconStateRoot, |
| 44 | +// validatorFields, |
| 45 | +// verifyValidatorFieldsCallParams.ValidatorFieldsProofs[i].ToByteSlice(), |
| 46 | +// new(big.Int).SetUint64(verifyValidatorFieldsCallParams.ValidatorIndices[i]), |
| 47 | +// ) |
| 48 | +// assert.Nil(t, err) |
| 49 | +// } |
| 50 | +// } |
42 | 51 |
|
43 | | - for i := 0; i < len(verifyValidatorFieldsCallParams.ValidatorFields); i++ { |
44 | | - validatorFields := [][32]byte{} |
45 | | - for _, field := range verifyValidatorFieldsCallParams.ValidatorFields[i] { |
46 | | - validatorFields = append(validatorFields, field) |
47 | | - } |
| 52 | +// func TestValidatorBalancesProofOnChain(t *testing.T) { |
| 53 | +// validators, err := beaconState.Validators() |
| 54 | +// if err != nil { |
| 55 | +// t.Fatal(err) |
| 56 | +// } |
48 | 57 |
|
49 | | - err = beaconChainProofsWrapper.VerifyValidatorFields( |
50 | | - &bind.CallOpts{}, |
51 | | - uint64(0), |
52 | | - verifyValidatorFieldsCallParams.StateRootProof.BeaconStateRoot, |
53 | | - validatorFields, |
54 | | - verifyValidatorFieldsCallParams.ValidatorFieldsProofs[i].ToByteSlice(), |
55 | | - new(big.Int).SetUint64(verifyValidatorFieldsCallParams.ValidatorIndices[i]), |
56 | | - ) |
57 | | - assert.Nil(t, err) |
58 | | - } |
59 | | -} |
| 58 | +// validatorIndices := []uint64{} |
| 59 | +// for i := int(0); i < len(validators); i += 100000000 { |
| 60 | +// validatorIndices = append(validatorIndices, uint64(i)) |
| 61 | +// } |
60 | 62 |
|
61 | | -func TestValidatorBalancesProofOnChain(t *testing.T) { |
62 | | - validators, err := beaconState.Validators() |
63 | | - if err != nil { |
64 | | - t.Fatal(err) |
65 | | - } |
| 63 | +// verifyCheckpointProofsCallParams, err := epp.ProveCheckpointProofs(beaconHeader, beaconState, validatorIndices) |
| 64 | +// if err != nil { |
| 65 | +// t.Fatal(err) |
| 66 | +// } |
66 | 67 |
|
67 | | - validatorIndices := []uint64{} |
68 | | - for i := int(0); i < len(validators); i += 100000000 { |
69 | | - validatorIndices = append(validatorIndices, uint64(i)) |
70 | | - } |
| 68 | +// blockRoot, err := beaconHeader.HashTreeRoot() |
| 69 | +// if err != nil { |
| 70 | +// t.Fatal(err) |
| 71 | +// } |
71 | 72 |
|
72 | | - verifyCheckpointProofsCallParams, err := epp.ProveCheckpointProofs(beaconHeader, beaconState, validatorIndices) |
73 | | - if err != nil { |
74 | | - t.Fatal(err) |
75 | | - } |
| 73 | +// err = beaconChainProofsWrapper.VerifyBalanceContainer( |
| 74 | +// &bind.CallOpts{}, |
| 75 | +// uint64(0), |
| 76 | +// blockRoot, |
| 77 | +// BeaconChainProofsWrapper.BeaconChainProofsBalanceContainerProof{ |
| 78 | +// BalanceContainerRoot: verifyCheckpointProofsCallParams.ValidatorBalancesRootProof.ValidatorBalancesRoot, |
| 79 | +// Proof: verifyCheckpointProofsCallParams.ValidatorBalancesRootProof.Proof.ToByteSlice(), |
| 80 | +// }, |
| 81 | +// ) |
| 82 | +// assert.Nil(t, err) |
76 | 83 |
|
77 | | - blockRoot, err := beaconHeader.HashTreeRoot() |
78 | | - if err != nil { |
79 | | - t.Fatal(err) |
80 | | - } |
81 | | - |
82 | | - err = beaconChainProofsWrapper.VerifyBalanceContainer( |
83 | | - &bind.CallOpts{}, |
84 | | - uint64(0), |
85 | | - blockRoot, |
86 | | - BeaconChainProofsWrapper.BeaconChainProofsBalanceContainerProof{ |
87 | | - BalanceContainerRoot: verifyCheckpointProofsCallParams.ValidatorBalancesRootProof.ValidatorBalancesRoot, |
88 | | - Proof: verifyCheckpointProofsCallParams.ValidatorBalancesRootProof.Proof.ToByteSlice(), |
89 | | - }, |
90 | | - ) |
91 | | - assert.Nil(t, err) |
92 | | - |
93 | | - for i := 0; i < len(verifyCheckpointProofsCallParams.BalanceProofs); i++ { |
94 | | - _, err = beaconChainProofsWrapper.VerifyValidatorBalance( |
95 | | - &bind.CallOpts{}, |
96 | | - verifyCheckpointProofsCallParams.ValidatorBalancesRootProof.ValidatorBalancesRoot, |
97 | | - new(big.Int).SetUint64(validatorIndices[i]), |
98 | | - BeaconChainProofsWrapper.BeaconChainProofsBalanceProof{ |
99 | | - PubkeyHash: verifyCheckpointProofsCallParams.BalanceProofs[i].PubkeyHash, |
100 | | - BalanceRoot: verifyCheckpointProofsCallParams.BalanceProofs[i].BalanceRoot, |
101 | | - Proof: verifyCheckpointProofsCallParams.BalanceProofs[i].Proof.ToByteSlice(), |
102 | | - }, |
103 | | - ) |
104 | | - assert.Nil(t, err) |
105 | | - } |
106 | | -} |
| 84 | +// for i := 0; i < len(verifyCheckpointProofsCallParams.BalanceProofs); i++ { |
| 85 | +// _, err = beaconChainProofsWrapper.VerifyValidatorBalance( |
| 86 | +// &bind.CallOpts{}, |
| 87 | +// verifyCheckpointProofsCallParams.ValidatorBalancesRootProof.ValidatorBalancesRoot, |
| 88 | +// new(big.Int).SetUint64(validatorIndices[i]), |
| 89 | +// BeaconChainProofsWrapper.BeaconChainProofsBalanceProof{ |
| 90 | +// PubkeyHash: verifyCheckpointProofsCallParams.BalanceProofs[i].PubkeyHash, |
| 91 | +// BalanceRoot: verifyCheckpointProofsCallParams.BalanceProofs[i].BalanceRoot, |
| 92 | +// Proof: verifyCheckpointProofsCallParams.BalanceProofs[i].Proof.ToByteSlice(), |
| 93 | +// }, |
| 94 | +// ) |
| 95 | +// assert.Nil(t, err) |
| 96 | +// } |
| 97 | +// } |
0 commit comments