Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(taiko): remove tx forwarding #362

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ func makeFullNode(ctx *cli.Context) *node.Node {
cfg.Eth.OverrideVerkle = &v
}

// CHANGE(taiko): set preconfirmation forwarding URL.
if ctx.IsSet(utils.PreconfirmationForwardingURLFlag.Name) {
cfg.Eth.PreconfirmationForwardingURL = ctx.String(utils.PreconfirmationForwardingURLFlag.Name)
}

backend, eth := utils.RegisterEthService(stack, &cfg.Eth)

// CHANGE(TAIKO): register Taiko RPC APIs.
Expand Down
2 changes: 0 additions & 2 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ func init() {
debug.Flags,
metricsFlags,
)
// CHANGE(taiko): append Taiko flags into the original GETH flags
app.Flags = append(app.Flags, utils.TaikoFlag, utils.PreconfirmationForwardingURLFlag)

flags.AutoEnvVars(app.Flags, "GETH")

Expand Down
5 changes: 0 additions & 5 deletions cmd/utils/taiko_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ var (
Usage: "Taiko network",
Category: flags.TaikoCategory,
}
PreconfirmationForwardingURLFlag = &cli.StringFlag{
Name: "taiko.preconfirmationForwardingUrl",
Usage: "URL to forward RPC requests before confirmation",
Category: flags.TaikoCategory,
}
)

// RegisterTaikoAPIs initializes and registers the Taiko RPC APIs.
Expand Down
14 changes: 4 additions & 10 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ import (

// EthAPIBackend implements ethapi.Backend and tracers.Backend for full nodes
type EthAPIBackend struct {
extRPCEnabled bool
allowUnprotectedTxs bool
eth *Ethereum
gpo *gasprice.Oracle
preconfirmationForwardingURL string // CHANGE(taiko): add preconfirmation forwarding URL
extRPCEnabled bool
allowUnprotectedTxs bool
eth *Ethereum
gpo *gasprice.Oracle
}

// ChainConfig returns the active chain configuration.
Expand Down Expand Up @@ -432,8 +431,3 @@ func (b *EthAPIBackend) StateAtBlock(ctx context.Context, block *types.Block, re
func (b *EthAPIBackend) StateAtTransaction(ctx context.Context, block *types.Block, txIndex int, reexec uint64) (*types.Transaction, vm.BlockContext, *state.StateDB, tracers.StateReleaseFunc, error) {
return b.eth.stateAtTransaction(ctx, block, txIndex, reexec)
}

// GetPreconfirmationForwardingURL returns the URL to forward RPC requests before confirmation.
func (b *EthAPIBackend) GetPreconfirmationForwardingURL() string {
return b.preconfirmationForwardingURL
}
4 changes: 1 addition & 3 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ type Ethereum struct {
lock sync.RWMutex // Protects the variadic fields (e.g. gas price and etherbase)

shutdownTracker *shutdowncheck.ShutdownTracker // Tracks if and when the node has shutdown ungracefully

PreconfirmationForwardingURL string // CHANGE(taiko): add preconfirmation forwarding URL
}

// New creates a new Ethereum object (including the initialisation of the common Ethereum object),
Expand Down Expand Up @@ -257,7 +255,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData))

// CHANGE(taiko): set up the pre-confirmation forwarding URL
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil, config.PreconfirmationForwardingURL}
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil}
if eth.APIBackend.allowUnprotectedTxs {
log.Info("Unprotected transactions allowed")
}
Expand Down
3 changes: 0 additions & 3 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ type Config struct {

// OverrideVerkle (TODO: remove after the fork)
OverrideVerkle *uint64 `toml:",omitempty"`

// CHANGE(taiko): add preconfirmation forwarding URL
PreconfirmationForwardingURL string
}

// CreateConsensusEngine creates a consensus engine for the given chain config.
Expand Down
12 changes: 0 additions & 12 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1974,18 +1974,6 @@ func (api *TransactionAPI) FillTransaction(ctx context.Context, args Transaction
// SendRawTransaction will add the signed transaction to the transaction pool.
// The sender is responsible for signing the transaction and using the correct nonce.
func (api *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error) {
// CHANGE(taiko): Forward the request to the preconf node if specified.
if forwardURL := api.b.GetPreconfirmationForwardingURL(); forwardURL != "" {
log.Info("Forwarding SendRawTransaction request", "forwardURL", forwardURL)
// Forward the raw transaction to the specified URL
h, err := forward[string](forwardURL, "eth_sendRawTransaction", []interface{}{input.String()})
if err == nil && h != nil {
return common.HexToHash(*h), nil
} else {
return common.Hash{}, err
}
}

tx := new(types.Transaction)
if err := tx.UnmarshalBinary(input); err != nil {
return common.Hash{}, err
Expand Down
5 changes: 0 additions & 5 deletions internal/ethapi/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3400,8 +3400,3 @@ func testRPCResponseWithFile(t *testing.T, testid int, result interface{}, rpc s
func addressToHash(a common.Address) common.Hash {
return common.BytesToHash(a.Bytes())
}

// CHANGE(taiko): add preconfirmation forwarding URL
func (b testBackend) GetPreconfirmationForwardingURL() string {
return ""
}
3 changes: 0 additions & 3 deletions internal/ethapi/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ type Backend interface {
SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
BloomStatus() (uint64, uint64)
ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

// CHANGE(taiko): add preconfirmation forwarding URL
GetPreconfirmationForwardingURL() string
}

func GetAPIs(apiBackend Backend) []rpc.API {
Expand Down
94 changes: 0 additions & 94 deletions internal/ethapi/taiko_preconf.go

This file was deleted.

5 changes: 0 additions & 5 deletions internal/ethapi/transaction_args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,3 @@ func (b *backendMock) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent)
}

func (b *backendMock) Engine() consensus.Engine { return nil }

// CHANGE(taiko): add preconfirmation forwarding URL
func (b *backendMock) GetPreconfirmationForwardingURL() string {
return ""
}