From 0f5aa2f445669398fca20cbe2bb8047f1b49c182 Mon Sep 17 00:00:00 2001 From: xjd Date: Thu, 12 Sep 2024 13:58:36 +0800 Subject: [PATCH] docs: possible OOM errors on syscalls (#101) --- src/high_level.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/high_level.rs b/src/high_level.rs index 6e2cad7..00c2cd8 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)) }