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

Đang mở
#752 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
backend-api-design

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Rust
Star
104
Fork
28
Merge trung bình
5 ngày 14 giờ
Pull request đã merge (30 ngày)
24

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của paritytech/revive

Tất cả issue của paritytech/revive

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.