Skip to content

Commit

Permalink
fix: ftm::Debug impl fails to compile (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI authored Jun 29, 2024
1 parent 3204933 commit 9e9ecf2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches:
- "main"
pull_request:

name: "Build feature combinations"

jobs:
feature-powerset:
name: "Build ${{ matrix.package }} features"
runs-on: "ubuntu-latest"

strategy:
matrix:
package:
- "starknet-types-core"
- "starknet-types-rpc"

steps:
- name: "Checkout source code"
uses: "actions/checkout@v3"

- name: "Setup stable toolchain"
uses: "actions-rs/toolchain@v1"
with:
toolchain: "stable"
profile: "minimal"
override: true

- name: "Install cargo-hack"
run: |
cargo install --locked cargo-hack
- name: "Build all feature combinations"
run: |
cargo hack build --package ${{ matrix.package }} --feature-powerset
2 changes: 1 addition & 1 deletion crates/starknet-types-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ parity-scale-codec = ["dep:parity-scale-codec"]
serde = ["alloc", "dep:serde"]
prime-bigint = ["dep:lazy_static"]
num-traits = []
papyrus-serialization = []
papyrus-serialization = ["std"]

[dev-dependencies]
proptest = "1.4.0"
Expand Down
17 changes: 4 additions & 13 deletions crates/starknet-types-core/src/felt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ mod formatting {

impl fmt::Debug for Felt {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.to_fixed_hex_string())
write!(f, "{}", self.0)
}
}

Expand Down Expand Up @@ -1107,18 +1107,9 @@ mod test {

#[test]
fn test_debug_format() {
assert_eq!(
format!("{:?}", Felt::ONE),
String::from("0x") + &"0".repeat(63) + "1"
);
assert_eq!(
format!("{:?}", Felt::from(2)),
String::from("0x") + &"0".repeat(63) + "2"
);
assert_eq!(
format!("{:?}", Felt::from(12345)),
String::from("0x") + &"0".repeat(60) + "3039"
);
assert_eq!(format!("{:?}", Felt::ONE), "0x1");
assert_eq!(format!("{:?}", Felt::from(2)), "0x2");
assert_eq!(format!("{:?}", Felt::from(12345)), "0x3039");
}

// Helper function to generate a vector of bits for testing purposes
Expand Down

0 comments on commit 9e9ecf2

Please sign in to comment.