Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Solidity validator - BYTES #136

Closed
ninabreznik opened this issue Jun 11, 2019 · 7 comments
Closed

Solidity validator - BYTES #136

ninabreznik opened this issue Jun 11, 2019 · 7 comments
Assignees

Comments

@ninabreznik
Copy link
Contributor

We need to validate bytes field too. So far we were validating it as a string, but when we send the EVM doesn't accept it as a string, but we need to convert it into a byte, so it makes sense to also validate it as a byte.

So, we should validate both:

  • if a user inserts a string
  • or if a user inserts bytes

There are many types of bytes, so we also need to check if it's bytes, byte32 etc.

@alincode
Copy link

bytes1 0x00 ~ 0xff
bytes2 0x0000 ~ 0xffff

@ninabreznik
Copy link
Contributor Author

I actually don't know exactly, but if both are valid bytes, we can except any and then before I send them to the contract with ethers.js, I encode them into the right format that ethers.js excepts. But user should be able to write any valid format of bytes. Also a string...

Does that make sense?

@ninabreznik
Copy link
Contributor Author

ninabreznik commented Jun 12, 2019

@alincode Just implemented formating and parsing bytes when sending a transaction.

This is the format of the hex byte ethers.js wants 0x736f6d657468696e670000000000000000000000000000000000000000000000

So, user can either write a string, that will be formatted to a bytecode
or they can paste in the bytecode itself in this format 0x736f6d657468696e670000000000000000000000000000000000000000000000

Please let me know once validators are ready so I can update it in the smartcontract-app.

I am using ethers.js (ethers.utils.formatBytes32String and ethers.utils.parseBytes32String)

@alincode
Copy link

@ninabreznik
I know how to valid bytes, so I just noted it for myself. when I finish, I will leave the release message to you.

@ninabreznik
Copy link
Contributor Author

@alincode Perfect. Let me know once you're done so I can update the validate module and test it in smartcontract-app :)

@alincode
Copy link

alincode commented Jun 16, 2019

@alincode
Copy link

@ninabreznik
fixed and update at 0.3.0

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

No branches or pull requests

3 participants