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

cli: Fix custom provider.cluster #3428

Merged

Conversation

acheroncrypto
Copy link
Collaborator

Problem

provider.cluster serialization is not compatible with its deserialization.

This is because in #2271, a custom deserialization function was implemented to support custom endpoints (as mentioned in #673 (comment)):

anchor/cli/src/config.rs

Lines 593 to 594 in 2ae3774

#[serde(deserialize_with = "des_cluster")]
cluster: Cluster,

but there was no custom serialization implementation that was compatible with the new deserialization. Thus, setting provider.cluster to a custom value:

[provider]
cluster = "https://anchor.solana/path"

results in:

Workspace configuration error: Unable to deserialize config: TOML parse error at line 15, column 11
   |
15 | cluster = ["https://anchor.solana/path", "wss://anchor.solana/path"]
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
invalid type: sequence, expected string or map

when a command, e.g. anchor keys sync, serializes Anchor.toml, as also mentioned in issues such as #3388 and #3222.

Summary of changes

Fix using a custom endpoint in provider.cluster by:

  • Implementing a custom serialization function for Cluster.
  • Overriding the default serialization of provider.cluster with the new function.

Fixes #3222

Copy link

vercel bot commented Dec 13, 2024

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added cli fix Bug fix PR labels Dec 13, 2024
@acheroncrypto acheroncrypto merged commit 135d7e0 into coral-xyz:master Dec 14, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli fix Bug fix PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An error occurred when updating program id using anchor keys sync
1 participant