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

Mismtach between bitsInWords and bytesInWords #147

Open
SebastienGllmt opened this issue Aug 29, 2018 · 2 comments
Open

Mismtach between bitsInWords and bytesInWords #147

SebastienGllmt opened this issue Aug 29, 2018 · 2 comments

Comments

@SebastienGllmt
Copy link

SebastienGllmt commented Aug 29, 2018

From https://github.com/runtimeverification/iele-semantics/blob/master/data.md you get the following:

  • bitsInWords converts a number of bits to a number of words.
  • bytesInWords converts a number of bytes to a number of words.
    syntax Int ::= bitsInWords ( Int ) [function]
 // ---------------------------------------------
    rule bitsInWords(I) => I up/Int 256

    syntax Int ::= bytesInWords ( Int ) [function]
 // ----------------------------------------------
    rule bytesInWords(I) => I up/Int 8

However the two definitions cannot both be true and also the 'bitsInWords' definition does not match the definition of Sha3 in https://github.com/runtimeverification/iele-semantics/blob/master/iele-gas.md

// Result size of SHA3 is 256 bits, i.e., 4 words.

rule #memory [ REG = sha3 _ ] => #registerDelta(REG, bitsInWords(256))

Changing this to up/Int 64 causes some of the tests/iele/ERC20/transfer_Caller-Zero.iele.json.test test to fail.

@vsubhuman
Copy link
Contributor

vsubhuman commented Aug 29, 2018

Also iele-gas.md defines "Operations whose result should fit into a word" and "Operations whose result should fit into 256 bits", implying that those are different sizes.

@dwightguth
Copy link

This is definitely a good catch. bitsInWords is supposed to divide by 64...

Since this affects the output of a transaction I won't have a fix right away, but this should be batched into the upcoming set of changes to IELE's gas model.

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

No branches or pull requests

3 participants