-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify PeerList
with Stainless
#866
Conversation
66aaad7
to
f2739ba
Compare
Good catch, feel free to open a PR to fix this, and make sure to mention there how you figured this out :) |
916cd7f
to
71a2d1e
Compare
Codecov Report
@@ Coverage Diff @@
## master #866 +/- ##
========================================
- Coverage 70.6% 70.5% -0.1%
========================================
Files 203 203
Lines 16303 16343 +40
========================================
+ Hits 11515 11527 +12
- Misses 4788 4816 +28
Continue to review full report at Codecov.
|
Copy the PeerList code as it is, no changes.
7232199
to
75440f9
Compare
Is this PR still relevant in any way? |
This is a first trial to introduce
cargo stainless
and let it run on thePeerList
.Problems that came up:
(won't fix)contracts
crate has a==>
macro feature for implies in specs.contains
instead ofcontains_key
, the Set hasadd
instead ofinsert
. Stainless collection method names epfl-lara/rust-stainless#144self
: 858da86. Spec macro fails onmut self
param epfl-lara/rust-stainless#145mod xx; use xx::*;
and the correspondinguse super::*;
fail as unsupported trees. Allow imports (use
) statements epfl-lara/rust-stainless#146pub fn first(&self) -> Option<&T> { ... }
. Ignore Lifetimes epfl-lara/rust-stainless#147iter().all(...)
. This was easily circumvented by creating some new set methods.stainless::{Set, Map}
, namelyT: Eq + Hash + Clone
, force users that also implement something generic (for example theListSet
) to put the same trait bounds on their implementation. These bounds then create evidence arguments everywhere that are for types that are not extracted. Hence, Stainless fails withmissing dependencies
. Unfortunately, this makes the new runtime implementations forstainless::{Set, Map}
quite unusable.--cfg stainless
) compile with the trait bounds for the runtime version and without them forcargo stainless
. This fails due to the one-crate-only compilation model. Thestainless::{Set, Map}
are outside of the current crate. Could a prelude be the solution to this?Eq + Hash + Clone
and their corresponding evidence args.Findings (Tendermint-related)
replace_faulty_witness
,replace_faulty_primary
only hold if the precondition includes/validates the invariant. Should this be added / was that implicitly assumed?