mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-10-20 18:56:17 +00:00
Add missing 63/64 rule documentation and a test (#462)
- Prominently point out the important differences of the `pallet-revive` runtime. - Add a test case illustrating the problem. See also: https://github.com/paritytech/contract-issues/issues/257 --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
1 parent
99b73ec083
commit
95ae938ddf
29 files changed
+172
-30
No files matched your search
@@ -7,12 +7,20 @@ Yul recompiler to LLVM, targetting RISC-V on [PolkaVM](https://github.com/koute/
|
|||||||
|
|
||||||
Check the [docs](https://paritytech.github.io/revive/) or visit [contracts.polkadot.io](https://docs.polkadot.com/develop/smart-contracts/) to learn more about `revive` and contracts on Polkadot!
|
Check the [docs](https://paritytech.github.io/revive/) or visit [contracts.polkadot.io](https://docs.polkadot.com/develop/smart-contracts/) to learn more about `revive` and contracts on Polkadot!
|
||||||
|
|
||||||
## Status
|
|
||||||
|
|
||||||
This is experimental software in active development and not ready just yet for production usage. Please do report any compiler related issues or missing features that are [not yet known to us](https://contracts.polkadot.io/known_issues/) here.
|
|
||||||
|
|
||||||
Discussion around the development is hosted on the [Polkadot Forum](https://forum.polkadot.network/t/contracts-update-solidity-on-polkavm/6949#a-new-solidity-compiler-1).
|
Discussion around the development is hosted on the [Polkadot Forum](https://forum.polkadot.network/t/contracts-update-solidity-on-polkavm/6949#a-new-solidity-compiler-1).
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
>
|
||||||
|
> Solidity on PVM is running on the `pallet-revive` runtime. This introduces **observable semantic differences** in comparison with the EVM.
|
||||||
|
>
|
||||||
|
> Study the [differences](https://paritytech.github.io/revive/user_guide/differences.html) section carefully. **Ignoring these differences may lead to defunct contracts.**
|
||||||
|
>
|
||||||
|
> Notable examples:
|
||||||
|
> - The 63/64 gas rule isn't implemented in the pallet (introduces potential DoS vector when calling other contracts)
|
||||||
|
> - Contract instantiation works differently (by hash instead of by code)
|
||||||
|
> - The gas model implemented by `pallet-revive` differs from Ethereum
|
||||||
|
> - The heap size is fixed instead of gas-metered and there's a fixed amount of stack size (contracts working fine on EVM may trap on PVM)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Building Solidity contracts for PolkaVM requires installing the following two compilers:
|
Building Solidity contracts for PolkaVM requires installing the following two compilers:
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ Therefore, in EVM terminology, the deploy code equals the runtime code.
|
|||||||
|
|
||||||
We are aware of the following differences in the translation of Solidity code.
|
We are aware of the following differences in the translation of Solidity code.
|
||||||
|
|
||||||
|
### The `63/64` gas rule
|
||||||
|
|
||||||
|
`pallet-revive` **doesn't apply the `63/64` gas rule**. We strongly advice to change any code calling untrusted contracts to supply a limited amount of gas only!
|
||||||
|
|
||||||
### `address.creationCode`
|
### `address.creationCode`
|
||||||
|
|
||||||
This returns the bytecode keccak256 hash instead.
|
This returns the bytecode keccak256 hash instead.
|
||||||
@@ -28,7 +32,7 @@ The below list contains noteworthy differences in the translation of YUL functio
|
|||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
>
|
>
|
||||||
> Many functions receive memory buffer offset pointer or size arguments. Since the PVM pointer size is 32 bit, supplying memory offset or buffer size values above `2^32-1` will trap the contract immediately.
|
> Many functions receive memory buffer offset pointer or size arguments. The PVM pointer size is 32 bit, supplying memory offset or buffer size values above `2^32-1` may lead to `OutOfGas` errors trap contract execution.
|
||||||
|
|
||||||
The `solc` compiler ought to always emit valid memory references, so Solidity dApp authors don't need to worry about this unless they deal with low level `assembly` code.
|
The `solc` compiler ought to always emit valid memory references, so Solidity dApp authors don't need to worry about this unless they deal with low level `assembly` code.
|
||||||
|
|
||||||
@@ -43,6 +47,10 @@ In general, revive preserves the memory layout, meaning low level memory operati
|
|||||||
|
|
||||||
In the constructor code, the offset is ignored and this always returns `0`.
|
In the constructor code, the offset is ignored and this always returns `0`.
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
>
|
||||||
|
> `pallet-revive` restricts the calldata size (to 128kb at the time of writing).
|
||||||
|
|
||||||
### `codecopy`
|
### `codecopy`
|
||||||
|
|
||||||
Only supported in constructor code.
|
Only supported in constructor code.
|
||||||
@@ -70,6 +78,10 @@ Returns the contract hash.
|
|||||||
|
|
||||||
Returns the contract hash size (constant value of `32`).
|
Returns the contract hash size (constant value of `32`).
|
||||||
|
|
||||||
|
### `revert`, `return`
|
||||||
|
|
||||||
|
`pallet-revive` restricts the returndata size (to 128kb at the time of writing).
|
||||||
|
|
||||||
### `prevrandao`, `difficulty`
|
### `prevrandao`, `difficulty`
|
||||||
|
|
||||||
Translates to a constant value of `2500000000000000`.
|
Translates to a constant value of `2500000000000000`.
|
||||||
|
|||||||
@@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
Hello and a warm welcome to the `revive` Solidity compiler book!
|
Hello and a warm welcome to the `revive` Solidity compiler book!
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
>
|
||||||
|
> Solidity on PVM is running on the `pallet-revive` runtime. This introduces **observable semantic differences** in comparison with the EVM.
|
||||||
|
>
|
||||||
|
> Study the [differences](https://paritytech.github.io/revive/user_guide/differences.html) section carefully. **Ignoring these differences may lead to defunct contracts.**
|
||||||
|
>
|
||||||
|
> Notable examples:
|
||||||
|
> - The 63/64 gas rule isn't implemented in the pallet (introduces potential DoS vector when calling other contracts)
|
||||||
|
> - Contract instantiation works differently (by hash instead of by code)
|
||||||
|
> - The gas model implemented by `pallet-revive` differs from Ethereum
|
||||||
|
> - The heap size is fixed instead of gas-metered and there's a fixed amount of stack size (contracts working fine on EVM may trap on PVM)
|
||||||
|
|
||||||
## Target audience
|
## Target audience
|
||||||
|
|
||||||
- **Solidity dApp developers** should read the [user guide](./user_guide.md). Solidity on PolkaVM introduces important differences to EVM which should be well understood.
|
- **Solidity dApp developers** should read the [user guide](./user_guide.md). Solidity on PolkaVM introduces important differences to EVM which should be well understood.
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity >=0.8.0;
|
||||||
|
|
||||||
|
/* runner.json
|
||||||
|
{
|
||||||
|
"differential": true,
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"Instantiate": {
|
||||||
|
"code": {
|
||||||
|
"Solidity": {
|
||||||
|
"contract": "RevertDataOob"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Call": {
|
||||||
|
"dest": {
|
||||||
|
"Instantiated": 0
|
||||||
|
},
|
||||||
|
"data": "eb8ac921000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Call": {
|
||||||
|
"dest": {
|
||||||
|
"Instantiated": 0
|
||||||
|
},
|
||||||
|
"data": "eb8ac92100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
contract RevertDataOob {
|
||||||
|
function test(uint256 offset, uint256 len) external {
|
||||||
|
assembly {
|
||||||
|
mstore(0, 0xcc572cf9)
|
||||||
|
mstore(32, offset)
|
||||||
|
mstore(64, len)
|
||||||
|
let stipend := mul(div(gas(), 64), 63) // On EVM this isn't necessary
|
||||||
|
let success := call(stipend, address(), 0, 28, 68, 0, 0)
|
||||||
|
mstore(0, 0xdeadbeef)
|
||||||
|
return(0, 32)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function main(uint256 offset, uint256 len) external pure {
|
||||||
|
assembly {
|
||||||
|
mstore(0x40, 0)
|
||||||
|
revert(offset, len)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,6 +44,7 @@ test_spec!(create, "CreateB", "Create.sol");
|
|||||||
test_spec!(call, "Caller", "Call.sol");
|
test_spec!(call, "Caller", "Call.sol");
|
||||||
test_spec!(balance, "Balance", "Balance.sol");
|
test_spec!(balance, "Balance", "Balance.sol");
|
||||||
test_spec!(return_data_oob, "ReturnDataOob", "ReturnDataOob.sol");
|
test_spec!(return_data_oob, "ReturnDataOob", "ReturnDataOob.sol");
|
||||||
|
test_spec!(revert_data_oob, "RevertDataOob", "RevertDataOob.sol");
|
||||||
test_spec!(immutables, "Immutables", "Immutables.sol");
|
test_spec!(immutables, "Immutables", "Immutables.sol");
|
||||||
test_spec!(transaction, "Transaction", "Transaction.sol");
|
test_spec!(transaction, "Transaction", "Transaction.sol");
|
||||||
test_spec!(block_hash, "BlockHash", "BlockHash.sol");
|
test_spec!(block_hash, "BlockHash", "BlockHash.sol");
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
|
|||||||
+13
-1
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
@@ -176,6 +176,18 @@
|
|||||||
<main>
|
<main>
|
||||||
<h1 id="welcome"><a class="header" href="#welcome">Welcome</a></h1>
|
<h1 id="welcome"><a class="header" href="#welcome">Welcome</a></h1>
|
||||||
<p>Hello and a warm welcome to the <code>revive</code> Solidity compiler book!</p>
|
<p>Hello and a warm welcome to the <code>revive</code> Solidity compiler book!</p>
|
||||||
|
<blockquote class="blockquote-tag blockquote-tag-warning">
|
||||||
|
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Warning</p>
|
||||||
|
<p>Solidity on PVM is running on the <code>pallet-revive</code> runtime. This introduces <strong>observable semantic differences</strong> in comparison with the EVM.</p>
|
||||||
|
<p>Study the <a href="https://paritytech.github.io/revive/user_guide/differences.html">differences</a> section carefully. <strong>Ignoring these differences may lead to defunct contracts.</strong></p>
|
||||||
|
<p>Notable examples:</p>
|
||||||
|
<ul>
|
||||||
|
<li>The 63/64 gas rule isn’t implemented in the pallet (introduces potential DoS vector when calling other contracts)</li>
|
||||||
|
<li>Contract instantiation works differently (by hash instead of by code)</li>
|
||||||
|
<li>The gas model implemented by <code>pallet-revive</code> differs from Ethereum</li>
|
||||||
|
<li>The heap size is fixed instead of gas-metered and there’s a fixed amount of stack size (contracts working fine on EVM may trap on PVM)</li>
|
||||||
|
</ul>
|
||||||
|
</blockquote>
|
||||||
<h2 id="target-audience"><a class="header" href="#target-audience">Target audience</a></h2>
|
<h2 id="target-audience"><a class="header" href="#target-audience">Target audience</a></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Solidity dApp developers</strong> should read the <a href="./user_guide.html">user guide</a>. Solidity on PolkaVM introduces important differences to EVM which should be well understood.</li>
|
<li><strong>Solidity dApp developers</strong> should read the <a href="./user_guide.html">user guide</a>. Solidity on PolkaVM introduces important differences to EVM which should be well understood.</li>
|
||||||
|
|||||||
+22
-2
@@ -36,7 +36,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
@@ -177,6 +177,18 @@
|
|||||||
<main>
|
<main>
|
||||||
<h1 id="welcome"><a class="header" href="#welcome">Welcome</a></h1>
|
<h1 id="welcome"><a class="header" href="#welcome">Welcome</a></h1>
|
||||||
<p>Hello and a warm welcome to the <code>revive</code> Solidity compiler book!</p>
|
<p>Hello and a warm welcome to the <code>revive</code> Solidity compiler book!</p>
|
||||||
|
<blockquote class="blockquote-tag blockquote-tag-warning">
|
||||||
|
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Warning</p>
|
||||||
|
<p>Solidity on PVM is running on the <code>pallet-revive</code> runtime. This introduces <strong>observable semantic differences</strong> in comparison with the EVM.</p>
|
||||||
|
<p>Study the <a href="https://paritytech.github.io/revive/user_guide/differences.html">differences</a> section carefully. <strong>Ignoring these differences may lead to defunct contracts.</strong></p>
|
||||||
|
<p>Notable examples:</p>
|
||||||
|
<ul>
|
||||||
|
<li>The 63/64 gas rule isn’t implemented in the pallet (introduces potential DoS vector when calling other contracts)</li>
|
||||||
|
<li>Contract instantiation works differently (by hash instead of by code)</li>
|
||||||
|
<li>The gas model implemented by <code>pallet-revive</code> differs from Ethereum</li>
|
||||||
|
<li>The heap size is fixed instead of gas-metered and there’s a fixed amount of stack size (contracts working fine on EVM may trap on PVM)</li>
|
||||||
|
</ul>
|
||||||
|
</blockquote>
|
||||||
<h2 id="target-audience"><a class="header" href="#target-audience">Target audience</a></h2>
|
<h2 id="target-audience"><a class="header" href="#target-audience">Target audience</a></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Solidity dApp developers</strong> should read the <a href="#resolc-user-guide">user guide</a>. Solidity on PolkaVM introduces important differences to EVM which should be well understood.</li>
|
<li><strong>Solidity dApp developers</strong> should read the <a href="#resolc-user-guide">user guide</a>. Solidity on PolkaVM introduces important differences to EVM which should be well understood.</li>
|
||||||
@@ -365,13 +377,15 @@ Therefore, in EVM terminology, the deploy code equals the runtime code.</p>
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
<h2 id="solidity"><a class="header" href="#solidity">Solidity</a></h2>
|
<h2 id="solidity"><a class="header" href="#solidity">Solidity</a></h2>
|
||||||
<p>We are aware of the following differences in the translation of Solidity code.</p>
|
<p>We are aware of the following differences in the translation of Solidity code.</p>
|
||||||
|
<h3 id="the-6364-gas-rule"><a class="header" href="#the-6364-gas-rule">The <code>63/64</code> gas rule</a></h3>
|
||||||
|
<p><code>pallet-revive</code> <strong>doesn’t apply the <code>63/64</code> gas rule</strong>. We strongly advice to change any code calling untrusted contracts to supply a limited amount of gas only!</p>
|
||||||
<h3 id="addresscreationcode"><a class="header" href="#addresscreationcode"><code>address.creationCode</code></a></h3>
|
<h3 id="addresscreationcode"><a class="header" href="#addresscreationcode"><code>address.creationCode</code></a></h3>
|
||||||
<p>This returns the bytecode keccak256 hash instead.</p>
|
<p>This returns the bytecode keccak256 hash instead.</p>
|
||||||
<h2 id="yul-functions"><a class="header" href="#yul-functions">YUL functions</a></h2>
|
<h2 id="yul-functions"><a class="header" href="#yul-functions">YUL functions</a></h2>
|
||||||
<p>The below list contains noteworthy differences in the translation of YUL functions.</p>
|
<p>The below list contains noteworthy differences in the translation of YUL functions.</p>
|
||||||
<blockquote class="blockquote-tag blockquote-tag-note">
|
<blockquote class="blockquote-tag blockquote-tag-note">
|
||||||
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
|
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
|
||||||
<p>Many functions receive memory buffer offset pointer or size arguments. Since the PVM pointer size is 32 bit, supplying memory offset or buffer size values above <code>2^32-1</code> will trap the contract immediately.</p>
|
<p>Many functions receive memory buffer offset pointer or size arguments. The PVM pointer size is 32 bit, supplying memory offset or buffer size values above <code>2^32-1</code> may lead to <code>OutOfGas</code> errors trap contract execution.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p>The <code>solc</code> compiler ought to always emit valid memory references, so Solidity dApp authors don’t need to worry about this unless they deal with low level <code>assembly</code> code.</p>
|
<p>The <code>solc</code> compiler ought to always emit valid memory references, so Solidity dApp authors don’t need to worry about this unless they deal with low level <code>assembly</code> code.</p>
|
||||||
<h3 id="mload-mstore-msize-mcopy-memory-related-functions"><a class="header" href="#mload-mstore-msize-mcopy-memory-related-functions"><code>mload</code>, <code>mstore</code>, <code>msize</code>, <code>mcopy</code> (memory related functions)</a></h3>
|
<h3 id="mload-mstore-msize-mcopy-memory-related-functions"><a class="header" href="#mload-mstore-msize-mcopy-memory-related-functions"><code>mload</code>, <code>mstore</code>, <code>msize</code>, <code>mcopy</code> (memory related functions)</a></h3>
|
||||||
@@ -383,6 +397,10 @@ Therefore, in EVM terminology, the deploy code equals the runtime code.</p>
|
|||||||
</ul>
|
</ul>
|
||||||
<h3 id="calldataload-calldatacopy"><a class="header" href="#calldataload-calldatacopy"><code>calldataload</code>, <code>calldatacopy</code></a></h3>
|
<h3 id="calldataload-calldatacopy"><a class="header" href="#calldataload-calldatacopy"><code>calldataload</code>, <code>calldatacopy</code></a></h3>
|
||||||
<p>In the constructor code, the offset is ignored and this always returns <code>0</code>.</p>
|
<p>In the constructor code, the offset is ignored and this always returns <code>0</code>.</p>
|
||||||
|
<blockquote class="blockquote-tag blockquote-tag-warning">
|
||||||
|
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Warning</p>
|
||||||
|
<p><code>pallet-revive</code> restricts the calldata size (to 128kb at the time of writing).</p>
|
||||||
|
</blockquote>
|
||||||
<h3 id="codecopy"><a class="header" href="#codecopy"><code>codecopy</code></a></h3>
|
<h3 id="codecopy"><a class="header" href="#codecopy"><code>codecopy</code></a></h3>
|
||||||
<p>Only supported in constructor code.</p>
|
<p>Only supported in constructor code.</p>
|
||||||
<h3 id="create-create2"><a class="header" href="#create-create2"><code>create</code>, <code>create2</code></a></h3>
|
<h3 id="create-create2"><a class="header" href="#create-create2"><code>create</code>, <code>create2</code></a></h3>
|
||||||
@@ -403,6 +421,8 @@ Thus, <code>revive</code> is able to supply the expected code hash and construct
|
|||||||
<p>Returns the contract hash.</p>
|
<p>Returns the contract hash.</p>
|
||||||
<h3 id="datasize"><a class="header" href="#datasize"><code>datasize</code></a></h3>
|
<h3 id="datasize"><a class="header" href="#datasize"><code>datasize</code></a></h3>
|
||||||
<p>Returns the contract hash size (constant value of <code>32</code>).</p>
|
<p>Returns the contract hash size (constant value of <code>32</code>).</p>
|
||||||
|
<h3 id="revert-return"><a class="header" href="#revert-return"><code>revert</code>, <code>return</code></a></h3>
|
||||||
|
<p><code>pallet-revive</code> restricts the returndata size (to 128kb at the time of writing).</p>
|
||||||
<h3 id="prevrandao-difficulty"><a class="header" href="#prevrandao-difficulty"><code>prevrandao</code>, <code>difficulty</code></a></h3>
|
<h3 id="prevrandao-difficulty"><a class="header" href="#prevrandao-difficulty"><code>prevrandao</code>, <code>difficulty</code></a></h3>
|
||||||
<p>Translates to a constant value of <code>2500000000000000</code>.</p>
|
<p>Translates to a constant value of <code>2500000000000000</code>.</p>
|
||||||
<h3 id="pc-extcodecopy"><a class="header" href="#pc-extcodecopy"><code>pc</code>, <code>extcodecopy</code></a></h3>
|
<h3 id="pc-extcodecopy"><a class="header" href="#pc-extcodecopy"><code>pc</code>, <code>extcodecopy</code></a></h3>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ window.search = window.search || {};
|
|||||||
if (yes) {
|
if (yes) {
|
||||||
loadSearchScript(
|
loadSearchScript(
|
||||||
window.path_to_searchindex_js ||
|
window.path_to_searchindex_js ||
|
||||||
path_to_root + 'searchindex-4ae832c1.js',
|
path_to_root + 'searchindex-c7304031.js',
|
||||||
'mdbook-search-index');
|
'mdbook-search-index');
|
||||||
search_wrap.classList.remove('hidden');
|
search_wrap.classList.remove('hidden');
|
||||||
searchicon.setAttribute('aria-expanded', 'true');
|
searchicon.setAttribute('aria-expanded', 'true');
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
window.search = Object.assign(window.search, JSON.parse('{"doc_urls":["welcome.html#welcome","welcome.html#target-audience","welcome.html#other-polkadot-contracts-resources","welcome.html#about","user_guide.html#resolc-user-guide","user_guide.html#revive-vs-resolc-nomenclature","user_guide/installation.html#installation","user_guide/installation.html#resolc-binary-releases","user_guide/installation.html#installing-the-solc-dependency","user_guide/installation.html#revive-npm-package","user_guide/installation.html#buidling-resolc-from-source","user_guide/cli.html#cli-usage","user_guide/cli.html#llvm-optimization-levels","user_guide/cli.html#stack-size","user_guide/cli.html#heap-size","user_guide/cli.html#solc","user_guide/cli.html#debug-artifacts","user_guide/cli.html#debug-info","user_guide/cli.html#deploy-time-linking","user_guide/js.html#js-npm-package","user_guide/tooling.html#tooling-integration","user_guide/tooling.html#solidity-toolkits","user_guide/tooling.html#compiler-explorer","user_guide/tooling.html#remix-ide","user_guide/std_json.html#standard-json-interface","user_guide/std_json.html#the-settingspolkavm-object","user_guide/std_json.html#settingspolkavmdebuginformation","user_guide/std_json.html#the-settingspolkavmmemoryconfig-object","user_guide/std_json.html#the-settingsoptimizer-object","user_guide/std_json.html#settingsoptimizermode","user_guide/std_json.html#settingsllvmarguments","user_guide/differences.html#differences-to-evm","user_guide/differences.html#deploy-code-vs-runtime-code","user_guide/differences.html#solidity","user_guide/differences.html#addresscreationcode","user_guide/differences.html#yul-functions","user_guide/differences.html#mload-mstore-msize-mcopy-memory-related-functions","user_guide/differences.html#calldataload-calldatacopy","user_guide/differences.html#codecopy","user_guide/differences.html#create-create2","user_guide/differences.html#dataoffset","user_guide/differences.html#datasize","user_guide/differences.html#prevrandao-difficulty","user_guide/differences.html#pc-extcodecopy","user_guide/differences.html#blobhash-blobbasefee","user_guide/differences.html#difference-regarding-the-solc-via-ir-mode","user_guide/differences.html#example-state-variable-initialization-order-in-inheritance","user_guide/rust_libraries.html#rust-contract-libraries","revive_runner.html#revive-runner-sandbox","revive_runner.html#installation-and-usage","revive_runner.html#trace-logs","revive_runner.html#automatic-contract-instantiation","revive_runner.html#example","developer_guide.html#developer-guide","developer_guide/contributing.html#contributor-guide","developer_guide/contributing.html#getting-started","developer_guide/contributing.html#using-the-makefile","developer_guide/contributing.html#codebase-organization","developer_guide/contributing.html#contribution-rules","developer_guide/contributing.html#style-guide","developer_guide/contributing.html#ai-policy","developer_guide/architecture.html#compiler-architecture-and-internals","developer_guide/architecture.html#resolc","developer_guide/architecture.html#reproducible-contract-builds","developer_guide/architecture.html#the-revive-compiler-libraries","developer_guide/architecture.html#evm-heap-memory","developer_guide/architecture.html#the-llvm-dependency","developer_guide/architecture.html#custom-optimizations","developer_guide/target.html#pvm-and-the-pallet-revive-runtime-target","developer_guide/target.html#target-cpu-configuration","developer_guide/target.html#why-pvm","developer_guide/target.html#host-environment-pallet-revive","developer_guide/testing.html#testing-strategy","developer_guide/testing.html#bug-compatibility-with-ethereum-solidity","developer_guide/testing.html#differential-integration-tests","developer_guide/testing.html#the-differential-testing-utility","developer_guide/cross_compilation.html#cross-compilation","developer_guide/cross_compilation.html#wasm-via-emscripten","developer_guide/cross_compilation.html#musl-libc","faq.html#faq","faq.html#what-evm-version-do-you-support","faq.html#is-inline-assembly-supported","faq.html#do-you-support-opcode-xy","faq.html#in-what-solidity-version-should-i-write-my-dapp","faq.html#tool-xy-says-the-contract-size-is-larger-than-24kb-and-will-fail-to-deploy","faq.html#is-resolc-a-drop-in-replacement-for-solc","roadmap.html#vision-and-roadmap","roadmap.html#roadmap"],"index":{"documentStore":{"docInfo":{"0":{"body":7,"breadcrumbs":2,"title":1},"1":{"body":22,"breadcrumbs":3,"title":2},"10":{"body":6,"breadcrumbs":7,"title":3},"11":{"body":33,"breadcrumbs":8,"title":2},"12":{"body":53,"breadcrumbs":9,"title":3},"13":{"body":62,"breadcrumbs":8,"title":2},"14":{"body":75,"breadcrumbs":8,"title":2},"15":{"body":10,"breadcrumbs":7,"title":1},"16":{"body":26,"breadcrumbs":8,"title":2},"17":{"body":15,"breadcrumbs":8,"title":2},"18":{"body":236,"breadcrumbs":9,"title":3},"19":{"body":31,"breadcrumbs":9,"title":3},"2":{"body":7,"breadcrumbs":4,"title":3},"20":{"body":9,"breadcrumbs":Line truncated
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
window.search = Object.assign(window.search, JSON.parse('{"doc_urls":["welcome.html#welcome","welcome.html#target-audience","welcome.html#other-polkadot-contracts-resources","welcome.html#about","user_guide.html#resolc-user-guide","user_guide.html#revive-vs-resolc-nomenclature","user_guide/installation.html#installation","user_guide/installation.html#resolc-binary-releases","user_guide/installation.html#installing-the-solc-dependency","user_guide/installation.html#revive-npm-package","user_guide/installation.html#buidling-resolc-from-source","user_guide/cli.html#cli-usage","user_guide/cli.html#llvm-optimization-levels","user_guide/cli.html#stack-size","user_guide/cli.html#heap-size","user_guide/cli.html#solc","user_guide/cli.html#debug-artifacts","user_guide/cli.html#debug-info","user_guide/cli.html#deploy-time-linking","user_guide/js.html#js-npm-package","user_guide/tooling.html#tooling-integration","user_guide/tooling.html#solidity-toolkits","user_guide/tooling.html#compiler-explorer","user_guide/tooling.html#remix-ide","user_guide/std_json.html#standard-json-interface","user_guide/std_json.html#the-settingspolkavm-object","user_guide/std_json.html#settingspolkavmdebuginformation","user_guide/std_json.html#the-settingspolkavmmemoryconfig-object","user_guide/std_json.html#the-settingsoptimizer-object","user_guide/std_json.html#settingsoptimizermode","user_guide/std_json.html#settingsllvmarguments","user_guide/differences.html#differences-to-evm","user_guide/differences.html#deploy-code-vs-runtime-code","user_guide/differences.html#solidity","user_guide/differences.html#the-6364-gas-rule","user_guide/differences.html#addresscreationcode","user_guide/differences.html#yul-functions","user_guide/differences.html#mload-mstore-msize-mcopy-memory-related-functions","user_guide/differences.html#calldataload-calldatacopy","user_guide/differences.html#codecopy","user_guide/differences.html#create-create2","user_guide/differences.html#dataoffset","user_guide/differences.html#datasize","user_guide/differences.html#revert-return","user_guide/differences.html#prevrandao-difficulty","user_guide/differences.html#pc-extcodecopy","user_guide/differences.html#blobhash-blobbasefee","user_guide/differences.html#difference-regarding-the-solc-via-ir-mode","user_guide/differences.html#example-state-variable-initialization-order-in-inheritance","user_guide/rust_libraries.html#rust-contract-libraries","revive_runner.html#revive-runner-sandbox","revive_runner.html#installation-and-usage","revive_runner.html#trace-logs","revive_runner.html#automatic-contract-instantiation","revive_runner.html#example","developer_guide.html#developer-guide","developer_guide/contributing.html#contributor-guide","developer_guide/contributing.html#getting-started","developer_guide/contributing.html#using-the-makefile","developer_guide/contributing.html#codebase-organization","developer_guide/contributing.html#contribution-rules","developer_guide/contributing.html#style-guide","developer_guide/contributing.html#ai-policy","developer_guide/architecture.html#compiler-architecture-and-internals","developer_guide/architecture.html#resolc","developer_guide/architecture.html#reproducible-contract-builds","developer_guide/architecture.html#the-revive-compiler-libraries","developer_guide/architecture.html#evm-heap-memory","developer_guide/architecture.html#the-llvm-dependency","developer_guide/architecture.html#custom-optimizations","developer_guide/target.html#pvm-and-the-pallet-revive-runtime-target","developer_guide/target.html#target-cpu-configuration","developer_guide/target.html#why-pvm","developer_guide/target.html#host-environment-pallet-revive","developer_guide/testing.html#testing-strategy","developer_guide/testing.html#bug-compatibility-with-ethereum-solidity","developer_guide/testing.html#differential-integration-tests","developer_guide/testing.html#the-differential-testing-utility","developer_guide/cross_compilation.html#cross-compilation","developer_guide/cross_compilation.html#wasm-via-emscripten","developer_guide/cross_compilation.html#musl-libc","faq.html#faq","faq.html#what-evm-version-do-you-support","faq.html#is-inline-assembly-supported","faq.html#do-you-support-opcode-xy","faq.html#in-what-solidity-version-should-i-write-my-dapp","faq.html#tool-xy-says-the-contract-size-is-larger-than-24kb-and-will-fail-to-deploy","faq.html#is-resolc-a-drop-in-replacement-for-solc","roadmap.html#vision-and-roadmap","roadmap.html#roadmap"],"index":{"documentStore":{"docInfo":{"0":{"body":74,"breadcrumbs":2,"title":1},"1":{"body":22,"breadcrumbs":3,"title":2},"10":{"body":6,"breadcrumbs":7,"title":3},"11":{"body":33,"breadcrumbs":8,"title":2},"12":{"body":53,"breadcrumbs":9,"title":3},"13":{"body":62,"breadcrumbs":8,"title":2},"14":{"body":75,"breadcrumbs":8,"title":2},"15":{"body":10,"breadcrumbs":7,"title":1},"16":{"body":26,"breadcrumbs":8,"title":2},"17":{"body":15,"breadcrumbs":8,"title":2},"18":{"body":236,"breadcrumbs":9,"title":3},"19":{"body":31,"breLine truncated
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
@@ -187,13 +187,15 @@ Therefore, in EVM terminology, the deploy code equals the runtime code.</p>
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
<h2 id="solidity"><a class="header" href="#solidity">Solidity</a></h2>
|
<h2 id="solidity"><a class="header" href="#solidity">Solidity</a></h2>
|
||||||
<p>We are aware of the following differences in the translation of Solidity code.</p>
|
<p>We are aware of the following differences in the translation of Solidity code.</p>
|
||||||
|
<h3 id="the-6364-gas-rule"><a class="header" href="#the-6364-gas-rule">The <code>63/64</code> gas rule</a></h3>
|
||||||
|
<p><code>pallet-revive</code> <strong>doesn’t apply the <code>63/64</code> gas rule</strong>. We strongly advice to change any code calling untrusted contracts to supply a limited amount of gas only!</p>
|
||||||
<h3 id="addresscreationcode"><a class="header" href="#addresscreationcode"><code>address.creationCode</code></a></h3>
|
<h3 id="addresscreationcode"><a class="header" href="#addresscreationcode"><code>address.creationCode</code></a></h3>
|
||||||
<p>This returns the bytecode keccak256 hash instead.</p>
|
<p>This returns the bytecode keccak256 hash instead.</p>
|
||||||
<h2 id="yul-functions"><a class="header" href="#yul-functions">YUL functions</a></h2>
|
<h2 id="yul-functions"><a class="header" href="#yul-functions">YUL functions</a></h2>
|
||||||
<p>The below list contains noteworthy differences in the translation of YUL functions.</p>
|
<p>The below list contains noteworthy differences in the translation of YUL functions.</p>
|
||||||
<blockquote class="blockquote-tag blockquote-tag-note">
|
<blockquote class="blockquote-tag blockquote-tag-note">
|
||||||
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
|
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>Note</p>
|
||||||
<p>Many functions receive memory buffer offset pointer or size arguments. Since the PVM pointer size is 32 bit, supplying memory offset or buffer size values above <code>2^32-1</code> will trap the contract immediately.</p>
|
<p>Many functions receive memory buffer offset pointer or size arguments. The PVM pointer size is 32 bit, supplying memory offset or buffer size values above <code>2^32-1</code> may lead to <code>OutOfGas</code> errors trap contract execution.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p>The <code>solc</code> compiler ought to always emit valid memory references, so Solidity dApp authors don’t need to worry about this unless they deal with low level <code>assembly</code> code.</p>
|
<p>The <code>solc</code> compiler ought to always emit valid memory references, so Solidity dApp authors don’t need to worry about this unless they deal with low level <code>assembly</code> code.</p>
|
||||||
<h3 id="mload-mstore-msize-mcopy-memory-related-functions"><a class="header" href="#mload-mstore-msize-mcopy-memory-related-functions"><code>mload</code>, <code>mstore</code>, <code>msize</code>, <code>mcopy</code> (memory related functions)</a></h3>
|
<h3 id="mload-mstore-msize-mcopy-memory-related-functions"><a class="header" href="#mload-mstore-msize-mcopy-memory-related-functions"><code>mload</code>, <code>mstore</code>, <code>msize</code>, <code>mcopy</code> (memory related functions)</a></h3>
|
||||||
@@ -205,6 +207,10 @@ Therefore, in EVM terminology, the deploy code equals the runtime code.</p>
|
|||||||
</ul>
|
</ul>
|
||||||
<h3 id="calldataload-calldatacopy"><a class="header" href="#calldataload-calldatacopy"><code>calldataload</code>, <code>calldatacopy</code></a></h3>
|
<h3 id="calldataload-calldatacopy"><a class="header" href="#calldataload-calldatacopy"><code>calldataload</code>, <code>calldatacopy</code></a></h3>
|
||||||
<p>In the constructor code, the offset is ignored and this always returns <code>0</code>.</p>
|
<p>In the constructor code, the offset is ignored and this always returns <code>0</code>.</p>
|
||||||
|
<blockquote class="blockquote-tag blockquote-tag-warning">
|
||||||
|
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Warning</p>
|
||||||
|
<p><code>pallet-revive</code> restricts the calldata size (to 128kb at the time of writing).</p>
|
||||||
|
</blockquote>
|
||||||
<h3 id="codecopy"><a class="header" href="#codecopy"><code>codecopy</code></a></h3>
|
<h3 id="codecopy"><a class="header" href="#codecopy"><code>codecopy</code></a></h3>
|
||||||
<p>Only supported in constructor code.</p>
|
<p>Only supported in constructor code.</p>
|
||||||
<h3 id="create-create2"><a class="header" href="#create-create2"><code>create</code>, <code>create2</code></a></h3>
|
<h3 id="create-create2"><a class="header" href="#create-create2"><code>create</code>, <code>create2</code></a></h3>
|
||||||
@@ -225,6 +231,8 @@ Thus, <code>revive</code> is able to supply the expected code hash and construct
|
|||||||
<p>Returns the contract hash.</p>
|
<p>Returns the contract hash.</p>
|
||||||
<h3 id="datasize"><a class="header" href="#datasize"><code>datasize</code></a></h3>
|
<h3 id="datasize"><a class="header" href="#datasize"><code>datasize</code></a></h3>
|
||||||
<p>Returns the contract hash size (constant value of <code>32</code>).</p>
|
<p>Returns the contract hash size (constant value of <code>32</code>).</p>
|
||||||
|
<h3 id="revert-return"><a class="header" href="#revert-return"><code>revert</code>, <code>return</code></a></h3>
|
||||||
|
<p><code>pallet-revive</code> restricts the returndata size (to 128kb at the time of writing).</p>
|
||||||
<h3 id="prevrandao-difficulty"><a class="header" href="#prevrandao-difficulty"><code>prevrandao</code>, <code>difficulty</code></a></h3>
|
<h3 id="prevrandao-difficulty"><a class="header" href="#prevrandao-difficulty"><code>prevrandao</code>, <code>difficulty</code></a></h3>
|
||||||
<p>Translates to a constant value of <code>2500000000000000</code>.</p>
|
<p>Translates to a constant value of <code>2500000000000000</code>.</p>
|
||||||
<h3 id="pc-extcodecopy"><a class="header" href="#pc-extcodecopy"><code>pc</code>, <code>extcodecopy</code></a></h3>
|
<h3 id="pc-extcodecopy"><a class="header" href="#pc-extcodecopy"><code>pc</code>, <code>extcodecopy</code></a></h3>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "../";
|
const path_to_root = "../";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "../searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "../searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="../toc-6f3f265e.js"></script>
|
<script src="../toc-6f3f265e.js"></script>
|
||||||
|
|||||||
+13
-1
@@ -35,7 +35,7 @@
|
|||||||
const path_to_root = "";
|
const path_to_root = "";
|
||||||
const default_light_theme = "light";
|
const default_light_theme = "light";
|
||||||
const default_dark_theme = "navy";
|
const default_dark_theme = "navy";
|
||||||
window.path_to_searchindex_js = "searchindex-4ae832c1.js";
|
window.path_to_searchindex_js = "searchindex-c7304031.js";
|
||||||
</script>
|
</script>
|
||||||
<!-- Start loading toc.js asap -->
|
<!-- Start loading toc.js asap -->
|
||||||
<script src="toc-6f3f265e.js"></script>
|
<script src="toc-6f3f265e.js"></script>
|
||||||
@@ -176,6 +176,18 @@
|
|||||||
<main>
|
<main>
|
||||||
<h1 id="welcome"><a class="header" href="#welcome">Welcome</a></h1>
|
<h1 id="welcome"><a class="header" href="#welcome">Welcome</a></h1>
|
||||||
<p>Hello and a warm welcome to the <code>revive</code> Solidity compiler book!</p>
|
<p>Hello and a warm welcome to the <code>revive</code> Solidity compiler book!</p>
|
||||||
|
<blockquote class="blockquote-tag blockquote-tag-warning">
|
||||||
|
<p class="blockquote-tag-title"><svg viewbox="0 0 16 16" width="18" height="18"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Warning</p>
|
||||||
|
<p>Solidity on PVM is running on the <code>pallet-revive</code> runtime. This introduces <strong>observable semantic differences</strong> in comparison with the EVM.</p>
|
||||||
|
<p>Study the <a href="https://paritytech.github.io/revive/user_guide/differences.html">differences</a> section carefully. <strong>Ignoring these differences may lead to defunct contracts.</strong></p>
|
||||||
|
<p>Notable examples:</p>
|
||||||
|
<ul>
|
||||||
|
<li>The 63/64 gas rule isn’t implemented in the pallet (introduces potential DoS vector when calling other contracts)</li>
|
||||||
|
<li>Contract instantiation works differently (by hash instead of by code)</li>
|
||||||
|
<li>The gas model implemented by <code>pallet-revive</code> differs from Ethereum</li>
|
||||||
|
<li>The heap size is fixed instead of gas-metered and there’s a fixed amount of stack size (contracts working fine on EVM may trap on PVM)</li>
|
||||||
|
</ul>
|
||||||
|
</blockquote>
|
||||||
<h2 id="target-audience"><a class="header" href="#target-audience">Target audience</a></h2>
|
<h2 id="target-audience"><a class="header" href="#target-audience">Target audience</a></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Solidity dApp developers</strong> should read the <a href="./user_guide.html">user guide</a>. Solidity on PolkaVM introduces important differences to EVM which should be well understood.</li>
|
<li><strong>Solidity dApp developers</strong> should read the <a href="./user_guide.html">user guide</a>. Solidity on PolkaVM introduces important differences to EVM which should be well understood.</li>
|
||||||
|
|||||||
Reference in new issue
Block a user