From dfd4fa88b5454fe1ba66aed573806320742278db Mon Sep 17 00:00:00 2001 From: xjd Date: Wed, 4 Sep 2024 16:59:49 +0800 Subject: [PATCH] docs: possible OOM errors on syscalls --- src/high_level.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/high_level.rs b/src/high_level.rs index 1684250..cb45067 100644 --- a/src/high_level.rs +++ b/src/high_level.rs @@ -79,6 +79,9 @@ fn load_data Result>( /// ``` /// let cell_output = load_cell(0, Source::Input).unwrap(); /// ``` +/// +/// **Note:** This function can panic if the underlying data is too large, +/// potentially causing an out-of-memory error. pub fn load_cell(index: usize, source: Source) -> Result { let data = load_data(|buf, offset| syscalls::load_cell(buf, offset, index, source))?; @@ -150,6 +153,9 @@ pub fn load_header(index: usize, source: Source) -> Result { /// ``` /// let witness = load_witness(0, Source::Input).unwrap(); /// ``` +/// +/// **Note:** This function can panic if the underlying data is too large, +/// potentially causing an out-of-memory error. pub fn load_witness(index: usize, source: Source) -> Result, SysError> { load_data(|buf, offset| syscalls::load_witness(buf, offset, index, source)) } @@ -168,6 +174,9 @@ pub fn load_witness(index: usize, source: Source) -> Result, SysError> { /// ``` /// let witness_args = load_witness_args(0, Source::Input).unwrap(); /// ``` +/// +/// **Note:** This function can panic if the underlying data is too large, +/// potentially causing an out-of-memory error. pub fn load_witness_args(index: usize, source: Source) -> Result { let data = load_data(|buf, offset| syscalls::load_witness(buf, offset, index, source))?; @@ -186,6 +195,9 @@ pub fn load_witness_args(index: usize, source: Source) -> Result Result { let data = load_data(|buf, offset| syscalls::load_transaction(buf, offset))?; @@ -470,6 +482,9 @@ pub fn load_input_out_point(index: usize, source: Source) -> Result Result, SysError> { load_data(|buf, offset| syscalls::load_cell_data(buf, offset, index, source)) }