Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC send_transaction should not include stack trace in the RPC response #4698

Open
eval-exec opened this issue Oct 28, 2024 · 0 comments
Open
Labels
b:rpc Break RPC interface t:bug Type: This doesn't seem right.

Comments

@eval-exec
Copy link
Collaborator

eval-exec commented Oct 28, 2024

Bug Report

When calling the send_transaction RPC, the response currently includes the full stack trace when an error occurs. This behavior is not ideal, as the stack trace information is better suited for internal debugging rather than being exposed in RPC responses. Including stack traces in RPC responses can also lead to larger payloads.

Current Behavior

Exception: {'code': -302, 'message': 'TransactionFailedToVerify: Verification failed Transaction(InsufficientCellCapacity(Outputs[0]): expected occupied capacity (0x230489e00) <= capacity (0x64))', 'data': 'Verification(Error { kind: Transaction, inner: InsufficientCellCapacity(Outputs[0]): expected occupied capacity (0x230489e00) <= capacity (0x64)\n\nStack backtrace:\n   0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from\n   1: ckb_verification::transaction_verifier::CapacityVerifier::verify\n   2: ckb_tx_pool::util::verify_rtx::{{closure}}::{{closure}}\n   3: ckb_tx_pool::util::verify_rtx::{{closure}}\n   4: ckb_tx_pool::process::<impl ckb_tx_pool::service::TxPoolService>::_process_tx::{{closure}}\n   5: ckb_tx_pool::process::<impl ckb_tx_pool::service::TxPoolService>::process_tx::{{closure}}\n   6: ckb_tx_pool::service::process::{{closure}}\n   7: ckb_async_runtime::Handle::spawn::{{closure}}\n   8: tokio::runtime::task::raw::poll\n   9: tokio::runtime::scheduler::multi_thread::worker::Context::run_task\n  10: tokio::runtime::scheduler::multi_thread::worker::run\n  11: tokio::runtime::task::raw::poll\n  12: std::sys_common::backtrace::__rust_begin_short_backtrace\n  13: core::ops::function::FnOnce::call_once{{vtable.shim}}\n  14: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once\n             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9\n  15: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once\n             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9\n  16: std::sys::unix::thread::Thread::new::thread_start\n             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/unix/thread.rs:108:17\n  17: start_thread\n  18: clone })'}

pretty print the message:

TransactionFailedToVerify: Verification failed Transaction(InsufficientCellCapacity(Outputs[0]): expected occupied capacity (0x230489e00) <= capacity (0x64)), data: Verification(Error { kind: Transaction, inner: InsufficientCellCapacity(Outputs[0]): expected occupied capacity (0x230489e00) <= capacity (0x64)

Stack backtrace:
   0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   1: ckb_verification::transaction_verifier::CapacityVerifier::verify
   2: ckb_tx_pool::util::verify_rtx::{{closure}}::{{closure}}
   3: ckb_tx_pool::util::verify_rtx::{{closure}}
   4: ckb_tx_pool::process::<impl ckb_tx_pool::service::TxPoolService>::_process_tx::{{closure}}
   5: ckb_tx_pool::process::<impl ckb_tx_pool::service::TxPoolService>::process_tx::{{closure}}
   6: ckb_tx_pool::service::process::{{closure}}
   7: ckb_async_runtime::Handle::spawn::{{closure}}
   8: tokio::runtime::task::raw::poll
   9: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  10: tokio::runtime::scheduler::multi_thread::worker::run
  11: tokio::runtime::task::raw::poll
  12: std::sys_common::backtrace::__rust_begin_short_backtrace
  13: core::ops::function::FnOnce::call_once{{vtable.shim}}
  14: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
  15: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
  16: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/unix/thread.rs:108:17
  17: start_thread
  18: clone })

Environment

  • CKB version: [the output of ckb --version]
  • Chain: [dev, staging, testnet, mainnet]
  • Operating system: [Ubuntu 20.04, macOS 11.4, Windows 10]
  • Arch: x64 [the output of uname -a]
  • Installation: [GitHub Release, Built from source]

Additional context/Screenshots

@eval-exec eval-exec added t:bug Type: This doesn't seem right. b:rpc Break RPC interface labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b:rpc Break RPC interface t:bug Type: This doesn't seem right.
Projects
None yet
Development

No branches or pull requests

1 participant