trace host function refactor - #7920
Open
pwang200 wants to merge 1 commit into
Open
Conversation
pwang200
force-pushed
the
ripple/wasmi-host-functions-trace2
branch
from
July 30, 2026 19:39
21a8698 to
260dfc5
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| return returnResult(runtime, params, results, hf.trace(*msg, *data, *asHex != 0), index); | ||
| try | ||
| { | ||
| int index = 0; |
Contributor
There was a problem hiding this comment.
nit: Let's use one of the stdint types. I have seen this through this file.
| auto const msg = getDataString(runtime, params, index); | ||
| auto const data = getDataSlice(runtime, params, index); | ||
| auto const asHex = getDataInt32(runtime, params, index); | ||
| if (!msg || !data || !asHex || (*asHex != 0 && *asHex != 1) || |
Contributor
There was a problem hiding this comment.
Would it be anymore efficient to change the check to something like this:
auto const msg = getDataString(runtime, params, index);
if (!msg)
{
return nullptr;
}
auto const data = getDataSlice(runtime, params, index);
if (!data)
{
return nullptr;
}
// etc
This would apply to all functions in this file.
| try | ||
| { | ||
| int index = 0; | ||
| WasmRuntimeWrapper& runtime = hf.getRT(); |
Contributor
There was a problem hiding this comment.
nit: Maybe use auto here as well to maintain consistency with the rest of the function?
This would apply to all functions in this file.
| } | ||
| hf.trace(*msg, *data, *asHex != 0); | ||
| } | ||
| catch (std::exception const& e) |
Contributor
There was a problem hiding this comment.
Is catching std::exception enough? Is it ok for other exceptions to bubble across the boundary?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
High Level Overview of Change
The five
trace_*host functions now return nothing, charge a flat 30 gas instead of 500, and skip all work when the node's log level is belowTrace.This breaks the guest wasm ABI:
trace,trace_num,trace_acct,trace_xfloat, andtrace_amtchange from-> i32to no result. Fixtures are regenerated against a matchingxrpl-wasm-stdlibbranch; guests built against the old signatures will fail to instantiate.API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)The
HostFunctionsvirtuals ininclude/xrpl/tx/wasm/HostFunc.hchange return type and their base implementations become no-ops rather than returningUnimplemented.Future Tasks
The fixture
Cargo.tomlfiles pin a scratch stdlib branch (renames_error_code_trace) and should be repointed once the rename and trace changes land on stdlibmain, regenerating fixtures and re-verifying gas expectations.