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

En 6312/meta tx standard #1885

Merged
merged 26 commits into from Jun 16, 2020
Merged

Conversation

sasurobert
Copy link
Contributor

Implemented meta transaction standard.

Attached documentation: https://docs.google.com/document/d/1P-ZNs2BCvHheb9jAkVC6MYWsWfGoQzAHbvBnrvezXAQ/edit

sasurobert and others added 23 commits June 8, 2020 12:11
# Conflicts:
#	epochStart/bootstrap/process_test.go
# Conflicts:
#	cmd/node/main.go
#	epochStart/bootstrap/common.go
#	epochStart/bootstrap/process.go
#	epochStart/bootstrap/process_test.go
#	integrationTests/multiShard/endOfEpoch/startInEpoch/startInEpoch_test.go
…o relayer - the difference should go back to sender.
…o relayer - the difference should go back to sender.
@raduchis raduchis self-requested a review June 11, 2020 15:11
@andreibancioiu andreibancioiu self-requested a review June 11, 2020 15:29
@andreibancioiu andreibancioiu added the type:feature New feature or request label Jun 11, 2020
@raduchis raduchis removed their request for review June 12, 2020 07:38
@iulianpascalau iulianpascalau self-requested a review June 12, 2020 09:39
@@ -18,8 +20,11 @@ github.com/ElrondNetwork/elrond-vm-common v0.0.0-20191203115206-691b00a6e76a/go.
github.com/ElrondNetwork/elrond-vm-common v0.1.9/go.mod h1:ZakxPST/Wt8umnRtA9gobcy3Dw2bywxwkC54P5VhO9g=
github.com/ElrondNetwork/elrond-vm-common v0.1.19 h1:mRO768HtMyXY23pvG18DonKVEIlNvXxoyKP94S9fb2A=
github.com/ElrondNetwork/elrond-vm-common v0.1.19/go.mod h1:ZakxPST/Wt8umnRtA9gobcy3Dw2bywxwkC54P5VhO9g=
Copy link
Contributor

Choose a reason for hiding this comment

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

go mod tidy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

process/smartContract/argumentParser.go Show resolved Hide resolved
process/smartContract/process.go Show resolved Hide resolved
@@ -279,7 +285,7 @@ func (sc *scProcessor) ExecuteSmartContractTransaction(
acntDst, err = sc.reloadLocalAccount(acntDst)
if err != nil {
log.Debug("reloadLocalAccount error", "error", err.Error())
return nil
return 0, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this value has a constant? Maybe move to a (new) const.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when critical error is returned the return code is not used, like sending nil back when critical error

@@ -137,6 +148,55 @@ func (inTx *InterceptedTransaction) CheckValidity() error {
return nil
}

func (inTx *InterceptedTransaction) verifyIfRelayedTx(tx *transaction.Transaction) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests missing for this function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed after first reviews will do it. may merge after disabling this txtype

@@ -393,6 +409,229 @@ func (txProc *txProcessor) moveBalances(
return nil
}

func (txProc *txProcessor) processRelayedTx(
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs heavy testing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed after first reviews will do it. may merge after disabling.

Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

Need heavy unit-testing and a few integration tests.

Copy link
Collaborator

@andreibancioiu andreibancioiu left a comment

Choose a reason for hiding this comment

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

Some questions and / or small findings.
Nice and detailed document 💯

@@ -414,6 +414,9 @@ const BuiltInFunctionSaveKeyValue = "SaveKeyValue"
// BuiltInFunctionESDTTransfer is the key for the elrond standard digital token transfer built-in function
const BuiltInFunctionESDTTransfer = "ESDTTransfer"

// RelayedTransaction is the key for the elrond meta/gassless/relayed transaction standard
const RelayedTransaction = "relayedTx"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please rename the document (the title) to use this term instead of "meta".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

core/converters.go Show resolved Hide resolved
process/coordinator/transactionType.go Show resolved Hide resolved
var ErrRecursiveRelayedTXIsNotAllowed = errors.New("recursive relayed tx is not allowed")

// ErrRelayedTxValueHigherThenUserTxValue signals that relayed tx value is higher then user tx value
var ErrRelayedTxValueHigherThenUserTxValue = errors.New("relayed tx value is higher then user tx value")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo "than".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

var ErrInvalidVMType = errors.New("invalid VM type")

// ErrRecursiveRelayedTXIsNotAllowed signals that recursive relayed tx is not allowed
var ErrRecursiveRelayedTXIsNotAllowed = errors.New("recursive relayed tx is not allowed")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo / case of "TX" vs. "Tx" below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

process/transaction/shardProcess.go Show resolved Hide resolved
process/transaction/shardProcess.go Show resolved Hide resolved
process/smartContract/process.go Show resolved Hide resolved
process/smartContract/process.go Show resolved Hide resolved
process/smartContract/process.go Show resolved Hide resolved
@sasurobert sasurobert changed the base branch from development to feat/new-development June 15, 2020 17:43
@sasurobert sasurobert changed the base branch from feat/new-development to feat/new-features June 15, 2020 17:43
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

Next PR should address the missing unit tests & integration tests

@sasurobert sasurobert merged commit 20dd8ab into feat/new-features Jun 16, 2020
@sasurobert sasurobert deleted the EN-6312/Meta-tx-standard branch June 16, 2020 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants