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
Create sequence module - Closes #5606 #5630
Create sequence module - Closes #5606 #5630
Conversation
a72aefe
to
76f206f
Compare
|
||
// Throw error when tx nonce is not equal to account nonce | ||
if (tx.nonce !== senderAccount.sequence.nonce) { | ||
throw new SequenceModuleError( |
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 should throw the NonceOutOfRange error to be handled specifically in the transaction pool
framework/test/unit/specs/modules/sequence/sequence_module.spec.ts
Outdated
Show resolved
Hide resolved
framework/test/unit/specs/modules/sequence/sequence_module.spec.ts
Outdated
Show resolved
Hide resolved
f423351
to
5ed080c
Compare
|
||
// Throw error when tx nonce is lower than the account nonce | ||
if (tx.nonce < senderAccount.sequence.nonce) { | ||
throw new NonceOutOfBoundsError( |
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 error should be different in order to check in transaction pool.
ie) in transaction pool, the lower nonce is rejected immediately, but higher nonce is accepted.
0486599
to
5851531
Compare
- Implement beforeTransactionApply and afterTransactionApply of sequence module - Create SequenceModuleError - Add id in Transaction interface in base_modules to show in the SequenceModuleError
- Add tests related to when nonce is invalid - Add tests related to when nonce is valid
- Pass nonce under sequence prop inside Account type
- Use SequenceAccount type - Account schema default values should have nonce - Throw NonceOutOfBoundsError error - Update unit tests - Use generics for account.set
- Only need to use getOrDefault in transfer asset of recipient
5851531
to
21a1de6
Compare
What was the problem?
This PR resolves #5606
How was it solved?
Source:
beforeTransactionApply
andafterTransactionApply
ofsequence
moduleSequenceModuleError
id
inTransaction
interface inbase_modules
to show in theSequenceModuleError
Tests:
nonce
is invalidnonce
is validHow was it tested?
Run
npm run test test/unit/specs/modules/sequence/sequence_module.spec.ts
under/framework