rskip | title | description | status | purpose | author | layer | complexity | created |
---|---|---|---|---|---|---|---|---|
34 |
Contract const DATA Sections |
Draft |
Sca |
SDL (@sergiodemianlerner) |
Core |
1 |
2017-01-20 |
RSKIP | 34 |
---|---|
Title | Contract const DATA Sections |
Created | 20-JAN-2017 |
Author | SDL |
Purpose | Sca |
Layer | Core |
Complexity | 1 |
Status | Draft |
Contracts can be used as data chuncks because CODECOPY allows copying other contracts code. However code passes semantic checks, and RSK adds headers to code. Therefore code is not suitable anymore to hold unformatted data. This RSKIP discusses how to allow const data sections.
There are several possible solutions:
-
The code header will allow the specification of two sections. Only two sections will be allowed: code and data. Each section will specify an base offset. Data will be memory-mapped, so that memory gaps do not consume gas"
-
A new opcode is created: DATA which automatically stops any code analysis. No JUMP will be allowed past this limit. The VM will stop processing if the PC enters the data section as if it was the end of code. The contract that uses CODECOPY must known the offset where data is located.
-
Another approach is that two STOP opcodes in sequence means DATA section starts. The second STOP opcode can not serve any useful use, because there is no JUMPDESTS between them
Solution 3 is simpler but may break compatibility with Ethereum contracts.
New opcode: DATA
This opcode executes as STOP.
Copyright and related rights waived via CC0.