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

Server config by passing config files, remove create2 verification #1232

Merged
merged 6 commits into from
Dec 14, 2023

Conversation

kuzdogan
Copy link
Member

@kuzdogan kuzdogan commented Dec 13, 2023

This PR allows users to modify the default Sourcify server config by passing config files under services/server/config. The default config is set at default.js. Production and staging configs production.js and staging.js respectively (must set up NODE_ENV=production or staging). These only override the given fields in this config.

Similar to .env, it is possible to create a config/local.js file, which is ignored, to set up a local development environment.

Environment variables are still passed via .env, for which a template is given at .env.dev. However this PR removes the env vars that can be public config values. This means most of the public env vars are now configs, with the exception of the IPFS_GATEWAY which is used at the lib-sourcify to assemble a contract. This, in the future can be a config passed to the lib-sourcify constructor and a LibSourcify instance created by the server. For now this is left, and also the IPFS_API variable is kept to keep IPFS vars together.

.env vars

Moves to config:

REPOSITORY_PATH=
REPOSITORY_SERVER_URL=
SOLC_REPO=
SOLJSON_REPO=
SERVER_PORT=

Removes:

AUTH0_AUDIENCE=
AUTH0_ISSUERBASEURL=
AUTH0_TOKENSIGNINGALG=
AUTH0_CLIENTID=

## These are not in sourcify-chains-default-json
NODE_URL_MAINNET=
NODE_URL_GOERLI=
NODE_URL_SEPOLIA=

TESTING=
TAG=
DOCKER_HOST_SERVER_PORT=
DOCKER_HOST_SOLC_REPO=
DOCKER_HOST_SOLJSON_REPO=
DOCKER_HOST_REPOSITORY_PATH=

Create2

We wanted to remove the CREATE2 verification feature as it's not being used, spam prone (can spam by giving arbitrary salt), and the spam prevention compicates the code. While cleaning up .env and removing the AUTH0 I also decided to remove the CREATE2 related code.

Misc

  • Removes the docker-compose files for the server. The docker itself is pretty straightforward
  • Remove ForbiddenError and UnauthorizedError as these were used in create2 endpoint authenticaiton

TODO:

  • Update the env vars in sourcifyeth/infra
  • Update the docs

View in Huly HI-556

Copy link
Member

@marcocastignoli marcocastignoli left a comment

Choose a reason for hiding this comment

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

I spotted just these two minor issues, I think next step is to completely remove process.env from lib-sourcify and pass them as options (just like we did it with the logger for lib-sourcify)

services/server/src/server/services/services.ts Outdated Show resolved Hide resolved
services/server/README.md Outdated Show resolved Hide resolved
@kuzdogan
Copy link
Member Author

Addressed the issues, thanks.

I spotted just these two minor issues, I think next step is to completely remove process.env from lib-sourcify and pass them as options (just like we did it with the logger for lib-sourcify)

Do you mean as "next step" later or in this PR? Is it ready to go?

@marcocastignoli marcocastignoli self-requested a review December 14, 2023 09:51
Copy link
Member

@marcocastignoli marcocastignoli left a comment

Choose a reason for hiding this comment

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

For me it's ready to go, we'll work on the lib-sourcify optimization in another PR 👍

@kuzdogan kuzdogan merged commit 3830ad3 into staging Dec 14, 2023
3 of 4 checks passed
@kuzdogan kuzdogan deleted the server-config branch December 19, 2023 18:22
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.

2 participants