Files
nym/validator-api/src/coconut/comm.rs
T
Bogdan-Ștefan Neacşu d62e13c932 Feature/coconut double spend prev (#1457)
* Add spend credential endpoint to coconut bandwidth contract

* Store spent credentials support

* Add query endpoint for spent credentials

* Proposals allowed only from special (contract) address

* Include check for admin in tests

* Create proposal from CBC

* Refactor into coconut integration tests

* Create proposal with spend credential integration test

* Resolve mixnet warnings

* Refactor to re-enable build

* Call CBC from gateway and remove validator-api workaround

* Include migration for the first deployment of multisig

* Fix bug in proposal id parsing

* Remove more validator-api create proposal code

* Check for InProgress status of credential

* Check the proposed voucher value

* Unwrapping cosmos msg from gateway

* Improve error message

* More nit fixing

* Test getting validator api cosmos address endpoint

* Refactor to prepare for distributed comm channel

* Refactor coconut e2e test for reuse

* Verification of cred endpoint test

* Update CHANGELOG
2022-07-18 12:37:07 +03:00

30 lines
828 B
Rust

// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::coconut::error::Result;
use coconut_interface::VerificationKey;
use credentials::obtain_aggregate_verification_key;
use url::Url;
#[async_trait]
pub trait APICommunicationChannel {
async fn aggregated_verification_key(&self) -> Result<VerificationKey>;
}
pub struct QueryCommunicationChannel {
validator_apis: Vec<Url>,
}
impl QueryCommunicationChannel {
pub fn new(validator_apis: Vec<Url>) -> Self {
QueryCommunicationChannel { validator_apis }
}
}
#[async_trait]
impl APICommunicationChannel for QueryCommunicationChannel {
async fn aggregated_verification_key(&self) -> Result<VerificationKey> {
Ok(obtain_aggregate_verification_key(&self.validator_apis).await?)
}
}