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

refactor: update icahost to use runtime.Environment #7600

Merged
merged 143 commits into from
Dec 17, 2024

Conversation

damiannolan
Copy link
Member

@damiannolan damiannolan commented Nov 25, 2024

Description

Updates icahost submodule to use runtime.Environment.
Removes storeService, msgRouterService and queryRouterService in favour of embedded appmodule.Environment.

ref: #7712


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Base automatically changed from marko/gomod_change to main December 17, 2024 15:50
if res == nil || res.Value == nil {

if err := m.cdc.Unmarshal(query.Data, msg); err != nil {
return nil, err
Copy link
Member Author

Choose a reason for hiding this comment

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

I think it might be best to return a more "constant" error here if this rpc is intended to be run in OnRecvPacket. Protobuf unmarshalling errors have a possibility to be indeterminate (this was a something found in earlier days of ibc transfer).

cc. @AdityaSripal this is correct, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I think this is protected by the fact that we changed acknowledgement errors themselves to strip out abci error code alone. But none the less, this is something good to be aware of cc. @gjermundgaraba

Copy link
Member Author

Choose a reason for hiding this comment

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

for example, back in the day we used to do this https://github.com/cosmos/ibc-go/blob/v3.4.0/modules/apps/transfer/ibc_module.go#L177 and it was for that reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah yea, great point to raise.

if res == nil || res.Value == nil {

if err := m.cdc.Unmarshal(query.Data, msg); err != nil {
return nil, errorsmod.Wrapf(ibcerrors.ErrInvalidType, "cannot unmarshal query request data to: %s", md.Input().FullName())
Copy link
Member Author

Choose a reason for hiding this comment

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

lemme know if you wanna use ibcerrors.ErrInvalidRequest instead here...

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty agnostic. They both seem OK

@@ -2,13 +2,15 @@

import (
"context"
"fmt"
"reflect"

Check notice

Code scanning / CodeQL

Sensitive package import Note

Certain system packages contain functions which may be a possible source of non-determinism
Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

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

Looks good (as good as proto stuff go)! LGTM!

if res == nil || res.Value == nil {

if err := m.cdc.Unmarshal(query.Data, msg); err != nil {
return nil, errorsmod.Wrapf(ibcerrors.ErrInvalidType, "cannot unmarshal query request data to: %s", md.Input().FullName())
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty agnostic. They both seem OK

func (m msgServer) ModuleQuerySafe(goCtx context.Context, msg *types.MsgModuleQuerySafe) (*types.MsgModuleQuerySafeResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

func (m msgServer) ModuleQuerySafe(ctx context.Context, msg *types.MsgModuleQuerySafe) (*types.MsgModuleQuerySafeResponse, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

what do you think @srdtrk? 😄

Copy link

Quality Gate Failed Quality Gate failed for 'ibc-go'

Failed conditions
63.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@damiannolan damiannolan merged commit 7aae649 into main Dec 17, 2024
29 checks passed
@damiannolan damiannolan deleted the damian/icahost-runtime-env branch December 17, 2024 18:10
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.

7 participants