-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip eth1data voting after electra (#14835)
* wip skip eth1data voting after electra * updating technique * adding fix for electra eth1 voting * fixing linting on test * seeing if reversing genesis state fixes problem * increasing safety of legacy check * review feedback * forgot to fix tests * nishant's feedback * nishant's feedback * rename function a little * Update beacon-chain/core/helpers/legacy.go Co-authored-by: Jun Song <[email protected]> * fixing naming --------- Co-authored-by: Jun Song <[email protected]>
- Loading branch information
1 parent
1069da1
commit d887536
Showing
9 changed files
with
116 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package helpers | ||
|
||
import ( | ||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state" | ||
"github.com/prysmaticlabs/prysm/v5/runtime/version" | ||
) | ||
|
||
// DepositRequestsStarted determines if the deposit requests have started. | ||
func DepositRequestsStarted(beaconState state.BeaconState) bool { | ||
if beaconState.Version() < version.Electra { | ||
return false | ||
} | ||
|
||
requestsStartIndex, err := beaconState.DepositRequestsStartIndex() | ||
if err != nil { | ||
return false | ||
} | ||
|
||
return beaconState.Eth1DepositIndex() == requestsStartIndex | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package helpers_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers" | ||
"github.com/prysmaticlabs/prysm/v5/testing/util" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// TestDepositRequestHaveStarted contains several test cases for depositRequestHaveStarted. | ||
func TestDepositRequestHaveStarted(t *testing.T) { | ||
t.Run("Version below Electra returns false", func(t *testing.T) { | ||
st, _ := util.DeterministicGenesisStateBellatrix(t, 1) | ||
result := helpers.DepositRequestsStarted(st) | ||
require.False(t, result) | ||
}) | ||
|
||
t.Run("Version is Electra or higher, no error, but Eth1DepositIndex != requestsStartIndex returns false", func(t *testing.T) { | ||
st, _ := util.DeterministicGenesisStateElectra(t, 1) | ||
require.NoError(t, st.SetEth1DepositIndex(1)) | ||
result := helpers.DepositRequestsStarted(st) | ||
require.False(t, result) | ||
}) | ||
|
||
t.Run("Version is Electra or higher, no error, and Eth1DepositIndex == requestsStartIndex returns true", func(t *testing.T) { | ||
st, _ := util.DeterministicGenesisStateElectra(t, 1) | ||
require.NoError(t, st.SetEth1DepositIndex(33)) | ||
require.NoError(t, st.SetDepositRequestsStartIndex(33)) | ||
result := helpers.DepositRequestsStarted(st) | ||
require.True(t, result) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Added | ||
|
||
- check to stop eth1 voting after electra and eth1 deposits stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters