{"record":{"id":"0cf652acddda8e08","repo":"datahaven-xyz/datahaven","slug":"zerofee","errorCode":"ZeroFee","errorMessage":"ZeroFee","messagePattern":"ZeroFee","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"operator/pallets/datahaven-native-transfer/src/lib.rs","lineNumber":186,"sourceCode":"        /// - `amount`: The amount of tokens to transfer\n        /// - `fee`: The fee to incentivize relayers (in native tokens)\n        #[pallet::call_index(0)]\n        #[pallet::weight(T::WeightInfo::transfer_to_ethereum())]\n        pub fn transfer_to_ethereum(\n            origin: OriginFor<T>,\n            recipient: H160,\n            amount: BalanceOf<T>,\n            fee: BalanceOf<T>,\n        ) -> DispatchResult {\n            let who = ensure_signed(origin)?;\n\n            ensure!(!Paused::<T>::get(), Error::<T>::TransfersDisabled);\n\n            // Get the token ID - fails if not registered\n            let token_id = T::NativeTokenId::get().ok_or(Error::<T>::TokenNotRegistered)?;\n\n            ensure!(amount > Zero::zero(), Error::<T>::InvalidAmount);\n            ensure!(fee > Zero::zero(), Error::<T>::ZeroFee);\n            ensure!(\n                recipient != H160::zero(),\n                Error::<T>::InvalidEthereumAddress\n            );\n\n            // Transfer fee to recipient\n            T::Currency::transfer(&who, &T::FeeRecipient::get(), fee, Preservation::Preserve)?;\n\n            // Lock tokens in the sovereign account\n            Self::lock_tokens(&who, amount)?;\n\n            // Build and send the message\n            let message = Self::build_mint_message(token_id, recipient, amount, fee)?;\n            T::OutboundQueue::validate(&message)\n                .and_then(|ticket| T::OutboundQueue::deliver(ticket))\n                .map_err(|_| Error::<T>::SendMessageFailed)?;\n\n            Self::deposit_event(Event::TokensTransferredToEthereum {","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/datahaven-xyz/datahaven/blob/edcb13dbbcd3c29489eaa2480a6f60ee4cb1f3ec/operator/pallets/datahaven-native-transfer/src/lib.rs#L168-L204","documentation":"transfer_to_ethereum requires a strictly positive fee (fee > Zero::zero()). The fee is paid to T::FeeRecipient to compensate relayers; a zero fee would make relaying economically unviable and is therefore rejected with ZeroFee before any state changes.","triggerScenarios":"Calling transfer_to_ethereum with fee == 0, regardless of a valid amount and recipient.","commonSituations":"Frontends defaulting fee to 0 and not forcing the user to set a relayer fee; scripts omitting the fee parameter (defaulting to 0); protocol changes raising a minimum fee that old integrations don't honor.","solutions":["Pass a fee greater than zero, at or above any configured minimum relayer fee.","Update UI/scripts to require and validate a non-zero fee field before submission.","Consult current relayer fee conventions to pick an acceptable fee value."],"exampleFix":"// before\nconst fee = 0n;\nawait api.tx.datahavenNativeTransfer.transferToEthereum(recipient, amount, fee);\n// after\nconst fee = await getMinRelayerFee(); // must be > 0\nawait api.tx.datahavenNativeTransfer.transferToEthereum(recipient, amount, fee);","handlingStrategy":"validation","validationCode":"if (fee <= 0n) throw new Error('A positive relayer fee is required');","typeGuard":"const isValidFee = (fee) => typeof fee === 'bigint' && fee > 0n;","tryCatchPattern":"try {\n  await transferToEthereum(recipient, amount, fee);\n} catch (e) {\n  if (String(e).includes('ZeroFee')) showFormError('Please set a non-zero relayer fee');\n  else throw e;\n}","preventionTips":["Default the fee field to a sensible non-zero value from chain constants.","Block form submission until fee > 0.","Track protocol minimum-fee changes in integration tests."],"tags":["validation","fees","bridge","dispatch-error"],"backgroundTag":"invalid-argument-value","analyzedSha":"edcb13dbbcd3c29489eaa2480a6f60ee4cb1f3ec","analyzedAt":"2026-09-13T19:19:32.206Z","contentChangedAt":"2026-09-13T19:19:32.206Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}