Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Use Serde trait to store/retrieve from memory - #1040

Merged
rodrodros merged 14 commits into
warplib-memory-to-cairo1from
memory-use-serde
May 1, 2023
Merged

Use Serde trait to store/retrieve from memory#1040
rodrodros merged 14 commits into
warplib-memory-to-cairo1from
memory-use-serde

Conversation

@piwonskp

@piwonskp piwonskp commented Apr 26, 2023

Copy link
Copy Markdown
Contributor

Fixes #1012

Comment thread warplib/src/warp_memory.cairo Outdated
Comment thread warplib/src/warp_memory.cairo
Comment thread warplib/src/warp_memory.cairo Outdated
@piwonskp
piwonskp changed the base branch from cairo-1.0 to warplib-memory-to-cairo1 April 28, 2023 18:16
Comment thread src/cairoUtilFuncGen/memory/memoryRead.ts Outdated
@rodrodros
rodrodros merged commit bdc2074 into warplib-memory-to-cairo1 May 1, 2023
@rodrodros
rodrodros deleted the memory-use-serde branch May 1, 2023 16:21
rodrodros added a commit that referenced this pull request May 17, 2023
* Make warplib a scarb project

* Add maths module

* update corelib to alpha 7

* Add arm binaries from alpha 7

* Add warp plugin binaries

* Rework structure for

* Fix warp dependency

* Fix warplib and delete files to ignore

* delete autogenerted warplib scripts

* Add corelib and bin for linux_x64

* Scarb package name replaces - for _

* Update compileCairo1 to use new binary

* Update compilation testing framework

* Some comments

* Address review

* Add unimplemented traits for WarpMemory

* Typo

* Delete maths.cairo

* Fix comp errors

* Add array handling logic

* Fix some compilation errors

* Make memory operations safe

* fix typo

* Use Serde trait to store/retrieve from memory (#1040)

* Use Serde trait to store/retrieve from memory

* Fix missing import

* Fix function naming in the trait

* Replace individual memory reads with a call to warp_memory

* Divide MemoryTrait into low level trait and external interface

* Remove unused import

* Add missing newline

* Fix wrong imports

* Cell accessor -> Warp memory impl

* Fix missing imports

* Use memory's own `read`instead of Felt252Dict's method

* Add memory implicit to memoryRead

* Fix arrayLiteral implicits

---------

Co-authored-by: Piotr Piwoński <piwonskp>

* Address review

* Update read_id to get_or_create_id

* Remove warplib/target

* Update workflow

* Fix tsc compilation errors

* Update warplib testing framwerk

* Fix bugs and compilation erros in warplib

* Add unit tests to Warplib

* Minor bug fixes in accessors

* Address review + add new test

* Use into

* Address review

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* start_pos -> position

* Fix and test change

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Minor stuff

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Remove starknet_accounts_devnet

* Fix testing

* Update naming

---------

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>
piwonskp added a commit that referenced this pull request Jun 2, 2023
* Make warplib a scarb project

* Add maths module

* update corelib to alpha 7

* Add arm binaries from alpha 7

* Add warp plugin binaries

* Rework structure for

* Fix warp dependency

* Fix warplib and delete files to ignore

* delete autogenerted warplib scripts

* Add corelib and bin for linux_x64

* Scarb package name replaces - for _

* Update compileCairo1 to use new binary

* Update compilation testing framework

* Some comments

* Address review

* Add unimplemented traits for WarpMemory

* Typo

* Delete maths.cairo

* Fix comp errors

* Add array handling logic

* Fix some compilation errors

* Make memory operations safe

* Update part of memory systems

* Add implicit conversion cases

* fix typo

* Array concat

* Minor refactoring to importPath.ts

* Use Serde trait to store/retrieve from memory (#1040)

* Use Serde trait to store/retrieve from memory

* Fix missing import

* Fix function naming in the trait

* Replace individual memory reads with a call to warp_memory

* Divide MemoryTrait into low level trait and external interface

* Remove unused import

* Add missing newline

* Fix wrong imports

* Cell accessor -> Warp memory impl

* Fix missing imports

* Use memory's own `read`instead of Felt252Dict's method

* Add memory implicit to memoryRead

* Fix arrayLiteral implicits

---------

Co-authored-by: Piotr Piwoński <piwonskp>

* Address review

* Update read_id to get_or_create_id

* Remove warplib/target

* Update imports

* Rewrite memory to calldata

* memory to storage

* Update workflow

* Fix tsc compilation errors

* Update warplib testing framwerk

* Fix bugs and compilation erros in warplib

* Add unit tests to Warplib

* Remove warplib sierra

* calldata to memory

* Add storage to memory

* Fix tsc compile bugs

* Add cairo1 compile and format for when using warp

* Update abi imports

* Improvements to memory util func gen

* Other import updates

* Fix some issues with imports

* Update a maths util function

* Minor bug fixes in accessors

* Address review + add new test

* Use into

* Address review

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* start_pos -> position

* Fix and test change

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Minor stuff

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Remove starknet_accounts_devnet

* Add super to importPaths

* Fix testing

* Improvments + linting

* Remove mut

* Some minor fixes

* Fix

* linting

* Address review

* Add endent in calldataToMemory

* Improvements in concat util func gen

* Add utilitie

* General fixes

* Improvements

* Update src/cairoUtilFuncGen/memory/implicitConversion.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Linting

* General fixes and improvements

* Relocation of warplib function

* Update src/cairoUtilFuncGen/memory/memoryStruct.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Bug fix

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToCalldata.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Rename to try

* Endent

* try rename

* Add felt constant and minor improvements

* Typo

* Linting

* Restore .starknet_account_devnet

* Write variables as mut

* Remove triple sss

* Remainig triple sss

* Nitpicks

* remove .starknet_accounts_devnet

* Add some comments

* Untry

* Restore behaviour file to default

* Restore behaviour file to default 2

---------

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>
AlejandroLabourdette pushed a commit that referenced this pull request Jun 2, 2023
* Make warplib a scarb project

* Add maths module

* update corelib to alpha 7

* Add arm binaries from alpha 7

* Add warp plugin binaries

* Rework structure for

* Fix warp dependency

* Fix warplib and delete files to ignore

* delete autogenerted warplib scripts

* Add corelib and bin for linux_x64

* Scarb package name replaces - for _

* Update compileCairo1 to use new binary

* Update compilation testing framework

* Some comments

* Address review

* Add unimplemented traits for WarpMemory

* Typo

* Delete maths.cairo

* Fix comp errors

* Add array handling logic

* Fix some compilation errors

* Make memory operations safe

* Update part of memory systems

* Add implicit conversion cases

* fix typo

* Array concat

* Minor refactoring to importPath.ts

* Use Serde trait to store/retrieve from memory (#1040)

* Use Serde trait to store/retrieve from memory

* Fix missing import

* Fix function naming in the trait

* Replace individual memory reads with a call to warp_memory

* Divide MemoryTrait into low level trait and external interface

* Remove unused import

* Add missing newline

* Fix wrong imports

* Cell accessor -> Warp memory impl

* Fix missing imports

* Use memory's own `read`instead of Felt252Dict's method

* Add memory implicit to memoryRead

* Fix arrayLiteral implicits

---------

Co-authored-by: Piotr Piwoński <piwonskp>

* Address review

* Update read_id to get_or_create_id

* Remove warplib/target

* Update imports

* Rewrite memory to calldata

* memory to storage

* Update workflow

* Fix tsc compilation errors

* Update warplib testing framwerk

* Fix bugs and compilation erros in warplib

* Add unit tests to Warplib

* Remove warplib sierra

* calldata to memory

* Add storage to memory

* Fix tsc compile bugs

* Add cairo1 compile and format for when using warp

* Update abi imports

* Improvements to memory util func gen

* Other import updates

* Fix some issues with imports

* Update a maths util function

* Minor bug fixes in accessors

* Address review + add new test

* Use into

* Address review

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* start_pos -> position

* Fix and test change

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Minor stuff

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Remove starknet_accounts_devnet

* Add super to importPaths

* Fix testing

* Improvments + linting

* Remove mut

* Some minor fixes

* Fix

* linting

* Address review

* Add endent in calldataToMemory

* Improvements in concat util func gen

* Add utilitie

* General fixes

* Improvements

* Update src/cairoUtilFuncGen/memory/implicitConversion.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Linting

* General fixes and improvements

* Relocation of warplib function

* Update src/cairoUtilFuncGen/memory/memoryStruct.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Bug fix

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToCalldata.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Rename to try

* Endent

* try rename

* Add felt constant and minor improvements

* Typo

* Linting

* Restore .starknet_account_devnet

* Write variables as mut

* Remove triple sss

* Remainig triple sss

* Nitpicks

* remove .starknet_accounts_devnet

* Add some comments

* Untry

* Restore behaviour file to default

* Restore behaviour file to default 2

---------

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>
piwonskp added a commit that referenced this pull request Jun 5, 2023
* Make warplib a scarb project

* Add maths module

* update corelib to alpha 7

* Add arm binaries from alpha 7

* Add warp plugin binaries

* Rework structure for

* Fix warp dependency

* Fix warplib and delete files to ignore

* delete autogenerted warplib scripts

* Add corelib and bin for linux_x64

* Scarb package name replaces - for _

* Update compileCairo1 to use new binary

* Update compilation testing framework

* Some comments

* Address review

* Add unimplemented traits for WarpMemory

* Typo

* Delete maths.cairo

* Fix comp errors

* Add array handling logic

* Fix some compilation errors

* Make memory operations safe

* fix typo

* functions for bytes

* Use Serde trait to store/retrieve from memory (#1040)

* Use Serde trait to store/retrieve from memory

* Fix missing import

* Fix function naming in the trait

* Replace individual memory reads with a call to warp_memory

* Divide MemoryTrait into low level trait and external interface

* Remove unused import

* Add missing newline

* Fix wrong imports

* Cell accessor -> Warp memory impl

* Fix missing imports

* Use memory's own `read`instead of Felt252Dict's method

* Add memory implicit to memoryRead

* Fix arrayLiteral implicits

---------

Co-authored-by: Piotr Piwoński <piwonskp>

* remove wm prefix

* Address review

* camel case to snake case

* read bytes length as a felt

* fixed compilation errors

* Update read_id to get_or_create_id

* Remove warplib/target

* Update workflow

* Fix tsc compilation errors

* Update warplib testing framwerk

* Fix bugs and compilation erros in warplib

* Add unit tests to Warplib

* Refactor and separate type conversions from maths

* separate external input check functions from math

* delete autogenerated

* update gitignore

* renaming variable

* Minor bug fixes in accessors

* Address review + add new test

* Use into

* Address review

* update references to warplib conversions in the branch

* create directory for autogen if it dosnt exist

* do not include in git types autogenerated files

* implementation of fixed bytes types

* include types in warplib lib

* try to find traits and structs first to export instead of functions

* remove support for bitwise operations with fixedBytes

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* start_pos -> position

* Fix and test change

* remove bytes handwritten implementation for warpmemory

* add a generated warp memory bytes implementation

* add imports needed for warp memory bytes

* test for warp memory bytes converter

* definition for `atIndex` function

* remove pow2

* pow2 autogenerated by warplib

* extend pow2 to n=255

* pow2 return now u128

* implement atIndex using pow2

* tests for atIndex

* implement bitwise operators for fixed bytes

* tests for bitwise operations with fixed bytes

* lint

* new line at files end

* rename byte location variable

* remove starknet accounts json

* refactor body of bytes bitwise operations

* delete bytes autogen file

* fix various issues converted with conversions to the address type (#1060)

- conversions from int variables used to call a Cairo 0 function. It
   was replaced with a new, Cairo 1,
   function---`unsafe_contract_address_from_felt`.

- conversions from int literals were represented in Cairo as raw int
   literals, which fails the type system.

- conversions from int literals to address wouldn't trigger typeString
   change from 'int_const bla-bla' to 'address', which caused
   primitiveTypeToCairo to fail.

- added tests

- the regex had to be changed, as it accidentally was catching methods
   of traits. Anyway, we might need to consider a solution not
   involving regexes, although it's not that bad, given that we only
   impose it on the code written by us

* Behavior tests and CI (#1055)

* enable behaviour tests in CI, again

* comments

* new warp-plugin bin with bug fixes (#1078)

* Add depured darwin version of warp-plugin

* Add x64 warp plugin binaries

---------

Co-authored-by: Piotr Piwoński <piwonskp>

* Do not include starknet accounts file in commits (#1077)

Co-authored-by: Piotr Piwoński <piwonskp>

* Update warp memory functionality to Cairo 1 (#1045)

* Make warplib a scarb project

* Add maths module

* update corelib to alpha 7

* Add arm binaries from alpha 7

* Add warp plugin binaries

* Rework structure for

* Fix warp dependency

* Fix warplib and delete files to ignore

* delete autogenerted warplib scripts

* Add corelib and bin for linux_x64

* Scarb package name replaces - for _

* Update compileCairo1 to use new binary

* Update compilation testing framework

* Some comments

* Address review

* Add unimplemented traits for WarpMemory

* Typo

* Delete maths.cairo

* Fix comp errors

* Add array handling logic

* Fix some compilation errors

* Make memory operations safe

* Update part of memory systems

* Add implicit conversion cases

* fix typo

* Array concat

* Minor refactoring to importPath.ts

* Use Serde trait to store/retrieve from memory (#1040)

* Use Serde trait to store/retrieve from memory

* Fix missing import

* Fix function naming in the trait

* Replace individual memory reads with a call to warp_memory

* Divide MemoryTrait into low level trait and external interface

* Remove unused import

* Add missing newline

* Fix wrong imports

* Cell accessor -> Warp memory impl

* Fix missing imports

* Use memory's own `read`instead of Felt252Dict's method

* Add memory implicit to memoryRead

* Fix arrayLiteral implicits

---------

Co-authored-by: Piotr Piwoński <piwonskp>

* Address review

* Update read_id to get_or_create_id

* Remove warplib/target

* Update imports

* Rewrite memory to calldata

* memory to storage

* Update workflow

* Fix tsc compilation errors

* Update warplib testing framwerk

* Fix bugs and compilation erros in warplib

* Add unit tests to Warplib

* Remove warplib sierra

* calldata to memory

* Add storage to memory

* Fix tsc compile bugs

* Add cairo1 compile and format for when using warp

* Update abi imports

* Improvements to memory util func gen

* Other import updates

* Fix some issues with imports

* Update a maths util function

* Minor bug fixes in accessors

* Address review + add new test

* Use into

* Address review

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* start_pos -> position

* Fix and test change

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Minor stuff

* Update warplib/src/test/warp_memory_test.cairo

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Remove starknet_accounts_devnet

* Add super to importPaths

* Fix testing

* Improvments + linting

* Remove mut

* Some minor fixes

* Fix

* linting

* Address review

* Add endent in calldataToMemory

* Improvements in concat util func gen

* Add utilitie

* General fixes

* Improvements

* Update src/cairoUtilFuncGen/memory/implicitConversion.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Linting

* General fixes and improvements

* Relocation of warplib function

* Update src/cairoUtilFuncGen/memory/memoryStruct.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Bug fix

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToStorage.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Update src/cairoUtilFuncGen/memory/memoryToCalldata.ts

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* Rename to try

* Endent

* try rename

* Add felt constant and minor improvements

* Typo

* Linting

* Restore .starknet_account_devnet

* Write variables as mut

* Remove triple sss

* Remainig triple sss

* Nitpicks

* remove .starknet_accounts_devnet

* Add some comments

* Untry

* Restore behaviour file to default

* Restore behaviour file to default 2

---------

Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>

* accesssor -> accessor

---------

Co-authored-by: rodrigo-pino <rodrodpino@gmail.com>
Co-authored-by: Piotr Piwoński <piwonskp@gmail.com>
Co-authored-by: Artem Yurchenko <44875844+murcake@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants