Skip to content

Commit

Permalink
remove broadcast service (#1988)
Browse files Browse the repository at this point in the history
  • Loading branch information
ARR552 authored Apr 5, 2023
1 parent cf79378 commit 0949fa2
Show file tree
Hide file tree
Showing 33 changed files with 6 additions and 1,461 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ install-git-hooks: ## Moves hook files to the .git/hooks directory
generate-code-from-proto: ## Generates code from proto files
cd proto/src/proto/statedb/v1 && protoc --proto_path=. --proto_path=../../../../include --go_out=../../../../../merkletree/pb --go-grpc_out=../../../../../merkletree/pb --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative statedb.proto
cd proto/src/proto/executor/v1 && protoc --proto_path=. --go_out=../../../../../state/runtime/executor/pb --go-grpc_out=../../../../../state/runtime/executor/pb --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative executor.proto
cd proto/src/proto/broadcast/v1 && protoc --proto_path=. --proto_path=../../../../include --go_out=../../../../../sequencer/broadcast/pb --go-grpc_out=../../../../../sequencer/broadcast/pb --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative broadcast.proto
cd proto/src/proto/aggregator/v1 && protoc --proto_path=. --proto_path=../../../../include --go_out=../../../../../aggregator/pb --go-grpc_out=../../../../../aggregator/pb --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative aggregator.proto

## Help display.
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ The diagram represents the main components of the software and how they interact

- (JSON) RPC: an interface that allows users (metamask, etherscan, ...) to interact with the node. Fully compatible with Ethereum RPC + some extra endpoints specifics of the network. It interacts with the `state` to get data and process transactions and with the `pool` to store transactions
- Pool: DB that stores transactions by the `RPC` to be selected/discarded by the `sequencer` later on
- Trusted Sequencer: get transactions from the `pool`, check if they are valid by processing them using the `state`, and create sequences. Once transactions are added into the state, they are immediately available to the `broadcast` service. Sequences are sent to L1 using the `etherman`
- Broadcast: API used by the `synchronizer` of nodes that are not the `trusted sequencer` to synchronize the trusted state
- Trusted Sequencer: get transactions from the `pool`, check if they are valid by processing them using the `state`, and create sequences. Once transactions are added into the state, they are immediately available through the `rpc`. Sequences are sent to L1 using the `etherman`
- Permissionless Sequencer: *coming soon*
- Etherman: abstraction that implements the needed methods to interact with the Ethereum network and the relevant smart contracts.
- Synchronizer: Updates the `state` by fetching data from Ethereum through the `etherman`. If the node is not a `trusted sequencer` it also updates the state with the data fetched from the `broadcast` of the `trusted sequencer`. It also detects and handles reorgs that can happen if the `trusted sequencer` sends different data in the broadcast vs the sequences sent to L1 (trusted vs virtual state)
- Synchronizer: Updates the `state` by fetching data from Ethereum through the `etherman`. If the node is not a `trusted sequencer` it also updates the state with the data fetched from the `rpc` of the `trusted sequencer`. It also detects and handles reorgs that can happen if the `trusted sequencer` sends different data in the rpc vs the sequences sent to L1 (trusted vs virtual state)
- State: Responsible for managing the state data (batches, blocks, transactions, ...) that is stored on the `state SB`. It also handles the integration with the `executor` and the `Merkletree` service
- State DB: persistence layer for the state data (except the Merkletree that is handled by the `Merkletree` service)
- Aggregator: consolidates batches by generating ZKPs (Zero Knowledge proofs). To do so it gathers the necessary data that the `prover` needs as input through the `state` and sends a request to it. Once the proof is generated it's sent to Ethereum through the `etherman`
Expand Down Expand Up @@ -76,7 +75,6 @@ Required services and components:
- JSON RPC: can run in a separated instance, and can have multiple instances
- Sequencer & Synchronizer: single instance that needs to run together
- Executor & Merkletree: service that can run on a separate instance
- Broadcast: can run on a separate instance
- Pool DB: Postgres SQL that can be run in a separate instance
- State DB: Postgres SQL that can be run in a separate instance

Expand Down
1 change: 0 additions & 1 deletion ci/e2e-group2/broadcast_test.go

This file was deleted.

2 changes: 0 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const (
RPC = "rpc"
// SYNCHRONIZER is the synchronizer component identifier.
SYNCHRONIZER = "synchronizer"
// BROADCAST is the broadcast component identifier.
BROADCAST = "broadcast-trusted-state"
// ETHTXMANAGER is the service that manages the tx sent to L1
ETHTXMANAGER = "eth-tx-manager"
// L2GASPRICER is the l2 gas pricer component identifier.
Expand Down
20 changes: 0 additions & 20 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,13 @@ import (
"github.com/0xPolygonHermez/zkevm-node/pool"
"github.com/0xPolygonHermez/zkevm-node/pool/pgpoolstorage"
"github.com/0xPolygonHermez/zkevm-node/sequencer"
"github.com/0xPolygonHermez/zkevm-node/sequencer/broadcast"
"github.com/0xPolygonHermez/zkevm-node/sequencer/broadcast/pb"
"github.com/0xPolygonHermez/zkevm-node/state"
"github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
"github.com/0xPolygonHermez/zkevm-node/synchronizer"
"github.com/ethereum/go-ethereum/common"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/urfave/cli/v2"
"google.golang.org/grpc"
)

const (
Expand Down Expand Up @@ -188,14 +185,6 @@ func start(cliCtx *cli.Context) error {
}
poolInstance := createPool(c.Pool, c.NetworkConfig.L2BridgeAddr, l2ChainID, st, eventLog)
go runSynchronizer(*c, etherman, etm, st, poolInstance)
case BROADCAST:
ev.Component = event.Component_Broadcast
ev.Description = "Running broadcast service"
err := eventLog.LogEvent(ctx, ev)
if err != nil {
log.Fatal(err)
}
go runBroadcastServer(c.BroadcastServer, st)
case ETHTXMANAGER:
ev.Component = event.Component_EthTxManager
ev.Description = "Running eth tx manager service"
Expand Down Expand Up @@ -332,15 +321,6 @@ func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.
}
}

func runBroadcastServer(c broadcast.ServerConfig, st *state.State) {
s := grpc.NewServer()

broadcastSrv := broadcast.NewServer(&c, st)
pb.RegisterBroadcastServiceServer(s, broadcastSrv)

broadcastSrv.Start()
}

// runL2GasPriceSuggester init gas price gasPriceEstimator based on type in config.
func runL2GasPriceSuggester(cfg gasprice.Config, state *state.State, pool *pool.Pool, etherman *etherman.Client) {
ctx := context.Background()
Expand Down
2 changes: 0 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/0xPolygonHermez/zkevm-node/pool"
"github.com/0xPolygonHermez/zkevm-node/pricegetter"
"github.com/0xPolygonHermez/zkevm-node/sequencer"
"github.com/0xPolygonHermez/zkevm-node/sequencer/broadcast"
"github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
"github.com/0xPolygonHermez/zkevm-node/synchronizer"
"github.com/mitchellh/mapstructure"
Expand Down Expand Up @@ -64,7 +63,6 @@ type Config struct {
NetworkConfig NetworkConfig
L2GasPriceSuggester gasprice.Config
Executor executor.Config
BroadcastServer broadcast.ServerConfig
MTClient merkletree.Config
StateDB db.Config
Metrics metrics.Config
Expand Down
12 changes: 0 additions & 12 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,6 @@ func Test_Defaults(t *testing.T) {
path: "RPC.MaxRequestsPerIPAndSecond",
expectedValue: float64(50),
},
{
path: "RPC.BroadcastURI",
expectedValue: "127.0.0.1:61090",
},
{
path: "RPC.DefaultSenderAddress",
expectedValue: "0x1111111111111111111111111111111111111111",
Expand All @@ -347,14 +343,6 @@ func Test_Defaults(t *testing.T) {
path: "Executor.URI",
expectedValue: "127.0.0.1:50071",
},
{
path: "BroadcastServer.Host",
expectedValue: "0.0.0.0",
},
{
path: "BroadcastServer.Port",
expectedValue: 61090,
},
{
path: "Metrics.Host",
expectedValue: "0.0.0.0",
Expand Down
5 changes: 0 additions & 5 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ ReadTimeoutInSec = 60
WriteTimeoutInSec = 60
MaxRequestsPerIPAndSecond = 50
SequencerNodeURI = ""
BroadcastURI = "127.0.0.1:61090"
DefaultSenderAddress = "0x1111111111111111111111111111111111111111"
EnableL2SuggestedGasPricePolling = true
[RPC.WebSockets]
Expand Down Expand Up @@ -142,10 +141,6 @@ URI = "127.0.0.1:50061"
[Executor]
URI = "127.0.0.1:50071"
[BroadcastServer]
Host = "0.0.0.0"
Port = 61090
[Metrics]
Host = "0.0.0.0"
Port = 9091
Expand Down
5 changes: 0 additions & 5 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ ReadTimeoutInSec = 60
WriteTimeoutInSec = 60
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://internal.zkevm-test.net:2083/"
BroadcastURI = "internal.zkevm-test.net:61090"
DefaultSenderAddress = "0x1111111111111111111111111111111111111111"
EnableL2SuggestedGasPricePolling = true
[RPC.WebSockets]
Expand Down Expand Up @@ -134,10 +133,6 @@ URI = "zkevm-prover:50061"
[Executor]
URI = "zkevm-prover:50071"

[BroadcastServer]
Host = "0.0.0.0"
Port = 61090

[Metrics]
Host = "0.0.0.0"
Port = 9091
Expand Down
1 change: 0 additions & 1 deletion config/environments/mainnet/public.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ ReadTimeoutInSec = 60
WriteTimeoutInSec = 60
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://zkevm-rpc.com"
BroadcastURI = "broadcast.zkevm-rpc.com:61090"
DefaultSenderAddress = "0x1111111111111111111111111111111111111111"
EnableL2SuggestedGasPricePolling = false
[RPC.WebSockets]
Expand Down
1 change: 0 additions & 1 deletion config/environments/public/public.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ ReadTimeoutInSec = 60
WriteTimeoutInSec = 60
MaxRequestsPerIPAndSecond = 5000
SequencerNodeURI = "https://rpc.public.zkevm-test.net/"
BroadcastURI = "public-grpc.zkevm-test.net:61090"
DefaultSenderAddress = "0x1111111111111111111111111111111111111111"
EnableL2SuggestedGasPricePolling = false
[RPC.WebSockets]
Expand Down
1 change: 0 additions & 1 deletion docs/components/rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ The container alone needs some parameters configured, access to certain configur
- `ZKEVM_NODE_STATEDB_HOST`: Name of StateDB Database Host
- `ZKEVM_NODE_POOL_HOST`: Name of PoolDB Database Host
- `ZKEVM_NODE_RPC_DB_HOST`: Name of RPCDB Database Host
- `ZKEVM_NODE_RPC_BROADCASTURI`: String to return when a client requests the following resource: `zkevm_getBroadcastURI`
- volumes:
- `your config.toml file`: /app/config.toml
- `your genesis file`: /app/genesis.json
1 change: 0 additions & 1 deletion docs/json-rpc-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ If the endpoint is not in the list below, it means this specific endpoint is not
- `zkevm_batchNumberByBlockNumber`
- `zkevm_consolidatedBlockNumber`
- `zkevm_getBatchByNumber`
- `zkevm_getBroadcastURI` _* deprecated, will be removed in the future_
- `zkevm_isBlockConsolidated`
- `zkevm_isBlockVirtualized`
- `zkevm_verifiedBatchNumber`
Expand Down
1 change: 0 additions & 1 deletion docs/modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Use the default [public config file](https://github.com/0xPolygonHermez/zkevm-no
[RPC]
...
SequencerNodeURI = "https://public.zkevm-test.net:2083"
BroadcastURI = "public-grpc.zkevm-test.net:61090"
```

Same goes for the Prover Config ([prover-config.json](https://github.com/0xPolygonHermez/zkevm-node/blob/develop/config/environments/public/public.prover.config.json)):
Expand Down
6 changes: 3 additions & 3 deletions docs/networks.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zkEVM testnet networks

| Network Name | ChainID | RPC URL | Explorer | Bridge Info | Broadcast RPC URI |
|--------------|---------|---------|----------|------------------|-----|
| Public Testnet | `1402` | https://rpc.public.zkevm-test.net | https://explorer.public.zkevm-test.net | https://public.zkevm-test.net/ | `public-grpc.zkevm-test.net:61090`
| Network Name | ChainID | RPC URL | Explorer | Bridge Info |
|--------------|---------|---------|----------|------------------|
| Public Testnet | `1402` | https://rpc.public.zkevm-test.net | https://explorer.public.zkevm-test.net | https://public.zkevm-test.net/
3 changes: 0 additions & 3 deletions jsonrpc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ type Config struct {
// to relay transactions to the Sequencer node
SequencerNodeURI string `mapstructure:"SequencerNodeURI"`

// BroadcastURI is the URL of the Trusted State broadcast service
BroadcastURI string `mapstructure:"BroadcastURI"`

// DefaultSenderAddress is the address that jRPC will use
// to communicate with the state for eth_EstimateGas and eth_Call when
// the From field is not specified because it is optional
Expand Down
6 changes: 0 additions & 6 deletions jsonrpc/endpoints_zkevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,3 @@ func (z *ZKEVMEndpoints) GetBatchByNumber(batchNumber types.BatchNumber, fullTx
return rpcBatch, nil
})
}

// GetBroadcastURI returns the IP:PORT of the broadcast service provided
// by the Trusted Sequencer JSON RPC server
func (z *ZKEVMEndpoints) GetBroadcastURI() (interface{}, types.Error) {
return z.config.BroadcastURI, nil
}
23 changes: 0 additions & 23 deletions jsonrpc/endpoints_zkevm.openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,29 +82,6 @@
}
]
},
{
"name": "zkevm_getBroadcastURI",
"summary": "Returns the configured Broadcast URL of the Trusted Sequencer.",
"params": [],
"result": {
"name": "result",
"schema": {
"type": "string"
}
},
"examples": [
{
"name": "example",
"description": "",
"params": [],
"result": {
"name": "exampleResult",
"description": "",
"value": "https://broadcast:1111"
}
}
]
},
{
"name": "zkevm_batchNumber",
"summary": "Returns the latest batch number.",
Expand Down
40 changes: 0 additions & 40 deletions proto/src/proto/broadcast/v1/broadcast.proto

This file was deleted.

31 changes: 0 additions & 31 deletions sequencer/broadcast/client.go

This file was deleted.

7 changes: 0 additions & 7 deletions sequencer/broadcast/config.go

This file was deleted.

18 changes: 0 additions & 18 deletions sequencer/broadcast/interfaces.go

This file was deleted.

Loading

0 comments on commit 0949fa2

Please sign in to comment.