`--newyork` returns 32 bytes from a 16-byte heap

オープン
#752 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

Start by tracing how the --newyork pipeline handles heap bounds for the Yul mstore and return operations; the issue gives a minimal reproducer and the relevant compiler options. Compare execution with --heap-size 16 and --heap-size 32 across both pipelines and optimization levels. Done means the 16-byte heap traps with ContractTrapped under both pipelines, while the 32-byte heap returns the same 32-byte word.

索引モデルが issue の本文から書いたものです。

説明

With --heap-size 16, mstore(off, 1); return(off, 32) at off = 0 traps with ContractTrapped under the baseline pipeline, but succeeds and returns a 32-byte word under --newyork at -O0, -O1, -O2, -O3, -Os, and -Oz. With --heap-size 32, both pipelines return the same 32-byte word.

object "C" {
    code { stop() }
    object "C_deployed" {
        code {
            let off := calldataload(0)
            mstore(off, 1)
            return(off, 32)
        }
    }
}
$ resolc --yul --bin --overwrite --heap-size 16 repro.yul -o base16
Compiler run successful. Artifact(s) can be found in directory "base16".
$ resolc --yul --newyork --optimization 0 --bin --overwrite --heap-size 16 repro.yul -o ny16
Compiler run successful. Artifact(s) can be found in directory "ny16".
$ RUST_LOG=runtime::revive=trace revive-runner -f base16/repro.yul:C.pvm 2>&1 | grep 'Bare call ends'
[TRACE runtime::revive] Bare call ends: result=Err(ExecError { error: Module(ModuleError { index: 3, error: [11, 0, 0, 0], message: Some("ContractTrapped") }), origin: Callee }), weight_consumed=Weight { ref_time: 4495653, proof_size: 362 }, weight_required=Weight { ref_time: 4495653, proof_size: 362 }, storage_deposit=Charge(0), gas_consumed=0, max_storage_deposit=Charge(0)
$ RUST_LOG=runtime::revive=trace revive-runner -f ny16/repro.yul:C.pvm 2>&1 | grep 'Bare call ends'
[TRACE runtime::revive] Bare call ends: result=Ok(ExecReturnValue { flags: (empty), data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] }), weight_consumed=Weight { ref_time: 6612187, proof_size: 462 }, weight_required=Weight { ref_time: 6612187, proof_size: 462 }, storage_deposit=Charge(0), gas_consumed=0, max_storage_deposit=Charge(0)
$ resolc --yul --bin --overwrite --heap-size 32 repro.yul -o base32
Compiler run successful. Artifact(s) can be found in directory "base32".
$ resolc --yul --newyork --optimization 0 --bin --overwrite --heap-size 32 repro.yul -o ny32
Compiler run successful. Artifact(s) can be found in directory "ny32".
$ RUST_LOG=runtime::revive=trace revive-runner -f base32/repro.yul:C.pvm 2>&1 | grep 'Bare call ends'
[TRACE runtime::revive] Bare call ends: result=Ok(ExecReturnValue { flags: (empty), data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] }), weight_consumed=Weight { ref_time: 14711211, proof_size: 765 }, weight_required=Weight { ref_time: 14711211, proof_size: 765 }, storage_deposit=Charge(0), gas_consumed=0, max_storage_deposit=Charge(0)
$ RUST_LOG=runtime::revive=trace revive-runner -f ny32/repro.yul:C.pvm 2>&1 | grep 'Bare call ends'
[TRACE runtime::revive] Bare call ends: result=Ok(ExecReturnValue { flags: (empty), data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] }), weight_consumed=Weight { ref_time: 6201286, proof_size: 455 }, weight_required=Weight { ref_time: 6201286, proof_size: 455 }, storage_deposit=Charge(0), gas_consumed=0, max_storage_deposit=Charge(0)

Expected behavior: the call traps with ContractTrapped under both pipelines when the configured 16-byte heap cannot hold a 32-byte store and return.

Git commit: 04e8decf76500000e1660919b2016ff776cf0c28

主要言語
Rust
スター
104
フォーク
28
平均マージ
5日 14時間
マージ済み PR(30日)
24

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

paritytech/revive のほかの issue

paritytech/revive の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。