Skip to content

Commit

Permalink
chore: align blockifier main
Browse files Browse the repository at this point in the history
Signed-off-by: Dori Medini <[email protected]>
  • Loading branch information
dorimedini-starkware authored and alon-dotan-starkware committed Jul 11, 2024
1 parent adeb39b commit bfd6813
Show file tree
Hide file tree
Showing 98 changed files with 91,217 additions and 8,614 deletions.
18 changes: 18 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[env]
# Enforce native_blockifier linking with pypy3.9.
PYO3_PYTHON = "/usr/local/bin/pypy3.9"
# Increase Rust stack size.
# This should be large enough for `MAX_ENTRY_POINT_RECURSION_DEPTH` recursive entry point calls.
RUST_MIN_STACK = "4194304" # 4 MiB

[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
/ci
/data
/logs
build
dist
*.DS_Store
/target
/.vscode
# Git hooks

# Git hooks.
/.husky

# Blockifier venv.
tmp_venv/*

2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Export the native_blockifier built artifact to allow local builds.
exports_files(["target/release/libnative_blockifier.so"])
Empty file added WORKSPACE
Empty file.
14 changes: 14 additions & 0 deletions blockifier.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:20.04

RUN apt update && apt -y install \
build-essential \
clang \
curl \
python3-dev

ENV RUSTUP_HOME=/opt/rust
ENV CARGO_HOME=/opt/rust
ENV PATH=$PATH:/opt/rust/bin

COPY scripts/install_build_tools.sh .
RUN bash install_build_tools.sh
16 changes: 16 additions & 0 deletions build_native_blockifier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/env bash
set -e

docker_image_name=blockifier-ci
docker build . -t ${docker_image_name}

docker run \
--rm \
--net host \
-e CARGO_HOME=${HOME}/.cargo \
-u $UID \
-v /tmp:/tmp \
-v "${HOME}:${HOME}" \
--workdir ${PWD} \
${docker_image_name} \
cargo build --release -p native_blockifier --features "testing"
5 changes: 5 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,24 @@ const Configuration = {
'scope-enum': [2, 'always', [
'base_layer',
'common',
'concurrency',
'config',
'execution',
'fee',
'helm',
'JSON-RPC',
'load_test',
'monitoring',
'native_blockifier',
'network',
'node',
'release',
'starknet_client',
'state',
'storage',
'sync',
'test_utils',
'transaction',
]],
},
/*
Expand Down
12 changes: 9 additions & 3 deletions crates/blockifier/bench/blockifier_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@
//!
//! Run the benchmarks using `cargo bench --bench blockifier_bench`.
use blockifier::test_utils::transfers_generator::TransfersGenerator;
use blockifier::test_utils::transfers_generator::{
RecipientGeneratorType, TransfersGenerator, TransfersGeneratorConfig,
};
use criterion::{criterion_group, criterion_main, Criterion};

pub fn transfers_benchmark(c: &mut Criterion) {
let mut transfers_generator = TransfersGenerator::new();
let transfers_generator_config = TransfersGeneratorConfig {
recipient_generator_type: RecipientGeneratorType::Random,
..Default::default()
};
let mut transfers_generator = TransfersGenerator::new(transfers_generator_config);
// Create a benchmark group called "transfers", which iterates over the accounts round-robin
// and performs transfers.
c.bench_function("transfers", |benchmark| {
benchmark.iter(|| {
transfers_generator.execute_chunk_of_transfers();
transfers_generator.execute_transfers();
})
});
}
Expand Down
Loading

0 comments on commit bfd6813

Please sign in to comment.