Skip to content

Conversation

@chirag-parmar
Copy link
Contributor

@chirag-parmar chirag-parmar commented Oct 6, 2025

This PR implements a C frontend for the verified proxy so that it can be used as a static library

Notes and Pointers for discussion:

  1. The async event loop of chronos is exported in a single threaded manner (processVerifProxyTasks) and must be called (or polled) regularly for efficient processing of the underlying async tasks. This means any busy waiting in the main loop of the application is forbidden (which is the case independent of this PR). This is a deliberate choice, since it is easier to develop multi-threaded logic in other languages/frameworks(ex: Go and Rust) where this library would be used rather than ship the library with the async event loop running on a different thread.
  2. Only the async tasks exported over the C API are tracked by the exported poll function (processVerifProxyTasks), any other async tasks dispatched independently will not be polled.
  3. Some of the logic in nimbus_verified_proxy.nim is abstracted/refactored out to be reused for the C frontend (verifproxy.nim). The PR also removes the stop procs from the LightClient to allow the C frontend to manually cancel the future associated with it.
  4. Since most parameters of the exported API are serialized strings (char *) docs are added to explain the encoding required for these strings.
  5. Example usage of the library can be found here: nimbus_verified_proxy/libverifproxy/example.c, the instructions for compiling are added to the README within that directory.

Meta: #3101
Experimentation: chirag-parmar/nim-playground@a877be0

@chirag-parmar chirag-parmar changed the title template code, builds with upnp error proxy: c-frontend Oct 6, 2025
@tersec
Copy link
Contributor

tersec commented Oct 6, 2025

Nimbus verified proxy CI / linux-amd64 (pull_request)

 /home/runner/work/nimbus-eth1/nimbus-eth1/vendor/nimbus-build-system/vendor/Nim/lib/system.nim: In function ‘_ZN6system5resetE3varIN10verifproxy7ContextEE’:
/home/runner/work/nimbus-eth1/nimbus-eth1/vendor/nimbus-build-system/vendor/Nim/lib/system.nim:941:74: error: ‘pthread_mutex_t’ has no member named ‘abi’
  941 |       obj = default(typeof(obj))

is due to:

Base automatically changed from proxy-frontend to master October 6, 2025 08:14
@chirag-parmar chirag-parmar force-pushed the c-frontend branch 4 times, most recently from 8aa9a38 to 7c0bb47 Compare October 24, 2025 12:15
@chirag-parmar chirag-parmar changed the base branch from master to proxy-rest-lc November 3, 2025 13:23
@chirag-parmar chirag-parmar force-pushed the c-frontend branch 2 times, most recently from 29d990c to 0937573 Compare November 4, 2025 07:34
@chirag-parmar chirag-parmar force-pushed the c-frontend branch 2 times, most recently from ea641f0 to 2645012 Compare November 5, 2025 10:02
@chirag-parmar chirag-parmar force-pushed the proxy-rest-lc branch 3 times, most recently from a91631d to d277ef9 Compare November 13, 2025 03:54
Base automatically changed from proxy-rest-lc to master November 15, 2025 06:31
@chirag-parmar chirag-parmar force-pushed the c-frontend branch 2 times, most recently from 92587c3 to bc09ffb Compare November 23, 2025 10:56
@chirag-parmar chirag-parmar requested a review from kdeme November 24, 2025 05:22
@chirag-parmar chirag-parmar marked this pull request as ready for review November 24, 2025 05:22
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