Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
… address Fixes genlayerlabs#430 by ensuring that contract deployments check for leader execution errors, decode error payloads (e.g., invalid_contract), and verify contract address presence before reporting success.
069dce1 to
d0b08de
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Fixes #430.
When deploying a contract that fails to load (e.g.
invalid_contract), consensus succeeds (consensus_data.status = 1 / FINALIZED), but execution fails (receipt.status = 5 / FINISHED_WITH_ERROR). Previously,genlayer deployonly checked consensus status before printing"Contract deployed successfully."and attempting to accessreceipt.contract_address, leading to misleading success output followed byTypeError: Cannot read properties of undefined (reading 'toLowerCase').In addition, base64-encoded execution error payloads from the VM leader (e.g.
AmludmFsaWRfY29udHJhY3Q=->invalid_contract) were not decoded, obscuring the root cause from the developer.Changes
extractExecutionErrorPayload(receipt)insrc/commands/contracts/execution.tsto decode base64 leader execution payloads and GenVM stderr into readable strings.assertSuccessfulExecution(receipt)to surface the decoded payload in the error message (e.g.,Execution did not finish successfully: FINISHED_WITH_ERROR (payload: invalid_contract)).normalizeExecutionResultto handleTIMEOUT(numeric 3) andNONDET_DISAGREE(numeric 4), avoidingundefinedreturns.src/commands/contracts/deploy.tsasserting thatreceipt.contract_addressis defined before stopping spinner with success message. If absent or execution failed, it throws a clear error.tests/actions/deploy.test.tscovering:invalid_contractpayload.Test plan
npx prettier --check "src/commands/contracts/execution.ts" "src/commands/contracts/deploy.ts" "tests/actions/deploy.test.ts": Passed (0 styling issues)npx vitest run tests/actions/deploy.test.ts: 32/32 tests passed (including both new regression tests)npx vitest run: 564/564 tests passed across the entire suitenpm run build: Production bundle (node scripts/run-esbuild.mjs production) compiled with 0 errorsSummary by CodeRabbit