Skip to content

Commit

Permalink
Add test showing that it is not possible to set explicit block size l…
Browse files Browse the repository at this point in the history
…imit for legacy (V1) consensus parameters
  • Loading branch information
rafal-ch committed Sep 16, 2024
1 parent 7b8c998 commit d07fbc3
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions fuel-tx/src/transaction/consensus_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,3 +1028,39 @@ pub mod typescript {
}
}
}

#[cfg(test)]
mod tests {
use crate::consensus_parameters::{
ConsensusParametersV2,
SettingBlockTransactionSizeLimitNotSupported,
};

use super::{
ConsensusParameters,
ConsensusParametersV1,
};

#[test]
fn error_when_setting_block_size_limit_in_consensus_parameters_v1() {
let mut consensus_params: ConsensusParameters =
ConsensusParametersV1::default().into();

let result = consensus_params.set_block_transaction_size_limit(0);

assert!(matches!(
result,
Err(SettingBlockTransactionSizeLimitNotSupported)
))
}

#[test]
fn ok_when_setting_block_size_limit_in_consensus_parameters_v2() {
let mut consensus_params: ConsensusParameters =
ConsensusParametersV2::default().into();

let result = consensus_params.set_block_transaction_size_limit(0);

assert!(matches!(result, Ok(())))
}
}

0 comments on commit d07fbc3

Please sign in to comment.