feat(core): improve I256 implementation (#2180)

* feat(core): improve I256 implementation

* chore: reorganize impls

* chore: update docs, add attributes, use Self

* fix: signum

* chore: use inline(always), update implementations

* fix: use usize for shifting, add more shift ops

* feat: make arithmetic ops generic to match U256

* chore: clippy

* chore: return
This commit is contained in:
DaniPopes 2023-02-24 01:21:41 +01:00 committed by GitHub
parent 48dc4b1ee2
commit 7e12f3ba36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 940 additions and 659 deletions

View File

@ -240,6 +240,7 @@ impl_abi_type_tuple!(19, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S
impl_abi_type_tuple!(20, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T);
impl_abi_type_tuple!(21, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U);
#[allow(clippy::extra_unused_type_parameters)]
#[cfg(test)]
mod tests {
use super::*;

File diff suppressed because it is too large Load Diff

View File

@ -547,7 +547,7 @@ fn estimate_priority_fee(rewards: Vec<Vec<U256>>) -> U256 {
.map(|(a, b)| {
let a = I256::try_from(*a).expect("priority fee overflow");
let b = I256::try_from(*b).expect("priority fee overflow");
((b - a) * 100.into()) / a
((b - a) * 100) / a
})
.collect();
percentage_change.pop();