Skip to content

Commit

Permalink
reverted relayed v3
Browse files Browse the repository at this point in the history
  • Loading branch information
sstanculeanu committed Oct 18, 2024
1 parent c170a4c commit 583b817
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 146 deletions.
35 changes: 17 additions & 18 deletions data/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,23 @@ import (
// Transaction represents the structure that maps and validates user input for publishing a new transaction
type Transaction struct {
// This field is used to tag transactions for send-multiple route
Index int `json:"-"`
Nonce uint64 `json:"nonce"`
Value string `json:"value"`
Receiver string `json:"receiver"`
Sender string `json:"sender"`
SenderUsername []byte `json:"senderUsername,omitempty"`
ReceiverUsername []byte `json:"receiverUsername,omitempty"`
GasPrice uint64 `json:"gasPrice"`
GasLimit uint64 `json:"gasLimit"`
Data []byte `json:"data,omitempty"`
Signature string `json:"signature,omitempty"`
ChainID string `json:"chainID"`
Version uint32 `json:"version"`
Options uint32 `json:"options,omitempty"`
GuardianAddr string `json:"guardian,omitempty"`
GuardianSignature string `json:"guardianSignature,omitempty"`
Relayer string `json:"relayer,omitempty"`
InnerTransactions []*Transaction `json:"innerTransactions,omitempty"`
Index int `json:"-"`
Nonce uint64 `json:"nonce"`
Value string `json:"value"`
Receiver string `json:"receiver"`
Sender string `json:"sender"`
SenderUsername []byte `json:"senderUsername,omitempty"`
ReceiverUsername []byte `json:"receiverUsername,omitempty"`
GasPrice uint64 `json:"gasPrice"`
GasLimit uint64 `json:"gasLimit"`
Data []byte `json:"data,omitempty"`
Signature string `json:"signature,omitempty"`
ChainID string `json:"chainID"`
Version uint32 `json:"version"`
Options uint32 `json:"options,omitempty"`
GuardianAddr string `json:"guardian,omitempty"`
GuardianSignature string `json:"guardianSignature,omitempty"`
Relayer string `json:"relayer,omitempty"`
}

// GetTransactionResponseData follows the format of the data field of get transaction response
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/gin-contrib/pprof v1.4.0
github.com/gin-contrib/static v0.0.1
github.com/gin-gonic/gin v1.9.1
github.com/multiversx/mx-chain-core-go v1.2.22
github.com/multiversx/mx-chain-core-go v1.2.23-0.20241018134424-75bab2a9058c
github.com/multiversx/mx-chain-crypto-go v1.2.12
github.com/multiversx/mx-chain-es-indexer-go v1.7.8
github.com/multiversx/mx-chain-logger-go v1.0.15
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/multiversx/mx-chain-core-go v1.2.22 h1:yDYrvoQOBbsDerEp7L3+de5AfMy3pTF333gWPpd+FNk=
github.com/multiversx/mx-chain-core-go v1.2.22/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-core-go v1.2.23-0.20241018134424-75bab2a9058c h1:hPCfMSj2vd9xNkARNxB1b3b9k8taFb+Xfja+WK97jno=
github.com/multiversx/mx-chain-core-go v1.2.23-0.20241018134424-75bab2a9058c/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-crypto-go v1.2.12 h1:zWip7rpUS4CGthJxfKn5MZfMfYPjVjIiCID6uX5BSOk=
github.com/multiversx/mx-chain-crypto-go v1.2.12/go.mod h1:HzcPpCm1zanNct/6h2rIh+MFrlXbjA5C8+uMyXj3LI4=
github.com/multiversx/mx-chain-es-indexer-go v1.7.8 h1:ZDKTXkQhQ7lLi6huVrBTUssVEqCvaCxGH4Y52GapboQ=
Expand Down
101 changes: 0 additions & 101 deletions process/testdata/pendingSCROfRelayedV3.json

This file was deleted.

16 changes: 0 additions & 16 deletions process/transactionProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const (
moveBalanceDescriptor = "MoveBalance"
relayedV1TransactionDescriptor = "RelayedTx"
relayedV2TransactionDescriptor = "RelayedTxV2"
relayedV3TransactionDescriptor = "RelayedTxV3"
emptyDataStr = ""
)

Expand Down Expand Up @@ -491,13 +490,6 @@ func (tp *TransactionProcessor) computeTransactionStatus(tx *transaction.ApiTran
}
}

isRelayedV3, status := checkIfRelayedV3Completed(tx)
if isRelayedV3 {
return &data.ProcessStatusResponse{
Status: status,
}
}

failed, reason = checkIfFailed(allLogs)
if failed {
return &data.ProcessStatusResponse{
Expand Down Expand Up @@ -588,14 +580,6 @@ func checkIfCompleted(logs []*transaction.ApiLogs) bool {
return found
}

func checkIfRelayedV3Completed(tx *transaction.ApiTransactionResult) (bool, string) {
if len(tx.InnerTransactions) == 0 {
return false, string(transaction.TxStatusPending)
}

return true, string(transaction.TxStatusSuccess)
}

func checkIfMoveBalanceNotarized(tx *transaction.ApiTransactionResult) bool {
isNotarized := tx.NotarizedAtSourceInMetaNonce > 0 && tx.NotarizedAtDestinationInMetaNonce > 0
if !isNotarized {
Expand Down
8 changes: 0 additions & 8 deletions process/transactionProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2001,14 +2001,6 @@ func TestTransactionProcessor_computeTransactionStatus(t *testing.T) {
status := tp.ComputeTransactionStatus(testData.Transaction, withResults)
require.Equal(t, string(transaction.TxStatusSuccess), status.Status)
})
t.Run("pending scr of relayed v3 should return pending", func(t *testing.T) {
t.Parallel()

testData := loadJsonIntoTxAndScrs(t, "./testdata/pendingSCROfRelayedV3.json")
tp := createTestProcessorFromScenarioData(testData)
status := tp.ComputeTransactionStatus(testData.Transaction, true)
require.Equal(t, string(transaction.TxStatusPending), status.Status)
})
})
t.Run("reward transaction", func(t *testing.T) {
t.Parallel()
Expand Down

0 comments on commit 583b817

Please sign in to comment.