-
Notifications
You must be signed in to change notification settings - Fork 115
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: add new a new msg to remove inbound trackers #3469
Open
kingpinXD
wants to merge
10
commits into
develop
Choose a base branch
from
msg-remove-inbound-tracker
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,197
−146
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0b1e609
add new MsgRemoveInboundTracker
kingpinXD d463c68
add changelog
kingpinXD 33f1f7d
Merge branch 'develop' into msg-remove-inbound-tracker
kingpinXD f2e7598
add changelog
kingpinXD dc924c4
add migration script for adding zetachain.zetacore.crosschain.MsgRemo…
kingpinXD e8ad06f
add task for simulation operation
kingpinXD b7be235
update migration script
kingpinXD 8f8eddf
rebase develop
kingpinXD 6649975
rebase develop
kingpinXD d1d962b
write new authorization list
kingpinXD 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
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
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,46 @@ | ||
package v3 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/zeta-chain/node/x/authority/types" | ||
) | ||
|
||
type authorityKeeper interface { | ||
SetAuthorizationList(ctx sdk.Context, list types.AuthorizationList) | ||
GetAuthorizationList(ctx sdk.Context) (val types.AuthorizationList, found bool) | ||
} | ||
|
||
// MigrateStore migrates the authority module state from the consensus version 2 to 3 | ||
func MigrateStore( | ||
ctx sdk.Context, | ||
keeper authorityKeeper, | ||
) error { | ||
// | ||
var ( | ||
authorizationList = types.DefaultAuthorizationsList() | ||
removeInboundAuthorization = types.Authorization{ | ||
MsgUrl: "/zetachain.zetacore.crosschain.MsgRemoveInboundTracker", | ||
AuthorizedPolicy: types.PolicyType_groupEmergency, | ||
} | ||
) | ||
|
||
// Fetch the current authorization list, if found use that instead of default list | ||
al, found := keeper.GetAuthorizationList(ctx) | ||
if found { | ||
authorizationList = al | ||
} | ||
|
||
// Add the new authorization | ||
authorizationList.SetAuthorization(removeInboundAuthorization) | ||
|
||
// Validate the authorization list | ||
err := authorizationList.Validate() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Set the new authorization list | ||
keeper.SetAuthorizationList(ctx, authorizationList) | ||
return nil | ||
} |
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,67 @@ | ||
package v3_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
keepertest "github.com/zeta-chain/node/testutil/keeper" | ||
v3 "github.com/zeta-chain/node/x/authority/migrations/v3" | ||
"github.com/zeta-chain/node/x/authority/types" | ||
) | ||
|
||
func TestMigrateStore(t *testing.T) { | ||
t.Run("update authorization list", func(t *testing.T) { | ||
// Arrange | ||
k, ctx := keepertest.AuthorityKeeper(t) | ||
|
||
list := types.DefaultAuthorizationsList() | ||
list.RemoveAuthorization("/zetachain.zetacore.crosschain.MsgRemoveInboundTracker") | ||
k.SetAuthorizationList(ctx, list) | ||
|
||
// Act | ||
err := v3.MigrateStore(ctx, *k) | ||
|
||
// Assert | ||
require.NoError(t, err) | ||
list, found := k.GetAuthorizationList(ctx) | ||
require.True(t, found) | ||
require.Equal(t, types.DefaultAuthorizationsList(), list) | ||
}) | ||
|
||
t.Run("set default authorization list if list is not found", func(t *testing.T) { | ||
// Arrange | ||
k, ctx := keepertest.AuthorityKeeper(t) | ||
|
||
// Act | ||
err := v3.MigrateStore(ctx, *k) | ||
|
||
// Assert | ||
require.NoError(t, err) | ||
list, found := k.GetAuthorizationList(ctx) | ||
require.True(t, found) | ||
require.Equal(t, types.DefaultAuthorizationsList(), list) | ||
}) | ||
|
||
t.Run("return error list is invalid", func(t *testing.T) { | ||
// Arrange | ||
k, ctx := keepertest.AuthorityKeeper(t) | ||
|
||
k.SetAuthorizationList(ctx, types.AuthorizationList{Authorizations: []types.Authorization{ | ||
{ | ||
MsgUrl: "ABC", | ||
AuthorizedPolicy: types.PolicyType_groupEmergency, | ||
}, | ||
{ | ||
MsgUrl: "ABC", | ||
AuthorizedPolicy: types.PolicyType_groupEmergency, | ||
}, | ||
}}) | ||
|
||
// Act | ||
err := v3.MigrateStore(ctx, *k) | ||
|
||
// Assert | ||
require.Error(t, err) | ||
}) | ||
} |
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.
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.
💡 Verification agent
🧩 Analysis chain
New Command Entry and Markdown Style Consistency
The new command entry for
zetacored tx crosschain remove-inbound-tracker
is well integrated into the command list. Please verify that the anchor link (#zetacored-tx-crosschain-remove-inbound-tracker
) correctly points to the corresponding section. Additionally, the static analysis hint indicates that a hard tab is detected on this line; consider replacing any hard tabs with spaces to adhere to markdownlint guidelines.Proposed diff for hard tab replacement (if applicable):
Error: No shell scripts or web queries found
🏁 Script executed:
Length of output: 2364
Anchor Link Validity and Hard Tab Removal
#zetacored-tx-crosschain-remove-inbound-tracker
correctly points to the corresponding header found at line 10607 in the markdown file.^I
characters). It is recommended to replace these with spaces to comply with markdownlint guidelines.🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
10330-10330: Hard tabs
Column: 96
(MD010, no-hard-tabs)
10331-10331: Hard tabs
Column: 90
(MD010, no-hard-tabs)
10332-10332: Hard tabs
Column: 84
(MD010, no-hard-tabs)
10333-10333: Hard tabs
Column: 100
(MD010, no-hard-tabs)
10334-10334: Hard tabs
Column: 102
(MD010, no-hard-tabs)
10335-10335: Hard tabs
Column: 92
(MD010, no-hard-tabs)
10336-10336: Hard tabs
Column: 84
(MD010, no-hard-tabs)