Skip to content

Commit

Permalink
Progressed ValidProposal - InvalidSig
Browse files Browse the repository at this point in the history
  • Loading branch information
rezbera committed Feb 15, 2025
1 parent 947b40c commit edda721
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion testing/simulated/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ func GenerateBeaconChain(t *testing.T, numBlocks int) []*types.SignedBeaconBlock
common.Root{1, 2, 3, 4, 5},
version2.Deneb1(),
)
beaconBlock.StateRoot = common.Root{5, 4, 3, 2, 1}
require.NotNil(t, beaconBlock)
require.NoError(t, err)

beaconBlock.StateRoot = common.Root{5, 4, 3, 2, 1}

beaconBlock.Body = &types.BeaconBlockBody{
ExecutionPayload: blockToExecutionPayload(block),
}
Expand Down
18 changes: 18 additions & 0 deletions testing/simulated/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"testing"

"github.com/berachain/beacon-kit/beacon/blockchain"
datypes "github.com/berachain/beacon-kit/da/types"
"github.com/berachain/beacon-kit/log/phuslu"
"github.com/berachain/beacon-kit/primitives/constants"
"github.com/berachain/beacon-kit/testing/simulated"
Expand Down Expand Up @@ -159,12 +160,29 @@ func (s *Simulated) TestProcessProposal_NilBeaconBlock_MustError() {
}

func (s *Simulated) TestProcessProposal_ValidProposal_MustAccept() {
// Initialize the chain correctly
appGenesis, err := genutiltypes.AppGenesisFromFile(
s.HomeDir + "/config/genesis.json",
)
s.Require().NoError(err)
_, err = s.SimComet.Comet.InitChain(s.Ctx, &types.InitChainRequest{
ChainId: "test-mainnet-chain",
AppStateBytes: appGenesis.AppState,
})
s.Require().NoError(err)

// Generate the valid proposal
chain := simulated.GenerateBeaconChain(s.T(), 2)
blockBytes, err := chain[0].MarshalSSZ()
s.Require().NoError(err)

blob := datypes.BlobSidecars{}
blobBytes, err := blob.MarshalSSZ()
s.Require().NoError(err)

txs := make([][]byte, 2)
txs[0] = blockBytes
txs[1] = blobBytes

res, err := s.SimComet.Comet.ProcessProposal(s.Ctx, &types.ProcessProposalRequest{
Txs: txs,
Expand Down

0 comments on commit edda721

Please sign in to comment.