Manual touches to plugeth code to accommodate geth v1.13.0
This commit is contained in:
@@ -19,9 +19,9 @@ import (
|
||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
|
||||
"github.com/openrelayxyz/plugeth-utils/core"
|
||||
"github.com/openrelayxyz/plugeth-utils/restricted"
|
||||
"github.com/openrelayxyz/plugeth-utils/restricted/params"
|
||||
@@ -44,10 +44,14 @@ type Backend struct {
|
||||
removedLogsFeed event.Feed
|
||||
removedLogsOnce sync.Once
|
||||
chainConfig *params.ChainConfig
|
||||
trieConfig *trie.Config
|
||||
}
|
||||
|
||||
func NewBackend(b ethapi.Backend) *Backend {
|
||||
return &Backend{b: b}
|
||||
func NewBackend(b ethapi.Backend, tc *trie.Config) *Backend {
|
||||
|
||||
return &Backend{
|
||||
b: b,
|
||||
trieConfig: tc}
|
||||
}
|
||||
|
||||
func (b *Backend) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
|
||||
@@ -488,7 +492,7 @@ func CloneChainConfig(cf *gparams.ChainConfig) *params.ChainConfig {
|
||||
}
|
||||
|
||||
func (b *Backend) GetTrie(h core.Hash) (core.Trie, error) {
|
||||
tr, err := trie.NewStateTrie(trie.TrieID(common.Hash(h)), trie.NewDatabase(b.b.ChainDb()))
|
||||
tr, err := trie.NewStateTrie(trie.TrieID(common.Hash(h)), trie.NewDatabase(b.b.ChainDb(), b.trieConfig))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -504,7 +508,7 @@ func (b *Backend) GetAccountTrie(stateRoot core.Hash, account core.Address) (cor
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
acTr, err := trie.NewStateTrie(trie.StorageTrieID(common.Hash(stateRoot), crypto.Keccak256Hash(account[:]), common.Hash(act.Root)), trie.NewDatabase(b.b.ChainDb()))
|
||||
acTr, err := trie.NewStateTrie(trie.StorageTrieID(common.Hash(stateRoot), crypto.Keccak256Hash(account[:]), common.Hash(act.Root)), trie.NewDatabase(b.b.ChainDb(), b.trieConfig))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -512,5 +516,5 @@ func (b *Backend) GetAccountTrie(stateRoot core.Hash, account core.Address) (cor
|
||||
}
|
||||
|
||||
func (b *Backend) GetContractCode(h core.Hash) ([]byte, error) {
|
||||
return state.NewDatabase(b.b.ChainDb()).ContractCode(common.Hash{}, common.Hash(h))
|
||||
return state.NewDatabase(b.b.ChainDb()).ContractCode(common.Address{}, common.Hash(h))
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package backendwrapper
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
|
||||
"github.com/openrelayxyz/plugeth-utils/core"
|
||||
@@ -38,7 +39,8 @@ func (t *WrappedTrie) Hash() core.Hash {
|
||||
}
|
||||
|
||||
func (t *WrappedTrie) NodeIterator(startKey []byte) core.NodeIterator {
|
||||
itr := t.t.NodeIterator(startKey)
|
||||
itr, err := t.t.NodeIterator(startKey)
|
||||
log.Error("Error returned from geth side NodeIterator", "err", err)
|
||||
return &WrappedNodeIterator{itr}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
|
||||
"github.com/openrelayxyz/plugeth-utils/core"
|
||||
)
|
||||
|
||||
@@ -166,8 +167,8 @@ func (w *WrappedStateDB) GetState(addr core.Address, hsh core.Hash) core.Hash {
|
||||
}
|
||||
|
||||
// HasSuicided(Address) bool
|
||||
func (w *WrappedStateDB) HasSuicided(addr core.Address) bool { // I figured we'd skip some of the future labor and update the name now
|
||||
return w.s.HasSuicided(common.Address(addr))
|
||||
func (w *WrappedStateDB) HasSuicided(addr core.Address) bool {
|
||||
return w.s.HasSelfDestructed(common.Address(addr))
|
||||
}
|
||||
|
||||
// // Exist reports whether the given account exists in state.
|
||||
@@ -231,7 +232,7 @@ func (n *Node) ResolvePath(x string) string {
|
||||
return n.n.ResolvePath(x)
|
||||
}
|
||||
func (n *Node) Attach() (core.Client, error) {
|
||||
return n.n.Attach()
|
||||
return n.n.Attach(), nil
|
||||
}
|
||||
func (n *Node) Close() error {
|
||||
return n.n.Close()
|
||||
|
||||
Reference in New Issue
Block a user