nautechsystems/nautilus_trader · error
SetFeeProtocol event data is too short
Error message
SetFeeProtocol event data is too short
What it means
Thrown by parse_fee_protocol_update_event_hypersync when the hypersync log's data field is present but shorter than the 4 x 32 = 128 bytes required to hold the SetFeeProtocol event's four padded parameters (feeProtocol0Old, feeProtocol1Old, feeProtocol0New, feeProtocol1New). The library checks length before decoding to avoid a guaranteed decode failure.
Source
Thrown at crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/fee_protocol_update.rs:71
/// # Panics
///
/// Panics if the contract address is not set in the log.
pub fn parse_fee_protocol_update_event_hypersync(
dex: SharedDex,
log: &HypersyncLog,
) -> anyhow::Result<FeeProtocolUpdateEvent> {
validate_event_signature_hash(
"SetFeeProtocolEvent",
FEE_PROTOCOL_UPDATE_EVENT_SIGNATURE_HASH,
log,
)?;
if let Some(data) = &log.data {
let data_bytes = data.as_ref();
// Validate the data contains 4 parameters of 32 bytes each
if data_bytes.len() < 4 * 32 {
anyhow::bail!("SetFeeProtocol event data is too short");
}
let decoded = match <SetFeeProtocolEventData as SolType>::abi_decode(data_bytes) {
Ok(decoded) => decoded,
Err(e) => anyhow::bail!("Failed to decode SetFeeProtocol event data: {e}"),
};
let pool_address = Address::from_slice(
log.address
.clone()
.expect("Contract address should be set in logs")
.as_ref(),
);
let pool_identifier = PoolIdentifier::Address(Ustr::from(&pool_address.to_string()));
Ok(FeeProtocolUpdateEvent::new(
dex,
pool_identifier,View on GitHub (pinned to 18893faf8b)
Solutions
- Ensure the hypersync query filters on the SetFeeProtocol topic0 signature so only matching event logs are fetched.
- Check that log.data is populated and its hex is >= 256 hex chars (128 bytes).
- Confirm the log comes from a standard Uniswap V3 pool; a SetFeeProtocol variant with different parameter layout will fail.
- Fix test/log fixtures so data contains four 32-byte words.
- If the event genuinely emits fewer words, update SetFeeProtocolEventData to the actual ABI and adjust the length check.
Example fix
// before
if data_bytes.len() < 4 * 32 {
anyhow::bail!("SetFeeProtocol event data is too short");
}
// after
if data_bytes.len() != 4 * 32 {
anyhow::bail!("SetFeeProtocol event data must be exactly 128 bytes, got {}", data_bytes.len());
} Defensive patterns
Strategy: validation
Validate before calling
fn is_valid_set_fee_protocol_data(data: Option<&[u8]>) -> bool {
data.map(|d| d.len() == 4 * 32).unwrap_or(false)
} Type guard
fn has_set_fee_protocol_shape(log: &HypersyncLog) -> bool {
log.data
.as_ref()
.map(|d| d.len() >= 128)
.unwrap_or(false)
} Try / catch
match parse_fee_protocol_update_event_hypersync(dex, &log) {
Ok(event) => handle(event),
Err(e) if e.to_string().contains("SetFeeProtocol") => {
tracing::warn!("skipping invalid SetFeeProtocol log: {e}");
}
Err(e) => return Err(e),
} Prevention
- Filter hypersync queries by the SetFeeProtocol topic0 so only well-formed event logs are returned
- Always request the data field in the log selection
- Validate data length == 128 bytes before calling the parser
- Verify emitting addresses are standard Uniswap V3 pools
When it happens
Trigger: A hypersync log whose topic0 matches SetFeeProtocol arrives with data shorter than 128 bytes — e.g. empty data, truncated hex, or data from a different event with fewer parameters.
Common situations: Feeding logs filtered only by address rather than by event topic so unrelated events slip through; hypersync query returning partial data fields; malformed/custom test fixtures in tests like test_parse_fee_protocol_update_event_hypersync.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Failed to decode SetFeeProtocol event data: {e}
- Flash event data is too short
- Failed to decode flash event data: {e}
- Missing tickLower in topic2 when parsing burn event
- Missing data in SetFeeProtocol event log
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/417df1566f6ce2bb.
Report an issue: GitHub.