Skip to content

Commit e2a9b13

Browse files
authored
Merge branch 'master' into rpc-test-invoke
2 parents 0a3567b + 51ecab1 commit e2a9b13

994 files changed

Lines changed: 73659 additions & 10638 deletions

File tree

Some content is hidden

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

.github/codeql/codeql-config.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Stellar Core CodeQL Config"
2+
3+
# Restrict CodeQL analysis to production code only.
4+
# See: https://docs.github.com/en/code-security/reference/code-scanning/workflow-configuration-options#specifying-directories-to-scan
5+
#
6+
# `paths` lists the directories that should be scanned. For compiled languages
7+
# (C/C++) `paths` is advisory: CodeQL still analyzes everything that gets built,
8+
# but `paths-ignore` is honored to filter results.
9+
10+
paths:
11+
- .github/workflows
12+
- src
13+
14+
paths-ignore:
15+
# Test directories and test data anywhere under src
16+
- src/**/test
17+
- src/**/testdata
18+
# Simulation is a non-production test/benchmarking subsystem
19+
- src/simulation
20+
# Generated XDR bindings
21+
- src/xdr
22+
# No skipping vendored / third-party libraries for now
23+
# - lib
24+
# Rust vendored soroban sources (tests + fuzz harnesses)
25+
- src/rust/soroban/**/fuzz
26+
# Build, tooling and docs
27+
- docker
28+
- docs
29+
- scripts
30+
- performance-eval
31+
- Builds
32+
- m4
33+
- target
34+
- test-lcm
35+
- test-tx-meta-baseline-current
36+
- test-tx-meta-baseline-next

.github/copilot-instructions.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ $ ./src/stellar-core test --ll fatal -r simple --abort --disable-dots "[tag]"
4848
$ NUM_PARTITIONS=$(nproc) STELLAR_CORE_TEST_PARAMS='--ll fatal -r simple --abort --disable-dots' make check
4949
```
5050

51+
When you make a protocol change
52+
(including `#ifdef`-gated vnext code) and add tests for that change, you MUST regenerate the captured
53+
`LedgerCloseMeta` golden data and commit the resulting `test-lcm/` changes.
54+
For vnext tests, configure with
55+
`--enable-next-protocol-version-unsafe-for-production` and rebuild first.
56+
57+
```sh
58+
# regenerate captured LedgerCloseMeta golden data, then commit test-lcm/
59+
$ ./src/stellar-core test --ll fatal -r simple --abort --disable-dots --rng-seed 12345 --capture-lcm "[tx]"
60+
```
61+
5162

5263
## Tools, subagents and skills
5364

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
if: steps.check-last-tested-commit.outputs.skip != 'true'
7777
# Prevent sudden announcement of a new advisory from failing ci:
7878
continue-on-error: true
79-
uses: EmbarkStudios/cargo-deny-action@8d73959fce1cdc8989f23fdf03bec6ae6a6576ef
79+
uses: EmbarkStudios/cargo-deny-action@91bf2b620e09e18d6eb78b92e7861937469acedb # v2.0.17
8080
with:
8181
command: check advisories
8282
# leave arguments empty so we don't test --all-features
@@ -85,7 +85,7 @@ jobs:
8585

8686
- name: Check cargo-deny bans licenses sources
8787
if: steps.check-last-tested-commit.outputs.skip != 'true'
88-
uses: EmbarkStudios/cargo-deny-action@8d73959fce1cdc8989f23fdf03bec6ae6a6576ef
88+
uses: EmbarkStudios/cargo-deny-action@91bf2b620e09e18d6eb78b92e7861937469acedb # v2.0.17
8989
with:
9090
command: check bans licenses sources
9191
# leave arguments empty so we don't test --all-features

.github/workflows/codeql.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CodeQL
2+
3+
on:
4+
schedule:
5+
# Run weekly on Monday at 06:00 UTC
6+
- cron: '0 6 * * 1'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
security-events: write
12+
actions: read
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
analyze:
20+
name: Analyze (${{ matrix.language }})
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 360
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- language: c-cpp
29+
build-mode: autobuild
30+
- language: rust
31+
build-mode: none
32+
- language: python
33+
build-mode: none
34+
- language: actions
35+
build-mode: none
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
with:
41+
submodules: recursive
42+
fetch-depth: 1
43+
44+
- name: Install build dependencies
45+
if: matrix.language == 'c-cpp'
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y \
49+
git build-essential pkg-config autoconf automake libtool \
50+
bison flex libpq-dev libunwind-dev parallel sed perl \
51+
postgresql ccache clang-format-12 libc++-dev libc++abi-dev
52+
53+
- name: Install Rust toolchain
54+
if: matrix.language == 'c-cpp' || matrix.language == 'rust'
55+
run: ./install-rust.sh
56+
57+
- name: Initialize CodeQL
58+
uses: github/codeql-action/init@v3
59+
with:
60+
languages: ${{ matrix.language }}
61+
build-mode: ${{ matrix.build-mode }}
62+
config-file: ./.github/codeql/codeql-config.yml
63+
64+
- name: Configure
65+
if: matrix.language == 'c-cpp'
66+
run: |
67+
./autogen.sh
68+
./configure --enable-ccache --enable-sdfprefs
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v3
72+
with:
73+
category: "/language:${{ matrix.language }}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ compile_commands.json
6666
/autom4te.cache
6767
/build
6868
/src/stellar-core
69+
/src/fuzz_*
6970
/buckets
7071
/compile
7172
/config.h

.gitmodules

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,10 @@
2323
path = lib/spdlog
2424
url = https://github.com/gabime/spdlog
2525
ignore = dirty
26-
[submodule "src/protocol-next/xdr"]
27-
path = src/protocol-next/xdr
28-
url = https://github.com/stellar/stellar-xdr
29-
branch = next
3026
[submodule "src/protocol-curr/xdr"]
3127
path = src/protocol-curr/xdr
3228
url = https://github.com/stellar/stellar-xdr
33-
branch = curr
29+
branch = main
3430
[submodule "src/rust/soroban/p21"]
3531
path = src/rust/soroban/p21
3632
url = https://github.com/stellar/rs-soroban-env
@@ -50,6 +46,9 @@
5046
[submodule "src/rust/soroban/p26"]
5147
path = src/rust/soroban/p26
5248
url = https://github.com/stellar/rs-soroban-env.git
49+
[submodule "src/rust/soroban/p27"]
50+
path = src/rust/soroban/p27
51+
url = https://github.com/stellar/rs-soroban-env.git
5352
[submodule "lib/gperftools"]
5453
path = lib/gperftools
5554
url = https://github.com/gperftools/gperftools.git

Builds/VisualStudio/build_rust.bat

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
set "project_dir=%~dp0..\.."
66
set "toolchain_file=%project_dir%\rust-toolchain.toml"
77
set "out_dir=%1\rust"
8-
set features=
8+
set "host_features="
9+
set "core_features="
910
set release_profile=
1011
set "set_linker_flags=cd ."
1112
if "%2"=="debug" set "set_linker_flags=(set CFLAGS=-MDd) & (set CXXFLAGS=-MDd)"
1213
if "%2"=="release" set "release_profile=--release"
13-
if "%3"=="next" set "features=--features next"
1414

1515
if not exist "%toolchain_file%" (
1616
echo Error: "%toolchain_file%" not found.
@@ -35,7 +35,15 @@ rem -- range to use for stable host envs
3535
set MIN_P=21
3636
set MAX_P=26
3737
rem -- version of the latest WIP protocol
38-
set LATEST_P=26
38+
set LATEST_P=27
39+
rem -- source host used to build the latest protocol. When this differs from
40+
rem -- LATEST_P, the latest build reuses an older host with --features next.
41+
set LATEST_HOST_P=27
42+
43+
if "%3"=="next" (
44+
set "core_features=--features next"
45+
if not "%LATEST_HOST_P%"=="%LATEST_P%" set "host_features=--features next"
46+
)
3947

4048
rem ---- Accumulators for final rustc link flags ----
4149
set "EXTERNS="
@@ -67,7 +75,7 @@ for /l %%P in (%MIN_P%,1,%MAX_P%) do (
6775

6876
rem -- Decide whether to skip building this protocol in the loop --
6977
set "skip_build="
70-
if defined features if %%P==%LATEST_P% set "skip_build=1"
78+
if "%3"=="next" if %%P==%LATEST_P% set "skip_build=1"
7179

7280
if not defined skip_build (
7381
if defined stamp_ok (
@@ -83,15 +91,16 @@ for /l %%P in (%MIN_P%,1,%MAX_P%) do (
8391
)
8492
)
8593

86-
if not defined skip_build (
87-
set "EXTERNS=!EXTERNS! --extern soroban_env_host_p%%P=%out_dir%\soroban-p%%P-target\%2\libsoroban_env_host.rlib"
88-
set "LPATHS=!LPATHS! -L dependency=%out_dir%\soroban-p%%P-target\%2\deps"
89-
)
94+
if not defined skip_build (
95+
set "EXTERNS=!EXTERNS! --extern soroban_env_host_p%%P=%out_dir%\soroban-p%%P-target\%2\libsoroban_env_host.rlib"
96+
set "LPATHS=!LPATHS! -L dependency=%out_dir%\soroban-p%%P-target\%2\deps"
97+
)
9098
)
9199

92-
rem ---- Build LATEST_P with features (only when "next" is passed) ----
93-
if defined features (
94-
set "latest_proto_dir=%project_dir%\src\rust\soroban\p%LATEST_P%"
100+
rem ---- Build LATEST_P for next builds. If LATEST_HOST_P differs from LATEST_P,
101+
rem ---- the latest build reuses that host source with --features next. ----
102+
if "%3"=="next" (
103+
set "latest_proto_dir=%project_dir%\src\rust\soroban\p%LATEST_HOST_P%"
95104
set "latest_proto_target=%out_dir%\soroban-p%LATEST_P%-target"
96105

97106
set "latest_rev="
@@ -109,8 +118,8 @@ if defined features (
109118
if defined latest_stamp_ok (
110119
echo p%LATEST_P% ^(latest^): up to date, skipping.
111120
) else (
112-
echo p%LATEST_P% ^(latest^): building soroban-env-host with %features%...
113-
%set_linker_flags% & pushd "!latest_proto_dir!" & (set RUSTFLAGS=-Cmetadata=p%LATEST_P%-!latest_rev:~0,12!) & cargo +%version% build %release_profile% --package soroban-env-host --locked %features% --target-dir "!latest_proto_target!" & popd
121+
echo p%LATEST_P% ^(latest^): building soroban-env-host with %host_features%...
122+
%set_linker_flags% & pushd "!latest_proto_dir!" & (set RUSTFLAGS=-Cmetadata=p%LATEST_P%-!latest_rev:~0,12!) & cargo +%version% build %release_profile% --package soroban-env-host --locked %host_features% --target-dir "!latest_proto_target!" & popd
114123
if errorlevel 1 exit /b 1
115124
if not "!latest_rev!"=="" (
116125
if not exist "!latest_proto_target!" mkdir "!latest_proto_target!"
@@ -147,7 +156,8 @@ rem Always invoke cargo here: cargo's own incremental-build tracking will
147156
rem no-op quickly when nothing changed, and the .soroban-revs file
148157
rem (tracked via build.rs) forces a rebuild when submodules change.
149158
echo Building stellar-core Rust library...
150-
%set_linker_flags% & cd /d "%project_dir%" & cargo +%version% rustc %release_profile% --package stellar-core --locked %features% --target-dir "%out_dir%\target" -- %EXTERNS% %LPATHS%
159+
echo Build command: cargo +%version% rustc %release_profile% --package stellar-core --locked %core_features% --target-dir "%out_dir%\target" -- %EXTERNS% %LPATHS%
160+
%set_linker_flags% & cd /d "%project_dir%" & cargo +%version% rustc %release_profile% --package stellar-core --locked %core_features% --target-dir "%out_dir%\target" -- %EXTERNS% %LPATHS%
151161

152162
endlocal
153163

0 commit comments

Comments
 (0)