diff --git a/crates/blockifier/feature_contracts/cairo1/account_faulty.cairo b/crates/blockifier/feature_contracts/cairo1/account_faulty.cairo index 76e9b1e6b4..682806a488 100644 --- a/crates/blockifier/feature_contracts/cairo1/account_faulty.cairo +++ b/crates/blockifier/feature_contracts/cairo1/account_faulty.cairo @@ -26,12 +26,16 @@ mod Account { const GET_BLOCK_HASH: felt252 = 3; // Use get_execution_info syscall. const GET_EXECUTION_INFO: felt252 = 4; + // Write to the storage. + const STORAGE_WRITE: felt252 = 8; // get_selector_from_name('foo'). const FOO_ENTRY_POINT_SELECTOR: felt252 = ( 0x1b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d ); + const STORAGE_WRITE_KEY: felt252 = 15; + #[storage] struct Storage { } @@ -80,6 +84,16 @@ mod Account { selector: felt252, calldata: Array ) -> felt252 { + let tx_info = starknet::get_tx_info().unbox(); + let signature = tx_info.signature; + let scenario = *signature[0_u32]; + + if (scenario == STORAGE_WRITE) { + let key = STORAGE_WRITE_KEY.try_into().unwrap(); + let value: felt252 = *signature[2_u32]; + starknet::syscalls::storage_write_syscall(0, key, value).unwrap_syscall(); + } + let to_address = 0; send_message_to_l1_syscall( @@ -129,6 +143,13 @@ mod Account { return starknet::VALIDATED; } + if (scenario == STORAGE_WRITE) { + let key = STORAGE_WRITE_KEY.try_into().unwrap(); + let value: felt252 = *signature[1_u32]; + starknet::syscalls::storage_write_syscall(0, key, value).unwrap_syscall(); + return starknet::VALIDATED; + } + assert (scenario == GET_EXECUTION_INFO, 'Unknown scenario'); let block_number: felt252 = *signature[1_u32]; diff --git a/crates/blockifier/feature_contracts/cairo1/compiled/account_faulty.casm.json b/crates/blockifier/feature_contracts/cairo1/compiled/account_faulty.casm.json index f7f13f0275..313cc467ab 100644 --- a/crates/blockifier/feature_contracts/cairo1/compiled/account_faulty.casm.json +++ b/crates/blockifier/feature_contracts/cairo1/compiled/account_faulty.casm.json @@ -42,28 +42,28 @@ "0x1", "0x208b7fff7fff7ffe", "0x1104800180018000", - "0x684", + "0x7c1", "0x482480017fff8000", - "0x683", + "0x7c0", "0x480080007fff8000", "0xa0680017fff8000", "0x9", "0x4824800180007ff5", - "0x55a0", + "0x5668", "0x482480017fff8000", "0x100000000000000000000000000000000", "0x400080007ff47fff", "0x10780017fff7fff", "0x21", "0x4824800180007ff5", - "0x55a0", + "0x5668", "0x400080007ff57fff", "0x482480017ff58000", "0x1", "0x48127ffe7fff8000", "0x480a7ffb7fff8000", "0x1104800180018000", - "0x439", + "0x437", "0x20680017fff7ffd", "0xe", "0x40780017fff7fff", @@ -195,21 +195,21 @@ "0x1", "0x208b7fff7fff7ffe", "0x1104800180018000", - "0x5eb", + "0x728", "0x482480017fff8000", - "0x5ea", + "0x727", "0x480080007fff8000", "0xa0680017fff8000", "0x9", "0x4824800180007fed", - "0x5f64", + "0x602c", "0x482480017fff8000", "0x100000000000000000000000000000000", "0x400080007fec7fff", "0x10780017fff7fff", "0x3e", "0x4824800180007fed", - "0x5f64", + "0x602c", "0x400080007fed7fff", "0x480680017fff8000", "0x1", @@ -241,7 +241,7 @@ "0x48127ff87fff8000", "0x480a7ffb7fff8000", "0x1104800180018000", - "0x387", + "0x385", "0x20680017fff7ffd", "0x12", "0x48127ffa7fff8000", @@ -436,7 +436,7 @@ "0x48127ffa7fff8000", "0x480080007ff88000", "0x1104800180018000", - "0x49e", + "0x50d", "0x20680017fff7ffa", "0x72", "0x20680017fff7ffd", @@ -461,21 +461,21 @@ "0x1", "0x208b7fff7fff7ffe", "0x1104800180018000", - "0x4e1", + "0x61e", "0x482480017fff8000", - "0x4e0", + "0x61d", "0x480080007fff8000", "0xa0680017fff8000", "0x9", "0x4824800180007ff3", - "0x972c", + "0x97f4", "0x482480017fff8000", "0x100000000000000000000000000000000", "0x400080007ff07fff", "0x10780017fff7fff", "0x3c", "0x4824800180007ff3", - "0x972c", + "0x97f4", "0x400080007ff17fff", "0x480680017fff8000", "0x0", @@ -496,7 +496,7 @@ "0x482680017ffb8000", "0x7", "0x1104800180018000", - "0x288", + "0x286", "0x20680017fff7ffd", "0xe", "0x40780017fff7fff", @@ -625,13 +625,15 @@ "0x482480017ff98000", "0x1", "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x2", "0xa0680017fff8000", "0x7", "0x482680017ffa8000", "0x100000000000000000000000000000000", "0x400280007ff97fff", "0x10780017fff7fff", - "0xf8", + "0xf4", "0x4825800180007ffa", "0x0", "0x400280007ff97fff", @@ -657,10 +659,11 @@ "0x480680017fff8000", "0x0", "0x20680017fff7ffe", - "0xcd", + "0xc9", + "0x40137fff7fff8000", "0xa0680017fff8004", "0xe", - "0x4824800180047ffe", + "0x4825800180048000", "0x800000000000000000000000000000000000000000000000000000000000000", "0x484480017ffe8000", "0x110000000000000000", @@ -671,10 +674,10 @@ "0xffffffffffffffeeffffffffffffffff", "0x400080027ff47ffd", "0x10780017fff7fff", - "0xbb", + "0xb6", "0x484480017fff8001", "0x8000000000000000000000000000000", - "0x48307fff80007ffd", + "0x48317fff80008000", "0x480080007ff77ffd", "0x480080017ff67ffd", "0x402480017ffc7ffe", @@ -686,7 +689,8 @@ "0x20680017fff7fff", "0x4", "0x10780017fff7fff", - "0x9e", + "0x99", + "0x400180007ff58001", "0x482480017ff58000", "0x1", "0x48127ff57fff8000", @@ -710,7 +714,7 @@ "0x480680017fff8000", "0x0", "0x20680017fff7ffe", - "0x76", + "0x70", "0x40780017fff7fff", "0x1", "0x48127ff67fff8000", @@ -721,11 +725,11 @@ "0x48127ffa7fff8000", "0x480080007ff88000", "0x1104800180018000", - "0x381", + "0x3ec", "0x20680017fff7ffa", - "0x61", - "0x20680017fff7ffd", "0x5b", + "0x20680017fff7ffd", + "0x55", "0x48307ffb80007ffc", "0x20680017fff7fff", "0x4", @@ -746,59 +750,53 @@ "0x1", "0x208b7fff7fff7ffe", "0x1104800180018000", - "0x3c4", + "0x4fd", "0x482480017fff8000", - "0x3c3", + "0x4fc", "0x480080007fff8000", "0xa0680017fff8000", "0x9", "0x4824800180007ff3", - "0x2404", + "0x8f3e", "0x482480017fff8000", "0x100000000000000000000000000000000", "0x400080007ff07fff", "0x10780017fff7fff", - "0x2b", + "0x25", "0x4824800180007ff3", - "0x2404", + "0x8f3e", "0x400080007ff17fff", - "0x480680017fff8000", - "0x0", - "0x482480017ff08000", + "0x482480017ff18000", "0x1", - "0x480680017fff8000", - "0x53656e644d657373616765546f4c31", - "0x400280007ffb7fff", - "0x400280017ffb7ffc", - "0x400280027ffb7ffd", - "0x400280037ffb7ff4", - "0x400280047ffb7ff5", - "0x480280067ffb8000", - "0x20680017fff7fff", - "0x11", + "0x48127ffe7fff8000", + "0x480a7ffb7fff8000", + "0x480a80007fff8000", + "0x480a80017fff8000", + "0x48127ff27fff8000", + "0x48127ff27fff8000", + "0x1104800180018000", + "0x416", + "0x20680017fff7ffd", + "0xe", "0x40780017fff7fff", "0x1", - "0x480680017fff8000", - "0x56414c4944", - "0x400080007ffe7fff", - "0x48127ffb7fff8000", - "0x480280057ffb8000", - "0x482680017ffb8000", - "0x7", + "0x400080007fff7ffe", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x48127ff97fff8000", "0x480680017fff8000", "0x0", - "0x48127ffa7fff8000", - "0x482480017ff98000", + "0x48127ffb7fff8000", + "0x482480017ffa8000", "0x1", "0x208b7fff7fff7ffe", - "0x48127ffd7fff8000", - "0x480280057ffb8000", - "0x482680017ffb8000", - "0x9", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", "0x480680017fff8000", "0x1", - "0x480280077ffb8000", - "0x480280087ffb8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", "0x208b7fff7fff7ffe", "0x40780017fff7fff", "0x1", @@ -925,9 +923,9 @@ "0x1", "0x208b7fff7fff7ffe", "0x1104800180018000", - "0x311", + "0x450", "0x482480017fff8000", - "0x310", + "0x44f", "0x480080007fff8000", "0xa0680017fff8000", "0x9", @@ -1031,21 +1029,21 @@ "0x1", "0x208b7fff7fff7ffe", "0x1104800180018000", - "0x2a7", + "0x3e6", "0x482480017fff8000", - "0x2a6", + "0x3e5", "0x480080007fff8000", "0xa0680017fff8000", "0x9", "0x4824800180007ff3", - "0x5b7c", + "0x5c44", "0x482480017fff8000", "0x100000000000000000000000000000000", "0x400080007ff27fff", "0x10780017fff7fff", "0x39", "0x4824800180007ff3", - "0x5b7c", + "0x5c44", "0x400080007ff37fff", "0x480680017fff8000", "0x1", @@ -1149,7 +1147,7 @@ "0x400380017ffd7ffc", "0x480280037ffd8000", "0x20680017fff7fff", - "0x1ca", + "0x23b", "0x480280047ffd8000", "0x480080017fff8000", "0x480080037fff8000", @@ -1167,7 +1165,7 @@ "0x48307ffe80007ff9", "0x400280007ffb7fff", "0x10780017fff7fff", - "0x1a7", + "0x218", "0x482480017ff98000", "0x1", "0x48307fff80007ffd", @@ -1179,10 +1177,10 @@ "0x20680017fff7ffe", "0xe", "0x40780017fff7fff", - "0x28", - "0x48127fd77fff8000", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x29", + "0x48127fd67fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x0", "0x480680017fff8000", @@ -1195,7 +1193,7 @@ "0x20680017fff7fff", "0x24", "0x40780017fff7fff", - "0x23", + "0x24", "0x480680017fff8000", "0x0", "0x4824800180007fff", @@ -1204,9 +1202,9 @@ "0xe", "0x40780017fff7fff", "0x2", - "0x48127fd77fff8000", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fd67fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x0", "0x480680017fff8000", @@ -1219,9 +1217,9 @@ "0x480680017fff8000", "0x496e76616c6964207363656e6172696f", "0x400080007ffe7fff", - "0x48127fd77fff8000", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fd67fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x1", "0x48127ffa7fff8000", @@ -1233,21 +1231,21 @@ "0x20680017fff7fff", "0x70", "0x40780017fff7fff", - "0x15", + "0x16", "0x480680017fff8000", "0x1", - "0x48307fdf80007fe0", + "0x48307fde80007fdf", "0xa0680017fff8000", "0x6", "0x48307ffe80007ffd", - "0x400080007fe47fff", + "0x400080007fe37fff", "0x10780017fff7fff", "0x54", "0x482480017ffd8000", "0x1", "0x48307fff80007ffd", - "0x400080007fe37fff", - "0x48307ffb7fdb8000", + "0x400080007fe27fff", + "0x48307ffb7fda8000", "0x40780017fff7fff", "0x1", "0x480080007ffe8000", @@ -1258,39 +1256,39 @@ "0x484480017ffe8000", "0x110000000000000000", "0x48307ffe7fff8002", - "0x480080017fdc7ffc", - "0x480080027fdb7ffc", + "0x480080017fdb7ffc", + "0x480080027fda7ffc", "0x402480017ffb7ffd", "0xffffffffffffffeeffffffffffffffff", - "0x400080037fda7ffd", + "0x400080037fd97ffd", "0x10780017fff7fff", "0x2d", "0x484480017fff8001", "0x8000000000000000000000000000000", "0x48307fff80007ffd", - "0x480080017fdd7ffd", - "0x480080027fdc7ffd", + "0x480080017fdc7ffd", + "0x480080027fdb7ffd", "0x402480017ffc7ffe", "0xf8000000000000000000000000000000", - "0x400080037fdb7ffe", + "0x400080037fda7ffe", "0x480680017fff8000", "0x1b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d", - "0x482480017fda8000", + "0x482480017fd98000", "0x4", "0x480680017fff8000", "0x43616c6c436f6e7472616374", - "0x400080007fcf7fff", - "0x400080017fcf7fce", - "0x400080027fcf7ff7", - "0x400080037fcf7ffd", - "0x400080047fcf7ff6", - "0x400080057fcf7ff6", - "0x480080077fcf8000", + "0x400080007fce7fff", + "0x400080017fce7fcd", + "0x400080027fce7ff7", + "0x400080037fce7ffd", + "0x400080047fce7ff6", + "0x400080057fce7ff6", + "0x480080077fce8000", "0x20680017fff7fff", "0xd", "0x48127ffd7fff8000", - "0x480080067fcd8000", - "0x482480017fcc8000", + "0x480080067fcc8000", + "0x482480017fcb8000", "0xa", "0x480680017fff8000", "0x0", @@ -1300,13 +1298,13 @@ "0x56414c4944", "0x208b7fff7fff7ffe", "0x48127ffd7fff8000", - "0x480080067fcd8000", - "0x482480017fcc8000", + "0x480080067fcc8000", + "0x482480017fcb8000", "0xa", "0x480680017fff8000", "0x1", - "0x480080087fca8000", - "0x480080097fc98000", + "0x480080087fc98000", + "0x480080097fc88000", "0x208b7fff7fff7ffe", "0x40780017fff7fff", "0x1", @@ -1315,10 +1313,10 @@ "0x480680017fff8000", "0x4f7074696f6e3a3a756e77726170206661696c65642e", "0x400080007ffe7fff", - "0x482480017fd78000", + "0x482480017fd68000", "0x4", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x1", "0x48127ffa7fff8000", @@ -1332,10 +1330,10 @@ "0x480680017fff8000", "0x496e646578206f7574206f6620626f756e6473", "0x400080007ffe7fff", - "0x482480017fd78000", + "0x482480017fd68000", "0x1", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x1", "0x48127ffa7fff8000", @@ -1347,20 +1345,20 @@ "0x20680017fff7fff", "0x22", "0x40780017fff7fff", - "0x22", + "0x23", "0x480680017fff8000", "0x0", "0x480680017fff8000", "0x476574426c6f636b48617368", - "0x400080007fcf7fff", - "0x400080017fcf7fce", - "0x400080027fcf7ffe", - "0x480080047fcf8000", + "0x400080007fce7fff", + "0x400080017fce7fcd", + "0x400080027fce7ffe", + "0x480080047fce8000", "0x20680017fff7fff", "0xd", - "0x48127fd77fff8000", - "0x480080037fcd8000", - "0x482480017fcc8000", + "0x48127fd67fff8000", + "0x480080037fcc8000", + "0x482480017fcb8000", "0x6", "0x480680017fff8000", "0x0", @@ -1369,79 +1367,192 @@ "0x480680017fff8000", "0x56414c4944", "0x208b7fff7fff7ffe", - "0x48127fd77fff8000", - "0x480080037fcd8000", - "0x482480017fcc8000", + "0x48127fd67fff8000", + "0x480080037fcc8000", + "0x482480017fcb8000", "0x7", "0x480680017fff8000", "0x1", - "0x480080057fca8000", - "0x480080067fc98000", + "0x480080057fc98000", + "0x480080067fc88000", "0x208b7fff7fff7ffe", "0x4824800180007ffb", + "0x8", + "0x20680017fff7fff", + "0x6f", + "0x40780017fff7fff", + "0x14", + "0x480680017fff8000", + "0xf", + "0xa0680017fff8004", + "0xe", + "0x4824800180047ffe", + "0x800000000000000000000000000000000000000000000000000000000000000", + "0x484480017ffe8000", + "0x110000000000000000", + "0x48307ffe7fff8002", + "0x480080007fe27ffc", + "0x480080017fe17ffc", + "0x402480017ffb7ffd", + "0xffffffffffffffeeffffffffffffffff", + "0x400080027fe07ffd", + "0x10780017fff7fff", + "0x4c", + "0x484480017fff8001", + "0x8000000000000000000000000000000", + "0x48307fff80007ffd", + "0x480080007fe37ffd", + "0x480080017fe27ffd", + "0x402480017ffc7ffe", + "0xf8000000000000000000000000000000", + "0x400080027fe17ffe", + "0x480680017fff8000", + "0x1", + "0x48307fd880007fd9", + "0xa0680017fff8000", + "0x6", + "0x48307ffe80007ffd", + "0x400080037fdd7fff", + "0x10780017fff7fff", + "0x2a", + "0x482480017ffd8000", + "0x1", + "0x48307fff80007ffd", + "0x400080037fdc7fff", + "0x48307ffb7fd48000", + "0x480680017fff8000", + "0x0", + "0x480080007ffe8000", + "0x482480017fd98000", + "0x4", + "0x480680017fff8000", + "0x53746f726167655772697465", + "0x400080007fce7fff", + "0x400080017fce7fcd", + "0x400080027fce7ffc", + "0x400080037fce7ff0", + "0x400080047fce7ffd", + "0x480080067fce8000", + "0x20680017fff7fff", + "0xd", + "0x48127ffd7fff8000", + "0x480080057fcc8000", + "0x482480017fcb8000", + "0x7", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x56414c4944", + "0x208b7fff7fff7ffe", + "0x48127ffd7fff8000", + "0x480080057fcc8000", + "0x482480017fcb8000", + "0x9", + "0x480680017fff8000", + "0x1", + "0x480080077fc98000", + "0x480080087fc88000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x5", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e646578206f7574206f6620626f756e6473", + "0x400080007ffe7fff", + "0x482480017fd68000", + "0x4", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x8", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7074696f6e3a3a756e77726170206661696c65642e", + "0x400080007ffe7fff", + "0x482480017fd68000", + "0x3", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x4824800180007ffa", "0x4", "0x20680017fff7fff", "0xc1", "0x480680017fff8000", "0x1", - "0x48307ff280007ff3", + "0x48307ff180007ff2", "0xa0680017fff8000", "0x6", "0x48307ffe80007ffd", - "0x400080007ff77fff", + "0x400080007ff67fff", "0x10780017fff7fff", "0xa7", "0x482480017ffd8000", "0x1", "0x48307fff80007ffd", - "0x400080007ff67fff", - "0x48307ffb7fee8000", + "0x400080007ff57fff", + "0x48307ffb7fed8000", "0x480680017fff8000", "0x2", "0x480080007ffe8000", - "0x48307feb80007fec", + "0x48307fea80007feb", "0xa0680017fff8000", "0x6", "0x48307ffe80007ffc", - "0x400080017ff07fff", + "0x400080017fef7fff", "0x10780017fff7fff", "0x87", "0x482480017ffc8000", "0x1", "0x48307fff80007ffd", - "0x400080017fef7fff", - "0x48307ffa7fe78000", + "0x400080017fee7fff", + "0x48307ffa7fe68000", "0x480680017fff8000", "0x3", "0x480080007ffe8000", - "0x48307fe480007fe5", + "0x48307fe380007fe4", "0xa0680017fff8000", "0x6", "0x48307ffe80007ffc", - "0x400080027fe97fff", + "0x400080027fe87fff", "0x10780017fff7fff", "0x67", "0x482480017ffc8000", "0x1", "0x48307fff80007ffd", - "0x400080027fe87fff", - "0x48307ffa7fe08000", - "0x482480017fe78000", + "0x400080027fe77fff", + "0x48307ffa7fdf8000", + "0x482480017fe68000", "0x3", "0x480080007ffe8000", "0x480680017fff8000", "0x476574457865637574696f6e496e666f", - "0x400080007fdb7fff", - "0x400080017fdb7fda", - "0x480080037fdb8000", + "0x400080007fda7fff", + "0x400080017fda7fd9", + "0x480080037fda8000", "0x20680017fff7fff", "0x4d", - "0x480080047fda8000", + "0x480080047fd98000", "0x480080007fff8000", "0x480080007fff8000", "0x48307fec80007fff", - "0x480080027fd68000", - "0x482480017fd58000", + "0x480080027fd58000", + "0x482480017fd48000", "0x5", "0x480080017ffb8000", "0x480080027ffa8000", @@ -1514,13 +1625,13 @@ "0x40780017fff7fff", "0xc", "0x48127ff07fff8000", - "0x480080027fcd8000", - "0x482480017fcc8000", + "0x480080027fcc8000", + "0x482480017fcb8000", "0x6", "0x480680017fff8000", "0x1", - "0x480080047fca8000", - "0x480080057fc98000", + "0x480080047fc98000", + "0x480080057fc88000", "0x208b7fff7fff7ffe", "0x40780017fff7fff", "0x10", @@ -1529,10 +1640,10 @@ "0x480680017fff8000", "0x496e646578206f7574206f6620626f756e6473", "0x400080007ffe7fff", - "0x482480017fd78000", + "0x482480017fd68000", "0x3", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x1", "0x48127ffa7fff8000", @@ -1546,10 +1657,10 @@ "0x480680017fff8000", "0x496e646578206f7574206f6620626f756e6473", "0x400080007ffe7fff", - "0x482480017fd78000", + "0x482480017fd68000", "0x2", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x1", "0x48127ffa7fff8000", @@ -1563,10 +1674,10 @@ "0x480680017fff8000", "0x496e646578206f7574206f6620626f756e6473", "0x400080007ffe7fff", - "0x482480017fd78000", + "0x482480017fd68000", "0x1", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x1", "0x48127ffa7fff8000", @@ -1580,9 +1691,9 @@ "0x480680017fff8000", "0x556e6b6e6f776e207363656e6172696f", "0x400080007ffe7fff", - "0x48127fd77fff8000", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fd67fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x1", "0x48127ffa7fff8000", @@ -1590,7 +1701,7 @@ "0x1", "0x208b7fff7fff7ffe", "0x40780017fff7fff", - "0x2a", + "0x2b", "0x40780017fff7fff", "0x1", "0x480680017fff8000", @@ -1598,8 +1709,8 @@ "0x400080007ffe7fff", "0x482680017ffb8000", "0x1", - "0x48127fcc7fff8000", - "0x48127fcc7fff8000", + "0x48127fcb7fff8000", + "0x48127fcb7fff8000", "0x480680017fff8000", "0x1", "0x48127ffa7fff8000", @@ -1607,7 +1718,7 @@ "0x1", "0x208b7fff7fff7ffe", "0x40780017fff7fff", - "0x38", + "0x39", "0x480a7ffb7fff8000", "0x480280027ffd8000", "0x482680017ffd8000", @@ -1708,114 +1819,321 @@ "0x48127ff87fff8000", "0x482480017ff78000", "0x1", - "0x208b7fff7fff7ffe" - ], - "bytecode_segment_lengths": [ - 128, - 210, - 285, - 268, - 89, - 161, - 474, - 92 - ], - "hints": [ - [ - 0, - [ - { - "TestLessThanOrEqual": { - "lhs": { - "Immediate": "0x0" - }, - "rhs": { - "Deref": { - "register": "FP", - "offset": -6 - } - }, - "dst": { - "register": "AP", - "offset": 0 - } - } - } - ] - ], - [ - 25, - [ - { - "AllocSegment": { - "dst": { - "register": "AP", - "offset": 0 - } - } - } - ] - ], - [ - 44, - [ - { - "TestLessThanOrEqual": { - "lhs": { - "Immediate": "0x55a0" - }, - "rhs": { - "Deref": { - "register": "AP", - "offset": -10 - } - }, - "dst": { - "register": "AP", - "offset": 0 - } - } - } - ] - ], - [ - 64, - [ - { - "AllocSegment": { - "dst": { - "register": "AP", - "offset": 0 - } - } - } - ] - ], - [ - 84, - [ - { - "AllocSegment": { - "dst": { - "register": "AP", - "offset": 0 - } - } - } - ] - ], - [ - 99, - [ - { - "AllocSegment": { - "dst": { - "register": "AP", - "offset": 0 - } - } - } - ] + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x476574457865637574696f6e496e666f", + "0x400280007ff97fff", + "0x400380017ff97ff8", + "0x480280037ff98000", + "0x20680017fff7fff", + "0xbe", + "0x480280047ff98000", + "0x480080017fff8000", + "0x480080037fff8000", + "0x480080047ffe8000", + "0x480680017fff8000", + "0x0", + "0x480280027ff98000", + "0x482680017ff98000", + "0x5", + "0x480080037ffa8000", + "0x480080047ff98000", + "0x48307ff980007ffa", + "0xa0680017fff8000", + "0x6", + "0x48307ffe80007ff9", + "0x400280007ff77fff", + "0x10780017fff7fff", + "0x9b", + "0x482480017ff98000", + "0x1", + "0x48307fff80007ffd", + "0x400280007ff77fff", + "0x48307ff77ff58000", + "0x480080007fff8000", + "0x4824800180007fff", + "0x8", + "0x482680017ff78000", + "0x1", + "0x20680017fff7ffe", + "0x6a", + "0x480680017fff8000", + "0xf", + "0xa0680017fff8004", + "0xe", + "0x4824800180047ffe", + "0x800000000000000000000000000000000000000000000000000000000000000", + "0x484480017ffe8000", + "0x110000000000000000", + "0x48307ffe7fff8002", + "0x480080007ffa7ffc", + "0x480080017ff97ffc", + "0x402480017ffb7ffd", + "0xffffffffffffffeeffffffffffffffff", + "0x400080027ff87ffd", + "0x10780017fff7fff", + "0x49", + "0x484480017fff8001", + "0x8000000000000000000000000000000", + "0x48307fff80007ffd", + "0x480080007ffb7ffd", + "0x480080017ffa7ffd", + "0x402480017ffc7ffe", + "0xf8000000000000000000000000000000", + "0x400080027ff97ffe", + "0x480680017fff8000", + "0x2", + "0x48307fef80007ff0", + "0xa0680017fff8000", + "0x6", + "0x48307ffe80007ffd", + "0x400080037ff57fff", + "0x10780017fff7fff", + "0x27", + "0x482480017ffd8000", + "0x1", + "0x48307fff80007ffd", + "0x400080037ff47fff", + "0x48307ffb7feb8000", + "0x480680017fff8000", + "0x0", + "0x480080007ffe8000", + "0x482480017ff18000", + "0x4", + "0x480680017fff8000", + "0x53746f726167655772697465", + "0x400080007fe57fff", + "0x400080017fe57fe4", + "0x400080027fe57ffc", + "0x400080037fe57ff0", + "0x400080047fe57ffd", + "0x480080067fe58000", + "0x20680017fff7fff", + "0x8", + "0x48127ffd7fff8000", + "0x480080057fe38000", + "0x482480017fe28000", + "0x7", + "0x10780017fff7fff", + "0x34", + "0x40780017fff7fff", + "0x6", + "0x48127ff77fff8000", + "0x480080057fdd8000", + "0x482480017fdc8000", + "0x9", + "0x480680017fff8000", + "0x1", + "0x480080077fda8000", + "0x480080087fd98000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0xb", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e646578206f7574206f6620626f756e6473", + "0x400080007ffe7fff", + "0x482480017fe88000", + "0x4", + "0x48127fdc7fff8000", + "0x48127fdc7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0xe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7074696f6e3a3a756e77726170206661696c65642e", + "0x400080007ffe7fff", + "0x482480017fe88000", + "0x3", + "0x48127fdc7fff8000", + "0x48127fdc7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x11", + "0x48127fee7fff8000", + "0x48127fe27fff8000", + "0x48127fe27fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x53656e644d657373616765546f4c31", + "0x400080007ffd7fff", + "0x400080017ffd7ffc", + "0x400080027ffd7ffe", + "0x400180037ffd7ffc", + "0x400180047ffd7ffd", + "0x480080067ffd8000", + "0x20680017fff7fff", + "0xd", + "0x48127ffa7fff8000", + "0x480080057ffb8000", + "0x482480017ffa8000", + "0x7", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x56414c4944", + "0x208b7fff7fff7ffe", + "0x48127ffa7fff8000", + "0x480080057ffb8000", + "0x482480017ffa8000", + "0x9", + "0x480680017fff8000", + "0x1", + "0x480080077ff88000", + "0x480080087ff78000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1a", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e646578206f7574206f6620626f756e6473", + "0x400080007ffe7fff", + "0x482680017ff78000", + "0x1", + "0x48127fdc7fff8000", + "0x48127fdc7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x28", + "0x480a7ff77fff8000", + "0x480280027ff98000", + "0x482680017ff98000", + "0x6", + "0x480680017fff8000", + "0x1", + "0x480280047ff98000", + "0x480280057ff98000", + "0x208b7fff7fff7ffe" + ], + "bytecode_segment_lengths": [ + 128, + 210, + 285, + 266, + 89, + 161, + 587, + 92, + 206 + ], + "hints": [ + [ + 0, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 25, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 44, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x5668" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -10 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 64, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 84, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 99, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] ], [ 113, @@ -1871,7 +2189,7 @@ { "TestLessThanOrEqual": { "lhs": { - "Immediate": "0x5f64" + "Immediate": "0x602c" }, "rhs": { "Deref": { @@ -2099,7 +2417,7 @@ { "TestLessThanOrEqual": { "lhs": { - "Immediate": "0x972c" + "Immediate": "0x97f4" }, "rhs": { "Deref": { @@ -2209,7 +2527,7 @@ ] ], [ - 623, + 625, [ { "TestLessThanOrEqual": { @@ -2231,14 +2549,14 @@ ] ], [ - 656, + 659, [ { "TestLessThan": { "lhs": { "Deref": { - "register": "AP", - "offset": -1 + "register": "FP", + "offset": 0 } }, "rhs": { @@ -2253,7 +2571,7 @@ ] ], [ - 660, + 663, [ { "LinearSplit": { @@ -2282,14 +2600,14 @@ ] ], [ - 670, + 673, [ { "LinearSplit": { "value": { "Deref": { - "register": "AP", - "offset": -2 + "register": "FP", + "offset": 0 } }, "scalar": { @@ -2311,7 +2629,7 @@ ] ], [ - 709, + 713, [ { "AllocSegment": { @@ -2324,7 +2642,7 @@ ] ], [ - 729, + 733, [ { "AllocSegment": { @@ -2337,12 +2655,12 @@ ] ], [ - 748, + 752, [ { "TestLessThanOrEqual": { "lhs": { - "Immediate": "0x2404" + "Immediate": "0x8f3e" }, "rhs": { "Deref": { @@ -2359,22 +2677,7 @@ ] ], [ - 771, - [ - { - "SystemCall": { - "system": { - "Deref": { - "register": "FP", - "offset": -5 - } - } - } - } - ] - ], - [ - 774, + 776, [ { "AllocSegment": { @@ -2387,7 +2690,7 @@ ] ], [ - 798, + 796, [ { "AllocSegment": { @@ -2400,7 +2703,7 @@ ] ], [ - 827, + 825, [ { "AllocSegment": { @@ -2413,7 +2716,7 @@ ] ], [ - 841, + 839, [ { "AllocSegment": { @@ -2426,7 +2729,7 @@ ] ], [ - 862, + 860, [ { "AllocSegment": { @@ -2439,7 +2742,7 @@ ] ], [ - 876, + 874, [ { "AllocSegment": { @@ -2452,7 +2755,7 @@ ] ], [ - 891, + 889, [ { "TestLessThanOrEqual": { @@ -2474,7 +2777,7 @@ ] ], [ - 908, + 906, [ { "AllocSegment": { @@ -2487,7 +2790,7 @@ ] ], [ - 927, + 925, [ { "TestLessThanOrEqual": { @@ -2509,7 +2812,7 @@ ] ], [ - 939, + 937, [ { "AllocSegment": { @@ -2522,7 +2825,7 @@ ] ], [ - 950, + 948, [ { "AllocSegment": { @@ -2535,7 +2838,7 @@ ] ], [ - 965, + 963, [ { "AllocSegment": { @@ -2548,7 +2851,7 @@ ] ], [ - 980, + 978, [ { "TestLessThanOrEqual": { @@ -2570,7 +2873,7 @@ ] ], [ - 1014, + 1012, [ { "AllocSegment": { @@ -2583,12 +2886,12 @@ ] ], [ - 1033, + 1031, [ { "TestLessThanOrEqual": { "lhs": { - "Immediate": "0x5b7c" + "Immediate": "0x5c44" }, "rhs": { "Deref": { @@ -2605,7 +2908,7 @@ ] ], [ - 1079, + 1077, [ { "AllocSegment": { @@ -2618,7 +2921,7 @@ ] ], [ - 1097, + 1095, [ { "AllocSegment": { @@ -2631,7 +2934,7 @@ ] ], [ - 1112, + 1110, [ { "AllocSegment": { @@ -2644,7 +2947,7 @@ ] ], [ - 1126, + 1124, [ { "AllocSegment": { @@ -2657,7 +2960,7 @@ ] ], [ - 1145, + 1143, [ { "SystemCall": { @@ -2672,7 +2975,7 @@ ] ], [ - 1160, + 1158, [ { "TestLessThan": { @@ -2697,7 +3000,7 @@ ] ], [ - 1212, + 1210, [ { "AllocSegment": { @@ -2710,7 +3013,7 @@ ] ], [ - 1235, + 1233, [ { "TestLessThan": { @@ -2735,7 +3038,7 @@ ] ], [ - 1246, + 1244, [ { "AllocSegment": { @@ -2748,7 +3051,7 @@ ] ], [ - 1249, + 1247, [ { "TestLessThan": { @@ -2770,7 +3073,7 @@ ] ], [ - 1253, + 1251, [ { "LinearSplit": { @@ -2799,7 +3102,7 @@ ] ], [ - 1263, + 1261, [ { "LinearSplit": { @@ -2828,14 +3131,14 @@ ] ], [ - 1283, + 1281, [ { "SystemCall": { "system": { "Deref": { "register": "AP", - "offset": -49 + "offset": -50 } } } @@ -2843,7 +3146,7 @@ ] ], [ - 1308, + 1306, [ { "AllocSegment": { @@ -2856,7 +3159,7 @@ ] ], [ - 1325, + 1323, [ { "AllocSegment": { @@ -2869,14 +3172,14 @@ ] ], [ - 1353, + 1351, [ { "SystemCall": { "system": { "Deref": { "register": "AP", - "offset": -49 + "offset": -50 } } } @@ -2884,7 +3187,87 @@ ] ], [ - 1383, + 1382, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "AP", + "offset": -1 + } + }, + "rhs": { + "Immediate": "0x800000000000000000000000000000000000000000000000000000000000000" + }, + "dst": { + "register": "AP", + "offset": 4 + } + } + } + ] + ], + [ + 1386, + [ + { + "LinearSplit": { + "value": { + "Deref": { + "register": "AP", + "offset": 3 + } + }, + "scalar": { + "Immediate": "0x110000000000000000" + }, + "max_x": { + "Immediate": "0xffffffffffffffffffffffffffffffff" + }, + "x": { + "register": "AP", + "offset": -2 + }, + "y": { + "register": "AP", + "offset": -1 + } + } + } + ] + ], + [ + 1396, + [ + { + "LinearSplit": { + "value": { + "Deref": { + "register": "AP", + "offset": -2 + } + }, + "scalar": { + "Immediate": "0x8000000000000000000000000000000" + }, + "max_x": { + "Immediate": "0xffffffffffffffffffffffffffffffff" + }, + "x": { + "register": "AP", + "offset": -1 + }, + "y": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1407, [ { "TestLessThan": { @@ -2909,7 +3292,73 @@ ] ], [ - 1398, + 1430, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "AP", + "offset": -50 + } + } + } + } + ] + ], + [ + 1455, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1472, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1494, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "AP", + "offset": -2 + } + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -1 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1509, [ { "TestLessThan": { @@ -2934,7 +3383,7 @@ ] ], [ - 1413, + 1524, [ { "TestLessThan": { @@ -2959,14 +3408,14 @@ ] ], [ - 1431, + 1542, [ { "SystemCall": { "system": { "Deref": { "register": "AP", - "offset": -37 + "offset": -38 } } } @@ -2974,7 +3423,7 @@ ] ], [ - 1463, + 1574, [ { "AllocSegment": { @@ -2987,7 +3436,7 @@ ] ], [ - 1479, + 1590, [ { "AllocSegment": { @@ -3000,7 +3449,7 @@ ] ], [ - 1495, + 1606, [ { "AllocSegment": { @@ -3013,7 +3462,7 @@ ] ], [ - 1522, + 1633, [ { "AllocSegment": { @@ -3026,7 +3475,7 @@ ] ], [ - 1539, + 1650, [ { "AllocSegment": { @@ -3039,7 +3488,7 @@ ] ], [ - 1556, + 1667, [ { "AllocSegment": { @@ -3052,7 +3501,7 @@ ] ], [ - 1573, + 1684, [ { "AllocSegment": { @@ -3065,7 +3514,7 @@ ] ], [ - 1589, + 1700, [ { "AllocSegment": { @@ -3078,7 +3527,7 @@ ] ], [ - 1615, + 1726, [ { "TestLessThanOrEqual": { @@ -3100,7 +3549,221 @@ ] ], [ - 1687, + 1798, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1822, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -7 + } + } + } + } + ] + ], + [ + 1837, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "AP", + "offset": -6 + } + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -1 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1857, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "AP", + "offset": -1 + } + }, + "rhs": { + "Immediate": "0x800000000000000000000000000000000000000000000000000000000000000" + }, + "dst": { + "register": "AP", + "offset": 4 + } + } + } + ] + ], + [ + 1861, + [ + { + "LinearSplit": { + "value": { + "Deref": { + "register": "AP", + "offset": 3 + } + }, + "scalar": { + "Immediate": "0x110000000000000000" + }, + "max_x": { + "Immediate": "0xffffffffffffffffffffffffffffffff" + }, + "x": { + "register": "AP", + "offset": -2 + }, + "y": { + "register": "AP", + "offset": -1 + } + } + } + ] + ], + [ + 1871, + [ + { + "LinearSplit": { + "value": { + "Deref": { + "register": "AP", + "offset": -2 + } + }, + "scalar": { + "Immediate": "0x8000000000000000000000000000000" + }, + "max_x": { + "Immediate": "0xffffffffffffffffffffffffffffffff" + }, + "x": { + "register": "AP", + "offset": -1 + }, + "y": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1882, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "AP", + "offset": -2 + } + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -1 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1905, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "AP", + "offset": -27 + } + } + } + } + ] + ], + [ + 1927, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1944, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 1973, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "AP", + "offset": -3 + } + } + } + } + ] + ], + [ + 1998, [ { "AllocSegment": { @@ -3131,7 +3794,7 @@ }, { "selector": "0x1b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d", - "offset": 891, + "offset": 889, "builtins": [ "range_check" ] @@ -3155,7 +3818,7 @@ "CONSTRUCTOR": [ { "selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", - "offset": 980, + "offset": 978, "builtins": [ "range_check" ] diff --git a/crates/blockifier/src/state/cached_state_test.rs b/crates/blockifier/src/state/cached_state_test.rs index b76f40ef7a..742cec4584 100644 --- a/crates/blockifier/src/state/cached_state_test.rs +++ b/crates/blockifier/src/state/cached_state_test.rs @@ -4,15 +4,25 @@ use assert_matches::assert_matches; use indexmap::indexmap; use pretty_assertions::assert_eq; use rstest::rstest; -use starknet_api::transaction::fields::Fee; -use starknet_api::{class_hash, compiled_class_hash, contract_address, felt, nonce, storage_key}; +use starknet_api::transaction::fields::{Fee, TransactionSignature}; +use starknet_api::{ + class_hash, + compiled_class_hash, + contract_address, + felt, + invoke_tx_args, + nonce, + storage_key, +}; use crate::context::{BlockContext, ChainInfo}; use crate::state::cached_state::*; use crate::test_utils::contracts::FeatureContract; use crate::test_utils::dict_state_reader::DictStateReader; use crate::test_utils::initial_test_state::test_state; -use crate::test_utils::CairoVersion; +use crate::test_utils::{create_calldata, CairoVersion, BALANCE}; +use crate::transaction::test_utils::{account_invoke_tx, STORAGE_WRITE}; +use crate::transaction::transactions::ExecutableTransaction; const CONTRACT_ADDRESS: &str = "0x100"; fn set_initial_state_values( @@ -472,6 +482,48 @@ fn test_state_cache_commit_and_merge( ); } +#[rstest] +#[case(false, felt!("0x7"), felt!("0x8"), false)] +#[case(true, felt!("0x0"), felt!("0x8"), true)] +#[case(true, felt!("0x7"), felt!("0x7"), true)] +#[case(false, felt!("0x0"), felt!("0x8"), false)] +#[case(true, felt!("0x7"), felt!("0x0"), false)] +fn test_write_at_validate_and_execute( + #[case] is_base_empty: bool, + #[case] validate_value: Felt, + #[case] execute_value: Felt, + #[case] charged: bool, +) { + let block_context = BlockContext::create_for_testing(); + let chain_info = &block_context.chain_info; + let faulty_account_feature_contract = FeatureContract::FaultyAccount(CairoVersion::Cairo1); + let contract_address = faulty_account_feature_contract.get_instance_address(0); + let mut state = test_state(chain_info, BALANCE, &[(faulty_account_feature_contract, 1)]); + + if !is_base_empty { + state.set_storage_at(contract_address, 15_u8.into(), felt!("0x1")).unwrap(); + } + let mut transactional_state = TransactionalState::create_transactional(&mut state); + + let signature = + TransactionSignature(vec![Felt::from(STORAGE_WRITE), validate_value, execute_value]); + let invoke_tx = account_invoke_tx(invoke_tx_args! { + signature, + sender_address: contract_address, + calldata: create_calldata(contract_address, "foo", &[]), + }); + let tx_execution_info = + invoke_tx.execute(&mut transactional_state, &block_context, false, true).unwrap(); + let n_allocated_keys = tx_execution_info + .receipt + .resources + .starknet_resources + .state + .state_changes_for_fee + .n_allocated_keys; + assert_eq!(n_allocated_keys > 0, charged); +} + // Test that allocations in validate and execute phases are properly squashed. #[rstest] #[case(false, felt!("0x7"), felt!("0x8"), false)] diff --git a/crates/blockifier/src/transaction/test_utils.rs b/crates/blockifier/src/transaction/test_utils.rs index 07ff2ba797..5d564aeef1 100644 --- a/crates/blockifier/src/transaction/test_utils.rs +++ b/crates/blockifier/src/transaction/test_utils.rs @@ -56,6 +56,7 @@ pub const GET_EXECUTION_INFO: u64 = 4; pub const GET_BLOCK_NUMBER: u64 = 5; pub const GET_BLOCK_TIMESTAMP: u64 = 6; pub const GET_SEQUENCER_ADDRESS: u64 = 7; +pub const STORAGE_WRITE: u64 = 8; /// Test fixtures.