carol-computer / carol

Programmable third party
12 stars 2 forks source link

Make capabilities the first argument to #[activate] methods #14

Closed LLFourn closed 1 year ago

LLFourn commented 1 year ago

So for example:

    #[activate]
    pub fn attest_to_price_at_minute(
        &self,
        cap: &(impl cap::Bls + cap::Http),
        time: OffsetDateTime,
        symbol: String,
    ) -> Result<AttestIndexPrice<bls::Signature>, String> {

you can see that the argument cap specifies that two capabilities (bls signature generation and http requests) required to activate the machine with method. This makes things much easier to evolve while keeping backwards compatibility and makes it easier to document and arrange the capabilities.