Fix RPC for blob transactions (#266)
- Fixes RPC for blob transactions - Allows loading chain ID from chain config file, improving integration in cerc-io/fixturenet-eth-stacks#21 Depends on cerc-io/system-tests#13 Reviewed-on: #266
This commit is contained in:
parent
190b36bcd1
commit
27d1634b5b
@ -12,6 +12,7 @@ integration
|
|||||||
test
|
test
|
||||||
scripts
|
scripts
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
environments
|
||||||
|
|
||||||
**/node_modules
|
**/node_modules
|
||||||
build
|
build
|
11
.github/workflows/tests.yaml
vendored
11
.github/workflows/tests.yaml
vendored
@ -102,10 +102,15 @@ jobs:
|
|||||||
progress: false
|
progress: false
|
||||||
- name: Run system tests
|
- name: Run system tests
|
||||||
working-directory: ./system-tests
|
working-directory: ./system-tests
|
||||||
|
# Work around dependency conflict in system-tests:
|
||||||
|
# web3 uses an older eth-account until (unreleased) v7
|
||||||
run: |
|
run: |
|
||||||
pip install pytest
|
pip3 install pytest
|
||||||
pip install -r requirements.txt
|
pip3 install -r requirements.txt
|
||||||
pytest -vv
|
pip3 install --no-deps 'eth-account>=0.12.3,<0.13'
|
||||||
|
pip3 install 'pydantic>=2.0.0'
|
||||||
|
# Skips tests that require Blob indexing
|
||||||
|
python3 -m pytest -vv -m "not blob_db"
|
||||||
|
|
||||||
- name: Run testnet stack without statediff
|
- name: Run testnet stack without statediff
|
||||||
env:
|
env:
|
||||||
|
@ -29,7 +29,6 @@ RUN GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -
|
|||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
ARG USER="vdm"
|
ARG USER="vdm"
|
||||||
ARG CONFIG_FILE="./environments/example.toml"
|
|
||||||
|
|
||||||
RUN adduser -Du 5000 $USER
|
RUN adduser -Du 5000 $USER
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -38,13 +37,10 @@ USER $USER
|
|||||||
|
|
||||||
# chown first so dir is writable
|
# chown first so dir is writable
|
||||||
# note: using $USER is merged, but not in the stable release yet
|
# note: using $USER is merged, but not in the stable release yet
|
||||||
COPY --chown=5000:5000 --from=builder /go/src/github.com/cerc-io/ipld-eth-server/$CONFIG_FILE config.toml
|
|
||||||
COPY --chown=5000:5000 --from=builder /go/src/github.com/cerc-io/ipld-eth-server/entrypoint.sh .
|
COPY --chown=5000:5000 --from=builder /go/src/github.com/cerc-io/ipld-eth-server/entrypoint.sh .
|
||||||
|
|
||||||
|
|
||||||
# keep binaries immutable
|
# keep binaries immutable
|
||||||
COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-server/ipld-eth-server ipld-eth-server
|
COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-server/ipld-eth-server ipld-eth-server
|
||||||
COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-server/environments environments
|
|
||||||
|
|
||||||
# Allow for debugging
|
# Allow for debugging
|
||||||
COPY --from=debugger /go/bin/dlv /usr/local/bin/
|
COPY --from=debugger /go/bin/dlv /usr/local/bin/
|
||||||
|
@ -277,10 +277,10 @@ func init() {
|
|||||||
serveCmd.PersistentFlags().String("eth-client-name", "Geth", "eth client name")
|
serveCmd.PersistentFlags().String("eth-client-name", "Geth", "eth client name")
|
||||||
serveCmd.PersistentFlags().String("eth-genesis-block", "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3", "eth genesis block hash")
|
serveCmd.PersistentFlags().String("eth-genesis-block", "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3", "eth genesis block hash")
|
||||||
serveCmd.PersistentFlags().String("eth-network-id", "1", "eth network id")
|
serveCmd.PersistentFlags().String("eth-network-id", "1", "eth network id")
|
||||||
serveCmd.PersistentFlags().String("eth-chain-id", "1", "eth chain id")
|
serveCmd.PersistentFlags().String("eth-chain-id", "", "eth chain id")
|
||||||
|
serveCmd.PersistentFlags().String("eth-chain-config", "", "json chain config file location")
|
||||||
serveCmd.PersistentFlags().String("eth-default-sender", "", "default sender address")
|
serveCmd.PersistentFlags().String("eth-default-sender", "", "default sender address")
|
||||||
serveCmd.PersistentFlags().String("eth-rpc-gas-cap", "", "rpc gas cap (for eth_Call execution)")
|
serveCmd.PersistentFlags().String("eth-rpc-gas-cap", "", "rpc gas cap (for eth_Call execution)")
|
||||||
serveCmd.PersistentFlags().String("eth-chain-config", "", "json chain config file location")
|
|
||||||
serveCmd.PersistentFlags().Bool("eth-supports-state-diff", false, "whether the proxy ethereum client supports statediffing endpoints")
|
serveCmd.PersistentFlags().Bool("eth-supports-state-diff", false, "whether the proxy ethereum client supports statediffing endpoints")
|
||||||
serveCmd.PersistentFlags().Bool("eth-forward-eth-calls", false, "whether to immediately forward eth_calls to proxy client")
|
serveCmd.PersistentFlags().Bool("eth-forward-eth-calls", false, "whether to immediately forward eth_calls to proxy client")
|
||||||
serveCmd.PersistentFlags().Bool("eth-proxy-on-error", true, "whether to forward all failed calls to proxy client")
|
serveCmd.PersistentFlags().Bool("eth-proxy-on-error", true, "whether to forward all failed calls to proxy client")
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "Beginning the ipld-eth-server process"
|
|
||||||
|
|
||||||
START_CMD="./ipld-eth-server"
|
START_CMD="./ipld-eth-server"
|
||||||
if [ "true" == "$CERC_REMOTE_DEBUG" ] && [ -x "/usr/local/bin/dlv" ]; then
|
if [ "true" == "$CERC_REMOTE_DEBUG" ] && [ -x "/usr/local/bin/dlv" ]; then
|
||||||
START_CMD="/usr/local/bin/dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec `pwd`/ipld-eth-server --continue --"
|
START_CMD="/usr/local/bin/dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec `pwd`/ipld-eth-server --continue --"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo running: $START_CMD ${VDB_COMMAND} --config=`pwd`/config.toml
|
exec $START_CMD ${VDB_COMMAND:-serve}
|
||||||
$START_CMD ${VDB_COMMAND} --config=`pwd`/config.toml
|
|
||||||
rv=$?
|
|
||||||
|
|
||||||
if [ $rv != 0 ]; then
|
|
||||||
echo "ipld-eth-server startup failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[database]
|
[database]
|
||||||
name = "vulcanize_testing"
|
name = "cerc_testing"
|
||||||
hostname = "localhost"
|
hostname = "localhost"
|
||||||
port = 5432
|
port = 5432
|
||||||
|
|
||||||
|
@ -660,6 +660,12 @@ func (pea *PublicEthAPI) localGetTransactionReceipt(ctx context.Context, hash co
|
|||||||
if receipt.Logs == nil {
|
if receipt.Logs == nil {
|
||||||
fields["logs"] = []*types.Log{}
|
fields["logs"] = []*types.Log{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tx.Type() == types.BlobTxType {
|
||||||
|
fields["blobGasUsed"] = hexutil.Uint64(receipt.BlobGasUsed)
|
||||||
|
fields["blobGasPrice"] = (*hexutil.Big)(receipt.BlobGasPrice)
|
||||||
|
}
|
||||||
|
|
||||||
// If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation
|
// If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation
|
||||||
if receipt.ContractAddress != (common.Address{}) {
|
if receipt.ContractAddress != (common.Address{}) {
|
||||||
fields["contractAddress"] = receipt.ContractAddress
|
fields["contractAddress"] = receipt.ContractAddress
|
||||||
|
@ -128,9 +128,10 @@ func NewConfig() (*Config, error) {
|
|||||||
viper.BindEnv("server.ipcPath", SERVER_IPC_PATH)
|
viper.BindEnv("server.ipcPath", SERVER_IPC_PATH)
|
||||||
viper.BindEnv("server.graphqlPath", SERVER_GRAPHQL_PATH)
|
viper.BindEnv("server.graphqlPath", SERVER_GRAPHQL_PATH)
|
||||||
|
|
||||||
|
viper.BindEnv("ethereum.chainID", ETH_CHAIN_ID)
|
||||||
|
viper.BindEnv("ethereum.chainConfig", ETH_CHAIN_CONFIG)
|
||||||
viper.BindEnv("ethereum.httpPath", ETH_HTTP_PATH)
|
viper.BindEnv("ethereum.httpPath", ETH_HTTP_PATH)
|
||||||
viper.BindEnv("ethereum.rpcGasCap", ETH_RPC_GAS_CAP)
|
viper.BindEnv("ethereum.rpcGasCap", ETH_RPC_GAS_CAP)
|
||||||
viper.BindEnv("ethereum.chainConfig", ETH_CHAIN_CONFIG)
|
|
||||||
viper.BindEnv("ethereum.supportsStateDiff", ETH_SUPPORTS_STATEDIFF)
|
viper.BindEnv("ethereum.supportsStateDiff", ETH_SUPPORTS_STATEDIFF)
|
||||||
viper.BindEnv("ethereum.stateDiffTimeout", ETH_STATEDIFF_TIMEOUT)
|
viper.BindEnv("ethereum.stateDiffTimeout", ETH_STATEDIFF_TIMEOUT)
|
||||||
viper.BindEnv("ethereum.forwardEthCalls", ETH_FORWARD_ETH_CALLS)
|
viper.BindEnv("ethereum.forwardEthCalls", ETH_FORWARD_ETH_CALLS)
|
||||||
@ -143,11 +144,32 @@ func NewConfig() (*Config, error) {
|
|||||||
c.dbInit()
|
c.dbInit()
|
||||||
ethHTTP := viper.GetString("ethereum.httpPath")
|
ethHTTP := viper.GetString("ethereum.httpPath")
|
||||||
ethHTTPEndpoint := fmt.Sprintf("http://%s", ethHTTP)
|
ethHTTPEndpoint := fmt.Sprintf("http://%s", ethHTTP)
|
||||||
nodeInfo, cli, err := getEthNodeAndClient(ethHTTPEndpoint)
|
|
||||||
c.NodeNetworkID = nodeInfo.NetworkID
|
// At least one of chain ID and chain config must be passed.
|
||||||
|
// If both are passed, the chain ID must match the config.
|
||||||
|
chainID := viper.GetUint64("ethereum.chainID")
|
||||||
|
chainConfigPath := viper.GetString("ethereum.chainConfig")
|
||||||
|
var err error
|
||||||
|
if chainConfigPath != "" {
|
||||||
|
if c.ChainConfig, err = utils.LoadConfig(chainConfigPath); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// Only validate the chain ID if it was actually passed
|
||||||
|
if viper.GetString("ethereum.chainID") != "" && c.ChainConfig.ChainID.Uint64() != chainID {
|
||||||
|
return nil, fmt.Errorf("passed chain ID %d does not match chain config chain ID %d",
|
||||||
|
chainID, c.ChainConfig.ChainID.Uint64())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if c.ChainConfig, err = utils.ChainConfig(chainID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeInfo, cli, err := getEthNodeAndClient(ethHTTPEndpoint, chainID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
c.NodeNetworkID = nodeInfo.NetworkID
|
||||||
c.Client = cli
|
c.Client = cli
|
||||||
c.SupportStateDiff = viper.GetBool("ethereum.supportsStateDiff")
|
c.SupportStateDiff = viper.GetBool("ethereum.supportsStateDiff")
|
||||||
c.ForwardEthCalls = viper.GetBool("ethereum.forwardEthCalls")
|
c.ForwardEthCalls = viper.GetBool("ethereum.forwardEthCalls")
|
||||||
@ -237,12 +259,6 @@ func NewConfig() (*Config, error) {
|
|||||||
if c.StateDiffTimeout < 0 {
|
if c.StateDiffTimeout < 0 {
|
||||||
return nil, errors.New("ethereum.stateDiffTimeout < 0")
|
return nil, errors.New("ethereum.stateDiffTimeout < 0")
|
||||||
}
|
}
|
||||||
chainConfigPath := viper.GetString("ethereum.chainConfig")
|
|
||||||
if chainConfigPath != "" {
|
|
||||||
c.ChainConfig, err = utils.LoadConfig(chainConfigPath)
|
|
||||||
} else {
|
|
||||||
c.ChainConfig, err = utils.ChainConfig(nodeInfo.ChainID)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.loadGroupCacheConfig()
|
c.loadGroupCacheConfig()
|
||||||
|
|
||||||
@ -312,12 +328,11 @@ func (c *Config) loadValidatorConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetEthNodeAndClient returns eth node info and client from path url
|
// GetEthNodeAndClient returns eth node info and client from path url
|
||||||
func getEthNodeAndClient(path string) (node.Info, *rpc.Client, error) {
|
func getEthNodeAndClient(path string, chainid uint64) (node.Info, *rpc.Client, error) {
|
||||||
viper.BindEnv("ethereum.nodeID", ETH_NODE_ID)
|
viper.BindEnv("ethereum.nodeID", ETH_NODE_ID)
|
||||||
viper.BindEnv("ethereum.clientName", ETH_CLIENT_NAME)
|
viper.BindEnv("ethereum.clientName", ETH_CLIENT_NAME)
|
||||||
viper.BindEnv("ethereum.genesisBlock", ETH_GENESIS_BLOCK)
|
viper.BindEnv("ethereum.genesisBlock", ETH_GENESIS_BLOCK)
|
||||||
viper.BindEnv("ethereum.networkID", ETH_NETWORK_ID)
|
viper.BindEnv("ethereum.networkID", ETH_NETWORK_ID)
|
||||||
viper.BindEnv("ethereum.chainID", ETH_CHAIN_ID)
|
|
||||||
|
|
||||||
rpcClient, err := rpc.Dial(path)
|
rpcClient, err := rpc.Dial(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -328,6 +343,6 @@ func getEthNodeAndClient(path string) (node.Info, *rpc.Client, error) {
|
|||||||
ClientName: viper.GetString("ethereum.clientName"),
|
ClientName: viper.GetString("ethereum.clientName"),
|
||||||
GenesisBlock: viper.GetString("ethereum.genesisBlock"),
|
GenesisBlock: viper.GetString("ethereum.genesisBlock"),
|
||||||
NetworkID: viper.GetString("ethereum.networkID"),
|
NetworkID: viper.GetString("ethereum.networkID"),
|
||||||
ChainID: viper.GetUint64("ethereum.chainID"),
|
ChainID: chainid,
|
||||||
}, rpcClient, nil
|
}, rpcClient, nil
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,15 @@ if [[ -z $SKIP_BUILD ]]; then
|
|||||||
# Prevent conflicting tty output
|
# Prevent conflicting tty output
|
||||||
export BUILDKIT_PROGRESS=plain
|
export BUILDKIT_PROGRESS=plain
|
||||||
|
|
||||||
$laconic_so setup-repositories
|
# The server itself will be run separately
|
||||||
$laconic_so build-containers
|
$laconic_so setup-repositories \
|
||||||
|
--exclude git.vdb.to/cerc-io/ipld-eth-server
|
||||||
|
$laconic_so build-containers \
|
||||||
|
--exclude cerc/ipld-eth-server
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! $laconic_so deploy \
|
if ! $laconic_so deploy \
|
||||||
|
--exclude ipld-eth-server \
|
||||||
--env-file $CONFIG_DIR/stack.env \
|
--env-file $CONFIG_DIR/stack.env \
|
||||||
--cluster test up
|
--cluster test up
|
||||||
then
|
then
|
||||||
|
@ -5,7 +5,7 @@ services:
|
|||||||
restart: on-failure
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
- ipld-eth-db
|
- ipld-eth-db
|
||||||
image: git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:v5.3.0-alpha
|
image: git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:v5.4.0-alpha
|
||||||
environment:
|
environment:
|
||||||
DATABASE_USER: "vdbm"
|
DATABASE_USER: "vdbm"
|
||||||
DATABASE_NAME: "cerc_testing"
|
DATABASE_NAME: "cerc_testing"
|
||||||
|
@ -4,6 +4,8 @@ services:
|
|||||||
ipld-eth-server:
|
ipld-eth-server:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: cerc/ipld-eth-server:local
|
image: cerc/ipld-eth-server:local
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
networks:
|
networks:
|
||||||
- test_default
|
- test_default
|
||||||
environment:
|
environment:
|
||||||
|
Loading…
Reference in New Issue
Block a user