Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
82440ff
chore: ignore ADR-001-JMDT-Native-EVM-Smart-Contracts.docx in gitignore
saishibunb Apr 13, 2026
a152a83
feat(smartcontract): port native EVM smart contract support to main
saishibunb Apr 13, 2026
010ed65
feat: integrate OpenTelemetry tracing and structured logging into Blo…
saishibunb Apr 13, 2026
f7ab725
refactor: remove redundant zap logging and cleanup unused imports acr…
saishibunb Apr 13, 2026
27e516d
feat: implement smart contract compilation, deployment, and execution…
saishibunb Apr 13, 2026
4d64395
refactor: replace zerolog with ion for gRPC server logging
saishibunb Apr 13, 2026
53e2cee
feat: implement solc_compile RPC handler and update contract compilat…
saishibunb Apr 13, 2026
9764a50
fix(block): guard nil tx.To and tx.From before calling .Hex() in logging
saishibunb Apr 13, 2026
64b7b77
Fix issues in contract compiling
saishibunb Apr 13, 2026
cd6936a
Update .gitignore
saishibunb Apr 13, 2026
d4bfd09
fix: guard nil tx.To and tx.GasPrice in Security package for contract…
saishibunb Apr 13, 2026
21222d2
feat: sign DeployContract tx with deployer private key
saishibunb Apr 13, 2026
f1c6695
fix: route unsigned contract deployments through internal trusted path
saishibunb Apr 13, 2026
c8388e0
chore: regenerate protobuf files with updated protoc version and corr…
saishibunb Apr 13, 2026
bd7363d
fix: remove hardcoded service addresses — read from config
saishibunb Apr 14, 2026
10f6b15
fix: declare err at function scope in InitializeStateDB
saishibunb Apr 14, 2026
216e7a9
feat: implement EVM transaction tracing and persistent log indexing w…
saishibunb Apr 14, 2026
74c43f1
chore: ignore refactor-contractDBOps documentation file
saishibunb Apr 14, 2026
ee7c345
refactor(contractDB): [1/17] create DB_OPs/contractDB/ with kvstore.go
saishibunb Apr 14, 2026
95cfa34
refactor(contractDB): [2/17] add types.go with canonical type definit…
saishibunb Apr 14, 2026
c5a8dc5
refactor(contractDB): [3/17] add repository.go and pebble_adapter.go
saishibunb Apr 14, 2026
adddfca
refactor(contractDB): [4/17] add journal.go and access_list.go
saishibunb Apr 14, 2026
f7e288e
refactor(contractDB): [5/17] add state_object.go
saishibunb Apr 14, 2026
4f1ecf6
refactor(contractDB): [6/17] add contractdb.go — ContractDB + StateDB…
saishibunb Apr 14, 2026
93ac73a
refactor(contractDB): [7/17] add state_accessors.go — full vm.StateDB…
saishibunb Apr 14, 2026
8585f11
refactor(contractDB): [8/17] add contractdb_test.go with unit tests
saishibunb Apr 14, 2026
073a172
refactor(contractDB): [9/17] replace SmartContract/internal/state/ wi…
saishibunb Apr 14, 2026
765a196
refactor(contractDB): [10/17] replace SmartContract/internal/reposito…
saishibunb Apr 14, 2026
34f82fe
refactor(contractDB): [11/17] replace SmartContract/internal/storage/…
saishibunb Apr 14, 2026
2c19edc
refactor(contractDB): [12/17] update all direct callers to import con…
saishibunb Apr 14, 2026
c77ed14
refactor(contractDB): [13/17] delete SmartContract/internal/state/
saishibunb Apr 14, 2026
42a99eb
refactor(contractDB): [14/17] delete SmartContract/internal/repository/
saishibunb Apr 14, 2026
5ce9fa4
refactor(contractDB): [15/17] delete SmartContract/internal/storage/
saishibunb Apr 14, 2026
79ece99
refactor(contractDB): [16/17] add pebble_test.go — integration tests
saishibunb Apr 14, 2026
82e9d89
refactor(contractDB): [17/17] final cleanup — verify grep check passes
saishibunb Apr 14, 2026
2ff3038
refactor(contractDB): update contract_registry to import contractDB d…
saishibunb Apr 14, 2026
b4cd361
fix: remove redundant local address calculation and account creation …
saishibunb Apr 14, 2026
df202a7
refactor: implement per-request StateDB isolation, add EIP-3860 initc…
saishibunb Apr 14, 2026
f141ca1
feat(ADR-001 phase1): thread ContractDeploymentInfo through block pro…
saishibunb Apr 14, 2026
de68c49
feat(ADR-001 phase2): add ContractPropagation gossip layer
saishibunb Apr 14, 2026
5ff6555
feat(ADR-001 phase3): wire shared registry and register stream handler
saishibunb Apr 14, 2026
45be80a
feat(ADR-001 phase4): add pull-on-demand fallback for missed contract…
saishibunb Apr 14, 2026
9c41de5
fix(Sequencer): update ProcessBlockLocally call site for new return s…
saishibunb Apr 14, 2026
bb79df7
chore(deps): upgrade ion to v0.4.1 and bump transitive OTEL/gRPC deps
saishibunb Apr 15, 2026
b83a5f8
feat(logging): add ion logger infrastructure for messaging, SmartCont…
saishibunb Apr 15, 2026
fe70ad1
fix(ADR-001): add bytecode storage helpers and surface nil-registry e…
saishibunb Apr 15, 2026
bafb27b
refactor(ion): migrate messaging package from zerolog/fmt to ion v0.4.1
saishibunb Apr 15, 2026
7252407
refactor(ion): migrate Sequencer package from stdlib log/fmt to ion v…
saishibunb Apr 15, 2026
dac29e8
chore: ignore WAL internals and ADR-001 code review doc
saishibunb Apr 15, 2026
a10ab93
refactor(logging): standardise all logger.go files to ion v0.4.1 GetN…
saishibunb Apr 15, 2026
05846b4
refactor(ion): migrate AVC package from zerolog/fmt to ion v0.4.1
saishibunb Apr 15, 2026
109c100
refactor(ion): migrate Block, DID, explorer, gETH, helper packages to…
saishibunb Apr 15, 2026
38f3126
refactor(ion): migrate SmartContract package from zerolog/fmt to ion …
saishibunb Apr 15, 2026
748eeae
refactor(ion): migrate fastsync, node, Pubsub, Sequencer packages to …
saishibunb Apr 15, 2026
8492052
refactor(ion): migrate config, DB_OPs, crdt, metrics, Vote, main to i…
saishibunb Apr 15, 2026
ddc9ac0
fix(ion): resolve build errors from ion API misuse post-migration
saishibunb Apr 15, 2026
b2a287f
fix(ion): fix missing log alias, local var shadowing, and unused ion …
saishibunb Apr 15, 2026
3a6eae2
fix(logging): add missing topic constants for DB_OPs_LogWriter, CRDTL…
saishibunb Apr 15, 2026
284c83b
fix(ion): resolve remaining build errors across 8 files
saishibunb Apr 15, 2026
97b1c43
fix(ion): complete fastsyncNew.go migration and fix protocol.ID cast
saishibunb Apr 15, 2026
4227d0a
fix(ion): remove leftover zerolog chain tails in fastsyncNew.go and f…
saishibunb Apr 15, 2026
cf0ddf1
fix(ion): convert remaining zerolog calls in main.go and fastsync.go
saishibunb Apr 15, 2026
689e96e
fix: resolve final Round 7 ion v0.4.1 build errors
saishibunb Apr 15, 2026
210638a
fix: Round 8 ion build errors — CRDTSyncHandler and fastsyncNew
saishibunb Apr 15, 2026
0707fe2
fix: Round 9 ion build errors — CRDTSyncHandler + ListenerHandler
saishibunb Apr 15, 2026
b29820e
fix: Round 10 ListenerHandler ion build errors
saishibunb Apr 15, 2026
cb222fa
fix: Round 11 — Streamcache_Builder bare err as ion.Field
saishibunb Apr 15, 2026
8ea9152
fix: Round 12 — DID bare err as ion.Field, node Logger field type
saishibunb Apr 15, 2026
e720b1c
fix: Round 13 — remove duplicate context import in NodeSelection Router
saishibunb Apr 15, 2026
533c4cc
fix: Round 14 — undefined ctx and variables in Sequencer/Consensus.go
saishibunb Apr 15, 2026
8c9e8e6
fix: Round 15 — remove leftover zerolog setup in Block/Server.go
saishibunb Apr 15, 2026
9797d08
fix: Round 16 — undefined opCtx in convertEthTxToConfigTx
saishibunb Apr 15, 2026
bef9605
fix: Round 17 — gETH/rpc handlers.go duplicate log import + log.Printf
saishibunb Apr 15, 2026
2ae165d
fix: Round 18 — restore log import in handlers.go, remove unused fmt …
saishibunb Apr 15, 2026
2824e78
fix: Round 19 — main.go zerolog Fatal chains and bare err as ion.Field
saishibunb Apr 15, 2026
98986c7
Update .gitignore
saishibunb Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,26 @@ __debug_bin
vendor/

# Internal team references
docs/SONARQUBE_SETUP_GUIDE.md
docs/SONARQUBE_SETUP_GUIDE.md
ADR-001-JMDT-Native-EVM-Smart-Contracts.docx
jmdn.yaml
contract_storage_pebble/000004.log
*.log
*.logs
*.db
*.db-wal
contract_storage_pebble/CURRENT
contract_storage_pebble/LOCK
contract_storage_pebble/MANIFEST-000001
contract_storage_pebble/MANIFEST-000005
contract_storage_pebble/*
SmartContract/artifacts/*
SmartContract/artifacts/HelloWorld.json
/SmartContract/artifacts
SmartContract/artifacts/HelloWorld.json
docs/refactor-contractDBOps.md
internal/WAL/*
docs/ADR-001-code-review.md
AVC/BLS/Router/config/bls.json
AVC/BuddyNodes/MessagePassing/BLS_Signer/config/bls.json
AVC/BuddyNodes/MessagePassing/BLS_Verifier/config/bls.json
4 changes: 2 additions & 2 deletions AVC/BFT/bft/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

// Zero allocation logger - its already allocated in the asynclogger
func logger() *ion.Ion {
logger, err := log.NewAsyncLogger().Get().NamedLogger(log.BFT, "")
logInstance, err := log.NewAsyncLogger().Get().NamedLogger(log.BFT, "")
if err != nil {
return nil
}
return logger.NamedLogger
return logInstance.GetNamedLogger()
}
29 changes: 15 additions & 14 deletions AVC/BFT/network/libp2p_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"

"github.com/JupiterMetaLabs/ion"
"github.com/libp2p/go-libp2p"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/core/host"
Expand Down Expand Up @@ -35,58 +36,58 @@ func SetupLibp2pHost(ctx context.Context, port int) (host.Host, *pubsub.PubSub,
return nil, nil, fmt.Errorf("failed to create gossipsub: %w", err)
}

fmt.Printf("✅ libp2p host created\n")
fmt.Printf(" Peer ID: %s\n", h.ID())
fmt.Printf(" Listening on: %s\n", listenAddr)
logger().Info(context.Background(), "✅ libp2p host created\n")
logger().Info(context.Background(), " Peer ID: %s", h.ID())
logger().Info(context.Background(), " Listening on: %s", listenAddr)

return h, ps, nil
}

// ConnectToPeers connects to bootstrap/peer nodes
func ConnectToPeers(ctx context.Context, h host.Host, peerAddrs []string) error {
if len(peerAddrs) == 0 {
fmt.Println("⚠️ No peers to connect to")
logger().Warn(context.Background(), "No peers to connect to")
return nil
}

fmt.Printf("🔗 Connecting to %d peers...\n", len(peerAddrs))
logger().Info(context.Background(), "🔗 Connecting to %d peers...", len(peerAddrs))

for _, addrStr := range peerAddrs {
// Parse multiaddr
maddr, err := multiaddr.NewMultiaddr(addrStr)
if err != nil {
fmt.Printf("❌ Invalid peer address %s: %v\n", addrStr, err)
logger().Info(context.Background(), "❌ Invalid peer address %s: %v", addrStr, err)
continue
}

// Extract peer info
peerInfo, err := peer.AddrInfoFromP2pAddr(maddr)
if err != nil {
fmt.Printf("❌ Failed to parse peer info from %s: %v\n", addrStr, err)
logger().Info(context.Background(), "❌ Failed to parse peer info from %s: %v", addrStr, err)
continue
}

// Check if this is a self-connection attempt
if peerInfo.ID == h.ID() {
fmt.Printf("🚫 Skipping self-connection attempt: %s\n", addrStr)
logger().Info(context.Background(), "🚫 Skipping self-connection attempt: %s", addrStr)
continue
}

// Connect
if err := h.Connect(ctx, *peerInfo); err != nil {
fmt.Printf("❌ Failed to connect to %s: %v\n", peerInfo.ID, err)
logger().Info(context.Background(), "❌ Failed to connect to %s: %v", peerInfo.ID, err)
continue
}

fmt.Printf("✅ Connected to peer: %s\n", peerInfo.ID)
logger().Info(context.Background(), "✅ Connected to peer: %s", peerInfo.ID)
}

return nil
}

// SetupSimpleNetwork creates a local test network
func SetupSimpleNetwork(ctx context.Context, numNodes int, startPort int) ([]host.Host, []*pubsub.PubSub, error) {
fmt.Printf("🚀 Setting up local test network with %d nodes\n", numNodes)
logger().Info(context.Background(), "🚀 Setting up local test network with %d nodes", numNodes)

hosts := make([]host.Host, numNodes)
pubsubs := make([]*pubsub.PubSub, numNodes)
Expand All @@ -102,7 +103,7 @@ func SetupSimpleNetwork(ctx context.Context, numNodes int, startPort int) ([]hos
}

// Connect them all together (full mesh for testing)
fmt.Println("\n🔗 Connecting nodes in full mesh...")
logger().Info(context.Background(), "Connecting nodes in full mesh")
for i := 0; i < numNodes; i++ {
for j := i + 1; j < numNodes; j++ {
// Connect i to j
Expand All @@ -112,11 +113,11 @@ func SetupSimpleNetwork(ctx context.Context, numNodes int, startPort int) ([]hos
}

if err := hosts[i].Connect(ctx, peerInfo); err != nil {
fmt.Printf("⚠️ Failed to connect node %d to node %d: %v\n", i, j, err)
logger().Info(context.Background(), "⚠️ Failed to connect node %d to node %d: %v", i, j, err)
}
}
}

fmt.Printf("\n✅ Network setup complete! %d nodes connected\n", numNodes)
logger().Info(context.Background(), "\n✅ Network setup complete! %d nodes connected", numNodes)
return hosts, pubsubs, nil
}
16 changes: 16 additions & 0 deletions AVC/BFT/network/logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package network

import (
log "gossipnode/logging"

"github.com/JupiterMetaLabs/ion"
)

// Zero allocation logger - its already allocated in the asynclogger
func logger() *ion.Ion {
logInstance, err := log.NewAsyncLogger().Get().NamedLogger(log.BFTNetwork, "")
if err != nil {
return nil
}
return logInstance.GetNamedLogger()
}
14 changes: 13 additions & 1 deletion AVC/BuddyNodes/DataLayer/CRDTLayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import (

"gossipnode/AVC/BuddyNodes/Types"
"gossipnode/crdt"
log "gossipnode/logging"

"github.com/JupiterMetaLabs/ion"
"github.com/libp2p/go-libp2p/core/peer"
)

Expand Down Expand Up @@ -120,7 +122,7 @@ func SyncAllNodes(ctx context.Context, nodes map[string]*Types.Controller) error
for j := i + 1; j < len(nodeIDs); j++ {
node1ID := nodeIDs[i]
node2ID := nodeIDs[j]
fmt.Println("Syncing", node1ID, "with", node2ID)
logger(log.CRDTLayer).Debug(context.Background(), "Syncing CRDT nodes", ion.String("node1", node1ID), ion.String("node2", node2ID))
if err := SyncWithNode(ctx, nodes[node1ID], nodes[node2ID], node1ID, node2ID); err != nil {
return fmt.Errorf("failed to sync %s with %s: %v", node1ID, node2ID, err)
}
Expand All @@ -140,3 +142,13 @@ func GetCRDTState(ctx context.Context, controller *Types.Controller) map[string]
func applyMergedCRDT(engine *crdt.Engine, key string, crdt crdt.CRDT) {
engine.ApplyMergedCRDT(key, crdt)
}


// logger returns the ion logger instance for CRDT layer
func logger(namedLogger string) *ion.Ion {
logInstance, err := log.NewAsyncLogger().Get().NamedLogger(namedLogger, "")
if err != nil {
return nil
}
return logInstance.GetNamedLogger()
}
45 changes: 22 additions & 23 deletions AVC/BuddyNodes/MessagePassing/BuddyNodeStream.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (StructBuddyNode *StructBuddyNode) HandleBuddyNodesMessageStream(host host.
}

// Record trace span and close it
streamSpanCtx, streamSpan := logger().NamedLogger.Tracer("MessagePassing").Start(spanCtx, "MessagePassing.HandleBuddyNodesMessageStream")
streamSpanCtx, streamSpan := logger().Tracer("MessagePassing").Start(spanCtx, "MessagePassing.HandleBuddyNodesMessageStream")
defer streamSpan.End()

startTime := time.Now().UTC()
Expand All @@ -79,8 +79,7 @@ func (StructBuddyNode *StructBuddyNode) HandleBuddyNodesMessageStream(host host.
streamSpan.SetAttributes(attribute.String("status", "read_error"))
duration := time.Since(startTime).Seconds()
streamSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(streamSpanCtx, "Error reading message from peer",
err,
logger().Error(streamSpanCtx, "Error reading message from peer", err,
ion.String("remote_peer_id", remotePeer.String()),
ion.String("message", msg),
ion.String("created_at", time.Now().UTC().Format(time.RFC3339)),
Expand All @@ -95,7 +94,7 @@ func (StructBuddyNode *StructBuddyNode) HandleBuddyNodesMessageStream(host host.

message := AVCStruct.NewMessageBuilder(nil).DeferenceMessage(msg)

logger().NamedLogger.Info(streamSpanCtx, "Received buddy message from peer",
logger().Info(streamSpanCtx, "Received buddy message from peer",
ion.String("remote_peer_id", remotePeer.String()),
ion.String("message", msg),
ion.String("created_at", time.Now().UTC().Format(time.RFC3339)),
Expand All @@ -110,7 +109,7 @@ func (StructBuddyNode *StructBuddyNode) HandleBuddyNodesMessageStream(host host.
streamSpan.SetAttributes(attribute.String("status", "parse_failed"))
duration := time.Since(startTime).Seconds()
streamSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(streamSpanCtx, "Failed to parse message - malformed JSON or invalid structure",
logger().Error(streamSpanCtx, "Failed to parse message - malformed JSON or invalid structure",
errors.New("failed to parse message"),
ion.String("remote_peer_id", remotePeer.String()),
ion.String("raw_message", msg),
Expand All @@ -129,7 +128,7 @@ func (StructBuddyNode *StructBuddyNode) HandleBuddyNodesMessageStream(host host.
streamSpan.SetAttributes(attribute.String("status", "nil_ack"))
duration := time.Since(startTime).Seconds()
streamSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(streamSpanCtx, "Received message with nil ACK",
logger().Error(streamSpanCtx, "Received message with nil ACK",
errors.New("received message with nil ACK"),
ion.String("remote_peer_id", remotePeer.String()),
ion.String("raw_message", msg),
Expand Down Expand Up @@ -163,7 +162,7 @@ func (StructBuddyNode *StructBuddyNode) HandleBuddyNodesMessageStream(host host.
if err := Router.Router(gossipMessage); err != nil {
streamSpan.RecordError(err)
streamSpan.SetAttributes(attribute.String("status", "router_failed"))
logger().NamedLogger.Error(streamSpanCtx, "Failed to handle message via service layer",
logger().Error(streamSpanCtx, "Failed to handle message via service layer",
err,
ion.String("remote_peer_id", remotePeer.String()),
ion.String("message", msg),
Expand All @@ -190,7 +189,7 @@ func (StructBuddyNode *StructBuddyNode) HandleBuddyNodesMessageStream(host host.
// handleStartPubSub handles the StartPubSub message type with direct logic
func (StructBuddyNode *StructBuddyNode) handleStartPubSub(spanCtx context.Context, s network.Stream) {
// Record trace span and close it
startPubSubSpanCtx, startPubSubSpan := logger().NamedLogger.Tracer("MessagePassing").Start(spanCtx, "MessagePassing.handleStartPubSub")
startPubSubSpanCtx, startPubSubSpan := logger().Tracer("MessagePassing").Start(spanCtx, "MessagePassing.handleStartPubSub")
defer startPubSubSpan.End()

startTime := time.Now().UTC()
Expand All @@ -215,7 +214,7 @@ func (StructBuddyNode *StructBuddyNode) handleStartPubSub(spanCtx context.Contex
startPubSubSpan.SetAttributes(attribute.String("status", "marshal_failed"))
duration := time.Since(startTime).Seconds()
startPubSubSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(startPubSubSpanCtx, "Failed to marshal ACK message",
logger().Error(startPubSubSpanCtx, "Failed to marshal ACK message",
err,
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", "ACK_TRUE"),
Expand All @@ -232,7 +231,7 @@ func (StructBuddyNode *StructBuddyNode) handleStartPubSub(spanCtx context.Contex
startPubSubSpan.SetAttributes(attribute.String("status", "send_failed"))
duration := time.Since(startTime).Seconds()
startPubSubSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(startPubSubSpanCtx, "Failed to send ACK to peer",
logger().Error(startPubSubSpanCtx, "Failed to send ACK to peer",
err,
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", "ACK_TRUE"),
Expand All @@ -244,7 +243,7 @@ func (StructBuddyNode *StructBuddyNode) handleStartPubSub(spanCtx context.Contex
} else {
duration := time.Since(startTime).Seconds()
startPubSubSpan.SetAttributes(attribute.Float64("duration", duration), attribute.String("status", "success"), attribute.String("ack_sent", "ACK_TRUE"))
logger().NamedLogger.Info(startPubSubSpanCtx, "Sent ACK_TRUE to peer for pubsub subscription",
logger().Info(startPubSubSpanCtx, "Sent ACK_TRUE to peer for pubsub subscription",
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", "ACK_TRUE"),
ion.Float64("duration", duration),
Expand All @@ -271,7 +270,7 @@ func (StructBuddyNode *StructBuddyNode) handleStartPubSub(spanCtx context.Contex
startPubSubSpan.SetAttributes(attribute.String("status", "marshal_failed"))
duration := time.Since(startTime).Seconds()
startPubSubSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(startPubSubSpanCtx, "Failed to marshal ACK message",
logger().Error(startPubSubSpanCtx, "Failed to marshal ACK message",
err,
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", "ACK_FALSE"),
Expand All @@ -288,7 +287,7 @@ func (StructBuddyNode *StructBuddyNode) handleStartPubSub(spanCtx context.Contex
startPubSubSpan.SetAttributes(attribute.String("status", "send_failed"))
duration := time.Since(startTime).Seconds()
startPubSubSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(startPubSubSpanCtx, "Failed to send ACK to peer",
logger().Error(startPubSubSpanCtx, "Failed to send ACK to peer",
err,
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", "ACK_FALSE"),
Expand All @@ -300,7 +299,7 @@ func (StructBuddyNode *StructBuddyNode) handleStartPubSub(spanCtx context.Contex
} else {
duration := time.Since(startTime).Seconds()
startPubSubSpan.SetAttributes(attribute.Float64("duration", duration), attribute.String("status", "success"), attribute.String("ack_sent", "ACK_FALSE"))
logger().NamedLogger.Info(startPubSubSpanCtx, "Sent ACK_FALSE to peer - node not ready for pubsub",
logger().Info(startPubSubSpanCtx, "Sent ACK_FALSE to peer - node not ready for pubsub",
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", "ACK_FALSE"),
ion.Float64("duration", duration),
Expand All @@ -316,7 +315,7 @@ func (StructBuddyNode *StructBuddyNode) handleStartPubSub(spanCtx context.Contex
// handleSubscriptionResponse handles subscription response messages
func (StructBuddyNode *StructBuddyNode) handleSubscriptionResponse(spanCtx context.Context, s network.Stream, message *AVCStruct.Message) {
// Record trace span and close it
subResponseSpanCtx, subResponseSpan := logger().NamedLogger.Tracer("MessagePassing").Start(spanCtx, "MessagePassing.handleSubscriptionResponse")
subResponseSpanCtx, subResponseSpan := logger().Tracer("MessagePassing").Start(spanCtx, "MessagePassing.handleSubscriptionResponse")
defer subResponseSpan.End()

startTime := time.Now().UTC()
Expand All @@ -331,7 +330,7 @@ func (StructBuddyNode *StructBuddyNode) handleSubscriptionResponse(spanCtx conte
subResponseSpan.SetAttributes(attribute.String("status", "ack_true"))
if StructBuddyNode.BuddyNode.ResponseHandler != nil {
StructBuddyNode.BuddyNode.ResponseHandler.HandleResponse(remotePeer, true, "main")
logger().NamedLogger.Info(subResponseSpanCtx, "Handled ACK_TRUE subscription response",
logger().Info(subResponseSpanCtx, "Handled ACK_TRUE subscription response",
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_status", "ACK_TRUE"),
ion.String("created_at", time.Now().UTC().Format(time.RFC3339)),
Expand All @@ -344,7 +343,7 @@ func (StructBuddyNode *StructBuddyNode) handleSubscriptionResponse(spanCtx conte
subResponseSpan.SetAttributes(attribute.String("status", "ack_false"))
if StructBuddyNode.BuddyNode.ResponseHandler != nil {
StructBuddyNode.BuddyNode.ResponseHandler.HandleResponse(remotePeer, false, "main")
logger().NamedLogger.Info(subResponseSpanCtx, "Handled ACK_FALSE subscription response",
logger().Info(subResponseSpanCtx, "Handled ACK_FALSE subscription response",
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_status", "ACK_FALSE"),
ion.String("created_at", time.Now().UTC().Format(time.RFC3339)),
Expand All @@ -358,7 +357,7 @@ func (StructBuddyNode *StructBuddyNode) handleSubscriptionResponse(spanCtx conte
subResponseSpan.SetAttributes(attribute.String("status", "unknown_ack_status"))
duration := time.Since(startTime).Seconds()
subResponseSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(subResponseSpanCtx, "Unknown status in ACK_Message",
logger().Error(subResponseSpanCtx, "Unknown status in ACK_Message",
errors.New("unknown status in ACK_Message"),
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_status", ackStatus),
Expand All @@ -373,7 +372,7 @@ func (StructBuddyNode *StructBuddyNode) handleSubscriptionResponse(spanCtx conte
subResponseSpan.SetAttributes(attribute.String("status", "nil_ack"))
duration := time.Since(startTime).Seconds()
subResponseSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(subResponseSpanCtx, "Unknown message type received from peer",
logger().Error(subResponseSpanCtx, "Unknown message type received from peer",
errors.New("unknown message type received"),
ion.String("remote_peer_id", remotePeer.String()),
ion.String("created_at", time.Now().UTC().Format(time.RFC3339)),
Expand All @@ -387,7 +386,7 @@ func (StructBuddyNode *StructBuddyNode) handleSubscriptionResponse(spanCtx conte
// sendACKResponse sends ACK response based on success/failure
func (StructBuddyNode *StructBuddyNode) sendACKResponse(spanCtx context.Context, s network.Stream, success bool, stage string) {
// Record trace span and close it
ackResponseSpanCtx, ackResponseSpan := logger().NamedLogger.Tracer("MessagePassing").Start(spanCtx, "MessagePassing.sendACKResponse")
ackResponseSpanCtx, ackResponseSpan := logger().Tracer("MessagePassing").Start(spanCtx, "MessagePassing.sendACKResponse")
defer ackResponseSpan.End()

startTime := time.Now().UTC()
Expand Down Expand Up @@ -423,7 +422,7 @@ func (StructBuddyNode *StructBuddyNode) sendACKResponse(spanCtx context.Context,
ackResponseSpan.SetAttributes(attribute.String("status", "marshal_failed"))
duration := time.Since(startTime).Seconds()
ackResponseSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(ackResponseSpanCtx, "Failed to marshal ACK response message",
logger().Error(ackResponseSpanCtx, "Failed to marshal ACK response message",
err,
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", ackType),
Expand All @@ -441,7 +440,7 @@ func (StructBuddyNode *StructBuddyNode) sendACKResponse(spanCtx context.Context,
ackResponseSpan.SetAttributes(attribute.String("status", "send_failed"))
duration := time.Since(startTime).Seconds()
ackResponseSpan.SetAttributes(attribute.Float64("duration", duration))
logger().NamedLogger.Error(ackResponseSpanCtx, "Failed to send ACK response to peer",
logger().Error(ackResponseSpanCtx, "Failed to send ACK response to peer",
err,
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", ackType),
Expand All @@ -454,7 +453,7 @@ func (StructBuddyNode *StructBuddyNode) sendACKResponse(spanCtx context.Context,
} else {
duration := time.Since(startTime).Seconds()
ackResponseSpan.SetAttributes(attribute.Float64("duration", duration), attribute.String("status", "success"))
logger().NamedLogger.Info(ackResponseSpanCtx, "Sent ACK response to peer",
logger().Info(ackResponseSpanCtx, "Sent ACK response to peer",
ion.String("remote_peer_id", remotePeer.String()),
ion.String("ack_type", ackType),
ion.String("stage", stage),
Expand Down
Loading
Loading