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

Use Sourcify database as default StorageService #1390

Merged
merged 16 commits into from
May 16, 2024

Conversation

marcocastignoli
Copy link
Member

@marcocastignoli marcocastignoli commented May 8, 2024

This PR closes #1380

With this PR, all server endpoints that previously fetched information from RepositoryV1 will now retrieve data from the database and RepositoryV2.

This PR also sets the database as the source of truth when checking the existence of a match.

Todo

"sources",
pathTranslationJSON[originalPath]
)
(obj: any) => obj.path === relativeFilePath
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to change this test because now a relative path is expected, not an absolute path

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know what to do with this test. Both Database and RepositoryV2 don't store path translations, so testing it like this really doesn't make sense. Should I implement a new test to check specifically the files stored on RepositoryV1 or I simply get rid of it?

From my pov RepositoryV1 is going to be removed soon, we just need to find a way to run repo.sourcify.dev with RepositoryV2 or Database. After we remove it, testing path translations is going to be useless.

@kuzdogan @manuelwedler feedback?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd say, in this case, don't make the extra effort for testing something that is going to 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.

Actually looking at this test again... If we want to keep path sanitization, then it makes sense to keep this test. But do we want to keep path sanitization for the database?

Copy link
Member

Choose a reason for hiding this comment

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

We can remove the path sanitization for the database but for the repoV2 this leaves me thinking if store the sources at path/to/the/source/with/many/folders/0xkeccak.sol or just sources/0xkeccak.sol because for the former there still can be weird characters in the path and we actually need to store in a standard path.

Copy link
Member Author

Choose a reason for hiding this comment

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

RepositoryV2 stores everything inside the first level of /sources

e.g.

/sources/0x11111.sol
/sources/0x11112.sol
...

Copy link
Member

Choose a reason for hiding this comment

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

Ok nice then it's not a problem and we can remove all the path sanitization related code + tests

Copy link
Member Author

Choose a reason for hiding this comment

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

We cannot remove "all the path sanitization related code" because it's still used in RepositoryV1, and right now RepositoryV1 is used in repo.sourcify.dev

Should this PR also make repo.sourcify.dev point to RepositoryV2 and remove RepositoryV1 completely?

Copy link
Member

Choose a reason for hiding this comment

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

Ok right... No let's not mix them both.

I've created a new issue to replace the repo.sourcify.dev completely and under that I've added the subtask to remove the path sanitization related code. #1398

With that we can dismiss this here and move on.

@marcocastignoli marcocastignoli marked this pull request as ready for review May 9, 2024 16:15
"sources",
pathTranslationJSON[originalPath]
)
(obj: any) => obj.path === relativeFilePath
Copy link
Member

Choose a reason for hiding this comment

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

We can remove the path sanitization for the database but for the repoV2 this leaves me thinking if store the sources at path/to/the/source/with/many/folders/0xkeccak.sol or just sources/0xkeccak.sol because for the former there still can be weird characters in the path and we actually need to store in a standard path.

Copy link
Member

@kuzdogan kuzdogan left a comment

Choose a reason for hiding this comment

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

Just added a comment about the path sanitization

@marcocastignoli marcocastignoli merged commit 62e216e into staging May 16, 2024
6 checks passed
@kuzdogan kuzdogan deleted the database-as-default-storage-service branch July 29, 2024 11:08
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.

Replace the Server endpoints with the DB
3 participants