Skip to content

Commit

Permalink
chore(ipld/plugin): multiple cleanups for linter and removal of dead …
Browse files Browse the repository at this point in the history
…code
  • Loading branch information
Wondertan committed Oct 6, 2022
1 parent 290c64d commit 9c5ac32
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
2 changes: 1 addition & 1 deletion nodebuilder/tests/fraud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestFraudProofBroadcasting(t *testing.T) {
// If we cannot get a height header within a timeframe it means the syncer was stopped
// FIXME: Eventually, this should be a check on service registry managing and keeping
// lifecycles of each Module.
syncCtx, syncCancel := context.WithTimeout(context.Background(), time.Millisecond*600)
syncCtx, syncCancel := context.WithTimeout(context.Background(), time.Millisecond*100)
_, err = full.HeaderServ.GetByHeight(syncCtx, 100)
require.ErrorIs(t, err, context.DeadlineExceeded)
syncCancel()
Expand Down
6 changes: 2 additions & 4 deletions nodebuilder/tests/swamp/swamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/bytes"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"
"go.uber.org/fx"

"github.com/celestiaorg/celestia-app/testutil/testnode"
Expand All @@ -32,8 +31,6 @@ import (

var blackholeIP6 = net.ParseIP("100::")

var queryEvent string = types.QueryForEvent(types.EventNewBlock).String()

// Swamp represents the main functionality that is needed for the test-case:
// - Network to link the nodes
// - CoreClient to share between Bridge nodes
Expand Down Expand Up @@ -66,7 +63,7 @@ func NewSwamp(t *testing.T, options ...Option) *Swamp {
var err error
ctx := context.Background()

// we create an arbitray number of funded accounts
// we create an arbitrary number of funded accounts
accounts := make([]string, 100)
for i := 0; i < 10; i++ {
accounts = append(accounts, tmrand.Str(9))
Expand All @@ -83,6 +80,7 @@ func NewSwamp(t *testing.T, options ...Option) *Swamp {
require.NoError(t, err)

cctx, cleanupGRPCServer, err := testnode.StartGRPCServer(app, testnode.DefaultAppConfig(), cctx)
require.NoError(t, err)

swp := &Swamp{
t: t,
Expand Down
21 changes: 1 addition & 20 deletions nodebuilder/tests/swamp/swamp_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,12 @@ package swamp

import (
"context"
"fmt"
"time"

"github.com/tendermint/tendermint/pkg/consts"

"github.com/celestiaorg/celestia-app/testutil/testnode"

"github.com/celestiaorg/celestia-app/x/payment"
paytypes "github.com/celestiaorg/celestia-app/x/payment/types"
)

// SubmitData submits given data in the block.
// TODO(@Wondertan): This must be a real PFD using celestia-app, once we can run App in the Swamp.
func (s *Swamp) SubmitData(ctx context.Context, data []byte) error {
signer := paytypes.NewKeyringSigner(s.ClientContext.Keyring, s.accounts[0], s.ClientContext.ChainID)
resp, err := payment.SubmitPayForData(ctx, signer, s.ClientContext.GRPCClient, data[:consts.NamespaceSize], data, 10000000000)
if err != nil {
return err
}
if resp.Code != 0 {
return fmt.Errorf("invalid status code: %d", resp.Code)
}
return nil
}

// FillBlocks produces the given amount of contiguous blocks with customizable size.
func (s *Swamp) FillBlocks(_ context.Context, bsize, blocks int) error {
btime := s.comps.CoreCfg.Consensus.CreateEmptyBlocksInterval
timer := time.NewTimer(btime)
Expand Down

0 comments on commit 9c5ac32

Please sign in to comment.