Commit graph

11 commits

Author SHA1 Message Date
Snider
34128d8e98 refactor: migrate module path to dappco.re/go/core/blockchain
Some checks failed
Security Scan / security (pull_request) Successful in 11s
Test / Test (pull_request) Failing after 19s
Update go.mod module line, all require/replace directives, and every
.go import path from forge.lthn.ai/core/go-blockchain to
dappco.re/go/core/blockchain. Add replace directives to bridge
dappco.re paths to existing forge.lthn.ai registry during migration.
Update CLAUDE.md, README, and docs to reflect the new module path.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 01:49:26 +00:00
Snider
71f0a5c1d5 refactor: replace fmt.Errorf/os.* with go-io/go-log conventions
Some checks failed
Security Scan / security (push) Successful in 11s
Test / Test (push) Failing after 23s
Replace all fmt.Errorf and errors.New in production code with
coreerr.E("Caller.Method", "message", err) from go-log. Replace
os.MkdirAll with coreio.Local.EnsureDir from go-io. Sentinel errors
(consensus/errors.go, wire/varint.go) intentionally kept as errors.New
for errors.Is compatibility.

270 error call sites converted across 38 files. Test files untouched.
crypto/ directory (CGO) untouched.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 21:17:49 +00:00
Claude
33a0b57d72
chore: use range-over-integer (Go 1.22+)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:14:08 +00:00
Claude
c488ef8816
test(p2p): integration test for chain request and block fetch
Performs handshake, REQUEST_CHAIN with genesis hash, reads
RESPONSE_CHAIN_ENTRY, then REQUEST_GET_OBJECTS with the first block
hash and verifies RESPONSE_GET_OBJECTS returns a non-empty block blob.

Also fixes the existing handshake test return code check — the C++
daemon handler returns 1 (not 0) on success.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 21:17:54 +00:00
Claude
fcb867d53b
fix(p2p): correct network IDs and serialisation for C++ daemon compat
Three bugs found by integration testing against the C++ testnet daemon:

1. NetworkIDMainnet/Testnet had byte 10 swapped — the C++ #ifndef TESTNET
   branch (mainnet) sets P2P_NETWORK_ID_TESTNET_FLAG=1, and the #else
   (testnet) sets it to 0. Counter-intuitive but matches compiled binaries.

2. ClientVersion format "Lethean/go-blockchain 0.1.0" was rejected by the
   daemon's parse_client_version which expects "major.minor.rev.build[commit]".
   Changed to "6.0.1.2[go-blockchain]".

3. RequestChain, RequestGetObjects, and ResponseGetObjects used StringArrayVal
   for hash fields, but the C++ daemon uses KV_SERIALIZE_CONTAINER_POD_AS_BLOB
   which packs all 32-byte hashes into a single concatenated blob. Also,
   ResponseChainEntry.m_block_ids is an object array of block_context_info
   (hash + cumulative size), not a simple hash list.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 21:17:48 +00:00
Claude
3fe8dec1a4
feat(p2p): add RequestGetObjects and ResponseGetObjects types
Encode/decode for NOTIFY_REQUEST_GET_OBJECTS (2003) and
NOTIFY_RESPONSE_GET_OBJECTS (2004), including BlockCompleteEntry
for block + transaction blob pairs.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:54:14 +00:00
Claude
412272b342
test(p2p): integration test against C++ testnet daemon
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:45:24 +00:00
Claude
074a7333aa
feat(p2p): timed sync and block/tx relay command types
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:41:30 +00:00
Claude
0e5ac70eef
feat(p2p): handshake command with NodeData and peerlist decoding
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:41:25 +00:00
Claude
b3d60948c6
feat(p2p): ping command encode/decode
Add EncodePingRequest (empty section) and DecodePingResponse
(status + peer_id) for the Levin ping command (1003).

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:34:36 +00:00
Claude
3474a98f97
feat(p2p): CORE_SYNC_DATA type and command ID constants
Add CoreSyncData with MarshalSection/UnmarshalSection for portable
storage roundtrip. Re-export Levin command IDs for the CryptoNote
P2P protocol layer.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 19:34:12 +00:00