fix(sdk): expose skipConditionValidation on uploadCDR and uploadFile#108
fix(sdk): expose skipConditionValidation on uploadCDR and uploadFile#108sophiej-story wants to merge 1 commit into
Conversation
|
The change is minimal and correct — One pre-existing issue that becomes more visible with this PR: in No high-confidence correctness or security bugs were found in the changed lines. Review iteration 1 · Commit b0817eb · 2026-05-22T04:17:22Z |
Why
Closes #50.
uploadCDR()anduploadFile()both callallocate()internally, which validates that the configured condition addresses implementcheckWriteCondition/checkReadCondition.allocate()already exposesskipConditionValidationto bypass that check — needed for the CDR contract'smsg.sender == conditionAddrshort-circuit (CDR.solwrite()line 174,read()line 217) when callers use a plain EOA / wallet address as the condition. The high-level wrappers didn't forward the flag, so the EOA-as-condition pattern wasn't reachable through them and would always throwInvalidConditionContractError.Change
packages/sdk/src/uploader.ts— add optionalskipConditionValidation?: booleantouploadCDR()anduploadFile()param types; forward to the internalallocate()call. JSDoc matches the existing comment onallocate().packages/sdk/__tests__/uploader.test.ts— two new tests foruploadCDR: pass-through with EOA addresses assertssimulateContractis not called and the run completes; default path with a non-ContractFunctionRevertedErrorcause throwsInvalidConditionContractErrorand no tx is sent.packages/sdk/__tests__/upload-file.test.ts— mirror tests foruploadFile, exercising the fullencryptFile → storage.upload → allocate → tdh2Encrypt → writepipeline so the skip assertion runs against a fully-completed call.docs/CONDITIONS.md— new "Bypassing Validation for EOA / Wallet-Address Conditions" subsection under "How Conditions Work", explaining the bypass and showing the flag onuploadCDR.No behavior change when the flag is omitted (default
false).Test plan