Use real conversion rate in greedy relayer strategy (#1035)

* use real conversion rate in greedy relayer strategy

* only accept positive, normal numbers in FloatJsonValueMetric
This commit is contained in:
Svyatoslav Nikolsky
2021-07-01 09:26:54 +03:00
committed by Bastian Köcher
parent 084c2e6c64
commit fd39d3519e
9 changed files with 78 additions and 17 deletions
@@ -212,7 +212,7 @@ pub trait TargetClient<P: MessageLane>: RelayClient {
nonces: RangeInclusive<MessageNonce>,
total_dispatch_weight: Weight,
total_size: u32,
) -> P::SourceChainBalance;
) -> Result<P::SourceChainBalance, Self::Error>;
}
/// State of the client.
@@ -775,10 +775,12 @@ pub(crate) mod tests {
nonces: RangeInclusive<MessageNonce>,
total_dispatch_weight: Weight,
total_size: u32,
) -> TestSourceChainBalance {
BASE_MESSAGE_DELIVERY_TRANSACTION_COST * (nonces.end() - nonces.start() + 1)
+ total_dispatch_weight
+ total_size as TestSourceChainBalance
) -> Result<TestSourceChainBalance, TestError> {
Ok(
BASE_MESSAGE_DELIVERY_TRANSACTION_COST * (nonces.end() - nonces.start() + 1)
+ total_dispatch_weight
+ total_size as TestSourceChainBalance,
)
}
}