hashable-integrable-macro #99

Open
CleverWild wants to merge 4 commits from hashable-integrable-macro into main
5 changed files with 13 additions and 27 deletions
Showing only changes of commit 11a2d8c8f3 - Show all commits

View File

@@ -214,15 +214,13 @@ mod tests {
};
use arbiter_crypto::safecell::{SafeCell, SafeCellHandle as _};
use super::{Error, Integrable, sign_entity, verify_entity};
#[derive(Clone, arbiter_macros::Hashable)]
use super::{Error, sign_entity, verify_entity};
#[derive(Clone, arbiter_macros::Hashable, arbiter_macros::Integrable)]
#[integrable(kind = "dummy_entity")]
struct DummyEntity {
payload_version: i32,
payload: Vec<u8>,
}
impl Integrable for DummyEntity {
const KIND: &'static str = "dummy_entity";
}
async fn bootstrapped_vault(db: &db::DatabasePool) -> ActorRef<Vault> {
let actor = Vault::spawn(

View File

@@ -1,6 +1,5 @@
use super::{DatabaseID, EvalContext, EvalViolation};
use crate::{
crypto::integrity::v1::Integrable,
db::models::{
EvmBasicGrant, EvmEtherTransferGrant, EvmEtherTransferGrantTarget, EvmEtherTransferLimit,
NewEvmEtherTransferLimit, SqliteTimestamp,
@@ -52,14 +51,12 @@ impl From<Meaning> for SpecificMeaning {
}
// A grant for ether transfers, which can be scoped to specific target addresses and volume limits
#[derive(Debug, Clone, arbiter_macros::Hashable)]
#[derive(Debug, Clone, arbiter_macros::Hashable, arbiter_macros::Integrable)]
#[integrable(kind = "EtherTransfer")]
pub struct Settings {
pub target: Vec<Address>,
pub limit: VolumeRateLimit,
}
impl Integrable for Settings {
const KIND: &'static str = "EtherTransfer";
}
impl From<Settings> for SpecificGrant {
fn from(val: Settings) -> Self {

View File

@@ -1,6 +1,5 @@
use super::{DatabaseID, EvalContext, EvalViolation};
use crate::{
crypto::integrity::Integrable,
db::models::{
EvmBasicGrant, EvmTokenTransferGrant, EvmTokenTransferVolumeLimit,
NewEvmTokenTransferGrant, NewEvmTokenTransferLog, NewEvmTokenTransferVolumeLimit,
@@ -63,15 +62,13 @@ impl From<Meaning> for SpecificMeaning {
}
// A grant for token transfers, which can be scoped to specific target addresses and volume limits
#[derive(Debug, Clone, arbiter_macros::Hashable)]
#[derive(Debug, Clone, arbiter_macros::Hashable, arbiter_macros::Integrable)]
#[integrable(kind = "TokenTransfer")]
pub struct Settings {
pub token_contract: Address,
pub target: Option<Address>,
pub volume_limits: Vec<VolumeRateLimit>,
}
impl Integrable for Settings {
const KIND: &'static str = "TokenTransfer";
}
impl From<Settings> for SpecificGrant {
fn from(val: Settings) -> Self {

View File

@@ -1,5 +1,5 @@
use crate::{
actors::GlobalActors, crypto::integrity::Integrable, db, peers::client::session::ClientSession,
actors::GlobalActors, db, peers::client::session::ClientSession,
};
use arbiter_crypto::authn;
use arbiter_macros::Hashable;
@@ -14,15 +14,12 @@ pub struct ClientProfile {
pub metadata: ClientMetadata,
}
#[derive(Hashable)]
#[derive(Hashable, arbiter_macros::Integrable)]
#[integrable(kind = "client_credentials")]
pub struct ClientCredentials {
pub pubkey: authn::PublicKey,
}
impl Integrable for ClientCredentials {
const KIND: &'static str = "client_credentials";
}
pub struct ClientConnection {
pub(crate) db: db::DatabasePool,
pub(crate) actors: GlobalActors,

View File

@@ -3,7 +3,7 @@ use crate::{
GlobalActors,
vault::{GetState, Vault},
},
crypto::integrity::{self, AttestationStatus, Integrable},
crypto::integrity::{self, AttestationStatus},
db::{DatabaseError, DatabasePool},
peers::client::ClientProfile,
};
@@ -23,16 +23,13 @@ pub mod auth;
pub mod session;
pub mod vault_gate;
#[derive(Debug, Clone, Hashable)]
#[derive(Debug, Clone, Hashable, arbiter_macros::Integrable)]
#[integrable(kind = "operator_credentials")]
pub struct Credentials {
pub id: i32,
pub pubkey: authn::PublicKey,
}
impl Integrable for Credentials {
const KIND: &'static str = "operator_credentials";
}
// Messages, sent by operator to connection client without having a request
#[derive(Debug)]
pub enum OutOfBand {