Skip to content

Commit

Permalink
Merge branch 'jsonfix' of https://github.com/AnomalyFi/nodekit-seq in…
Browse files Browse the repository at this point in the history
…to jsonfix
  • Loading branch information
mtgnoah committed Dec 16, 2023
2 parents ea10656 + 5b399d1 commit 18076fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion commitment/commitment_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (w *CommitmentManager) request(
}

//! TODO just changed the chainId so this should fix it
auth, err := ethbind.NewKeyedTransactorWithChainID(priv, big.NewInt(32382))
auth, err := ethbind.NewKeyedTransactorWithChainID(priv, big.NewInt(3151908))
if err != nil {
log.Fatalf("Failed to create authorized transactor: %v", err)
return err
Expand Down
3 changes: 2 additions & 1 deletion genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func Default() *Genesis {

// Chain Parameters
MinBlockGap: 100,
MinEmptyBlockGap: 2_500,
MinEmptyBlockGap: 1_000,
//MinEmptyBlockGap used to be 2_500

// Chain Fee Parameters
MinUnitPrice: chain.Dimensions{100, 100, 100, 100, 100},
Expand Down
27 changes: 10 additions & 17 deletions rpc/jsonrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ type BlockInfo struct {
BlockId string `json:"id"`
Timestamp int64 `json:"timestamp"`
L1Head uint64 `json:"l1_head"`
Height uint64 `json:"height"`
}

type BlockHeadersResponse struct {
Expand Down Expand Up @@ -333,6 +334,7 @@ func (j *JSONRPCServer) GetBlockHeadersByHeight(req *http.Request, args *GetBloc
BlockId: prevBlkId.String(),
Timestamp: blk.Tmstmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
}
}

Expand All @@ -359,6 +361,7 @@ func (j *JSONRPCServer) GetBlockHeadersByHeight(req *http.Request, args *GetBloc
BlockId: id.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
}
return false
}
Expand All @@ -370,6 +373,7 @@ func (j *JSONRPCServer) GetBlockHeadersByHeight(req *http.Request, args *GetBloc
BlockId: id.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
})
}
return true
Expand Down Expand Up @@ -437,6 +441,7 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
BlockId: prevBlkId.String(),
Timestamp: blk.Tmstmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
}
} else {
return errors.New("Could not find Previous Block")
Expand All @@ -460,30 +465,14 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
return false
}

// if blk.Hght == heightKey {
// blocks = append(blocks, BlockInfo{
// BlockId: id.String(),
// Timestamp: blk.Tmstmp,
// L1Head: l1Head.Uint64(),
// })
// }

// if blk.Tmstmp > args.End {
// Next = BlockInfo{
// BlockId: id.String(),
// Timestamp: blk.Tmstmp,
// L1Head: l1Head.Uint64(),
// }
// return false
// }

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

Next = BlockInfo{
BlockId: id.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
}
return false
}
Expand All @@ -495,6 +484,7 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
BlockId: id.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
})
}
return true
Expand Down Expand Up @@ -544,6 +534,7 @@ func (j *JSONRPCServer) GetBlockHeadersByStart(req *http.Request, args *GetBlock
BlockId: prevBlkId.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
}
} else {
//! This is where the error is
Expand Down Expand Up @@ -584,6 +575,7 @@ func (j *JSONRPCServer) GetBlockHeadersByStart(req *http.Request, args *GetBlock
BlockId: id.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
}
return false
}
Expand All @@ -595,6 +587,7 @@ func (j *JSONRPCServer) GetBlockHeadersByStart(req *http.Request, args *GetBlock
BlockId: id.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
Height: blk.Hght,
})
fmt.Println("Match Found")
fmt.Println("Blocks Length After Append:", len(blocks))
Expand Down

0 comments on commit 18076fe

Please sign in to comment.