From dc42329369ac3952c386e329adf5ed2f47d757d6 Mon Sep 17 00:00:00 2001 From: PaddyMc Date: Wed, 5 Jun 2024 17:29:16 +0100 Subject: [PATCH 1/2] fix: remove some todos --- x/smart-account/ante/pubkey.go | 5 +++-- x/smart-account/post/post.go | 1 - x/smart-account/types/keys.go | 3 +++ x/smart-account/types/msgs.go | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/x/smart-account/ante/pubkey.go b/x/smart-account/ante/pubkey.go index d2631c2d191..5c322e819cc 100644 --- a/x/smart-account/ante/pubkey.go +++ b/x/smart-account/ante/pubkey.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx/signing" authante "github.com/cosmos/cosmos-sdk/x/auth/ante" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + smartaccounttypes "github.com/osmosis-labs/osmosis/v25/x/smart-account/types" ) // EmitPubKeyDecoratorEvents emits the events that the SetPubKeyDecorator would emit. This is needed for backwards @@ -49,8 +50,8 @@ func (spkd EmitPubKeyDecoratorEvents) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim var events sdk.Events for i, sig := range sigs { events = append(events, sdk.NewEvent(sdk.EventTypeTx, - // TODO: add authenticator specific events here sdk.NewAttribute(sdk.AttributeKeyAccountSequence, fmt.Sprintf("%s/%d", signers[i], sig.Sequence)), + sdk.NewAttribute(smartaccounttypes.AttributeKeyAccountSequenceAuthenticator, fmt.Sprintf("%s/%d", signers[i], sig.Sequence)), )) sigBzs, err := signatureDataToBz(sig.Data) @@ -59,8 +60,8 @@ func (spkd EmitPubKeyDecoratorEvents) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim } for _, sigBz := range sigBzs { events = append(events, sdk.NewEvent(sdk.EventTypeTx, - // TODO: add authenticator specific events here sdk.NewAttribute(sdk.AttributeKeySignature, base64.StdEncoding.EncodeToString(sigBz)), + sdk.NewAttribute(smartaccounttypes.AttributeKeySignatureAuthenticator, base64.StdEncoding.EncodeToString(sigBz)), )) } } diff --git a/x/smart-account/post/post.go b/x/smart-account/post/post.go index d8353f0d536..9148ac25469 100644 --- a/x/smart-account/post/post.go +++ b/x/smart-account/post/post.go @@ -97,7 +97,6 @@ func (ad AuthenticatorPostDecorator) PostHandle( } // We skip replay protection here as it was already checked on authenticate. - // TODO: We probably want to avoid calling this function again. Can we keep this in cache? maybe in transient store? authenticationRequest, err := authenticator.GenerateAuthenticationRequest( ctx, ad.cdc, diff --git a/x/smart-account/types/keys.go b/x/smart-account/types/keys.go index 6ca018810d2..2190231aec4 100644 --- a/x/smart-account/types/keys.go +++ b/x/smart-account/types/keys.go @@ -24,6 +24,9 @@ const ( AttributeKeyAuthenticatorId = "authenticator_id" AtrributeKeyIsSmartAccountActive = "is_smart_account_active" + + AttributeKeyAccountSequenceAuthenticator = "authenticator_acc_seq" + AttributeKeySignatureAuthenticator = "authenticator_signature" ) var ( diff --git a/x/smart-account/types/msgs.go b/x/smart-account/types/msgs.go index 6ed74edc29a..62cea695926 100644 --- a/x/smart-account/types/msgs.go +++ b/x/smart-account/types/msgs.go @@ -37,7 +37,6 @@ func (msg *MsgAddAuthenticator) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgRemoveAuthenticator{} func (msg *MsgRemoveAuthenticator) ValidateBasic() error { - // TODO: call validate here return validateSender(msg.Sender) } From 77f96607986f2d584f106227801ca6dd5629f934 Mon Sep 17 00:00:00 2001 From: PaddyMc Date: Tue, 11 Jun 2024 15:13:41 +0100 Subject: [PATCH 2/2] chore: update comment to link to issue --- x/smart-account/post/post.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/smart-account/post/post.go b/x/smart-account/post/post.go index 9148ac25469..e55ec957223 100644 --- a/x/smart-account/post/post.go +++ b/x/smart-account/post/post.go @@ -97,6 +97,8 @@ func (ad AuthenticatorPostDecorator) PostHandle( } // We skip replay protection here as it was already checked on authenticate. + // TODO: Cache the authenticationRequest in the AnteHandler and reuse here. + // https://github.com/osmosis-labs/osmosis/issues/8371 authenticationRequest, err := authenticator.GenerateAuthenticationRequest( ctx, ad.cdc,