Skip to content

Feature/sc#27

Open
saishibunb wants to merge 76 commits into
mainfrom
feature/sc
Open

Feature/sc#27
saishibunb wants to merge 76 commits into
mainfrom
feature/sc

Conversation

@saishibunb
Copy link
Copy Markdown
Member

What

Why

How

Testing

Checklist

  • make build passes
  • make lint passes
  • make fmt-check passes
  • Commit messages follow conventional commits
  • No secrets or credentials in the diff

saishibunb and others added 30 commits April 13, 2026 14:10
Brings the full SmartContract package from SmartContract-Fixes into main
via the feature/sc integration branch. Includes:

- SmartContract/ package: EVM executor, Solidity compiler (solc-go),
  StateDB (Pebble-backed), contract registry, gRPC server/client,
  proto definitions, and all internal sub-packages
- gETH/Facade: wire scClient into ServiceImpl; implement Call(),
  GetCode(), GetStorageAt(), GetGasPrice(), GetFeeHistory(),
  GetMaxPriorityFeePerGas(), IsListening(), GetPeerCount()
- handlers.go: re-enable eth_call, uncomment eth_getCode, add
  eth_getStorageAt, eth_feeHistory, eth_maxPriorityFeePerGas,
  net_listening, net_peerCount
- messaging/BlockProcessing: integrate StateDB for all transactions,
  add commitToDB parameter, wire ProcessContractDeployment
- Block/: update SubmitRawTransaction and GetFeeStatisticsFromRouting
  signatures (remove ctx param)
- config/constants.go: add DefaultGasPrice, DefaultPriorityFeePerGas
- Logger: add gETH/Facade/Service/Logger package
- messaging/BlockProcessing/public_api.go: expose public API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contract creation transactions have To == nil by design (EIP standard).
SubmitRawTransaction was calling tx.To.Hex() unconditionally in several
log statements, causing a nil pointer dereference panic whenever a
DeployContract gRPC call was made.

Added addrHex() helper that safely dereferences *common.Address and
returns a descriptive fallback string ("<contract creation>" for nil To,
"<nil>" for nil From). Applied across all six call sites in Server.go.

Fixes: panic: runtime error: invalid memory address or nil pointer
dereference at Block/Server.go:175 on DeployContract.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… creation

Contract creation transactions (EIP-1559 Type 2) have tx.To == nil and
tx.GasPrice == nil by design. The Security package assumed both were always
set, causing nil pointer panics on DeployContract calls.

Changes:
- Security.go AllChecks(): guard tx.To before span attribute assignment (×2)
- Security.go CheckSignature(): remove tx.To from required-field check;
  To is intentionally nil for contract deployments
- security_cache.go CheckAddressExistWithCache(): skip receiver cache lookup
  when tx.To is nil (contract creation has no receiver)
- security_cache.go CheckBalanceWithCache(): use tx.MaxFee as effective gas
  price when tx.GasPrice is nil (EIP-1559 Type 2 transactions)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Added private_key field to DeployContractRequest (proto field 7).
The DeployContract handler now:
  1. Requires private_key (0x-prefixed hex ECDSA key) in the request
  2. Parses it via crypto.HexToECDSA
  3. Calls transaction.SignTransaction() to populate V, R, S on the tx
  4. Logs the signed tx hash before submission

Without V/R/S populated, Security.CheckSignature() correctly rejects
the transaction. This fix ensures the deployment tx is a properly
signed EIP-1559 Type 2 transaction, matching what the consensus
pipeline expects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drop the proto private_key approach (required protoc regeneration).
Instead, Block/Server.go now detects unsigned contract-creation
transactions (tx.To == nil && tx.V == nil) submitted by the internal
SmartContract gRPC service and bypasses external signature validation
for them. All regular signed transactions still go through the full
Security.AllChecks() pipeline.

- Block/Server.go: add isInternalDeployment branch before AllChecks
- handlers.go: remove signing code (V/R/S left nil intentionally)
- smartcontract.proto / .pb.go: revert private_key field (field 7)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All three DID/gETH/BlockGen service addresses were hardcoded to
localhost:15052, localhost:15054, and localhost:8090. They now come
from the unified settings.NodeConfig loaded by settings.Load().

deploy_contract.go:
  - Add sharedDIDClient singleton + SetSharedDIDClient() (same pattern
    as sharedKVStore) so InitializeStateDB never dials a new connection
  - InitializeStateDB now uses the shared client when available; falls
    back to JMDN_PORTS_DID_ADDR env var, then localhost:15052 (tests only)

server_integration.go:
  - Call evm.SetSharedDIDClient(didClient) after creating the DID client
    so block processing reuses the already-dialled connection

cmd/main.go (standalone SC server):
  - Replace hardcoded port/address literals with settings.Load()
  - Uses cfg.Ports.Smart, cfg.Ports.Geth, cfg.Ports.DID, cfg.Binds.DID
  - Calls evm.SetSharedDIDClient + evm.SetSharedKVStore at startup
  - Replaced deprecated grpc.Dial with grpc.NewClient

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The KVStore fallback branch used err= assignment but err was only
declared inside the DID client if-else block via :=, making it
out of scope. Declare var err error at the top of the function and
use a local connErr for the gRPC dial error to keep scopes clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add KVStore, Batch, Iterator interfaces plus PebbleStore, MemKVStore
implementations and Config/NewKVStore factory into the new
gossipnode/DB_OPs/contractDB sub-package.
Package declaration: contractDB. SmartContract/internal/storage/ untouched.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ions

Add ContractMetadata, TransactionReceipt, StorageMetadata, AccountData,
emptyCodeHash, and key-prefix constants. These become the single source
of truth for the entire node's contract persistence layer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
StateRepository and StateBatch interfaces land in repository.go.
PebbleAdapter (and PebbleBatch) implement StateRepository against the
contractDB.KVStore — no more import of SmartContract/internal/storage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy journal (snapshot/revert change log) and accessList (EIP-2929/2930
tracking) from SmartContract/internal/state/ into contractDB, updating
the package declaration. Internal helpers, not part of the public API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
stateObject model (balance, nonce, code, storage dirty-tracking) moved
to contractDB. Imports of SmartContract/internal/repository removed —
now uses the contractDB.StateRepository defined in the same package.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… interface

ContractDB struct, NewContractDB, CommitToDB, Finalise, GetBalanceChanges,
metadata/receipt persistence, EVM mechanics stubs, and the public StateDB
interface land in contractdb.go. Also contains the sharedKVStore /
sharedDIDClient singletons with SetSharedKVStore, SetSharedDIDClient,
and InitializeStateDB (moved from SmartContract/internal/evm).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… implementation

All vm.StateDB method implementations (GetBalance, SetBalance, GetNonce,
SetNonce, GetCode, SetCode, GetState, SetState, Snapshot,
RevertToSnapshot, CreateAccount, Suicide/SelfDestruct, Exist, Empty,
access-list methods) moved to state_accessors.go.
ContractDB now fully satisfies vm.StateDB in its new home.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Unit tests using MemKVStore (no real DB process needed).
Covers: CreateAccount, SetBalance/GetBalance, SetCode/GetCode,
SetState/GetState, Snapshot+modify+RevertToSnapshot, log capture,
and a CommitToDB → reload round-trip over a shared MemStore.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…th re-export stubs

All files in SmartContract/internal/state/ replaced by compat.go which
re-exports every type and constructor from gossipnode/DB_OPs/contractDB.
Existing callers compile unchanged without touching their import paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ry/ with re-export stubs

compat.go re-exports StateRepository, StateBatch, StorageMetadata, and
NewPebbleAdapter from contractDB. All existing repository callers still
compile with their original import paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… with re-export stubs

compat.go re-exports KVStore, Batch, Iterator, StoreType, Config,
NewKVStore, NewMemKVStore, NewPebbleStore, and ConfigFromEnv from
contractDB. Callers importing the old storage path still compile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tractDB

Every file that previously imported SmartContract/internal/state,
/repository, or /storage now imports gossipnode/DB_OPs/contractDB.

Changes:
- deploy_contract.go: uses contractDB.StateDB, ContractMetadata,
  TransactionReceipt; delegates InitializeStateDB to contractDB
- server_integration.go: NewKVStore/SetSharedKVStore/SetSharedDIDClient/
  NewPebbleAdapter/NewContractDB from contractDB
- cmd/main.go: same as server_integration
- router/router.go: StateDB field type → contractDB.StateDB
- router/conversion.go: ConvertToInternalStateDB returns contractDB.StateDB
- processor.go: casts through contractDB.StateDB

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
saishibunb and others added 30 commits April 15, 2026 11:50
Applies to: ContractPropagation.go, broadcast.go, blockPropagation.go,
            DIDPropagation.go, BlockProcessing/Processing.go

- Remove all github.com/rs/zerolog/log imports
- Replace log.Info/Warn/Error/Debug chains with contractLogger() / broadcastLogger() / logger() ion calls
- Replace fmt.Printf console output with structured ion log calls
- Use ion.Err(err) for error fields in Warn/Debug (not ion.String("error", err.Error()))
- Use ion.Duration(key, d) for duration fields
- Use context.Background() for functions without an injected ctx

ADR-001 fixes bundled in ContractPropagation.go:
- Bytecode now transferred in pull-on-demand response (Bytecode []byte field)
- io.LimitReader guards on all stream reads (4 MB push, 512 B pull-req, 25 MB pull-resp)
- sync.Once ensures ContractLocalGRO is initialised race-free via ensureContractLocalGRO()

ADR-001 fix bundled in broadcast.go:
- Removed two spurious ProcessBlockLocally call sites inside BroadcastBlockToEveryNodeWithExtraData;
  single authoritative call remains in consensus_statemachine.go

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…0.4.1

consensus_statemachine.go:
- Remove stdlib "log" import; add github.com/JupiterMetaLabs/ion
- Replace log.Printf and fmt.Printf with logger().Info/Warn/Error calls
- Use ion.Err(err) for error fields in Warn calls
- Structured fields replace printf format strings throughout

Consensus.go:
- Drop logger().NamedLogger. indirection — logger() now returns *ion.Ion directly
- Replace ion.String("error", err.Error()) with ion.Err(err) across all Warn calls

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- internal/WAL/* — generated write-ahead log files, not for version control
- docs/ADR-001-code-review.md — review artifact, tracked separately

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…amedLogger() pattern

- Update all existing logger.go files from old *logging.Logging return type to
  canonical *ion.Ion via logInstance.GetNamedLogger()
- Add 22 new topic constants to logging/constants.go (Node, Fastsync, GethServer,
  Helper, Profiler, Transfer, Shutdown, PubsubRoot/Channel/Router/Subscriber,
  NodeSelection, CRDT, Main, SmartContractRouter/Compiler/Registry/Server,
  BFTNetwork, TOPIC)
- Create new logger.go files for packages that lacked one: AVC/BFT/network,
  AVC/NodeSelection/Router, AVC/NodeSelection/pkg/selection, Pubsub,
  Pubsub/DataProcessing/Channel, Pubsub/Router, SmartContract/internal/*,
  SmartContract/pkg/compiler, SmartContract/server_logger, config/PubSubMessages/Cache,
  crdt/HashMap, fastsync, gETH, helper, main_logger, node, profiler, shutdown, transfer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- BuddyNodes/MessagePassing: replace zerolog with ion in BuddyNodeStream,
  CRDTSyncHandler, ListenerHandler, MessageListener, Streaming, Streamcache_Builder
- BuddyNodes/MessagePassing/Service: migrate all service files (nodeDiscovery,
  publish, subscription, validation, verification, PubSubConnector)
- BuddyNodes/MessagePassing/Structs: migrate Utils.go
- BuddyNodes/DataLayer: migrate CRDTLayer.go
- BFT/network: migrate libp2p_setup.go
- NodeSelection: migrate Router.go, filter.go, service.go
- VoteModule: migrate vote_validation.go

All log.Error() with error as field converted to ion.Err(err); structured fields
use ion.String/Int/Bool/Duration/Err constructors throughout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… ion v0.4.1

- Block: migrate Server.go, Loghelper.go, gRPCclient.go, grpc_server.go from
  zerolog; fix .NamedLogger chain calls after logger() return-type change
- DID: replace zerolog with ion structured logging
- explorer: migrate api.go from zerolog
- gETH/Server: replace zerolog with ion in main gETH server
- gETH/Facade/Service: migrate Service.go (71 ServiceLogger.LogData → ion calls)
  and Service_WS.go
- gETH/Facade/rpc: migrate handlers.go and http_server.go
- gETH/gETH_Middleware: replace zerolog with ion
- helper: migrate helper.go and tun_ip.go from fmt.Printf/zerolog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…v0.4.1

- cmd/main.go: replace fmt.Printf startup prints with ion structured logs
- internal/contract_registry/kvstore.go: migrate from zerolog to ion
- internal/evm/deploy_contract.go: migrate from zerolog to ion
- internal/router/handlers.go and server.go: migrate from zerolog to ion
- pkg/compiler/compiler.go: migrate from zerolog to ion
- server_integration.go: migrate from zerolog to ion

All error logging uses ion.Err(err) field; structured context preserved with
ion.String/Int/Bool constructors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion v0.4.1

- fastsync: migrate fastsync.go, fastsyncNew.go, FileTransfer.go from zerolog
- node: migrate node.go, nodemanager.go, discovery.go from zerolog; fix
  metricsLogger.NamedLogger. → metricsLogger. after return-type change
- Pubsub: migrate Pubsub.go, Publish/Publish.go, Router/Router.go,
  DataProcessing/Channel/Channel.go
- Pubsub/Subscription: migrate Subscription.go, SubscriptionManager.go,
  SubscriberHelper.go
- Sequencer/Communication: replace zerolog with ion structured logging
- Sequencer/Consensus: remove ASCII box prints, replace with ion structured logs
- Sequencer/helper/staticfunctions: add missing ion import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on v0.4.1

- config/ConnectionPool: replace zerolog with ion
- config/PubSubMessages: migrate Cache/AddPeerCache, GlobalVariables_Builder,
  GossipSub_Helper, Pubsub_Builder from zerolog to ion
- config/utils/BuddyNodes_Utils: migrate from zerolog to ion
- crdt/HashMap/HashMap: replace zerolog with ion
- DB_OPs: migrate MainDB_Connections, account_immuclient, log_writer, merkletree,
  sqlops from zerolog to ion (using logger(log.Topic) pattern)
- metrics/metrics and DBMetrics: migrate from zerolog to ion
- Vote/Trigger: migrate from zerolog/fmt; fix logger().NamedLogger.Tracer() →
  logger().Tracer() after return-type change
- profiler/profiler: replace fmt.Printf with ion structured logs
- transfer/file: migrate from zerolog to ion
- main.go: replace zerolog/fmt startup and lifecycle logs with ion

Completes project-wide migration from zerolog/fmt.Printf/zap to ion v0.4.1.
Only intentionally preserved: CLI terminal output (directMSG, CLI/CLI.go, seed).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- logging/constants.go: add VoteModule and DB_OPs_SqlOps topic constants
  (referenced by vote_validation.go and sqlops.go but missing from constants)
- AVC/VoteModule/vote_validation.go: remove unused fmt import; fix
  ion.Float64("correct", correct) → ion.Bool("correct", correct) (bool vs float64)
- AVC/NodeSelection/pkg/selection/service.go: remove unused fmt import; fix 5 raw
  struct/int values passed directly as ion.Field — wrap with ion.String/ion.Int
- AVC/NodeSelection/pkg/selection/filter.go: remove unused fmt import
- profiler/profiler.go: fix logger().Error panic recovery — pass fmt.Errorf as
  error arg (3rd positional), ion.String as field; ion.Field cannot be cast as error
- helper/helper.go: add errors import; fix logger().Error missing required error
  arg — pass errors.New("uint256 overflow") as 3rd positional arg
- metrics/DBMetrics.go: remove unused fmt import
- metrics/metrics.go: remove unused fmt import
- config/utils/BuddyNodes_Utils.go: remove unused fmt import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…import

- DB_OPs/MainDB_Connections.go: alias gossipnode/logging as log (was unaliased,
  causing all log.MainDB_Connections references to be undefined); rename local
  variable logger := asyncLogger.GlobalLogger to ionLogger to stop it shadowing
  the package-level logger(string) function — which caused the *ion.Ion to be
  called as a function at line 233; update all logger.Debug calls in
  connectToMainDB to ionLogger.Debug
- DB_OPs/account_immuclient.go: add missing log "gossipnode/logging" import —
  file used log.DB_OPs_AccountConnectionPool but had no import for the package
- transfer/file.go: remove unused ion import (all logging goes via logger())

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ayer, DB_OPs_MerkleTree

These constants were referenced by logger(log.X) calls in log_writer.go,
CRDTLayer.go, and merkle.go but were never added to logging/constants.go.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- explorer/addressOps.go: remove extra .GetNamedLogger() chained on logger()
  which already returns *ion.Ion — type has no such method
- AVC/BuddyNodes/DataLayer/CRDTLayer.go: fix node1ID.String()/node2ID.String()
  called on plain string values — drop .String() call
- SmartContract/server_logger.go: delete file — duplicate logger() declaration
  conflicts with SmartContract/logger.go in the same package
- SmartContract/server_integration.go: replace 2 leftover zerolog
  log.Warn().Err(err).Msg(...) calls with logger().Warn(ctx, msg, ion.Err(err))
- config/PubSubMessages/GlobalVariables_Builder.go: remove unused fmt import
- config/PubSubMessages/Pubsub_Builder.go: remove unused fmt import
- fastsync/fastsync.go: complete the partial migration — convert all ~43
  remaining zerolog log.Error/Warn/Info/Debug chain calls to ion; fix all ~31
  ion.String("value", fmt.Sprintf(...)) patterns to typed ion fields; fix two
  syntax-error anonymous-function-in-arg-list blocks at former lines 1080/1092;
  fix arithmetic-split-across-ion.String at former line 702
- fastsync/fastsyncNew.go: fix broken multi-line log call where args landed
  outside the function call on line 280

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- fastsync/fastsyncNew.go: comprehensive fix of all remaining build errors —
  241 logger calls corrected including: dangling args after closed calls,
  inline anonymous functions embedded in ion.String, ion.String("value",
  fmt.Sprintf(...)) converted to typed ion fields, incomplete calls with
  format-string placeholders but no values, reversed/double-comma arg order,
  and ~15 remaining zerolog calls
- Pubsub/Publish/Publish.go: fix ion.String("protocol", gps.Protocol) where
  gps.Protocol is protocol.ID (named type over string) — add explicit cast
  string(gps.Protocol)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ix peer.ID cast

- fastsync/fastsyncNew.go: fix 9 remaining syntax errors — all caused by zerolog
  chain fragments (.Str().Int().Bool().Msg()) left behind after the ion call was
  already emitted on the preceding line; remove the orphaned lines and replace the
  four logger().Info(ctx,.) stubs with complete ion calls
- Pubsub/Router/Router.go: fix ion.String("sender", message.Sender) where
  message.Sender is peer.ID (named type over string) — use .String() method

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- main.go: 34 remaining zerolog log.Info/Error/Warn chain calls converted to
  mainLogger().Info/Error/Warn(context.Background(), ...) with typed ion fields
- fastsync/fastsync.go: one leftover log.Info().Msg("Sync completed") at line 484

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- AVC/BFT/bft/logger.go: rename local var logger→logInstance to stop
  shadowing the package-level logger() func; fix undefined logInstance ref
- fastsync/fastsync.go: wrap bare err args in ion.Err() for four
  logger().Warn() calls (lines 742, 787, 958, 1287); remove nil variadic
  args from three Warn() calls (lines 1294, 1334, 1393)
- fastsync/fastsyncNew.go: remove else branch in NewFastSync where
  logger() was called but the logger *ion.Ion parameter shadowed the func;
  stray ion, prefix already removed (1909); ion.Err(err) fix already applied (966)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fastsync/fastsyncNew.go:
- Line 1988: wrap bare err in ion.Err() for logger().Debug() call
- Lines 2518-2519: remove stray "ion," prefix before ion.Int() field args

AVC/BuddyNodes/MessagePassing/CRDTSyncHandler.go:
- Remove extra closing ) from all ion.String("args", fmt.Sprintf(...))))
  patterns (every call had one extra paren from botched migration)
- Fix 8 dangling-arg logger calls where printf args were orphaned on the
  next line outside the function call; merged into fmt.Sprintf() in msg
- Balance all remaining unclosed parens on logger/ion lines

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CRDTSyncHandler.go:
- Remove extra ) from 3 remaining logger calls whose format strings
  contain literal parentheses (e.g. "(expected %d)") that fooled the
  previous paren-balance script

ListenerHandler.go:
- Strip stray trailing 'g' from 6 logger calls (zerolog .Msg migration
  artifact that left a bare 'g' after the closing paren)
- Fix 2 calls ending with .String()) — remove the orphaned .String() chain
- Fix 7 calls ending with ")) — remove the extra closing paren
- Fix line 1551: orphaned printf args outside the logger call merged into
  fmt.Sprintf("...%d...%d...", len(buddyIDs), config.MaxMainPeers)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Line 1718: logger().Error() was missing its final closing ) causing
  'unexpected newline in argument list' on the return statement
- Line 1908: logger().Info() closed too early, leaving ', voteResult)'
  orphaned outside the call; reconstructed as fmt.Sprintf with both
  buddyID.String() and voteResult args

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Wrap bare err arg in ion.Err() in logger().Info() call (line 290)
- This also resolves the 'ion imported and not used' error since
  ion.Err() is now the first use of the ion package in this file

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DID/DID.go:
- Lines 102, 125, 483: wrap bare err in ion.Err() for logger().Warn() calls

node/nodemanager.go:
- Change NodeManager.Logger field from *log.Logging to *ion.Ion to match
  the *ion.Ion returned by logger(); remove now-unused log alias import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Router.go had "context" declared twice in the import block (once at the
top, once after the ion import), causing 'redeclared in this block' and
'imported and not used' errors. Deduplicated and reordered imports.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
printCRDTHeader(): no ctx param — replace bare ctx with context.Background();
  remove logger().Debug call referencing undefined receivedCount/sentCount

printCRDTVotes(): has trace_ctx from tracer — replace 7 bare ctx refs with
  trace_ctx (lines 1248, 1255, 1268, 1281-1283, 1293)

printCRDTFooter(): no ctx param — replace bare ctx with context.Background()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the unmigrated zerolog.New() txLogger creation and the
SetLogger(txLogger) call — both reference zerolog which is no longer
imported. Gin DefaultWriter/DefaultErrorWriter setup is preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
convertEthTxToConfigTx is a context-free conversion helper; debug logging
was copied in from the calling function with opCtx references that are not
in scope. Replace all opCtx with context.Background() in that function.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove log "gossipnode/logging" alias (unused, caused redeclaration of
  stdlib "log")
- Remove stdlib "log" import
- Convert all 46 log.Printf calls to logger().Info() with ion fields:
    RPC Request  → ion.String("request", ...)
    RPC Response → ion.String("method", ...), ion.String("response", ...)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…in http_server.go

handlers.go: re-add log "gossipnode/logging" import removed in Round 17;
  the logger() function at line 624 uses log.NewAsyncLogger() and log.Facade

http_server.go: remove unused "fmt" import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4x log.Fatal().Err(err).Msg(...) → mainLogger().Critical(ctx, msg, err)
  + os.Exit(1) to maintain process-exit behaviour

3x logger.Debug(ctx, "msg: %v", err) → logger.Debug(ctx, "msg", ion.Err(err))
  removing the now-redundant %v format verb

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant