From 5fc1a44113a08187ab153ac239b5fa377ed0e703 Mon Sep 17 00:00:00 2001 From: p0p3yee Date: Wed, 28 Feb 2024 15:07:10 -0500 Subject: [PATCH 1/3] Update to keep encrypted tx & update its processed height --- proto/fairyring/pep/encrypted_tx.proto | 2 + x/pep/keeper/encrypted_tx.go | 30 ++++ .../keeper/msg_server_submit_encrypted_tx.go | 10 +- x/pep/module.go | 9 +- x/pep/types/encrypted_tx.pb.go | 132 ++++++++++++++---- 5 files changed, 148 insertions(+), 35 deletions(-) diff --git a/proto/fairyring/pep/encrypted_tx.proto b/proto/fairyring/pep/encrypted_tx.proto index 8d12fcde..7a578369 100644 --- a/proto/fairyring/pep/encrypted_tx.proto +++ b/proto/fairyring/pep/encrypted_tx.proto @@ -12,6 +12,8 @@ message EncryptedTx { string data = 3; string creator = 4; cosmos.base.v1beta1.Coin chargedGas = 5; + uint64 processedAtChainHeight = 6; + bool expired = 7; } message EncryptedTxArray { diff --git a/x/pep/keeper/encrypted_tx.go b/x/pep/keeper/encrypted_tx.go index 1c9df116..97e86124 100644 --- a/x/pep/keeper/encrypted_tx.go +++ b/x/pep/keeper/encrypted_tx.go @@ -48,6 +48,36 @@ func (k Keeper) SetEncryptedTx( ), parsedEncryptedTxArr) } +func (k Keeper) SetEncryptedTxProcessedHeight( + ctx sdk.Context, + height uint64, + index uint64, + processedHeight uint64, +) { + arr := k.GetEncryptedTxAllFromHeight(ctx, height) + + if index >= uint64(len(arr.EncryptedTx)) { + return + } + + arr.EncryptedTx[index].ProcessedAtChainHeight = processedHeight + + k.SetEncryptedTx(ctx, height, arr) +} + +func (k Keeper) SetAllEncryptedTxExpired( + ctx sdk.Context, + height uint64, +) { + arr := k.GetEncryptedTxAllFromHeight(ctx, height) + + for i := range arr.EncryptedTx { + arr.EncryptedTx[i].Expired = true + } + + k.SetEncryptedTx(ctx, height, arr) +} + // GetEncryptedTx returns a encryptedTx from its index func (k Keeper) GetEncryptedTx( ctx sdk.Context, diff --git a/x/pep/keeper/msg_server_submit_encrypted_tx.go b/x/pep/keeper/msg_server_submit_encrypted_tx.go index 01c7ad8e..7557c83d 100644 --- a/x/pep/keeper/msg_server_submit_encrypted_tx.go +++ b/x/pep/keeper/msg_server_submit_encrypted_tx.go @@ -84,10 +84,12 @@ func (k msgServer) SubmitEncryptedTx(goCtx context.Context, msg *types.MsgSubmit } encryptedTx := types.EncryptedTx{ - TargetHeight: msg.TargetBlockHeight, - Data: msg.Data, - Creator: msg.Creator, - ChargedGas: &minGas, + TargetHeight: msg.TargetBlockHeight, + Data: msg.Data, + Creator: msg.Creator, + ChargedGas: &minGas, + ProcessedAtChainHeight: 0, + Expired: false, } txIndex := k.AppendEncryptedTx(ctx, encryptedTx) diff --git a/x/pep/module.go b/x/pep/module.go index 6d4a0fa1..177b3990 100644 --- a/x/pep/module.go +++ b/x/pep/module.go @@ -218,6 +218,8 @@ func (am AppModule) processFailedEncryptedTx(ctx sdk.Context, tx types.Encrypted ), ) + am.keeper.SetEncryptedTxProcessedHeight(ctx, tx.TargetHeight, tx.Index, uint64(ctx.BlockHeight())) + creatorAddr, err := sdk.AccAddressFromBech32(tx.Creator) if err != nil { am.keeper.Logger(ctx).Error("error while trying to parse tx creator address when processing failed encrypted tx") @@ -286,8 +288,8 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { am.keeper.Logger(ctx).Error(fmt.Sprintf("Decryption key not found for block height: %d, Removing all the encrypted txs...", h)) encryptedTxs := am.keeper.GetEncryptedTxAllFromHeight(ctx, h) if len(encryptedTxs.EncryptedTx) > 0 { - am.keeper.RemoveAllEncryptedTxFromHeight(ctx, h) - am.keeper.Logger(ctx).Info(fmt.Sprintf("Removed total %d encrypted txs at block %d", len(encryptedTxs.EncryptedTx), h)) + am.keeper.SetAllEncryptedTxExpired(ctx, h) + am.keeper.Logger(ctx).Info(fmt.Sprintf("Updated total %d encrypted txs at block %d to expired", len(encryptedTxs.EncryptedTx), h)) indexes := make([]string, len(encryptedTxs.EncryptedTx)) for _, v := range encryptedTxs.EncryptedTx { indexes = append(indexes, strconv.FormatUint(v.Index, 10)) @@ -571,6 +573,7 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { eventStrArrJson, _ := json.Marshal(underlyingTxEvents) am.keeper.Logger(ctx).Info("! Encrypted Tx Decrypted & Decoded & Executed successfully !") + am.keeper.SetEncryptedTxProcessedHeight(ctx, eachTx.TargetHeight, eachTx.Index, uint64(ctx.BlockHeight())) ctx.EventManager().EmitEvent( sdk.NewEvent(types.EncryptedTxExecutedEventType, @@ -585,8 +588,6 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { telemetry.IncrCounter(1, types.KeyTotalSuccessEncryptedTx) } - - am.keeper.RemoveAllEncryptedTxFromHeight(ctx, h) } } diff --git a/x/pep/types/encrypted_tx.pb.go b/x/pep/types/encrypted_tx.pb.go index 79d05f00..abc72b0e 100644 --- a/x/pep/types/encrypted_tx.pb.go +++ b/x/pep/types/encrypted_tx.pb.go @@ -25,11 +25,13 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type EncryptedTx struct { - TargetHeight uint64 `protobuf:"varint,1,opt,name=targetHeight,proto3" json:"targetHeight,omitempty"` - Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` - Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"` - ChargedGas *types.Coin `protobuf:"bytes,5,opt,name=chargedGas,proto3" json:"chargedGas,omitempty"` + TargetHeight uint64 `protobuf:"varint,1,opt,name=targetHeight,proto3" json:"targetHeight,omitempty"` + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"` + ChargedGas *types.Coin `protobuf:"bytes,5,opt,name=chargedGas,proto3" json:"chargedGas,omitempty"` + ProcessedAtChainHeight uint64 `protobuf:"varint,6,opt,name=processedAtChainHeight,proto3" json:"processedAtChainHeight,omitempty"` + Expired bool `protobuf:"varint,7,opt,name=expired,proto3" json:"expired,omitempty"` } func (m *EncryptedTx) Reset() { *m = EncryptedTx{} } @@ -100,6 +102,20 @@ func (m *EncryptedTx) GetChargedGas() *types.Coin { return nil } +func (m *EncryptedTx) GetProcessedAtChainHeight() uint64 { + if m != nil { + return m.ProcessedAtChainHeight + } + return 0 +} + +func (m *EncryptedTx) GetExpired() bool { + if m != nil { + return m.Expired + } + return false +} + type EncryptedTxArray struct { EncryptedTx []EncryptedTx `protobuf:"bytes,1,rep,name=encryptedTx,proto3" json:"encryptedTx"` } @@ -152,28 +168,30 @@ func init() { func init() { proto.RegisterFile("fairyring/pep/encrypted_tx.proto", fileDescriptor_7c124d687cde8326) } var fileDescriptor_7c124d687cde8326 = []byte{ - // 323 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xbf, 0x4e, 0xc3, 0x30, - 0x10, 0xc6, 0x63, 0x9a, 0x82, 0x70, 0x40, 0x42, 0x56, 0x07, 0xd3, 0xc1, 0x44, 0x9d, 0x22, 0x06, - 0x5b, 0x2d, 0x13, 0x23, 0xe5, 0xef, 0x1c, 0x21, 0x06, 0x16, 0xe4, 0x38, 0x26, 0xb5, 0xa0, 0xb1, - 0xe5, 0x18, 0x94, 0xbc, 0x05, 0x8f, 0xc2, 0x63, 0x74, 0xec, 0xc8, 0x84, 0x50, 0xfb, 0x22, 0xa8, - 0x09, 0xa5, 0xe9, 0x76, 0xf7, 0x7d, 0xdf, 0x9d, 0x7e, 0xba, 0x83, 0xe1, 0x33, 0x57, 0xb6, 0xb2, - 0x2a, 0xcf, 0x98, 0x91, 0x86, 0xc9, 0x5c, 0xd8, 0xca, 0x38, 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 0xf1, - 0xe6, 0x4b, 0xe2, 0x7d, 0x2d, 0x89, 0xf7, 0x78, 0x9a, 0x29, 0x37, 0x79, 0x4b, 0xa8, 0xd0, 0x53, - 0x76, 0xc3, 0x95, 0x4d, 0x5e, 0xb5, 0x78, 0x61, 0x9b, 0x07, 0x95, 0xf5, 0x8b, 0x5c, 0x65, 0x64, - 0x91, 0xec, 0xd6, 0x77, 0x3d, 0xfb, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x56, 0xd6, 0xd1, 0xd8, 0xc0, - 0x01, 0x00, 0x00, + // 363 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x3d, 0xef, 0xd3, 0x30, + 0x10, 0xc6, 0xe3, 0x7f, 0xd3, 0x16, 0x1c, 0x90, 0x90, 0x55, 0x21, 0xd3, 0x21, 0x44, 0x9d, 0x22, + 0x06, 0x5b, 0x2d, 0x12, 0x12, 0x63, 0x5b, 0xde, 0xe6, 0x08, 0x31, 0xb0, 0x20, 0xc7, 0x39, 0x12, + 0x0b, 0x1a, 0x5b, 0x8e, 0x41, 0xc9, 0xca, 0x27, 0xe0, 0x63, 0x75, 0xec, 0xc8, 0x84, 0x50, 0xfb, + 0x45, 0x50, 0x92, 0x96, 0xa6, 0x03, 0xdb, 0xdd, 0x3d, 0xcf, 0x9d, 0x7e, 0xba, 0x07, 0x47, 0x9f, + 0x85, 0xb2, 0x8d, 0x55, 0x65, 0xce, 0x0d, 0x18, 0x0e, 0xa5, 0xb4, 0x8d, 0x71, 0x90, 0x7d, 0x72, + 0x35, 0x33, 0x56, 0x3b, 0x4d, 0x1e, 0xfe, 0x73, 0x30, 0x03, 0x66, 0x3e, 0xcb, 0x75, 0xae, 0x3b, + 0x85, 0xb7, 0x55, 0x6f, 0x9a, 0x87, 0x52, 0x57, 0x3b, 0x5d, 0xf1, 0x54, 0x54, 0xc0, 0xbf, 0x2f, + 0x53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xa1, 0x77, 0x38, 0x85, 0xde, 0xaf, 0x53, 0xe8, 0x7d, 0x7c, + 0x96, 0x2b, 0x57, 0x7c, 0x4b, 0x99, 0xd4, 0x3b, 0xfe, 0x46, 0x28, 0x9b, 0x7e, 0xd5, 0xf2, 0x0b, + 0xbf, 0x46, 0x5e, 0x77, 0xa1, 0xbb, 0xc6, 0x40, 0x95, 0x4e, 0xba, 0xa4, 0x9e, 0xff, 0x0d, 0x00, + 0x00, 0xff, 0xff, 0xe6, 0x14, 0x3b, 0x24, 0x12, 0x02, 0x00, 0x00, } func (m *EncryptedTx) Marshal() (dAtA []byte, err error) { @@ -196,6 +214,21 @@ func (m *EncryptedTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Expired { + i-- + if m.Expired { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.ProcessedAtChainHeight != 0 { + i = encodeVarintEncryptedTx(dAtA, i, uint64(m.ProcessedAtChainHeight)) + i-- + dAtA[i] = 0x30 + } if m.ChargedGas != nil { { size, err := m.ChargedGas.MarshalToSizedBuffer(dAtA[:i]) @@ -307,6 +340,12 @@ func (m *EncryptedTx) Size() (n int) { l = m.ChargedGas.Size() n += 1 + l + sovEncryptedTx(uint64(l)) } + if m.ProcessedAtChainHeight != 0 { + n += 1 + sovEncryptedTx(uint64(m.ProcessedAtChainHeight)) + } + if m.Expired { + n += 2 + } return n } @@ -498,6 +537,45 @@ func (m *EncryptedTx) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProcessedAtChainHeight", wireType) + } + m.ProcessedAtChainHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEncryptedTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProcessedAtChainHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expired", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEncryptedTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Expired = bool(v != 0) default: iNdEx = preIndex skippy, err := skipEncryptedTx(dAtA[iNdEx:]) From 3317621a7533bff14188acb5df31574fad79d64a Mon Sep 17 00:00:00 2001 From: p0p3yee Date: Wed, 28 Feb 2024 15:10:03 -0500 Subject: [PATCH 2/3] Update to better logic --- x/pep/module.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x/pep/module.go b/x/pep/module.go index 177b3990..eaf87447 100644 --- a/x/pep/module.go +++ b/x/pep/module.go @@ -218,8 +218,6 @@ func (am AppModule) processFailedEncryptedTx(ctx sdk.Context, tx types.Encrypted ), ) - am.keeper.SetEncryptedTxProcessedHeight(ctx, tx.TargetHeight, tx.Index, uint64(ctx.BlockHeight())) - creatorAddr, err := sdk.AccAddressFromBech32(tx.Creator) if err != nil { am.keeper.Logger(ctx).Error("error while trying to parse tx creator address when processing failed encrypted tx") @@ -346,6 +344,7 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { for _, eachTx := range arr.EncryptedTx { startConsumedGas := ctx.GasMeter().GasConsumed() + am.keeper.SetEncryptedTxProcessedHeight(ctx, eachTx.TargetHeight, eachTx.Index, uint64(ctx.BlockHeight())) if currentNonce, found := am.keeper.GetPepNonce(ctx, eachTx.Creator); found && currentNonce.Nonce == math.MaxUint64 { am.processFailedEncryptedTx(ctx, eachTx, "invalid pep nonce", startConsumedGas) continue @@ -573,7 +572,6 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { eventStrArrJson, _ := json.Marshal(underlyingTxEvents) am.keeper.Logger(ctx).Info("! Encrypted Tx Decrypted & Decoded & Executed successfully !") - am.keeper.SetEncryptedTxProcessedHeight(ctx, eachTx.TargetHeight, eachTx.Index, uint64(ctx.BlockHeight())) ctx.EventManager().EmitEvent( sdk.NewEvent(types.EncryptedTxExecutedEventType, From 1fc5fd42f08517c26e79121d1e5dd4c597c3ba5d Mon Sep 17 00:00:00 2001 From: p0p3yee Date: Thu, 29 Feb 2024 20:19:40 -0500 Subject: [PATCH 3/3] Add test --- scripts/tests/pep.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/tests/pep.sh b/scripts/tests/pep.sh index 663045ec..4a181a58 100755 --- a/scripts/tests/pep.sh +++ b/scripts/tests/pep.sh @@ -307,6 +307,25 @@ if [ "$RESULT" != "$AGG_KEY_HEIGHT" ]; then exit 1 fi +FIRST_ENCRYPTED_TX_HEIGHT=$($BINARY query pep list-encrypted-tx --node $CHAIN2_NODE -o json | jq '.encryptedTxArray[0].encryptedTx[0].processedAtChainHeight') +SECOND_ENCRYPTED_TX_HEIGHT=$($BINARY query pep list-encrypted-tx --node $CHAIN2_NODE -o json | jq '.encryptedTxArray[0].encryptedTx[1].processedAtChainHeight') + +echo "First Encrypted tx processed at height: $FIRST_ENCRYPTED_TX_HEIGHT, 2nd one processed at: $SECOND_ENCRYPTED_TX_HEIGHT" + +FIRST_EVENT=$(curl -s http://localhost:26657/block_results?height=$FIRST_ENCRYPTED_TX_HEIGHT | jq '.result.begin_block_events[] | select(.type == "reverted-encrypted-tx") | .attributes[] | select(.key == "reason") | .value') +if [[ "$FIRST_EVENT" != *"insufficient fees"* ]]; then + echo "ERROR: Pep module expected first encrypted tx failed with reason insufficient fee, got: $FIRST_EVENT instead" + exit 1 +fi +echo "First Encrypted TX Failed with Reason: $FIRST_EVENT as expected." + +SECOND_EVENT=$(curl -s http://localhost:26657/block_results?height=$SECOND_ENCRYPTED_TX_HEIGHT | jq '.result.begin_block_events[] | select(.type == "executed-encrypted-tx") | .attributes[] | select(.key == "events") | .value') +if [[ "$SECOND_EVENT" != *"coin_received"* ]]; then + echo "ERROR: Pep module expected second encrypted tx succeeded with events, got: $SECOND_EVENT instead" + exit 1 +fi +echo "Second Encrypted TX succeeded with Events: $(echo $SECOND_EVENT | jq) as expected." + echo "" echo "###########################################################" echo "# SUCCESSFULLY TESTED #"