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
e00113e1
Unverified
Commit
e00113e1
authored
May 26, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: adjust tests to assert receipt l1-fee metadata
parent
97e72f6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
system_config_test.go
op-e2e/actions/system_config_test.go
+12
-3
system_test.go
op-e2e/system_test.go
+8
-0
No files found.
op-e2e/actions/system_config_test.go
View file @
e00113e1
...
@@ -212,7 +212,14 @@ func TestGPOParamsChange(gt *testing.T) {
...
@@ -212,7 +212,14 @@ func TestGPOParamsChange(gt *testing.T) {
receipt
:=
alice
.
LastTxReceipt
(
t
)
receipt
:=
alice
.
LastTxReceipt
(
t
)
require
.
Equal
(
t
,
basefee
,
receipt
.
L1GasPrice
,
"L1 gas price matches basefee of L1 origin"
)
require
.
Equal
(
t
,
basefee
,
receipt
.
L1GasPrice
,
"L1 gas price matches basefee of L1 origin"
)
require
.
NotZero
(
t
,
receipt
.
L1GasUsed
,
"L2 tx uses L1 data"
)
require
.
NotZero
(
t
,
receipt
.
L1GasUsed
,
"L2 tx uses L1 data"
)
l1Cost
:=
types
.
L1Cost
(
receipt
.
L1GasUsed
.
Uint64
(),
basefee
,
big
.
NewInt
(
2100
),
big
.
NewInt
(
1000
_000
))
require
.
Equal
(
t
,
new
(
big
.
Float
)
.
Mul
(
new
(
big
.
Float
)
.
SetInt
(
basefee
),
new
(
big
.
Float
)
.
Mul
(
new
(
big
.
Float
)
.
SetInt
(
receipt
.
L1GasUsed
),
receipt
.
FeeScalar
),
),
new
(
big
.
Float
)
.
SetInt
(
receipt
.
L1Fee
),
"fee field in receipt matches gas used times scalar times basefee"
)
// receipt.L1GasUsed includes the overhead already, so subtract that before passing it into the L1 cost func
l1Cost
:=
types
.
L1Cost
(
receipt
.
L1GasUsed
.
Uint64
()
-
2100
,
basefee
,
big
.
NewInt
(
2100
),
big
.
NewInt
(
1000
_000
))
require
.
Equal
(
t
,
l1Cost
,
receipt
.
L1Fee
,
"L1 fee is computed with standard GPO params"
)
require
.
Equal
(
t
,
l1Cost
,
receipt
.
L1Fee
,
"L1 fee is computed with standard GPO params"
)
require
.
Equal
(
t
,
"1"
,
receipt
.
FeeScalar
.
String
(),
"1000_000 divided by 6 decimals = float(1)"
)
require
.
Equal
(
t
,
"1"
,
receipt
.
FeeScalar
.
String
(),
"1000_000 divided by 6 decimals = float(1)"
)
...
@@ -268,7 +275,8 @@ func TestGPOParamsChange(gt *testing.T) {
...
@@ -268,7 +275,8 @@ func TestGPOParamsChange(gt *testing.T) {
receipt
=
alice
.
LastTxReceipt
(
t
)
receipt
=
alice
.
LastTxReceipt
(
t
)
require
.
Equal
(
t
,
basefeeGPOUpdate
,
receipt
.
L1GasPrice
,
"L1 gas price matches basefee of L1 origin"
)
require
.
Equal
(
t
,
basefeeGPOUpdate
,
receipt
.
L1GasPrice
,
"L1 gas price matches basefee of L1 origin"
)
require
.
NotZero
(
t
,
receipt
.
L1GasUsed
,
"L2 tx uses L1 data"
)
require
.
NotZero
(
t
,
receipt
.
L1GasUsed
,
"L2 tx uses L1 data"
)
l1Cost
=
types
.
L1Cost
(
receipt
.
L1GasUsed
.
Uint64
(),
basefeeGPOUpdate
,
big
.
NewInt
(
1000
),
big
.
NewInt
(
2
_300_000
))
// subtract overhead from L1GasUsed receipt field, types.L1Cost applies it again
l1Cost
=
types
.
L1Cost
(
receipt
.
L1GasUsed
.
Uint64
()
-
1000
,
basefeeGPOUpdate
,
big
.
NewInt
(
1000
),
big
.
NewInt
(
2
_300_000
))
require
.
Equal
(
t
,
l1Cost
,
receipt
.
L1Fee
,
"L1 fee is computed with updated GPO params"
)
require
.
Equal
(
t
,
l1Cost
,
receipt
.
L1Fee
,
"L1 fee is computed with updated GPO params"
)
require
.
Equal
(
t
,
"2.3"
,
receipt
.
FeeScalar
.
String
(),
"2_300_000 divided by 6 decimals = float(2.3)"
)
require
.
Equal
(
t
,
"2.3"
,
receipt
.
FeeScalar
.
String
(),
"2_300_000 divided by 6 decimals = float(2.3)"
)
...
@@ -288,7 +296,8 @@ func TestGPOParamsChange(gt *testing.T) {
...
@@ -288,7 +296,8 @@ func TestGPOParamsChange(gt *testing.T) {
receipt
=
alice
.
LastTxReceipt
(
t
)
receipt
=
alice
.
LastTxReceipt
(
t
)
require
.
Equal
(
t
,
basefee
,
receipt
.
L1GasPrice
,
"L1 gas price matches basefee of L1 origin"
)
require
.
Equal
(
t
,
basefee
,
receipt
.
L1GasPrice
,
"L1 gas price matches basefee of L1 origin"
)
require
.
NotZero
(
t
,
receipt
.
L1GasUsed
,
"L2 tx uses L1 data"
)
require
.
NotZero
(
t
,
receipt
.
L1GasUsed
,
"L2 tx uses L1 data"
)
l1Cost
=
types
.
L1Cost
(
receipt
.
L1GasUsed
.
Uint64
(),
basefee
,
big
.
NewInt
(
1000
),
big
.
NewInt
(
2
_300_000
))
// subtract overhead from L1GasUsed receipt field, types.L1Cost applies it again
l1Cost
=
types
.
L1Cost
(
receipt
.
L1GasUsed
.
Uint64
()
-
1000
,
basefee
,
big
.
NewInt
(
1000
),
big
.
NewInt
(
2
_300_000
))
require
.
Equal
(
t
,
l1Cost
,
receipt
.
L1Fee
,
"L1 fee is computed with updated GPO params"
)
require
.
Equal
(
t
,
l1Cost
,
receipt
.
L1Fee
,
"L1 fee is computed with updated GPO params"
)
require
.
Equal
(
t
,
"2.3"
,
receipt
.
FeeScalar
.
String
(),
"2_300_000 divided by 6 decimals = float(2.3)"
)
require
.
Equal
(
t
,
"2.3"
,
receipt
.
FeeScalar
.
String
(),
"2_300_000 divided by 6 decimals = float(2.3)"
)
}
}
...
...
op-e2e/system_test.go
View file @
e00113e1
...
@@ -1232,6 +1232,14 @@ func TestFees(t *testing.T) {
...
@@ -1232,6 +1232,14 @@ func TestFees(t *testing.T) {
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
err
)
require
.
Equal
(
t
,
l1Fee
,
gpoL1Fee
,
"l1 fee mismatch"
)
require
.
Equal
(
t
,
l1Fee
,
gpoL1Fee
,
"l1 fee mismatch"
)
require
.
Equal
(
t
,
receipt
.
L1Fee
,
l1Fee
,
"l1 fee in receipt is correct"
)
require
.
Equal
(
t
,
new
(
big
.
Float
)
.
Mul
(
new
(
big
.
Float
)
.
SetInt
(
l1Header
.
BaseFee
),
new
(
big
.
Float
)
.
Mul
(
new
(
big
.
Float
)
.
SetInt
(
receipt
.
L1GasUsed
),
receipt
.
FeeScalar
),
),
new
(
big
.
Float
)
.
SetInt
(
receipt
.
L1Fee
),
"fee field in receipt matches gas used times scalar times basefee"
)
// Calculate total fee
// Calculate total fee
baseFeeRecipientDiff
.
Add
(
baseFeeRecipientDiff
,
coinbaseDiff
)
baseFeeRecipientDiff
.
Add
(
baseFeeRecipientDiff
,
coinbaseDiff
)
totalFee
:=
new
(
big
.
Int
)
.
Add
(
baseFeeRecipientDiff
,
l1FeeRecipientDiff
)
totalFee
:=
new
(
big
.
Int
)
.
Add
(
baseFeeRecipientDiff
,
l1FeeRecipientDiff
)
...
...
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