-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve ephemeral account drift (#1403)
This PR proposes a series of small changes in an attempt to fix (or improve) the drift we see in production. I have not been able to reproduce (meaningful) negative drift in a test locally and found debugging it on production quite challenging because you want to caveman debug both sides ideally. The following changes definitely improve things, but we'll need to keep following it up. - [x] plug leaks where we weren't withdrawing money from the EA even though we paid for things like PT updates - [x] pessimistically withdraw money from the account in `DownloadSector` (host only refunds storage revenue on failure) - [x] sync newly created accounts (avoids funding already funded accounts) - [x] reset drift in production (fresh start allows for better follow up) I considered syncing the account balance when we fund an account. I went back and fourth on that several times but eventually removed it because it more or less makes `requiresSync` obsolete. The benefit though would be that you are certain the account has 1SC in it after you fund it, while at the same time keeping track of drift. So drift would still build up, but at the very least you have an account with 1SC and you never run into unexpected insufficient balance errors...
- Loading branch information
Showing
13 changed files
with
208 additions
and
143 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
1 change: 0 additions & 1 deletion
1
stores/sql/mysql/migrations/main/migration_00014_hosts_resolvedaddresses.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
ALTER TABLE hosts DROP COLUMN subnets; | ||
ALTER TABLE hosts ADD resolved_addresses varchar(255) NOT NULL DEFAULT ''; | ||
|
1 change: 1 addition & 0 deletions
1
stores/sql/mysql/migrations/main/migration_00015_reset_drift.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
UPDATE ephemeral_accounts SET drift = "0", clean_shutdown = 0, requires_sync = 1; |
1 change: 0 additions & 1 deletion
1
stores/sql/sqlite/migrations/main/migration_00014_hosts_resolvedaddresses.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
ALTER TABLE hosts DROP COLUMN subnets; | ||
ALTER TABLE hosts ADD resolved_addresses TEXT NOT NULL DEFAULT ''; | ||
|
1 change: 1 addition & 0 deletions
1
stores/sql/sqlite/migrations/main/migration_00015_reset_drift.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
UPDATE ephemeral_accounts SET drift = "0", clean_shutdown = 0, requires_sync = 1; |
Oops, something went wrong.