-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
…k_wrapper_vk_hash (#2809) ## What ❔ We have a configuration field `recursion_scheduler_level_vk_hash` which actually stores `snark_wrapper_vk_hash` inside. It happened because an old config value was utilized for the new purpose some time ago. This PR changes the name of field in a non-breaking way: - `serde` (de)serialization happens with both `alias` and `rename(serialize = "..")`, so that we serialize the field the same way as before, but can deserialize either way. This is used for env configs and API. - `protobuf` deserialization is done by introducing a new field, and reading whatever one is available. - `protobuf` serialization always produced the _new_ field, so newly generated configs should have new field name. - ~~⚠️ DB column names was left as-is, because renaming DB columns is not a trivial process.~~ - Upd: Migration was added. It copies the old column to the new one and switches to the new one right away. ## Why ❔ Having incorrect name that doesn't represent the value stored is confusing and can lead to errors.
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
UPDATE protocol_patches SET recursion_scheduler_level_vk_hash = snark_wrapper_vk_hash WHERE recursion_scheduler_level_vk_hash = ''::bytea; | ||
ALTER TABLE protocol_patches DROP COLUMN snark_wrapper_vk_hash; | ||
ALTER TABLE protocol_patches ALTER COLUMN recursion_scheduler_level_vk_hash DROP DEFAULT; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ALTER TABLE protocol_patches ADD COLUMN snark_wrapper_vk_hash BYTEA NOT NULL DEFAULT ''::bytea; | ||
ALTER TABLE protocol_patches ALTER COLUMN recursion_scheduler_level_vk_hash SET DEFAULT ''::bytea; | ||
UPDATE protocol_patches SET snark_wrapper_vk_hash = recursion_scheduler_level_vk_hash; | ||
-- Default was only needed to migrate old rows, we don't want this field to be forgotten by accident after migration. | ||
ALTER TABLE protocol_patches ALTER COLUMN snark_wrapper_vk_hash DROP DEFAULT; | ||
|
||
-- Old column should be removed once the migration is on the mainnet. | ||
COMMENT ON COLUMN protocol_patches.recursion_scheduler_level_vk_hash IS 'This column is deprecated and will be removed in the future. Use snark_wrapper_vk_hash instead.'; |