Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mtgnoah committed May 6, 2024
1 parent f2ac759 commit d93efbc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
1 change: 0 additions & 1 deletion cmd/token-cli/cmd/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ var testHeaderCmd = &cobra.Command{
end_time := end * 1000

res, err := tcli.GetBlockHeadersByStart(ctx, start_time, end_time)

if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func Default() *Genesis {
// Chain Parameters
MinBlockGap: 1_000,
MinEmptyBlockGap: 1_000,
//MinEmptyBlockGap used to be 2_500
// MinEmptyBlockGap used to be 2_500

// Chain Fee Parameters
MinUnitPrice: chain.Dimensions{100, 100, 100, 100, 100},
Expand Down
32 changes: 15 additions & 17 deletions rpc/jsonrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import (
type JSONRPCServer struct {
c Controller
headers *types.ShardedMap[string, *chain.StatefulBlock]
//map[ids.ID]*chain.StatefulBlock // Map block ID to block header
// map[ids.ID]*chain.StatefulBlock // Map block ID to block header

blocksWithValidTxs *types.ShardedMap[string, *types.SequencerBlock]

//map[ids.ID]*types.SequencerBlock // Map block ID to block header
// map[ids.ID]*types.SequencerBlock // Map block ID to block header

idsByHeight btree.Map[uint64, ids.ID] // Map block ID to block height

Expand Down Expand Up @@ -346,7 +346,7 @@ func (j *JSONRPCServer) GetBlockHeadersByHeight(req *http.Request, args *GetBloc
return errors.New("Could not find Block")
}

//tmp := blk.Tmstmp / 1000
// tmp := blk.Tmstmp / 1000

Prev = BlockInfo{
BlockId: prevBlkId.String(),
Expand All @@ -368,7 +368,7 @@ func (j *JSONRPCServer) GetBlockHeadersByHeight(req *http.Request, args *GetBloc
return false
}

//tmp := blk.Tmstmp / 1000
// tmp := blk.Tmstmp / 1000
if blk.Tmstmp >= args.End {
Next = BlockInfo{
BlockId: id.String(),
Expand Down Expand Up @@ -401,7 +401,7 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
// Parse query parameters

var firstBlock uint64
//var prevBlkId ids.ID
// var prevBlkId ids.ID

if args.ID != "" {
id, err := ids.FromString(args.ID)
Expand All @@ -422,11 +422,11 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
// Handle error or default case
// TODO add error potentially
// http.Error(writer, "Invalid parameters", http.StatusBadRequest)
//TODO used to return nil but changed
//return nil
// TODO used to return nil but changed
// return nil
}

//prevBlkId, success := j.idsByHeight.Get(firstBlock - 1)
// prevBlkId, success := j.idsByHeight.Get(firstBlock - 1)

Prev := BlockInfo{}
if firstBlock > 1 {
Expand Down Expand Up @@ -466,7 +466,7 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
}

if blk.Tmstmp >= args.End {
//tmp := blk.Tmstmp / 1000
// tmp := blk.Tmstmp / 1000

Next = BlockInfo{
BlockId: id.String(),
Expand All @@ -478,7 +478,7 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
}

if blk.Hght == heightKey {
//tmp := blk.Tmstmp / 1000
// tmp := blk.Tmstmp / 1000

blocks = append(blocks, BlockInfo{
BlockId: id.String(),
Expand Down Expand Up @@ -509,10 +509,8 @@ func (j *JSONRPCServer) GetBlockHeadersByStart(req *http.Request, args *GetBlock
var firstBlock uint64

j.blocks.Ascend(args.Start, func(tmstp int64, height uint64) bool {

firstBlock = height
return false

})

Prev := BlockInfo{}
Expand All @@ -525,7 +523,7 @@ func (j *JSONRPCServer) GetBlockHeadersByStart(req *http.Request, args *GetBlock
return fmt.Errorf("Could not find Previous Block: %d ", firstBlock)
}

//tmp := blk.Tmstmp / 1000
// tmp := blk.Tmstmp / 1000
Prev = BlockInfo{
BlockId: prevBlkId.String(),
Timestamp: blk.Tmstmp,
Expand All @@ -551,7 +549,7 @@ func (j *JSONRPCServer) GetBlockHeadersByStart(req *http.Request, args *GetBlock

if blk.Tmstmp >= args.End {

//tmp := blk.Tmstmp / 1000
// tmp := blk.Tmstmp / 1000

Next = BlockInfo{
BlockId: id.String(),
Expand All @@ -562,7 +560,7 @@ func (j *JSONRPCServer) GetBlockHeadersByStart(req *http.Request, args *GetBlock
return false
}

//tmp := blk.Tmstmp / 1000
// tmp := blk.Tmstmp / 1000

blocks = append(blocks, BlockInfo{
BlockId: id.String(),
Expand Down Expand Up @@ -655,7 +653,7 @@ func (j *JSONRPCServer) GetCommitmentBlocks(req *http.Request, args *GetBlockCom

comm := header.Commit()

//TODO swapped these 2 functions so now it exits earlier. Need to test
// TODO swapped these 2 functions so now it exits earlier. Need to test
if blockTemp.Hght >= args.CurrentHeight {
// root := types.NewU256().SetBytes(blockTemp.StateRoot)
// bigRoot := root.Int
Expand Down Expand Up @@ -727,7 +725,7 @@ func (j *JSONRPCServer) AcceptBlock(blk *chain.StatelessBlock) error {

block, results, _, id, err := rpc.UnpackBlockMessage(msg, parser)

//TODO I should experiment with TTL
// TODO I should experiment with TTL
j.headers.Put(id.String(), block)
// j.headers[id.String()] = block
j.idsByHeight.Set(block.Hght, *id)
Expand Down
Empty file modified scripts/fix.lint.sh
100644 → 100755
Empty file.

0 comments on commit d93efbc

Please sign in to comment.