Skip to content

Commit

Permalink
fix e2e slashing test
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Jul 5, 2024
1 parent 6387998 commit 2ad925d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
7 changes: 3 additions & 4 deletions tests/e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# End-To-End Tests

Multi-chain system tests that run against the demo app.

Run them with:

Run them with:
```shell
make test
```


```
6 changes: 3 additions & 3 deletions x/meshsecurity/contract/out_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

type (
SudoMsg struct {
HandleEpoch *struct{} `json:"handle_epoch,omitempty"`
ValsetUpdate *ValsetUpdate `json:"valset_update,omitempty"`
HandleEpoch *struct{} `json:"handle_epoch,omitempty"`
HandleValsetUpdate *HandleValsetUpdate `json:"handle_valset_update,omitempty"`
}

// Validator alias to wasmVM type
Expand All @@ -27,7 +27,7 @@ type (
}

// ValsetUpdate updates to the active validator set
ValsetUpdate struct {
HandleValsetUpdate struct {
Additions []Validator `json:"additions"`
Removals []ValidatorAddr `json:"removals"`
Updated []Validator `json:"updated"`
Expand Down
4 changes: 2 additions & 2 deletions x/meshsecurity/keeper/valset_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (k Keeper) sendAsync(ctx sdk.Context, op types.PipedValsetOperation, valAdd
// ValsetUpdateReport aggregate all stored changes of the current block. Should be called by an end-blocker.
// The events reported are categorized by type and not time. Conflicting events as Bonded/ Unbonded
// are not supposed to happen within the same block
func (k Keeper) ValsetUpdateReport(ctx sdk.Context) (contract.ValsetUpdate, error) {
func (k Keeper) ValsetUpdateReport(ctx sdk.Context) (contract.HandleValsetUpdate, error) {
var innerErr error
appendValidator := func(set *[]wasmvmtypes.Validator, valAddr sdk.ValAddress) bool {
val, ok := k.Staking.GetValidator(ctx, valAddr)
Expand All @@ -101,7 +101,7 @@ func (k Keeper) ValsetUpdateReport(ctx sdk.Context) (contract.ValsetUpdate, erro
*set = append(*set, valSlash)
return false
}
r := contract.ValsetUpdate{ // init with empty slices for contract that does not handle null or omitted fields
r := contract.HandleValsetUpdate{ // init with empty slices for contract that does not handle null or omitted fields
Additions: make([]contract.Validator, 0),
Removals: make([]contract.ValidatorAddr, 0),
Updated: make([]contract.Validator, 0),
Expand Down
2 changes: 1 addition & 1 deletion x/meshsecurity/keeper/valset_updates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestBuildValsetUpdateReport(t *testing.T) {
got, err := k.ValsetUpdateReport(ctx)
// then
require.NoError(t, err)
exp := contract.ValsetUpdate{
exp := contract.HandleValsetUpdate{
Additions: []contract.Validator{
{
Address: val4.String(),
Expand Down
4 changes: 2 additions & 2 deletions x/meshsecurity/keeper/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func (k Keeper) SendHandleEpoch(ctx sdk.Context, contractAddr sdk.AccAddress) er
}

// SendValsetUpdate submit the valset update report to the virtual staking contract via sudo
func (k Keeper) SendValsetUpdate(ctx sdk.Context, contractAddr sdk.AccAddress, v contract.ValsetUpdate) error {
func (k Keeper) SendValsetUpdate(ctx sdk.Context, contractAddr sdk.AccAddress, v contract.HandleValsetUpdate) error {
msg := contract.SudoMsg{
ValsetUpdate: &v,
HandleValsetUpdate: &v,
}
return k.doSudoCall(ctx, contractAddr, msg)
}
Expand Down

0 comments on commit 2ad925d

Please sign in to comment.