Skip to content

Commit

Permalink
refactor: rename roller to prover (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmountaintop authored Jul 28, 2023
1 parent e780994 commit 20e1344
Show file tree
Hide file tree
Showing 71 changed files with 897 additions and 965 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/roller.yml → .github/workflows/prover.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Roller
name: Prover

on:
push:
Expand All @@ -8,21 +8,21 @@ on:
- develop
- alpha
paths:
- 'roller/**'
- '.github/workflows/roller.yml'
- 'prover/**'
- '.github/workflows/prover.yml'
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths:
- 'roller/**'
- '.github/workflows/roller.yml'
- 'prover/**'
- '.github/workflows/prover.yml'

defaults:
run:
working-directory: 'roller'
working-directory: 'prover'

jobs:
test:
Expand All @@ -43,7 +43,7 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: roller
flags: prover
compile:
if: github.event_name == 'push' # will only be triggered when pushing to main & staging & develop & alpha
runs-on: ubuntu-latest
Expand All @@ -65,7 +65,7 @@ jobs:
workspaces: "common/libzkp/impl -> target"
- name: Test
run: |
make roller
make prover
check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
Expand All @@ -92,7 +92,7 @@ jobs:
uses: actions/checkout@v2
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports
- run: goimports -local scroll-tech/roller/ -w .
- run: goimports -local scroll-tech/prover/ -w .
- run: go mod tidy
# If there are any diffs from goimports or go mod tidy, fail.
- name: Verify no changes from goimports and go mod tidy
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lint: ## The code's format and security checks.
make -C common lint
make -C coordinator lint
make -C database lint
make -C roller lint
make -C prover lint
make -C bridge-history-api lint

update: ## update dependencies
Expand All @@ -20,13 +20,13 @@ update: ## update dependencies
cd $(PWD)/common/ && go get -u github.com/scroll-tech/[email protected] && go mod tidy
cd $(PWD)/coordinator/ && go get -u github.com/scroll-tech/[email protected] && go mod tidy
cd $(PWD)/database/ && go get -u github.com/scroll-tech/[email protected] && go mod tidy
cd $(PWD)/roller/ && go get -u github.com/scroll-tech/[email protected] && go mod tidy
cd $(PWD)/prover/ && go get -u github.com/scroll-tech/[email protected] && go mod tidy
goimports -local $(PWD)/bridge/ -w .
goimports -local $(PWD)/bridge-history-api/ -w .
goimports -local $(PWD)/common/ -w .
goimports -local $(PWD)/coordinator/ -w .
goimports -local $(PWD)/database/ -w .
goimports -local $(PWD)/roller/ -w .
goimports -local $(PWD)/prover/ -w .

dev_docker: ## build docker images for development/testing usages
docker build -t scroll_l1geth ./common/docker/l1geth/
Expand Down
2 changes: 1 addition & 1 deletion bridge/internal/config/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (r *RelayerConfig) UnmarshalJSON(input []byte) error {
for _, privStr := range jsonConfig.RollupSenderPrivateKeys {
priv, err := crypto.ToECDSA(common.FromHex(privStr))
if err != nil {
return fmt.Errorf("incorrect roller_private_key format, err: %v", err)
return fmt.Errorf("incorrect prover_private_key format, err: %v", err)
}
r.RollupSenderPrivateKeys = append(r.RollupSenderPrivateKeys, priv)
}
Expand Down
2 changes: 1 addition & 1 deletion bridge/internal/controller/relayer/l2_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func (r *Layer2Relayer) ProcessCommittedBatches() {
// The proof for this block is not ready yet.
return
case types.ProvingTaskProved:
// It's an intermediate state. The roller manager received the proof but has not verified
// It's an intermediate state. The prover manager received the proof but has not verified
// the proof yet. We don't roll up the proof until it's verified.
return
case types.ProvingTaskVerified:
Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/coordinator.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ COPY ./common/go.* ./common/
COPY ./coordinator/go.* ./coordinator/
COPY ./database/go.* ./database/
COPY ./prover-stats-api/go.* ./prover-stats-api/
COPY ./roller/go.* ./roller/
COPY ./prover/go.* ./prover/
COPY ./tests/integration-test/go.* ./tests/integration-test/
COPY ./bridge-history-api/go.* ./bridge-history-api/
RUN go mod download -x
Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/db_cli.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY ./common/go.* ./common/
COPY ./coordinator/go.* ./coordinator/
COPY ./database/go.* ./database/
COPY ./prover-stats-api/go.* ./prover-stats-api/
COPY ./roller/go.* ./roller/
COPY ./prover/go.* ./prover/
COPY ./tests/integration-test/go.* ./tests/integration-test/
COPY ./bridge-history-api/go.* ./bridge-history-api/
RUN go mod download -x
Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/event_watcher.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY ./common/go.* ./common/
COPY ./coordinator/go.* ./coordinator/
COPY ./database/go.* ./database/
COPY ./prover-stats-api/go.* ./prover-stats-api/
COPY ./roller/go.* ./roller/
COPY ./prover/go.* ./prover/
COPY ./tests/integration-test/go.* ./tests/integration-test/
COPY ./bridge-history-api/go.* ./bridge-history-api/
RUN go mod download -x
Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/gas_oracle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY ./common/go.* ./common/
COPY ./coordinator/go.* ./coordinator/
COPY ./database/go.* ./database/
COPY ./prover-stats-api/go.* ./prover-stats-api/
COPY ./roller/go.* ./roller/
COPY ./prover/go.* ./prover/
COPY ./tests/integration-test/go.* ./tests/integration-test/
COPY ./bridge-history-api/go.* ./bridge-history-api/
RUN go mod download -x
Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/msg_relayer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY ./common/go.* ./common/
COPY ./coordinator/go.* ./coordinator/
COPY ./database/go.* ./database/
COPY ./prover-stats-api/go.* ./prover-stats-api/
COPY ./roller/go.* ./roller/
COPY ./prover/go.* ./prover/
COPY ./tests/integration-test/go.* ./tests/integration-test/
COPY ./bridge-history-api/go.* ./bridge-history-api/
RUN go mod download -x
Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/rollup_relayer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY ./common/go.* ./common/
COPY ./coordinator/go.* ./coordinator/
COPY ./database/go.* ./database/
COPY ./prover-stats-api/go.* ./prover-stats-api/
COPY ./roller/go.* ./roller/
COPY ./prover/go.* ./prover/
COPY ./tests/integration-test/go.* ./tests/integration-test/
COPY ./bridge-history-api/go.* ./bridge-history-api/
RUN go mod download -x
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ flag_management:
- type: project
target: auto
threshold: 1%
- name: roller
- name: prover
statuses:
- type: project
target: auto
Expand Down
36 changes: 18 additions & 18 deletions common/types/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,28 @@ const (
MsgRelayFailed
)

// RollerProveStatus is the roller prove status of a block batch (session)
type RollerProveStatus int32
// ProverProveStatus is the prover prove status of a block batch (session)
type ProverProveStatus int32

const (
// RollerProveStatusUndefined indicates an unknown roller proving status
RollerProveStatusUndefined RollerProveStatus = iota
// RollerAssigned indicates roller assigned but has not submitted proof
RollerAssigned
// RollerProofValid indicates roller has submitted valid proof
RollerProofValid
// RollerProofInvalid indicates roller has submitted invalid proof
RollerProofInvalid
// ProverProveStatusUndefined indicates an unknown prover proving status
ProverProveStatusUndefined ProverProveStatus = iota
// ProverAssigned indicates prover assigned but has not submitted proof
ProverAssigned
// ProverProofValid indicates prover has submitted valid proof
ProverProofValid
// ProverProofInvalid indicates prover has submitted invalid proof
ProverProofInvalid
)

func (s RollerProveStatus) String() string {
func (s ProverProveStatus) String() string {
switch s {
case RollerAssigned:
return "RollerAssigned"
case RollerProofValid:
return "RollerProofValid"
case RollerProofInvalid:
return "RollerProofInvalid"
case ProverAssigned:
return "ProverAssigned"
case ProverProofValid:
return "ProverProofValid"
case ProverProofInvalid:
return "ProverProofInvalid"
default:
return fmt.Sprintf("Bad Value: %d", int32(s))
}
Expand All @@ -99,7 +99,7 @@ func (s RollerProveStatus) String() string {
type ProverTaskFailureType int

const (
// ProverTaskFailureTypeUndefined indicates an unknown roller failure type
// ProverTaskFailureTypeUndefined indicates an unknown prover failure type
ProverTaskFailureTypeUndefined ProverTaskFailureType = iota
// ProverTaskFailureTypeTimeout prover task failure of timeout
ProverTaskFailureTypeTimeout
Expand Down
24 changes: 12 additions & 12 deletions common/types/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ import (
"github.com/stretchr/testify/assert"
)

func TestRollerProveStatus(t *testing.T) {
func TestProverProveStatus(t *testing.T) {
tests := []struct {
name string
s RollerProveStatus
s ProverProveStatus
want string
}{
{
"RollerAssigned",
RollerAssigned,
"RollerAssigned",
"ProverAssigned",
ProverAssigned,
"ProverAssigned",
},
{
"RollerProofValid",
RollerProofValid,
"RollerProofValid",
"ProverProofValid",
ProverProofValid,
"ProverProofValid",
},
{
"RollerProofInvalid",
RollerProofInvalid,
"RollerProofInvalid",
"ProverProofInvalid",
ProverProofInvalid,
"ProverProofInvalid",
},
{
"Bad Value",
RollerProveStatus(999), // Invalid value.
ProverProveStatus(999), // Invalid value.
"Bad Value: 999",
},
}
Expand Down
30 changes: 15 additions & 15 deletions common/types/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/scroll-tech/go-ethereum/rlp"
)

// RespStatus represents status code from roller to scroll
// RespStatus represents status code from prover to scroll
type RespStatus uint32

const (
Expand All @@ -23,7 +23,7 @@ const (
StatusProofError
)

// ProofType represents the type of roller.
// ProofType represents the type of prover.
type ProofType uint8

func (r ProofType) String() string {
Expand All @@ -40,28 +40,28 @@ func (r ProofType) String() string {
const (
// ProofTypeUndefined is an unknown proof type
ProofTypeUndefined ProofType = iota
// ProofTypeChunk is default roller, it only generates zk proof from traces.
// ProofTypeChunk is default prover, it only generates zk proof from traces.
ProofTypeChunk
// ProofTypeBatch generates zk proof from other zk proofs and aggregate them into one proof.
ProofTypeBatch
)

// AuthMsg is the first message exchanged from the Roller to the Sequencer.
// It effectively acts as a registration, and makes the Roller identification
// AuthMsg is the first message exchanged from the Prover to the Sequencer.
// It effectively acts as a registration, and makes the Prover identification
// known to the Sequencer.
type AuthMsg struct {
// Message fields
Identity *Identity `json:"message"`
// Roller signature
// Prover signature
Signature string `json:"signature"`
}

// Identity contains all the fields to be signed by the roller.
// Identity contains all the fields to be signed by the prover.
type Identity struct {
// Roller name
// Prover name
Name string `json:"name"`
// Roller RollerType
RollerType ProofType `json:"roller_type,omitempty"`
// Prover ProverType
ProverType ProofType `json:"prover_type,omitempty"`
// Version is common.Version+ZkVersion. Use the following to check the latest ZkVersion version.
// curl -sL https://api.github.com/repos/scroll-tech/scroll-prover/commits | jq -r ".[0].sha"
Version string `json:"version"`
Expand Down Expand Up @@ -140,10 +140,10 @@ func (i *Identity) Hash() ([]byte, error) {
// ProofMsg is the data structure sent to the coordinator.
type ProofMsg struct {
*ProofDetail `json:"zkProof"`
// Roller signature
// Prover signature
Signature string `json:"signature"`

// Roller public key
// Prover public key
publicKey string
}

Expand Down Expand Up @@ -204,13 +204,13 @@ func (a *ProofMsg) PublicKey() (string, error) {
type TaskMsg struct {
ID string `json:"id"`
Type ProofType `json:"type,omitempty"`
// For decentralization, basic rollers will get block hashes from the coordinator. So that they can refer to the block hashes and fetch traces locally. Only applicable for basic rollers.
// For decentralization, basic provers will get block hashes from the coordinator. So that they can refer to the block hashes and fetch traces locally. Only applicable for basic provers.
BlockHashes []common.Hash `json:"block_hashes,omitempty"`
// Only applicable for aggregator rollers.
// Only applicable for aggregator provers.
SubProofs []*AggProof `json:"sub_proofs,omitempty"`
}

// ProofDetail is the message received from rollers that contains zk proof, the status of
// ProofDetail is the message received from provers that contains zk proof, the status of
// the proof generation succeeded, and an error message if proof generation failed.
type ProofDetail struct {
ID string `json:"id"`
Expand Down
2 changes: 1 addition & 1 deletion common/types/message/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestGenerateToken(t *testing.T) {
func TestIdentityHash(t *testing.T) {
identity := &Identity{
Name: "testName",
RollerType: ProofTypeChunk,
ProverType: ProofTypeChunk,
Version: "testVersion",
Token: "testToken",
}
Expand Down
4 changes: 2 additions & 2 deletions common/utils/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ var (
CoordinatorApp MockAppName = "coordinator-test"
// DBCliApp the name of mock database app.
DBCliApp MockAppName = "db_cli-test"
// RollerApp the name of mock roller app.
RollerApp MockAppName = "roller-test"
// ProverApp the name of mock prover app.
ProverApp MockAppName = "prover-test"
)

// RegisterSimulation register initializer function for integration-test.
Expand Down
4 changes: 2 additions & 2 deletions common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.0.31"
var tag = "v4.0.32"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand All @@ -25,5 +25,5 @@ var commit = func() string {
// ZkVersion is commit-id of common/libzkp/impl/cargo.lock/scroll-prover
var ZkVersion string

// Version denote the version of scroll protocol, including the l2geth, relayer, coordinator, roller, contracts and etc.
// Version denote the version of scroll protocol, including the l2geth, relayer, coordinator, prover, contracts and etc.
var Version = fmt.Sprintf("%s-%s-%s", tag, commit, ZkVersion)
2 changes: 1 addition & 1 deletion contracts/docs/CrossDomainMessaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The execution in layer 2 may be failed due to out of gas problem. In such case,

### Send Message from L2 to L1

Similar to sending message from L1 to L2, you should call `L2ScrollMessenger.sendMessage` first in layer 2. The `L2ScrollMessenger` contract will emit a `SentMessage` event, which will be notified by the Sequencer. Unlike above, the Sequencer will first batch submit layer 2 transactions (or block) to `ZKRollup` contract in layer 1. Then the Sequencer will wait the proof generated by roller and submit the proof to `ZKRollup` contract in layer 1 again. Finally, anyone can call `L1ScrollMessenger.relayMessageWithProof` with correct proof to execute the message in layer 1.
Similar to sending message from L1 to L2, you should call `L2ScrollMessenger.sendMessage` first in layer 2. The `L2ScrollMessenger` contract will emit a `SentMessage` event, which will be notified by the Sequencer. Unlike above, the Sequencer will first batch submit layer 2 transactions (or block) to `ZKRollup` contract in layer 1. Then the Sequencer will wait the proof generated by prover and submit the proof to `ZKRollup` contract in layer 1 again. Finally, anyone can call `L1ScrollMessenger.relayMessageWithProof` with correct proof to execute the message in layer 1.

Currently, for the safety reason, we only allow privileged contracts to send cross domain messages. And only privileged accounts can call `L2ScrollMessenger.relayMessage`.

Expand Down
Loading

0 comments on commit 20e1344

Please sign in to comment.