From 00eb69f3899328fbf8ef33f04a825ffb6547a064 Mon Sep 17 00:00:00 2001 From: mtgnoah Date: Fri, 15 Dec 2023 19:38:07 -0600 Subject: [PATCH 1/2] Added height and decreased block time --- genesis/genesis.go | 3 ++- rpc/jsonrpc_server.go | 27 ++++++++++----------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/genesis/genesis.go b/genesis/genesis.go index cdc5af4..068d661 100644 --- a/genesis/genesis.go +++ b/genesis/genesis.go @@ -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}, diff --git a/rpc/jsonrpc_server.go b/rpc/jsonrpc_server.go index c9bbd15..8dc415b 100644 --- a/rpc/jsonrpc_server.go +++ b/rpc/jsonrpc_server.go @@ -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 { @@ -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, } } @@ -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 } @@ -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 @@ -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") @@ -460,23 +465,6 @@ 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 @@ -484,6 +472,7 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade BlockId: id.String(), Timestamp: tmp, L1Head: l1Head.Uint64(), + Height: blk.Hght, } return false } @@ -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 @@ -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 @@ -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 } @@ -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)) From 5b399d1f54f3cb0b13e5785500ffc4ef70e31bed Mon Sep 17 00:00:00 2001 From: mtgnoah Date: Fri, 15 Dec 2023 19:47:09 -0600 Subject: [PATCH 2/2] fix chain id --- commitment/commitment_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commitment/commitment_manager.go b/commitment/commitment_manager.go index 27302c0..3734dd3 100644 --- a/commitment/commitment_manager.go +++ b/commitment/commitment_manager.go @@ -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