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

Only write options after onboarding #284

Merged
merged 2 commits into from May 14, 2024

Conversation

johnny9
Copy link
Contributor

@johnny9 johnny9 commented Mar 9, 2023

Windows
Intel macOS
Apple Silicon macOS
ARM64 Android

@johnny9 johnny9 marked this pull request as ready for review March 9, 2023 12:46
@hebasto hebasto added the UX Designers' opinions are required label Apr 17, 2023
@jarolrod jarolrod added this to the v1.0 milestone May 29, 2023
@hebasto
Copy link
Member

hebasto commented May 30, 2023

Needs rebase.

@johnny9
Copy link
Contributor Author

johnny9 commented May 31, 2023

update from 45e3262 to 08be85b:

  • rebased over main

@thebagmaster
Copy link

thebagmaster commented Jun 4, 2023

ACK 08be85b
I tested these on Ubuntu 22.04.2 and it does what it says on the tin.
Understood that we may need to buffer the settings writing to file in on-boarding; especially if the storage location is not set and may change.
Maybe we should do our best to save what we can of what the user configured?
Are there situations where we buffer settings and different settings that we save immediately?

@hebasto hebasto modified the milestones: v1.0, v1.1 Jun 6, 2023
@hebasto
Copy link
Member

hebasto commented Aug 31, 2023

@johnny9
Copy link
Contributor Author

johnny9 commented Sep 1, 2023

Update from 08be85b to 51df97d

  • rebased with main

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

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

Concept ACK

@@ -15,8 +15,9 @@

#include <cassert>

OptionsQmlModel::OptionsQmlModel(interfaces::Node& node)
OptionsQmlModel::OptionsQmlModel(interfaces::Node& node, bool is_onboarded)
Copy link
Member

Choose a reason for hiding this comment

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

potentially, a bool indicating if we're onboarded or not could be valuable to other models. Since right now we don't have such a use case, this is fine.

@D33r-Gee
Copy link
Contributor

tACK on WSL Ubuntu 22.04 on signet

Works as expected, the settings file gets created after the onboarding has finished.

settings.json:

{ "listen": true, "natpmp": true, "prune": 2861 }

Do we want the “Listen” and “natpmp” options to be true by default or was it just for testing this PR?

@D33r-Gee
Copy link
Contributor

tACK on Android armv7 everything worked as expected

The settings.json was created after the onboarding with the following values:

{ "prune": 2861 }

Copy link
Contributor

@D33r-Gee D33r-Gee left a comment

Choose a reason for hiding this comment

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

ACK 51df97d

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

Concept ACK, I'll test soon. It looks that there are some unaddressed feedback.

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

tACK 51df97d

Tested in both master(/ main) and this PRs branch: changing all settings touched by this branch's code change and verify the changes were saved accordingly.

Things I noticed during testing:

In main:

  • If the user doesn't change anything setting.json file will look like:
{
    "prune": 1907
}
  • If the user disables any settings setting.json file will look like:
{
    "prune": 0
    "listen": false,
    "natpmp": false,
    "server": false,
    "upnp": false

}

In branch johnny9:write_after_onboard:

  • If the user doesn't change anything setting.json file will look like:
{
    "dbcache": 16000,
    "listen": true,
    "natpmp": true,
    "prune": 1907,
    "server": true,
    "upnp": true
}
  • If the user disables any settings setting.json file will look like:
{
    "dbcache": 16000,
}
After the user makes any changes on the settings mentioned above next time the user starts `bitcoin-qt` up again it looks like the UI doesn't match the configuration file (`settings.json`), is this expected?
  • Using main:

Screenshot from 2024-03-12 15-55-36

  • Using this branch:

Screenshot from 2024-03-12 16-03-51

@johnny9
Copy link
Contributor Author

johnny9 commented Mar 29, 2024

Update 51df97d to 61f8e6c

  • Rebased with master
  • Initialized all uninitialized OptionsQmlModel properties

@johnny9
Copy link
Contributor Author

johnny9 commented Mar 29, 2024

In branch johnny9:write_after_onboard:

  • If the user doesn't change anything setting.json file will look like:
{
    "dbcache": 16000,
    "listen": true,
    "natpmp": true,
    "prune": 1907,
    "server": true,
    "upnp": true
}
  • If the user disables any settings setting.json file will look like:
{
    "dbcache": 16000,
}

After the user makes any changes on the settings mentioned above next time the user starts bitcoin-qt up again it looks like the UI doesn't match the configuration file (settings.json), is this expected?

@pablomartin4btc I wasn't able to reproduce the output you were seeing during onboarding but I think I fixed the settings not applying at next startup with initializing the values in the constructor.

@D33r-Gee
Copy link
Contributor

tACK 61f8e6c

On Ubuntu 22.04 and Android (armv7)

Works as expected, settings.json shows defaults:

{
    "listen": true,
    "prune": 1907
}

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

tACK 61f8e6c

It behaves as expected.

dbcache setting is not persisted anymore ("dbcache": 16000,), is this correct?

@johnny9
Copy link
Contributor Author

johnny9 commented Apr 5, 2024

dbcache setting is not persisted anymore ("dbcache": 16000,), is this correct?

It should only persist if you set it to a value other than nDefaultDbCache (450)

@pablomartin4btc
Copy link
Contributor

dbcache setting is not persisted anymore ("dbcache": 16000,), is this correct?

It should only persist if you set it to a value other than nDefaultDbCache (450)

Perfect, it works.

@johnny9
Copy link
Contributor Author

johnny9 commented Apr 10, 2024

Update from 61f8e6c to 4f557b0

  • rebased with main

@johnny9
Copy link
Contributor Author

johnny9 commented Apr 10, 2024

Update from 4f557b0 to 9e56907

  • fixed build issue with previous rebase conflict (forgot to remove <<<<<<<)

Copy link
Contributor

@D33r-Gee D33r-Gee left a comment

Choose a reason for hiding this comment

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

tACK 9e56907

lgtm, works as expected on both Ubuntu 22.04 and Android (armv7)

played around with different settings and they registered properly both in the settings.json and in the debug.log

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

re-ACK 9e56907

Copy link
Contributor

@MarnixCroes MarnixCroes left a comment

Choose a reason for hiding this comment

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

9e56907
writing of the settings works, but it always additionally creates a settings.json.bak file?

@@ -8,6 +8,7 @@
#include <common/settings.h>
#include <common/system.h>
#include <interfaces/node.h>
#include <mapport.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this?

Suggested change
#include <qt/optionsmodel.h>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is needed for PruneMiBtoGB i believe

}
m_onboarded = true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: accidentally removed the last line break?

Suggested change
}
}

Copy link
Contributor Author

@johnny9 johnny9 May 8, 2024

Choose a reason for hiding this comment

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

already has a newline character at the end of the file. don't need an additional blank line.

@johnny9 johnny9 requested a review from jarolrod May 8, 2024 14:12
Copy link
Contributor

@D33r-Gee D33r-Gee left a comment

Choose a reason for hiding this comment

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

re ACK 9e56907 on Ubuntu 22.04 works as expected

@hebasto hebasto merged commit 84d388d into bitcoin-core:main May 14, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UX Designers' opinions are required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants