celestiaorg / rsmt2d

Go implementation of two dimensional Reed-Solomon merkle tree data availability scheme.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove test cases that vary based on codec for extendeddatacrossword_test.go

rootulp opened this issue · comments

Context

The tests in extendeddatacrossword_test.go contain test cases for multiple codecs but after #151 this repo only supports one codec.

Example:

tests := []struct {
name string
// Size of each share, in bytes
shareSize int
codec Codec
}{
{"leopard", bufferSize, NewLeoRSCodec()},
}

Proposal

Refactor the tests in this file to remove test cases that differ based on codec. This will likely remove a level of indentation from the interesting parts of this file.

Thanks for opening this issue!
Is there a long-term plan to exclusively use one codec? If so, it may be beneficial to refactor functions that currently accept a codec as an input parameter. These parameters would become redundant with only one supported codec. Alternatively, if multiple codecs will continue to be supported, it's useful to maintain the current structure of the tests. These tests comprehensively account for all input parameters of the function they aim to test, including the codec. (it is conceivable that if other codecs get added we need to re-deploy the same test structure as we currently have, resulting in redundant work). WDYT? @rootulp

I don't see any GH issues in this repo for adding new codecs. I think the current test structure is a byproduct of development (i.e. historically multiple codecs were supported) so IMO we should refactor to just support one codec.

If we need to add a new codec in the future, the PR that adds a new codec can (and should) add test coverage for the new codec.