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

Fix logic to be the same as in the spec actors #1292

Merged
merged 6 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions vm/actor/src/util/balance_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ where
floor: &TokenAmount,
) -> Result<TokenAmount, Box<dyn StdError>> {
let prev = self.get(key)?;
let available = prev
.checked_sub(floor)
.unwrap_or_else(|| TokenAmount::from(0u8));
let available = std::cmp::max(TokenAmount::zero(), prev - floor);
let sub: TokenAmount = std::cmp::min(&available, req).clone();

if sub.is_positive() {
Expand Down
1 change: 1 addition & 0 deletions vm/interpreter/src/gas_tracker/price_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ impl StepCost {

/// Provides prices for operations in the VM
#[derive(Clone, Debug)]
#[allow(clippy::all)]
pub struct PriceList {
/// Compute gas charge multiplier
// * This multiplier is not currently applied to anything, but is matching lotus.
Expand Down