Skip to content

Commit 92412cc

Browse files
26.11.25 Release
26.11.25 Release 2fa67951d2cfc4bb92805e5e22057f33b5203efd
2 parents d143e0e + cb29ebd commit 92412cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2771
-387
lines changed

Public/TestEVM/Builtin/SafeCasting/Default.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
],
55
verify: "C:C.spec",
66
"solc": "solc8.28",
7+
"safe_casting_builtin": true
78
}

Public/TestEVM/Builtin/SafeCasting/expectedDefault.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"safeCasting": {
44
"FAIL": [
55
"complex(int8,int8)",
6+
"narrow(int64)",
67
"noWidth(uint256)"
78
],
89
"SUCCESS": [

Public/TestSolana/CpisTest/Default.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"build_script": "./certora_build.sh",
3-
"java_args": ["-Dlevel.cpi=info"],
3+
"java_args": ["-Dlevel.sbf.cpi=info"],
44
"rule": [
55
"rule_transfer_token_transfers_same_wallet_0",
66
"rule_transfer_token_transfers_same_wallet_1",

Public/TestSolana/CpisTest/src/processor.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use solana_program::{
55
program_error::ProgramError,
66
pubkey::Pubkey,
77
};
8-
98
use spl_token::instruction::{burn, close_account, mint_to, transfer};
109

10+
1111
const SEED1: &[u8] = b"seed1";
1212
const SEED2: &[u8] = b"seed2";
1313
const SEED3: &[u8] = b"seed3";
@@ -29,6 +29,7 @@ pub fn process_transfer_token<const N_SIGNERS: usize>(
2929
Ok(())
3030
}
3131

32+
#[cvlr::early_panic]
3233
fn invoke_transfer_token<'a, const N_SIGNERS: usize>(
3334
token_program: &AccountInfo<'a>,
3435
from: &AccountInfo<'a>,
@@ -87,6 +88,7 @@ pub fn process_mint_token<const N_SIGNERS: usize>(
8788
Ok(())
8889
}
8990

91+
#[cvlr::early_panic]
9092
fn invoke_mint_token<'a, const N_SIGNERS: usize>(
9193
token_program: &AccountInfo<'a>,
9294
mint: &AccountInfo<'a>,
@@ -146,6 +148,7 @@ pub fn process_burn_token<const N_SIGNERS: usize>(
146148
Ok(())
147149
}
148150

151+
#[cvlr::early_panic]
149152
fn invoke_burn_token<'a, const N_SIGNERS: usize>(
150153
token_program: &AccountInfo<'a>,
151154
source: &AccountInfo<'a>,
@@ -198,6 +201,7 @@ pub fn process_close_account<const N_SIGNERS: usize>(
198201
Ok(())
199202
}
200203

204+
#[cvlr::early_panic]
201205
fn invoke_close_account<'a, const N_SIGNERS: usize>(
202206
token_program: &AccountInfo<'a>,
203207
account: &AccountInfo<'a>,
@@ -241,6 +245,7 @@ pub fn process_unknown_program(
241245
Ok(())
242246
}
243247

248+
#[cvlr::early_panic]
244249
fn invoke_unknown_program<'a>(
245250
acc1: &AccountInfo<'a>,
246251
acc2: &AccountInfo<'a>,

lib/Shared/src/main/kotlin/config/Config.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,6 +2267,15 @@ object Config {
22672267
)
22682268
) {}
22692269

2270+
val extraSolanaPatterns = object : ConfigType.BooleanCmdLine(
2271+
true,
2272+
Option(
2273+
"extraSolanaPatterns",
2274+
true,
2275+
"Apply some extra solana rewrite pattern [default=true]"
2276+
)
2277+
) {}
2278+
22702279
val globalInliner = object : ConfigType.IntCmdLine(
22712280
default = 1,
22722281
option = Option(
@@ -2487,6 +2496,15 @@ object Config {
24872496
)
24882497
) {}
24892498

2499+
val SafeCastingBuiltin: ConfigType.BooleanCmdLine = object : ConfigType.BooleanCmdLine(
2500+
false,
2501+
Option(
2502+
"safeCastingBuiltin", true,
2503+
"Used to signal that the python side instrumented the safeCasting builtin rule [default: false]"
2504+
),
2505+
pythonName = "--safe_casting_builtin"
2506+
) {}
2507+
24902508
val CallTraceHardFail = object : ConfigType.HardFailCmdLine(
24912509
HardFailMode.OFF,
24922510
Option(

lib/Shared/src/main/kotlin/log/Logger.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,18 @@ enum class LoggerTypes : LoggerName {
129129
CALLTRACE_STORAGE,
130130
REPORT_UTILS,
131131
SBF,
132-
SBF_SCALAR_ANALYSIS,
133132
SBF_BACKWARD_SCALAR_ANALYSIS,
133+
SBF_CPI,
134+
SBF_MEMORY_ANALYSIS,
135+
SBF_PTA_UNIFY,
136+
SBF_PTA_UNIFY2,
137+
SBF_PTA_COLLAPSES,
138+
SBF_PTA_CELL_RECONSTRUCT,
139+
SBF_PTA_JOIN,
140+
SBF_PTA_LEQ,
141+
SBF_PTA_MEM_TRANSFER,
142+
SBF_SCALAR_ANALYSIS,
143+
SBF_SCALAR_WITH_PREDS_ANALYSIS,
134144
WASM,
135145
WASM_ANALYSIS,
136146
CVLR,
@@ -140,7 +150,6 @@ enum class LoggerTypes : LoggerName {
140150
TWOSTAGE,
141151
FOUNDRY,
142152
DEBUG_SYMBOLS,
143-
CPI,
144153
EQUIVALENCE,
145154
OVERFLOW_PATTERN_REWRITER,
146155
BOUNDED_MODEL_CHECKER,

scripts/CertoraProver/certoraBuild.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,14 +3339,14 @@ def instrument_auto_finders(self, build_arg_contract_file: str, i: int,
33393339
else:
33403340
added_source_finders = {}
33413341

3342-
try:
3343-
casting_instrumentations, casting_types = generate_casting_instrumentation(self.asts, build_arg_contract_file, sdc_pre_finder)
3344-
except Exception as e:
3345-
instrumentation_logger.warning(
3346-
f"Computing casting instrumentation failed for {build_arg_contract_file}: {e}", exc_info=True)
3347-
casting_instrumentations, casting_types = {}, {}
3348-
3349-
instr = CertoraBuildGenerator.merge_dicts_instrumentation(instr, casting_instrumentations)
3342+
if self.context.safe_casting_builtin:
3343+
try:
3344+
casting_instrumentations, casting_types = generate_casting_instrumentation(self.asts, build_arg_contract_file, sdc_pre_finder)
3345+
except Exception as e:
3346+
instrumentation_logger.warning(
3347+
f"Computing casting instrumentation failed for {build_arg_contract_file}: {e}", exc_info=True)
3348+
casting_instrumentations, casting_types = {}, {}
3349+
instr = CertoraBuildGenerator.merge_dicts_instrumentation(instr, casting_instrumentations)
33503350

33513351
abs_build_arg_contract_file = Util.abs_posix_path(build_arg_contract_file)
33523352
if abs_build_arg_contract_file not in instr:
@@ -3401,12 +3401,13 @@ def instrument_auto_finders(self, build_arg_contract_file: str, i: int,
34013401
read_so_far += amt + 1 + to_skip
34023402
output.write(in_file.read(-1))
34033403

3404-
library_name, funcs = casting_types.get(contract_file, ("", list()))
3405-
if len(funcs) > 0:
3406-
output.write(bytes(f"\nlibrary {library_name}" + "{\n", "utf8"))
3407-
for f in funcs:
3408-
output.write(bytes(f, "utf8"))
3409-
output.write(bytes("}\n", "utf8"))
3404+
if self.context.safe_casting_builtin:
3405+
library_name, funcs = casting_types.get(contract_file, ("", list()))
3406+
if len(funcs) > 0:
3407+
output.write(bytes(f"\nlibrary {library_name}" + "{\n", "utf8"))
3408+
for f in funcs:
3409+
output.write(bytes(f, "utf8"))
3410+
output.write(bytes("}\n", "utf8"))
34103411

34113412
new_file = self.to_autofinder_file(build_arg_contract_file)
34123413
self.context.file_to_contract[new_file] = self.context.file_to_contract[

scripts/CertoraProver/certoraContextAttributes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,19 @@ class EvmAttributes(AttrUtil.Attributes):
12021202
disables_build_cache=False,
12031203
)
12041204

1205+
SAFE_CASTING_BUILTIN = AttrUtil.AttributeDefinition(
1206+
arg_type=AttrUtil.AttrArgType.BOOLEAN,
1207+
help_msg="This needs to be set to true for the safeCasting builtin to work",
1208+
default_desc="This needs to be set to true for the safeCasting builtin to work",
1209+
jar_flag='-safeCastingBuiltin',
1210+
argparse_args={
1211+
'action': AttrUtil.STORE_TRUE,
1212+
'default': False
1213+
},
1214+
affects_build_cache_key=True,
1215+
disables_build_cache=False,
1216+
)
1217+
12051218
@classmethod
12061219
def hide_attributes(cls) -> List[str]:
12071220
# do not show these attributes in the help message

scripts/CertoraProver/certoraContextValidator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ def __default_path() -> Path:
238238
check_rule(context)
239239

240240
if context.split_rules and (context.build_only or context.compilation_steps_only):
241-
raise Util.CertoraUserInputError("cannot use 'compilation_steps_only' or 'build_only' with 'split_rules'")
241+
validation_logger.warning("When running with 'compilation_steps_only' or 'build_only', "
242+
"'split_rules' attribute has no effect and will be ignored.")
242243

243244
if context.compilation_steps_only and context.build_only:
244245
raise Util.CertoraUserInputError("cannot use both 'compilation_steps_only' and 'build_only'")

scripts/certoraRun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def run_certora(args: List[str], app: Type[App.CertoraApp] = App.EvmApp,
7474
# Collect and dump configuration layout
7575
collect_and_dump_config_layout(context)
7676

77-
if context.split_rules:
77+
if context.split_rules and not (context.build_only or context.compilation_steps_only):
7878
context.build_only = True
7979
build(context)
8080
context.build_only = False

0 commit comments

Comments
 (0)