Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
4aed100
Introduced Stakers model
abi87 Mar 28, 2023
94ddc25
introduced staker generator
abi87 Mar 28, 2023
43cf22a
stakers store model property tests
abi87 Mar 29, 2023
d0ea2a0
chain state property tests
abi87 Mar 30, 2023
245fa58
diff property tests + fix
abi87 Mar 30, 2023
2e9fd5f
reduced code duplication in tests
abi87 Mar 30, 2023
cbd246b
fix insert after delete delegator in diff
abi87 Mar 30, 2023
e7691da
extended test coverage
abi87 Mar 30, 2023
94ecc46
nit
abi87 Mar 30, 2023
cf91599
nit
abi87 Mar 30, 2023
382148d
cleanup
abi87 Mar 30, 2023
8c119d5
wip: stakers storage stateful testing
abi87 Mar 30, 2023
0e48267
wip: more stakers storage stateful testing
abi87 Mar 30, 2023
3bead39
wip: more stakers storage stateful testing
abi87 Mar 31, 2023
f6356f2
wip: more stakers storage stateful testing
abi87 Mar 31, 2023
13c5256
merge fix
abi87 Apr 7, 2023
610b14d
Add BLS benchmarks (#1318)
StephenButtolph Apr 11, 2023
0c6064a
Encode codec version in merkledb (#1313)
Apr 11, 2023
ffc7e42
Expose consensus-app-concurrency (#1322)
StephenButtolph Apr 11, 2023
e8f6abe
Adjust Logic In Merkle DB History (#1310)
dboehm-avalabs Apr 11, 2023
343693f
Fix Concurrency Bug In CommitToParent (#1320)
dboehm-avalabs Apr 11, 2023
f8eb5c3
Cleanup goroutines on health.Stop (#1325)
StephenButtolph Apr 11, 2023
8441a3a
Update versions for v1.10.0 (#1282)
StephenButtolph Apr 11, 2023
6958914
Add benchmark for gRPC GetValidatorSet (#1326)
hexfusion Apr 12, 2023
a924b94
Add checks for database being closed in merkledb; other nits (#1333)
Apr 12, 2023
7d6fda1
nit
abi87 Apr 13, 2023
5a57560
Merge branch 'dev' into stakers_model
abi87 Apr 17, 2023
4be61bb
Merge branch 'dev' into stakers_model
abi87 Apr 20, 2023
45cab8a
Merge branch 'dev' into stakers_model
abi87 Apr 21, 2023
4173c34
Merge branch 'dev' into stakers_model
abi87 Apr 24, 2023
fbd5048
Merge branch 'dev' into stakers_model
abi87 Apr 26, 2023
b3a2fad
Merge branch 'dev' into stakers_model
abi87 May 1, 2023
d6a65e6
Merge branch 'dev' into stakers_model
abi87 May 2, 2023
1f32388
Merge branch 'dev' into stakers_model
abi87 May 3, 2023
30ac9cb
Merge branch 'dev' into stakers_model
abi87 May 4, 2023
cd5cd2b
Merge branch 'dev' into stakers_model
abi87 May 10, 2023
adc5f40
docs
abi87 May 10, 2023
ab56c7f
nit
abi87 May 11, 2023
643e3b2
nits
abi87 May 11, 2023
9c4fa9a
cleanup
abi87 May 11, 2023
c47b72a
Merge branch 'dev' into stakers_model
abi87 May 16, 2023
06bbc5d
Merge branch 'dev' into stakers_model
abi87 May 17, 2023
be9a042
Merge branch 'dev' into stakers_model
abi87 May 18, 2023
273cab4
nit
abi87 May 18, 2023
2acb7ef
Merge branch 'dev' into stakers_model
abi87 May 18, 2023
8030940
Merge branch 'dev' into stakers_model
abi87 May 19, 2023
ff98262
Merge branch 'dev' into stakers_model
abi87 May 20, 2023
68dd0f5
Merge branch 'dev' into stakers_model
abi87 May 23, 2023
c63f3b5
Merge branch 'dev' into stakers_model
abi87 May 24, 2023
1e104db
nits
abi87 May 24, 2023
d6d0a83
nits
abi87 May 24, 2023
e8ad209
reduced code duplication in UTs
abi87 May 24, 2023
7ef586d
nits
abi87 May 24, 2023
7c69f5e
Merge branch 'dev' into stakers_model
abi87 May 25, 2023
42bf741
Merge branch 'dev' into stakers_model
abi87 May 28, 2023
b50c595
Merge branch 'dev' into stakers_model
abi87 May 31, 2023
1229d7c
Merge branch 'dev' into stakers_model
abi87 May 31, 2023
8f7d5b2
Merge branch 'dev' into stakers_model
abi87 Jun 1, 2023
33b7dd9
UT nit
abi87 Jun 1, 2023
340b25c
Merge branch 'dev' into stakers_model
abi87 Jun 6, 2023
2a57245
Merge branch 'dev' into stakers_model
abi87 Jun 8, 2023
40719d9
Merge branch 'dev' into stakers_model
abi87 Jun 9, 2023
054a4d2
Merge branch 'dev' into stakers_model
abi87 Jun 11, 2023
92db303
Merge branch 'dev' into stakers_model
abi87 Jun 13, 2023
5725cbc
Merge branch 'dev' into stakers_model
abi87 Jun 13, 2023
e2f4922
Merge branch 'dev' into stakers_model
abi87 Jun 13, 2023
6604f38
Merge branch 'dev' into stakers_model
abi87 Jun 14, 2023
c5941a8
appease linter
abi87 Jun 14, 2023
99041e5
Merge branch 'dev' into stakers_model
abi87 Jun 15, 2023
c47f410
Merge branch 'dev' into stakers_model
abi87 Jun 15, 2023
b6b8e9f
Merge branch 'dev' into stakers_model
abi87 Jun 16, 2023
8177cd0
Merge branch 'dev' into stakers_model
abi87 Jun 19, 2023
59de7f1
nit
abi87 Jun 19, 2023
73a8117
nit
abi87 Jun 19, 2023
6253862
Merge branch 'dev' into stakers_model
abi87 Jun 19, 2023
5fbeab9
nits
abi87 Jun 19, 2023
628b5c6
wip: restructuring stakers generators
abi87 Jun 20, 2023
07fdd6f
Merge branch 'dev' into stakers_model
abi87 Jun 28, 2023
564098a
nits
abi87 Jun 28, 2023
4ed0ec6
extended property tests with state rebuild checks
abi87 Jun 28, 2023
79f78c2
nits
abi87 Jun 28, 2023
e28dc21
Merge branch 'dev' into stakers_model
abi87 Jun 28, 2023
93eb13e
Merge branch 'dev' into stakers_model
abi87 Jun 29, 2023
157bc5f
Merge branch 'dev' into stakers_model
abi87 Jun 30, 2023
8ff47f5
Merge branch 'dev' into stakers_model
abi87 Jul 3, 2023
afb6296
skewed stakers property tests towards primary network + more fixes
abi87 Jul 5, 2023
f3281bc
fixed storage ops
abi87 Jul 6, 2023
4929d31
nit
abi87 Jul 6, 2023
52319b2
Merge branch 'dev' into stakers_model
abi87 Jul 6, 2023
1a136c5
nits
abi87 Jul 6, 2023
c220b51
fixed UTs data race
abi87 Jul 6, 2023
8fcfb76
nit
abi87 Jul 7, 2023
940dbe3
Merge branch 'dev' into stakers_model
abi87 Jul 7, 2023
1c5de0c
Merge branch 'dev' into stakers_model
abi87 Jul 10, 2023
44ed635
Merge branch 'dev' into stakers_model
abi87 Jul 10, 2023
62ab0b5
Merge branch 'dev' into stakers_model
abi87 Jul 11, 2023
90bbe95
Merge branch 'dev' into stakers_model
abi87 Jul 13, 2023
6ac3131
Merge branch 'dev' into stakers_model
abi87 Jul 14, 2023
bae62c9
Merge branch 'dev' into stakers_model
abi87 Jul 19, 2023
9a3e581
Merge branch 'dev' into stakers_model
abi87 Jul 20, 2023
d5177d9
Merge branch 'dev' into stakers_model
abi87 Jul 21, 2023
f006058
Merge branch 'dev' into stakers_model
abi87 Jul 22, 2023
ddb8cdb
Merge branch 'dev' into stakers_model
abi87 Jul 24, 2023
55587c8
Merge branch 'dev' into stakers_model
abi87 Jul 25, 2023
c85f8c1
Merge branch 'dev' into stakers_model
abi87 Jul 26, 2023
aa5e002
Merge branch 'dev' into stakers_model
abi87 Jul 27, 2023
10ac9cb
Merge branch 'dev' into stakers_model
abi87 Jul 28, 2023
4a8d459
Merge branch 'dev' into stakers_model
abi87 Aug 7, 2023
f3a9949
Merge branch 'dev' into stakers_model
abi87 Aug 9, 2023
122ae78
Merge branch 'dev' into stakers_model
abi87 Aug 11, 2023
cf49870
Merge branch 'dev' into stakers_model
abi87 Aug 14, 2023
9f38091
Merge branch 'dev' into stakers_model
abi87 Aug 16, 2023
87abc10
dropped unreachable code
abi87 Aug 16, 2023
5ad376f
Merge branch 'dev' into stakers_model
abi87 Aug 21, 2023
adac490
Merge branch 'dev' into stakers_model
abi87 Aug 22, 2023
b0fc46d
Merge branch 'dev' into stakers_model
abi87 Aug 24, 2023
00d63f9
Merge branch 'dev' into stakers_model
abi87 Aug 25, 2023
24aa9ca
Merge branch 'dev' into stakers_model
abi87 Aug 29, 2023
fe720f6
Merge branch 'dev' into stakers_model
abi87 Aug 30, 2023
c1216ab
Merge branch 'dev' into stakers_model
abi87 Aug 31, 2023
eecf423
Merge branch 'dev' into stakers_model
abi87 Sep 4, 2023
c2c6bc4
Merge branch 'dev' into stakers_model
abi87 Sep 6, 2023
ae79f52
Merge branch 'dev' into stakers_model
abi87 Sep 11, 2023
599ebaa
Merge branch 'dev' into stakers_model
abi87 Sep 12, 2023
7cd0606
appease linter
abi87 Sep 14, 2023
fd32154
Merge branch 'dev' into stakers_model
abi87 Sep 14, 2023
b5fa9a3
Merge branch 'dev' into stakers_model
abi87 Sep 18, 2023
3cbf840
Merge branch 'dev' into stakers_model
abi87 Sep 20, 2023
31c680a
Merge branch 'dev' into stakers_model
abi87 Sep 21, 2023
2f43c45
Merge branch 'dev' into stakers_model
abi87 Sep 29, 2023
84669e6
Merge branch 'dev' into stakers_model
abi87 Oct 4, 2023
e4d9f04
Merge branch 'dev' into stakers_model
abi87 Oct 6, 2023
0300469
Merge branch 'dev' into stakers_model
abi87 Oct 11, 2023
10f6c52
Merge branch 'dev' into stakers_model
abi87 Oct 15, 2023
b4346f7
Merge branch 'dev' into stakers_model
abi87 Oct 17, 2023
d57e692
Merge branch 'dev' into stakers_model
abi87 Oct 17, 2023
460046e
Merge branch 'dev' into stakers_model
abi87 Oct 18, 2023
2cac774
Merge branch 'dev' into stakers_model
abi87 Oct 25, 2023
801e2ea
fixed merge
abi87 Oct 25, 2023
2255c6e
Merge remote-tracking branch 'upstream/dev' into stakers_model
Oct 27, 2023
acd1e7f
Merge branch 'dev' into stakers_model
abi87 Oct 29, 2023
0427428
Merge branch 'dev' into stakers_model
abi87 Nov 2, 2023
d744fbf
Merge remote-tracking branch 'upstream/dev' into stakers_model
Nov 3, 2023
3c88bb7
Merge branch 'stakers_model' of github.com:ava-labs/avalanchego into …
Nov 3, 2023
c3750f3
Merge branch 'dev' into stakers_model
abi87 Nov 13, 2023
879e2b6
Merge branch 'dev' into stakers_model
abi87 Jan 3, 2024
9b9f802
Merge branch 'dev' into stakers_model
abi87 Jan 3, 2024
4392421
Merge branch 'dev' into stakers_model
abi87 Jan 5, 2024
267bd34
Merge branch 'dev' into stakers_model
abi87 Jan 8, 2024
f5cb8ab
Merge branch 'dev' into stakers_model
abi87 Jan 12, 2024
0c51db3
Merge branch 'dev' into stakers_model
abi87 Jan 18, 2024
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
Prev Previous commit
Next Next commit
fixed storage ops
  • Loading branch information
abi87 committed Jul 6, 2023
commit f3281bcb8b48df963aaded1ca80f1291941d454a
163 changes: 70 additions & 93 deletions vms/platformvm/state/stakers_model_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ var (
_ commands.Command = (*putCurrentDelegatorCommand)(nil)
_ commands.Command = (*deleteCurrentDelegatorCommand)(nil)
_ commands.Command = (*addTopDiffCommand)(nil)
_ commands.Command = (*applyBottomDiffCommand)(nil)
_ commands.Command = (*commitBottomStateCommand)(nil)
_ commands.Command = (*applyAndCommitBottomDiffCommand)(nil)
_ commands.Command = (*rebuildStateCommand)(nil)

commandsCtx = buildStateCtx()
Expand Down Expand Up @@ -195,18 +194,20 @@ var stakersCommands = &commands.ProtoCommands{
genDeleteCurrentDelegatorCommand,

genAddTopDiffCommand,
genApplyBottomDiffCommand,
genCommitBottomStateCommand,
genApplyAndCommitBottomDiffCommand,
genRebuildStateCommand,
)
},
}

// PutCurrentValidator section
type putCurrentValidatorCommand txs.Tx
type putCurrentValidatorCommand struct {
sTx *txs.Tx
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the randomly generated stakerTx to be inserted

err error
}

func (v *putCurrentValidatorCommand) Run(sut commands.SystemUnderTest) commands.Result {
sTx := (*txs.Tx)(v)
func (cmd *putCurrentValidatorCommand) Run(sut commands.SystemUnderTest) commands.Result {
sTx := cmd.sTx
sys := sut.(*sysUnderTest)

stakerTx := sTx.Unsigned.(txs.StakerTx)
Expand All @@ -221,8 +222,8 @@ func (v *putCurrentValidatorCommand) Run(sut commands.SystemUnderTest) commands.
return sys
}

func (v *putCurrentValidatorCommand) NextState(cmdState commands.State) commands.State {
sTx := (*txs.Tx)(v)
func (cmd *putCurrentValidatorCommand) NextState(cmdState commands.State) commands.State {
sTx := cmd.sTx
stakerTx := sTx.Unsigned.(txs.StakerTx)
currentVal, err := NewCurrentStaker(sTx.ID(), stakerTx, uint64(1000))
if err != nil {
Expand All @@ -238,20 +239,25 @@ func (*putCurrentValidatorCommand) PreCondition(commands.State) bool {
return true
}

func (*putCurrentValidatorCommand) PostCondition(cmdState commands.State, res commands.Result) *gopter.PropResult {
func (cmd *putCurrentValidatorCommand) PostCondition(cmdState commands.State, res commands.Result) *gopter.PropResult {
if cmd.err != nil {
cmd.err = nil // reset for next runs
return &gopter.PropResult{Status: gopter.PropFalse}
}

if !checkSystemAndModelContent(cmdState, res) {
return &gopter.PropResult{Status: gopter.PropFalse}
}

return &gopter.PropResult{Status: gopter.PropTrue}
}

func (v *putCurrentValidatorCommand) String() string {
stakerTx := v.Unsigned.(txs.StakerTx)
return fmt.Sprintf("PutCurrentValidator(subnetID: %v, nodeID: %v, txID: %v, priority: %v, unixStartTime: %v, duration: %v)",
func (cmd *putCurrentValidatorCommand) String() string {
stakerTx := cmd.sTx.Unsigned.(txs.StakerTx)
return fmt.Sprintf("\nputCurrentValidator(subnetID: %v, nodeID: %v, txID: %v, priority: %v, unixStartTime: %v, duration: %v)",
stakerTx.SubnetID(),
stakerTx.NodeID(),
v.TxID,
cmd.sTx.TxID,
stakerTx.CurrentPriority(),
stakerTx.StartTime().Unix(),
stakerTx.EndTime().Sub(stakerTx.StartTime()),
Expand All @@ -265,7 +271,10 @@ var genPutCurrentValidatorCommand = addPermissionlessValidatorTxGenerator(comman
panic(fmt.Errorf("failed signing tx, %w", err))
}

cmd := (*putCurrentValidatorCommand)(sTx)
cmd := &putCurrentValidatorCommand{
sTx: sTx,
err: nil,
}
return cmd
},
)
Expand Down Expand Up @@ -379,7 +388,7 @@ func (cmd *deleteCurrentValidatorCommand) PostCondition(cmdState commands.State,
}

func (*deleteCurrentValidatorCommand) String() string {
return "DeleteCurrentValidator"
return "\ndeleteCurrentValidator"
}

// a trick to force command regeneration at each sampling.
Expand All @@ -392,16 +401,16 @@ var genDeleteCurrentValidatorCommand = gen.IntRange(1, 2).Map(

// PutCurrentDelegator section
type putCurrentDelegatorCommand struct {
sTx txs.Tx
sTx *txs.Tx
err error
}

func (v *putCurrentDelegatorCommand) Run(sut commands.SystemUnderTest) commands.Result {
candidateDelegator := v.sTx
func (cmd *putCurrentDelegatorCommand) Run(sut commands.SystemUnderTest) commands.Result {
candidateDelegator := cmd.sTx
sys := sut.(*sysUnderTest)
err := addCurrentDelegatorInSystem(sys, candidateDelegator.Unsigned)
if err != nil {
v.err = err
cmd.err = err
}
return sys
}
Expand Down Expand Up @@ -455,12 +464,12 @@ func addCurrentDelegatorInSystem(sys *sysUnderTest, candidateDelegatorTx txs.Uns
return nil
}

func (v *putCurrentDelegatorCommand) NextState(cmdState commands.State) commands.State {
candidateDelegator := v.sTx
func (cmd *putCurrentDelegatorCommand) NextState(cmdState commands.State) commands.State {
candidateDelegator := cmd.sTx
model := cmdState.(*stakersStorageModel)
err := addCurrentDelegatorInModel(model, candidateDelegator.Unsigned)
if err != nil {
v.err = err
cmd.err = err
}
return cmdState
}
Expand Down Expand Up @@ -516,9 +525,9 @@ func (*putCurrentDelegatorCommand) PreCondition(commands.State) bool {
return true
}

func (v *putCurrentDelegatorCommand) PostCondition(cmdState commands.State, res commands.Result) *gopter.PropResult {
if v.err != nil {
v.err = nil // reset for next runs
func (cmd *putCurrentDelegatorCommand) PostCondition(cmdState commands.State, res commands.Result) *gopter.PropResult {
if cmd.err != nil {
cmd.err = nil // reset for next runs
return &gopter.PropResult{Status: gopter.PropFalse}
}

Expand All @@ -529,12 +538,12 @@ func (v *putCurrentDelegatorCommand) PostCondition(cmdState commands.State, res
return &gopter.PropResult{Status: gopter.PropTrue}
}

func (v *putCurrentDelegatorCommand) String() string {
stakerTx := v.sTx.Unsigned.(txs.StakerTx)
return fmt.Sprintf("PutCurrentDelegator(subnetID: %v, nodeID: %v, txID: %v, priority: %v, unixStartTime: %v, duration: %v)",
func (cmd *putCurrentDelegatorCommand) String() string {
stakerTx := cmd.sTx.Unsigned.(txs.StakerTx)
return fmt.Sprintf("\nputCurrentDelegator(subnetID: %v, nodeID: %v, txID: %v, priority: %v, unixStartTime: %v, duration: %v)",
stakerTx.SubnetID(),
stakerTx.NodeID(),
v.sTx.TxID,
cmd.sTx.TxID,
stakerTx.CurrentPriority(),
stakerTx.StartTime().Unix(),
stakerTx.EndTime().Sub(stakerTx.StartTime()))
Expand All @@ -548,7 +557,7 @@ var genPutCurrentDelegatorCommand = addPermissionlessDelegatorTxGenerator(comman
}

cmd := &putCurrentDelegatorCommand{
sTx: *sTx,
sTx: sTx,
}
return cmd
},
Expand All @@ -562,12 +571,20 @@ type deleteCurrentDelegatorCommand struct {
func (cmd *deleteCurrentDelegatorCommand) Run(sut commands.SystemUnderTest) commands.Result {
// delete first delegator, if any
sys := sut.(*sysUnderTest)
_, err := deleteCurrentDelegator(sys)
if err != nil {
cmd.err = err
}
return sys // returns sys to allow comparison with state in PostCondition
}

func deleteCurrentDelegator(sys *sysUnderTest) (bool, error) {
// delete first validator, if any
topDiff := sys.getTopChainState()

stakerIt, err := topDiff.GetCurrentStakerIterator()
if err != nil {
cmd.err = err
return sys
return false, err
}

var (
Expand All @@ -583,12 +600,12 @@ func (cmd *deleteCurrentDelegatorCommand) Run(sut commands.SystemUnderTest) comm
}
if !found {
stakerIt.Release()
return sys // no current validator to delete
return false, nil // no current validator to delete
}
stakerIt.Release() // release before modifying stakers collection

topDiff.DeleteCurrentDelegator(delegator)
return sys // returns sys to allow comparison with state in PostCondition
return true, nil
}

func (*deleteCurrentDelegatorCommand) NextState(cmdState commands.State) commands.State {
Expand Down Expand Up @@ -637,7 +654,7 @@ func (cmd *deleteCurrentDelegatorCommand) PostCondition(cmdState commands.State,
}

func (*deleteCurrentDelegatorCommand) String() string {
return "DeleteCurrentDelegator"
return "\ndeleteCurrentDelegator"
}

// a trick to force command regeneration at each sampling.
Expand Down Expand Up @@ -684,7 +701,7 @@ func (cmd *addTopDiffCommand) PostCondition(cmdState commands.State, res command
}

func (*addTopDiffCommand) String() string {
return "AddTopDiffCommand"
return "\naddTopDiffCommand"
}

// a trick to force command regeneration at each sampling.
Expand All @@ -695,75 +712,35 @@ var genAddTopDiffCommand = gen.IntRange(1, 2).Map(
},
)

// applyBottomDiffCommand section
type applyBottomDiffCommand struct {
// applyAndCommitBottomDiffCommand section
type applyAndCommitBottomDiffCommand struct {
err error
}

func (cmd *applyBottomDiffCommand) Run(sut commands.SystemUnderTest) commands.Result {
func (cmd *applyAndCommitBottomDiffCommand) Run(sut commands.SystemUnderTest) commands.Result {
sys := sut.(*sysUnderTest)
_, cmd.err = sys.flushBottomDiff()

return sys
}

func (*applyBottomDiffCommand) NextState(cmdState commands.State) commands.State {
return cmdState // model has no diffs
}

func (*applyBottomDiffCommand) PreCondition(commands.State) bool {
return true
}

func (cmd *applyBottomDiffCommand) PostCondition(cmdState commands.State, res commands.Result) *gopter.PropResult {
if cmd.err != nil {
cmd.err = nil // reset for next runs
return &gopter.PropResult{Status: gopter.PropFalse}
}

if !checkSystemAndModelContent(cmdState, res) {
return &gopter.PropResult{Status: gopter.PropFalse}
if _, err := sys.flushBottomDiff(); err != nil {
cmd.err = err
return sys
}

return &gopter.PropResult{Status: gopter.PropTrue}
}

func (*applyBottomDiffCommand) String() string {
return "ApplyBottomDiffCommand"
}

// a trick to force command regeneration at each sampling.
// gen.Const would not allow it
var genApplyBottomDiffCommand = gen.IntRange(1, 2).Map(
func(int) commands.Command {
return &applyBottomDiffCommand{}
},
)

// commitBottomStateCommand section
type commitBottomStateCommand struct {
err error
}

func (cmd *commitBottomStateCommand) Run(sut commands.SystemUnderTest) commands.Result {
sys := sut.(*sysUnderTest)
err := sys.baseState.Commit()
if err != nil {
if err := sys.baseState.Commit(); err != nil {
cmd.err = err
return sys
}

return sys
}

func (*commitBottomStateCommand) NextState(cmdState commands.State) commands.State {
func (*applyAndCommitBottomDiffCommand) NextState(cmdState commands.State) commands.State {
return cmdState // model has no diffs
}

func (*commitBottomStateCommand) PreCondition(commands.State) bool {
func (*applyAndCommitBottomDiffCommand) PreCondition(commands.State) bool {
return true
}

func (cmd *commitBottomStateCommand) PostCondition(cmdState commands.State, res commands.Result) *gopter.PropResult {
func (cmd *applyAndCommitBottomDiffCommand) PostCondition(cmdState commands.State, res commands.Result) *gopter.PropResult {
if cmd.err != nil {
cmd.err = nil // reset for next runs
return &gopter.PropResult{Status: gopter.PropFalse}
Expand All @@ -776,15 +753,15 @@ func (cmd *commitBottomStateCommand) PostCondition(cmdState commands.State, res
return &gopter.PropResult{Status: gopter.PropTrue}
}

func (*commitBottomStateCommand) String() string {
return "CommitBottomStateCommand"
func (*applyAndCommitBottomDiffCommand) String() string {
return "\napplyAndCommitBottomDiffCommand"
}

// a trick to force command regeneration at each sampling.
// gen.Const would not allow it
var genCommitBottomStateCommand = gen.IntRange(1, 2).Map(
var genApplyAndCommitBottomDiffCommand = gen.IntRange(1, 2).Map(
func(int) commands.Command {
return &commitBottomStateCommand{}
return &applyAndCommitBottomDiffCommand{}
},
)

Expand Down Expand Up @@ -857,7 +834,7 @@ func (cmd *rebuildStateCommand) PostCondition(cmdState commands.State, res comma
}

func (*rebuildStateCommand) String() string {
return "RebuildStateCommand"
return "\nrebuildStateCommand"
}

// a trick to force command regeneration at each sampling.
Expand Down