Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

release/0.2.2 #140

Merged
merged 38 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
220cfc1
feat: refactor proof handling to support multiple instances
RomarQ Aug 8, 2023
0fe3131
feat: support ethereum to acurast communication
RomarQ Aug 10, 2023
171b503
feat(hyperdrive): Add tests
RomarQ Aug 11, 2023
591b162
feat(hyperdrive): Split ethereum proof validation error
RomarQ Aug 11, 2023
62a7e31
feat(hyperdrive-outgoing): add support for evm messages
RomarQ Aug 18, 2023
f347f82
feature(hyperdrive-outgoing): make API instance agnostic
RomarQ Aug 18, 2023
21c2a7c
feat(hyperdrive-evm): Fix storage proof validation and properly handl…
RomarQ Sep 3, 2023
b24c712
Merge pull request #121 from Acurast/release/0.2.1
RomarQ Sep 12, 2023
35c38f0
Merge pull request #118 from Acurast/feat/evm-ibc-support
RomarQ Sep 14, 2023
43e97f3
chore: test job registration with multiple slots and remove Display t…
RomarQ Sep 18, 2023
e76042c
Merge pull request #123 from Acurast/chore/misc
RomarQ Sep 18, 2023
f446199
feat: allow job deregistration when the job was already matched
RomarQ Sep 6, 2023
8ac9068
feat: allow job deregistration when the job was already assigned
RomarQ Sep 6, 2023
dc5457a
fix: do not clear StoredStorageCapacity and properly calculate the pr…
RomarQ Sep 14, 2023
9a919d0
fix: refund job creator on job de-registration
RomarQ Sep 26, 2023
1526b83
Merge pull request #119 from Acurast/feat/de-register
RomarQ Sep 27, 2023
cd25688
fix: pallet_hyperdrive benchmarks
RomarQ Sep 28, 2023
e2a48d2
Merge pull request #126 from Acurast/fix/benchmarks
RomarQ Sep 28, 2023
1933fcf
feat: env vars (#128)
gitsimon Oct 13, 2023
8aafd93
Feat/env vars (#129)
gitsimon Oct 13, 2023
58f36d2
feat(hyperdrive): transfer reward from hyperdrive pallet instead of m…
RomarQ Oct 13, 2023
893e46c
fix: import under no-std benchmarking
gitsimon Oct 15, 2023
6c4de6d
Merge pull request #130 from Acurast/feat/registration-payment
RomarQ Oct 16, 2023
be3cef1
fix: clear environment on consumer finalize
gitsimon Oct 16, 2023
5d74b4e
feat: parameterize set_environment benchmarks
gitsimon Oct 16, 2023
5d3d2cb
feat(attestation): support key attestation version 300
RomarQ Oct 16, 2023
4743475
Merge pull request #134 from Acurast/chore/support-attestation-versio…
RomarQ Oct 16, 2023
740a5a5
chore: remove token burn when refunding to target chain
RomarQ Oct 17, 2023
ad8bcc4
Merge pull request #135 from Acurast/chore/remove-token-burn
RomarQ Oct 17, 2023
c7590b5
feat: pallet_vesting
gitsimon Jul 11, 2023
8e9db31
feat: make pallet_vesting instantiable
gitsimon Jul 18, 2023
4d0067f
feat: PoS with proof of vesting
gitsimon Aug 30, 2023
d817f84
fix: parachain staking benchmark
gitsimon Oct 17, 2023
588a4ab
feat: add set_environment test
gitsimon Oct 18, 2023
c7113e3
chore: migrations to proof of vesting
gitsimon Oct 18, 2023
0382484
feat: delegation bond less with fallback to cancel
gitsimon Oct 19, 2023
1f0f85a
feat: set all environments
gitsimon Oct 30, 2023
33f6477
chore: bumped version
godenzim Nov 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = ["pallets/proxy"]
[workspace.package]
authors = [ "Papers AG" ]
repository = "https://github.com/Acurast/acurast-core"
version = "0.2.1"
version = "0.2.2"

# TODO: Temporary workaround (https://substrate.stackexchange.com/questions/9870)
[patch.crates-io]
Expand Down
1 change: 1 addition & 0 deletions pallets/acurast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", default-fea
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.43" }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.43" }
parachains-common = { git = "https://github.com/paritytech/cumulus", default-features = false, optional = true, branch = "polkadot-v0.9.43" }
log = "0.4.19"

[dev-dependencies]
base64 = { version = "0.13.0", default-features = false, features = ["alloc"] }
Expand Down
27 changes: 23 additions & 4 deletions pallets/acurast/common/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,21 @@ pub fn extract_attestation<'a>(
Ok(KeyDescription::V4(parsed))
}
100 => {
let parsed = asn1::parse_single::<KeyDescriptionV100V200>(extension.extn_value)
let parsed = asn1::parse_single::<KeyDescriptionKeyMint>(extension.extn_value)
.map_err(|_| ValidationError::ParseError)?;
Ok(KeyDescription::V100(parsed))
}
200 => {
let parsed = asn1::parse_single::<KeyDescriptionV100V200>(extension.extn_value)
let parsed = asn1::parse_single::<KeyDescriptionKeyMint>(extension.extn_value)
.map_err(|_| ValidationError::ParseError)?;
Ok(KeyDescription::V200(parsed))
}
_ => Err(ValidationError::UnsupportedAttestationVersion),
300 => {
let parsed = asn1::parse_single::<KeyDescriptionKeyMint>(extension.extn_value)
.map_err(|_| ValidationError::ParseError)?;
Ok(KeyDescription::V300(parsed))
}
_ => Err(ValidationError::UnsupportedAttestationVersion(version)),
}
}

Expand Down Expand Up @@ -432,14 +437,25 @@ mod tests {
PIXEL_INTERMEDIATE_1_CERT,
PIXEL_KEY_CERT,
],
vec![
r"MIIFHDCCAwSgAwIBAgIJANUP8luj8tazMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNVBAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTkxMTIyMjAzNzU4WhcNMzQxMTE4MjAzNzU4WjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75g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mjU2Z3EXR7YYE+AKh91ysxVc0Xs7lpm2HOcGo4IBbzCCAWswDgYDVR0PAQH/BAQDAgMIMIIBVwYKKwYBBAHWeQIBEQSCAUcwggFDAgIBLAoBAgICASwKAQIEIFn60RrhIWvgMbYX5Yen3U+9/33bdmX070ih8hd+Z4I/BAAwZb+FPQgCBgGLOSJgrr+FRVUEUzBRMSswKQQkY29tLmFjdXJhc3QuYXR0ZXN0ZWQuZXhlY3V0b3IuY2FuYXJ5AgEPMSIEIOxwwqTgcqD1hlUqaDV7I2l8nUXx4SV6jE0polrEmCQzMIGnoQsxCQIBAgIBAwIBBqIDAgEDowQCAgEApQUxAwIBAKoDAgEBv4N3AgUAv4U+AwIBAL+FQEwwSgQgJqxMYL6x43g1fK0MMGE0evjfb7q7sNjOokRYVe4B42gBAf8KAQAEIHkY01pAyfdaFbiuYRh2UFMeF4ltt8FCbyvwoDT6CfTLv4VBBQIDAiLgv4VCBQIDAxZGv4VOBgIEATSzXb+FTwYCBAE0s10wCgYIKoZIzj0EAwIDRwAwRAIgP/JcTQhcHftUQRZSUdKedvMAUzj02tfvKP8t/7ruzgcCIHMS0aiL/dbzq+E1+bxtPL0pMZPjCxyGLdPcIySI8yk/",
],
];

for chain in chains {
let decoded_chain = decode_certificate_chain(&chain);
validate_certificate_chain_root(&decoded_chain).expect("validating root failed");
let (_, cert, _) =
validate_certificate_chain(&decoded_chain).expect("validating chain failed");
let key_description = extract_attestation(cert.extensions)?;
let key_description = extract_attestation(cert.extensions).map_err(|err| {
dbg!(err.clone());

err
})?;
match &key_description {
KeyDescription::V4(key_description) => {
assert_eq!(key_description.attestation_version, 4)
Expand All @@ -450,6 +466,9 @@ mod tests {
KeyDescription::V200(key_description) => {
assert_eq!(key_description.attestation_version, 200)
}
KeyDescription::V300(key_description) => {
assert_eq!(key_description.attestation_version, 300)
}
_ => return Err(()),
}
let _: BoundedKeyDescription = key_description.try_into()?;
Expand Down
13 changes: 7 additions & 6 deletions pallets/acurast/common/src/attestation/asn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub struct KeyDescriptionV4<'a> {
}

#[derive(Asn1Read, Asn1Write)]
pub struct KeyDescriptionV100V200<'a> {
pub struct KeyDescriptionKeyMint<'a> {
/// The [version](https://developer.android.com/training/articles/security-key-attestation#certificate_schema) of the attestation.
/// It's necessary to peak this field before parsing all fields, since fields differ in versions and ASN parsing fails with a single deviating field.
pub attestation_version: i64,
Expand All @@ -177,17 +177,18 @@ pub struct KeyDescriptionV100V200<'a> {
pub key_mint_security_level: SecurityLevel,
pub attestation_challenge: &'a [u8],
pub unique_id: &'a [u8],
pub software_enforced: AuthorizationListV100V200<'a>,
pub tee_enforced: AuthorizationListV100V200<'a>,
pub software_enforced: AuthorizationListKeyMint<'a>,
pub tee_enforced: AuthorizationListKeyMint<'a>,
}

pub enum KeyDescription<'a> {
V1(KeyDescriptionV1<'a>),
V2(KeyDescriptionV2<'a>),
V3(KeyDescriptionV3<'a>),
V4(KeyDescriptionV4<'a>),
V100(KeyDescriptionV100V200<'a>),
V200(KeyDescriptionV100V200<'a>),
V100(KeyDescriptionKeyMint<'a>),
V200(KeyDescriptionKeyMint<'a>),
V300(KeyDescriptionKeyMint<'a>),
}

/// One of
Expand Down Expand Up @@ -480,7 +481,7 @@ pub struct AuthorizationListV4<'a> {
}

#[derive(asn1::Asn1Read, asn1::Asn1Write)]
pub struct AuthorizationListV100V200<'a> {
pub struct AuthorizationListKeyMint<'a> {
#[explicit(1)]
pub purpose: Option<SetOf<'a, i64>>,
#[explicit(2)]
Expand Down
2 changes: 1 addition & 1 deletion pallets/acurast/common/src/attestation/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum ValidationError {
/// Error occured when parsing the extension field
ParseExtension,
/// Attestation version is not supported
UnsupportedAttestationVersion,
UnsupportedAttestationVersion(i64),
/// Error occured while parsing the P256 public key
ParseP256PublicKey,
/// Error occured while parsing the P384 public key
Expand Down
20 changes: 20 additions & 0 deletions pallets/acurast/common/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub use bounded_attestation::*;
use frame_support::{pallet_prelude::*, storage::bounded_vec::BoundedVec};
use sp_std::prelude::*;

use crate::ParameterBound;
#[cfg(feature = "std")]
use serde;
#[cfg(feature = "std")]
Expand Down Expand Up @@ -37,9 +38,11 @@ pub type SerialNumber = BoundedVec<u8, ConstU32<SERIAL_NUMBER_MAX_LENGTH>>;
pub enum MultiOrigin<AcurastAccountId> {
Acurast(AcurastAccountId),
Tezos(TezosAddressBytes),
Ethereum(EthereumAddressBytes),
}

pub type TezosAddressBytes = BoundedVec<u8, CU32<36>>;
pub type EthereumAddressBytes = BoundedVec<u8, CU32<20>>;

/// The type of a job identifier sequence.
pub type JobIdSequence = u128;
Expand Down Expand Up @@ -93,6 +96,23 @@ pub struct JobRegistration<AccountId, MaxAllowedSources: Get<u32>, Extra> {
pub extra: Extra,
}

pub const PUB_KEYS_MAX_LENGTH: u32 = 33;
pub type PubKeyBytes = BoundedVec<u8, ConstU32<PUB_KEYS_MAX_LENGTH>>;

/// Structure representing execution environment variables encrypted for a specific processor.
#[derive(RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo, Clone, PartialEq)]
pub struct Environment<
MaxEnvVars: ParameterBound,
KeyMaxSize: ParameterBound,
ValueMaxSize: ParameterBound,
> {
/// Public key of key pair specifically created to encrypt environment secrets.
pub public_key: PubKeyBytes,
/// Environment variables with cleartext key, encrypted value.
pub variables:
BoundedVec<(BoundedVec<u8, KeyMaxSize>, BoundedVec<u8, ValueMaxSize>), MaxEnvVars>,
}

pub const MAX_JOB_MODULES: u32 = 1;

#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
Expand Down
9 changes: 5 additions & 4 deletions pallets/acurast/common/src/types/bounded_attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl TryFrom<KeyDescription<'_>> for BoundedKeyDescription {
KeyDescription::V4(kd) => kd.try_into(),
KeyDescription::V100(kd) => kd.try_into(),
KeyDescription::V200(kd) => kd.try_into(),
KeyDescription::V300(kd) => kd.try_into(),
}
}
}
Expand Down Expand Up @@ -140,10 +141,10 @@ impl TryFrom<asn::KeyDescriptionV4<'_>> for BoundedKeyDescription {
}
}

impl TryFrom<asn::KeyDescriptionV100V200<'_>> for BoundedKeyDescription {
impl TryFrom<asn::KeyDescriptionKeyMint<'_>> for BoundedKeyDescription {
type Error = ();

fn try_from(data: asn::KeyDescriptionV100V200) -> Result<Self, Self::Error> {
fn try_from(data: asn::KeyDescriptionKeyMint) -> Result<Self, Self::Error> {
Ok(BoundedKeyDescription {
attestation_security_level: data.attestation_security_level.into(),
key_mint_security_level: data.key_mint_security_level.into(),
Expand Down Expand Up @@ -585,10 +586,10 @@ impl TryFrom<asn::AuthorizationListV4<'_>> for BoundedAuthorizationList {
}
}

impl TryFrom<asn::AuthorizationListV100V200<'_>> for BoundedAuthorizationList {
impl TryFrom<asn::AuthorizationListKeyMint<'_>> for BoundedAuthorizationList {
type Error = ();

fn try_from(data: asn::AuthorizationListV100V200) -> Result<Self, Self::Error> {
fn try_from(data: asn::AuthorizationListKeyMint) -> Result<Self, Self::Error> {
Ok(BoundedAuthorizationList {
purpose: try_bound_set!(data.purpose, Purpose, u8)?,
algorithm: try_bound!(data.algorithm, u8)?,
Expand Down
21 changes: 21 additions & 0 deletions pallets/acurast/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,26 @@ benchmarks! {
).into());
}

set_environment {
let x in 1 .. T::MaxEnvVars::get();
let (caller, job) = register_job::<T>(true, false);
let mut vars: Vec<(BoundedVec<u8, T::EnvKeyMaxSize>, BoundedVec<u8, T::EnvValueMaxSize>)> = vec![];
for i in 0..x {
(&mut vars).push((BoundedVec::truncate_from(vec![
105, 112, 102, 115, 58, 47, 47, 8]), BoundedVec::truncate_from(vec![
105, 112, 102, 115, 58, 47, 47, 8])))
}
let env: EnvironmentFor<T> = Environment{
public_key: BoundedVec::truncate_from(vec![105, 112, 102, 115, 58, 47, 47, 8]),
variables: BoundedVec::try_from(vars).unwrap(),
};
let local_job_id = 1;
}: _(RawOrigin::Signed(caller.clone()), local_job_id, account("processor", 0, SEED), env.clone())
verify {
assert_last_event::<T>(Event::ExecutionEnvironmentUpdated(
(MultiOrigin::Acurast(caller), 1), account("processor", 0, SEED)
).into());
}

impl_benchmark_test_suite!(Acurast, mock::ExtBuilder::default().build(), mock::Test);
}
Loading
Loading