-
Notifications
You must be signed in to change notification settings - Fork 205
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
Added fix for relayed move balance to non payables #6382
Added fix for relayed move balance to non payables #6382
Conversation
@@ -330,6 +330,9 @@ | |||
# MultiESDTNFTTransferAndExecuteByUserEnableEpoch represents the epoch when enshrined sovereign cross chain opcodes are enabled | |||
MultiESDTNFTTransferAndExecuteByUserEnableEpoch = 9999999 | |||
|
|||
# FixRelayedMoveBalanceToNonPayableSCEnableEpoch represents the epoch when the fix for relayed move balance to non payable sc will be enabled | |||
FixRelayedMoveBalanceToNonPayableSCEnableEpoch = 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it also involves meta transaction is invalid
, is there a umbrella term to cover both cases, to be used in the flag name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reason behind it(other than no umbrella term found): although the meta contract is payable, you are not allowed to execute a move balance to it, being on meta, thus making it non payable.
@@ -122,6 +122,7 @@ func createEnableEpochsConfig() config.EnableEpochs { | |||
RelayedTransactionsV3EnableEpoch: 105, | |||
FixRelayedBaseCostEnableEpoch: 106, | |||
MultiESDTNFTTransferAndExecuteByUserEnableEpoch: 107, | |||
FixRelayedMoveBalanceToNonPayableSCEnableEpoch: 107, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the same as RelayedTransactionsV3EnableEpoch
(I know it's just a test)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, updated to 108
@@ -267,6 +267,76 @@ func TestRelayedTransactionInMultiShardEnvironmentWithChainSimulatorScCalls(t *t | |||
} | |||
} | |||
|
|||
func TestRelayedTransactionInMultiShardEnvironmentWithChainSimulatorInvalidInnerMoveBalance(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not "invalid" per se, but "with sending to non-payable contract". Can also stay as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated name TestRelayedTransactionInMultiShardEnvironmentWithChainSimulatorInnerMoveBalanceToNonPayableSC
@@ -2343,7 +2343,6 @@ func testChainSimulatorChangeMetaData(t *testing.T, issueFn issueTxFunc) { | |||
[]byte(core.ESDTRoleNFTUpdate), | |||
} | |||
tx = setSpecialRoleTx(nonce, addrs[1].Bytes, addrs[0].Bytes, tokenID, roles) | |||
nonce++ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious why the test was changed. Perhaps leave a comment in the PR (directly here on GitHub)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, this was a linter issue, raised here, added on PR description
process/transaction/shardProcess.go
Outdated
@@ -500,14 +500,28 @@ func (txProc *txProcessor) processMoveBalance( | |||
|
|||
isPayable, err := txProc.scProcessor.IsPayable(tx.SndAddr, tx.RcvAddr) | |||
if err != nil { | |||
errRefund := txProc.removeConsumedValueFromSender(tx, acntSrc, isUserTxOfRelayed) | |||
if errRefund != nil { | |||
log.Warn("failed to return funds to sender after check if receiver is payable", "error", errRefund) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warn or error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upgraded to error
process/transaction/shardProcess.go
Outdated
@@ -543,6 +557,31 @@ func (txProc *txProcessor) processMoveBalance( | |||
return nil | |||
} | |||
|
|||
func (txProc *txProcessor) removeConsumedValueFromSender( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refund
instead of remove
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to revertConsumedValueFromSender
process/transaction/shardProcess.go
Outdated
@@ -543,6 +557,31 @@ func (txProc *txProcessor) processMoveBalance( | |||
return nil | |||
} | |||
|
|||
func (txProc *txProcessor) removeConsumedValueFromSender( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename as remove seems like subtracting
maybe revertConsumedValueFromSender
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System Test results
Normal allin test: v1.7.13-dev-config-aebb55e8e0 -> fix_relayed_movebalance_to-760583c822
--- Specific errors ---
block hash does not match 366
wrong nonce in block 376
miniblocks does not match 0
num miniblocks does not match 0
miniblock hash does not match 0
block bodies does not match 0
receipts hash missmatch 0
/------/
--- Statistics ---
Nr. of all ERRORS: 4
Nr. of all WARNS: 269
Nr. of new ERRORS: 4
Nr. of new WARNS: 44
Nr. of PANICS: 0
/------/
--- ERRORS ---
ovh-p03-observer-2 :
Error: error calling SaveRoundsInfo, will retry driver = *host.hostDriver retrial in = error = connection not open while sending data on route for topic SaveRoundsInfo 1
ovh-p03-observer-3 :
Error: error calling SaveRoundsInfo, will retry driver = *host.hostDriver retrial in = error = connection not open while sending data on route for topic SaveRoundsInfo 1
ovh-p03-observer-1 :
Error: error calling FinalizedBlock, will retry driver = *host.hostDriver retrial in = error = connection not open while sending data on route for topic FinalizedBlock 1
ovh-p03-observer-4 :
Error: error calling FinalizedBlock, will retry driver = *host.hostDriver retrial in = error = connection not open while sending data on route for topic FinalizedBlock 1
/------/
--- WARNINGS ---
ovh-p03-validator-28 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 5
Warn: basePreProcess.saveTransactionToStorage txHash = dataUnit = TransactionUnit error = missing transaction 6
Warn: basePreProcess.createMarshalledData: tx not found hash = 6
ovh-p03-validator-16 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 1
ovh-p03-observer-2 :
Warn: wt.Listen()-> connection problem error = connection not open 1
ovh-p03-validator-35 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 2
ovh-p03-validator-17 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 3
ovh-p03-validator-31 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 3
ovh-p03-validator-26 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 1
ovh-p03-observer-3 :
Warn: wt.Listen()-> connection problem error = connection not open 2
Warn: c.openConnection(), retrying in error = dial tcp connect: connection refused 1
ovh-p03-validator-30 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 3
ovh-p03-validator-12 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 1
ovh-p03-validator-20 :
Warn: shardProcessor.createMiniBlocks error = shard is stuck shard = 2
ovh-p03-observer-1 :
Warn: wt.Listen()-> connection problem error = connection not open 2
Warn: c.openConnection(), retrying in error = dial tcp connect: connection refused 1
ovh-p03-validator-8 :
Warn: processDebugger: node is stuck last committed round = 1
ovh-p03-observer-4 :
Warn: wt.Listen()-> connection problem error = connection not open 2
Warn: c.openConnection(), retrying in error = dial tcp connect: connection refused 1
/------/
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?