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

update migrations #1520

Closed
wants to merge 5 commits into from
Closed

update migrations #1520

wants to merge 5 commits into from

Conversation

estebanmino
Copy link
Member

@estebanmino estebanmino commented Apr 25, 2024

Fixes BX-1443
Figma link (if any):

What changed (plus any additional context for devs)

new method migrate is working fine but we were using it wrongly together with version number for state slices

for rainbowChains we had version 7, with 6 migrations

migrate applies the migration functions one by one removing the ones from 0 to version (.toSliced(0,version)`) so if you were in version 6, all of the migrations would be removed since the migrations were 6, so none of the migrations were being executed

we have to have this in mind for the next time we use this method

I updated migrate to accept any arbitrary number of elements in an array param since it was annoying to add a new interface for each element in the array

Screen recordings / screenshots

What to test

Copy link

Here's the packed extension for this build:
rainbowbx-8c99c0d43c88f9db517c58d21000638ee505203c.zip

@estebanmino estebanmino marked this pull request as ready for review April 25, 2024 20:07
@estebanmino estebanmino requested review from greg-schrammel, DanielSinclair and derHowie and removed request for greg-schrammel April 25, 2024 20:07
Copy link

linear bot commented Apr 25, 2024

Copy link

Here's the packed extension for this build:
rainbowbx-4948a5ba330f878ca7e10aa64efbf053eaffeaad.zip

m6: (s: E) => F,
): R<F>;
// if you need more migrations, add more overloads here
<T>(migrations: ((s: any) => any)[]): R<T>;
Copy link
Contributor

Choose a reason for hiding this comment

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

this removes all the type safety 😔😔😔 don't think it's worth it

Copy link
Member Author

Choose a reason for hiding this comment

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

is there any other option for this? adding 15+ lines per new migration is not the best either

@@ -80,7 +80,7 @@ export const chainLabelMap: Record<
[ChainId.zora]: [ChainNameDisplay[zoraSepolia.id]],
[ChainId.avalanche]: [ChainNameDisplay[avalancheFuji.id]],
[ChainId.blast]: [ChainNameDisplay[chainBlastSepolia.id]],
[ChainId.degen]: [ChainNameDisplay[chainDegen.id]],
[ChainId.degen]: [],
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah

@greg-schrammel
Copy link
Contributor

so if you were in version 6, all of the migrations would be removed since the migrations were 6, so none of the migrations were being executed

yes this is the expected behavior

we can make the util throw if the version and quantity of migrations mismatches

@greg-schrammel
Copy link
Contributor

tried an idea here #1523

@estebanmino
Copy link
Member Author

closing for #1523

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants