Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
72380064
Unverified
Commit
72380064
authored
Apr 10, 2023
by
mergify[bot]
Committed by
GitHub
Apr 10, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into jm/streamline-migration/non-live-testing
parents
3cb85b9c
dca2cb63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
guaranteed-gas-market.md
specs/guaranteed-gas-market.md
+11
-11
No files found.
specs/guaranteed-gas-market.md
View file @
72380064
...
@@ -93,7 +93,7 @@ def clamp(v: i256, min: u128, max: u128) -> u128:
...
@@ -93,7 +93,7 @@ def clamp(v: i256, min: u128, max: u128) -> u128:
if
prev_num
==
now_num
:
if
prev_num
==
now_num
:
now_basefee
=
prev_basefee
now_basefee
=
prev_basefee
now_bought_gas
=
prev_bought_gas
+
requested_gas
now_bought_gas
=
prev_bought_gas
+
requested_gas
elif
prev_num
!=
now_num
:
elif
prev_num
!=
now_num
:
# Width extension and conversion to signed integer math
# Width extension and conversion to signed integer math
gas_used_delta
=
int128
(
prev_bought_gas
)
-
int128
(
TARGET_RESOURCE_LIMIT
)
gas_used_delta
=
int128
(
prev_bought_gas
)
-
int128
(
TARGET_RESOURCE_LIMIT
)
# Use truncating (round to 0) division - solidity's default.
# Use truncating (round to 0) division - solidity's default.
...
@@ -101,18 +101,18 @@ elif prev_num != now_num :
...
@@ -101,18 +101,18 @@ elif prev_num != now_num :
base_fee_per_gas_delta
=
prev_basefee
*
gas_used_delta
/
TARGET_RESOURCE_LIMIT
/
BASE_FEE_MAX_CHANGE_DENOMINATOR
base_fee_per_gas_delta
=
prev_basefee
*
gas_used_delta
/
TARGET_RESOURCE_LIMIT
/
BASE_FEE_MAX_CHANGE_DENOMINATOR
now_basefee_wide
=
prev_basefee
+
base_fee_per_gas_delta
now_basefee_wide
=
prev_basefee
+
base_fee_per_gas_delta
now_basefee
=
clamp
(
now_basefee_wide
,
min
=
MINIMUM_BASEFEE
,
max
=
UINT_
64
_MAX_VALUE
)
now_basefee
=
clamp
(
now_basefee_wide
,
min
=
MINIMUM_BASEFEE
,
max
=
UINT_
128
_MAX_VALUE
)
now_bought_gas
=
requested_gas
now_bought_gas
=
requested_gas
# If we skipped multiple blocks between the previous block and now update the basefee again.
# If we skipped multiple blocks between the previous block and now update the basefee again.
# This is not exactly the same as iterating the above function, but quite close for reasonable
# This is not exactly the same as iterating the above function, but quite close for reasonable
# gas target values. It is also constant time wrt the number of missed blocks which is important
# gas target values. It is also constant time wrt the number of missed blocks which is important
# for keeping gas usage stable.
# for keeping gas usage stable.
if
prev_num
+
1
<
now_num
:
if
prev_num
+
1
<
now_num
:
n
=
now_num
-
prev_num
-
1
n
=
now_num
-
prev_num
-
1
# Apply 7/8 reduction to prev_basefee for the n empty blocks in a row.
# Apply 7/8 reduction to prev_basefee for the n empty blocks in a row.
now_basefee_wide
=
prev
_basefee
*
pow
(
1
-
(
1
/
BASE_FEE_MAX_CHANGE_DENOMINATOR
),
n
)
now_basefee_wide
=
now
_basefee
*
pow
(
1
-
(
1
/
BASE_FEE_MAX_CHANGE_DENOMINATOR
),
n
)
now_basefee
=
clamp
(
now_basefee_wide
,
min
=
MINIMUM_BASEFEE
,
max
=
UINT_64_MAX_VALUE
)
now_basefee
=
clamp
(
now_basefee_wide
,
min
=
MINIMUM_BASEFEE
,
max
=
type
(
uint128
)
.
max
)
require
(
now_bought_gas
<
MAX_RESOURCE_LIMIT
)
require
(
now_bought_gas
<
MAX_RESOURCE_LIMIT
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment