Skip to content

Commit

Permalink
chore: delete commented tests (#1027)
Browse files Browse the repository at this point in the history
Closes #1026
  • Loading branch information
rootulp authored Nov 22, 2022
1 parent 8604be9 commit 801a0d4
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 265 deletions.
56 changes: 0 additions & 56 deletions app/test/process_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,62 +118,6 @@ func TestMessageInclusionCheck(t *testing.T) {
}
}

// TODO: redo this tests, which is more difficult to do now that it requires the
// data to be processed by PrepareProposal func
// TestProcessMessagesWithReservedNamespaces(t *testing.T) {
// testApp := testutil.SetupTestAppWithGenesisValSet(t)
// encConf := encoding.MakeConfig(app.ModuleEncodingRegisters...)

// signer := testutil.GenerateKeyringSigner(t, testAccName)

// type test struct {
// name string
// namespace namespace.ID
// expectedResult abci.ResponseProcessProposal_Result
// }

// tests := []test{
// {"transaction namespace id for message", appconsts.TxNamespaceID, abci.ResponseProcessProposal_REJECT},
// {"evidence namespace id for message", appconsts.EvidenceNamespaceID, abci.ResponseProcessProposal_REJECT},
// {"tail padding namespace id for message", appconsts.TailPaddingNamespaceID, abci.ResponseProcessProposal_REJECT},
// {"namespace id 200 for message", namespace.ID{0, 0, 0, 0, 0, 0, 0, 200}, abci.ResponseProcessProposal_REJECT},
// {"correct namespace id for message", namespace.ID{3, 3, 2, 2, 2, 1, 1, 1}, abci.ResponseProcessProposal_ACCEPT},
// }

// for _, tt := range tests {
// pfb, msg := genRandMsgPayForBlobForNamespace(t, signer, 8, tt.namespace)
// input := abci.RequestProcessProposal{
// BlockData: &core.Data{
// Txs: [][]byte{
// buildTx(t, signer, encConf.TxConfig, pfb),
// },
// Blobs: core.Blobs{
// MessagesList: []*core.Message{
// {
// NamespaceId: pfb.GetNamespaceId(),
// Data: msg,
// },
// },
// },
// SquareSize: 8,
// },
// }
// data, err := coretypes.DataFromProto(input.BlockData)
// require.NoError(t, err)

// shares, err := shares.Split(data)
// require.NoError(t, err)

// require.NoError(t, err)
// eds, err := da.ExtendShares(input.BlockData.SquareSize, shares)
// require.NoError(t, err)
// dah := da.NewDataAvailabilityHeader(eds)
// input.Header.DataHash = dah.Hash()
// res := testApp.ProcessProposal(input)
// assert.Equal(t, tt.expectedResult, res.Result)
// }
// }

func TestProcessMessageWithParityShareNamespaces(t *testing.T) {
testApp := testutil.SetupTestAppWithGenesisValSet(t)
encConf := encoding.MakeConfig(app.ModuleEncodingRegisters...)
Expand Down
55 changes: 0 additions & 55 deletions pkg/prove/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,61 +171,6 @@ func TestTxShareIndex(t *testing.T) {
}
}

// TODO: Uncomment/fix this test after we've adjusted tx inclusion proofs to
// work using non-interactive defaults
// func Test_genRowShares(t *testing.T) {
// squareSize := uint64(16)
// typicalBlockData := types.Data{
// Txs: generateRandomlySizedTxs(10, 200),
// Blobs: generateRandomlySizedMessages(20, 1000),
// SquareSize: squareSize,
// }

// // note: we should be able to compute row shares from raw data
// // this quickly tests this by computing the row shares before
// // computing the shares in the normal way.
// rowShares, err := genRowShares(
// appconsts.DefaultCodec(),
// typicalBlockData,
// 0,
// squareSize,
// )
// require.NoError(t, err)

// rawShares, err := shares.Split(typicalBlockData, false)
// require.NoError(t, err)

// eds, err := da.ExtendShares(squareSize, rawShares)
// require.NoError(t, err)

// for i := uint64(0); i < squareSize; i++ {
// row := eds.Row(uint(i))
// assert.Equal(t, row, rowShares[i], fmt.Sprintf("row %d", i))
// // also test fetching individual rows
// secondSet, err := genRowShares(appconsts.DefaultCodec(), typicalBlockData, i, i)
// require.NoError(t, err)
// assert.Equal(t, row, secondSet[0], fmt.Sprintf("row %d", i))
// }
// }

// func Test_genOrigRowShares(t *testing.T) {
// txCount := 100
// squareSize := uint64(16)
// typicalBlockData := types.Data{
// Txs: generateRandomlySizedTxs(txCount, 200),
// Blobs: generateRandomlySizedMessages(10, 1500),
// SquareSize: squareSize,
// }

// rawShares, err := shares.Split(typicalBlockData, false)
// require.NoError(t, err)

// genShares := genOrigRowShares(typicalBlockData, 0, 15)

// require.Equal(t, len(rawShares), len(genShares))
// assert.Equal(t, rawShares, genShares)
// }

// stripCompactShares strips the universal prefix (namespace, info byte, data length) and
// reserved byte from a list of compact shares and joins them into a single byte
// slice.
Expand Down
154 changes: 0 additions & 154 deletions pkg/shares/shares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,160 +17,6 @@ import (
coretypes "github.com/tendermint/tendermint/types"
)

// var defaultVoteTime = time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)

// TODO: refactor into different tests
// func TestMakeShares(t *testing.T) {
// reservedTxNamespaceID := append(bytes.Repeat([]byte{0}, 7), 1)
// reservedEvidenceNamespaceID := append(bytes.Repeat([]byte{0}, 7), 3)
// val := coretypes.NewMockPV()
// blockID := makeBlockID([]byte("blockhash"), 1000, []byte("partshash"))
// blockID2 := makeBlockID([]byte("blockhash2"), 1000, []byte("partshash"))
// vote1 := makeVote(t, val, "chainID", 0, 10, 2, 1, blockID, defaultVoteTime)
// vote2 := makeVote(t, val, "chainID", 0, 10, 2, 1, blockID2, defaultVoteTime)
// testEvidence := &coretypes.DuplicateVoteEvidence{
// VoteA: vote1,
// VoteB: vote2,
// }
// protoTestEvidence, err := coretypes.EvidenceToProto(testEvidence)
// if err != nil {
// t.Error(err)
// }
// testEvidenceBytes, err := protoio.MarshalDelimited(protoTestEvidence)
// largeTx := coretypes.Tx(bytes.Repeat([]byte("large Tx"), 50))
// largeTxLenDelimited, _ := largeTx.MarshalDelimited()
// smolTx := coretypes.Tx("small Tx")
// smolTxLenDelimited, _ := smolTx.MarshalDelimited()
// msg1 := coretypes.Blob{
// NamespaceID: namespace.ID("8bytesss"),
// Data: []byte("some data"),
// }
// msg1Marshaled, _ := msg1.MarshalDelimited()
// if err != nil {
// t.Fatalf("Could not encode evidence: %v, error: %v\n", testEvidence, err)
// }

// type args struct {
// data Splitter
// }
// tests := []struct {
// name string
// args args
// want NamespacedShares
// }{
// {
// name: "evidence",
// args: args{
// data: &coretypes.EvidenceData{
// Evidence: []coretypes.Evidence{testEvidence},
// },
// },
// want: NamespacedShares{
// NamespacedShare{
// Share: append(
// append(reservedEvidenceNamespaceID, byte(0)),
// testEvidenceBytes[:appconsts.CompactShareContentSize]...,
// ),
// ID: reservedEvidenceNamespaceID,
// },
// NamespacedShare{
// Share: append(
// append(reservedEvidenceNamespaceID, byte(0)),
// zeroPadIfNecessary(testEvidenceBytes[appconsts.CompactShareContentSize:], appconsts.CompactShareContentSize)...,
// ),
// ID: reservedEvidenceNamespaceID,
// },
// },
// },
// {"small LL Tx",
// args{
// data: coretypes.Txs{smolTx},
// },
// NamespacedShares{
// NamespacedShare{
// Share: append(
// append(reservedTxNamespaceID, byte(0)),
// zeroPadIfNecessary(smolTxLenDelimited, appconsts.CompactShareContentSize)...,
// ),
// ID: reservedTxNamespaceID,
// },
// },
// },
// {"one large LL Tx",
// args{
// data: coretypes.Txs{largeTx},
// },
// NamespacedShares{
// NamespacedShare{
// Share: append(
// append(reservedTxNamespaceID, byte(0)),
// largeTxLenDelimited[:appconsts.CompactShareContentSize]...,
// ),
// ID: reservedTxNamespaceID,
// },
// NamespacedShare{
// Share: append(
// append(reservedTxNamespaceID, byte(0)),
// zeroPadIfNecessary(largeTxLenDelimited[appconsts.CompactShareContentSize:], appconsts.CompactShareContentSize)...,
// ),
// ID: reservedTxNamespaceID,
// },
// },
// },
// {"large then small LL Tx",
// args{
// data: coretypes.Txs{largeTx, smolTx},
// },
// NamespacedShares{
// NamespacedShare{
// Share: append(
// append(reservedTxNamespaceID, byte(0)),
// largeTxLenDelimited[:appconsts.CompactShareContentSize]...,
// ),
// ID: reservedTxNamespaceID,
// },
// NamespacedShare{
// Share: append(
// append(
// reservedTxNamespaceID,
// byte(0),
// ),
// zeroPadIfNecessary(
// append(largeTxLenDelimited[appconsts.CompactShareContentSize:], smolTxLenDelimited...),
// appconsts.CompactShareContentSize,
// )...,
// ),
// ID: reservedTxNamespaceID,
// },
// },
// },
// {"ll-app message",
// args{
// data: coretypes.Blobs{[]coretypes.Blob{msg1}},
// },
// NamespacedShares{
// NamespacedShare{
// Share: append(
// []byte(msg1.NamespaceID),
// zeroPadIfNecessary(msg1Marshaled, appconsts.MsgShareSize)...,
// ),
// ID: msg1.NamespaceID,
// },
// },
// },
// }
// for i, tt := range tests {
// tt := tt // stupid scopelint :-/
// i := i
// t.Run(tt.name, func(t *testing.T) {
// got := tt.args.data.SplitIntoShares()
// if !reflect.DeepEqual(got, tt.want) {
// t.Errorf("%v: makeShares() = \n%+v\nwant\n%+v\n", i, got, tt.want)
// }
// })
// }
// }

func TestMerge(t *testing.T) {
type test struct {
name string
Expand Down

0 comments on commit 801a0d4

Please sign in to comment.