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

R4R: Slashing, validator set, and governance simulation #1783

Merged
merged 80 commits into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
15a5cd5
Simulate time passing
cwgoes Jul 20, 2018
2a04c04
Print out final height & time
cwgoes Jul 20, 2018
79e870a
Simulate validator set changes
cwgoes Jul 20, 2018
a1ea7cc
Simulate different block loads
cwgoes Jul 20, 2018
727b7bd
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Jul 23, 2018
9c55ec5
Random SigningValidators
cwgoes Jul 23, 2018
782fcd7
Simple random Byzantine evidence
cwgoes Jul 23, 2018
e4d0b17
Option to skip RequestBeginBlock randomization
cwgoes Jul 23, 2018
0f85d6c
Initial genesis validator in simulation
cwgoes Jul 23, 2018
d2709e2
Helpful printouts
cwgoes Jul 23, 2018
6c07f4a
Better load simulation
cwgoes Jul 23, 2018
01264b9
Nicer logs
cwgoes Jul 23, 2018
d7f1553
Linter fixes; 'make format'
cwgoes Jul 23, 2018
738009c
Delay RequestBeginBlock.SigningValidators one block; nicer formatting
cwgoes Jul 24, 2018
b032b8e
Period invariant checks
cwgoes Jul 24, 2018
2bf2c9a
SimulateMsgUnrevoke
cwgoes Jul 24, 2018
e69f7fc
Simulated x/gov msgs, more initially bonded
cwgoes Jul 25, 2018
3a4aed5
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Jul 25, 2018
9a07c07
Linter fixes; 'make format'
cwgoes Jul 25, 2018
be70a21
Somehow nondeterministic
cwgoes Jul 25, 2018
d151988
Debugging contd.
cwgoes Jul 25, 2018
f0cff46
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Jul 25, 2018
5058379
Fix nondeterminism but now we found a bug!
cwgoes Jul 25, 2018
8cacb96
Debugging contd.
cwgoes Jul 26, 2018
d9000fb
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Jul 26, 2018
7a02762
More debugging
cwgoes Jul 26, 2018
ce52253
Debugging contd.
cwgoes Jul 27, 2018
d36d739
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Jul 27, 2018
529b93a
Remove debugging Printfs
cwgoes Jul 27, 2018
14c4642
Debugging contd.
cwgoes Jul 27, 2018
8ccde07
Merge PR #1842: simulation: Use transition matrices for simulating va…
ValarDragon Jul 28, 2018
a2ed2d1
Remove debug Printfs
cwgoes Jul 28, 2018
7fb08f8
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Jul 30, 2018
4036295
Governance simulation contd.
cwgoes Jul 30, 2018
e7a732d
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Jul 31, 2018
2a9061e
dep; make format
cwgoes Jul 31, 2018
462e0cc
NewInt64Coin
cwgoes Jul 31, 2018
afed984
Pass header correctly for slashing
cwgoes Jul 31, 2018
d69107c
Longer timeout; disable inflation
cwgoes Jul 31, 2018
c3b9818
Separate into 'test_sim_modules', 'test_sim_gaia_{fast,slow}'
cwgoes Jul 31, 2018
23d96f0
Misc fixes
cwgoes Jul 31, 2018
fd6594b
Fix teesny-tiny spelling mistake
cwgoes Jul 31, 2018
2163e96
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Jul 31, 2018
416e0d7
Past evidence; events for BeginBlock/EndBlock
cwgoes Aug 1, 2018
9a4a42b
Simplify simulation configuration
cwgoes Aug 1, 2018
dfb81f0
Add module simulation for x/gov
cwgoes Aug 1, 2018
6caaebc
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Aug 1, 2018
b1b7d9d
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Aug 3, 2018
ebd394c
Fix BeginBlock on existing deliverState.ctx
cwgoes Aug 3, 2018
03d9378
Minor cleanup
cwgoes Aug 3, 2018
36aa0af
Cleanup x/gov simulation msgs
cwgoes Aug 3, 2018
d9c1d67
Log proposal EndBlocker events
cwgoes Aug 3, 2018
fadfe87
Update PENDING.md
cwgoes Aug 3, 2018
7b2b989
Minor fixes
cwgoes Aug 3, 2018
73d5028
Correct evidence type
cwgoes Aug 3, 2018
a4c7fa7
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Aug 6, 2018
64a2e5b
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Aug 8, 2018
0a3f610
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Aug 8, 2018
bce3f5d
reduce unnecessarsy verbosity
ValarDragon Aug 9, 2018
75f8f15
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Aug 10, 2018
268c0ac
dep ensure -v -update
cwgoes Aug 10, 2018
f18c01d
Merge PR #1994: Delete install.md
zramsay Aug 13, 2018
1a64c87
Merge PR #1995: upgrading ledger goclient lib
jleni Aug 13, 2018
2b703c9
Merge branch 'develop' into cwgoes/slashing-simulation
cwgoes Aug 13, 2018
b40c9e8
Remove simulation from 'make test_cover'
cwgoes Aug 13, 2018
198f0f3
.ABCIValidator() includes address
cwgoes Aug 13, 2018
f172dd6
Minor fixes
cwgoes Aug 13, 2018
63762e9
Remove from CircleCI test_cover (why is this different)
cwgoes Aug 13, 2018
11ae0f3
Merge branch 'release/v0.24.0' into cwgoes/slashing-simulation
cwgoes Aug 15, 2018
70cc9bd
Update Gopkg.lock
cwgoes Aug 15, 2018
44c5ae7
Change timeout on 'make test_sim_gaia_fast'
cwgoes Aug 15, 2018
4bd01b0
testing...
cwgoes Aug 15, 2018
6e58500
Merge branch 'release/v0.24.0' into cwgoes/slashing-simulation
cwgoes Aug 15, 2018
1e1f337
Some logs for stake bug
cwgoes Aug 15, 2018
c13dd76
Add more debugging
cwgoes Aug 15, 2018
93060d7
Make randomized simulation deterministic from a given seed (#2059)
ValarDragon Aug 16, 2018
54ee496
Update Gopkg.lock
cwgoes Aug 16, 2018
617a503
Zero inflation on stake module test; additional event
cwgoes Aug 16, 2018
169260f
Remove accidental change from develop
cwgoes Aug 16, 2018
eb3e623
Remove printfs for merge into release/v0.24.0
cwgoes Aug 16, 2018
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
30 changes: 24 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
export PATH="$GOBIN:$PATH"
make test_cli

test_sim:
test_sim_modules:
<<: *defaults
parallelism: 1
steps:
Expand All @@ -96,11 +96,26 @@ jobs:
- restore_cache:
key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Test simulation
name: Test individual module simulations
command: |
export PATH="$GOBIN:$PATH"
export GAIA_SIMULATION_SEED=1531897442166404087
make test_sim
make test_sim_modules

test_sim_gaia_fast:
<<: *defaults
parallelism: 1
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v1-pkg-cache
- restore_cache:
key: v1-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Test full Gaia simulation
Copy link
Contributor

@ValarDragon ValarDragon Jul 31, 2018

Choose a reason for hiding this comment

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

Is this a full simulation? If so can this be worded as tests all gaia modules?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It tests them together though, rather than individually (that's test_sim_modules).

command: |
export PATH="$GOBIN:$PATH"
make test_sim_gaia_fast

test_cover:
<<: *defaults
Expand All @@ -118,7 +133,7 @@ jobs:
command: |
export PATH="$GOBIN:$PATH"
make install
for pkg in $(go list github.com/cosmos/cosmos-sdk/... | grep -v github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test | circleci tests split --split-by=timings); do
for pkg in $(go list github.com/cosmos/cosmos-sdk/... | grep -v github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test | grep -v '/simulation' | circleci tests split --split-by=timings); do
id=$(basename "$pkg")
GOCACHE=off go test -timeout 8m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
done
Expand Down Expand Up @@ -161,7 +176,10 @@ workflows:
- test_cli:
requires:
- setup_dependencies
- test_sim:
- test_sim_modules:
requires:
- setup_dependencies
- test_sim_gaia_fast:
requires:
- setup_dependencies
- test_cover:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ FEATURES
- Modules specify invariants and operations, preferably in an x/[module]/simulation package
- Modules can test random combinations of their own operations
- Applications can integrate operations and invariants from modules together for an integrated simulation
- Simulates Tendermint's algorithm for validator set updates
- Simulates validator signing/downtime with a Markov chain, and occaisional double-signatures
- Includes simulated operations & invariants for staking, slashing, governance, and bank modules
- [store] \#1481 Add transient store
- [baseapp] Initialize validator set on ResponseInitChain
- [baseapp] added BaseApp.Seal - ability to seal baseapp parameters once they've been set
Expand Down
51 changes: 26 additions & 25 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,17 @@ test_unit:
test_race:
@go test -race $(PACKAGES_NOSIMULATION)

test_sim:
@echo "Running individual module simulations."
@go test $(PACKAGES_SIMTEST) -v
@echo "Running full Gaia simulation. This may take several minutes."
@echo "Pass the flag 'SimulationSeed' to run with a constant seed."
@echo "Pass the flag 'SimulationNumKeys' to run with the specified number of keys."
@echo "Pass the flag 'SimulationNumBlocks' to run with the specified number of blocks."
@echo "Pass the flag 'SimulationBlockSize' to run with the specified block size (operations per block)."
@go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationBlockSize=200 -v
test_sim_modules:
@echo "Running individual module simulations..."
@go test $(PACKAGES_SIMTEST)

test_sim_gaia_fast:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not able to send a successful SIGINT to this command.

Copy link
Contributor

@ValarDragon ValarDragon Aug 16, 2018

Choose a reason for hiding this comment

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

Good point! We should resolve this, but I strongly think we should get this PR merged, and fix this once its merged. Reviewing / rebasing / etc. is becoming a pain, and it will be much easier to parallelize work once its on develop. Mentioned your point about SIGINT #1924

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just send SIGKILL!

@echo "Running full Gaia simulation. This may take several minutes..."
@go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=1000 -v -timeout 24h

test_sim_gaia_slow:
Copy link
Contributor

Choose a reason for hiding this comment

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

See above.

@echo "Running full Gaia simulation. This may take several minutes..."
@go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=1000 -SimulationVerbose=true -v -timeout 24h

test_cover:
@bash tests/test_cover.sh
Expand Down Expand Up @@ -204,4 +206,4 @@ localnet-stop:
check_tools check_dev_tools get_tools get_dev_tools get_vendor_deps draw_deps test test_cli test_unit \
test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update \
build-linux build-docker-gaiadnode localnet-start localnet-stop \
format check-ledger test_sim update_tools update_dev_tools
format check-ledger test_sim_modules test_sim_gaia_fast test_sim_gaia_slow update_tools update_dev_tools
2 changes: 1 addition & 1 deletion baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg
} else {
// In the first block, app.deliverState.ctx will already be initialized
// by InitChain. Context is now updated with Header information.
app.deliverState.ctx = app.deliverState.ctx.WithBlockHeader(req.Header)
app.deliverState.ctx = app.deliverState.ctx.WithBlockHeader(req.Header).WithBlockHeight(req.Header.Height)
Copy link
Contributor

@ValarDragon ValarDragon Aug 3, 2018

Choose a reason for hiding this comment

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

Should this be fixed on develop through a seperate PR?
EDIT: Nevermind this was just made R4R, i thought it was going to be awhile before that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, it's minor and wasn't caught before since we only hit this case on height 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to the changelog here for now

}

if app.beginBlocker != nil {
Expand Down
Loading