-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat!: simulator support #186
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d898472
feat(simulator): start simulator wiring
fmorency 5558615
feat(simulator): progress
fmorency 080d0ad
feat(simulator): set power
fmorency e605186
fix(simulator): lint
fmorency 84f7039
fix: error desc
fmorency 66965c4
feat(simulator): update params, remove validator & fix set power
fmorency 42ff42c
fix: determinism and refactor
fmorency f2b3a4a
fix: lint
fmorency d4eea29
fix(simulator): account keeper only used for testing
fmorency e8fcecf
fix(simulator): set power logic
fmorency 2bebf6a
fix(simulator): remove x/distribution module
fmorency 99307bf
fix(simulator): don't remove last validator
fmorency 5bea544
fix(simulator): balance must be gte two
fmorency 246b3bc
Revert "fix(simulator): remove x/distribution module"
fmorency d5fd045
feat(simulator): antehandler disabling msg withdraw delegator rewards
fmorency 269b688
feat(make): simulation support
fmorency 58ca31d
chore(simulator): parameter file
fmorency 1efeec3
doc(simulator): integration
fmorency dfca838
fix(simulator): lint
fmorency eb4aa4b
ci(simulator): simulator support
fmorency 83cc739
fix: ante check
fmorency d86bb53
deps: sdk v0.50.8
Reecepbcups aa4f188
rm go.work.sum
Reecepbcups 7ff9388
Merge branch 'main' into simulation
Reecepbcups File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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 | ||
# # Requires wiring v2 | ||
# # https://github.com/strangelove-ventures/poa/issues/199 | ||
# - name: Simulation export/import (fixed seed) | ||
# run: make sim-export-import | ||
- 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,4 +20,6 @@ | |
# Depinject debug file | ||
debug_container.dot | ||
|
||
build/ | ||
build/ | ||
|
||
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,38 @@ | ||
package poaante | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
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 { | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically there is a security issue here with authz nested bypasses. but since it is a trusted val set for POA, if someone really does that kinda obvious who did