Skip to content

Commit 28dba3f

Browse files
authored
Merge branch 'master' into db_datastore_direct_range_as_of
2 parents ca74484 + 640908f commit 28dba3f

File tree

129 files changed

+2271
-1526
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+2271
-1526
lines changed

.github/actions/perf-common-steps/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ runs:
182182
run_perf mainnet eth_getTransactionByHash 5 stress_test_eth_getTransactionByHash_13M 1:1,100:30,1000:20,10000:20
183183
run_perf mainnet eth_getTransactionReceipt 5 stress_test_eth_getTransactionReceipt_14M 1:1,100:30,1000:20,5000:20,10000:20,20000:20
184184
run_perf mainnet eth_createAccessList 5 stress_test_eth_createAccessList_16M 1:1,100:30,1000:20,10000:20,20000:20
185+
run_perf mainnet debug_traceTransaction 5 stress_test_debug_trace_transaction_21M 1:1,100:30,1000:20,2000:20
185186
fi
186187
187188
if [ $failed_test -eq 0 ]; then

.github/workflows/execution-test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
description: 'Stage to stop at; none for all; sample values: "Execution", "IntermediateHashes", "HashState", "HistoryIndex"'
1111
required: false
1212
type: string
13+
clean_datadir:
14+
description: 'Remove datadir before running the test'
15+
type: boolean
16+
default: true
1317

1418
jobs:
1519
execution-test-suite:
@@ -33,6 +37,10 @@ jobs:
3337
- name: Clean Build Directory
3438
run: rm -rf ${{runner.workspace}}/silkworm/build
3539

40+
- name: Clean Database Directory
41+
if: ${{github.event.inputs.clean_datadir}}
42+
run: rm -rf ${{runner.workspace}}/silkworm_datadir
43+
3644
- name: Create Build Environment
3745
run: cmake -E make_directory ${{runner.workspace}}/silkworm/build
3846

@@ -55,7 +63,7 @@ jobs:
5563
run: |
5664
set +e # Disable exit on error
5765
58-
# Run Erigon, wait sync and check ability to maintain sync
66+
# Run Silkworm, wait until the end of historical execution and check the result
5967
python3 $ERIGON_QA_PATH/test_system/qa-tests/silkworm-execution/run_and_check_execution.py \
6068
${{runner.workspace}}/silkworm/build/cmd ${{runner.workspace}}/silkworm_datadir $TRACKING_TIME_SECONDS $TOTAL_TIME_SECONDS $CHAIN
6169

.github/workflows/rpc-integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Checkout RPC Tests Repository & Install Requirements
3434
run: |
3535
rm -rf ${{runner.workspace}}/rpc-tests
36-
git -c advice.detachedHead=false clone --depth 1 --branch v1.56.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
36+
git -c advice.detachedHead=false clone --depth 1 --branch v1.57.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
3737
cd ${{runner.workspace}}/rpc-tests
3838
pip3 install -r requirements.txt --break-system-packages
3939

cmake/compiler_settings.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,5 @@ else()
123123
add_link_options(-fsanitize=safe-stack)
124124
endif()
125125
endif()
126+
127+
add_compile_definitions(SILKWORM_CAPI_COMPONENT)

silkworm/capi/CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
include("${SILKWORM_MAIN_DIR}/cmake/common/targets.cmake")
55

6+
add_subdirectory(common)
7+
68
set(TARGET silkworm_capi)
79

810
find_package(Microsoft.GSL REQUIRED)
@@ -11,10 +13,11 @@ set(PUBLIC_LIBS "")
1113
set(PRIVATE_LIBS
1214
glaze::glaze
1315
Microsoft.GSL::GSL
16+
silkworm_capi_common
1417
silkworm_core
1518
silkworm_db
19+
silkworm_execution
1620
silkworm_sentry
17-
silkworm_node
1821
silkworm_rpcdaemon
1922
)
2023

@@ -47,4 +50,14 @@ set_target_properties(${TARGET} PROPERTIES LINK_OPTIONS "${LINK_OPTIONS}")
4750

4851
add_subdirectory(cli)
4952

50-
target_link_libraries(silkworm_capi_static_test PRIVATE silkworm_db_test_util silkworm_node)
53+
target_link_libraries(silkworm_capi_static_test PRIVATE silkworm_db_test_util)
54+
55+
# collect all public C headers into the same directory
56+
set(HEADERS_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/include")
57+
file(GLOB_RECURSE HEADERS "../capi/*.h" "../*/capi/*.h")
58+
add_custom_command(
59+
TARGET ${TARGET}
60+
POST_BUILD
61+
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory "${HEADERS_INSTALL_PATH}"
62+
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HEADERS} "${HEADERS_INSTALL_PATH}"
63+
)

silkworm/capi/cli/sample-go-client/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
// #cgo LDFLAGS: -lsilkworm_capi
44
// #cgo LDFLAGS: -L${SRCDIR}/../../../../build/silkworm/capi
55
// #cgo LDFLAGS: -Wl,-rpath ${SRCDIR}/../../../../build/silkworm/capi
6-
// #cgo CFLAGS: -I${SRCDIR}/../../../../silkworm/capi
6+
// #cgo CFLAGS: -I${SRCDIR}/../../../../build/silkworm/capi/include
77
/*
88
#include "silkworm.h"
99
#include <stdlib.h>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2025 The Silkworm Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
include("${SILKWORM_MAIN_DIR}/cmake/common/targets.cmake")
5+
6+
silkworm_library(silkworm_capi_common)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2025 The Silkworm Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <filesystem>
7+
8+
#include <silkworm/infra/common/log.hpp>
9+
#include <silkworm/infra/concurrency/context_pool_settings.hpp>
10+
11+
namespace silkworm::capi {
12+
13+
struct CommonComponent {
14+
silkworm::log::Settings log_settings;
15+
silkworm::concurrency::ContextPoolSettings context_pool_settings;
16+
std::filesystem::path data_dir_path;
17+
};
18+
19+
} // namespace silkworm::capi

silkworm/capi/common/errors.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2025 The Silkworm Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#ifndef SILKWORM_CAPI_ERRORS_H_
5+
#define SILKWORM_CAPI_ERRORS_H_
6+
7+
// Silkworm library error codes (SILKWORM_OK indicates no error, i.e. success)
8+
9+
#define SILKWORM_OK 0
10+
#define SILKWORM_INTERNAL_ERROR 1
11+
#define SILKWORM_UNKNOWN_ERROR 2
12+
#define SILKWORM_INVALID_HANDLE 3
13+
#define SILKWORM_INVALID_PATH 4
14+
#define SILKWORM_INVALID_SNAPSHOT 5
15+
#define SILKWORM_INVALID_MDBX_ENV 6
16+
#define SILKWORM_INVALID_BLOCK_RANGE 7
17+
#define SILKWORM_BLOCK_NOT_FOUND 8
18+
#define SILKWORM_UNKNOWN_CHAIN_ID 9
19+
#define SILKWORM_MDBX_ERROR 10
20+
#define SILKWORM_INVALID_BLOCK 11
21+
#define SILKWORM_DECODING_ERROR 12
22+
#define SILKWORM_TOO_MANY_INSTANCES 13
23+
#define SILKWORM_INVALID_SETTINGS 14
24+
#define SILKWORM_TERMINATION_SIGNAL 15
25+
#define SILKWORM_SERVICE_ALREADY_STARTED 16
26+
#define SILKWORM_INCOMPATIBLE_LIBMDBX 17
27+
#define SILKWORM_INVALID_MDBX_TXN 18
28+
29+
#endif // SILKWORM_CAPI_ERRORS_H_

silkworm/capi/common/instance.hpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2025 The Silkworm Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <memory>
7+
8+
#include "common_component.hpp"
9+
10+
namespace silkworm::db::capi {
11+
struct Component;
12+
}
13+
14+
namespace silkworm::rpc {
15+
class Daemon;
16+
}
17+
18+
namespace silkworm::sentry::capi {
19+
struct Component;
20+
}
21+
22+
namespace capi_todo {
23+
24+
struct SilkwormInstance {
25+
silkworm::capi::CommonComponent common;
26+
std::unique_ptr<silkworm::db::capi::Component> db;
27+
std::unique_ptr<silkworm::rpc::Daemon> rpcdaemon;
28+
std::unique_ptr<silkworm::sentry::capi::Component> sentry;
29+
30+
SilkwormInstance();
31+
~SilkwormInstance();
32+
};
33+
34+
} // namespace capi_todo

0 commit comments

Comments
 (0)