Skip to content

Commit

Permalink
Change gwei math to primitives package for ePBS state
Browse files Browse the repository at this point in the history
  • Loading branch information
potuz committed May 21, 2024
1 parent 84244b6 commit 6a92bf8
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 221 deletions.
1 change: 1 addition & 0 deletions beacon-chain/core/helpers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ go_test(
"//container/slice:go_default_library",
"//crypto/hash:go_default_library",
"//encoding/bytesutil:go_default_library",
"//math:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion proto/engine/v1/generated.ssz.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/eth/v1/generated.ssz.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/eth/v2/generated.ssz.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

290 changes: 147 additions & 143 deletions proto/prysm/v1alpha1/beacon_state.pb.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions proto/prysm/v1alpha1/beacon_state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ message BeaconStateEPBS {

// Fields introduced in Electra fork [12001-13000]
uint64 deposit_receipts_start_index = 12001;
uint64 deposit_balance_to_consume = 12002 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/math.Gwei"];
uint64 exit_balance_to_consume = 12003 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/math.Gwei"];
uint64 deposit_balance_to_consume = 12002 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"];
uint64 exit_balance_to_consume = 12003 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"];
uint64 earliest_exit_epoch = 12004 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"];
uint64 consolidation_balance_to_consume = 12005 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/math.Gwei"];
uint64 consolidation_balance_to_consume = 12005 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Gwei"];
uint64 earliest_consolidation_epoch = 12006 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"];
repeated PendingBalanceDeposit pending_balance_deposits = 12007 [(ethereum.eth.ext.ssz_max) = "pending_balance_deposits_limit"];
repeated PendingPartialWithdrawal pending_partial_withdrawals = 12008 [(ethereum.eth.ext.ssz_max) = "pending_partial_withdrawals_limit"];
Expand Down
133 changes: 66 additions & 67 deletions proto/prysm/v1alpha1/generated.ssz.go
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion testing/util/random/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ go_library(
"//config/fieldparams:go_default_library",
"//config/params:go_default_library",
"//consensus-types/primitives:go_default_library",
"//math:go_default_library",
"//proto/engine/v1:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
Expand Down
7 changes: 3 additions & 4 deletions testing/util/random/epbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
"github.com/prysmaticlabs/prysm/v5/config/params"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v5/math"
enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
)
Expand Down Expand Up @@ -242,10 +241,10 @@ func BeaconState(t *testing.T) *ethpb.BeaconStateEPBS {
StateSummaryRoot: randomBytes(32, t),
}},
DepositReceiptsStartIndex: randomUint64(t),
DepositBalanceToConsume: math.Gwei(randomUint64(t)),
ExitBalanceToConsume: math.Gwei(randomUint64(t)),
DepositBalanceToConsume: primitives.Gwei(randomUint64(t)),
ExitBalanceToConsume: primitives.Gwei(randomUint64(t)),
EarliestExitEpoch: primitives.Epoch(randomUint64(t)),
ConsolidationBalanceToConsume: math.Gwei(randomUint64(t)),
ConsolidationBalanceToConsume: primitives.Gwei(randomUint64(t)),
EarliestConsolidationEpoch: primitives.Epoch(randomUint64(t)),
PendingBalanceDeposits: []*ethpb.PendingBalanceDeposit{
{
Expand Down

0 comments on commit 6a92bf8

Please sign in to comment.