Skip to content
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

Abstraction of cache and context #4357

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

M1nd3r
Copy link
Contributor

@M1nd3r M1nd3r commented Nov 15, 2024

Abstraction of cache and context so that the current codec_v1 implementation can be switched for THP version.

Copy link

github-actions bot commented Nov 15, 2024

core UI changes device test click test persistence test
T2T1 Model T test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3B1 Safe 3 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3T1 Safe 5 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
All main(screens)

Copy link

github-actions bot commented Nov 15, 2024

legacy UI changes device test(screens) main(screens)

@M1nd3r M1nd3r force-pushed the M1nd3r/cache-and-context branch 2 times, most recently from dbaba59 to 9400f19 Compare November 15, 2024 20:54
@M1nd3r M1nd3r force-pushed the M1nd3r/cache-and-context branch 2 times, most recently from 545adf2 to 48f58b0 Compare November 15, 2024 20:58
@M1nd3r M1nd3r changed the title [draft] Codec cache and context abstraction [draft] Abstraction of context and codec cache Nov 15, 2024
@M1nd3r M1nd3r force-pushed the M1nd3r/cache-and-context branch 2 times, most recently from addd607 to 3411ee1 Compare November 15, 2024 22:12
@M1nd3r M1nd3r changed the title [draft] Abstraction of context and codec cache Abstraction of cache and context Nov 18, 2024
@@ -557,6 +557,7 @@ if FROZEN:
))

SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/*.py'))
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/codec/*.py'))
Copy link
Contributor Author

@M1nd3r M1nd3r Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codec specific files are separated so that they can be easily ommited for THP prod builds. When the THP implementation is added, it could look like this:

if THP:
   SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/thp/*.py'))
if not THP or PYOPT == '0':
   SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/wire/codec/*.py'))

Copy link
Contributor Author

@M1nd3r M1nd3r Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The condition or PYOPT == '0' is in the snippet because the codec will be used on DebugLink even with THP builds.

@M1nd3r M1nd3r marked this pull request as ready for review November 18, 2024 08:45
@M1nd3r M1nd3r requested a review from mmilata November 18, 2024 08:45
Copy link
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will continue tomorrow

core/tests/test_apps.bitcoin.keychain.py Show resolved Hide resolved
core/src/apps/common/authorization.py Show resolved Hide resolved
core/src/apps/common/backup.py Show resolved Hide resolved
@M1nd3r M1nd3r self-assigned this Nov 19, 2024
Copy link
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not found any major issue.

@matejcik can you please go through 8fe6fe5 real quick if you can spot anything that breaks the workflow restart/module unloading?

core/src/storage/cache_common.py Outdated Show resolved Hide resolved
core/src/storage/cache.py Outdated Show resolved Hide resolved
core/src/storage/cache_common.py Outdated Show resolved Hide resolved
core/src/storage/cache_common.py Outdated Show resolved Hide resolved
core/src/storage/cache_common.py Outdated Show resolved Hide resolved
core/src/trezor/wire/protocol_common.py Outdated Show resolved Hide resolved
core/src/trezor/wire/codec/codec_context.py Outdated Show resolved Hide resolved
core/src/trezor/wire/message_handler.py Outdated Show resolved Hide resolved
Filter = Callable[[int, Handler], Handler]

# If set to False protobuf messages marked with "experimental_message" option are rejected.
EXPERIMENTAL_ENABLED = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: shouldn't this also be somewhere under storage/cache to avoid being wiped by a restart?

core/tests/test_apps.bitcoin.keychain.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔎 Needs review
Development

Successfully merging this pull request may close these issues.

2 participants