Add invoke hostcall#944
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 57 minutes and 49 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR implements Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/jam/in-core/externalities/refine.test.ts (1)
352-430: Add explicit HOST/FAULT payload mapping tests.
machineInvokenow has dedicated mapping forStatus.HOST(hostCallIndex) andStatus.FAULT(address), but this suite currently validates onlyPANIC/OOGshape. Please add direct assertions for both payload branches to prevent regressions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/jam/in-core/externalities/refine.test.ts` around lines 352 - 430, Add two new test cases in the "machineInvoke" suite that invoke machineInvoke on a machine whose inner PVM returns Status.HOST and Status.FAULT respectively, and assert the mapped payload fields: for HOST assert result.isOk is true, result.ok.result.status === Status.HOST and that result.ok.result.payload.hostCallIndex equals the inner PVM's host call index; for FAULT assert result.ok.result.status === Status.FAULT and that result.ok.result.payload.address equals the inner PVM's fault address. Use the existing helpers (createExt, machineInit, machineInvoke, BytesBlob.blobFrom, MINIMAL_PROGRAM or a minimal program that triggers the desired inner status) and check result.ok.registers/gas as appropriate; reference machineInvoke, Status.HOST, Status.FAULT, hostCallIndex, and address when locating the assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/jam/in-core/externalities/refine.ts`:
- Around line 199-203: The branch handling Status.HOST and Status.FAULT
currently defaults exitParam to 0 when null; instead, in the function that sets
machineStatus (the block that checks status === Status.HOST / Status.FAULT and
calls tryAsU64), explicitly check the raw exitParam (from getExitParam() / the
local exitParam variable) for null and if null return a Result.error() (not
throw) describing the invariant violation; preserve use of tryAsU64 when
non-null and set machineStatus = { status, hostCallIndex: tryAsU64(exitParam) }
or { status, address: tryAsU64(exitParam) } respectively, and reference Status,
machineStatus, and tryAsU64 to locate the changes.
---
Nitpick comments:
In `@packages/jam/in-core/externalities/refine.test.ts`:
- Around line 352-430: Add two new test cases in the "machineInvoke" suite that
invoke machineInvoke on a machine whose inner PVM returns Status.HOST and
Status.FAULT respectively, and assert the mapped payload fields: for HOST assert
result.isOk is true, result.ok.result.status === Status.HOST and that
result.ok.result.payload.hostCallIndex equals the inner PVM's host call index;
for FAULT assert result.ok.result.status === Status.FAULT and that
result.ok.result.payload.address equals the inner PVM's fault address. Use the
existing helpers (createExt, machineInit, machineInvoke, BytesBlob.blobFrom,
MINIMAL_PROGRAM or a minimal program that triggers the desired inner status) and
check result.ok.registers/gas as appropriate; reference machineInvoke,
Status.HOST, Status.FAULT, hostCallIndex, and address when locating the
assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 64e99834-2bd3-458f-9eff-a822ce82859e
📒 Files selected for processing (2)
packages/jam/in-core/externalities/refine.test.tspackages/jam/in-core/externalities/refine.ts
View all
Benchmarks summary: 83/83 OK ✅ |
No description provided.