Skip to content

Commit

Permalink
Fix/ds app (#144)
Browse files Browse the repository at this point in the history
* WIP

* dsTool working again

* linter

* fix batchL2Data

* avoid fatal if dump finish fine
  • Loading branch information
ARR552 authored Sep 19, 2024
1 parent 2cd1625 commit 80fd1fa
Show file tree
Hide file tree
Showing 11 changed files with 1,780 additions and 192 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- name: Checkout code
uses: actions/checkout@v3
- name: Lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
test:
strategy:
matrix:
go-version: [ 1.19.x ]
go-version: [ 1.21.x ]
goarch: [ "amd64" ]
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ linters:
- godox # Godox is a linter for TODOs and FIXMEs left in the code

linters-settings:
dupl:
threshold: 300
revive:
rules:
- name: exported
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ help: ## Prints this help
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'


generate-code-from-proto: ## Generates code from proto files
cd proto/datastream/v1 && protoc --proto_path=. --proto_path=../../include --go_out=../../../datastream --go-grpc_out=../../../datastream --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative datastream.proto
118 changes: 78 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,43 +294,81 @@ Sequencer data stream service to stream L2 blocks and L2 txs

List of events (entry types):

### Start L2 Block
- Entry type = 1
- Entry data:
>u64 batchNum
>u64 blockL2Num
>u64 timestamp
>u32 deltaTimestamp
>u32 L1InfoTreeIndex
>u8[32] l1BlockHash
>u8[32] globalExitRoot
>u8[20] coinbase
>u16 forkID
>u32 chainID
### L2 TX
- Entry type = 2
- Entry data:
>u8 gasPricePercentage
>u8 isValid // Intrinsic
>u8[32] stateRoot
>u32 encodedTXLength
>u8[] encodedTX
### End L2 Block
- Entry type = 3
- Entry data:
>u64 blockL2Num
>u8[32] l2BlockHash
>u8[32] stateRoot
### Update GER
- Entry type = 4
- Entry data:
>u64 batchNum
>u64 timestamp
>u8[32] globalExitRoot
>u8[20] coinbase
>u16 forkID
>u32 chainID
>u8[32] stateRoot
### BatchStart:
uint64 number
BatchType type
uint64 fork_id
uint64 chain_id
Debug debug

### BatchEnd:
uint64 number
bytes local_exit_root
bytes state_root
Debug debug

### L2Block:
uint64 number
uint64 batch_number
uint64 timestamp
uint32 delta_timestamp
uint64 min_timestamp
bytes l1_blockhash
uint32 l1_infotree_index
bytes hash
bytes state_root
bytes global_exit_root
bytes coinbase
uint64 block_gas_limit
bytes block_info_root
Debug debug

### L2BlockEnd:
uint64 number

### Transaction:
uint64 l2block_number
uint64 index
bool is_valid
bytes encoded
uint32 effective_gas_price_percentage
bytes im_state_root
Debug debug

### UpdateGER:
uint64 batch_number
uint64 timestamp
bytes global_exit_root
bytes coinbase
uint64 fork_id
uint64 chain_id
bytes state_root
Debug debug

### BookMark:
BookmarkType type
uint64 value

### Debug:
string message

### BookmarkType:
BOOKMARK_TYPE_UNSPECIFIED = 0;
BOOKMARK_TYPE_BATCH = 1;
BOOKMARK_TYPE_L2_BLOCK = 2;

### EntryType:
ENTRY_TYPE_UNSPECIFIED = 0;
ENTRY_TYPE_BATCH_START = 1;
ENTRY_TYPE_L2_BLOCK = 2;
ENTRY_TYPE_TRANSACTION = 3;
ENTRY_TYPE_BATCH_END = 4;
ENTRY_TYPE_UPDATE_GER = 5;
ENTRY_TYPE_L2_BLOCK_END = 6;

### BatchType:
BATCH_TYPE_UNSPECIFIED = 0;
BATCH_TYPE_REGULAR = 1;
BATCH_TYPE_FORCED = 2;
BATCH_TYPE_INJECTED = 3;
BATCH_TYPE_INVALID = 4;
521 changes: 381 additions & 140 deletions cmd/main.go

Large diffs are not rendered by default.

Loading

0 comments on commit 80fd1fa

Please sign in to comment.