Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publish #642

Draft
wants to merge 56 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
be3ee3b
fix publishing script by copying files to target folder.
marioiordanov Oct 29, 2024
6dbeea7
add step to circleci build process to ensure that problems are catche…
marioiordanov Oct 29, 2024
0449863
changes
marioiordanov Oct 29, 2024
0d9b0cf
edit ci pipeline
marioiordanov Oct 29, 2024
400582d
edit ci config
marioiordanov Oct 29, 2024
a9aaff6
edit ci config
marioiordanov Oct 29, 2024
5f2fb6f
circle ci config
marioiordanov Oct 29, 2024
bd2a12a
edit ci config
marioiordanov Oct 29, 2024
b7341c4
edit script + ci
marioiordanov Oct 29, 2024
61db780
ci config
marioiordanov Oct 29, 2024
35b337c
reduced ci
marioiordanov Oct 29, 2024
ac6b9a6
restore ci
marioiordanov Oct 29, 2024
dd08b83
config
marioiordanov Oct 29, 2024
d6bf84f
extend command
marioiordanov Oct 29, 2024
e2fc500
edit cp
marioiordanov Oct 29, 2024
6d4b4b6
edit script
marioiordanov Oct 29, 2024
06e2132
move files around and change constants
marioiordanov Oct 30, 2024
6529ede
restore config with all steps
marioiordanov Oct 30, 2024
84834c1
refactor files and fix test
marioiordanov Oct 30, 2024
c88afe8
remove files
marioiordanov Oct 30, 2024
bc1671d
fix test
marioiordanov Oct 30, 2024
7bb2bec
edit script
marioiordanov Oct 30, 2024
770b79c
skip testing for faster ci
marioiordanov Oct 30, 2024
7ecd6c4
check another command
marioiordanov Oct 30, 2024
51fbf6b
reduce ci steps
marioiordanov Oct 30, 2024
388e56b
try with latest stable toolchain
marioiordanov Oct 30, 2024
271114a
Revert "try with latest stable toolchain"
marioiordanov Oct 30, 2024
02b3e02
restore scrits
marioiordanov Oct 30, 2024
1bbd776
changed constant
marioiordanov Oct 30, 2024
50563d8
update version to 0.2.2
marioiordanov Oct 30, 2024
d99ca6e
remove empty line [skip ci]
marioiordanov Oct 30, 2024
fe19c93
edit ci config[skip ci]
marioiordanov Oct 30, 2024
f995471
website new version
marioiordanov Oct 30, 2024
38b9f35
edit generate_artifacts script to copy file to starknet-devnet-core c…
marioiordanov Oct 30, 2024
ee51020
edit ci
marioiordanov Oct 31, 2024
6619396
edit metadata
marioiordanov Oct 31, 2024
0244d8c
next version
marioiordanov Oct 31, 2024
8501bbe
use nightly feature
marioiordanov Oct 31, 2024
0c369a3
edit ci
marioiordanov Oct 31, 2024
23aa95e
edit toml
marioiordanov Oct 31, 2024
b932462
edit toml by excluding a file
marioiordanov Oct 31, 2024
c728ef2
edit ci
marioiordanov Oct 31, 2024
634d4c5
changes
marioiordanov Oct 31, 2024
4d2e9e9
changes
marioiordanov Oct 31, 2024
fb45251
edit ci
marioiordanov Oct 31, 2024
b337d66
Revert "changes"
marioiordanov Nov 1, 2024
22a0b85
usc to universal_sierra_compiler
marioiordanov Nov 1, 2024
8e4cce8
include bin project
marioiordanov Nov 1, 2024
c011b6b
fix compilation errors
marioiordanov Nov 1, 2024
9ed3b6f
change ci
marioiordanov Nov 4, 2024
52ddb50
change ci
marioiordanov Nov 4, 2024
9e18533
change ci
marioiordanov Nov 4, 2024
14a92ab
change ci [skip ci]
marioiordanov Nov 4, 2024
7c6a621
exclude folders not needed for uploading to crates.io
marioiordanov Nov 4, 2024
b5261e8
change ci
marioiordanov Nov 4, 2024
fe080f3
change ci
marioiordanov Nov 4, 2024
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
75 changes: 39 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,42 +48,45 @@ jobs:
steps:
- checkout
- run:
name: Load cache
command: .circleci/scripts/cache.sh load
- run:
name: Install nightly-2024-07-08
command: rustup install nightly-2024-07-08
- run:
name: Install foundry
command: ./scripts/install_foundry.sh
- run:
name: Verify lockfile
command: cargo update -w --locked
- run:
name: Build
command: cargo build --release
- run:
name: Clippy check
command: ./scripts/clippy_check.sh
- run:
name: Format check
command: ./scripts/format_check.sh
- run:
name: Code spell check
command: ./scripts/check_spelling.sh
- run:
name: Save cache
command: .circleci/scripts/cache.sh save
- run:
name: Cleanup old cache
command: .circleci/scripts/cache.sh cleanup
- run:
name: Unit tests
command: cargo test --lib --bins --no-fail-fast
- run:
name: Integration tests
# fails if jobs not limited; read more in https://github.com/0xSpaceShard/starknet-devnet-rs/issues/378
command: cargo test --jobs 9 --test '*' --no-fail-fast
name: test
command: env
# - run:
# name: Install nightly-2024-10-31
# command: rustup install nightly-2024-10-31
# - run:
# name: Install foundry
# command: ./scripts/install_foundry.sh
# - run:
# name: Verify lockfile
# command: cargo update -w --locked
# - run:
# name: Build
# command: cargo build --release
# - run:
# name: Clippy check
# command: ./scripts/clippy_check.sh
# - run:
# name: Format check
# command: ./scripts/format_check.sh
# - run:
# name: Code spell check
# command: ./scripts/check_spelling.sh
# - run:
# name: Save cache
# command: .circleci/scripts/cache.sh save
# - run:
# name: Cleanup old cache
# command: .circleci/scripts/cache.sh cleanup
# - run:
# name: Unit tests
# command: cargo test --lib --bins --no-fail-fast
# - run:
# name: Integration tests
# # fails if jobs not limited; read more in https://github.com/0xSpaceShard/starknet-devnet-rs/issues/378
# command: cargo test --jobs 9 --test '*' --no-fail-fast
# - run:
# name: Check publishing by packaging the workspace
# command: cargo +nightly-2024-10-31 package -Z package-workspace

binary-build:
parameters:
Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ rand_mt = "4.2.2"
regex_generate = "0.2.3"
reqwest = { version = "0.12", features = ["blocking", "json"] }
url = "2.4"
usc = { version = "2.2.0", package = "universal-sierra-compiler" }
universal-sierra-compiler = { version = "2.2.0", package = "universal-sierra-compiler" }
num-bigint = { version = "0.4" }
bigdecimal = { version = "0.4.5" }
enum-helper-macros = "0.0.1"
Expand All @@ -72,12 +72,12 @@ enum-helper-macros = "0.0.1"
starknet-types-core = "0.1.5"
starknet_api = { version = "0.13.0-rc.0", features = ["testing"] }
blockifier = { version = "0.8.0" }
starknet-rs-signers = { version = "0.10.0", package = "starknet-signers" }
starknet-rs-core = { version = "0.12.0", package = "starknet-core" }
starknet-rs-providers = { version = "0.12.0", package = "starknet-providers" }
starknet-rs-accounts = { version = "0.11.0", package = "starknet-accounts" }
starknet-rs-contract = { version = "0.11.0", package = "starknet-contract" }
starknet-rs-crypto = { version = "0.7.2", package = "starknet-crypto" }
starknet-signers = { version = "0.10.0", package = "starknet-signers" }
starknet-core = { version = "0.12.0", package = "starknet-core" }
starknet-providers = { version = "0.12.0", package = "starknet-providers" }
starknet-accounts = { version = "0.11.0", package = "starknet-accounts" }
starknet-contract = { version = "0.11.0", package = "starknet-contract" }
starknet-crypto = { version = "0.7.2", package = "starknet-crypto" }
cairo-vm = "=1.0.1"

# Cairo-lang dependencies
Expand All @@ -96,9 +96,9 @@ cairo-lang-syntax = "=2.7.0"
cairo-lang-utils = "=2.7.0"

# Inner dependencies
starknet-types = { version = "0.2.1", path = "crates/starknet-devnet-types", package = "starknet-devnet-types" }
starknet-core = { version = "0.2.1", path = "crates/starknet-devnet-core", package = "starknet-devnet-core" }
server = { version = "0.2.1", path = "crates/starknet-devnet-server", package = "starknet-devnet-server" }
starknet-devnet-types = { version = "0.2.3", path = "crates/starknet-devnet-types", package = "starknet-devnet-types" }
starknet-devnet-core = { version = "0.2.3", path = "crates/starknet-devnet-core", package = "starknet-devnet-core" }
starknet-devnet-server = { version = "0.2.3", path = "crates/starknet-devnet-server", package = "starknet-devnet-server" }

# Dependabot alerts
zerocopy = "0.7.31"
Expand Down
3 changes: 2 additions & 1 deletion contracts/generate_artifacts.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ set -eu

# Bash script to generate the artifacts required by Devnet to compile.
mkdir -p l1-l2-artifacts
mkdir -p ../crates/starknet-devnet-core/contracts/l1-l2-artifacts

# L1-L2 messaging:
## SOLIDITY
forge build --root ./l1-l2-messaging/solidity
cp ./l1-l2-messaging/solidity/out/MockStarknetMessaging.sol/MockStarknetMessaging.json ./l1-l2-artifacts/
cp ./l1-l2-messaging/solidity/out/L1L2.sol/L1L2Example.json ./l1-l2-artifacts/
cp ./l1-l2-messaging/solidity/out/MockStarknetMessaging.sol/MockStarknetMessaging.json ../crates/starknet-devnet-core/contracts/l1-l2-artifacts/

## CAIRO
scarb --manifest-path ./l1-l2-messaging/cairo/Scarb.toml build
Expand Down
10 changes: 5 additions & 5 deletions crates/starknet-devnet-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "starknet-devnet-core"
version = "0.2.1"
version = "0.2.3"
edition.workspace = true
repository.workspace = true
license-file.workspace = true
Expand All @@ -19,16 +19,16 @@ reqwest = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
starknet-types-core = { workspace = true }
starknet-rs-signers = { workspace = true }
starknet-rs-core = { workspace = true }
starknet-types = { workspace = true }
starknet-signers = { workspace = true }
starknet-core = { workspace = true }
starknet-devnet-types = { workspace = true }
rand = { workspace = true }
rand_mt = { workspace = true }
tracing = { workspace = true }
indexmap = { workspace = true }
url = { workspace = true }
nonzero_ext = { workspace = true }
usc = { workspace = true }
universal-sierra-compiler = { workspace = true }
parking_lot = { workspace = true }

# necessary for installing reqwest in Docker
Expand Down
26 changes: 14 additions & 12 deletions crates/starknet-devnet-core/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ use blockifier::state::state_api::StateReader;
use starknet_api::core::{calculate_contract_address, PatriciaKey};
use starknet_api::transaction::{Calldata, ContractAddressSalt};
use starknet_api::{felt, patricia_key};
use starknet_rs_core::types::Felt;
use starknet_types::contract_address::ContractAddress;
use starknet_types::contract_class::{Cairo0Json, ContractClass};
use starknet_types::error::Error;
use starknet_types::felt::{felt_from_prefixed_hex, join_felts, split_biguint, ClassHash, Key};
use starknet_types::num_bigint::BigUint;
use starknet_types::rpc::state::Balance;
use starknet_types::traits::HashProducer;
use starknet_core::types::Felt;
use starknet_devnet_types::contract_address::ContractAddress;
use starknet_devnet_types::contract_class::{Cairo0Json, ContractClass};
use starknet_devnet_types::error::Error;
use starknet_devnet_types::felt::{
felt_from_prefixed_hex, join_felts, split_biguint, ClassHash, Key,
};
use starknet_devnet_types::num_bigint::BigUint;
use starknet_devnet_types::rpc::state::Balance;
use starknet_devnet_types::traits::HashProducer;

use crate::constants::{
CAIRO_0_ACCOUNT_CONTRACT, CHARGEABLE_ACCOUNT_ADDRESS, CHARGEABLE_ACCOUNT_PRIVATE_KEY,
Expand Down Expand Up @@ -214,10 +216,10 @@ impl Accounted for Account {

#[cfg(test)]
mod tests {
use starknet_rs_core::types::Felt;
use starknet_types::contract_address::ContractAddress;
use starknet_types::felt::felt_from_prefixed_hex;
use starknet_types::rpc::state::Balance;
use starknet_core::types::Felt;
use starknet_devnet_types::contract_address::ContractAddress;
use starknet_devnet_types::felt::felt_from_prefixed_hex;
use starknet_devnet_types::rpc::state::Balance;

use super::Account;
use crate::account::FeeToken;
Expand Down
40 changes: 15 additions & 25 deletions crates/starknet-devnet-core/src/blocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use indexmap::IndexMap;
use starknet_api::block::{BlockHeader, BlockNumber, BlockStatus, BlockTimestamp};
use starknet_api::data_availability::L1DataAvailabilityMode;
use starknet_api::felt;
use starknet_rs_core::types::{BlockId, BlockTag, Felt};
use starknet_types::contract_address::ContractAddress;
use starknet_types::felt::{BlockHash, TransactionHash};
use starknet_types::rpc::block::{
use starknet_core::types::{BlockId, BlockTag, Felt};
use starknet_devnet_types::contract_address::ContractAddress;
use starknet_devnet_types::felt::{BlockHash, TransactionHash};
use starknet_devnet_types::rpc::block::{
BlockHeader as TypesBlockHeader, PendingBlockHeader as TypesPendingBlockHeader, ResourcePrice,
};
use starknet_types::traits::HashProducer;
use starknet_devnet_types::traits::HashProducer;
use starknet_types_core::hash::{Pedersen, StarkHash};

use crate::constants::{DEVNET_DEFAULT_STARTING_BLOCK_NUMBER, STARKNET_VERSION};
Expand Down Expand Up @@ -302,8 +302,8 @@ impl HashProducer for StarknetBlock {
#[cfg(test)]
mod tests {
use starknet_api::block::{BlockHash, BlockHeader, BlockNumber, BlockStatus};
use starknet_rs_core::types::{BlockId, BlockTag, Felt};
use starknet_types::traits::HashProducer;
use starknet_core::types::{BlockId, BlockTag, Felt};
use starknet_devnet_types::traits::HashProducer;

use super::{StarknetBlock, StarknetBlocks};
use crate::state::state_diff::StateDiff;
Expand Down Expand Up @@ -353,17 +353,13 @@ mod tests {
// latest block returns none, because collection is empty
assert!(
blocks
.block_number_from_block_id(&BlockId::Tag(
starknet_rs_core::types::BlockTag::Latest
))
.block_number_from_block_id(&BlockId::Tag(starknet_core::types::BlockTag::Latest))
.is_none()
);
// pending block returns some
assert!(
blocks
.block_number_from_block_id(&BlockId::Tag(
starknet_rs_core::types::BlockTag::Pending
))
.block_number_from_block_id(&BlockId::Tag(starknet_core::types::BlockTag::Pending))
.is_some()
);

Expand All @@ -380,16 +376,12 @@ mod tests {
assert!(blocks.block_number_from_block_id(&BlockId::Hash(Felt::ONE)).is_none());
assert!(
blocks
.block_number_from_block_id(&BlockId::Tag(
starknet_rs_core::types::BlockTag::Latest
))
.block_number_from_block_id(&BlockId::Tag(starknet_core::types::BlockTag::Latest))
.is_some()
);
assert!(
blocks
.block_number_from_block_id(&BlockId::Tag(
starknet_rs_core::types::BlockTag::Pending
))
.block_number_from_block_id(&BlockId::Tag(starknet_core::types::BlockTag::Pending))
.is_some()
);
assert!(blocks.block_number_from_block_id(&BlockId::Hash(block_hash)).is_some());
Expand Down Expand Up @@ -672,14 +664,12 @@ mod tests {
blocks.get_by_block_id(&BlockId::Hash(block_to_insert.block_hash())).unwrap();
assert!(block_to_insert == extracted_block.clone());

let extracted_block = blocks
.get_by_block_id(&BlockId::Tag(starknet_rs_core::types::BlockTag::Latest))
.unwrap();
let extracted_block =
blocks.get_by_block_id(&BlockId::Tag(starknet_core::types::BlockTag::Latest)).unwrap();
assert!(block_to_insert == extracted_block.clone());

let extracted_block = blocks
.get_by_block_id(&BlockId::Tag(starknet_rs_core::types::BlockTag::Pending))
.unwrap();
let extracted_block =
blocks.get_by_block_id(&BlockId::Tag(starknet_core::types::BlockTag::Pending)).unwrap();
assert!(block_to_insert == extracted_block.clone());

match blocks.get_by_block_id(&BlockId::Number(11)) {
Expand Down
Loading