-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into reece/add-authority-to-keeper-admin
- Loading branch information
Showing
32 changed files
with
1,453 additions
and
2,294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
*.pb.go | ||
*.pb.gw.go | ||
*.pulsar.go | ||
*_simulation.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Simulator tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out source | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- name: Full application simulation (fixed seed) | ||
run: make sim-full-app | ||
- name: Simulation after state import (fixed seed) | ||
run: make sim-after-import | ||
- name: Simulation import/export (fixed seed) | ||
run: make sim-import-export | ||
- name: Simulate application state determinism (fixed seed) | ||
run: make sim-app-determinism |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,6 @@ | |
# Depinject debug file | ||
debug_container.dot | ||
|
||
build/\ | ||
build/ | ||
|
||
go.work.sum | ||
go.work.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package poaante | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/x/authz" | ||
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" | ||
|
||
"github.com/strangelove-ventures/poa" | ||
) | ||
|
||
type MsgDisableWithdrawDelegatorRewards struct { | ||
} | ||
|
||
func NewPOADisableWithdrawDelegatorRewards() MsgDisableWithdrawDelegatorRewards { | ||
return MsgDisableWithdrawDelegatorRewards{} | ||
} | ||
|
||
func (mdwr MsgDisableWithdrawDelegatorRewards) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { | ||
currHeight := ctx.BlockHeight() | ||
if currHeight <= 1 { | ||
// allow GenTx to pass | ||
return next(ctx, tx, simulate) | ||
} | ||
|
||
if mdwr.hasWithdrawDelegatorRewardsMsg(tx.GetMsgs()) { | ||
return ctx, poa.ErrWithdrawDelegatorRewardsNotAllowed | ||
} | ||
|
||
return next(ctx, tx, simulate) | ||
} | ||
|
||
func (mdwr MsgDisableWithdrawDelegatorRewards) hasWithdrawDelegatorRewardsMsg(msgs []sdk.Msg) bool { | ||
for _, msg := range msgs { | ||
// authz nested message check (recursive) | ||
if execMsg, ok := msg.(*authz.MsgExec); ok { | ||
msgs, err := execMsg.GetMessages() | ||
if err != nil { | ||
return true | ||
} | ||
|
||
if mdwr.hasWithdrawDelegatorRewardsMsg(msgs) { | ||
return true | ||
} | ||
} | ||
|
||
if _, ok := msg.(*distrtypes.MsgWithdrawDelegatorReward); ok { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.