Skip to content

Conversation

@qiweiii
Copy link
Contributor

@qiweiii qiweiii commented Oct 27, 2025

No description provided.

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 pull request introduces significant refactoring related to the accumulation process, removing the separate on_transfer invocation and integrating its logic into accumulate. It also adds the concept of a registrar privileged service for creating services at specific indices. Several bugs are fixed, and concurrency conformance is improved. However, I found a critical issue in state key generation, a few typos, and have a suggestion for improving debug logs.


Suggestions that couldn't be attached to a specific line

Blockchain/Sources/Blockchain/VMInvocations/HostCall/HostCalls.swift:773, 775, 828, 830, 873, 875, 908-909, 911, 932, 935, 1021, 1023, 1050, 1052, 1102, 1105, 1159, 1161, 1203, 1206, 1256, 1259, 1319, 1321, 1341, 1343

There is a recurring typo in the class name. It should be AccumulateResultContext instead of AccumlateResultContext.


Blockchain/Sources/Blockchain/VMInvocations/Invocations/AccumulateInvocation.swift:56, 61

There is a typo in the class name. It should be AccumulateResultContext instead of AccumlateResultContext.


PolkaVM/Sources/PolkaVM/Engine.swift:104

The instruction name formatting for logging was removed. The previous implementation converted instruction names to uppercase snake_case (e.g., CmovNzImm became CMOV_NZ_IMM), which is arguably more readable in logs. Consider restoring the previous formatting for better debuggability:
return cleanName.replacingOccurrences(of: "([a-z])([A-Z])", with: "$1_$2", options: .regularExpression).uppercased()


PolkaVM/Sources/PolkaVM/Instructions/Instructions.swift:1706

The result of a signed remainder operation with a divisor of zero should be the dividend. The code now correctly writes a (the Int64 dividend) to the destination register. However, the type of the destination register is UInt64. You are writing a signed Int64 to it. It should be context.state.writeRegister(rd, UInt64(bitPattern: a)) to be explicit and safe.

@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

❌ Patch coverage is 75.19380% with 96 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.01%. Comparing base (f0b98fd) to head (2b9b7de).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...lockchain/Sources/Blockchain/State/StateTrie.swift 51.35% 36 Missing ⚠️
...ockchain/RuntimeProtocols/AccumulateFunction.swift 42.42% 19 Missing ⚠️
.../Blockchain/VMInvocations/HostCall/HostCalls.swift 72.72% 18 Missing ⚠️
PolkaVM/Sources/PolkaVM/Engine.swift 25.00% 6 Missing ⚠️
...ain/Sources/Blockchain/Config/ProtocolConfig.swift 28.57% 5 Missing ⚠️
...cations/InvocationContexts/AccumulateContext.swift 50.00% 4 Missing ⚠️
...ces/Blockchain/RuntimeProtocols/Accumulation.swift 97.05% 3 Missing ⚠️
...hain/Sources/Blockchain/Types/ServiceAccount.swift 66.66% 2 Missing ⚠️
...n/VMInvocations/Invocations/RefineInvocation.swift 0.00% 1 Missing ⚠️
...ces/Blockchain/Validator/GuaranteeingService.swift 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #370      +/-   ##
==========================================
- Coverage   81.93%   81.01%   -0.93%     
==========================================
  Files         381      379       -2     
  Lines       34012    25899    -8113     
==========================================
- Hits        27868    20981    -6887     
+ Misses       6144     4918    -1226     

☔ 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.

@qiweiii qiweiii merged commit 6242ba4 into master Oct 27, 2025
5 of 7 checks passed
@qiweiii qiweiii deleted the gp-0.7.1 branch October 27, 2025 23:06
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.

3 participants