Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 25948bd

Browse files
julio4Marvelousmichealdependabot[bot]hudem1nethermind-oss-compliance[bot]
authored
Archive release (#301)
* feat: migrate merkle tree to snforge * fix: remove print * feat: migrate write any slot snforge * feat: migrate struct mapping key snforge * feat: migrate store packing snforge * feat: migrate lib calls snforge * feat: migrate hash trait snforge * feat: migrate hash compatible snforge * feat: migrate commit reveal snforge * fix: added the colored onlydust logo (#294) * fix: added the colored onlydust logo * fix: added the colored onlydust logo * fix: rename onlydust logo --------- Co-authored-by: julio4 <30329843+julio4@users.noreply.github.com> * chore(deps): bump estree-util-value-to-estree (#295) Bumps the npm_and_yarn group with 1 update in the / directory: [estree-util-value-to-estree](https://github.com/remcohaszing/estree-util-value-to-estree). Updates `estree-util-value-to-estree` from 3.3.2 to 3.3.3 - [Release notes](https://github.com/remcohaszing/estree-util-value-to-estree/releases) - [Commits](remcohaszing/estree-util-value-to-estree@v3.3.2...v3.3.3) --- updated-dependencies: - dependency-name: estree-util-value-to-estree dependency-version: 3.3.3 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: julio4 <30329843+julio4@users.noreply.github.com> * chore(deps): bump the npm_and_yarn group across 1 directory with 3 updates (#296) Bumps the npm_and_yarn group with 3 updates in the / directory: [@babel/helpers](https://github.com/babel/babel/tree/HEAD/packages/babel-helpers), [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) and [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Updates `@babel/helpers` from 7.26.7 to 7.27.0 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.0/packages/babel-helpers) Updates `@babel/runtime` from 7.26.7 to 7.27.0 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.0/packages/babel-runtime) Updates `vite` from 5.4.14 to 5.4.17 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.4.17/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.4.17/packages/vite) --- updated-dependencies: - dependency-name: "@babel/helpers" dependency-version: 7.27.0 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: "@babel/runtime" dependency-version: 7.27.0 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: vite dependency-version: 5.4.17 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: julio4 <30329843+julio4@users.noreply.github.com> * feat: ZkSnark use case example (Circom, Groth16, Snarkjs, Garaga) (#270) * feat: ZkSnark use case example (Circom, Groth16, Snarkjs, Garaga) * feat(PR review): Move files to advanced-concepts/verify_proofs * fix: typos * fix: zksnark * feat: improve zksnark wording * fix: remove redundant paragraph --------- Co-authored-by: julio4 <30329843+julio4@users.noreply.github.com> * Update README.md * chore(deps): bump the npm_and_yarn group across 1 directory with 2 updates (#300) Bumps the npm_and_yarn group with 2 updates in the / directory: [brace-expansion](https://github.com/juliangruber/brace-expansion) and [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Updates `brace-expansion` from 2.0.1 to 2.0.2 - [Release notes](https://github.com/juliangruber/brace-expansion/releases) - [Commits](juliangruber/brace-expansion@v2.0.1...v2.0.2) Updates `vite` from 5.4.17 to 5.4.19 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.4.19/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.4.19/packages/vite) --- updated-dependencies: - dependency-name: brace-expansion dependency-version: 2.0.2 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: vite dependency-version: 5.4.19 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat: update dep and archive warning * Add CODEOWNERS file (#299) * Add CODEOWNERS file template * update CODEOWNERS --------- Co-authored-by: nethermind-oss-compliance[bot] <189609862+nethermind-oss-compliance[bot]@users.noreply.github.com> Co-authored-by: julio4 <30329843+julio4@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Marvelousmicheal <112209435+Marvelousmicheal@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hudem1 <55464342+hudem1@users.noreply.github.com> Co-authored-by: nethermind-oss-compliance[bot] <189609862+nethermind-oss-compliance[bot]@users.noreply.github.com>
1 parent 22927a2 commit 25948bd

38 files changed

Lines changed: 6108 additions & 1303 deletions

File tree

CODEOWNERS

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# =============================================================================
2+
# GLOBAL OWNERS
3+
# =============================================================================
4+
* @NethermindEth/nubia-admins
5+
* @NethermindEth/nubia-general
6+
* @NethermindEth/nubia-starknet-by-example
7+
* @NethermindEth/nubia-starknet-by-example-admin
8+
* @NethermindEth/role_angkor_admin
9+
* @NethermindEth/role_legal_users
10+
* @NethermindEth/role_nubia_admin
11+
* @NethermindEth/security-admins
12+
13+
# =============================================================================
14+
# INDIVIDUALS
15+
# =============================================================================
16+
* @julio4

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Starknet by Example
22

3-
Dev preview at: https://starknet-by-example-dev.voyager.online/
3+
> [!WARNING]
4+
> Starknet By Example was moved to [Starkware's official Starknet documentation](https://github.com/starknet-io/starknet-docs/tree/main/modules/archive/pages/starknet-by-example). This repository is now archived and may not be up to date.
45
56
## Description
67

Scarb.lock

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ dependencies = [
3434
[[package]]
3535
name = "commit_reveal"
3636
version = "0.1.0"
37+
dependencies = [
38+
"snforge_std",
39+
]
3740

3841
[[package]]
3942
name = "components"
@@ -125,13 +128,24 @@ dependencies = [
125128
name = "factory"
126129
version = "0.1.0"
127130

131+
[[package]]
132+
name = "garaga"
133+
version = "0.15.5"
134+
source = "git+https://github.com/keep-starknet-strange/garaga.git?tag=v0.15.5#8cc51a86a84401b063b39520e2d67254baeaebe5"
135+
128136
[[package]]
129137
name = "hash_solidity_compatible"
130138
version = "0.1.0"
139+
dependencies = [
140+
"snforge_std",
141+
]
131142

132143
[[package]]
133144
name = "hash_trait"
134145
version = "0.1.0"
146+
dependencies = [
147+
"snforge_std",
148+
]
135149

136150
[[package]]
137151
name = "l1_l2_token_bridge"
@@ -143,6 +157,9 @@ dependencies = [
143157
[[package]]
144158
name = "library_calls"
145159
version = "0.1.0"
160+
dependencies = [
161+
"snforge_std",
162+
]
146163

147164
[[package]]
148165
name = "mappings"
@@ -154,6 +171,9 @@ dependencies = [
154171
[[package]]
155172
name = "merkle_tree"
156173
version = "0.1.0"
174+
dependencies = [
175+
"snforge_std",
176+
]
157177

158178
[[package]]
159179
name = "nft_dutch_auction"
@@ -267,17 +287,26 @@ dependencies = [
267287
"snforge_std",
268288
]
269289

290+
[[package]]
291+
name = "snarkjs"
292+
version = "0.1.0"
293+
dependencies = [
294+
"garaga",
295+
"openzeppelin_token",
296+
"snforge_std",
297+
]
298+
270299
[[package]]
271300
name = "snforge_scarb_plugin"
272-
version = "0.38.0"
301+
version = "0.38.3"
273302
source = "registry+https://scarbs.xyz/"
274-
checksum = "sha256:c4d128eedb5fca4362be38a84e5f5a85bd94ec1557bab7c045d48de0163e406c"
303+
checksum = "sha256:0cd914b547acd96b4cad99a78e95c0eda001d0c280da4969b2161e286079cf46"
275304

276305
[[package]]
277306
name = "snforge_std"
278-
version = "0.38.0"
307+
version = "0.38.3"
279308
source = "registry+https://scarbs.xyz/"
280-
checksum = "sha256:8b3eaff778105c313b78708974c253cd927ecf5c896f4557a0ea4f10f427b554"
309+
checksum = "sha256:d376526fbbe22535ad89ed630b11d6e209f22c50168de6c6430c0591c81c3174"
281310
dependencies = [
282311
"snforge_scarb_plugin",
283312
]
@@ -299,6 +328,9 @@ dependencies = [
299328
[[package]]
300329
name = "store_using_packing"
301330
version = "0.1.0"
331+
dependencies = [
332+
"snforge_std",
333+
]
302334

303335
[[package]]
304336
name = "storing_custom_types"
@@ -310,6 +342,9 @@ dependencies = [
310342
[[package]]
311343
name = "struct_as_mapping_key"
312344
version = "0.1.0"
345+
dependencies = [
346+
"snforge_std",
347+
]
313348

314349
[[package]]
315350
name = "testing_how_to"
@@ -353,3 +388,6 @@ dependencies = [
353388
[[package]]
354389
name = "write_to_any_slot"
355390
version = "0.1.0"
391+
dependencies = [
392+
"snforge_std",
393+
]

Scarb.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ openzeppelin_token = "1.0.0"
2323
openzeppelin_utils = "1.0.0"
2424
components = { path = "listings/applications/components" }
2525
pragma_lib = { git = "https://github.com/astraly-labs/pragma-lib", tag = "2.9.1" }
26+
garaga = { git = "https://github.com/keep-starknet-strange/garaga.git", tag = "v0.15.5" }
2627

2728
[workspace.package]
2829
description = "Collection of examples of how to use the Cairo programming language to create smart contracts on Starknet."

_typos.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[default]
2-
extend-ignore-identifiers-re = ["requestor", "REQUESTOR", "Requestor"]
2+
extend-ignore-identifiers-re = ["requestor", "REQUESTOR", "Requestor", "groth", "Groth"]
33

44
[type.po]
55
extend-glob = ["*.po", "*.css", "*.js"]

listings/advanced-concepts/commit_reveal/Scarb.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ edition.workspace = true
77
starknet.workspace = true
88

99
[dev-dependencies]
10-
cairo_test.workspace = true
10+
assert_macros.workspace = true
11+
snforge_std.workspace = true
1112

1213
[scripts]
1314
test.workspace = true

listings/advanced-concepts/commit_reveal/src/commit_reveal.cairo

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub trait ICommitmentRevealTrait<T> {
66

77
// [!region contract]
88
#[starknet::contract]
9-
pub mod CommitmentRevealTraits {
9+
mod CommitmentRevealTraits {
1010
use starknet::storage::{StoragePointerWriteAccess, StoragePointerReadAccess};
1111
use core::hash::HashStateTrait;
1212
use core::pedersen::PedersenTrait;
@@ -32,26 +32,20 @@ pub mod CommitmentRevealTraits {
3232

3333
#[cfg(test)]
3434
mod tests {
35-
use super::{
36-
CommitmentRevealTraits, ICommitmentRevealTraitDispatcher,
37-
ICommitmentRevealTraitDispatcherTrait,
38-
};
39-
35+
use super::{ICommitmentRevealTraitDispatcher, ICommitmentRevealTraitDispatcherTrait};
4036
use core::hash::HashStateTrait;
4137
use core::pedersen::PedersenTrait;
42-
use starknet::syscalls::deploy_syscall;
38+
use snforge_std::{ContractClassTrait, DeclareResultTrait, declare};
4339

4440
fn deploy() -> ICommitmentRevealTraitDispatcher {
45-
let (contract_address, _) = deploy_syscall(
46-
CommitmentRevealTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false,
47-
)
48-
.unwrap();
41+
let contract = declare("CommitmentRevealTraits").unwrap().contract_class();
42+
let (contract_address, _) = contract.deploy(@array![]).unwrap();
4943
ICommitmentRevealTraitDispatcher { contract_address }
5044
}
5145

5246
#[test]
5347
fn commit_and_reveal() {
54-
let mut contract = deploy();
48+
let contract = deploy();
5549

5650
// [!region offchain]
5751
// Off-chain, compute the commitment hash for secret

listings/advanced-concepts/hash_solidity_compatible/Scarb.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ edition.workspace = true
77
starknet.workspace = true
88

99
[dev-dependencies]
10-
cairo_test.workspace = true
10+
assert_macros.workspace = true
11+
snforge_std.workspace = true
1112

1213
[scripts]
1314
test.workspace = true

listings/advanced-concepts/hash_solidity_compatible/src/contract.cairo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub trait ISolidityHashExample<TContractState> {
44
}
55

66
#[starknet::contract]
7-
pub mod SolidityHashExample {
7+
mod SolidityHashExample {
88
use core::keccak::keccak_u256s_be_inputs;
99
use core::integer;
1010

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
1-
mod tests {
2-
use hash_solidity_compatible::contract::{SolidityHashExample, ISolidityHashExample};
3-
use starknet::{contract_address_const, testing::set_contract_address};
1+
use hash_solidity_compatible::contract::{
2+
ISolidityHashExampleDispatcher, ISolidityHashExampleDispatcherTrait,
3+
};
4+
use snforge_std::{ContractClassTrait, DeclareResultTrait, declare};
45

5-
fn setup() -> SolidityHashExample::ContractState {
6-
let mut state = SolidityHashExample::contract_state_for_testing();
7-
let contract_address = contract_address_const::<0x1>();
8-
set_contract_address(contract_address);
9-
state
10-
}
11-
12-
#[test]
13-
fn get_same_hash_solidity() {
14-
let mut state = setup();
15-
let mut array: Array<u256> = array![];
16-
array.append(1);
17-
18-
let hash_expected: u256 =
19-
0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6;
20-
let hash_received: u256 = state.hash_data(array.span());
6+
fn setup() -> ISolidityHashExampleDispatcher {
7+
let contract = declare("SolidityHashExample").unwrap().contract_class();
8+
let (contract_address, _) = contract.deploy(@array![]).unwrap();
9+
ISolidityHashExampleDispatcher { contract_address }
10+
}
2111

22-
assert_eq!(hash_received, hash_expected);
23-
}
12+
#[test]
13+
fn get_same_hash_solidity() {
14+
let contract = setup();
15+
let hash_expected: u256 = 0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6;
16+
assert_eq!(contract.hash_data(array![1].span()), hash_expected);
2417
}

0 commit comments

Comments
 (0)