Skip to content

Commit

Permalink
docs(node/swamp): apply suggestions from @Bidon15
Browse files Browse the repository at this point in the history
Co-authored-by: Nguyen Nhu Viet <[email protected]>
  • Loading branch information
Wondertan committed Jun 29, 2022
1 parent f0ad950 commit 9a563f7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
30 changes: 30 additions & 0 deletions node/tests/reconstruct_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Test with light nodes spawns more goroutines than in the race detectors budget,
// and thus we're disabling the race detector.
// TODO(@Wondertan): Remove this once we move to go1.19 with unlimited race detector
//go:build !race

package tests
Expand All @@ -20,6 +23,18 @@ import (
"github.com/celestiaorg/celestia-node/node/tests/swamp"
)

/*
Test-Case: Full Node reconstructs blocks from a Bridge node
Pre-Reqs:
- First 20 blocks have a block size of 16
- Blocktime is 100 ms
Steps:
1. Create a Bridge Node(BN)
2. Start a BN
3. Create a Full Node(FN) with BN as a trusted peer
4. Start a FN
5. Check that a FN can retrieve shares from 1 to 20 blocks
*/
func TestFullReconstructFromBridge(t *testing.T) {
const (
blocks = 20
Expand Down Expand Up @@ -57,6 +72,21 @@ func TestFullReconstructFromBridge(t *testing.T) {
require.NoError(t, err)
}

/*
Test-Case: Full Node reconstructs blocks only from Light Nodes
Pre-Reqs:
- First 20 blocks have a block size of 16
- Blocktime is 100 ms
Steps:
1. Create a Bridge Node(BN)
2. Start a BN
3. Create 69 Light Nodes(LNs) with BN as a trusted peer
4. Start 69 LNs
5. Create a Full Node(FN) with 69 LNs as trusted peers
6. Unlink FN connection to BN
7. Start a FN
8. Check that a FN can retrieve shares from 1 to 20 blocks
*/
func TestFullReconstructFromLights(t *testing.T) {
ipld.RetrieveQuadrantTimeout = time.Millisecond * 100
share.DefaultSampleAmount = 20
Expand Down
5 changes: 0 additions & 5 deletions node/tests/swamp/swamp_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ func (s *Swamp) SubmitData(ctx context.Context, t *testing.T, data []byte) {
require.Zero(t, result.Code)
}

func (s *Swamp) FillBlock(ctx context.Context, t *testing.T, bsize int) {
data := make([]byte, bsize*ipld.ShareSize)
s.SubmitData(ctx, t, data)
}

func (s *Swamp) FillBlocks(ctx context.Context, t *testing.T, bsize, blocks int) {
btime := s.comps.CoreCfg.Consensus.CreateEmptyBlocksInterval
timer := time.NewTimer(btime)
Expand Down

0 comments on commit 9a563f7

Please sign in to comment.