Skip to content

Conversation

@qiweiii
Copy link
Contributor

@qiweiii qiweiii commented Sep 18, 2025

close #353

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes primarily focus on a significant rework of the State Trie implementation to align with the JAM specification, including changes to node structure, hashing, and storage format. This also involves adding branch collapsing logic for deletions and updating tests accordingly. A potential issue was found where a message size limit was removed in the fuzzing socket, which could lead to resource exhaustion.

@codecov
Copy link

codecov bot commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 96.60194% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.94%. Comparing base (cfe98d5) to head (ce3661c).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...kchain/Sources/Blockchain/State/StateBackend.swift 66.66% 3 Missing ⚠️
...ces/PolkaVM/Executors/JIT/ExecutorBackendJIT.swift 0.00% 3 Missing ⚠️
Fuzzing/Sources/Fuzzing/FuzzingSocket.swift 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #366      +/-   ##
==========================================
+ Coverage   81.64%   81.94%   +0.29%     
==========================================
  Files         381      381              
  Lines       33572    33707     +135     
==========================================
+ Hits        27410    27620     +210     
+ Misses       6162     6087      -75     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found potential compile-time error in JIT executor, a removed safety check that can cause memory issues in fuzzing socket, brittle test expectation logic in TraceTest, and backward-compatibility risks from enforcing a new 65-byte trie-node storage format without migration handling.


Suggestions that couldn't be attached to a specific line

PolkaVM/Sources/PolkaVM/Executors/JIT/ExecutorBackendJIT.swift:192

The use of nonisolated(unsafe) on a local variable is invalid and will not compile. Additionally, the @Sendable Task closure writes to asyncResult, which violates concurrency safety. Replace the local var with a boxed reference that is @unchecked Sendable and write through the box inside the Task. For example: replace nonisolated(unsafe) var asyncResult: ExecOutcome? with let resultBox = UncheckedSendableBox<ExecOutcome?>(nil) and in the Task set resultBox.value = await boxedCtx.value.dispatch(...). After semaphore.wait(), read guard let asyncResult = resultBox.value else { ... }.


PolkaVM/Sources/PolkaVM/Executors/JIT/ExecutorBackendJIT.swift:198

The Task { @Sendable in ... } closure captures and mutates a local variable across concurrency. After applying the boxed approach above, update the closure to write to resultBox.value to satisfy sendability and avoid data races.

@qiweiii
Copy link
Contributor Author

qiweiii commented Sep 18, 2025

benchmark can be ignored for this one, it cannot build on master with latest swift version

@qiweiii qiweiii marked this pull request as ready for review September 18, 2025 06:12
@qiweiii qiweiii merged commit c6507b6 into master Sep 18, 2025
12 of 20 checks passed
@qiweiii qiweiii deleted the 0.7.0-traces-3 branch September 18, 2025 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix state root calculation from state trie

3 participants