Commit 30c2bb5
committed
Update to unified kth/0.78.0 Conan 2 package + modern CI
The standalone c-api/<ver>@kth/stable recipe was rolled into a single
unified `kth` package; this branch updates py-native to consume it,
modernizes the build pipeline, brings the C bindings up to date with
the C-API drift accumulated over the last ~4 years, and replaces the
deprecated CI workflow with a cibuildwheel-based one.
Build pipeline:
- conanfile.py: Conan 2 syntax (requirements()/generate()), pins
kth/0.78.0 with currency=BCH and db=dynamic, stages headers and
static libs from kth and ALL transitive deps into ./kth/.
- setup.py: drop dead Conan 1.x Conan.factory() path; shell out to
`conan install` instead. BuildExtCommand discovers staged libs at
build time and wraps them in -Wl,--start-group/--end-group so the
linker resolves circular deps regardless of glob order. C++23,
explicit -lstdc++. run_conan_install() also reads KTH_MARCH_ID and
KTH_CURRENCY from env (CLI flags still win) so CI can override.
- Move .sh helpers to scripts/, drop .bat, .travis/, .appveyor.yml,
AUTHORS, residual __init__.py.
C-API drift fixes (Python signatures changed accordingly β py-api
will need matching updates):
- block/header/transaction factory_from_data: drop `version` arg
- block/header serialized_size, header_to_data: drop `version` arg
- output_point_construct_from_hash_index: takes kth_hash_t const* now
- chain_script_construct -> chain_script_construct_from_bytes
- wallet_payment_address_encoded split into _legacy / _cashaddr
(with token_aware bool) / _token (the BCH-only ones gated by
KTH_CURRENCY_BCH)
- transaction_hash_sighash_type removed (no longer in C-API)
- node_get_chain -> node_chain
- node.cpp: explicitly include kth/capi/node_info.h (no longer
pulled in transitively by kth/capi.h)
Settings struct sync:
- DatabaseSettings: drop flush_writes/file_growth_rate/
index_start_height; add db_mode (kth_db_mode_t enum:
0=pruned, 1=normal, 2=full_indexed).
- BlockchainSettings: drop gauss_activation_time/
descartes_activation_time; add bch_gauss/bch_descartes/
bch_lobachevski/bch_galois bools and the new
leibniz_activation_time (2026) / cantor_activation_time (2027).
module.c quality pass:
- Replace 8 functions full of `int res2 = ...; res2 = ...; res2 =
...` (set-but-never-checked) with KTH_TRY_SETATTR macro that
Py_DECREFs the half-built object and returns NULL on the first
failure, propagating the Python exception correctly. The macro
name is provisional; flagged for the cleanup pass.
Tests:
- test_config.py rewritten with shared `_assert_common_*` helpers
(mainnet and testnet4 share ~80 asserts), named constants
(DB_MODE_NORMAL, LEIBNIZ_ACTIVATION_TIME, CANTOR_ACTIVATION_TIME),
loops over BIP/BCH flag families instead of 30 copy-pasted lines,
and `>=` bounds instead of exact-equality on things that grow
organically (checkpoint count, seed count). Covers the new
db_mode and bch_* fields, drops the removed gauss/descartes ones.
- test_node.py: rename node_get_chain -> node_chain.
All 3 tests pass against a real Knuth v0.78.0 node startup on
mainnet (32+32 threads, march_id=ZLm9Pjh).
CI (replaces the old knuth.yml):
- The old workflow was a Frankenstein of npm/node-pre-gyp/twine/
Docker-custom across three shells, pinned to ubuntu-20.04
(deprecated by GitHub) and node-pre-gyp paths that don't even
apply to a Python package. Replaced wholesale.
- New ci.yml: sdist job + cibuildwheel matrix on Linux x86_64
(manylinux container) and macOS arm64 (macos-latest is Apple
Silicon now). cp39-cp313, no PyPy, no musllinux, no 32-bit.
- Conan installed in CIBW_BEFORE_ALL, kth remote registered, and
CIBW_BEFORE_BUILD pre-installs the build deps so we can run pip
with --no-build-isolation (our setup.py shells out to `conan
install`).
- Smoke test inside each built wheel: `import kth_native` + pytest.
- publish job scaffolded for Trusted Publishing on tag pushes,
gated behind `if: false` until PyPI auth is wired up.
- KTH_MARCH_ID/KTH_CURRENCY pinned at workflow level so the build
flavor lives in exactly one place.
- Concurrency group cancels superseded PR runs to save minutes.
- Windows is intentionally out of this pass β the old workflow's
Windows path was 100% npm/node-gyp/node-pre-gyp and never built
a Python wheel in the first place. Add `windows-latest` later as
a follow-up once Linux/macOS is green.1 parent 0c71a98 commit 30c2bb5
34 files changed
Lines changed: 694 additions & 1405 deletions
File tree
- .github/workflows
- .travis
- examples
- include/kth/py-native
- chain
- config
- scripts
- src
- chain
- config
- tests
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
0 commit comments