Skip to content
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: interachain sudo callback refactoring #313

Merged
merged 7 commits into from
Sep 19, 2023

Conversation

swelf19
Copy link
Contributor

@swelf19 swelf19 commented Sep 8, 2023

  • extracted "an executing sudo in cached limited context" into middleware
  • removed redundant "Is it a contract address" checks
  • merge SudoResponse/SudoError/SudoTimeout into single handler
  • added requirement to pay fee to register interchain account

https://github.com/neutron-org/neutron-tests/actions/runs/6196055940

related PRs:
neutron-org/neutron-sdk#112
neutron-org/neutron-dev-contracts#27
neutron-org/neutron-integration-tests#204

@swelf19 swelf19 marked this pull request as ready for review September 15, 2023 10:02
pr0n00gler
pr0n00gler previously approved these changes Sep 15, 2023
Makefile Outdated Show resolved Hide resolved
x/contractmanager/ibc_middleware_test.go Outdated Show resolved Hide resolved
@pr0n00gler pr0n00gler dismissed their stale review September 15, 2023 10:33

I misclicked, it's not approved yet

proto/neutron/interchaintxs/v1/tx.proto Show resolved Hide resolved
x/contractmanager/keeper/failure.go Outdated Show resolved Hide resolved
x/contractmanager/keeper/sudo.go Outdated Show resolved Hide resolved
@@ -20,118 +20,37 @@ func (k Keeper) HasContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress)
return k.wasmKeeper.HasContractInfo(ctx, contractAddress)
Copy link
Contributor

Choose a reason for hiding this comment

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

probably not in scope of this PR, just want to share my observations:

I think we should remove the HasContractInfo method from the contractmanager.Keeper interface for it's just a proxy, no specific logic inside it. this could 1) make the HasContractInfo calls less ambiguous (why do we ask for a contract info from the contractmanager module, not from the wasm one, given the fact it's the wasm module which owns contracts) and 2) simplify contractmanager.Keeper interface, e.g. make it cleaner, more contractmanager module specialisation-oriented

Copy link
Contributor

Choose a reason for hiding this comment

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

another suggestion: I don't see any reasons of SudoKVQueryResult and SudoTxQueryResult in being placed in the contractmanager module. I suggest moving them to the interchainqueries module — to the only place they are used and to the place IMO they belong to in terms of module responsibility and scope

}
k.Logger(ctx).Debug("SudoError: contract not found", "senderAddress", senderAddress)
return nil, fmt.Errorf("%s is not a contract address and not the Transfer module", senderAddress)
func PrepareOpenAckCallbackMessage(details types.OpenAckDetails) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO the PrepareOpenAckCallbackMessage func belongs to the interchaintxs module

Copy link
Contributor

Choose a reason for hiding this comment

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

the PrepareSudoCallbackMessage func also seems not at the right place for me, but I couldn't come up with a better one since it's used by two modules (not by a single one as PrepareOpenAckCallbackMessage). but since they are quite similar, I think we can either keep the both here or find better places for both of them. a better place for PrepareOpenAckCallbackMessage is obvious — interchaintxs module. any ideas on PrepareSudoCallbackMessage?

x/contractmanager/types/module.go Outdated Show resolved Hide resolved
x/contractmanager/types/sudo.go Outdated Show resolved Hide resolved
x/interchaintxs/keeper/keeper.go Outdated Show resolved Hide resolved
x/interchaintxs/keeper/keeper.go Outdated Show resolved Hide resolved
x/interchaintxs/types/params.go Show resolved Hide resolved
@pr0n00gler pr0n00gler merged commit 3675448 into feat/icatx-rework Sep 19, 2023
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants