Skip to content

Interface simplified#40

Merged
henriqueaklein merged 22 commits into
developfrom
fix_interface_sdk
Jul 8, 2026
Merged

Interface simplified#40
henriqueaklein merged 22 commits into
developfrom
fix_interface_sdk

Conversation

@henriqueaklein

Copy link
Copy Markdown
Contributor

Interface changed to externalize 3 methods

  • Init (auto-generates a wallet or loads a previously created default wallet)
  • InitWithEthKey (generates a geniusaccount from a private key)
  • InitWithMnemonic (generates a geniusAccount from a eth key that is generated by the mnemonic)

I removed the paramaters such as port, autodht and full node flags from the method and instead it's read from json files. Also removed the dependency of a dev_config.json file on the write directory, as all init files will need to pass the json of the dev_config on the init method, so people can't edit a file and change the payouts and whatnot.

- Strip autodht, process, baseport, is_full_node from all init signatures
- GeniusSDKInit now takes (base_path, dev_config)
- GeniusSDKInitWithKey now takes (base_path, dev_config, eth_private_key)
- GeniusSDKInitWithMnemonic now takes (base_path, dev_config, mnemonic)
- Remove GeniusSDKInitWithKeyAndDevConfig (D-08, INIT-04)
- Remove GeniusSDKInitMinimal (D-08, INIT-05)
- Update Doxygen @param tags: no reference to legacy params
- Remove SDKInitHelper template (D-03) — each function inlines its own logic
- Remove ReadDevConfigFromJSONStr and ReadDevConfigFromJSON wrappers
- Remove GeniusSDKInitWithKeyAndDevConfig and GeniusSDKInitMinimal (D-08)
- Add 3 inline init functions calling GeniusNode::New(config, AccountSource{variant})
  - GeniusSDKInit → NewAccount{} (INIT-01, IMPL-01, IMPL-02)
  - GeniusSDKInitWithKey → FromPrivateKey{key_copy} (INIT-02, IMPL-03, IMPL-06)
  - GeniusSDKInitWithMnemonic → FromMnemonic{mnemonic_copy} (INIT-03, IMPL-04, IMPL-06)
- D-05: null/empty dev_config returns nullptr with SPDLOG_ERROR
- D-06: key/mnemonic captured by value (std::string) before AccountSource
- D-09: static std::string ret_val with .assign() reset per function
- Zero references to NewFromPrivateKey, NewFromMnemonic, old multi-param New()
…rg init, ship config files

- Rewrite getSDKConfig() to accept only base_path and eth_private_key (strip autodht/process/baseport)
- Rewrite initSDK() to load dev_config.json from base_path and call GeniusSDKInitWithKey(base_path, dev_config, eth_private_key)
- Create example/network_config.json (port 40001, enable_dht: true)
- Create example/sgns_config.json (enable_processing: true, is_full_node: false)
- Update example/CMakeLists.txt to copy network_config.json and sgns_config.json to build output
…ice callers, ship service configs

- Rewrite SDKIdleExample.cpp: load dev_config.json, call GeniusSDKInitWithKey with 3 args (no legacy params)
- Rewrite service.cpp: accept only base_path CLI arg, load dev_config.json, call GeniusSDKInit with 2 args
- Strip parse_bool lambda, all autodht/process/baseport/is_full_node references
- Create services/network_config.json and services/sgns_config.json with same defaults as examples
- Document all 14 return sites (11 nullptr + 3 success) across 3 init functions
- Verify every failure path returns nullptr, every success path returns non-null string
- Confirm static ret_val with assign reset prevents cross-call accumulation
- Confirm key_copy/mnemonic_copy value capture preserves IMPL-06
- All 4 VER-01 checks (A/B/C/D) documented with line-number evidence
- VER-02: 5 grep scans confirm zero references to NewFromPrivateKey, NewFromMnemonic,
  GeniusSDKInitWithKeyAndDevConfig, GeniusSDKInitMinimal, autodht, baseport, is_full_node
- VER-02: All 3 GeniusNode::New calls use the unified 2-arg AccountSource signature
- VER-03: All 8 @param tags across 3 init functions match their signatures exactly
- VER-03: No stale parameter references in any Doxygen block
- Summary table: 12/12 checks passed
- STATE.md reflects Phase 1 completion (completed_phases=1, completed_plans=3)
- Current Position updated: Phase 2 of 2, Status: Verified
- Progress bar: 100%, all 3 VER requirements pass (12/12 checks)
- Session continuity updated to 2026-07-06
- Verification report: all 3 init functions preserve return contract, zero dead
  references, accurate Doxygen documentation
@henriqueaklein henriqueaklein merged commit 14c3b44 into develop Jul 8, 2026
16 of 30 checks passed
@henriqueaklein henriqueaklein deleted the fix_interface_sdk branch July 8, 2026 16:54
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.

2 participants