Skip to content

Commit

Permalink
chore: remove tmp code
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Jan 20, 2025
1 parent ef394e8 commit 94c5f69
Showing 1 changed file with 0 additions and 86 deletions.
86 changes: 0 additions & 86 deletions light/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,89 +113,3 @@ func TestExampleClient(t *testing.T) {

logger.Info("verified light block", "light-block", lb)
}

// Manually getting light blocks and verifying them.
func TestClientLocalDevnet(t *testing.T) {
const CHAINID = "dashmate_local_37"

if testing.Short() {
t.Skip("skipping test in short mode")
}

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

logger, err := log.NewDefaultLogger(log.LogFormatPlain, log.LogLevelTrace)
if err != nil {
t.Fatal(err)
}

// Start a test application
// app, err := kvstore.NewMemoryApp()
// require.NoError(t, err)

primary, err := httpp.New(CHAINID, "10.56.229.104:34657")
if err != nil {
t.Fatal(err)
}

// give Tendermint time to generate some blocks
time.Sleep(5 * time.Second)

_, err = primary.LightBlock(ctx, 1)
if err != nil {
t.Fatal(err)
}

db := dbm.NewMemDB()

// pv, err := privval.LoadOrGenFilePV(conf.PrivValidator.KeyFile(), conf.PrivValidator.StateFile())
require.NoError(t, err)
coreClient, err := dashcore.NewRPCClient("10.56.229.104:30002",
"tenderdash", "I3MFP6SmzDG0",
logger)
require.NoError(t, err)

c, err := light.NewClientAtHeight(
ctx,
1,
CHAINID,
primary,
nil,
dbs.New(db),
coreClient,
light.Logger(logger),
)

if err != nil {
t.Fatal(err)
}
defer func() {
if err := c.Cleanup(); err != nil {
t.Fatal(err)
}
}()

// wait for a few more blocks to be produced
time.Sleep(2 * time.Second)

// verify the block at height 3
_, err = c.VerifyLightBlockAtHeight(ctx, 3, time.Now())
if err != nil {
t.Fatal(err)
}

// retrieve light block at height 3
_, err = c.TrustedLightBlock(3)
if err != nil {
t.Fatal(err)
}

// update to the latest height
lb, err := c.Update(ctx, time.Now())
if err != nil {
t.Fatal(err)
}

logger.Info("verified light block", "light-block", lb)
}

0 comments on commit 94c5f69

Please sign in to comment.