Skip to content

Commit 80b6e07

Browse files
nwatson22rv-auditoranvacaru
authored
Change formula for #sizeOfDynamicType(#array) (#2455)
* Change formula for #sizeOfDynamicType(#array) * Set Version: 1.0.580 * Add test * Set Version: 1.0.581 * Set Version: 1.0.584 * Set Version: 1.0.585 --------- Co-authored-by: devops <[email protected]> Co-authored-by: Andrei Văcaru <[email protected]>
1 parent efeb85f commit 80b6e07

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

kevm-pyk/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "kevm-pyk"
7-
version = "1.0.584"
7+
version = "1.0.585"
88
description = ""
99
authors = [
1010
"Runtime Verification, Inc. <[email protected]>",

kevm-pyk/src/kevm_pyk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
if TYPE_CHECKING:
66
from typing import Final
77

8-
VERSION: Final = '1.0.584'
8+
VERSION: Final = '1.0.585'

kevm-pyk/src/kevm_pyk/kproj/evm-semantics/abi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ For most types, this is a fixed 32 bytes, except for static tuples, for which th
321321
- for `#bytes(BS)` and `#string(BS)`, the size is 32 bytes for the length prefix plus the size of the actual byte sequence, rounded up to the nearest multiple of 32.
322322
- for `#tuple(ARGS)`, the size is 32 bytes for the length prefix plus the cumulative size of its elements.
323323
- for `#array(T, N, _)` that has elements of a static `TypedArg` `T`, the size is `32 * (1 + N)`,which accounts for 32 bytes for the length prefix and 32 bytes for each element.
324-
- for dynamic type arrays `#array(T, N, ELEMS)`, the size is `32 * (1 + N + #sizeOfDynamicTypeList(ELEMS))`.
324+
- for dynamic type arrays `#array(T, N, ELEMS)`, the size is `32 * (1 + N) + #sizeOfDynamicTypeList(ELEMS)`.
325325

326326
```k
327327
syntax Int ::= #sizeOfDynamicType ( TypedArg ) [klabel(#sizeOfDynamicType), function]
@@ -332,7 +332,7 @@ For most types, this is a fixed 32 bytes, except for static tuples, for which th
332332
rule #sizeOfDynamicType(#array(T, N, _)) => 32 *Int (1 +Int N)
333333
requires #isStaticType(T)
334334
335-
rule #sizeOfDynamicType(#array(T, N, ELEMS)) => 32 *Int (1 +Int N +Int #sizeOfDynamicTypeList(ELEMS))
335+
rule #sizeOfDynamicType(#array(T, N, ELEMS)) => (32 *Int (1 +Int N)) +Int #sizeOfDynamicTypeList(ELEMS)
336336
requires notBool #isStaticType(T)
337337
338338
syntax Int ::= #sizeOfDynamicTypeList ( TypedArgs ) [klabel(#sizeOfDynamicTypeList), function, total]

package/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.584
1+
1.0.585

tests/specs/functional/abi-spec.k

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,26 @@ module ABI-SPEC
3939
...
4040
</k>
4141

42+
claim [sizeOfDynamicType-2455]:
43+
<k> runLemma(
44+
#sizeOfDynamicType(
45+
#array(
46+
#bytes(b"\x00"),
47+
3,
48+
#bytes(b"\xaa"), #bytes(b"\xbb\xbb"), #bytes(b"\xcc\xcc\xcc")
49+
)
50+
)
51+
==Int
52+
lengthBytes(#enc(
53+
#array(
54+
#bytes(b"\x00"),
55+
3,
56+
#bytes(b"\xaa"), #bytes(b"\xbb\xbb"), #bytes(b"\xcc\xcc\xcc")
57+
)
58+
))
59+
)
60+
=> doneLemma(true)
61+
...
62+
</k>
63+
4264
endmodule

0 commit comments

Comments
 (0)