-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move ::WriteAttribute
validation inside Interaction Model Write Handling
#37322
Move ::WriteAttribute
validation inside Interaction Model Write Handling
#37322
Conversation
…he datamodel provider to perform the checks
…another small amount of flash
PR #37322: Size comparison from 8be890b to d6cb071 Full report (27 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, nrfconnect, qpg, stm32, telink, tizen)
|
PR #37322: Size comparison from 8be890b to 714e7bf Full report (56 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
PR #37322: Size comparison from 8be890b to d36e731 Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #37322: Size comparison from 8be890b to 61d7ac7 Full report (14 builds for cc13x4_26x4, cc32xx, nrfconnect, qpg, stm32, tizen)
|
PR #37322: Size comparison from 8be890b to b5d9035 Increases above 0.2%:
Full report (69 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #37322: Size comparison from 8be890b to ea2daaf Increases above 0.2%:
Full report (69 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
PR #37322: Size comparison from 8be890b to 1d34e06 Increases above 0.2%:
Full report (63 builds for cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
…ovider (#37345) * A first pass to add global attributes as part of IME instead of datamodel::provider * Some updates * Update some tests and reformat... the checks were PAINFUL,kept debug logs * Bump test: we now support the extra 3 global attributes not in metadata * More fixes * Fix compile error about parameter shadowing * More updates on casts to make xtensa compile happy * Restyled by clang-format * Fix tests * Make the test for unsupported write consistent with #37322 * Fix includes * Smaller delta * Attribute metadata is now guaranteed * Update src/app/data-model-provider/MetadataLookup.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/MetadataLookup.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Address some code review comments * Remove the ember metadata public cluster path validation as it is not needed anymore as a public API * Do not enforce ordering in attribute list encoding * Comment about items returned or not returned in various calls * Correct the unsupported attribute call * Restyle * Update order dependent test in java ... this is somewhat broken... * Fix indent * Fix include * Fix typo * Allow TODO comment: I am not willing to re-build the kotlin code right now for this PR * Using uint64_t for encoding saves some flash * Fix test ... although this is NOT ok as we need order independent test * Fix the real list now * Switch the basic information constraints as a set compare (use python) * Remove extra space * Restyled by prettier-yaml * Fix asserts in DGWIFI - wrong method used * Restyled by autopep8 * Update src/app/data-model-provider/Provider.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/ProviderMetadataTree.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/data-model-providers/codegen/CodegenDataModelProvider_Write.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/ProviderMetadataTree.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Undo DFWIFI changes, leave it up to #37382. * Update ordering of attribute list to match unsorted (and smaller) implementation in the SDK * Update src/app/GlobalAttributes.cpp Co-authored-by: Terence Hampson <thampson@google.com> * Update src/app/GlobalAttributes.h Co-authored-by: Terence Hampson <thampson@google.com> * Add comment about oddify in path validation * Added comments about why we do the casts ... it is ugly * Add integration test for writing read only attributes and getting the correct error * Restyled by isort * Fix unused imports --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> Co-authored-by: Terence Hampson <thampson@google.com>
PR #37322: Size comparison from a38f2aa to b0111d9 Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #37322: Size comparison from 8deebeb to 17dbfe0 Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
…ovider (project-chip#37345) * A first pass to add global attributes as part of IME instead of datamodel::provider * Some updates * Update some tests and reformat... the checks were PAINFUL,kept debug logs * Bump test: we now support the extra 3 global attributes not in metadata * More fixes * Fix compile error about parameter shadowing * More updates on casts to make xtensa compile happy * Restyled by clang-format * Fix tests * Make the test for unsupported write consistent with project-chip#37322 * Fix includes * Smaller delta * Attribute metadata is now guaranteed * Update src/app/data-model-provider/MetadataLookup.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/MetadataLookup.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Address some code review comments * Remove the ember metadata public cluster path validation as it is not needed anymore as a public API * Do not enforce ordering in attribute list encoding * Comment about items returned or not returned in various calls * Correct the unsupported attribute call * Restyle * Update order dependent test in java ... this is somewhat broken... * Fix indent * Fix include * Fix typo * Allow TODO comment: I am not willing to re-build the kotlin code right now for this PR * Using uint64_t for encoding saves some flash * Fix test ... although this is NOT ok as we need order independent test * Fix the real list now * Switch the basic information constraints as a set compare (use python) * Remove extra space * Restyled by prettier-yaml * Fix asserts in DGWIFI - wrong method used * Restyled by autopep8 * Update src/app/data-model-provider/Provider.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/ProviderMetadataTree.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/data-model-providers/codegen/CodegenDataModelProvider_Write.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/ProviderMetadataTree.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Undo DFWIFI changes, leave it up to project-chip#37382. * Update ordering of attribute list to match unsorted (and smaller) implementation in the SDK * Update src/app/GlobalAttributes.cpp Co-authored-by: Terence Hampson <thampson@google.com> * Update src/app/GlobalAttributes.h Co-authored-by: Terence Hampson <thampson@google.com> * Add comment about oddify in path validation * Added comments about why we do the casts ... it is ugly * Add integration test for writing read only attributes and getting the correct error * Restyled by isort * Fix unused imports --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> Co-authored-by: Terence Hampson <thampson@google.com>
…dling (project-chip#37322) * Move write validity inside the write handler rather than requesting the datamodel provider to perform the checks * Restyle * A bit of code cleanup and reuse, to minimize flash impact * Restyle * Drop the mPreviousSuccessPath, making objects smaller and saving yet another small amount of flash * Cleanup some includes * Restyle * Remove obsolete tests from codgen, as we do not do more validation now * Test write interaction passes * Test write passes * Slight clarity of code update * Fix comment * Manual check for last written saves 16 bytes of flash on QPG. * Status success is 2 bytes smaller in code generation than CHIP_NO_ERROR * Not using endpoint finder saves flash * Clean up code. We now save flash * More flash savings by reusing the server cluster finder * Update src/app/data-model-provider/MetadataLookup.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/MetadataLookup.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/Provider.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/data-model-provider/MetadataLookup.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Updated comment * Hoist "writing" log up in processing, to preserve similar functionality * Code clarity updates * Fix includes and update the code AGAIN because it does seem we use more flash * Fix unsupported write on global attributes * Fix includes * Update src/app/WriteHandler.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Post merge cleanup * Fix merge error --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Functionality from an external view should be unchanged. Internally, we now do not validate inside providers but rather use the metadata from the provider to validate things.
Fixes #36484
Changes
return spec error code of unsupported endpoint/cluster
so minimize flash usage overhead of this change.EndpointFinder
as it is not used anymore and the inline method of searching through endpoints results in smaller flash.At this point, at least on some devices we have a (very small) net flash win.
Testing