Skip to content

Commit

Permalink
Update smc (0xPolygonHermez#1360)
Browse files Browse the repository at this point in the history
* update contracts

* etherman updated

* synchronizer

* Synchronizer with AddSequence

* aggregator and txmanager working

* smc latest version

* linter

* genesis + test fixed

* Extra check

* Update/executor proto (0xPolygonHermez#1384)

* Adapt to newest executor proto

* Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (0xPolygonHermez#1369)

Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](spf13/viper@v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github.com/ethereum/go-ethereum from 1.10.25 to 1.10.26 (0xPolygonHermez#1368)

Bumps [github.com/ethereum/go-ethereum](https://github.com/ethereum/go-ethereum) from 1.10.25 to 1.10.26.
- [Release notes](https://github.com/ethereum/go-ethereum/releases)
- [Commits](ethereum/go-ethereum@v1.10.25...v1.10.26)

---
updated-dependencies:
- dependency-name: github.com/ethereum/go-ethereum
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* WIP

* WIP

* rever prover proto

* Add acc_input_hash

* linter

* linter

* Use new executor image

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* linter

* Disable prover

* Update/executor proto (0xPolygonHermez#1403)

* Adapt to newest executor proto

* WIP

* WIP

* rever prover proto

* Add acc_input_hash

* linter

* linter

* Use new executor image

* update files

* db test

* linter

* names modification

* fixes

* Feature/latest smc (0xPolygonHermez#1412)

* latest smc

* Code addapted

* update smc

* linter

* extra events

* fix tests

* update broadcast proto

* sequencer fix due to trusted reorg

* Lastes smc version

* linter

* genesis

* fix: update SCs addresses in config

Signed-off-by: Paolo Grisoli <[email protected]>

* check verified state root + genesis

* fix state root check when proofs are aggregated

* Recursive Aggregator (0xPolygonHermez#1419)

* New recursive aggregator2

* fix: update sequences table name

* fix: handle errors properly

* replace "sequence_group" table for "sequences". Set OldAccInputHash in buildInputProver function

* feat: replace the old aggregator with the new one

This commit wires the new aggregator in place of the old one.
Everithing related to the old aggregato has been wiped out.

* fix: wait to be synced after sending final proof

This commit fixes a bug that was causing the aggregato to start
generating a duplicated proof.
The problem was that after sending the final proof to L1, the aggregator
was not waiting for it to be seen by the synchronizer. Instead it was
checking immediately for batches to prove. Since the synchronizer didn't
update the verified batches yet, the aggregator was picking up again the
first virtual batch which followed the previous verified batch.
This commit adds a signal emitted after a final proof is sent. The next
aggregator iteration will get the signal and wait for the synchronizer
to sync.

Signed-off-by: Paolo Grisoli <[email protected]>

* Added EthTxManager.VerifyBatches. Use this instead of Rthman.VerifyBatches

* fix: send final proof in a separate goroutine

This commit moves the logic to send the final proof in its own
goroutine. This allows to immediately free the prover and at the same
time way for the synchronizer to catch up. The `recursive_proof` table
is now cleared only after the network is up to date.

* fix: clear proofs cache if no final proof ready

This commit makes the proofs cache to be cleared when a final proof is
not ready. This avoids the cache to grow up until a final proof is sent.

* fix: rebasing dust

* feat: use etherman addresses in batchsender script

* fix: don't fill block twice in verifyBatchesEvent

This commit fixes a problem in etherman that was causing the
synchronizer to crash on a VerifyBatches event.
Credits to @ARR552 for the fix

* chore: update prover image in test/docker-compose

* fix: linter and simplify prover interface

This commit addresses linter complaints and simplifies the prover
interface by unwrapping proof responses types.

* fix: remove unused parameter for prover clients

* chore: move table schema in 0001.sql

* fix: remove old proof table and rename the new one

* fix: fix some linter problems

* test: fix TestSequenceTooBig

* fix: remove old Provers config

* feat: better error handling in aggregator/prover

* test: fix executor tests using new prover image

* chore: add migration for state proof table

* style: return typed errors in aggregator/prover

* style: make prover field private

* initial implementation checkProofReadyToVerify

* style: timer mutex, fix duplication, logs/errcheck

This commit elaborates more the changes introduced to send a final proof
at a given point in time, without a proof in generating:
- Added a mutex to guard the timer to send the final proof.
- Removed some code duplication. In particular the two functions
  `checkVerifyProof` and `checkProofReadyToVerify` have been merged into
the `tryBuildFinalProof` function.
- Some logs were not correct, in particular the one informing about the
  last verified batch number was using the wrong value.
- Some errors were not checked like the one returned from
  `checkProofReadyToVerify` (now `tryBuildFinalProof`).
- Few variables renaming for better readability.

Signed-off-by: Paolo Grisoli <[email protected]>

* fix: update SCs addresses

* fix: add check on mocked LER and SR

This commit adds a check (similar to the one in the old aggregator) to
check if we are using a mocked prover. In this case the `NewStateRoot`
and `NewLocalExitRoot` values returned by the mock prover are not valid
and need to be replaced with the ones returned by the executor.

* fix:unlock underlying proofs if VerifyBatches err

This commit fixes the bug happening when an error is returned calling
`VerifyBatches`.
We were unlocking the wrong proof and the correct one/ones was/were
stuck in the `generating` status.

* fix: better fix for VerifyBatches error

This commit implements a better fix for the case an error is returned by
VerifyBatches. In case of a proof coming from an aggregation job, it
stores it, making it available for the other provers to be taken again.

* fix: update leftover SCs addresses

* Rename interval/time agggregator config parameters

* fix: adjust config files to new Aggregator names

* refac: store aggregated proof in any case

This commit changes the behavior when an aggregated proof is crafted.
Now the poof is always stored (and the two aggregated proofs deleted)
regardless if a final proof needs to be sent or not.

* refac: return string pointer for proof ID

This commit changes the returned type to be `*string` for the prover
functions that return the proof ID. Since the proof ID is stored as
`*string` inside the `state.Proof` struct, this change makes more
convenient to pass the pointer around and finally store it.

* style: use alias for ugly grpc health package name

* fix: replace bad Matic SC address

* test: fix TestSequenceTooBig

Signed-off-by: Paolo Grisoli <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: Alonso <[email protected]>

* fix merge

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Paolo Grisoli <[email protected]>
Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ToniRamirezM <[email protected]>
Co-authored-by: Paolo Grisoli <[email protected]>
Co-authored-by: agnusmor <[email protected]>
  • Loading branch information
6 people authored Dec 2, 2022
1 parent 88670a0 commit 0f72eb1
Show file tree
Hide file tree
Showing 92 changed files with 9,086 additions and 5,115 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ 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/zkprover/v1 && protoc --proto_path=. --go_out=../../../../../proverclient/pb --go-grpc_out=../../../../../proverclient/pb --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative zk_prover.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.
## Pulls comments from beside commands and prints a nicely formatted
Expand Down
Loading

0 comments on commit 0f72eb1

Please sign in to comment.