stellar / soroban-rpc

RPC server for Soroban contracts.
12 stars 18 forks source link

Overflow of valid fee value #103

Open mn13 opened 6 months ago

mn13 commented 6 months ago

What version are you using?

v20.3.3

What did you do?

With soroban 20.3.1 I tried to call soroban contract install with a 61 kb wasm in testnet and got error: Fee was too large 4946582915. After some investigation I found that error occurs in https://github.com/stellar/soroban-rpc/blob/main/cmd/crates/soroban-rpc/src/txn.rs#L321 because classic_tx_fee + simulation.min_resource_fee = 4946582915 or 494.6582915 XLM. Why values that exceed U32_MAX is not allowed for fee? Does it mean that there is no way to install wasm in mainnet with soroban-cli?

What did you expect to see?

Max fee value fits I128_MAX

What did you see instead?

Error if simulation.min_resource_fee is more than U32_MAX - DEFAULT_TRANSACTION_FEES=4294967195

mn13 commented 6 months ago

Looks like the problem came from https://github.com/stellar/stellar-xdr

pub struct Transaction {
    pub source_account: MuxedAccount,
    pub fee: u32,
    pub seq_num: SequenceNumber,
    pub cond: Preconditions,
    pub memo: Memo,
    pub operations: VecM<Operation, 100>,
    pub ext: TransactionExt,
}
mn13 commented 6 months ago

As described in stellar-xdr repository: Types are generated from XDR definitions hosted at stellar/stellar-xdr using xdrgen.

And u32 fees are part of xdr definitions