Skip to content
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

First quint draft that is somewhat complete with consensus, executor, voteKeeper #40

Merged
merged 83 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
6731e80
executor start
josef-widder Oct 25, 2023
ad3f85f
PreCommit function
josef-widder Oct 26, 2023
31505ee
TODOs
josef-widder Oct 26, 2023
f0b2915
line 28 is in the books
josef-widder Oct 26, 2023
e106f7d
prevote, precommit, and timeout done. proposal missing
josef-widder Oct 28, 2023
c7190d2
starting to put things together for state machine
josef-widder Oct 29, 2023
a210f05
a somewhat complete version of the executor logic
josef-widder Oct 29, 2023
e7427b6
state machine, but needs to be debugged
josef-widder Oct 29, 2023
ba7dcdb
moving statemachine. problem with chooseSome
josef-widder Oct 30, 2023
8d0f6c6
it moves
josef-widder Oct 30, 2023
11f50ed
more things moving
josef-widder Oct 30, 2023
17e7584
some problem with bookkeeper
josef-widder Oct 30, 2023
0604c38
more things move
josef-widder Oct 30, 2023
369590f
I have seen a Polka
josef-widder Oct 30, 2023
366324b
cleanup
josef-widder Oct 30, 2023
74ab8b4
cleaning
josef-widder Oct 30, 2023
7a638d3
successful test of statemachine
josef-widder Oct 31, 2023
2a0afc3
before consensus return refactor
josef-widder Oct 31, 2023
a3cb547
first pending event added
josef-widder Oct 31, 2023
ae8fc80
cleaned consensus
josef-widder Oct 31, 2023
4ea7f1b
commit to merge with Manuel's updated votekeeper
josef-widder Oct 31, 2023
ef3afa0
to merge Daniel's comment
josef-widder Oct 31, 2023
c06cb80
executor start
josef-widder Oct 25, 2023
50a9865
PreCommit function
josef-widder Oct 26, 2023
1bebf51
TODOs
josef-widder Oct 26, 2023
fe9f80b
line 28 is in the books
josef-widder Oct 26, 2023
4fc5086
prevote, precommit, and timeout done. proposal missing
josef-widder Oct 28, 2023
33254b3
starting to put things together for state machine
josef-widder Oct 29, 2023
bd0f9d9
a somewhat complete version of the executor logic
josef-widder Oct 29, 2023
53d33ae
state machine, but needs to be debugged
josef-widder Oct 29, 2023
990dbab
moving statemachine. problem with chooseSome
josef-widder Oct 30, 2023
af85baa
it moves
josef-widder Oct 30, 2023
c4eb53f
more things moving
josef-widder Oct 30, 2023
f4baf60
some problem with bookkeeper
josef-widder Oct 30, 2023
6499b75
more things move
josef-widder Oct 30, 2023
ebbdcfa
I have seen a Polka
josef-widder Oct 30, 2023
86303d2
cleanup
josef-widder Oct 30, 2023
e9d18dd
cleaning
josef-widder Oct 30, 2023
074650b
successful test of statemachine
josef-widder Oct 31, 2023
4a6dc1f
before consensus return refactor
josef-widder Oct 31, 2023
b7ce6f3
first pending event added
josef-widder Oct 31, 2023
3fed023
cleaned consensus
josef-widder Oct 31, 2023
9e6f28a
commit to merge with Manuel's updated votekeeper
josef-widder Oct 31, 2023
a1864f9
to merge Daniel's comment
josef-widder Oct 31, 2023
e674e2a
Merge branch 'josef/executor' of github.com:informalsystems/malachite…
josef-widder Oct 31, 2023
db5ee24
addressed Daniel's comments
josef-widder Oct 31, 2023
57fd87a
addressed Daniel's comments and run tests
josef-widder Oct 31, 2023
a82a5a3
completed the timeout test
josef-widder Oct 31, 2023
40564d1
clean up and comments
josef-widder Oct 31, 2023
80a6de0
added checks for increasing round numbers
josef-widder Nov 1, 2023
2dfc4be
added hash function checks
josef-widder Nov 1, 2023
140ea02
valset error thrown in test fixed
josef-widder Nov 3, 2023
56c82dd
added action and logic to get value from the outside into the system
josef-widder Nov 3, 2023
183a321
comments following the discussion on where to put the reponsibility f…
josef-widder Nov 3, 2023
f66d6a4
transformed that executed events into list
josef-widder Nov 6, 2023
77b994f
added an asynchronous execution environment
josef-widder Nov 6, 2023
fb1acda
added round number checks to ProposalMsg
josef-widder Nov 6, 2023
a7e21fd
test for disagreement in asynchronous setting
josef-widder Nov 7, 2023
22507b9
Parameterization of the Asynchronous model
josef-widder Nov 8, 2023
e82759a
Typecheck all Quint specs on CI and run test for `consensustest.qnt`
romac Nov 8, 2023
97086de
Update Specs/Quint/AsyncModels.qnt
josef-widder Nov 8, 2023
ead6a3c
added a type invariant
josef-widder Nov 8, 2023
76218ca
Merge branch 'josef/executor' of github.com:informalsystems/malachite…
josef-widder Nov 8, 2023
d02f187
updated syntax to Quint 0.14.4
josef-widder Nov 8, 2023
f397501
Merge branch 'main' into josef/executor
josef-widder Nov 13, 2023
9fad761
moved bookkeeper statemachine out for modularity
josef-widder Nov 13, 2023
44278fb
Update Quint test job
romac Nov 13, 2023
25133f8
commented a line that failed a test. Need to discuss with Manu
josef-widder Nov 13, 2023
d5456cd
Merge branch 'josef/executor' of github.com:informalsystems/malachite…
josef-widder Nov 13, 2023
5009cd8
Run test on all Quint files
romac Nov 13, 2023
f169987
Use script to run all tests even in the presence of failures
romac Nov 13, 2023
8f62980
fixed the logic and the test for Precommit,Nil
josef-widder Nov 13, 2023
3bb23b5
Merge branch 'josef/executor' of github.com:informalsystems/malachite…
josef-widder Nov 13, 2023
37d4edd
Update Specs/Quint/voteBookkeeperTest.qnt
josef-widder Nov 14, 2023
7e4b8e8
rename files for test CI
josef-widder Nov 14, 2023
e26c2f9
Update .github/workflows/quint.yml
josef-widder Nov 14, 2023
8d39beb
Merge branch 'josef/executor' of github.com:informalsystems/malachite…
josef-widder Nov 14, 2023
c7cec44
renamed one more file with a test
josef-widder Nov 14, 2023
5991bba
module renamed
josef-widder Nov 14, 2023
3945567
start with a test where a process enters round 1 and messages are alr…
josef-widder Nov 14, 2023
15f4a26
added todos
josef-widder Nov 15, 2023
31c2c1f
Merge branch 'main' into josef/executor
josef-widder Nov 15, 2023
98b5c4a
Pass over the votekeeper spec (#69)
hvanz Nov 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/quint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@ jobs:
quint-typecheck:
name: Typecheck
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./Specs/Quint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: npm install -g @informalsystems/quint
- run: npx @informalsystems/quint typecheck consensus.qnt
- run: npx @informalsystems/quint typecheck voteBookkeeper.qnt
- run: bash Scripts/quint-forall.sh typecheck Specs/Quint/*.qnt

quint-test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: npm install -g @informalsystems/quint
- run: bash Scripts/quint-forall.sh test Specs/Quint/*.qnt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romac , CI is complaining about failed tests: I guess we shouldn't run "quint test" on statemachineAsync.qnt as it has some const, and quint complains about "Uninitialized const validator". Indeed, AsyncModels.qnt imports statemachineAsync.qnt and gives values to these consts. Not sure what is the best way to set it up here so that ignores statemachineAsync.qnt.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have change the line to only run test on *Test.qnt and renamed the files that contain tests.

josef-widder marked this conversation as resolved.
Show resolved Hide resolved

48 changes: 48 additions & 0 deletions Scripts/quint-forall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/env bash

BLUE=$(tput setaf 4)
RED=$(tput setaf 1)
RESET=$(tput sgr0)
UNDERLINE=$(tput smul)

# [INFO] message in blue
info()
{
echo "${BLUE}[INFO] $*${RESET}"
}

# [ERROR] message in red
error()
{
echo "${RED}[ERROR] $*${RESET} "
}

# Run `quint $command` on all given files.

cmd="$1"
files=("${@:2}")

if [[ "${#files[@]}" -eq 0 ]]; then
echo "${UNDERLINE}Usage:${RESET} $0 <command> <file> [<file> ...]"
exit 1
fi

failed=0
failed_files=()

for file in "${files[@]}"; do
info "Running: quint $cmd ${UNDERLINE}$file"
if ! npx @informalsystems/quint "$cmd" "$file"; then
failed_files+=("$file")
failed=$((failed + 1))
fi
echo ""
done

if [[ "$failed" -gt 0 ]]; then
error "Failed on $failed files:"
for file in "${failed_files[@]}"; do
error " - ${UNDERLINE}$file"
done
exit 1
fi
81 changes: 81 additions & 0 deletions Specs/Quint/AsyncModels.qnt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// -*- mode: Bluespec; -*-

module AsyncModels {
josef-widder marked this conversation as resolved.
Show resolved Hide resolved

import statemachineAsync(
validators = Set("v1", "v2", "v3", "v4"),
validatorSet = Set("v1", "v2", "v3", "v4").mapBy(x => 1),
Faulty = Set("v1"),
Values = Set("a", "b"),
Rounds = Set(0, 1, 2, 3),
Heights = Set(0) // , 1, 2, 3)
) as N4F1 from "./statemachineAsync"

// quint run --init=N4F1::init --step=N4F1::step --invariant=N4F1::AgreementInv AsyncModels.qnt
// quint run --init=N4F1::init --step=N4F1::step --invariant=N4F1::ConsensusOutputInv AsyncModels.qnt

import statemachineAsync(
validators = Set("v1", "v2", "v3", "v4"),
validatorSet = Set("v1", "v2", "v3", "v4").mapBy(x => 1),
Faulty = Set("v1", "v2"),
Values = Set("a", "b"),
Rounds = Set(0), // , 1, 2, 3)
Heights = Set(0) // , 1, 2, 3)
) as N4F2 from "./statemachineAsync"

// v3 and v4 are correct. v2 is a N4N4F22aulty proposal and proposes diN4N4F22N4N4F22erently to v3 and v4
// this run leads to disagreement
run DisagreementTest = {
N4F2::init
.then(N4F2::valStep("v3"))
.then(N4F2::valStep("v4"))
.then(N4F2::deliverProposal("v3", { height: 0, proposal: "b", round: 0, src: "v2", validRound: -1 }))
.then(N4F2::deliverProposal("v4", { height: 0, proposal: "a", round: 0, src: "v2", validRound: -1 }))
.then(N4F2::valStep("v3"))
.then(N4F2::valStep("v4"))
.then(all{
// they voted diN4F2N4F2erently
assert(N4F2::voteBuffer == Map(
"v3" -> Set({ height: 0, id: "a", round: 0, src: "v4", step: "Prevote" },
{ height: 0, id: "b", round: 0, src: "v3", step: "Prevote" }),
"v4" -> Set({ height: 0, id: "a", round: 0, src: "v4", step: "Prevote" },
{ height: 0, id: "b", round: 0, src: "v3", step: "Prevote" }))),
N4F2::deliverVote("v4", { height: 0, id: "a", round: 0, src: "v1", step: "Prevote" })
})
.then(N4F2::deliverVote("v4", { height: 0, id: "a", round: 0, src: "v2", step: "Prevote" }))
.then(N4F2::deliverVote("v3", { height: 0, id: "b", round: 0, src: "v1", step: "Prevote" }))
.then(N4F2::deliverVote("v3", { height: 0, id: "b", round: 0, src: "v2", step: "Prevote" }))
.then(N4F2::deliverVote("v3", { height: 0, id: "b", round: 0, src: "v3", step: "Prevote" }))
.then(N4F2::deliverVote("v4", { height: 0, id: "a", round: 0, src: "v4", step: "Prevote" }))
.then(N4F2::valStep("v3"))
.then(N4F2::valStep("v3"))
.then(N4F2::valStep("v3"))
.then(N4F2::valStep("v4"))
.then(N4F2::valStep("v4"))
.then(N4F2::valStep("v4"))
.then(all{
// they precommited diN4F2N4F2erently
assert( N4F2::voteBuffer.get("v3").contains({ height: 0, id: "a", round: 0, src: "v4", step: "Precommit" }) and
N4F2::voteBuffer.get("v4").contains({ height: 0, id: "b", round: 0, src: "v3", step: "Precommit" })),
N4F2::deliverVote("v4", { height: 0, id: "a", round: 0, src: "v1", step: "Precommit" }) })
.then(N4F2::deliverVote("v4", { height: 0, id: "a", round: 0, src: "v2", step: "Precommit" }))
.then(N4F2::deliverVote("v3", { height: 0, id: "b", round: 0, src: "v1", step: "Precommit" }))
.then(N4F2::deliverVote("v3", { height: 0, id: "b", round: 0, src: "v2", step: "Precommit" }))
.then(N4F2::valStep("v3"))
.then(N4F2::valStep("v3"))
.then(N4F2::valStep("v4"))
.then(N4F2::valStep("v4"))
.then(all{
assert(N4F2::AgreementInv),
N4F2::deliverVote("v4", { height: 0, id: "a", round: 0, src: "v4", step: "Precommit" }) })
.then(N4F2::deliverVote("v3", { height: 0, id: "b", round: 0, src: "v3", step: "Precommit" }))
.then(N4F2::valStep("v3"))
.then(N4F2::valStep("v4"))
.then(all{
assert(not(N4F2::AgreementInv)),
N4F2::unchangedAll})
}



}
Loading
Loading