-
Notifications
You must be signed in to change notification settings - Fork 166
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
[Exec] Update sequence number independent of transaction invocation result #602
[Exec] Update sequence number independent of transaction invocation result #602
Conversation
prepareTx(t, tx6, account, privKey, 4, chain) | ||
prepareTx(t, tx6, account, privKey, 5, chain) |
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.
the previous call in the test supposed to fail due to runtime error (failed in updating contract), previously we didn't increment the sequence number but with the new behaviour it needs to increment.
// we don't set the proper sequence number of this one | ||
_, col2, block2, proposal2, _ := makePanicBlock(t, conID, colID, chain, uint64(0), block1.Header, genesis) |
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.
same here
}), | ||
) | ||
|
||
t.Run("Transaction invocation fails but sequence number is incremented", newVMTest().withBootstrapProcedureOptions( |
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.
We also have added this test before
@@ -25,7 +26,12 @@ func (d *TransactionFeeDeductor) Process( | |||
defer span.Finish() | |||
} | |||
|
|||
return d.deductFees(vm, ctx, proc.Transaction, sth, programs) | |||
txErr, fatalErr := d.deductFees(vm, ctx, proc.Transaction, sth, programs) | |||
// TODO handle deduct fee failures, for now just return as 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.
we need to address this case on fee deduction PR
_ = led.Set("00", "", "", []byte{'F'}) | ||
_ = led.Set("05", "", "", []byte{'B'}) |
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.
this needs to change the state commitment as the sequence number is applied.
fvm/transactionSequenceNum_test.go
Outdated
|
||
tx := flow.TransactionBody{} | ||
tx.SetProposalKey(address, 0, 0) | ||
signEnvelope(&tx, address, *privKey) |
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.
signatures are not needed for this test but I added them here, so in the future when we move proposal signature verification to this component, the test will check it.
…com:onflow/flow-go into ramtin/4107-seq-number-updates-on-failed-tx
This PR
changes the behaviour of sequence number update as follows
fixes error handling of meta transactions. (the txErrors were ignored previously)
Most of the heavy lifting has been done in previous PRs, this PR adds few tests and fix exec node's computer and chunk verifier and adds some extra unit test.
What does this mean?
Starting next spork, when running a transaction, the proposer key sequence number would always be incremented unless any of the following conditions occur:
In other words, the new behaviour increments the sequence number even if the transaction fails at runtime or any other condition that is not mentioned above. The new behaviour protects the network against some cases of spamming attacks and protects users from double transaction submission attacks.