Skip to content

Commit

Permalink
Merge pull request #141 from dvc94ch/dev-testnet
Browse files Browse the repository at this point in the history
Add dev testnet.
  • Loading branch information
xiaying-peng authored Nov 1, 2022
2 parents 75ad337 + 1032355 commit 64f2f07
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ run-mainnet-offline:
docker run -d --rm -e "MODE=OFFLINE" -e "NETWORK=MAINNET" -e "PORT=8081" -p 8081:8081 rosetta-ethereum:latest

run-testnet-online:
docker run -d --rm --ulimit "nofile=${NOFILE}:${NOFILE}" -v "${PWD}/ethereum-data:/data" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -p 8080:8080 -p 30303:30303 rosetta-ethereum:latest
docker run -d --rm --ulimit "nofile=${NOFILE}:${NOFILE}" -v "${PWD}/ethereum-data:/data" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -p 8080:8080 -p 30303:30303 -p 8545:8545 rosetta-ethereum:latest

run-testnet-offline:
docker run -d --rm -e "MODE=OFFLINE" -e "NETWORK=TESTNET" -e "PORT=8081" -p 8081:8081 rosetta-ethereum:latest
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/ethereum-data:/dat
Cloned repo:
```text
make run-testnet-online
// to send some funds into your testnet account you can use the following commands
geth attach http://127.0.0.1:8545
> eth.sendTransaction({from: eth.coinbase, to: "0x9C639954BC9956598Df734994378A36f73cfba0C", value: web3.toWei(50, "ether")})
```

**`Testnet:Online`** (Remote)
Expand Down Expand Up @@ -338,4 +341,4 @@ You can find community implementations for a variety of blockchains in the [rose

This project is available open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).

© 2022 Coinbase
© 2022 Coinbase
10 changes: 9 additions & 1 deletion configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func LoadConfiguration() (*Configuration, error) {
config.GenesisBlockIdentifier = ethereum.MainnetGenesisBlockIdentifier
config.Params = params.MainnetChainConfig
config.GethArguments = ethereum.MainnetGethArguments
case Testnet, Ropsten:
case Ropsten:
config.Network = &types.NetworkIdentifier{
Blockchain: ethereum.Blockchain,
Network: ethereum.RopstenNetwork,
Expand All @@ -156,6 +156,14 @@ func LoadConfiguration() (*Configuration, error) {
config.GenesisBlockIdentifier = ethereum.GoerliGenesisBlockIdentifier
config.Params = params.GoerliChainConfig
config.GethArguments = ethereum.GoerliGethArguments
case Testnet:
config.Network = &types.NetworkIdentifier{
Blockchain: ethereum.Blockchain,
Network: ethereum.DevNetwork,
}
config.GenesisBlockIdentifier = nil
config.Params = params.AllCliqueProtocolChanges
config.GethArguments = ethereum.DevGethArguments
case "":
return nil, errors.New("NETWORK must be populated")
default:
Expand Down
8 changes: 4 additions & 4 deletions configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ func TestLoadConfiguration(t *testing.T) {
cfg: &Configuration{
Mode: Online,
Network: &types.NetworkIdentifier{
Network: ethereum.RopstenNetwork,
Network: ethereum.DevNetwork,
Blockchain: ethereum.Blockchain,
},
Params: params.RopstenChainConfig,
GenesisBlockIdentifier: ethereum.RopstenGenesisBlockIdentifier,
Params: params.AllCliqueProtocolChanges,
GenesisBlockIdentifier: nil,
Port: 1000,
GethURL: DefaultGethURL,
GethArguments: ethereum.RopstenGethArguments,
GethArguments: ethereum.DevGethArguments,
SkipGethAdmin: true,
},
},
Expand Down
4 changes: 3 additions & 1 deletion ethereum/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2487,7 +2487,9 @@ func TestBlock_468194(t *testing.T) {
}

// Block with EIP-1559 base fee & txs. This block taken from mainnet:
// https://etherscan.io/block/0x68985b6b06bb5c6012393145729babb983fc16c50ec5207972ddda02de02f7e2
//
// https://etherscan.io/block/0x68985b6b06bb5c6012393145729babb983fc16c50ec5207972ddda02de02f7e2
//
// This block has 7 transactions, all EIP-1559 type except the last.
func TestBlock_13998626(t *testing.T) {
mockJSONRPC := &mocks.JSONRPC{}
Expand Down
7 changes: 7 additions & 0 deletions ethereum/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const (
// in GoerliNetworkNetworkIdentifier.
GoerliNetwork string = "Goerli"

// DevNetwork is the value of the network
// in DevNetworkNetworkIdentifier.
DevNetwork string = "Dev"

// Symbol is the symbol value
// used in Currency.
Symbol = "ETH"
Expand Down Expand Up @@ -136,6 +140,9 @@ var (
// GoerliGethArguments are the arguments to start a ropsten geth instance.
GoerliGethArguments = fmt.Sprintf("%s --goerli", MainnetGethArguments)

// DevGethArguments are the arguments to start a dev geth instance.
DevGethArguments = fmt.Sprintf("%s --dev", MainnetGethArguments)

// MainnetGenesisBlockIdentifier is the *types.BlockIdentifier
// of the mainnet genesis block.
MainnetGenesisBlockIdentifier = &types.BlockIdentifier{
Expand Down
5 changes: 0 additions & 5 deletions services/network_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/coinbase/rosetta-ethereum/configuration"
"github.com/coinbase/rosetta-ethereum/ethereum"

"github.com/coinbase/rosetta-sdk-go/asserter"
"github.com/coinbase/rosetta-sdk-go/types"
)

Expand Down Expand Up @@ -86,10 +85,6 @@ func (s *NetworkAPIService) NetworkStatus(
return nil, wrapErr(ErrGeth, err)
}

if currentTime < asserter.MinUnixEpoch {
return nil, ErrGethNotReady
}

return &types.NetworkStatusResponse{
CurrentBlockIdentifier: currentBlock,
CurrentBlockTimestamp: currentTime,
Expand Down

0 comments on commit 64f2f07

Please sign in to comment.