Skip to content

Commit

Permalink
init txs
Browse files Browse the repository at this point in the history
  • Loading branch information
drspacemn committed Oct 3, 2023
1 parent 253d70d commit 0204aab
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ target/
# Snos artifacts
build/*
!build/os_latest.json

# Cairo dependencies
cairo-lang
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "cairo-lang"]
path = cairo-lang
url = https://github.com/starkware-libs/cairo-lang.git
ignore = all
1 change: 0 additions & 1 deletion scripts/setup-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ cairo-compile cairo-lang/src/starkware/starknet/core/os/os.cairo --output build/
cairo-compile tests/programs/different_output.cairo --output build/different_output.json
cairo-compile tests/programs/fact.cairo --output build/fact.json
cairo-compile tests/programs/hint.cairo --output build/hint.json

13 changes: 11 additions & 2 deletions tests/common.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use blockifier::block_context::BlockContext;
use cairo_vm::cairo_run::{cairo_run, CairoRunConfig};
use cairo_vm::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor;
use cairo_vm::vm::runners::cairo_pie::CairoPie;
Expand All @@ -22,6 +23,10 @@ use rstest::*;
use blockifier::execution::contract_class::ContractClassV0;
use blockifier::test_utils::*;

const TOKEN_FOR_TESTING_HASH_0_12_2: &str = "45000d731e6d5ad0023e448dd15cab6f997b04a39120daf56a8816d9f436376";
const DUMMY_ACCOUNT_HASH_0_12_2: &str = "7cea4d7710723fa9e33472b6ceb71587a0ce4997ef486638dd0156bdb6c2daa";
const DUMMY_TOKEN_HASH_0_12_2: &str = "16dc3038da22dde8ad61a786ab9930699cc496c8bccb90d77cc8abee89803f7";
const TESTING_HASH_0_12_2: &str = "7364bafc3d2c56bc84404a6d8be799f533e518b8808bce86395a9442e1e5160";

#[fixture]
pub fn setup_runner() -> (CairoRunner, VirtualMachine) {
Expand Down Expand Up @@ -97,6 +102,8 @@ pub fn sw_compat_config() -> (StarknetGeneralConfig, BlockInfo) {
// StateDiff(address_to_class_hash={1320198688701432534719157742574249187606949535760401890964327160391813649815: 3091807693782130767501414083074324621934995166802976508502430836300051087875, 991941543224299354231458875645971891578962076399384993792970752200863471543: 2876089962371428491550960640645254719239874945228583157550348788822249547409}, nonces={<DataAvailabilityMode.L1: 0>: {1320198688701432534719157742574249187606949535760401890964327160391813649815: 2, 991941543224299354231458875645971891578962076399384993792970752200863471543: 1}}, storage_updates={<DataAvailabilityMode.L1: 0>: {1320198688701432534719157742574249187606949535760401890964327160391813649815: {322990191961554429053868449035526014412279677330895387449703561219527453810: 1464161352, 553060490499374521350519736808313349113904249869887409031913453630132670891: 1320198688701432534719157742574249187606949535760401890964327160391813649815, 27838543048034294391053713572600349634190921977214803311654412455831886488: 168811955464684315858783496655603761152, 482148859801725464274198147480840119334382080162606228723774290742111978842: 170141183460469231731687303715884105728, 877823913686921299048507465990220541161247202424540097559864758276037605753: 18, 1473120764136009396440970107973971969419251478021578277222806501183556393953: 6928249226643520745136808551794, 622991711977806760541268368343056323675924475443734630808231720566777350071: 1329227995784915872903807060280344576, 1267095271664963432194589802007389382906322551387806188627353037007263322258: 1}}}, declared_classes={}, block_info=BlockInfo(block_number=0, block_timestamp=1000, eth_l1_gas_price=100000000, strk_l1_gas_price=0, sequencer_address=443902168967810054148884074756742919510645257800272067493104417962415061304, starknet_version='0.12.3'))
#[rstest]
pub fn setup_snos_data(sw_compat_config: (StarknetGeneralConfig, BlockInfo)) {
let block_context = BlockContext::create_for_testing();
println!("CONTEXT: {:?}", block_context);

// let class_map = HashMap::from([
// (
Expand All @@ -112,8 +119,10 @@ pub fn setup_snos_data(sw_compat_config: (StarknetGeneralConfig, BlockInfo)) {
println!("CONF: {:?}", sw_compat_config.1);
}


// DEPLOY ACCOUNT: InternalDeployAccount(hash_value=22688876470218804543887986415455328819098091743988100398197353790124740200, version=1, max_fee=1267650600228229401496703205376, signature=[], nonce=0, sender_address=1470089414715992704702781317133162679047468004062084455026636858461958198968, contract_address_salt=0, class_hash=3531298130119845387864440863187980726515137569165069484670944625223023734186, constructor_calldata=[])
// DEPLOY TOKEN: InternalInvokeFunction(hash_value=2852915394592604060963909836770256627436576776991723431020681987492769528640, version=1, max_fee=1267650600228229401496703205376, signature=[], nonce=1, sender_address=1470089414715992704702781317133162679047468004062084455026636858461958198968, entry_point_selector=617075754465154585683856897856256838130216341506379215893724690153393808813, entry_point_type=<EntryPointType.EXTERNAL: 0>, calldata=[1470089414715992704702781317133162679047468004062084455026636858461958198968, 232670485425082704932579856502088130646006032362877466777181098476241604910, 3, 2618767603815038378512366346550627731109766804643583016834052353912473402832, 1329227995784915872903807060280344576, 0])
// FUND ACCOUNT: InternalDeployAccount(hash_value=96374521715508826444566467091393680183010464453336720810014746622481735761, version=1, max_fee=1267650600228229401496703205376, signature=[], nonce=0, sender_address=2618767603815038378512366346550627731109766804643583016834052353912473402832, contract_address_salt=0, class_hash=646245114977324210659279014519951538684823368221946044944492064370769527799, constructor_calldata=[])
pub fn load_contract_class_v0(path: &str) -> ContractClassV0 {
let raw_contract_class = fs::read_to_string(path::PathBuf::from(path)).unwrap();
ContractClassV0::try_from_json_string(&raw_contract_class).unwrap()
}
}

0 comments on commit 0204aab

Please sign in to comment.