Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
2a9f6bed
Commit
2a9f6bed
authored
6 years ago
by
Sergey Pepyakin
Committed by
Bastian Köcher
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix overflow in srml-contract. (#1113)
parent
fa84cec3
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/srml/contract/src/gas.rs
+4
-1
4 additions, 1 deletion
substrate/srml/contract/src/gas.rs
with
4 additions
and
1 deletion
substrate/srml/contract/src/gas.rs
+
4
−
1
View file @
2a9f6bed
...
...
@@ -150,9 +150,12 @@ pub fn buy_gas<T: Trait>(
let
cost
=
<
T
::
Gas
as
As
<
T
::
Balance
>>
::
as_
(
gas_limit
.clone
())
.checked_mul
(
&
gas_price
)
.ok_or
(
"overflow multiplying gas limit by price"
)
?
;
if
b
<
cost
+
<
balances
::
Module
<
T
>>
::
existential_deposit
()
{
let
new_balance
=
b
.checked_sub
(
&
cost
);
if
new_balance
<
Some
(
<
balances
::
Module
<
T
>>
::
existential_deposit
())
{
return
Err
(
"not enough funds for transaction fee"
);
}
<
balances
::
Module
<
T
>>
::
set_free_balance
(
transactor
,
b
-
cost
);
<
balances
::
Module
<
T
>>
::
decrease_total_stake_by
(
cost
);
Ok
(
GasMeter
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment