-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from 0xPolygonHermez/fix/71_70-updateEtrog-syn…
…c_flag Fix/71 70 update etrog sync flag
- Loading branch information
Showing
10 changed files
with
115 additions
and
8 deletions.
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,20 @@ | ||
name: Check Version | ||
on: | ||
push: | ||
branches: | ||
- 'release/**' | ||
- 'feature/**' | ||
- 'fix/**' | ||
pull_request: | ||
jobs: | ||
check_version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21.x | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Check Version | ||
run: make check-is-new-version |
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
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
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
60 changes: 60 additions & 0 deletions
60
synchronizer/actions/etrog/processor_l1_update_etrog_sequence.go
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,60 @@ | ||
package etrog | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/0xPolygonHermez/zkevm-synchronizer-l1/etherman" | ||
"github.com/0xPolygonHermez/zkevm-synchronizer-l1/state/entities" | ||
"github.com/0xPolygonHermez/zkevm-synchronizer-l1/synchronizer/actions" | ||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
// ProcessorL1UpdateEtrogSequence implements L1EventProcessor | ||
type ProcessorL1UpdateEtrogSequence struct { | ||
actions.ProcessorBase[ProcessorL1UpdateEtrogSequence] | ||
state stateOnSequencedBatchesInterface | ||
} | ||
|
||
// NewProcessorL1UpdateEtrogSequence returns instance of a processor for UpdateEtrogSequenceOrder | ||
func NewProcessorL1UpdateEtrogSequence(state stateOnSequencedBatchesInterface, | ||
) *ProcessorL1UpdateEtrogSequence { | ||
return &ProcessorL1UpdateEtrogSequence{ | ||
ProcessorBase: actions.ProcessorBase[ProcessorL1UpdateEtrogSequence]{ | ||
SupportedEvent: []etherman.EventOrder{etherman.UpdateEtrogSequenceOrder}, | ||
SupportedForkdIds: &actions.ForksIdOnlyEtrog}, | ||
state: state, | ||
} | ||
} | ||
|
||
// Process process event | ||
func (p *ProcessorL1UpdateEtrogSequence) Process(ctx context.Context, forkId ForkIdType, order etherman.Order, l1Block *etherman.Block, dbTx stateTxType) error { | ||
if l1Block == nil || l1Block.UpdateEtrogSequence.BatchNumber == 0 { | ||
return actions.ErrInvalidParams | ||
} | ||
err := p.processUpdateEtrogSequence(ctx, forkId, order, l1Block.UpdateEtrogSequence, l1Block.BlockNumber, l1Block.ReceivedAt, dbTx) | ||
return err | ||
} | ||
|
||
func (p *ProcessorL1UpdateEtrogSequence) processUpdateEtrogSequence(ctx context.Context, forkId ForkIdType, order etherman.Order, updateEtrogSequence etherman.UpdateEtrogSequence, blockNumber uint64, l1BlockTimestamp time.Time, dbTx stateTxType) error { | ||
l1inforoot := common.Hash(updateEtrogSequence.PolygonRollupBaseEtrogBatchData.ForcedGlobalExitRoot) | ||
seq := SequenceOfBatches{} | ||
seq.Sequence = *entities.NewSequencedBatches( | ||
updateEtrogSequence.BatchNumber, updateEtrogSequence.BatchNumber, | ||
blockNumber, uint64(forkId), | ||
l1BlockTimestamp, time.Now(), | ||
l1inforoot, string(order.Name)) | ||
ethSeqBatch := etherman.SequencedBatch{ | ||
BatchNumber: updateEtrogSequence.BatchNumber, | ||
L1InfoRoot: &l1inforoot, | ||
SequencerAddr: updateEtrogSequence.SequencerAddr, | ||
TxHash: updateEtrogSequence.TxHash, | ||
PolygonRollupBaseEtrogBatchData: updateEtrogSequence.PolygonRollupBaseEtrogBatchData, | ||
} | ||
|
||
batch := entities.NewVirtualBatchFromL1(blockNumber, seq.Sequence.FromBatchNumber, uint64(forkId), ethSeqBatch) | ||
|
||
seq.Batches = append(seq.Batches, batch) | ||
|
||
return p.state.OnSequencedBatchesOnL1(ctx, seq, dbTx) | ||
} |
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
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
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
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
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