Skip to content

Upgrade Vixen to 0.4.0 #25

Description

@kespinola

Context

In Vixen 0.4.0 we've removed the requirement to attach to a local set.

Goal

Update the the vixen version to 0.4.0 so can remove the use of local set.

    let local = tokio::task::LocalSet::new();

    let policy_store = PolicyStore::build()
        .config(config)
        .run(&local)
        .await?;

    local
        .run_until(async {
            // Retrieve the latest snapshot of validator policies
            let snapshot = policy_store.snapshot();

            // Define validator and policy pubkeys to check permission
            // Note: These are dummy pubkeys for demonstration purposes
            let validator = Pubkey::new_unique();
            let policy = Pubkey::new_unique();

            // Check if the validator is allowed by the policy
            match snapshot.is_allowed(&[policy], &validator) {
                Ok(true) => println!("Validator is allowed."),
                Ok(false) => println!("Validator is denied."),
                Err(e) => println!("Error checking policy: {:?}", e),
            }

            Ok(())
        })
        .await

Internally should use try_run_async()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions