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: use contract configs #731

Merged
merged 27 commits into from
Jul 26, 2024
Merged

Conversation

ChaoticTempest
Copy link
Member

This make use of contract configs in our node.

  • --override-config parameter for partial overrides over the config in the contract
  • we have less environment variables needed now, alongside less CLI arguments too

@ChaoticTempest ChaoticTempest requested review from volovyks and ppca July 25, 2024 09:52
@volovyks
Copy link
Collaborator

@ChaoticTempest I've fixed a conflict and contract tests, please, check the latest commits.
Part of the contract update test is commented. We are hitting transaction size.

@@ -404,7 +404,7 @@ async fn test_contract_propose_update() {
dbg!(contract.id());

test_propose_update_config(&contract, &accounts).await;
test_propose_update_contract(&contract, &accounts).await;
// _test_propose_update_contract(&contract, &accounts).await;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The contract is too big.

Copy link
Collaborator

@volovyks volovyks left a comment

Choose a reason for hiding this comment

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

LGTM!
Not sure what is going on with cargo check, it is all good on my machine and GCP VM.

chain-signatures/node/src/protocol/mod.rs Show resolved Hide resolved
Err(e) => {
tracing::error!("could not fetch contract's config: {e}");
tokio::time::sleep(Duration::from_secs(1)).await;
continue;
Copy link
Member

Choose a reason for hiding this comment

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

Is one second too frequent, config is not very frequently changed.

And above rpc_client::fetch_mpc_config.await blocks the main tokio thread, slow near rpc could slowdown protocol state handle(). I would suggest merge config with state call, doing it less frequently, or fetch it in a background tokio thread, without await, and run read from the fetched config written by the background thread, it could be 1s old but next MpcSign will get 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.

yeah 1s might be too frequent actually for configs that rarely if ever change. We can probably have a background task that fetches the config every 10 minutes or so as to not block this thread

Copy link
Member

@ailisp ailisp left a comment

Choose a reason for hiding this comment

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

Nice improvement! Although we didn't test the new config is applied in an integration test, I think the code looks right, config is refreshed and pass as function arguments instead of state to protocol modules, they'll always get latest config.

@volovyks
Copy link
Collaborator

@ChaoticTempest I'm merging this to avoid conflicts. Let's address all the comments in a follow-up PR.

@volovyks volovyks merged commit 5762932 into develop Jul 26, 2024
3 checks passed
@volovyks volovyks deleted the phuong/feat/use-contract-configs branch July 26, 2024 11:58
Copy link

Terraform Feature Environment Destroy (dev-731)

Terraform Initialization ⚙️success

Terraform Destroy success

Show Destroy Plan


No changes. No objects need to be destroyed.

Either you have not created any objects yet or the existing objects were
already deleted outside of Terraform.

Destroy complete! Resources: 0 destroyed.

Pusher: @volovyks, Action: pull_request, Working Directory: ``, Workflow: Terraform Feature Env (Destroy)

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