Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBC rate limiter in 7.10023.1 is garbage #3611

Closed
dzmitry-lahoda opened this issue May 17, 2023 · 2 comments
Closed

IBC rate limiter in 7.10023.1 is garbage #3611

dzmitry-lahoda opened this issue May 17, 2023 · 2 comments

Comments

@dzmitry-lahoda
Copy link
Contributor

impl Ics20RateLimiter for ConstantAny {
fn allow(
msg: &pallet_ibc::ics20::Ics20TransferMsg,
_flow_type: pallet_ibc::ics20::FlowType,
) -> Result<(), ()> {
let pica_denom =
<::IbcDenomToAssetIdConversion as DenomToAssetId<
Runtime,
>>::from_asset_id_to_denom(CurrencyId::PICA);

	let limit = match msg.token.denom.to_string().as_str() {
		denom if Some(denom) == pica_denom.as_deref() => 500_000,
		_ => 10_000,
	};
	if msg.token.amount.as_u256() <= ::ibc::bigint::U256::from(limit * 10_u64.pow(12)) {
		return Ok(())
	}
	Err(())
}

}

@dzmitry-lahoda
Copy link
Contributor Author

dzmitry-lahoda commented May 17, 2023

rate limiter does not work as advertised

for USDT it is 10^9 .
for DOT it is 10^6.

cc @josietyleung @kkast

@josietyleung
Copy link
Contributor

fixed in #3620

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants