mirror of
https://github.com/logos-co/logos-verified-proxy-module.git
synced 2026-08-27 04:51:08 +00:00
Grows the typed surface from 8 methods to 60: all 30 eth_* the library dispatches, plus the 30 op_* mirrors. Everything was already reachable through rpc(); what was missing was discoverability — `lm methods`, the LIDL contract, and a caller's type checker. Generated, not hand-written. Each wrapper is three lines over the same shared path, so sixty-one of them by hand is sixty-one chances to transpose an argument; the table is extracted from the library's OWN dispatch table (the `case $name` in c_frontend.nim), including each parameter's real type — which is how ethGetBlockByNumber gets a bool, ethFeeHistory a uint64 and a list, and eth_call an object rather than everything being a string. They are still committed as literal text: the module's code generator parses verified_proxy_impl.h as TEXT to build the LIDL contract, so anything hidden behind a macro would simply not exist to it. `--check` proves the committed blocks still match, and fails on a one-character edit (verified). eth_syncing is deliberately excluded from the typed surface — the runtime issues it as its own keep-alive and a wrapper would invite callers to fight it. Still reachable through rpc(). CI is new for this repo, which had none: build on Linux and macOS, unit tests (the check derivation runs the suite as part of building it), and the codegen drift check. Named explicitly rather than via `nix flake check`, which would also evaluate the x86_64-windows pseudo-system. Verified live on sepolia through a real logoscore daemon: ethGasPrice, ethMaxPriorityFeePerGas, ethBlobBaseFee, ethGetBlockTransactionCountByNumber, ethGetUncleCountByBlockNumber and ethGetBlockByNumber all answer. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
1.5 KiB
CMake
44 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(VerifiedProxyModuleTests LANGUAGES CXX)
|
|
|
|
include(LogosTest)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(MHD REQUIRED IMPORTED_TARGET libmicrohttpd)
|
|
pkg_check_modules(CURL REQUIRED IMPORTED_TARGET libcurl)
|
|
|
|
# Mirror the module build: inject the version from metadata.json.
|
|
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../metadata.json" _vp_metadata_json)
|
|
string(JSON VERIFIED_PROXY_MODULE_VERSION GET "${_vp_metadata_json}" version)
|
|
|
|
# Unit tests against a MOCKED libverifproxy.
|
|
#
|
|
# flake.nix sets tests.mockCLibs = [ "verifproxy" ], which stops the test
|
|
# derivation from even resolving the real external library — without it every
|
|
# CI test run would pay for the whole nimbus/Nim toolchain build.
|
|
logos_test(
|
|
NAME verified_proxy_module_tests
|
|
MODULE_SOURCES
|
|
../src/proxy_config.cpp
|
|
../src/proxy_runtime.cpp
|
|
../src/verified_proxy_impl.cpp
|
|
../src/verified_proxy_rpc.cpp
|
|
../src/rpc_http_server.cpp
|
|
../src/beacon_client.cpp
|
|
TEST_SOURCES
|
|
main.cpp
|
|
test_config_validation.cpp
|
|
test_proxy_runtime.cpp
|
|
test_rpc_http_server.cpp
|
|
test_beacon_client.cpp
|
|
verified_proxy_events_test.cpp
|
|
MOCK_C_SOURCES
|
|
mocks/mock_libverifproxy.cpp
|
|
EXTRA_INCLUDES
|
|
stubs
|
|
.
|
|
)
|
|
target_link_libraries(verified_proxy_module_tests PRIVATE PkgConfig::MHD PkgConfig::CURL)
|
|
target_compile_definitions(verified_proxy_module_tests PRIVATE
|
|
VERIFIED_PROXY_MODULE_VERSION="${VERIFIED_PROXY_MODULE_VERSION}")
|