Compare commits

..

16 Commits

Author SHA1 Message Date
vincent
af942bef61 fix 2023-02-28 23:05:01 +08:00
vincent
2ed812322f with condition 2023-02-28 22:56:47 +08:00
vincent
1134eee175 finish 2023-02-28 22:45:04 +08:00
vincent
e4699d2a51 fix and trty 2023-02-28 22:32:57 +08:00
vincent
6ce5b6dad0 fix and fix 2023-02-28 22:23:26 +08:00
vincent
7732b0c3f8 test 1.4 2023-02-28 22:14:34 +08:00
vincent
c9c849a56e try and try 2023-02-28 22:03:26 +08:00
vincent
257bc88a87 make variable 2023-02-28 21:45:16 +08:00
vincent
04552240e3 try to fix 2023-02-28 21:35:07 +08:00
vincent
2aff8a1ad1 test 2023-02-28 21:24:51 +08:00
vincent
f75f4afb60 fix 2023-02-28 21:23:25 +08:00
vincent
f979964d04 fix 2023-02-28 21:11:50 +08:00
vincent
3507c419b4 fix 2023-02-28 21:00:19 +08:00
vincent
8d55e83239 fix 2023-02-28 20:50:44 +08:00
vincent
2d20ee639f fix 2023-02-28 20:42:26 +08:00
vincent
08bf938e19 test 2023-02-28 20:26:38 +08:00
8 changed files with 26 additions and 87 deletions

View File

@@ -24,7 +24,6 @@
"min_gas_price": 0,
"gas_price_diff": 50000
},
"finalize_batch_interval_sec": 0,
"message_sender_private_keys": [
"1212121212121212121212121212121212121212121212121212121212121212"
],
@@ -57,7 +56,6 @@
"min_gas_price": 0,
"gas_price_diff": 50000
},
"finalize_batch_interval_sec": 0,
"message_sender_private_keys": [
"1212121212121212121212121212121212121212121212121212121212121212"
],

View File

@@ -47,8 +47,6 @@ type RelayerConfig struct {
SenderConfig *SenderConfig `json:"sender_config"`
// gas oracle config
GasOracleConfig *GasOracleConfig `json:"gas_oracle_config"`
// The interval in which we send finalize batch transactions.
FinalizeBatchIntervalSec uint64 `json:"finalize_batch_interval_sec"`
// The private key of the relayer
MessageSenderPrivateKeys []*ecdsa.PrivateKey `json:"-"`
GasOracleSenderPrivateKeys []*ecdsa.PrivateKey `json:"-"`

View File

@@ -354,29 +354,22 @@ func (r *Layer2Relayer) ProcessCommittedBatches() {
}
// batches are sorted by batch index in increasing order
batchHashes, err := r.db.GetCommittedBatches(1)
batches, err := r.db.GetCommittedBatches(1)
if err != nil {
log.Error("Failed to fetch committed L2 batches", "err", err)
return
}
if len(batchHashes) == 0 {
if len(batches) == 0 {
return
}
hash := batchHashes[0]
hash := batches[0]
// @todo add support to relay multiple batches
batches, err := r.db.GetBlockBatches(map[string]interface{}{"hash": hash}, "LIMIT 1")
status, err := r.db.GetProvingStatusByHash(hash)
if err != nil {
log.Error("Failed to fetch committed L2 batch", "hash", hash, "err", err)
log.Error("GetProvingStatusByHash failed", "hash", hash, "err", err)
return
}
if len(batches) == 0 {
log.Error("Unexpected result for GetBlockBatches", "hash", hash, "len", 0)
return
}
batch := batches[0]
status := batch.ProvingStatus
switch status {
case types.ProvingTaskUnassigned, types.ProvingTaskAssigned:
@@ -399,34 +392,6 @@ func (r *Layer2Relayer) ProcessCommittedBatches() {
log.Info("Start to roll up zk proof", "hash", hash)
success := false
previousBatch, err := r.db.GetLatestFinalizingOrFinalizedBatch()
// skip submitting proof
if err == nil && uint64(batch.CreatedAt.Sub(*previousBatch.CreatedAt).Seconds()) < r.cfg.FinalizeBatchIntervalSec {
log.Info(
"Not enough time passed, skipping",
"hash", hash,
"createdAt", batch.CreatedAt,
"lastFinalizingHash", previousBatch.Hash,
"lastFinalizingStatus", previousBatch.RollupStatus,
"lastFinalizingCreatedAt", previousBatch.CreatedAt,
)
if err = r.db.UpdateRollupStatus(r.ctx, hash, types.RollupFinalizationSkipped); err != nil {
log.Warn("UpdateRollupStatus failed", "hash", hash, "err", err)
} else {
success = true
}
return
}
// handle unexpected db error
if err != nil && err.Error() != "sql: no rows in result set" {
log.Error("Failed to get latest finalized batch", "err", err)
return
}
defer func() {
// TODO: need to revisit this and have a more fine-grained error handling
if !success {

View File

@@ -43,36 +43,24 @@ pipeline {
}
sh "docker login --username=$dockerUser --password=$dockerPassword"
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
script {
try {
sh "docker manifest inspect scrolltech/bridge:$TAGNAME > /dev/null"
} catch (e) {
// only build if the tag non existed
//sh "docker login --username=${dockerUser} --password=${dockerPassword}"
sh "make -C bridge docker"
sh "docker tag scrolltech/bridge:latest scrolltech/bridge:${TAGNAME}"
sh "docker push scrolltech/bridge:${TAGNAME}"
throw e
}
}
sh "docker manifest inspect scrolltech/bridge:$TAGNAME > /dev/null"
}
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
script {
try {
sh "docker manifest inspect scrolltech/coordinator:$TAGNAME > /dev/null"
} catch (e) {
// only build if the tag non existed
//sh "docker login --username=${dockerUser} --password=${dockerPassword}"
sh "make -C coordinator docker"
sh "docker tag scrolltech/coordinator:latest scrolltech/coordinator:${TAGNAME}"
sh "docker push scrolltech/coordinator:${TAGNAME}"
throw e
}
}
def condition = sh(returnStdout: true, script: 'echo $?')
echo condition
// skip the building part if the tag already existed
if (condition == 0) {
return;
}
// sh "docker login --username=${dockerUser} --password=${dockerPassword}"
// sh "make -C bridge docker"
// sh "make -C coordinator docker"
// sh "docker tag scrolltech/bridge:latest scrolltech/bridge:${TAGNAME}"
// sh "docker tag scrolltech/coordinator:latest scrolltech/coordinator:${TAGNAME}"
// sh "docker push scrolltech/bridge:${TAGNAME}"
// sh "docker push scrolltech/coordinator:${TAGNAME}"
}
}
}
}
}
}
}

View File

@@ -368,9 +368,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "bounded-collections"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de2aff4807e40f478132150d80b031f2461d88f061851afcab537d7600c24120"
checksum = "a071c348a5ef6da1d3a87166b408170b46002382b1dda83992b5c2208cefb370"
dependencies = [
"log",
"parity-scale-codec",
@@ -2902,9 +2902,9 @@ dependencies = [
[[package]]
name = "parity-scale-codec"
version = "3.3.0"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3840933452adf7b3b9145e27086a5a3376c619dca1a21b1e5a5af0d54979bed"
checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac"
dependencies = [
"arrayvec 0.7.2",
"bitvec 1.0.1",
@@ -5014,7 +5014,7 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "types"
version = "0.1.0"
source = "git+https://github.com/scroll-tech/scroll-zkevm?branch=goerli-0215#a090be6f603f58f9e1fb9cf500834fa2e51e0ca9"
source = "git+https://github.com/scroll-tech/scroll-zkevm?branch=goerli-0215#d0d3338663a0b3eee51e9d044ab96a7899d70252"
dependencies = [
"base64 0.13.0",
"blake2",
@@ -5682,7 +5682,7 @@ dependencies = [
[[package]]
name = "zkevm"
version = "0.1.0"
source = "git+https://github.com/scroll-tech/scroll-zkevm?branch=goerli-0215#a090be6f603f58f9e1fb9cf500834fa2e51e0ca9"
source = "git+https://github.com/scroll-tech/scroll-zkevm?branch=goerli-0215#d0d3338663a0b3eee51e9d044ab96a7899d70252"
dependencies = [
"anyhow",
"blake2",

View File

@@ -5,7 +5,7 @@ import (
"runtime/debug"
)
var tag = "alpha-v1.13"
var tag = "alpha-v1.11"
var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {

View File

@@ -194,15 +194,6 @@ func (o *blockBatchOrm) GetLatestFinalizedBatch() (*types.BlockBatch, error) {
return batch, nil
}
func (o *blockBatchOrm) GetLatestFinalizingOrFinalizedBatch() (*types.BlockBatch, error) {
row := o.db.QueryRowx(`select * from block_batch where index = (select max(index) from block_batch where rollup_status = $1 or rollup_status = $2);`, types.RollupFinalizing, types.RollupFinalized)
batch := &types.BlockBatch{}
if err := row.StructScan(batch); err != nil {
return nil, err
}
return batch, nil
}
func (o *blockBatchOrm) GetCommittedBatches(limit uint64) ([]string, error) {
rows, err := o.db.Queryx(`SELECT hash FROM block_batch WHERE rollup_status = $1 ORDER BY index ASC LIMIT $2`, types.RollupCommitted, limit)
if err != nil {

View File

@@ -63,7 +63,6 @@ type BlockBatchOrm interface {
GetLatestBatch() (*types.BlockBatch, error)
GetLatestCommittedBatch() (*types.BlockBatch, error)
GetLatestFinalizedBatch() (*types.BlockBatch, error)
GetLatestFinalizingOrFinalizedBatch() (*types.BlockBatch, error)
UpdateRollupStatus(ctx context.Context, hash string, status types.RollupStatus) error
UpdateCommitTxHashAndRollupStatus(ctx context.Context, hash string, commitTxHash string, status types.RollupStatus) error
UpdateFinalizeTxHashAndRollupStatus(ctx context.Context, hash string, finalizeTxHash string, status types.RollupStatus) error