Skip to content

Commit

Permalink
feat(ssz): SSZTypes (berachain#1626)
Browse files Browse the repository at this point in the history
Co-authored-by: Cal Bera <[email protected]>
  • Loading branch information
itsdevbear and calbera authored Jun 27, 2024
1 parent de48919 commit 9e4bc31
Show file tree
Hide file tree
Showing 64 changed files with 1,020 additions and 406 deletions.
2 changes: 1 addition & 1 deletion beacond/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ require (
github.com/berachain/beacon-kit/mod/log v0.0.0-20240619234034-fe96d94eafef // indirect
github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd // indirect
github.com/berachain/beacon-kit/mod/payload v0.0.0-20240624003607-df94860f8eeb // indirect
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588 // indirect
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6 // indirect
github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240624003607-df94860f8eeb // indirect
github.com/berachain/beacon-kit/mod/state-transition v0.0.0-20240624003607-df94860f8eeb // indirect
github.com/berachain/beacon-kit/mod/storage v0.0.0-20240624003607-df94860f8eeb // indirect
Expand Down
4 changes: 2 additions & 2 deletions beacond/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd h1:QH
github.com/berachain/beacon-kit/mod/p2p v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:ft214cxJaqrRPOuAjpYwgA9AOElJnHrDZZEQ0jZPWwQ=
github.com/berachain/beacon-kit/mod/payload v0.0.0-20240624003607-df94860f8eeb h1:/aKXt8E60/AMOod4MMhbf+8POaIE1vW43ufnTdAZ3uo=
github.com/berachain/beacon-kit/mod/payload v0.0.0-20240624003607-df94860f8eeb/go.mod h1:IFOWyTyeFcwsTkJc0Ud9uMLxQ8r4SyZNFiXpDQaJAgc=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588 h1:zL2vsFmWlm+vbmX17Uc97sVBxjlPlMqQ7Jna0I99uyY=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588/go.mod h1:xg8BworJAcrzTzbTgP/637Be89xAtrRzGkXKSzuRMkQ=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6 h1:5gY+D3SGJJ78t32qIMfC2KQxz5ieXDcCsh544tzdQ6c=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6/go.mod h1:SR9DyddnG1jRxscSEHHQt9E6RaIi/2morGi0YgO4P6s=
github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240624003607-df94860f8eeb h1:Z9hmZ7UatAS2xaAq104mSVwuNzshJh6YCH1hfMP7Ucc=
github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240624003607-df94860f8eeb/go.mod h1:SoPgkydkLS+bbNQu6iLJiRrS+wncytSQ2AjWBj57zFQ=
github.com/berachain/beacon-kit/mod/state-transition v0.0.0-20240624003607-df94860f8eeb h1:LmYd/RSR1itlg5BprDcxzvIgDbJ1pn4mELpt+/t/HkM=
Expand Down
2 changes: 1 addition & 1 deletion mod/cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240624204855-d8809d5c8588
github.com/berachain/beacon-kit/mod/log v0.0.0-20240619234034-fe96d94eafef
github.com/berachain/beacon-kit/mod/node-core v0.0.0-20240624003607-df94860f8eeb
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6
github.com/cometbft/cometbft v1.0.0-alpha.2.0.20240625053718-5a9f3b4a787f
github.com/cosmos/cosmos-sdk v0.51.0
github.com/ethereum/go-ethereum v1.14.5
Expand Down
2 changes: 2 additions & 0 deletions mod/cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ github.com/berachain/beacon-kit/mod/payload v0.0.0-20240624003607-df94860f8eeb h
github.com/berachain/beacon-kit/mod/payload v0.0.0-20240624003607-df94860f8eeb/go.mod h1:IFOWyTyeFcwsTkJc0Ud9uMLxQ8r4SyZNFiXpDQaJAgc=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588 h1:zL2vsFmWlm+vbmX17Uc97sVBxjlPlMqQ7Jna0I99uyY=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588/go.mod h1:xg8BworJAcrzTzbTgP/637Be89xAtrRzGkXKSzuRMkQ=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6 h1:5gY+D3SGJJ78t32qIMfC2KQxz5ieXDcCsh544tzdQ6c=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6/go.mod h1:SR9DyddnG1jRxscSEHHQt9E6RaIi/2morGi0YgO4P6s=
github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240624003607-df94860f8eeb h1:Z9hmZ7UatAS2xaAq104mSVwuNzshJh6YCH1hfMP7Ucc=
github.com/berachain/beacon-kit/mod/runtime v0.0.0-20240624003607-df94860f8eeb/go.mod h1:SoPgkydkLS+bbNQu6iLJiRrS+wncytSQ2AjWBj57zFQ=
github.com/berachain/beacon-kit/mod/state-transition v0.0.0-20240624003607-df94860f8eeb h1:LmYd/RSR1itlg5BprDcxzvIgDbJ1pn4mELpt+/t/HkM=
Expand Down
6 changes: 3 additions & 3 deletions mod/cli/pkg/commands/genesis/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
"github.com/berachain/beacon-kit/mod/primitives/pkg/constants"
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz"
"github.com/berachain/beacon-kit/mod/primitives/pkg/version"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/x/genutil"
Expand Down Expand Up @@ -181,9 +182,8 @@ func executableDataToExecutionPayloadHeader(

g.Go(func() error {
var withdrawalsRootErr error
withdrawalsRoot, withdrawalsRootErr = engineprimitives.Withdrawals(
withdrawals,
).HashTreeRoot()
wds := ssz.ListCompositeFromElements(withdrawals...)
withdrawalsRoot, withdrawalsRootErr = wds.HashTreeRoot()
return withdrawalsRootErr
})

Expand Down
4 changes: 2 additions & 2 deletions mod/cli/pkg/commands/genesis/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/bytes"
"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz/merkleizer"
"github.com/spf13/afero"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -82,7 +82,7 @@ func GetGenesisValidatorRootCmd(cs common.ChainSpec) *cobra.Command {
)
}

merkleizer := ssz.NewMerkleizer[
merkleizer := merkleizer.New[
common.ChainSpec, [32]byte, *types.Validator,
]()
var validatorsRoot common.Root
Expand Down
2 changes: 1 addition & 1 deletion mod/config/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/berachain/beacon-kit/mod/execution v0.0.0-20240624003607-df94860f8eeb
github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44
github.com/berachain/beacon-kit/mod/payload v0.0.0-20240624003607-df94860f8eeb
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6
github.com/cometbft/cometbft v1.0.0-alpha.2.0.20240625053718-5a9f3b4a787f
github.com/mitchellh/mapstructure v1.5.0
github.com/spf13/viper v1.19.0
Expand Down
4 changes: 2 additions & 2 deletions mod/config/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44 h1:R4
github.com/berachain/beacon-kit/mod/log v0.0.0-20240624033454-8f3451361f44/go.mod h1:xP5KcG56VfbPgz2ZRHerxm90MkjXMSDaGZNOOO5yfH4=
github.com/berachain/beacon-kit/mod/payload v0.0.0-20240624003607-df94860f8eeb h1:/aKXt8E60/AMOod4MMhbf+8POaIE1vW43ufnTdAZ3uo=
github.com/berachain/beacon-kit/mod/payload v0.0.0-20240624003607-df94860f8eeb/go.mod h1:IFOWyTyeFcwsTkJc0Ud9uMLxQ8r4SyZNFiXpDQaJAgc=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588 h1:zL2vsFmWlm+vbmX17Uc97sVBxjlPlMqQ7Jna0I99uyY=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588/go.mod h1:xg8BworJAcrzTzbTgP/637Be89xAtrRzGkXKSzuRMkQ=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6 h1:5gY+D3SGJJ78t32qIMfC2KQxz5ieXDcCsh544tzdQ6c=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6/go.mod h1:SR9DyddnG1jRxscSEHHQt9E6RaIi/2morGi0YgO4P6s=
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0=
Expand Down
2 changes: 1 addition & 1 deletion mod/consensus-types/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.4
require (
github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240624204855-d8809d5c8588
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6
github.com/ethereum/go-ethereum v1.14.5
github.com/ferranbt/fastssz v0.1.4-0.20240422063434-a4db75388da1
github.com/stretchr/testify v1.9.0
Expand Down
2 changes: 2 additions & 0 deletions mod/consensus-types/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd h1
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:iXa+Q+i0q+GCpLzkusulO57K5vlkDgM77jtfMr3QdFA=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588 h1:zL2vsFmWlm+vbmX17Uc97sVBxjlPlMqQ7Jna0I99uyY=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588/go.mod h1:xg8BworJAcrzTzbTgP/637Be89xAtrRzGkXKSzuRMkQ=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6 h1:5gY+D3SGJJ78t32qIMfC2KQxz5ieXDcCsh544tzdQ6c=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6/go.mod h1:SR9DyddnG1jRxscSEHHQt9E6RaIi/2morGi0YgO4P6s=
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0=
Expand Down
5 changes: 4 additions & 1 deletion mod/consensus-types/pkg/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
"github.com/berachain/beacon-kit/mod/primitives/pkg/constants"
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz"
"github.com/berachain/beacon-kit/mod/primitives/pkg/version"
"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -149,7 +150,9 @@ func DefaultGenesisExecutionPayloadHeaderDeneb() (

g.Go(func() error {
var err error
emptyWithdrawalsRoot, err = engineprimitives.Withdrawals{}.HashTreeRoot()
wds := ssz.ListCompositeFromElements(
[]*engineprimitives.Withdrawal{}...)
emptyWithdrawalsRoot, err = wds.HashTreeRoot()
return err
})

Expand Down
4 changes: 2 additions & 2 deletions mod/consensus-types/pkg/types/body.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/crypto"
"github.com/berachain/beacon-kit/mod/primitives/pkg/eip4844"
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz/merkleizer"
"github.com/berachain/beacon-kit/mod/primitives/pkg/version"
)

Expand Down Expand Up @@ -203,7 +203,7 @@ func (b *BeaconBlockBodyDeneb) GetTopLevelRoots() ([][32]byte, error) {
err error
layer = make([]common.Root, BodyLengthDeneb)
randao = b.GetRandaoReveal()
merkleizer = ssz.NewMerkleizer[
merkleizer = merkleizer.New[
common.ChainSpec, [32]byte, common.Root,
]()
)
Expand Down
2 changes: 1 addition & 1 deletion mod/consensus-types/pkg/types/body.ssz.go

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

4 changes: 2 additions & 2 deletions mod/consensus-types/pkg/types/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/constants"
"github.com/berachain/beacon-kit/mod/primitives/pkg/crypto"
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz/merkleizer"
)

// Deposit into the consensus layer from the deposit contract in the execution
Expand Down Expand Up @@ -83,7 +83,7 @@ type Deposits []*Deposit
// HashTreeRoot returns the hash tree root of the Withdrawals list.
func (d Deposits) HashTreeRoot() (common.Root, error) {
// TODO: read max deposits from the chain spec.
merkleizer := ssz.NewMerkleizer[common.ChainSpec, [32]byte, *Deposit]()
merkleizer := merkleizer.New[common.ChainSpec, [32]byte, *Deposit]()
return merkleizer.MerkleizeListComposite(
d, constants.MaxDepositsPerBlock,
)
Expand Down
2 changes: 1 addition & 1 deletion mod/consensus-types/pkg/types/deposit.ssz.go

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

6 changes: 3 additions & 3 deletions mod/consensus-types/pkg/types/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/bytes"
"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz"
"github.com/berachain/beacon-kit/mod/primitives/pkg/version"
"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -78,9 +79,8 @@ func (e *ExecutionPayload) ToHeader(

g.Go(func() error {
var withdrawalsRootErr error
withdrawalsRoot, withdrawalsRootErr = engineprimitives.Withdrawals(
e.GetWithdrawals(),
).HashTreeRoot()
wds := ssz.ListCompositeFromElements(e.GetWithdrawals()...)
withdrawalsRoot, withdrawalsRootErr = wds.HashTreeRoot()
return withdrawalsRootErr
})

Expand Down
2 changes: 1 addition & 1 deletion mod/consensus-types/pkg/types/payload.ssz.go

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

4 changes: 2 additions & 2 deletions mod/consensus-types/pkg/types/payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/bytes"
"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz/merkleizer"
"github.com/berachain/beacon-kit/mod/primitives/pkg/version"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestExecutionPayload_ToHeader(t *testing.T) {
}

header, err := payload.ToHeader(
ssz.NewMerkleizer[common.ChainSpec, [32]byte, common.Root](),
merkleizer.New[common.ChainSpec, [32]byte, common.Root](),
)
require.NoError(t, err)
require.NotNil(t, header)
Expand Down
2 changes: 1 addition & 1 deletion mod/consensus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ replace (

require (
cosmossdk.io/core v0.12.1-0.20240623110059-dec2d5583e39
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624165659-90675b692325
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6
github.com/cometbft/cometbft v1.0.0-alpha.2.0.20240625053718-5a9f3b4a787f
github.com/cosmos/cosmos-sdk v0.51.0
github.com/cosmos/gogoproto v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions mod/consensus/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240610210054-bfdc14c4013c h1:rPoD2zVkIzuMC4R/XMuwx6eanJL8ccu37sLro+eIj3Y=
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240610210054-bfdc14c4013c/go.mod h1:xgngH5/PYbyW+YDEmRhbBy3V333GXsNWF4DAkjYCmfs=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624165659-90675b692325 h1:GzIrXpB1cHkLuzJDL+ItiALjYydVzieBskUYcfch5J8=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624165659-90675b692325/go.mod h1:xg8BworJAcrzTzbTgP/637Be89xAtrRzGkXKSzuRMkQ=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6 h1:5gY+D3SGJJ78t32qIMfC2KQxz5ieXDcCsh544tzdQ6c=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6/go.mod h1:SR9DyddnG1jRxscSEHHQt9E6RaIi/2morGi0YgO4P6s=
github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240624014538-75ba469b1881 h1:08l5GGkl19zIShnUZKiU7ONTfK7L9KS/b82Mdrc+Fz8=
github.com/berachain/cosmos-sdk v0.46.0-beta2.0.20240624014538-75ba469b1881/go.mod h1:hCN0m+X7MmJvJ2ukDDRDyScC+30wXHtXTdx6vleSnBU=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s=
Expand Down
2 changes: 1 addition & 1 deletion mod/da/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/berachain/beacon-kit/mod/engine-primitives v0.0.0-20240624204855-d8809d5c8588
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd
github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6
github.com/crate-crypto/go-kzg-4844 v1.0.0
github.com/ethereum/c-kzg-4844 v1.0.2
github.com/ethereum/go-ethereum v1.14.5
Expand Down
4 changes: 2 additions & 2 deletions mod/da/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd h1
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:iXa+Q+i0q+GCpLzkusulO57K5vlkDgM77jtfMr3QdFA=
github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c h1:7f9dLYGOCMoV7LxT6YRmVSWLTPbGTTcxDPLPLvHGrOk=
github.com/berachain/beacon-kit/mod/log v0.0.0-20240610210054-bfdc14c4013c/go.mod h1:nFybcw/ZhJ6Gu66dna301W2I7u61skm2HfHxQmdR68Q=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588 h1:zL2vsFmWlm+vbmX17Uc97sVBxjlPlMqQ7Jna0I99uyY=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588/go.mod h1:xg8BworJAcrzTzbTgP/637Be89xAtrRzGkXKSzuRMkQ=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6 h1:5gY+D3SGJJ78t32qIMfC2KQxz5ieXDcCsh544tzdQ6c=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6/go.mod h1:SR9DyddnG1jRxscSEHHQt9E6RaIi/2morGi0YgO4P6s=
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0=
Expand Down
2 changes: 1 addition & 1 deletion mod/engine-primitives/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.4

require (
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6
github.com/ethereum/go-ethereum v1.14.5
github.com/ferranbt/fastssz v0.1.4-0.20240422063434-a4db75388da1
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions mod/engine-primitives/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd h1:jD/ggR959ZX+lqxsMzoRJzrGvFK7PI6UmgnRwOTh4S4=
github.com/berachain/beacon-kit/mod/errors v0.0.0-20240618214413-d5ec0e66b3dd/go.mod h1:iXa+Q+i0q+GCpLzkusulO57K5vlkDgM77jtfMr3QdFA=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588 h1:zL2vsFmWlm+vbmX17Uc97sVBxjlPlMqQ7Jna0I99uyY=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240624204855-d8809d5c8588/go.mod h1:xg8BworJAcrzTzbTgP/637Be89xAtrRzGkXKSzuRMkQ=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6 h1:5gY+D3SGJJ78t32qIMfC2KQxz5ieXDcCsh544tzdQ6c=
github.com/berachain/beacon-kit/mod/primitives v0.0.0-20240627134700-de48919ec4d6/go.mod h1:SR9DyddnG1jRxscSEHHQt9E6RaIi/2morGi0YgO4P6s=
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0=
Expand Down
8 changes: 5 additions & 3 deletions mod/engine-primitives/pkg/engine-primitives/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package engineprimitives
import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
"github.com/berachain/beacon-kit/mod/primitives/pkg/constants"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz"
"github.com/berachain/beacon-kit/mod/primitives/pkg/ssz/merkleizer"
)

// Transactions is a typealias for [][]byte, which is how transactions are
Expand All @@ -37,14 +37,16 @@ type Transactions [][]byte
// NOTE: Uses a new merkleizer for each call.
func (txs Transactions) HashTreeRoot() (common.Root, error) {
return txs.HashTreeRootWith(
ssz.NewMerkleizer[common.ChainSpec, [32]byte, common.Root](),
merkleizer.New[common.ChainSpec, [32]byte, common.Root](),
)
}

// TxsMerkleizer is a ssz merkleizer used for transactions.
//
// TODO: make the ChainSpec a generic on this type.
type TxsMerkleizer ssz.Merkleizer[common.ChainSpec, [32]byte, common.Root]
type TxsMerkleizer merkleizer.Merkleizer[
common.ChainSpec, [32]byte, common.Root,
]

// HashTreeRootWith returns the hash tree root of the Transactions list
// using the given merkleizer.
Expand Down
Loading

0 comments on commit 9e4bc31

Please sign in to comment.