rollup: add rollup/withdrawtrie package (#543)

This commit is contained in:
HAOYUatHZ 2023-10-24 16:06:16 +08:00 committed by GitHub
parent 803286714a
commit a6ac896a2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}