Skip to content

Conversation

@mootz12
Copy link
Contributor

@mootz12 mootz12 commented Jan 12, 2026

What

We were overriding inclusion fee and not applying resource fee inputs to the simulated transaction

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Jan 12, 2026
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋🏻 Little concerned we're working around and covering a bug, take a look inline.

Comment on lines 206 to 222
resource_fee: Option<u64>,
) -> Result<Transaction, Error> {
let mut tx = raw.clone();

// Right now simulate.results is one-result-per-function, and assumes there is only one
// operation in the txn, so we need to enforce that here. I (Paul) think that is a bug
// in soroban-rpc.simulateTransaction design, and we should fix it there.
// TODO: We should to better handling so non-soroban txns can be a passthrough here.
if tx.operations.len() != 1 {
return Err(Error::UnexpectedOperationCount {
count: tx.operations.len(),
});
}

let mut transaction_data = simulation.transaction_data()?;
let min_resource_fee = if let Some(rf) = resource_fee {
tracing::trace!(
"setting resource fee to {rf} from {}",
if let Ok(rf_i64) = i64::try_from(rf) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me the bug seems like resource_fee is a u64, not that we're missing a conversion from u64 to i64 and need a fallback value if a user enters a value too large.

Does the issue stem from the Args specifying fees on the command line as u64 instead of i64?

pub struct Args {
/// Set the fee for smart contract resource consumption, in stroops. 1 stroop = 0.0000001 xlm. Overrides the simulated resource fee
#[arg(long, env = "STELLAR_RESOURCE_FEE", help_heading = HEADING_RPC)]
pub resource_fee: Option<u64>,

We should collect it as the correct type so that if a user enters an invalid value, the command line hard errors right there, forcing the developer to discover the issue rather than hide the mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this was just overlooked during the first PR adding this.

The real issue was twofold:

  1. we didn't have the transaction_data.resource_fee getting set when a user supplied this arg
  2. the tx.fee was being set based on the min_tx_fee, not the raw.fee

This being said, I can make this change with the additional check that it is positive to improve the error handling, as it is likely the right way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

3 participants