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
|
||||
scripts
|
||||
Dockerfile
|
||||
environments
|
||||
|
||||
**/node_modules
|
||||
build
|
11
.github/workflows/tests.yaml
vendored
11
.github/workflows/tests.yaml
vendored
@ -102,10 +102,15 @@ jobs:
|
||||
progress: false
|
||||
- name: Run system tests
|
||||
working-directory: ./system-tests
|
||||
# Work around dependency conflict in system-tests:
|
||||
# web3 uses an older eth-account until (unreleased) v7
|
||||
run: |
|
||||
pip install pytest
|
||||
pip install -r requirements.txt
|
||||
pytest -vv
|
||||
pip3 install pytest
|
||||
pip3 install -r requirements.txt
|
||||
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
|
||||
env:
|
||||
|
@ -29,7 +29,6 @@ RUN GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -
|
||||
FROM alpine
|
||||
|
||||
ARG USER="vdm"
|
||||
ARG CONFIG_FILE="./environments/example.toml"
|
||||
|
||||
RUN adduser -Du 5000 $USER
|
||||
WORKDIR /app
|
||||
@ -38,13 +37,10 @@ USER $USER
|
||||
|
||||
# chown first so dir is writable
|
||||
# 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 .
|
||||
|
||||
|
||||
# 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/environments environments
|
||||
|
||||
# Allow for debugging
|
||||
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-genesis-block", "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3", "eth genesis block hash")
|
||||
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-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-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")
|
||||
|
@ -1,17 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Beginning the ipld-eth-server process"
|
||||
|
||||
START_CMD="./ipld-eth-server"
|
||||
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 --"
|
||||
fi
|
||||
|
||||
echo running: $START_CMD ${VDB_COMMAND} --config=`pwd`/config.toml
|
||||
$START_CMD ${VDB_COMMAND} --config=`pwd`/config.toml
|
||||
rv=$?
|
||||
|
||||
if [ $rv != 0 ]; then
|
||||
echo "ipld-eth-server startup failed"
|
||||
exit 1
|
||||
fi
|
||||
exec $START_CMD ${VDB_COMMAND:-serve}
|
||||
|
@ -1,5 +1,5 @@
|
||||
[database]
|
||||
name = "vulcanize_testing"
|
||||
name = "cerc_testing"
|
||||
hostname = "localhost"
|
||||
port = 5432
|
||||
|
||||
|
@ -660,6 +660,12 @@ func (pea *PublicEthAPI) localGetTransactionReceipt(ctx context.Context, hash co
|
||||
if receipt.Logs == nil {
|
||||
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 receipt.ContractAddress != (common.Address{}) {
|
||||
fields["contractAddress"] = receipt.ContractAddress
|
||||
|
@ -128,9 +128,10 @@ func NewConfig() (*Config, error) {
|
||||
viper.BindEnv("server.ipcPath", SERVER_IPC_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.rpcGasCap", ETH_RPC_GAS_CAP)
|
||||
viper.BindEnv("ethereum.chainConfig", ETH_CHAIN_CONFIG)
|
||||
viper.BindEnv("ethereum.supportsStateDiff", ETH_SUPPORTS_STATEDIFF)
|
||||
viper.BindEnv("ethereum.stateDiffTimeout", ETH_STATEDIFF_TIMEOUT)
|
||||
viper.BindEnv("ethereum.forwardEthCalls", ETH_FORWARD_ETH_CALLS)
|
||||
@ -143,11 +144,32 @@ func NewConfig() (*Config, error) {
|
||||
c.dbInit()
|
||||
ethHTTP := viper.GetString("ethereum.httpPath")
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
c.NodeNetworkID = nodeInfo.NetworkID
|
||||
c.Client = cli
|
||||
c.SupportStateDiff = viper.GetBool("ethereum.supportsStateDiff")
|
||||
c.ForwardEthCalls = viper.GetBool("ethereum.forwardEthCalls")
|
||||
@ -237,12 +259,6 @@ func NewConfig() (*Config, error) {
|
||||
if c.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()
|
||||
|
||||
@ -312,12 +328,11 @@ func (c *Config) loadValidatorConfig() {
|
||||
}
|
||||
|
||||
// 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.clientName", ETH_CLIENT_NAME)
|
||||
viper.BindEnv("ethereum.genesisBlock", ETH_GENESIS_BLOCK)
|
||||
viper.BindEnv("ethereum.networkID", ETH_NETWORK_ID)
|
||||
viper.BindEnv("ethereum.chainID", ETH_CHAIN_ID)
|
||||
|
||||
rpcClient, err := rpc.Dial(path)
|
||||
if err != nil {
|
||||
@ -328,6 +343,6 @@ func getEthNodeAndClient(path string) (node.Info, *rpc.Client, error) {
|
||||
ClientName: viper.GetString("ethereum.clientName"),
|
||||
GenesisBlock: viper.GetString("ethereum.genesisBlock"),
|
||||
NetworkID: viper.GetString("ethereum.networkID"),
|
||||
ChainID: viper.GetUint64("ethereum.chainID"),
|
||||
ChainID: chainid,
|
||||
}, rpcClient, nil
|
||||
}
|
||||
|
@ -22,11 +22,15 @@ if [[ -z $SKIP_BUILD ]]; then
|
||||
# Prevent conflicting tty output
|
||||
export BUILDKIT_PROGRESS=plain
|
||||
|
||||
$laconic_so setup-repositories
|
||||
$laconic_so build-containers
|
||||
# The server itself will be run separately
|
||||
$laconic_so setup-repositories \
|
||||
--exclude git.vdb.to/cerc-io/ipld-eth-server
|
||||
$laconic_so build-containers \
|
||||
--exclude cerc/ipld-eth-server
|
||||
fi
|
||||
|
||||
if ! $laconic_so deploy \
|
||||
--exclude ipld-eth-server \
|
||||
--env-file $CONFIG_DIR/stack.env \
|
||||
--cluster test up
|
||||
then
|
||||
|
@ -5,7 +5,7 @@ services:
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
- 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:
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_NAME: "cerc_testing"
|
||||
|
@ -4,6 +4,8 @@ services:
|
||||
ipld-eth-server:
|
||||
restart: unless-stopped
|
||||
image: cerc/ipld-eth-server:local
|
||||
build:
|
||||
context: ..
|
||||
networks:
|
||||
- test_default
|
||||
environment:
|
||||
|
Loading…
Reference in New Issue
Block a user