Skip to content

Commit

Permalink
Merge pull request #4 from coinbase/patrick/small-nits
Browse files Browse the repository at this point in the history
[Chore] Remote Node Instructions
  • Loading branch information
patrick-ogrady authored Oct 25, 2020
2 parents 06e61e1 + 4dbc3f5 commit 3561458
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/ethereum-data:/dat
```
_If you cloned the repository, you can run `make run-mainnet-online`._

#### Mainnet:Online (Remote)
```text
docker run -d --rm --ulimit "nofile=100000:100000" -e "MODE=ONLINE" -e "NETWORK=MAINNET" -e "PORT=8080" -e "GETH=<NODE URL>" -p 8080:8080 -p 30303:30303 rosetta-ethereum:latest
```
_If you cloned the repository, you can run `make run-mainnet-remote geth=<NODE URL>`._

#### Mainnet:Offline
```text
docker run -d --rm -e "MODE=OFFLINE" -e "NETWORK=MAINNET" -e "PORT=8081" -p 8081:8081 rosetta-ethereum:latest
Expand All @@ -80,6 +86,12 @@ docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/ethereum-data:/dat
```
_If you cloned the repository, you can run `make run-testnet-online`._

#### Testnet:Online (Remote)
```text
docker run -d --rm --ulimit "nofile=100000:100000" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -e "GETH=<NODE URL>" -p 8080:8080 -p 30303:30303 rosetta-ethereum:latest
```
_If you cloned the repository, you can run `make run-testnet-remote geth=<NODE URL>`._

#### Testnet:Offline
```text
docker run -d --rm -e "MODE=OFFLINE" -e "NETWORK=TESTNET" -e "PORT=8081" -p 8081:8081 rosetta-ethereum:latest
Expand Down Expand Up @@ -119,7 +131,7 @@ and run one of the following commands:
## Future Work
* Add ERC-20 Rosetta Module to enable reading ERC-20 token transfers and transaction construction
* [Rosetta API `/mempool/*`](https://www.rosetta-api.org/docs/MempoolApi.html) implementation
* Add more methods to the `/call` endpoint (currently only support `eth_getTransactionReceipt`
* Add more methods to the `/call` endpoint (currently only support `eth_getTransactionReceipt`)
* Add CI test using `rosetta-cli` to run on each PR (likely on a regtest network)

_Please reach out on our [community](https://community.rosetta-api.org) if you want to tackle anything on this list!_
Expand Down
20 changes: 12 additions & 8 deletions ethereum/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (ec *Client) getBlock(
return nil, nil, ethereum.NotFound
}

// Decode header and transactions.
// Decode header and transactions
var head types.Header
var body rpcBlock
if err := json.Unmarshal(raw, &head); err != nil {
Expand All @@ -332,7 +332,17 @@ func (ec *Client) getBlock(
return nil, nil, fmt.Errorf("%w: unable to get uncles", err)
}

// Get all transaction receipts
receipts, err := ec.getBlockReceipts(ctx, body.Hash, body.Transactions)
if err != nil {
return nil, nil, fmt.Errorf("%w: could not get receipts for %x", err, body.Hash[:])
}

// Get block traces (not possible to make idempotent block transaction trace requests)
//
// We fetch traces last because we want to avoid limiting the number of other
// block-related data fetches we perform concurrently (we limit the number of
// concurrent traces that are computed to 16 to avoid overwhelming geth).
var traces []*rpcCall
var rawTraces []*rpcRawCall
var addTraces bool
Expand All @@ -344,13 +354,7 @@ func (ec *Client) getBlock(
}
}

// Get all transaction receipts
receipts, err := ec.getBlockReceipts(ctx, body.Hash, body.Transactions)
if err != nil {
return nil, nil, fmt.Errorf("%w: could not get receipts for %x", err, body.Hash[:])
}

// Convert all txs to formatted txs
// Convert all txs to loaded txs
txs := make([]*types.Transaction, len(body.Transactions))
loadedTxs := make([]*loadedTransaction, len(body.Transactions))
for i, tx := range body.Transactions {
Expand Down

0 comments on commit 3561458

Please sign in to comment.