-
Notifications
You must be signed in to change notification settings - Fork 0
Add CeloEspressoTimestamp for migration #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: celo-integration-rebase-13.2
Are you sure you want to change the base?
Changes from 3 commits
07e50fc
ae1317f
d53a44f
71556a2
c0d6688
02ac426
a9facec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ package derive | |
| import ( | ||
| "context" | ||
| "fmt" | ||
| "time" | ||
|
|
||
| "github.com/ethereum/go-ethereum/common" | ||
| "github.com/ethereum/go-ethereum/core/types" | ||
|
|
@@ -50,9 +51,10 @@ type DataSourceFactory struct { | |
|
|
||
| func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1Fetcher, blobsFetcher L1BlobsFetcher, altDAFetcher AltDAInputFetcher) *DataSourceFactory { | ||
| config := DataSourceConfig{ | ||
| l1Signer: cfg.L1Signer(), | ||
| batchInboxAddress: cfg.BatchInboxAddress, | ||
| altDAEnabled: cfg.AltDAEnabled(), | ||
| l1Signer: cfg.L1Signer(), | ||
| batchInboxAddress: cfg.BatchInboxAddress, | ||
| altDAEnabled: cfg.AltDAEnabled(), | ||
| celoEspressoTimestamp: cfg.CeloEspressoTimestamp, | ||
| } | ||
| return &DataSourceFactory{ | ||
| log: log, | ||
|
|
@@ -86,19 +88,26 @@ func (ds *DataSourceFactory) OpenData(ctx context.Context, ref eth.L1BlockRef, b | |
|
|
||
| // DataSourceConfig regroups the mandatory rollup.Config fields needed for DataFromEVMTransactions. | ||
| type DataSourceConfig struct { | ||
| l1Signer types.Signer | ||
| batchInboxAddress common.Address | ||
| altDAEnabled bool | ||
| l1Signer types.Signer | ||
| batchInboxAddress common.Address | ||
| altDAEnabled bool | ||
| celoEspressoTimestamp *uint64 | ||
| } | ||
|
|
||
| // isValidBatchTx returns true if: | ||
| // 1. the transaction is not reverted | ||
| // isValidBatchTx validates a transaction against the given configuration | ||
| // It returns true if: | ||
| // 1. the transaction is not reverted (only checked if CeloEspresso is enabled) | ||
| // 2. the transaction type is any of Legacy, ACL, DynamicFee, Blob, or Deposit (for L3s). | ||
| // 3. the transaction has a To() address that matches the batch inbox address, and | ||
| // 4. the transaction has a valid signature from the batcher address | ||
| func isValidBatchTx(tx *types.Transaction, receipt *types.Receipt, l1Signer types.Signer, batchInboxAddr, batcherAddr common.Address, logger log.Logger) bool { | ||
| func isValidBatchTx(tx *types.Transaction, receipt *types.Receipt, l1Signer types.Signer, batchInboxAddr, batcherAddr common.Address, logger log.Logger, celoEspressoTimestamp *uint64) bool { | ||
| // If CeloEspresso is activated, return false if the transaction is reverted | ||
| if receipt.Status != types.ReceiptStatusSuccessful { | ||
QuentinI marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return false | ||
| logger.Info("tx in inbox with reverted status", "hash", tx.Hash(), "status", receipt.Status) | ||
| if celoEspressoTimestamp != nil && time.Now().Unix() >= int64(*celoEspressoTimestamp) { | ||
|
||
| logger.Info("tx is dropped since it is reverted") | ||
| return false | ||
| } | ||
|
||
| } | ||
|
|
||
| // For now, we want to disallow the SetCodeTx type or any future types. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.