Skip to content

Commit

Permalink
Merge pull request #49 from cartridge-gg/feat/5/6/tweaks
Browse files Browse the repository at this point in the history
Feat/5/6 Cargo fmt and clippy, and an update to the README
  • Loading branch information
tarrencev committed Mar 18, 2024
2 parents 410fae6 + 26efc79 commit 16dfdbd
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 13 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ make

in the root directory.

### Commiting changes

The compiled account is stored in the git repository in the `crates/account_sdk/compiled/` folder. To make sure that the tests are run against the most reacent version of the code run `make` in the root repository. The `make` command should also be run before commiting any changes to ensure a valid state of the compiled code.

### Building for web assembly

After you've compiled the cairo code you can compile rust to wasm using
Expand Down
9 changes: 6 additions & 3 deletions crates/account_sdk/src/felt_ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ impl<'a> ser::Serializer for &'a mut Serializer {
Err(Error::TypeNotSupported)
}

fn serialize_some<T: ?Sized>(self, value: &T) -> Result<()>
fn serialize_some<T>(self, value: &T) -> Result<()>
where
T: Serialize,
T: ?Sized,
{
Err(Error::TypeNotSupported)
}
Expand All @@ -153,14 +154,15 @@ impl<'a> ser::Serializer for &'a mut Serializer {
Err(Error::TypeNotSupported)
}

fn serialize_newtype_struct<T: ?Sized>(self, name: &'static str, value: &T) -> Result<()>
fn serialize_newtype_struct<T>(self, name: &'static str, value: &T) -> Result<()>
where
T: Serialize,
T: ?Sized,
{
value.serialize(self)
}

fn serialize_newtype_variant<T: ?Sized>(
fn serialize_newtype_variant<T>(
self,
name: &'static str,
variant_index: u32,
Expand All @@ -169,6 +171,7 @@ impl<'a> ser::Serializer for &'a mut Serializer {
) -> Result<()>
where
T: Serialize,
T: ?Sized,
{
Err(Error::TypeNotSupported)
}
Expand Down
1 change: 1 addition & 0 deletions crates/webauthn/tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ fn main() {
// It's important since we always want to test against the latest version of the code
println!("cargo:rerun-if-changed=../auth");
println!("cargo:rerun-if-changed=../session");
println!("cargo:rerun-if-changed=../../../Scarb.toml");
}
2 changes: 0 additions & 2 deletions crates/webauthn/tests/src/auth/expand_auth_data.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use cairo_args_runner::{errors::SierraRunnerError, Arg, Felt252};
use proptest::{collection, prelude::*};

use crate::prelude::*;
use cairo_args_runner::SuccessfulRun;

struct AuthDataParser;
impl ArgumentParser for AuthDataParser {
Expand Down
2 changes: 0 additions & 2 deletions crates/webauthn/tests/src/auth/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use super::*;
use crate::*;
use cairo_args_runner::SuccessfulRun;
use cairo_args_runner::{errors::SierraRunnerError, Arg, Felt252};

struct U256ArrParser;

Expand Down
2 changes: 0 additions & 2 deletions crates/webauthn/tests/src/auth/mod_arithmetic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use cairo_args_runner::{Arg, Felt252};

use crate::prelude::*;

/// ```extended_gcd(u256, u256) -> (u256, u256, u256)```
Expand Down
1 change: 0 additions & 1 deletion crates/webauthn/tests/src/auth/verify_ecdsa.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use account_sdk::webauthn_signer::P256VerifyingKeyConverter;
use cairo_args_runner::Felt252;
use p256::{
ecdsa::{signature::Signer, Signature, SigningKey},
elliptic_curve::{rand_core::OsRng, SecretKey},
Expand Down
1 change: 0 additions & 1 deletion crates/webauthn/tests/src/auth/verify_signature.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use account_sdk::webauthn_signer::P256VerifyingKeyConverter;
use cairo_args_runner::Felt252;
use p256::{
ecdsa::{signature::Signer, Signature, SigningKey},
elliptic_curve::rand_core::OsRng,
Expand Down
1 change: 0 additions & 1 deletion crates/webauthn/tests/src/prop_utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use cairo_args_runner::Felt252;
use proptest::prelude::*;
use proptest::strategy::Strategy;

#[derive(Debug, Clone, Copy)]
pub struct Felt252Strategy;
Expand Down
1 change: 0 additions & 1 deletion crates/webauthn/tests/src/session/prop_signature_proofs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use cairo_args_runner::Felt252;
use proptest::prelude::*;
use proptest::strategy::Strategy;

use crate::prop_utils::Felt252Strategy;
use crate::session::signature_proofs::SIGNATURE_PROOFS;
Expand Down

0 comments on commit 16dfdbd

Please sign in to comment.