Skip to content

Commit e0f9c74

Browse files
authored
feat: added ci option (#328)
* feat: added ci option * cleanup
1 parent d1f4868 commit e0f9c74

6 files changed

Lines changed: 53 additions & 9 deletions

File tree

.github/workflows/sui-prover.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ jobs:
130130
git clone https://github.com/asymptotic-code/sui-kit.git sui-kit
131131
132132
cd sui-kit/examples/amm
133-
sui-prover
133+
sui-prover --ci
134134
135135
cd ../showcase
136-
sui-prover
136+
sui-prover --ci
137137
138138
cd ../guide
139-
sui-prover
139+
sui-prover --ci
140140
141141
internal-tests:
142142
# check if prover needed
@@ -229,10 +229,10 @@ jobs:
229229
git clone https://github.com/asymptotic-code/integer-library int-lib
230230
231231
cd int-lib/specs
232-
sui-prover
232+
sui-prover --ci
233233
234234
cd ../specs-bv
235-
sui-prover --no-bv-int-encoding
235+
sui-prover --no-bv-int-encoding --ci
236236
237237
token-distribution-specs:
238238
needs: build-prover
@@ -270,7 +270,7 @@ jobs:
270270
run: |
271271
git clone --depth 1 -b fix/prover_specs https://github.com/asymptotic-code/sui-smart-contracts.git sui-smart-contracts
272272
cd sui-smart-contracts/token-distribution-specs
273-
sui-prover
273+
sui-prover --ci
274274
275275
scallop-bpl-generation:
276276
needs: build-prover
@@ -315,7 +315,7 @@ jobs:
315315
- name: Run
316316
run: |
317317
cd scallop/contracts/specs
318-
sui-prover -g
318+
sui-prover -g --ci
319319
320320
cetus-bpl-generation:
321321
needs: build-prover
@@ -360,4 +360,4 @@ jobs:
360360
- name: Run
361361
run: |
362362
cd cetus/cetus_clmm_specs
363-
sui-prover -g
363+
sui-prover -g --ci

crates/move-prover-boogie-backend/src/boogie_backend/boogie_wrapper.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,17 @@ impl<'env> BoogieWrapper<'env> {
231231
individual_timeout: Option<u64>,
232232
individual_options: Option<String>,
233233
) -> anyhow::Result<BoogieOutput> {
234+
if self.options.ci {
235+
if individual_timeout.is_some() {
236+
println!("Individual Timeout: {:?}", individual_timeout.unwrap());
237+
}
238+
if individual_options.is_some() {
239+
println!(
240+
"Individual Boogie Options: {:?}",
241+
individual_options.clone().unwrap()
242+
);
243+
}
244+
}
234245
let res = self
235246
.call_remote(
236247
boogie_file,
@@ -252,7 +263,20 @@ impl<'env> BoogieWrapper<'env> {
252263
) -> anyhow::Result<BoogieOutput> {
253264
let args = self
254265
.options
255-
.get_boogie_command(boogie_file, individual_options)?;
266+
.get_boogie_command(boogie_file, individual_options.clone())?;
267+
268+
if self.options.ci {
269+
println!("Boogie Execution Command: {}", args.iter().join(" "));
270+
if individual_timeout.is_some() {
271+
println!("Individual Timeout: {:?}", individual_timeout.unwrap());
272+
}
273+
if individual_options.is_some() {
274+
println!(
275+
"Individual Boogie Options: {:?}",
276+
individual_options.unwrap()
277+
);
278+
}
279+
}
256280
info!("running solver");
257281
debug!("command line: {}", args.iter().join(" "));
258282

crates/move-prover-boogie-backend/src/boogie_backend/options.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ pub struct BoogieOptions {
164164
pub sequential_task: bool,
165165
/// Whether to force timeout handling
166166
pub force_timeout: bool,
167+
/// Whether to enable CI mode for continuous integration environments
168+
pub ci: bool,
167169
/// A hard timeout for boogie execution; if the process does not terminate within
168170
/// this time frame, it will be killed. Zero for no timeout.
169171
pub hard_timeout_secs: u64,
@@ -236,6 +238,7 @@ impl Default for BoogieOptions {
236238
spec_no_abort_check_only: false,
237239
func_abort_check_only: false,
238240
no_verify: false,
241+
ci: false,
239242
}
240243
}
241244
}

crates/move-stackless-bytecode/src/function_target_pipeline.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,14 @@ impl FunctionTargetsHolder {
524524
}
525525

526526
if *focus {
527+
if self.prover_options.ci {
528+
func_env.module_env.env.diag(
529+
Severity::Error,
530+
&func_env.get_loc(),
531+
"The 'focus' attribute is restricted in CI mode.",
532+
);
533+
return;
534+
}
527535
self.focus_specs.insert(func_env.get_qualified_id());
528536
} else {
529537
self.no_focus_specs.insert(func_env.get_qualified_id());

crates/move-stackless-bytecode/src/options.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ pub struct ProverOptions {
9494
pub bv_int_encoding: bool,
9595
/// Skip checking spec functions that do not abort
9696
pub skip_spec_no_abort: bool,
97+
/// CI mode
98+
pub ci: bool,
9799
}
98100

99101
// add custom struct for mutation options
@@ -131,6 +133,7 @@ impl Default for ProverOptions {
131133
ban_int_2_bv: false,
132134
bv_int_encoding: true,
133135
skip_spec_no_abort: false,
136+
ci: false,
134137
}
135138
}
136139
}

crates/sui-prover/src/prove.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ pub struct GeneralConfig {
113113
/// Dump control-flow graphs to file
114114
#[clap(name = "stats", long, global = false)]
115115
pub stats: bool,
116+
117+
/// Whether to enable CI mode for continuous integration environments
118+
#[clap(name = "ci", long, global = false)]
119+
pub ci: bool,
116120
}
117121

118122
#[derive(Args, Default)]
@@ -273,6 +277,8 @@ async fn execute_backend_boogie(
273277
options.remote = remote_config.to_config()?;
274278
options.prover.skip_spec_no_abort = general_config.skip_spec_no_abort;
275279
options.backend.force_timeout = general_config.force_timeout;
280+
options.backend.ci = general_config.ci;
281+
options.prover.ci = general_config.ci;
276282

277283
if general_config.explain {
278284
let mut error_writer = Buffer::no_color();

0 commit comments

Comments
 (0)