Skip to content

generalise transaction header/footer validation #75

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

Closed
iltoga opened this issue Jul 18, 2019 · 1 comment · Fixed by #93
Closed

generalise transaction header/footer validation #75

iltoga opened this issue Jul 18, 2019 · 1 comment · Fixed by #93
Assignees
Labels
FEATURE New feature or request
Milestone

Comments

@iltoga
Copy link
Contributor

iltoga commented Jul 18, 2019

Description

implment util function to generalise tx validation for header and footer (this last if tx is signed)

it should, at least contain:

  • transaction type: must be
    • not nil
    • a valid tx type
  • sender account type: must be
    • not nil
    • a valid account type
  • sender account: must be a valid account
    • not nil
    • a valid account (validation depends on the account type):
      • type 0: b64decode and check that is 32 bytes long
  • recipient account: if present (depends on tx type), must be a valid account
    • a valid account (validation depends on the account type):
      • type 0: b64decode and check that is 32 bytes long
  • fee: must be
    • greater than 0 (beside if genesis block transaction?)
  • transaction body length: must be
    • not nil (?)
    • greater than 0 (?)
  • transaction body bytes: must be
    • len(TransactionBodyBytes) == TransactionBodyLength
  • transaction signature: if present, must be
    • a valid signature (verify against account public key...)

Breakdown

  • Implement new method in util package and add above tx validation rules
  • call it at the beginning of every transaction Validate() implementation
  • refactor VerifySignature method to use account public key instead of account ID (to be discussed)
@iltoga iltoga added the FEATURE New feature or request label Jul 18, 2019
@iltoga iltoga added this to the Sprint 2 milestone Jul 18, 2019
@andy-shi88
Copy link
Contributor

Looks good, and in my #74 PR I already update the signature verification to accept AccountType+AccountAddress instead, it'll check the type and do proper signature validation according to it type.

@iltoga iltoga self-assigned this Jul 23, 2019
@iltoga iltoga mentioned this issue Jul 23, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FEATURE New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants