Skip to content

Commit

Permalink
Prepare release 2.9.2 (#282)
Browse files Browse the repository at this point in the history
* fix(app): correct sidebar placement

* fix(app): responsive content centering

* fix(app): responsive content centering

* Update issue templates, Close #273

close #273

* Feat: add logos (#278)

* fix #276

* feat: updated logo

* Feat: upgrade to `2.9.2` (#280)

* chore: update 2.9.2

* chore: apply fmt

* fix: hide AA for upcoming fixes

* fix: github edit link

* fix: starknet book deadlink

* fix #279

* small improvement: increase footer bottom padding

* fix #275

* fix: minor

* fix: remove print from cairo_cheatsheet

* Update verify_cairo_programs.yml
  • Loading branch information
julio4 authored Dec 19, 2024
1 parent badf4db commit b7d405f
Show file tree
Hide file tree
Showing 101 changed files with 904 additions and 643 deletions.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Checklist:**
- Using the correct tooling versions, from https://github.com/NethermindEth/StarknetByExample/blob/dev/.tool-versions
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: Suggest an idea of example or concept to showcase
title: ''
labels: enhancement
assignees: ''

---

**Describe the concept/idea you would like to see**

**Is it a new example or a modification/extension of a current one**
If you consider editing some content, explain exactly why and what.

**Additional context**
Add any other context or screenshots about the request here.
2 changes: 1 addition & 1 deletion .github/workflows/verify_cairo_programs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Verify Cairo programs compilation
on:
pull_request:
branches:
- main
- dev
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb 2.8.2
starknet-foundry 0.30.0
scarb 2.9.2
starknet-foundry 0.35.0
79 changes: 50 additions & 29 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -128,105 +128,126 @@ dependencies = [

[[package]]
name = "openzeppelin"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:5dc87a71f0f5d045e02e5bc5ea7a9b0360bbbc3f388b846006280d266feac192"
checksum = "sha256:05fd9365be85a4a3e878135d5c52229f760b3861ce4ed314cb1e75b178b553da"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_merkle_tree",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_access"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:b9139449e53d715992b2d9e887c0c723d886419bee7ceb5561648c70bd6d3174"
checksum = "sha256:7734901a0ca7a7065e69416fea615dd1dc586c8dc9e76c032f25ee62e8b2a06c"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_account"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:841bb881adbe98b64fee1dc1329f6e3fbabdfbd9fa65c66ffb54c55f13764bce"
checksum = "sha256:1aa3a71e2f40f66f98d96aa9bf9f361f53db0fd20fa83ef7df04426a3c3a926a"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_finance"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:f0c507fbff955e4180ea3fa17949c0ff85518c40101f4948948d9d9a74143d6c"
dependencies = [
"openzeppelin_access",
"openzeppelin_token",
]

[[package]]
name = "openzeppelin_governance"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:a9d9c983cfd4369e7bbb69433fb264edf376805ed873b1f70a287825a6bd1eaf"
checksum = "sha256:c0fb60fad716413d537fabd5fcbb2c499ca6beb95af5f0d1699955ecec4c6f63"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:312bc2e531f036480ad7392dbb31042c38d875ef9dbb5578ea8de5c05e35b7d8"
checksum = "sha256:13e04a2190684e6804229a77a6c56de7d033db8b9ef519e5e8dee400a70d8a3d"

[[package]]
name = "openzeppelin_merkle_tree"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:8e264c8d5f0591262a235a445b8ca78dd5580c251707b218b829b6b4d6f84a34"
checksum = "sha256:039608900e92f3dcf479bf53a49a1fd76452acd97eb86e390d1eb92cacdaf3af"

[[package]]
name = "openzeppelin_presets"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:7bc9db7563e434535ebd06c7598ba0f8494e791c5f80401389b356a3ebd65a08"
checksum = "sha256:5c07a8de32e5d9abe33988c7927eaa8b5f83bc29dc77302d9c8c44c898611042"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_security"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:b7497f5e55c6d9f1d7606ad0d12719e3c04765e266fb91fb72740e0af41d03f3"
checksum = "sha256:27155597019ecf971c48d7bfb07fa58cdc146d5297745570071732abca17f19f"

[[package]]
name = "openzeppelin_token"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:7074c23fbc300b3cccff1037264dfdbe976fb11ae42ce687f4a8ce469adc552a"
checksum = "sha256:4452f449dc6c1ea97cf69d1d9182749abd40e85bd826cd79652c06a627eafd91"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_upgrades"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:4de95a7fb8955e63711f34bb954676f6cef127b44b570c0535d7781297821b44"
checksum = "sha256:15fdd63f6b50a0fda7b3f8f434120aaf7637bcdfe6fd8d275ad57343d5ede5e1"

[[package]]
name = "openzeppelin_utils"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:a494aeb5f1371db7f22e922196aa41d1d1698877a766a838350c0b6ffe49fda2"
checksum = "sha256:44f32d242af1e43982decc49c563e613a9b67ade552f5c3d5cde504e92f74607"

[[package]]
name = "pragma_lib"
version = "1.0.0"
source = "git+https://github.com/astraly-labs/pragma-lib#86d7ccdc15b349b8b48d9796fc8464c947bea6e1"
source = "git+https://github.com/astraly-labs/pragma-lib?tag=2.9.1#ee1f3f7e9276cf64e19e267832de380d84c04d28"

[[package]]
name = "simple_account"
Expand All @@ -248,15 +269,15 @@ dependencies = [

[[package]]
name = "snforge_scarb_plugin"
version = "0.2.0"
version = "0.35.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:2e4ce3ebe3f49548bd26908391b5d78537a765d827df0d96c32aeb88941d0d67"
checksum = "sha256:20bd6a488fda7201ce2a5fd680d8e715b10e3545147b276747ad079c96c3d5d2"

[[package]]
name = "snforge_std"
version = "0.30.0"
version = "0.35.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:2f3c4846881813ac0f5d1460981249c9f5e2a6831e752beedf9b70975495b4ec"
checksum = "sha256:fe4e1b1526c815441183baed7f93e73bc76a6393d23e1f9c34fbe227bfaedfd6"
dependencies = [
"snforge_scarb_plugin",
]
Expand Down
12 changes: 6 additions & 6 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ test = "$(git rev-parse --show-toplevel)/scripts/test_resolver.sh"
[workspace.tool.snforge]

[workspace.dependencies]
starknet = "2.8.2"
cairo_test = "2.8.2"
assert_macros = "2.8.2"
snforge_std = "0.30.0"
openzeppelin = "0.16.0"
starknet = "2.9.2"
cairo_test = "2.9.2"
assert_macros = "2.9.2"
snforge_std = "0.35.0"
openzeppelin = "0.20.0"
components = { path = "listings/applications/components" }
pragma_lib = { git = "https://github.com/astraly-labs/pragma-lib" }
pragma_lib = { git = "https://github.com/astraly-labs/pragma-lib", tag = "2.9.1" }

[workspace.package]
description = "Collection of examples of how to use the Cairo programming language to create smart contracts on Starknet."
Expand Down
27 changes: 27 additions & 0 deletions components/ThemeImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useEffect, useState } from "react";
import { useTheme } from "./useTheme";

export const ThemeImage = ({
light,
dark,
alt,
...props
}: {
light: string;
dark: string;
alt: string;
[key: string]: any;
}) => {
const [mounted, setMounted] = useState(false);
const theme = useTheme();

useEffect(() => {
setMounted(true);
}, []);
if (!mounted) {
return <img src={light} alt={alt} {...props} />;
}

// Client-side rendering after hydrating
return <img src={theme === "light" ? light : dark} alt={alt} {...props} />;
};
32 changes: 32 additions & 0 deletions components/useTheme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { useEffect, useState } from "react";

export function useTheme() {
const [theme, setTheme] = useState<"dark" | "light">(() => {
if (typeof window === "undefined") return "light";
return document.documentElement.classList.contains("dark")
? "dark"
: "light";
});

useEffect(() => {
const handleThemeChange = () => {
const newTheme = document.documentElement.classList.contains("dark")
? "dark"
: "light";
setTheme(newTheme);
};

// Watch for class changes on documentElement
const observer = new MutationObserver(handleThemeChange);
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"],
});

return () => {
observer.disconnect();
};
}, []);

return theme;
}
2 changes: 1 addition & 1 deletion footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function Footer() {
return (
<div className="flex flex-col items-center pb-2 gap-2 opacity-50 hover:opacity-70 transition-opacity duration-500 ease-in-out">
<div className="flex flex-col items-center pb-4 gap-2 opacity-50 hover:opacity-70 transition-opacity duration-500 ease-in-out">
<img
className="w-40"
src="/collaborators/PoweredByNethermind.svg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ pub mod CommitmentRevealTraits {

#[cfg(test)]
mod tests {
use starknet::SyscallResultTrait;
use super::{
CommitmentRevealTraits, ICommitmentRevealTraitDispatcher,
ICommitmentRevealTraitDispatcherTrait
ICommitmentRevealTraitDispatcherTrait,
};

use core::hash::HashStateTrait;
Expand All @@ -44,9 +43,9 @@ mod tests {

fn deploy() -> ICommitmentRevealTraitDispatcher {
let (contract_address, _) = deploy_syscall(
CommitmentRevealTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false
CommitmentRevealTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false,
)
.unwrap_syscall();
.unwrap();
ICommitmentRevealTraitDispatcher { contract_address }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use starknet::secp256_trait::{Signature};
// 3. Sign the hash (off chain, keep your private key secret)
#[starknet::interface]
trait IVerifySignature<TContractState> {
fn get_signature(self: @TContractState, r: u256, s: u256, v: u32,) -> Signature;
fn get_signature(self: @TContractState, r: u256, s: u256, v: u32) -> Signature;
fn verify_eth_signature(
self: @TContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32,
);
fn recover_public_key(
self: @TContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32
self: @TContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32,
);
}

Expand All @@ -23,7 +23,7 @@ mod verifySignature {
use super::IVerifySignature;
use core::starknet::eth_address::EthAddress;
use starknet::secp256k1::Secp256k1Point;
use starknet::secp256_trait::{Signature, signature_from_vrs, recover_public_key,};
use starknet::secp256_trait::{Signature, signature_from_vrs, recover_public_key};
use starknet::eth_signature::{verify_eth_signature, public_key_point_to_eth_address};

#[storage]
Expand All @@ -46,7 +46,7 @@ mod verifySignature {
/// # Returns
///
/// * `Signature` - The signature struct.
fn get_signature(self: @ContractState, r: u256, s: u256, v: u32,) -> Signature {
fn get_signature(self: @ContractState, r: u256, s: u256, v: u32) -> Signature {
// Create a Signature object from the given v, r, and s values.
let signature: Signature = signature_from_vrs(v, r, s);
signature
Expand All @@ -62,7 +62,7 @@ mod verifySignature {
/// * `s` - The S component of the signature.
/// * `v` - The V component of the signature.
fn verify_eth_signature(
self: @ContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32
self: @ContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32,
) {
let signature = self.get_signature(r, s, v);
verify_eth_signature(:msg_hash, :signature, :eth_address);
Expand All @@ -79,7 +79,7 @@ mod verifySignature {
/// * `s` - The S component of the signature.
/// * `v` - The V component of the signature.
fn recover_public_key(
self: @ContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32
self: @ContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32,
) {
let signature = self.get_signature(r, s, v);
let public_key_point = recover_public_key::<Secp256k1Point>(msg_hash, signature)
Expand All @@ -93,7 +93,7 @@ mod verifySignature {

#[cfg(test)]
mod tests {
use starknet::secp256_trait::{Signature, signature_from_vrs, recover_public_key,};
use starknet::secp256_trait::{Signature, signature_from_vrs, recover_public_key};
use starknet::EthAddress;
use starknet::secp256k1::{Secp256k1Point};
use starknet::eth_signature::{verify_eth_signature, public_key_point_to_eth_address};
Expand Down
Loading

0 comments on commit b7d405f

Please sign in to comment.