generated from rollkit/template-da-repo
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initial interface definitions and generator code
- Loading branch information
1 parent
d120328
commit 63ea304
Showing
8 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# go-sequencing | ||
|
||
go-sequencing defines a generic sequencing interface for modular blockchains | ||
|
||
## Sequencing Interface | ||
|
||
## Implementations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: v1beta1 | ||
|
||
# The plugins to run. | ||
plugins: | ||
# The name of the plugin. | ||
- name: gogofaster | ||
# The the relative output directory. | ||
out: types/pb | ||
# Any options to provide to the plugin. | ||
opt: plugins=grpc,paths=source_relative | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: v1beta1 | ||
|
||
build: | ||
roots: | ||
- proto | ||
- third_party/proto | ||
lint: | ||
use: | ||
- DEFAULT | ||
- COMMENTS | ||
- FILE_LOWER_SNAKE_CASE | ||
except: | ||
- COMMENT_ENUM | ||
- COMMENT_ENUM_VALUE | ||
- COMMENT_MESSAGE | ||
- COMMENT_RPC | ||
- COMMENT_SERVICE | ||
- COMMENT_FIELD | ||
- PACKAGE_VERSION_SUFFIX | ||
- RPC_REQUEST_STANDARD_NAME | ||
- SERVICE_SUFFIX | ||
- UNARY_RPC | ||
ignore: | ||
- tendermint | ||
breaking: | ||
use: | ||
- FILE | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module github.com/rollkit/template-da-repo | ||
module github.com/rollkit/go-sequencing | ||
|
||
go 1.21.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
# see: https://stackoverflow.com/a/246128 | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"/.. | ||
TARGET_DIR=./types/pb | ||
|
||
cd $SCRIPT_DIR | ||
mkdir -p $TARGET_DIR | ||
rm -rf $TARGET_DIR/* | ||
docker run -u $UID:$(id -g) -e XDG_CACHE_HOME=/tmp/.cache -v $PWD:/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./proto/protoc.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
buf generate --path="./proto/sequencing" --template="buf.gen.yaml" --config="buf.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
syntax = "proto3"; | ||
package rollkit; | ||
|
||
// SequencerInput ... | ||
service SequencerInput { | ||
// SubmitRollupTransaction ... | ||
rpc SubmitRollupTransaction(SubmitRollupTransactionRequest) returns (SubmitRollupTransactionResponse) {} | ||
} | ||
|
||
// SubmitRollupTransactionRequest ... | ||
message SubmitRollupTransactionRequest { | ||
// the unhashed rollup id | ||
bytes rollup_id = 1; | ||
// the raw data bytes of the rollup transaction | ||
bytes data = 2; | ||
} | ||
|
||
// SubmitRollupTransactionResponse ... | ||
message SubmitRollupTransactionResponse { | ||
} | ||
|
||
// SequencerOutput ... | ||
service SequencerOutput { | ||
// SubmitRollupTransaction ... | ||
rpc GetNextBatch(BatchRequest) returns (BatchResponse) {} | ||
} | ||
|
||
// BatchRequest provides the last batch while requesting for the next batch | ||
message BatchRequest { | ||
repeated bytes transactions = 1; | ||
} | ||
|
||
// BatchResponse contains the transaction batch that is last sequenced | ||
message BatchResponse { | ||
repeated bytes transactions = 1; | ||
} | ||
|
||
// BatchVerifier | ||
service BatchVerifier { | ||
// VerifyBatch ... | ||
rpc VerifyBatch(BatchRequest) returns VerificationResponse {} | ||
} | ||
|
||
// VerificationResponse | ||
message VerificationResponse { | ||
bool success = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package sequencing | ||
|
||
// SequencerInput provides a method for submitting a transaction from rollup to sequencer | ||
type SequencerInput interface { | ||
// SubmitRollupTransaction submits a transaction from rollup to sequencer | ||
SubmitRollupTransaction(rollupId RollupId, tx Tx) error | ||
} | ||
|
||
// SequencerOutput provides a method for getting the next batch of transactions from sequencer to rollup | ||
type SequencerOutput interface { | ||
// GetNextBatch returns the next batch of transactions from sequencer to rollup | ||
// lastBatch is the last batch of transactions received from the sequencer | ||
// returns the next batch of transactions and an error if any from the sequencer | ||
GetNextBatch(lastBatch []Tx) ([]Tx, error) | ||
} | ||
|
||
// BatchVerifier provides a method for verifying a batch of transactions received from the sequencer | ||
type BatchVerifier interface { | ||
// VerifyBatch verifies a batch of transactions received from the sequencer | ||
VerifyBatch(batch []Tx) (bool, error) | ||
} | ||
|
||
// RollupId is a unique identifier for a rollup chain | ||
type RollupId = []byte | ||
|
||
// Tx is a rollup transaction | ||
type Tx = []byte |