Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jshooks [DO NOT MERGE] #318

Open
wants to merge 221 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
0bd65bb
quickjs running inside xahaud
RichardAH Apr 5, 2024
9ab33d5
more progress on jsvm
RichardAH Apr 22, 2024
71a6f9c
compiling
RichardAH Apr 22, 2024
54c00d0
bug fixes
RichardAH Apr 22, 2024
206773d
debug
RichardAH Apr 22, 2024
a2c3567
first js hookapi working (accept)
RichardAH Apr 23, 2024
80df3ad
hookjs rollback
RichardAH Apr 23, 2024
98d39db
otxnid, trace apis for js hooks
RichardAH Apr 30, 2024
f051b87
js util_raddr
RichardAH May 5, 2024
4e91d58
js util_accid
RichardAH May 5, 2024
7e12b46
js util_verify
RichardAH May 6, 2024
38a4b3c
js util_sha512h
RichardAH May 6, 2024
6954abd
bug fix, debugging print
RichardAH May 6, 2024
c3cf4b5
start of js util_keylet
RichardAH May 7, 2024
f913700
js util_keylet untested compiling
RichardAH May 9, 2024
ec7d603
js otxn_type
RichardAH May 9, 2024
40b9aa7
js otxn_param otxn_slot
RichardAH May 9, 2024
663910c
js otxn_field otxn_generation otxn_burden etxn_burden
RichardAH May 9, 2024
34a159b
js etxn_fee_base/details/reserve/generation/nonce hook_account
RichardAH May 9, 2024
7497d61
js hook_hash, hook_again, fee_base, ledger_seq, ledger_last_hash, led…
RichardAH May 10, 2024
8e172e1
js hook_param hook_param_set hook_skip hook_pos
RichardAH May 12, 2024
7b0bc67
js state, state_foreign, state_set, state_foreign_set, compiling unte…
RichardAH May 14, 2024
280ba7d
js slot slot_clear slot_count slot_set slot_size slot_subarray slot_s…
RichardAH May 16, 2024
842a038
enable js slot apis
RichardAH May 18, 2024
9e72931
fix quickjs build
dangell7 May 19, 2024
82e754d
Update quickjs.cmake
dangell7 May 19, 2024
a634318
js sto_validate sto_subfield sto_subarray sto_emplace sto_erase, comp…
RichardAH May 20, 2024
7cc395b
js float_set float_multiply float_mulratio float_negate float_compare…
RichardAH May 21, 2024
1f73557
js emit
RichardAH May 21, 2024
46308e3
js prepare otxn_json, compiling not tested
RichardAH May 21, 2024
6c3da46
js prepare/emit working
RichardAH May 21, 2024
59ecbd9
add hso w/ api version
dangell7 May 22, 2024
f4ffe4a
add set js hook tests
dangell7 May 22, 2024
5d61eea
clean up test code
dangell7 May 22, 2024
c4d0fc0
[fold] tmp use `hsov1`
dangell7 May 22, 2024
70bc2d3
more js hook tests
dangell7 May 22, 2024
71675c4
js slot_json sto_to_json sto_from_json meta_slot xpop_slot
RichardAH May 23, 2024
c9dcff9
fix js otxn_id hook_account bugs
RichardAH May 23, 2024
6973540
fix account type on js otxn_field
RichardAH May 24, 2024
033dedf
fix float_set
dangell7 May 24, 2024
13719a1
fix_float
dangell7 May 25, 2024
7567277
[fold] denis error
dangell7 May 25, 2024
b650d72
dump
dangell7 May 28, 2024
d1e5eb8
Revert "dump"
dangell7 May 28, 2024
bf99a1b
fix `sto_emplace`
dangell7 May 28, 2024
f5bb779
nit: reorder fields
dangell7 May 28, 2024
b340824
Merge pull request #326 from Xahau/dev
WietseWind May 29, 2024
52456a2
CI Split jobs with prev job dependency & CI on `jshooks` (#320) (#328)
WietseWind May 29, 2024
5254595
add tests
dangell7 May 30, 2024
2b111b7
Fix account_tx sluggishness as per https://github.com/XRPLF/rippled/c…
WietseWind May 30, 2024
bea1697
Fix JS float_int return JS instead of JSXFL
WietseWind May 30, 2024
6429ec6
cont. tests
dangell7 May 30, 2024
34d7435
cont. tests
dangell7 May 30, 2024
178fdba
remove dummy arg causes `INVALID_ARGUMENT` for keylets without args
dangell7 May 31, 2024
78280e4
fix `sto_subarray`
dangell7 Jun 3, 2024
e4c6add
make accept/rollback actually exit the jsvm
RichardAH Jul 4, 2024
f2becaf
remove promise, date and proxy from the jsvm
RichardAH Jul 4, 2024
f591290
first iteration of adding an instruction limit to jshooks
RichardAH Jul 8, 2024
f12b8cb
qjs modules, compiling not tested
RichardAH Jul 11, 2024
a983120
patch `state_foreign_set ` delete
dangell7 Jul 12, 2024
c662a8b
comment out debug
dangell7 Jul 12, 2024
5c7ec5f
more testing
dangell7 Jul 12, 2024
f96daa0
TextEncoder/Decoder working in jshooks
RichardAH Jul 15, 2024
9db9ad2
add error logging for qjs
RichardAH Jul 16, 2024
f35704c
add tests
dangell7 Jul 16, 2024
f829a79
better exit handling accept/rollback/exception/instruction limit
RichardAH Jul 17, 2024
c1610a6
fix v1 errors
dangell7 Jul 29, 2024
783bff7
add feature
dangell7 Jul 30, 2024
b13cab4
add proper error handling
dangell7 Jul 30, 2024
a498ebe
update tests
dangell7 Jul 30, 2024
c240c15
rename HooksV1 feature to JSHooks feature
RichardAH Aug 4, 2024
8cb2bbb
Workaround CentOS7 EOL
WietseWind Aug 17, 2024
9e7bee5
fix slot_float return
dangell7 Sep 19, 2024
ee21449
`float_sign` should be int not bigint
dangell7 Sep 19, 2024
f3118ef
fix return error
dangell7 Sep 19, 2024
db245d2
build for mac
dangell7 Oct 23, 2024
534870f
Merge branch 'dev' into jshooks
dangell7 Oct 23, 2024
39ec8fb
fix: build error `no type named 'Reader' in namespace 'Json'`
tequdev Oct 28, 2024
72e773c
fix: not to use `std::lexicographical_compare_three_way`
tequdev Oct 28, 2024
4f90178
[fold] preprocessor macros
dangell7 Nov 11, 2024
36d630b
Merge branch 'dev' into jshooks
RichardAH Nov 14, 2024
81413a5
Merge branch 'jshooks' into fix-jshooks-at-macos-build
RichardAH Dec 11, 2024
211e63c
Merge pull request #386 from tequdev/fix-jshooks-at-macos-build
RichardAH Dec 11, 2024
1bed7f1
fix jshooks build error (#410)
tequdev Dec 16, 2024
eec61f1
JSHooks Instruction Count (#423)
tequdev Jan 21, 2025
799a056
conan
dangell7 Feb 1, 2025
71884ad
sync
dangell7 Feb 1, 2025
2f6cf0a
[patch] remit transfer rate
dangell7 Feb 1, 2025
171610d
[release] add release build
dangell7 Feb 1, 2025
20ca066
[fold] update workflow
dangell7 Feb 2, 2025
56c0e0d
[fold] fix bad assert
dangell7 Feb 2, 2025
7162fe0
[fold] upgrade artifact@v4
dangell7 Feb 2, 2025
858ea1b
[fold] add external snappy
dangell7 Feb 2, 2025
7d8f5de
[fold] remove conan patch
dangell7 Feb 2, 2025
c27518b
[fold] use rippleci docker image
dangell7 Feb 2, 2025
bf33b6f
[fold] update conan
dangell7 Feb 2, 2025
fe43029
[fold] clang-format
dangell7 Feb 2, 2025
97a10d6
[fold] fix test
dangell7 Feb 4, 2025
b7acfb9
fix misc warnings
dangell7 Feb 4, 2025
cd45285
include optional
dangell7 Feb 4, 2025
4b93e16
fix macos github action
dangell7 Feb 4, 2025
26a66bc
fix misc warnings
dangell7 Feb 4, 2025
7c360ba
add optional include
dangell7 Feb 5, 2025
ee68cc2
clang-format
dangell7 Feb 5, 2025
9faef17
fix bad commit
dangell7 Feb 6, 2025
6858861
fix failing test
dangell7 Feb 7, 2025
680c609
Update macos.yml
dangell7 Feb 11, 2025
ecc7793
Merge branch 'dev' into tmp-conan
dangell7 Feb 11, 2025
802ea6c
[temp] remove negative rate test
dangell7 Feb 11, 2025
c0f55d0
Merge branch 'dev' into jshooks
dangell7 Feb 21, 2025
92be814
fix JSHooks tests (#446)
tequdev Feb 24, 2025
8b29fc5
Add bytecode validity check on SetHook (#439)
tequdev Feb 24, 2025
15515b8
fix sto_from_json error (#438)
tequdev Feb 24, 2025
d82f607
add replacer for Stringify bigint value (#437)
tequdev Feb 24, 2025
359ab70
Merge branch 'dev' into jshooks
dangell7 Feb 24, 2025
5502453
[fold] clang-format
dangell7 Feb 24, 2025
f868b4d
reorder free context
dangell7 Feb 24, 2025
ca04c2a
`float_sto_set` return bigint
dangell7 Feb 24, 2025
0440961
[fold] clang-format
dangell7 Feb 24, 2025
5cfe566
[fold] update test wasm
dangell7 Feb 24, 2025
f9e7fed
[revert] typo
dangell7 Feb 26, 2025
61f4505
feat(quickjs): add test_sto_emplace (#448)
sublimator Feb 27, 2025
6fdf788
Merge branch 'dev' into tmp-conan
dangell7 Feb 28, 2025
da5f1d1
Merge branch 'dev' into tmp-conan
dangell7 Mar 5, 2025
5ef3795
[fix] release build issue
dangell7 Mar 6, 2025
6aa1ff8
add tests for `float_sto`, `float_sto_set`, `float_sum` (#462)
tequdev Mar 12, 2025
eaa2cc9
[JSHooks] Add sto tests (#460)
tequdev Mar 12, 2025
4bfe27d
Enable JS Date on using parent ledger close time
tequdev Mar 17, 2025
fb7af36
Update jshooks header
sublimator Mar 18, 2025
d9659dc
Merge remote-tracking branch 'origin/dev' into jshooks
sublimator Mar 18, 2025
f3ee0dd
Fix validate exception handling #473
sublimator Mar 18, 2025
1b12b40
Add missing JS_FreeValue calls for early returns #468
sublimator Mar 18, 2025
fc50c0f
Free out array in slot before returning special case int64 #467
sublimator Mar 18, 2025
f97165e
Return DOESNT_EXIST in JSHooks sto_erase #463
sublimator Mar 18, 2025
1c4ebfe
Updated the jshook build script so that it works on macOS and Ubuntu …
tequdev Mar 18, 2025
e4a6aec
Bump numFeatures
sublimator Mar 18, 2025
fcf3848
Add tests for `fee_base`, `ledger_keylet`, `meta_slot` (#469)
tequdev Mar 18, 2025
752dbf3
Automatically add MacOS gsed/ggrep paths to PATH if exist
sublimator Mar 18, 2025
618a933
Add `xpop_slot` test (#476)
tequdev Mar 18, 2025
f9e7ea9
Test for NO_FREE_SLOTS
sublimator Mar 18, 2025
05bd9c6
Use official shell script
sublimator Mar 18, 2025
0726789
update conan to 1.86
dangell7 Mar 21, 2025
b73dd58
Merge branch 'dev' into tmp-conan
dangell7 Mar 21, 2025
8d7cc68
Merge remote-tracking branch 'origin/tmp-conan' into jshooks
sublimator Mar 23, 2025
2da58fe
[CONAN] Run MacOS builds on GH runners
sublimator Mar 24, 2025
1ba1887
[CONAN] Do not build cobalt
sublimator Mar 24, 2025
092a29c
[CONAN] Use self-hosted runner again
sublimator Mar 24, 2025
a203314
[CONAN] check clang --version
sublimator Mar 24, 2025
8ea35ac
[CONAN] remove DBOOST_ASIO_DISABLE_CONCEPTS define
sublimator Mar 24, 2025
2061d6d
[CONAN] clear cache
sublimator Mar 24, 2025
d370398
[CONAN] clear the tools.build:cxxflags
sublimator Mar 24, 2025
42a44d0
[CONAN] clear the tools.build:cxxflags
sublimator Mar 24, 2025
61135c0
[CONAN] clean up conf experiments
sublimator Mar 24, 2025
58e3840
remove `cxxflags` for macos action
dangell7 Mar 24, 2025
73c1748
[CONAN] simplify matrix
sublimator Mar 24, 2025
d9388e1
[CONAN] fix typo
sublimator Mar 24, 2025
7446ddd
[CONAN] simplify matrix
sublimator Mar 24, 2025
d7167a9
[CONAN] use macos-15
sublimator Mar 25, 2025
f6f87e4
[CONAN] use simpler GA runners with conan cache
sublimator Mar 25, 2025
8a5ccbf
[CONAN] use simpler GA runners with conan cache
sublimator Mar 25, 2025
e89aa05
[CONAN] use simpler GA runners with conan cache
sublimator Mar 25, 2025
2dd2264
[CONAN] use v4 -artifacts
sublimator Mar 25, 2025
167417b
[CONAN] remove redundant step
sublimator Mar 25, 2025
7468171
[CONAN] fix typo and redundant deps step
sublimator Mar 25, 2025
17dfca6
add Emit tests (#478)
tequdev Mar 25, 2025
043f1e9
[CONAN] install nproc
sublimator Mar 25, 2025
c25fd87
[CONAN] no access to 8 core runner
sublimator Mar 25, 2025
cfbfd76
[CONAN] manually handle cache saving step
sublimator Mar 25, 2025
5571827
Merge branch 'tequdev/jshooks-date' into jshooks
sublimator Mar 25, 2025
3593d67
[CONAN] manually handle cache saving step in MacOS
sublimator Mar 25, 2025
643cd9f
Mark header file as generated
sublimator Mar 25, 2025
314fb6c
[CONAN] cache build directory too
sublimator Mar 25, 2025
ec849e0
[CONAN] cache build directory too
sublimator Mar 25, 2025
eba913a
[CONAN] try using abs path
sublimator Mar 25, 2025
ca7533c
fix zero XFL (#481)
tequdev Mar 25, 2025
e8560c2
[CONAN] try using glob
sublimator Mar 25, 2025
40dc69d
[GA] conan mac os build
dangell7 Mar 25, 2025
17fdd09
[GA] update conan profile
dangell7 Mar 25, 2025
9178aa9
[GA] remove unused workflows
dangell7 Mar 25, 2025
15b679b
[CONAN] cache ccache folder
sublimator Mar 25, 2025
69b7728
[GA] tmp disable build cache
dangell7 Mar 25, 2025
9c26f1f
[GA] revert
dangell7 Mar 25, 2025
5365bbc
[CONAN] fix MacOS ccache folder
sublimator Mar 25, 2025
46d745b
[CONAN] include-hidden-folders: true
sublimator Mar 25, 2025
48919f0
[GA] Remove build caching
dangell7 Mar 25, 2025
9bd6d22
[CONAN] dummy tests for now
sublimator Mar 25, 2025
5d41688
[CONAN] fallback cache key with run_id
sublimator Mar 25, 2025
3d9423d
[CONAN] use dummy jobs
sublimator Mar 25, 2025
e9461c8
[CONAN] prime .ccache
sublimator Mar 25, 2025
942227f
[CONAN] stable fallback cache key
sublimator Mar 25, 2025
3f98c15
[CONAN] use step conclusion
sublimator Mar 25, 2025
19111a3
[CONAN] use always() and step conclusion
sublimator Mar 25, 2025
34b148b
[CONAN] better ccache keys
sublimator Mar 26, 2025
c53dcf1
feat: add RUN_TARGET_PATTERN macro with --unittest-arg regex
sublimator Mar 27, 2025
053a10a
[CONAN] clean up comments
sublimator Mar 27, 2025
c953ee3
[CONAN] Move caching steps into build/dependencies actions
sublimator Mar 28, 2025
5e255e5
[CONAN] Fix Claude's mess
sublimator Mar 28, 2025
a83a157
[CONAN] Remove straggling .build_deps mention
sublimator Mar 28, 2025
a9c096e
Add :log-test-names: target for --unittest-arg
sublimator Mar 28, 2025
c9f0fe0
[CONAN] Namespace xahau actions/workflows for easier upstream
sublimator Mar 28, 2025
486003f
[CONAN] Do not build on sh runner for PRs targeting dev
sublimator Mar 28, 2025
a8c80e9
[CONAN] GA only needs to declare push with ignore-branches
sublimator Mar 28, 2025
689740d
Use GA runners with conan/ccache caches (#482)
sublimator Mar 28, 2025
864734f
Update xahau-sh-build-in-docker.yml
dangell7 Mar 28, 2025
245cf4a
refactor checkpatterns remove comments
dangell7 Mar 28, 2025
5eac2d3
change `on` fields
dangell7 Mar 28, 2025
ed24374
fix checkpatterns
dangell7 Mar 28, 2025
9532ea7
tmp fix docker release builder
dangell7 Mar 28, 2025
2d9ac91
fix build dir
dangell7 Mar 28, 2025
ddbbe91
attempt fix builder
dangell7 Mar 28, 2025
9a90a7f
optional release builder
dangell7 Mar 28, 2025
cab4d63
revert some cmake builds
dangell7 Mar 28, 2025
a8e9448
revert docker dependency cache
dangell7 Mar 29, 2025
859dcbc
remove `EXIT_IF_CONTAINER_RUNNING`
dangell7 Mar 29, 2025
313ad71
test workflow
dangell7 Mar 29, 2025
95ab35a
Update release-builder.sh
dangell7 Mar 29, 2025
f8d22bb
add caching
dangell7 Mar 29, 2025
c27e2a9
Update xahau-sh-build-in-docker.yml
dangell7 Mar 29, 2025
8b0592c
Update xahau-sh-build-in-docker.yml
dangell7 Mar 29, 2025
0bf50c5
eof
dangell7 Mar 30, 2025
64441f7
Merge branch 'tmp-conan' into jshooks
dangell7 Mar 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
first js hookapi working (accept)
RichardAH committed May 24, 2024
commit a2c3567cafbdee558744f8766123691706f79336
57 changes: 50 additions & 7 deletions src/ripple/app/hook/Macro.h
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@
#define SEP_int32_t LPAREN int32_t COMMA
#define SEP_uint64_t LPAREN uint64_t COMMA
#define SEP_int64_t LPAREN int64_t COMMA
#define SEP_JSValue LPAREN JSValue COMMA

#define VAL_uint32_t WasmEdge_ValueGetI32(in[_stack++])
#define VAL_int32_t WasmEdge_ValueGetI32(in[_stack++])
@@ -88,7 +89,12 @@

#define WASM_VAL_TYPE(T, b) CAT2(TYP_, T)

#define DECLARE_HOOK_FUNCTION(R, F, ...) \
#define HALF_COUNT(...) \
HALF_COUNT_IMPL(__VA_ARGS__, 16, 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0)

#define HALF_COUNT_IMPL(_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, N, ...) N

#define DECLARE_WASM_FUNCTION(R, F, ...) \
R F(hook::HookContext& hookCtx, \
WasmEdge_CallingFrameContext const& frameCtx, \
__VA_ARGS__); \
@@ -102,7 +108,12 @@
extern WasmEdge_FunctionTypeContext* WasmFunctionType##F; \
extern WasmEdge_String WasmFunctionName##F;

#define DECLARE_HOOK_FUNCNARG(R, F) \
#define DECLARE_JS_FUNCTION(R, F, ...)\
extern JSValue JSFunction##F(JSContext *ctx, JSValueConst this_val,\
int argc, JSValueConst *argv);\
const int JSFunctionParamCount##F = HALF_COUNT(__VA_ARGS__);

#define DECLARE_WASM_FUNCNARG(R, F) \
R F(hook::HookContext& hookCtx, \
WasmEdge_CallingFrameContext const& frameCtx); \
extern WasmEdge_Result WasmFunction##F( \
@@ -112,8 +123,8 @@
WasmEdge_Value* out); \
extern WasmEdge_ValType WasmFunctionResult##F[]; \
extern WasmEdge_FunctionTypeContext* WasmFunctionType##F; \
extern WasmEdge_String WasmFunctionName##F;

extern WasmEdge_String WasmFunctionName##F;
#define DEFINE_WASM_FUNCTION(R, F, ...) \
WasmEdge_Result hook_api::WasmFunction##F( \
void* data_ptr, \
@@ -178,7 +189,39 @@
hook::HookContext& hookCtx, \
WasmEdge_CallingFrameContext const& frameCtx)

#define HOOK_SETUP() \
#define VAR_JSASSIGN(T, V) T& V = argv[_stack++]

#define DEFINE_JS_FUNCTION(R, F, ...)\
JSValue hook_api::JSFunction##F(JSContext *ctx, JSValueConst this_val,\
int argc, JSValueConst *argv)\
{\
int _stack = 0; \
FOR_VARS(VAR_JSASSIGN, 2, __VA_ARGS__);


#define JS_HOOK_SETUP()\
JSRuntime *rt = JS_GetRuntime(ctx);\
hook::HookContext& hookCtx = \
*reinterpret_cast<hook::HookContext*>(JS_GetRuntimeOpaque(rt));\
[[maybe_unused]] ApplyContext& applyCtx = hookCtx.applyCtx; \
[[maybe_unused]] auto& view = applyCtx.view(); \
[[maybe_unused]] auto j = applyCtx.app.journal("View"); \
try \
{


#define JS_HOOK_TEARDOWN() \
} \
catch (const std::exception& e) \
{ \
JLOG(hookCtx.applyCtx.app.journal("View").error()) \
<< "HookError[" << HC_ACC() << "]: (JS) " << __func__ \
<< " threw uncaught exception, what=" << e.what(); \
return JS_NewInt64(ctx, INTERNAL_ERROR); \
}}


#define WASM_HOOK_SETUP() \
try \
{ \
[[maybe_unused]] ApplyContext& applyCtx = hookCtx.applyCtx; \
@@ -194,12 +237,12 @@
if (!memoryCtx || !memory || !memory_length) \
return INTERNAL_ERROR;

#define HOOK_TEARDOWN() \
#define WASM_HOOK_TEARDOWN() \
} \
catch (const std::exception& e) \
{ \
JLOG(hookCtx.applyCtx.app.journal("View").error()) \
<< "HookError[" << HC_ACC() << "]: " << __func__ \
<< "HookError[" << HC_ACC() << "]: (WASM) " << __func__ \
<< " threw uncaught exception, what=" << e.what(); \
return INTERNAL_ERROR; \
}
Loading