forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(trace): add withdraw trie root (ethereum#217)
* init rollup/rcfg/config.go minor * update traces struct * init withdraw_trie.go * finish * fix `L2MessageQueueAddress` * refactor(rollup): add `UsingScroll` into `ChainConfig` (ethereum#218) * update comments * update comments
- Loading branch information
1 parent
30f4f57
commit 8a78c73
Showing
5 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package rcfg | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/scroll-tech/go-ethereum/common" | ||
) | ||
|
||
// TODO: | ||
// verify in consensus layer when decentralizing sequencer | ||
|
||
var ( | ||
// L2MessageQueueAddress is the address of the L2MessageQueue | ||
// predeploy | ||
// see contracts/src/L2/predeploys/L2MessageQueue.sol | ||
L2MessageQueueAddress = common.HexToAddress("0x5300000000000000000000000000000000000000") | ||
WithdrawTrieRootSlot = common.BigToHash(big.NewInt(0)) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package withdrawtrie | ||
|
||
import ( | ||
"github.com/scroll-tech/go-ethereum/common" | ||
"github.com/scroll-tech/go-ethereum/rollup/rcfg" | ||
) | ||
|
||
// StateDB represents the StateDB interface | ||
// required to get withdraw trie root | ||
type StateDB interface { | ||
GetState(common.Address, common.Hash) common.Hash | ||
} | ||
|
||
// ReadWTRSlot reads WithdrawTrieRoot slot in L2MessageQueue predeploy, i.e., `messageRoot` | ||
// in contracts/src/libraries/common/AppendOnlyMerkleTree.sol | ||
func ReadWTRSlot(addr common.Address, state StateDB) common.Hash { | ||
return state.GetState(addr, rcfg.WithdrawTrieRootSlot) | ||
} |