Skip to content

Commit

Permalink
wip: adding some implementation of the finalizer, defining needed int…
Browse files Browse the repository at this point in the history
…erfaces by the finalizer from the dbmanager, and implementing the remaining resourses Sub.

Signed-off-by: Nikolay Nedkov <[email protected]>
  • Loading branch information
Psykepro committed Dec 22, 2022
1 parent 3edbd8b commit b19bf97
Show file tree
Hide file tree
Showing 19 changed files with 791 additions and 428 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ install-git-hooks: ## Moves hook files to the .git/hooks directory
.PHONY: generate-code-from-proto
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/executor/v1 && protoc --proto_path=. --experimental_allow_proto3_optional --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

Expand Down
62 changes: 30 additions & 32 deletions aggregator/pb/aggregator.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions merkletree/pb/statedb.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 20 additions & 8 deletions pool/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ type Transaction struct {

// ZkCounters counters for the tx
type ZkCounters struct {
CumulativeGasUsed int64
UsedKeccakHashes int32
UsedPoseidonHashes int32
UsedPoseidonPaddings int32
UsedMemAligns int32
UsedArithmetics int32
UsedBinaries int32
UsedSteps int32
CumulativeGasUsed uint64
UsedKeccakHashes uint32
UsedPoseidonHashes uint32
UsedPoseidonPaddings uint32
UsedMemAligns uint32
UsedArithmetics uint32
UsedBinaries uint32
UsedSteps uint32
}

// IsZkCountersBelowZero checks if any of the counters are below zero
Expand All @@ -73,6 +73,18 @@ func (zkc *ZkCounters) SumUpZkCounters(txZkCounters ZkCounters) {
zkc.UsedSteps += txZkCounters.UsedSteps
}

// SubZkCounters subtract zk counters with passed zk counters (not safe)
func (zkc *ZkCounters) SubZkCounters(txZkCounters ZkCounters) {
zkc.CumulativeGasUsed -= txZkCounters.CumulativeGasUsed
zkc.UsedKeccakHashes -= txZkCounters.UsedKeccakHashes
zkc.UsedPoseidonHashes -= txZkCounters.UsedPoseidonHashes
zkc.UsedPoseidonPaddings -= txZkCounters.UsedPoseidonPaddings
zkc.UsedMemAligns -= txZkCounters.UsedMemAligns
zkc.UsedArithmetics -= txZkCounters.UsedArithmetics
zkc.UsedBinaries -= txZkCounters.UsedBinaries
zkc.UsedSteps -= txZkCounters.UsedSteps
}

// IsClaimTx checks, if tx is a claim tx
func (tx *Transaction) IsClaimTx(l2BridgeAddr common.Address) bool {
if tx.To() == nil {
Expand Down
Loading

0 comments on commit b19bf97

Please sign in to comment.