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

feat: add cli options for server configuration #487

Merged
merged 6 commits into from
Dec 16, 2024
Merged

Conversation

Romsters
Copy link
Contributor

What 💻

Added --allow-origin cli option;
Added --no-cors cli option;

Why ✋

Feature parity with anvil;

@Romsters Romsters requested a review from a team as a code owner December 11, 2024 00:51
Copy link
Contributor

@itegulov itegulov left a comment

Choose a reason for hiding this comment

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

LGTM, but is there an easy way to test this? At least manually but would be nice if we could do something in e2e tests.

SUPPORTED_APIS.md Outdated Show resolved Hide resolved
@Romsters
Copy link
Contributor Author

LGTM, but is there an easy way to test this? At least manually but would be nice if we could do something in e2e tests.

Added e2e tests

@@ -93,6 +101,66 @@ pub async fn init_testing_provider(
})
}

// Init testing provider which sends specified HTTP headers e.g. for authentication
// Outside of `TestingProvider` to avoid specifying `P`
Copy link
Member

Choose a reason for hiding this comment

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

Can we solve it by using Box<dyn FullZksyncProvider<T>> instead of template parameters?
Transport can also be erased by using Box<dyn Transport + Clone>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possibly, but we already have the default init_testing_provider function which I copied. Can be refactored though.

@@ -93,6 +101,66 @@ pub async fn init_testing_provider(
})
}

// Init testing provider which sends specified HTTP headers e.g. for authentication
// Outside of `TestingProvider` to avoid specifying `P`
pub async fn init_testing_provider_with_http_headers(
Copy link
Member

Choose a reason for hiding this comment

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

Also, isn't it possible to express the logic of adding headers as a fn add_headers(EraTestNode) -> EraTestNode, so that this method is not needed at all? Then you will be able to use init_testing_provider(add_headers) or smth.

Note that function is composable, so we can wrap any number of layers here, e.g. init_testing_provider(|node| f1(f2(node)))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because it's not the setting on the node, it's the setting on provider.

Copy link
Contributor Author

@Romsters Romsters Dec 13, 2024

Choose a reason for hiding this comment

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

We could extend the provider code of on_era_test_node_with_wallet_and_config fn or add another one on the alloy-zksync side, but didn't want to do that as not sure if it is useful for any other cases.

Copy link
Member

@popzxc popzxc left a comment

Choose a reason for hiding this comment

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

I think the tests indeed can be refactored, but it's not urgent

@Romsters Romsters merged commit 07ebfbc into main Dec 16, 2024
13 checks passed
@Romsters Romsters deleted the anvil-server-config branch December 16, 2024 09:23
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.

3 participants