commit
67819b62c8
@ -6,7 +6,7 @@ ARG BUILDNUM=""
|
|||||||
# Build Geth in a stock Go builder container
|
# Build Geth in a stock Go builder container
|
||||||
FROM golang:1.20-alpine as builder
|
FROM golang:1.20-alpine as builder
|
||||||
|
|
||||||
RUN apk add --no-cache gcc musl-dev linux-headers git
|
RUN apk add --no-cache gcc musl-dev binutils-gold linux-headers git
|
||||||
|
|
||||||
# Get dependencies - will also be cached if we won't change go.mod/go.sum
|
# Get dependencies - will also be cached if we won't change go.mod/go.sum
|
||||||
COPY go.mod /go-ethereum/
|
COPY go.mod /go-ethereum/
|
||||||
|
@ -25,6 +25,10 @@ rather than forking the Geth project. Out of the box, PluGeth behaves exactly
|
|||||||
like upstream Geth, but by installing plugins written in Golang, developers can
|
like upstream Geth, but by installing plugins written in Golang, developers can
|
||||||
extend its functionality in a wide variety of way.
|
extend its functionality in a wide variety of way.
|
||||||
|
|
||||||
|
### Submitting Pull Requests
|
||||||
|
|
||||||
|
We are eager to include contributions from the community into the project. We ask that pull requests which include new features to be covered by our test plugin found in: `/plugins/test-plugin`. The test design and instructions for use are documented there. If further assistance is needed please get in touch with us.
|
||||||
|
|
||||||
### Contact Us
|
### Contact Us
|
||||||
|
|
||||||
If you're trying to do something that isn't supported by the current plugin system, Reach out to us on [Discord](https://discord.gg/Epf7b7Gr) and we'll help you figure out how to make it work.
|
If you're trying to do something that isn't supported by the current plugin system, Reach out to us on [Discord](https://discord.gg/Epf7b7Gr) and we'll help you figure out how to make it work.
|
||||||
|
@ -20,7 +20,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -57,6 +57,9 @@ const (
|
|||||||
var (
|
var (
|
||||||
// flags that configure the node
|
// flags that configure the node
|
||||||
nodeFlags = flags.Merge([]cli.Flag{
|
nodeFlags = flags.Merge([]cli.Flag{
|
||||||
|
//begin PluGeth code injection
|
||||||
|
utils.PluginsDirFlag,
|
||||||
|
//end PluGeth code injection
|
||||||
utils.IdentityFlag,
|
utils.IdentityFlag,
|
||||||
utils.UnlockedAccountFlag,
|
utils.UnlockedAccountFlag,
|
||||||
utils.PasswordFileFlag,
|
utils.PasswordFileFlag,
|
||||||
@ -322,7 +325,14 @@ func prepare(ctx *cli.Context) {
|
|||||||
// blocking mode, waiting for it to be shut down.
|
// blocking mode, waiting for it to be shut down.
|
||||||
func geth(ctx *cli.Context) error {
|
func geth(ctx *cli.Context) error {
|
||||||
//begin PluGeth code injection
|
//begin PluGeth code injection
|
||||||
if err := plugins.Initialize(path.Join(ctx.String(utils.DataDirFlag.Name), "plugins"), ctx); err != nil {
|
var pluginsDir string
|
||||||
|
if ctx.IsSet(utils.PluginsDirFlag.Name) {
|
||||||
|
pluginsDir = ctx.String(utils.PluginsDirFlag.Name)
|
||||||
|
} else {
|
||||||
|
pluginsDir = filepath.Join(ctx.String(utils.DataDirFlag.Name), "plugins")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := plugins.Initialize(pluginsDir, ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
prepare(ctx)
|
prepare(ctx)
|
||||||
|
@ -88,6 +88,14 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// General settings
|
// General settings
|
||||||
|
//begin PluGeth code injection
|
||||||
|
PluginsDirFlag = &flags.DirectoryFlag{
|
||||||
|
Name: "pluginsdir",
|
||||||
|
Usage: "Directory for plugins",
|
||||||
|
Value: flags.DirectoryString(filepath.Join("<datadir>", "plugins")),
|
||||||
|
Category: flags.EthCategory,
|
||||||
|
}
|
||||||
|
//end PluGeth code injection
|
||||||
DataDirFlag = &flags.DirectoryFlag{
|
DataDirFlag = &flags.DirectoryFlag{
|
||||||
Name: "datadir",
|
Name: "datadir",
|
||||||
Usage: "Data directory for the databases and keystore",
|
Usage: "Data directory for the databases and keystore",
|
||||||
|
@ -58,6 +58,7 @@ func Lookup(name string, validate func(interface{}) bool) []interface{} {
|
|||||||
var DefaultPluginLoader *PluginLoader
|
var DefaultPluginLoader *PluginLoader
|
||||||
|
|
||||||
func NewPluginLoader(target string) (*PluginLoader, error) {
|
func NewPluginLoader(target string) (*PluginLoader, error) {
|
||||||
|
log.Info("Loading plugins from directory", "path", target)
|
||||||
pl := &PluginLoader{
|
pl := &PluginLoader{
|
||||||
Plugins: []pluginDetails{},
|
Plugins: []pluginDetails{},
|
||||||
Subcommands: make(map[string]Subcommand),
|
Subcommands: make(map[string]Subcommand),
|
||||||
|
@ -5,9 +5,11 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"time"
|
"time"
|
||||||
"os"
|
"os"
|
||||||
|
"bytes"
|
||||||
|
|
||||||
"github.com/openrelayxyz/plugeth-utils/core"
|
"github.com/openrelayxyz/plugeth-utils/core"
|
||||||
"github.com/openrelayxyz/plugeth-utils/restricted/hexutil"
|
"github.com/openrelayxyz/plugeth-utils/restricted/hexutil"
|
||||||
|
"github.com/openrelayxyz/plugeth-utils/restricted/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var hookChan chan map[string]struct{} = make(chan map[string]struct{}, 10)
|
var hookChan chan map[string]struct{} = make(chan map[string]struct{}, 10)
|
||||||
@ -223,6 +225,8 @@ func txTracer() {
|
|||||||
log.Error("debug_traceTransaction failed", "err", err)
|
log.Error("debug_traceTransaction failed", "err", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testGetContractCode(t3)
|
||||||
|
|
||||||
debugArg0 := map[string]interface{}{
|
debugArg0 := map[string]interface{}{
|
||||||
"input": "0x60006000fd",
|
"input": "0x60006000fd",
|
||||||
"from": coinBase,
|
"from": coinBase,
|
||||||
@ -242,7 +246,6 @@ func txTracer() {
|
|||||||
var trResult1 interface{}
|
var trResult1 interface{}
|
||||||
err = client.Call(&trResult1, "debug_traceCall", debugArg1, "latest", t)
|
err = client.Call(&trResult1, "debug_traceCall", debugArg1, "latest", t)
|
||||||
|
|
||||||
|
|
||||||
final := map[string]interface{}{
|
final := map[string]interface{}{
|
||||||
"input": "0x61520873000000000000000000000000000000000000000060006000600060006000f1",
|
"input": "0x61520873000000000000000000000000000000000000000060006000600060006000f1",
|
||||||
"from": coinBase,
|
"from": coinBase,
|
||||||
@ -258,3 +261,39 @@ func txTracer() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testGetContractCode(hash core.Hash) {
|
||||||
|
|
||||||
|
cl := apis[0].Service.(*engineService).stack
|
||||||
|
client, err := cl.Attach()
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Error connecting with client testGetContractCode")
|
||||||
|
}
|
||||||
|
|
||||||
|
receipt := map[string]interface{}{}
|
||||||
|
err = client.Call(&receipt, "eth_getTransactionReceipt", hash)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Error calling getTransactionReciepts, testGetContractCode", "err", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var controlCode hexutil.Bytes
|
||||||
|
err = client.Call(&controlCode, "eth_getCode", receipt["contractAddress"], receipt["blockNumber"])
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Error calling getCode, testGetContractCode", "err", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
codeHash := crypto.Keccak256Hash(controlCode)
|
||||||
|
|
||||||
|
testCode, err := apis[0].Service.(*engineService).backend.GetContractCode(codeHash)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Error calling GetContractCode", "err", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !bytes.Equal(testCode, controlCode) {
|
||||||
|
|
||||||
|
log.Error("Exit with error, return value from GetContractCode is divergent from control value")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("made it through checkGetContractCode")
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum"
|
"github.com/ethereum/go-ethereum"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
gcore "github.com/ethereum/go-ethereum/core"
|
gcore "github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
gparams "github.com/ethereum/go-ethereum/params"
|
gparams "github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
@ -510,7 +511,6 @@ func (b *Backend) GetAccountTrie(stateRoot core.Hash, account core.Address) (cor
|
|||||||
return NewWrappedTrie(acTr), nil
|
return NewWrappedTrie(acTr), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Backend) GetContractCode(h core.Hash) ([]byte, error) {
|
||||||
|
return state.NewDatabase(b.b.ChainDb()).ContractCode(common.Hash{}, common.Hash(h))
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user