Repository navigation
wasm: refuse unknown fields on every Arca object - #32
Merged
GracedEternalKingCabbageMan merged 1 commit intoOct 3, 2026
Merged
Conversation
serde_wasm_bindgen reads a struct by asking the JavaScript object for each field the struct names, so a field it does not name is never seen and deny_unknown_fields has nothing to refuse. A misspelt bound in the verifier's policy (maxExitDelaySecond) was accepted and the bound took its default; a misspelt ceiling in signCsfs's limits (maxUncomitted) was ignored and the ceiling fell back to 0. Every Arca object is now read whole first, every key with it, and then into its type, where deny_unknown_fields applies at every level: the policy and its fee-rate floor, the limits, the message, its source, outputs and inputs. A source is read as a record or as the named form by whether it has `record`, so a stray field is named in the refusal rather than reported as matching no variant.
GracedEternalKingCabbageMan
deleted the
fix/wasm-arca-dto-unknown-fields
branch
October 3, 2026 12:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
serde_wasm_bindgenreads a struct by asking the JavaScript object for each field the struct names. A field the struct does not name is therefore never seen, anddeny_unknown_fieldshas nothing to refuse. Before this change:new ArkVerifier(network, { operator, maxExitDelaySecond: 172800 })was accepted, and the bound took its default. The new test fails withMissing expected exception.signCsfs(..., { maxUncomitted: '9999000' })ignored the misspelt field, so the ceiling fell back to 0. The signer refused for that reason instead:the committed outputs leave 9999000 atoms ... the ceiling is 0.Every Arca object is now read whole first, with all of its keys, and only then converted into its type, where
deny_unknown_fieldsapplies at every level. That covers the policy and its fee-rate floor, the limits, the message, and the message's source, outputs and inputs. A source is read as a record or in the named form depending on whether it hasrecord, so a stray field is named in the refusal instead of being reported as matching no variant.Tested, wasm
--dev --target nodejs:ark_records.jsrefusesunknown field \maxExitDelaySecond`and, insideminReserveFeeRate,unknown field `mutliple``.arca_signers.jsrefusesmaxUncomittedin the limits,saltsin a named source,leafIdbesiderecord,amountin an output,voutin an input,tmein an unroll andconnectorAssetin a release.ark_regtest(5 leaves accepted, 25 refused) and the signers'arca_regtest.py(Tests successful), whose objects all cross this boundary, pass.