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
c6932d70
Unverified
Commit
c6932d70
authored
Nov 30, 2022
by
mergify[bot]
Committed by
GitHub
Nov 30, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4115 from ethereum-optimism/fix/revert-receipts
op-chain-ops: no longer embed receipts
parents
f7f64dd1
72958876
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
142 deletions
+2
-142
withdrawal.go
op-chain-ops/crossdomain/withdrawal.go
+0
-106
db_migration.go
op-chain-ops/genesis/db_migration.go
+2
-7
receipts.go
op-chain-ops/genesis/receipts.go
+0
-29
No files found.
op-chain-ops/crossdomain/withdrawal.go
View file @
c6932d70
...
@@ -4,10 +4,8 @@ import (
...
@@ -4,10 +4,8 @@ import (
"errors"
"errors"
"math/big"
"math/big"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
)
)
...
@@ -141,107 +139,3 @@ func (w *Withdrawal) StorageSlot() (common.Hash, error) {
...
@@ -141,107 +139,3 @@ func (w *Withdrawal) StorageSlot() (common.Hash, error) {
slot
:=
crypto
.
Keccak256
(
preimage
)
slot
:=
crypto
.
Keccak256
(
preimage
)
return
common
.
BytesToHash
(
slot
),
nil
return
common
.
BytesToHash
(
slot
),
nil
}
}
// Compute the receipt corresponding to the withdrawal. This receipt
// is in the bedrock transition block. It contains 3 logs.
// SentMessage, SentMessageExtension1 and MessagePassed.
// These logs are enough for the standard withdrawal flow to happen
// which is driven by events being emitted.
func
(
w
*
Withdrawal
)
Receipt
(
hdr
*
types
.
Header
,
txIndex
uint
)
(
*
types
.
Receipt
,
error
)
{
// Create a new receipt with the state root, successful execution and no gas
// used
receipt
:=
types
.
NewReceipt
(
hdr
.
Root
.
Bytes
(),
false
,
0
)
if
receipt
.
Logs
==
nil
{
receipt
.
Logs
=
make
([]
*
types
.
Log
,
0
)
}
// Use a counter to track the log index. Each receipt has 3 events and there
// is 1 receipt per transaction. Increment the logIndex after appending the
// log to the receipt.
logIndex
:=
txIndex
*
3
// Create the SentMessage log.
args
:=
abi
.
Arguments
{
{
Name
:
"target"
,
Type
:
AddressType
},
{
Name
:
"sender"
,
Type
:
AddressType
},
{
Name
:
"data"
,
Type
:
BytesType
},
{
Name
:
"nonce"
,
Type
:
Uint256Type
},
}
data
,
err
:=
args
.
Pack
(
w
.
Target
,
w
.
Sender
,
w
.
Data
,
w
.
Nonce
)
if
err
!=
nil
{
return
nil
,
err
}
// The L2CrossDomainMessenger emits this event. The target is
// indexed.
sm
:=
&
types
.
Log
{
Address
:
predeploys
.
L2CrossDomainMessengerAddr
,
Topics
:
[]
common
.
Hash
{
SentMessageEventABIHash
,
w
.
Target
.
Hash
(),
},
Data
:
data
,
BlockNumber
:
hdr
.
Number
.
Uint64
(),
TxHash
:
common
.
Hash
{},
TxIndex
:
txIndex
,
BlockHash
:
hdr
.
Hash
(),
Index
:
logIndex
,
Removed
:
false
,
}
receipt
.
Logs
=
append
(
receipt
.
Logs
,
sm
)
logIndex
++
// Create the SentMessageExtension1 log. The L2CrossDomainMessenger
// emits this event. The sender is indexed.
sm1
:=
&
types
.
Log
{
Address
:
predeploys
.
L2CrossDomainMessengerAddr
,
Topics
:
[]
common
.
Hash
{
SentMessageExtension1EventABIHash
,
w
.
Sender
.
Hash
(),
},
Data
:
common
.
LeftPadBytes
(
w
.
Value
.
Bytes
(),
32
),
BlockNumber
:
hdr
.
Number
.
Uint64
(),
TxHash
:
common
.
Hash
{},
TxIndex
:
txIndex
,
BlockHash
:
hdr
.
Hash
(),
Index
:
logIndex
,
Removed
:
false
,
}
receipt
.
Logs
=
append
(
receipt
.
Logs
,
sm1
)
logIndex
++
// Create the MessagePassed log.
mpargs
:=
abi
.
Arguments
{
{
Name
:
"value"
,
Type
:
Uint256Type
},
{
Name
:
"gasLimit"
,
Type
:
Uint256Type
},
{
Name
:
"data"
,
Type
:
BytesType
},
{
Name
:
"withdrawalHash"
,
Type
:
Bytes32Type
},
}
hash
,
err
:=
w
.
Hash
()
if
err
!=
nil
{
return
nil
,
err
}
mpdata
,
err
:=
mpargs
.
Pack
(
w
.
Value
,
w
.
GasLimit
,
w
.
Data
,
hash
)
if
err
!=
nil
{
return
nil
,
err
}
// The L2ToL1MessagePasser emits this event.
mp
:=
&
types
.
Log
{
Address
:
predeploys
.
L2ToL1MessagePasserAddr
,
Topics
:
[]
common
.
Hash
{
MessagePassedEventABIHash
,
common
.
BytesToHash
(
common
.
LeftPadBytes
(
w
.
Nonce
.
Bytes
(),
32
)),
w
.
Sender
.
Hash
(),
w
.
Target
.
Hash
(),
},
Data
:
mpdata
,
BlockNumber
:
hdr
.
Number
.
Uint64
(),
TxHash
:
common
.
Hash
{},
TxIndex
:
txIndex
,
BlockHash
:
hdr
.
Hash
(),
Index
:
logIndex
,
Removed
:
false
,
}
receipt
.
Logs
=
append
(
receipt
.
Logs
,
mp
)
return
receipt
,
nil
}
op-chain-ops/genesis/db_migration.go
View file @
c6932d70
...
@@ -122,12 +122,7 @@ func MigrateDB(ldb ethdb.Database, config *DeployConfig, l1Block *types.Block, m
...
@@ -122,12 +122,7 @@ func MigrateDB(ldb ethdb.Database, config *DeployConfig, l1Block *types.Block, m
BaseFee
:
(
*
big
.
Int
)(
config
.
L2GenesisBlockBaseFeePerGas
),
BaseFee
:
(
*
big
.
Int
)(
config
.
L2GenesisBlockBaseFeePerGas
),
}
}
receipts
,
err
:=
CreateReceipts
(
bedrockHeader
,
withdrawals
,
&
config
.
L1CrossDomainMessengerProxy
)
bedrockBlock
:=
types
.
NewBlock
(
bedrockHeader
,
nil
,
nil
,
nil
,
trie
.
NewStackTrie
(
nil
))
if
err
!=
nil
{
return
nil
,
err
}
bedrockBlock
:=
types
.
NewBlock
(
bedrockHeader
,
nil
,
nil
,
receipts
,
trie
.
NewStackTrie
(
nil
))
res
:=
&
MigrationResult
{
res
:=
&
MigrationResult
{
TransitionHeight
:
bedrockBlock
.
NumberU64
(),
TransitionHeight
:
bedrockBlock
.
NumberU64
(),
...
@@ -142,7 +137,7 @@ func MigrateDB(ldb ethdb.Database, config *DeployConfig, l1Block *types.Block, m
...
@@ -142,7 +137,7 @@ func MigrateDB(ldb ethdb.Database, config *DeployConfig, l1Block *types.Block, m
rawdb
.
WriteTd
(
ldb
,
bedrockBlock
.
Hash
(),
bedrockBlock
.
NumberU64
(),
bedrockBlock
.
Difficulty
())
rawdb
.
WriteTd
(
ldb
,
bedrockBlock
.
Hash
(),
bedrockBlock
.
NumberU64
(),
bedrockBlock
.
Difficulty
())
rawdb
.
WriteBlock
(
ldb
,
bedrockBlock
)
rawdb
.
WriteBlock
(
ldb
,
bedrockBlock
)
rawdb
.
WriteReceipts
(
ldb
,
bedrockBlock
.
Hash
(),
bedrockBlock
.
NumberU64
(),
receipts
)
rawdb
.
WriteReceipts
(
ldb
,
bedrockBlock
.
Hash
(),
bedrockBlock
.
NumberU64
(),
nil
)
rawdb
.
WriteCanonicalHash
(
ldb
,
bedrockBlock
.
Hash
(),
bedrockBlock
.
NumberU64
())
rawdb
.
WriteCanonicalHash
(
ldb
,
bedrockBlock
.
Hash
(),
bedrockBlock
.
NumberU64
())
rawdb
.
WriteHeadBlockHash
(
ldb
,
bedrockBlock
.
Hash
())
rawdb
.
WriteHeadBlockHash
(
ldb
,
bedrockBlock
.
Hash
())
rawdb
.
WriteHeadFastBlockHash
(
ldb
,
bedrockBlock
.
Hash
())
rawdb
.
WriteHeadFastBlockHash
(
ldb
,
bedrockBlock
.
Hash
())
...
...
op-chain-ops/genesis/receipts.go
deleted
100644 → 0
View file @
f7f64dd1
package
genesis
import
(
"github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)
// CreateReceipts will create the set of bedrock genesis receipts given
// a list of legacy withdrawals.
func
CreateReceipts
(
hdr
*
types
.
Header
,
withdrawals
[]
*
crossdomain
.
LegacyWithdrawal
,
l1CrossDomainMessenger
*
common
.
Address
)
([]
*
types
.
Receipt
,
error
)
{
receipts
:=
make
([]
*
types
.
Receipt
,
0
)
for
i
,
withdrawal
:=
range
withdrawals
{
wd
,
err
:=
crossdomain
.
MigrateWithdrawal
(
withdrawal
,
l1CrossDomainMessenger
)
if
err
!=
nil
{
return
nil
,
err
}
receipt
,
err
:=
wd
.
Receipt
(
hdr
,
uint
(
i
))
if
err
!=
nil
{
return
nil
,
err
}
receipts
=
append
(
receipts
,
receipt
)
}
return
receipts
,
nil
}
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