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

fix: smart account signing checktx error #8665

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

PaddyMc
Copy link
Collaborator

@PaddyMc PaddyMc commented Sep 3, 2024

What is the purpose of the change

Found an issue where checktx would cause the FE to throw an error because check tx will throw an error based on generate sign bytes

if this code path is hit and the txn doen't have any auth data we throw a nil pointer
https://github.com/osmosis-labs/osmosis/blob/main/x/smart-account/authenticator/authentication_request.go#L253-L257

recovered: runtime error: invalid memory address or nil pointer dereference
stack:
goroutine 57378 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x6b
github.com/cosmos/cosmos-sdk/baseapp.newDefaultRecoveryMiddleware.func1({0x702a6a0, 0xa1a68b0})
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/recovery.go:74 +0x35
github.com/cosmos/cosmos-sdk/baseapp.newRecoveryMiddleware.func1({0x702a6a0, 0xa1a68b0})
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/recovery.go:42 +0x51
github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x702a6a0, 0xa1a68b0}, 0xc00212e648)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/recovery.go:31 +0x71
github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x702a6a0, 0xa1a68b0}, 0xc0b6ddf698)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/recovery.go:36 +0xf1
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx.func1()
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/baseapp.go:835 +0x10b
panic({0x702a6a0?, 0xa1a68b0?})
	/usr/local/go/src/runtime/panic.go:770 +0x136
github.com/cosmos/cosmos-sdk/x/auth/tx.(*wrapper).GetSigningTxData(0xc0b1e8b200)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/x/auth/tx/adapter.go:63 +0xb6d
github.com/cosmos/cosmos-sdk/x/auth/signing.GetSignBytesAdapter({0x8132380, 0xc0b75bfc08}, 0xc001174720, 0x1, {{0x0, 0x0}, {0xc001a76240, 0x9}, 0x264fb0, 0x1f9, ...}, ...)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/x/auth/signing/adapter.go:37 +0x14e
github.com/osmosis-labs/osmosis/v26/x/smart-account/authenticator.GenerateAuthenticationRequest({{0x8132540, 0xa3e29c0}, {0x81507c8, 0xc0b6dfff40}, {{0x0, 0x0}, {0xc001a76240, 0x9}, 0x13540bf, {0x146b959e, ...}, ...}, ...}, ...)
	/home/ghost/git/osmosis-labs/osmosis/x/smart-account/authenticator/authentication_request.go:254 +0xd65
github.com/osmosis-labs/osmosis/v26/x/smart-account/post.AuthenticatorPostDecorator.PostHandle({_, _, _, _, {_, _}}, {{0x8132540, 0xa3e29c0}, {0x81507c8, 0xc0b6dfff40}, ...}, ...)
	/home/ghost/git/osmosis-labs/osmosis/x/smart-account/post/post.go:102 +0x1016
github.com/cosmos/cosmos-sdk/types.ChainPostDecorators.func2({{0x8132540, 0xa3e29c0}, {0x81507c8, 0xc0b6dfff40}, {{0x0, 0x0}, {0xc001a76240, 0x9}, 0x13540bf, {0x146b959e, ...}, ...}, ...}, ...)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/types/handler.go:76 +0x1c6
github.com/osmosis-labs/osmosis/v26/x/protorev/keeper.ProtoRevDecorator.PostHandle({{{0x814fcd8, 0xc000d029c0}, {0x80f8ed0, 0xc002e7c980}, 0xc002e7ca10, {{0x814fcd8, 0xc000d029c0}, 0xc000131378, {0x80f8ed0, 0xc002e7c800}, ...}, ...}}, ...)
	/home/ghost/git/osmosis-labs/osmosis/x/protorev/keeper/posthandler.go:36 +0x15a
github.com/cosmos/cosmos-sdk/types.ChainPostDecorators.func2({{0x8132540, 0xa3e29c0}, {0x81507c8, 0xc0b6dfff40}, {{0x0, 0x0}, {0xc001a76240, 0x9}, 0x13540bf, {0x146b959e, ...}, ...}, ...}, ...)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/types/handler.go:76 +0x1c6
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx(0xc001a4efc8, 0x2, {0xc0afa76420, 0x156, 0x160})
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/baseapp.go:966 +0x1c8a
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Simulate(0xc001a4efc8, {0xc0afa76420, 0x156, 0x160})
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/test_helpers.go:28 +0xa5
github.com/cosmos/cosmos-sdk/x/auth/tx.txServer.Simulate({{{0x0, 0x0, 0x0}, {0x8155208, 0xc0019b5110}, 0x0, {0x0, 0x0}, {0x816f488, 0xc0010e8d70}, ...}, ...}, ...)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/x/auth/tx/service.go:98 +0x35a
github.com/cosmos/cosmos-sdk/types/tx._Service_Simulate_Handler.func1({0x8132460, 0xc0b70a3770}, {0x74dcfa0, 0xc0b6da22c0})
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/types/tx/service.pb.go:1443 +0xf1
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func1({0x8132460, 0xc0b70a3770}, {0x74dcfa0, 0xc0b6da22c0}, 0xc0b6da22e0, 0xc0b2871938)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/grpcserver.go:85 +0xd09
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2.1({0x8132460, 0xc0b6dbcff0}, {0x74dcfa0, 0xc0b6da22c0})
	/home/ghost/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/chain.go:48 +0xe3
github.com/grpc-ecosystem/go-grpc-middleware/recovery.UnaryServerInterceptor.func1({0x8132460, 0xc0b6dbcff0}, {0x74dcfa0, 0xc0b6da22c0}, 0xc0b6da22e0, 0xc0b6db8380)
	/home/ghost/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/recovery/interceptors.go:33 +0x1d6
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2({0x8132460, 0xc0b6dbcff0}, {0x74dcfa0, 0xc0b6da22c0}, 0xc0b6da22e0, 0xc0b2871938)
	/home/ghost/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/chain.go:53 +0x223
github.com/cosmos/cosmos-sdk/types/tx._Service_Simulate_Handler({0x749a800, 0xc0007732c0}, {0x8132460, 0xc0b6dbcff0}, 0xc0b1e8af80, 0xc0b6dbd020)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/types/tx/service.pb.go:1445 +0x22c
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func2({0x749a800, 0xc0007732c0}, {0x8132460, 0xc0b6dbcff0}, 0xc0b1e8af80, 0x0)
	/home/ghost/go/pkg/mod/github.com/osmosis-labs/[email protected]/baseapp/grpcserver.go:107 +0x17d
google.golang.org/grpc.(*Server).processUnaryRPC(0xc002814400, {0x8132460, 0xc0b6dbcf00}, {0x814d2a0, 0xc000f7a780}, 0xc0b2879560, 0xc001a26240, 0xc0018d6380, 0x0)
	/home/ghost/go/pkg/mod/google.golang.org/[email protected]/server.go:1379 +0x180d
google.golang.org/grpc.(*Server).handleStream(0xc002814400, {0x814d2a0, 0xc000f7a780}, 0xc0b2879560)
	/home/ghost/go/pkg/mod/google.golang.org/[email protected]/server.go:1790 +0x1053
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	/home/ghost/go/pkg/mod/google.golang.org/[email protected]/server.go:1029 +0x178
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 533
	/home/ghost/go/pkg/mod/google.golang.org/[email protected]/server.go:1040 +0x1ae
: panic [osmosis-labs/[email protected]/baseapp/recovery.go:72] with gas used: '359115'

@PaddyMc PaddyMc added the A:backport/v26.x backport patches to v26.x branch label Sep 3, 2024
Copy link
Contributor

coderabbitai bot commented Sep 3, 2024

Walkthrough

The change modifies the conditional logic within the GenerateAuthenticationRequest function in the authentication_request.go file. The function now requires both the simulate boolean flag to be true and the context's IsCheckTx() method to return true for the sign bytes generation to be skipped. This adjustment enhances the control flow by refining the conditions under which sign bytes are not generated.

Changes

Files Change Summary
x/smart-account/authenticator/authentication_request.go Modified conditional logic in GenerateAuthenticationRequest to require both simulate and IsCheckTx() for skipping sign bytes generation.
CHANGELOG.md Added an entry documenting a fix for a "smart account signing checktx error" related to pull request #8665.

Tip

We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3c32690 and 93eec3e.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@PaddyMc PaddyMc added the V:state/breaking State machine breaking PR label Sep 3, 2024
@PaddyMc PaddyMc added V:state/compatible/backport State machine compatible PR, should be backported and removed V:state/breaking State machine breaking PR labels Sep 3, 2024
@PaddyMc PaddyMc merged commit 51cdc5c into main Sep 4, 2024
1 check passed
@PaddyMc PaddyMc deleted the fix/smart-account-signing-checktx branch September 4, 2024 17:10
mergify bot pushed a commit that referenced this pull request Sep 4, 2024
* fix: smart account signing checktx error

* chore: add changelog entry

(cherry picked from commit 51cdc5c)
PaddyMc added a commit that referenced this pull request Sep 4, 2024
* fix: smart account signing checktx error

* chore: add changelog entry

(cherry picked from commit 51cdc5c)

Co-authored-by: PaddyMc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v26.x backport patches to v26.x branch V:state/compatible/backport State machine compatible PR, should be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants