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

contract interaction: validate args inputs #1035

Closed
tom2drum opened this issue Jul 19, 2023 · 3 comments · Fixed by #1413
Closed

contract interaction: validate args inputs #1035

tom2drum opened this issue Jul 19, 2023 · 3 comments · Fixed by #1413
Assignees
Labels
enhancement New feature or request PM review For issues what are needed to be reviewed by PM v1.22.0 Release v1.22.0

Comments

@tom2drum
Copy link
Collaborator

tom2drum commented Jul 19, 2023

validation rules for each type of args:

  • boolean - bool
    • has to be literal string either true or false with all possible variations of letter-case (tRuE is correct), or either 1 or 0
  • string - string
    • is not validated
  • integer - int, int8, etc
    • can contain only digits [0-9] and signs - or +
    • min and max values are validated according to integer size (-128…127 for int8)
    • can contain thousands separators like _ or , decided to use masked inputs
  • unsigned integer - uint, uint8, etc
    • can contain only digits [0-9] and sign +
    • min and max values are validated according to integer size (-128…127 for int8)
    • can contain thousands separators like _ or , decided to use masked inputs
  • address - address
    • string that matches regexp /^0x[a-fA-F\d]{40}$/
    • length is equal 42
    • checksum is valid
  • fixed-size byte array - bytes1, bytes2, etc
    • input format
      • hex (0x112233 for bytes3); empty value is 0x
      • ASCII string (foo) with length less or equal array size; empty value is ""
  • dynamically-sized byte array - bytes
    • similar to bytes1[], bytes2, etc
  • array - T[k] where T can be any of the above types and k is array size (optional)
    • possible input format example - [4, 3, 2, 1] - in square brackets type elements separated by comma and white space (optional)
    • each element should follow validation rules for the type
    • ?? how highlight error for a specific element of the array; maybe we need separate input for each element
    • arrays can be nested in each other - [ [ 1, 2 ], [ [ 3, 4 ] ], [ [ [ 5 ], 6 ], 7 ]
  • functions - function
    • rare case; will not be supported
  • tuples - tuple
    • similar to array with elements of different type - [ 1, true, 0x112233]
  • structs - struct
    • ?? difficult to manage
      struct(
         txHash: 0x4977044e3c1c2f2c6fd987639a93ee8e7ca9ae16e6b204ceec237a826eb0520c
         blockNumber: 1000
         logs: [ 1, 3, 7 ]
      )
    
@tom2drum tom2drum added research Research task enhancement New feature or request triage Issues and PRs that are needed triage labels Jul 19, 2023
@tom2drum tom2drum self-assigned this Jul 20, 2023
@tom2drum tom2drum removed the triage Issues and PRs that are needed triage label Jul 31, 2023
@tom2drum tom2drum changed the title write contract inputs validation contract interaction: validate args inputs Aug 1, 2023
@tom2drum tom2drum removed the research Research task label Aug 1, 2023
@tom2drum tom2drum added the need design For issues that wait for design updates label Sep 25, 2023
@tgladilina
Copy link
Collaborator

tgladilina commented Nov 7, 2023

Deleted

@tgladilina tgladilina removed the need design For issues that wait for design updates label Nov 28, 2023
@tgladilina tgladilina removed their assignment Nov 30, 2023
@NikitaSavik
Copy link
Contributor

@tgladilina to be reworked:
show fields in a column (instead of the flex row)

@tgladilina
Copy link
Collaborator

tgladilina commented Dec 4, 2023

@tom2drum tom2drum added the PM review For issues what are needed to be reviewed by PM label Dec 13, 2023
@github-actions github-actions bot added pre-release Tasks in pre-release right now v1.22.0 Release v1.22.0 and removed pre-release Tasks in pre-release right now labels Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PM review For issues what are needed to be reviewed by PM v1.22.0 Release v1.22.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants