pouladzade / seriality Goto Github PK
View Code? Open in Web Editor NEWSeriality is a library for serializing and de-serializing all the Solidity types in a very efficient way which mostly written in solidity-assembly
License: Apache License 2.0
Seriality is a library for serializing and de-serializing all the Solidity types in a very efficient way which mostly written in solidity-assembly
License: Apache License 2.0
Could you please update this for solidity 0.5.0 release?
I have faced a lot of compilation error. I fixed few which don't involve with assembly. But for assembly like this below I think its better to ask for you help here.
/Users/hasnaeenferdous/startbahn/dev/github/artcontract/app/contracts/src/BytesToTypes.sol:59:13: SyntaxError: The use of labels is disallowed. Please use "if", "switch", "for" or function calls instead.
loop:
^--^
,/Users/hasnaeenferdous/startbahn/dev/github/artcontract/app/contracts/src/BytesToTypes.sol:59:13: SyntaxError: Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
loop:
^--^
,/Users/hasnaeenferdous/startbahn/dev/github/artcontract/app/contracts/src/BytesToTypes.sol:64:13: SyntaxError: Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
jumpi(loop , lt(loop_index , chunk_count))
^----------------------------------------^
,/Users/hasnaeenferdous/startbahn/dev/github/artcontract/app/contracts/src/TypesToBytes.sol:45:9: SyntaxError: The use of labels is disallowed. Please use "if", "switch", "for" or function calls instead.
loop:
^--^
,/Users/hasnaeenferdous/startbahn/dev/github/artcontract/app/contracts/src/TypesToBytes.sol:45:9: SyntaxError: Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
loop:
^--^
,/Users/hasnaeenferdous/startbahn/dev/github/artcontract/app/contracts/src/TypesToBytes.sol:50:13: SyntaxError: Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
jumpi(loop , lt(index,stack_size))
Hi!
first of all: Great work! this functions are real useful to make my contracts much more efficient!
But I suggest to implement Seriality as am solidity Library. So you don't have to copy the code while deployment!
( I think solidity inheritance works that way: "When a contract inherits from other contracts, only a single contract is created on the blockchain, and the code from all the base contracts is compiled into the created contract." docs.
Thanks for share your Work!
Would be great to update library to work with more current compilers.
This statement in the docs could be much improved:
The buffer size must be chosen very carefully, if you are not sure about that choose your biggest guess.
I'd like to save everyone hours of debugging insanity.
Minimum buffer size is the summation of sizes of all serialized values and enough padding such that this size value is a multiple of 32. Or in other words, up to 31 bytes of padding is needed.
Don't allocate a buffer like this based solely on the summation of sizeOf
results for each variable:
uint size = sizeOfBool()*3 + sizeOfUnit(32)*2 + sizeofAddress()*2;
bytes memory data = new bytes(size);
The above will lead to undefined behavior after serializing values into it, incorrect program behavior, and Truffle/Ganache will do even weirder stuff (freeze/crash).
Compute the size of the buffer to account for needed padding:
uint size = sizeOfBool()*3 + sizeOfUnit(32)*2 + sizeofAddress()*2;
if ((size % 32) > 0) {
size += 32 - (size % 32);
}
bytes memory data = new bytes(size);
Contributing to this project will be easier if there is one command which can run the test suite.
Demonstrating that the commands exists and works can be done with CI or GitHub Action, Travis, or another CI provider.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.