From 7b4666df92288bb9138a95cd568fcd7eefbdb1fb Mon Sep 17 00:00:00 2001 From: marcello33 Date: Thu, 7 Nov 2024 14:14:19 +0100 Subject: [PATCH] add: logs --- internal/cli/server/api_service.go | 7 +++++++ internal/cli/server/utils.go | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/internal/cli/server/api_service.go b/internal/cli/server/api_service.go index f6783804c1..bfd99fc7b9 100644 --- a/internal/cli/server/api_service.go +++ b/internal/cli/server/api_service.go @@ -3,6 +3,7 @@ package server import ( "context" "errors" + "fmt" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" @@ -11,6 +12,7 @@ import ( ) func (s *Server) GetRootHash(ctx context.Context, req *protobor.GetRootHashRequest) (*protobor.GetRootHashResponse, error) { + fmt.Printf(">>>>> GetRootHash: %v\n", req) rootHash, err := s.backend.APIBackend.GetRootHash(ctx, req.StartBlockNumber, req.EndBlockNumber) if err != nil { return nil, err @@ -20,6 +22,7 @@ func (s *Server) GetRootHash(ctx context.Context, req *protobor.GetRootHashReque } func (s *Server) GetVoteOnHash(ctx context.Context, req *protobor.GetVoteOnHashRequest) (*protobor.GetVoteOnHashResponse, error) { + fmt.Printf(">>>>> GetVoteOnHash: %v\n", req) vote, err := s.backend.APIBackend.GetVoteOnHash(ctx, req.StartBlockNumber, req.EndBlockNumber, req.Hash, req.MilestoneId) if err != nil { return nil, err @@ -37,6 +40,7 @@ func headerToProtoborHeader(h *types.Header) *protobor.Header { } func (s *Server) GetHeaderByNumber(ctx context.Context, req *protobor.GetHeaderByNumberRequest) (*protobor.GetHeaderByNumberResponse, error) { + fmt.Printf(">>>>> GetHeaderByNumber: %v\n", req) header, err := s.backend.APIBackend.HeaderByNumber(ctx, rpc.BlockNumber(req.Number)) if err != nil { return nil, err @@ -46,6 +50,7 @@ func (s *Server) GetHeaderByNumber(ctx context.Context, req *protobor.GetHeaderB } func (s *Server) GetBlockByNumber(ctx context.Context, req *protobor.GetBlockByNumberRequest) (*protobor.GetBlockByNumberResponse, error) { + fmt.Printf(">>>>> GetBlockByNumber: %v\n", req) block, err := s.backend.APIBackend.BlockByNumber(ctx, rpc.BlockNumber(req.Number)) if err != nil { return nil, err @@ -61,6 +66,7 @@ func blockToProtoBlock(h *types.Block) *protobor.Block { } func (s *Server) GetTransactionReceipt(ctx context.Context, req *protobor.ReceiptRequest) (*protobor.ReceiptResponse, error) { + fmt.Printf(">>>>> GetTransactionReceipt: %v\n", req) _, blockHash, _, txnIndex, err := s.backend.APIBackend.GetTransaction(ctx, protoutil.ConvertH256ToHash(req.Hash)) if err != nil { return nil, err @@ -83,6 +89,7 @@ func (s *Server) GetTransactionReceipt(ctx context.Context, req *protobor.Receip } func (s *Server) GetBorBlockReceipt(ctx context.Context, req *protobor.ReceiptRequest) (*protobor.ReceiptResponse, error) { + fmt.Printf(">>>>> GetBorBlockReceipt: %v\n", req) receipt, err := s.backend.APIBackend.GetBorBlockReceipt(ctx, protoutil.ConvertH256ToHash(req.Hash)) if err != nil { return nil, err diff --git a/internal/cli/server/utils.go b/internal/cli/server/utils.go index aa461c9e92..e001da0c9b 100644 --- a/internal/cli/server/utils.go +++ b/internal/cli/server/utils.go @@ -1,6 +1,7 @@ package server import ( + "fmt" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/internal/cli/server/proto" @@ -12,6 +13,7 @@ import ( ) func PeerInfoToPeer(info *p2p.PeerInfo) *proto.Peer { + fmt.Printf(">>>>> PeerInfoToPeer: %v\n", info) return &proto.Peer{ Id: info.ID, Enode: info.Enode, @@ -24,12 +26,14 @@ func PeerInfoToPeer(info *p2p.PeerInfo) *proto.Peer { } func ConvertBloomToProtoBloom(bloom types.Bloom) *protobor.Bloom { + fmt.Printf(">>>>> ConvertBloomToProtoBloom: %v\n", bloom) return &protobor.Bloom{ Bloom: bloom.Bytes(), } } func ConvertLogsToProtoLogs(logs []*types.Log) []*protobor.Log { + fmt.Printf(">>>>> ConvertLogsToProtoLogs: %v\n", logs) var protoLogs []*protobor.Log for _, log := range logs { protoLog := &protobor.Log{ @@ -50,6 +54,7 @@ func ConvertLogsToProtoLogs(logs []*types.Log) []*protobor.Log { } func ConvertTopicsToProtoTopics(topics []common.Hash) []*protocommon.H256 { + fmt.Printf(">>>>> ConvertTopicsToProtoTopics: %v\n", topics) var protoTopics []*protocommon.H256 for _, topic := range topics { protoTopics = append(protoTopics, protoutil.ConvertHashToH256(topic)) @@ -59,6 +64,7 @@ func ConvertTopicsToProtoTopics(topics []common.Hash) []*protocommon.H256 { } func ConvertReceiptToProtoReceipt(receipt *types.Receipt) *protobor.Receipt { + fmt.Printf(">>>>> ConvertReceiptToProtoReceipt: %v\n", receipt) return &protobor.Receipt{ Type: uint64(receipt.Type), PostState: receipt.PostState,