MetaMask / MetaMask/metamask-mobile

fix: remove unnecessary items from state logs export

Open
#13,373 0 comments 0 reactions 0 assignees View on GitHub
team-mobile-platform type-enhancement
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

### What is this about?

State logs export (see app/util/logs/index.ts) is currently >3MB.

Too big makes it hard to share as the Android sharing feature doesn't allow to save the file to device storage but only to send it using messaging. (see screenshot)

Purging the export from non user specific data could help having a reasonable export size.

Put the important app version and metrics at the top of the file to prevent them being truncated if the inline data is too big for the app we share with.

### Scenario

_No response_

### Design

_No response_

### Technical Details

in app/util/logs/index.ts
- remove unnecessary items from export:
- snaps source code (>130KB)
- list of tokens from TokenListController (>3MB)
- move [appVersion, buildNumber and metaMetricsId](https://github.com/MetaMask/metamask-mobile/blob/49e012144a86a3587dc57a7e0649bc850234736d/app/util/logs/index.ts#L72-L74) to the beginning of the exported log

### Threat Modeling Framework

_No response_

### Acceptance Criteria

- log size is under ~500KB
- state log export is purged of all non user specific data
- appVersion, buildNumber and metaMetricsId appear at the top of the log

### Stakeholder review needed before the work gets merged

- [x] Engineering (needed in most cases)
- [ ] Design
- [x] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

Contributor guide

Open the contributing guide

Research direction

Start in app/util/logs/index.ts and inspect how the state log export is assembled. Remove the snaps source code and TokenListController token list, then place appVersion, buildNumber, and metaMetricsId at the beginning. Done means the export is under about 500KB and contains no non-user-specific data.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.