Skip to content

Commit

Permalink
txingestion: remove (ethereum#70)
Browse files Browse the repository at this point in the history
* txingestion: remove

* workflow: bugfix

* rollup: lint
  • Loading branch information
tynes authored Nov 3, 2020
1 parent e11fe6d commit a0aa2fc
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 448 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
git fetch gh $GITHUB_SHA
git checkout $GITHUB_SHA
cd $HOME/optimism-integration
./build.sh
./docker/build.sh
- name: Test
run: |
Expand Down
10 changes: 1 addition & 9 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,9 @@ var (
}

optimismFlags = []cli.Flag{
// TODO: deprecate these flags
utils.TxIngestionEnableFlag,
utils.TxIngestionDBHostFlag,
utils.TxIngestionDBPortFlag,
utils.TxIngestionDBNameFlag,
utils.TxIngestionDBUserFlag,
utils.TxIngestionDBPasswordFlag,
utils.TxIngestionPollIntervalFlag,
// Flags for the SyncService
utils.TxIngestionSignerKeyHexFlag,
utils.TxIngestionSignerKeyFileFlag,
// Flags for the SyncService
utils.Eth1SyncServiceEnable,
utils.Eth1AddressResolverAddressFlag,
utils.Eth1CanonicalTransactionChainDeployHeightFlag,
Expand Down
7 changes: 0 additions & 7 deletions cmd/geth/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ var AppHelpFlagGroups = []flagGroup{
{
Name: "OPTIMISM",
Flags: []cli.Flag{
utils.TxIngestionEnableFlag,
utils.TxIngestionDBHostFlag,
utils.TxIngestionDBPortFlag,
utils.TxIngestionDBNameFlag,
utils.TxIngestionDBUserFlag,
utils.TxIngestionDBPasswordFlag,
utils.TxIngestionPollIntervalFlag,
utils.TxIngestionSignerKeyHexFlag,
utils.TxIngestionSignerKeyFileFlag,
utils.Eth1SyncServiceEnable,
Expand Down
106 changes: 23 additions & 83 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,42 +771,7 @@ var (
Usage: "External EVM configuration (default = built-in interpreter)",
Value: "",
}
// Flags associated with Layer 1 Transaction Ingestion
// TODO(mark): deprecate these flags
TxIngestionEnableFlag = cli.BoolFlag{
Name: "txingestion.enable",
Usage: "Enable L1 Transaction Ingestion",
}
TxIngestionDBHostFlag = cli.StringFlag{
Name: "txingestion.dbhost",
Usage: "HTTP host of SQL database to ingest transactions from",
Value: eth.DefaultConfig.Rollup.TxIngestionDBHost,
}
TxIngestionDBPortFlag = cli.IntFlag{
Name: "txingestion.dbport",
Usage: "HTTP port of SQL database to ingest transactions from",
Value: int(eth.DefaultConfig.Rollup.TxIngestionDBPort),
}
TxIngestionDBNameFlag = cli.StringFlag{
Name: "txingestion.dbname",
Usage: "Database name to ingest transactions from",
Value: eth.DefaultConfig.Rollup.TxIngestionDBName,
}
TxIngestionDBUserFlag = cli.StringFlag{
Name: "txingestion.dbuser",
Usage: "Database username",
Value: eth.DefaultConfig.Rollup.TxIngestionDBUser,
}
TxIngestionDBPasswordFlag = cli.StringFlag{
Name: "txingestion.dbpassword",
Usage: "Database password",
Value: eth.DefaultConfig.Rollup.TxIngestionDBPassword,
}
TxIngestionPollIntervalFlag = cli.DurationFlag{
Name: "txingestion.pollinterval",
Usage: "Time between polls for tranaction ingestion",
Value: eth.DefaultConfig.Rollup.TxIngestionPollInterval,
}
// The god key
TxIngestionSignerKeyHexFlag = cli.StringFlag{
Name: "txingestion.signerkey",
Usage: "Hex private key to authenticate L1 to L2 txs",
Expand Down Expand Up @@ -1087,52 +1052,7 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
}
}

// setTransactionIngestion configures the transaction ingestion process.
func setTxIngestion(ctx *cli.Context, cfg *rollup.Config) {
if ctx.GlobalIsSet(TxIngestionEnableFlag.Name) {
cfg.TxIngestionEnable = ctx.GlobalBool(TxIngestionEnableFlag.Name)
}
if ctx.GlobalIsSet(TxIngestionDBHostFlag.Name) {
cfg.TxIngestionDBHost = ctx.GlobalString(TxIngestionDBHostFlag.Name)
}
if ctx.GlobalIsSet(TxIngestionDBPortFlag.Name) {
cfg.TxIngestionDBPort = ctx.GlobalUint(TxIngestionDBPortFlag.Name)
}
if ctx.GlobalIsSet(TxIngestionDBNameFlag.Name) {
cfg.TxIngestionDBName = ctx.GlobalString(TxIngestionDBNameFlag.Name)
}
if ctx.GlobalIsSet(TxIngestionDBUserFlag.Name) {
cfg.TxIngestionDBUser = ctx.GlobalString(TxIngestionDBUserFlag.Name)
}
if ctx.GlobalIsSet(TxIngestionDBPasswordFlag.Name) {
cfg.TxIngestionDBPassword = ctx.GlobalString(TxIngestionDBPasswordFlag.Name)
}
if ctx.GlobalIsSet(TxIngestionPollIntervalFlag.Name) {
cfg.TxIngestionPollInterval = ctx.GlobalDuration(TxIngestionPollIntervalFlag.Name)
}

var (
hex = ctx.GlobalString(TxIngestionSignerKeyHexFlag.Name)
file = ctx.GlobalString(TxIngestionSignerKeyFileFlag.Name)
key *ecdsa.PrivateKey
err error
)
switch {
case file != "" && hex != "":
Fatalf("Options %q and %q are mutually exclusive", TxIngestionSignerKeyFileFlag.Name, TxIngestionSignerKeyHexFlag.Name)
case file != "":
if key, err = crypto.LoadECDSA(file); err != nil {
Fatalf("Option %q: %v", NodeKeyFileFlag.Name, err)
}
cfg.TxIngestionSignerKey = key
case hex != "":
if key, err = crypto.HexToECDSA(hex); err != nil {
Fatalf("Option %q: %v", NodeKeyHexFlag.Name, err)
}
cfg.TxIngestionSignerKey = key
}
}

// setEth1 configures the sync service
func setEth1(ctx *cli.Context, cfg *rollup.Config) {
if ctx.GlobalIsSet(Eth1CanonicalTransactionChainDeployHeightFlag.Name) {
height := ctx.GlobalUint64(Eth1CanonicalTransactionChainDeployHeightFlag.Name)
Expand Down Expand Up @@ -1173,6 +1093,27 @@ func setEth1(ctx *cli.Context, cfg *rollup.Config) {
if ctx.GlobalIsSet(RollupEnableVerifierFlag.Name) {
cfg.IsVerifier = true
}

var (
hex = ctx.GlobalString(TxIngestionSignerKeyHexFlag.Name)
file = ctx.GlobalString(TxIngestionSignerKeyFileFlag.Name)
key *ecdsa.PrivateKey
err error
)
switch {
case file != "" && hex != "":
Fatalf("Options %q and %q are mutually exclusive", TxIngestionSignerKeyFileFlag.Name, TxIngestionSignerKeyHexFlag.Name)
case file != "":
if key, err = crypto.LoadECDSA(file); err != nil {
Fatalf("Option %q: %v", NodeKeyFileFlag.Name, err)
}
cfg.TxIngestionSignerKey = key
case hex != "":
if key, err = crypto.HexToECDSA(hex); err != nil {
Fatalf("Option %q: %v", NodeKeyHexFlag.Name, err)
}
cfg.TxIngestionSignerKey = key
}
}

// setLes configures the les server and ultra light client settings from the command line flags.
Expand Down Expand Up @@ -1632,7 +1573,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
setMiner(ctx, &cfg.Miner)
setWhitelist(ctx, cfg)
setLes(ctx, cfg)
setTxIngestion(ctx, &cfg.Rollup)
setEth1(ctx, &cfg.Rollup)

if ctx.GlobalIsSet(SyncModeFlag.Name) {
Expand Down
5 changes: 1 addition & 4 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ type Ethereum struct {
blockchain *core.BlockChain
protocolManager *ProtocolManager
lesServer LesServer
// Transaction Ingestion Service
txIngestion *rollup.TxIngestion // will be deprecated
syncService *rollup.SyncService
syncService *rollup.SyncService

// DB interfaces
chainDb ethdb.Database // Block chain database
Expand Down Expand Up @@ -207,7 +205,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
config.TxPool.Journal = ctx.ResolvePath(config.TxPool.Journal)
}
eth.txPool = core.NewTxPool(config.TxPool, chainConfig, eth.blockchain)
eth.txIngestion = rollup.NewTxIngestion(config.Rollup, chainConfig, eth.txPool)

eth.syncService, err = rollup.NewSyncService(context.Background(), config.Rollup, eth.txPool, eth.blockchain, eth.chainDb)
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions rollup/sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ func (s *SyncService) pollHead() {
}
process := new([]*types.Header)
index, err := s.getCommonAncestor(head.Number, process)
if err != nil {
log.Error("Cannot get common ancestor", "message", err.Error())
continue
}
log.Debug("get common ancestor", "index", index, "count", len(*process))
blocks := (*process)[:]
for i := len(blocks) - 1; i >= 0; i-- {
Expand All @@ -373,6 +377,9 @@ func (s *SyncService) resolveAddresses() error {
return errors.New("Must initialize eth rpc client first")
}
resolver, err := addressmanager.NewLibAddressManager(s.AddressResolverAddress, s.ethrpcclient)
if err != nil {
return fmt.Errorf("Cannot create new address manager: %w", err)
}
// TODO(mark): using the correct block height is a consensus critical thing.
// Be sure to use the correct height by setting BlockNumber in the context
opts := bind.CallOpts{Context: s.ctx}
Expand Down
2 changes: 1 addition & 1 deletion rollup/sync_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func TestSyncServiceSequencerBatchAppend(t *testing.T) {
count := 0
for _, transactions := range queued {
// This stuff should match ctcTx.tx
for _, _ = range transactions {
for range transactions {
count++
}
}
Expand Down
173 changes: 0 additions & 173 deletions rollup/transaction_ingestion.go

This file was deleted.

Loading

0 comments on commit a0aa2fc

Please sign in to comment.