-
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.
Merge branch 'develop' into electra-e2e
- Loading branch information
Showing
55 changed files
with
998 additions
and
610 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
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
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,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
Oops, something went wrong.