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

Increment the proposer key sequence for failed transactions #67

Closed
kaliweh-circle opened this issue Jul 29, 2021 · 1 comment · Fixed by #82
Closed

Increment the proposer key sequence for failed transactions #67

kaliweh-circle opened this issue Jul 29, 2021 · 1 comment · Fixed by #82
Assignees
Labels

Comments

@kaliweh-circle
Copy link

kaliweh-circle commented Jul 29, 2021

Problem

The flow-emulator doesn't increment the proposer key sequence for failed transactions. The current behavior doesn't match the changes introduced in #602 which was released in flow v0.17.4. I only tested the two cases listed below but most likely there are more cases to cover.

Version: v.0.22.0

Steps to Reproduce

  1. Submit a transfer transaction with an amount larger than the sender balance. The transaction should fail and the key sequence should be incremented.
➜  flow transactions get fcfbfae19116a4c6c30646a430533900c.....

❌ Transaction Error
execution error code 1101: [Error Code: 1101] cadence runtime error Execution failed:
error: pre-condition failed: Amount withdrawn must be less than or equal than the balance of the Vault
   --> ee82856bf20e2aa6.FungibleToken:170:16
    |
170 |                 self.balance >= amount:
    |                 ^^^^^^^^^^^^^^^^^^^^^^
Status		✅ SEALED
ID		fcfbfae19116a4c6c30646a430533900c...
Payer		8913a7d76722a585
Authorizers	[8913a7d76722a585]
Proposal Key:
    Address	8913a7d76722a585
    Index	0
    Sequence	1

The key sequence remains 1 after the transaction is sealed.

➜  flow accounts get 8913a7d76722a585
Address	 0x8913a7d76722a585
Balance	 1.00100000
Keys	 1
Key 0	Public Key		 bcee61165014006481673cef8dbb204daf5f33e369....
	Weight			 1000
	Signature Algorithm	 ECDSA_secp256k1
	Hash Algorithm		 SHA3_256
	Revoked 		 false
	Sequence Number 	 1
	Index 			 0
  1. Submit a transfer transaction to an invalid address or an address that cannot receive the transfer token "not setup". The transaction should fail and the key sequence should be incremented.
➜  flow transactions get 1c06fd999d93c57313056dfae458...
❌ Transaction Error
execution error code 1101: [Error Code: 1101] cadence runtime error Execution failed:
error: panic: Could not borrow receiver reference to the recipient's Vault
  -->1c06fd999d93c57313056dfae458...:27:6
   |
27 | 			?? panic("Could not borrow receiver reference to the recipient's Vault")
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Status		✅ SEALED
ID		1c06fd999d93c57313056dfae458...
Payer		700a49a02359d112
Authorizers	[700a49a02359d112]
Proposal Key:
    Address	700a49a02359d112
    Index	0
    Sequence	1

The sequence remains 1 after the transaction is exuted

➜  flow accounts get 700a49a02359d112
Address	 0x700a49a02359d112
Balance	 1.00100000
Keys	 1
Key 0	Public Key		 349c2dab77ebf344f971b5a23fc44...
	Weight			 1000
	Signature Algorithm	 ECDSA_secp256k1
	Hash Algorithm		 SHA3_256
	Revoked 		 false
	Sequence Number 	 1
	Index 			 0

Acceptance Criteria

Match the flow implementation by incrementing the proposer key sequence for all transactions, except the four cases mentioned in this announcement.

  • invalid transaction (transaction rejected by collection nodes)
  • any of the transaction signatures are not valid
  • the transaction is missing the signature(s) by the proposer
  • the proposal sequence number is invalid (not match with the one stored on the chain)

Context

N/A

@psiemens
Copy link
Contributor

psiemens commented Aug 4, 2021

Thank you for reporting this, @kaliweh-circle!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants