Skip to content

Commit

Permalink
fix: update zkevm-ethtx-manager version
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Sep 30, 2024
1 parent c4c790f commit 60f0f7c
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 35 deletions.
3 changes: 1 addition & 2 deletions aggoracle/chaingersender/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type EthTxManager interface {
Result(ctx context.Context, id common.Hash) (ethtxmanager.MonitoredTxResult, error)
Add(ctx context.Context,
to *common.Address,
forcedNonce *uint64,
value *big.Int,
data []byte,
gasOffset uint64,
Expand Down Expand Up @@ -103,7 +102,7 @@ func (c *EVMChainGERSender) UpdateGERWaitUntilMined(ctx context.Context, ger com
if err != nil {
return err
}
id, err := c.ethTxMan.Add(ctx, &c.gerAddr, nil, big.NewInt(0), data, c.gasOffset, nil)
id, err := c.ethTxMan.Add(ctx, &c.gerAddr, big.NewInt(0), data, c.gasOffset, nil)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ func (a *Aggregator) settleDirect(
return false
}

monitoredTxID, err := a.ethTxManager.Add(ctx, to, nil, big.NewInt(0), data, a.cfg.GasOffset, nil)
monitoredTxID, err := a.ethTxManager.Add(ctx, to, big.NewInt(0), data, a.cfg.GasOffset, nil)
if err != nil {
a.logger.Errorf("Error Adding TX to ethTxManager: %v", err)
mTxLogger := ethtxmanager.CreateLogger(monitoredTxID, sender, to)
Expand Down
2 changes: 1 addition & 1 deletion bridgesync/mock_l2_test.go

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

4 changes: 2 additions & 2 deletions claimsponsor/evmclaimsponsor.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type EthTxManager interface {
ResultsByStatus(ctx context.Context, statuses []ethtxmanager.MonitoredTxStatus,
) ([]ethtxmanager.MonitoredTxResult, error)
Result(ctx context.Context, id common.Hash) (ethtxmanager.MonitoredTxResult, error)
Add(ctx context.Context, to *common.Address, forcedNonce *uint64, value *big.Int, data []byte,
Add(ctx context.Context, to *common.Address, value *big.Int, data []byte,
gasOffset uint64, sidecar *types.BlobTxSidecar) (common.Hash, error)
}

Expand Down Expand Up @@ -152,7 +152,7 @@ func (c *EVMClaimSponsor) sendClaim(ctx context.Context, claim *Claim) (string,
if err != nil {
return "", err
}
id, err := c.ethTxManager.Add(ctx, &c.bridgeAddr, nil, big.NewInt(0), data, c.gasOffest, nil)
id, err := c.ethTxManager.Add(ctx, &c.bridgeAddr, big.NewInt(0), data, c.gasOffest, nil)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/0xPolygon/cdk-data-availability v0.0.9
github.com/0xPolygon/cdk-rpc v0.0.0-20240905074455-431d3c271fe8
github.com/0xPolygonHermez/zkevm-data-streamer v0.2.6
github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240716105056-c051c96d0234
github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240930120324-65816dead447
github.com/0xPolygonHermez/zkevm-synchronizer-l1 v1.0.1
github.com/ethereum/go-ethereum v1.14.8
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ github.com/0xPolygonHermez/zkevm-data-streamer v0.2.6 h1:BSO1uu6dmLQ5kKb3uyDvsUx
github.com/0xPolygonHermez/zkevm-data-streamer v0.2.6/go.mod h1:RC6ouyNsUtJrv5aGPcM6Dm5xhXN209tRSzcsJsaOtZI=
github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240716105056-c051c96d0234 h1:QElCysO7f2xaknY/RDjxcs7IVmcgORfsCX2g+YD0Ko4=
github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240716105056-c051c96d0234/go.mod h1:zBZWxwOHKlw+ghd9roQLgIkDZWA7e7qO3EsfQQT/+oQ=
github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240930120324-65816dead447 h1:8nZjZrHZo+P9hTkhwtQ4J6eh9v4MTMtVb9jRDra8h0s=
github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240930120324-65816dead447/go.mod h1:4iWpcwMOZJPapUzFB/HjTAM0X/gltHSEzQHE0lOt+eY=
github.com/0xPolygonHermez/zkevm-synchronizer-l1 v1.0.1 h1:8GbJBNsYO4zrqiBX++et8eQrJDEWEZuo3Ch3M416YnI=
github.com/0xPolygonHermez/zkevm-synchronizer-l1 v1.0.1/go.mod h1:96i+QSANfbikwlUY3U9MLNtg3656W3dWfbGqH+Od1/k=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
Expand Down
19 changes: 1 addition & 18 deletions sequencesender/sequencesender.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ type SequenceSender struct {
logger *log.Logger
ethTxManager *ethtxmanager.Client
etherman *etherman.Client
currentNonce uint64
nonceMutex sync.Mutex
latestVirtualBatch uint64 // Latest virtualized batch obtained from L1
latestVirtualTime time.Time // Latest virtual batch timestamp
latestSentToL1Batch uint64 // Latest batch sent to L1
Expand Down Expand Up @@ -141,14 +139,6 @@ func (s *SequenceSender) Start(ctx context.Context) {

// Get current nonce
var err error
s.nonceMutex.Lock()
s.currentNonce, err = s.etherman.CurrentNonce(ctx, s.cfg.L2Coinbase)
if err != nil {
s.logger.Fatalf("failed to get current nonce from %v, error: %v", s.cfg.L2Coinbase, err)
} else {
s.logger.Infof("current nonce for %v is %d", s.cfg.L2Coinbase, s.currentNonce)
}
s.nonceMutex.Unlock()

// Get latest virtual state batch from L1
err = s.updateLatestVirtualBatch()
Expand Down Expand Up @@ -601,18 +591,12 @@ func (s *SequenceSender) sendTx(
) error {
// Params if new tx to send or resend a previous tx
var paramTo *common.Address
var paramNonce *uint64
var paramData []byte
var valueFromBatch uint64
var valueToBatch uint64
var valueToAddress common.Address

if !resend {
s.nonceMutex.Lock()
nonce := s.currentNonce
s.currentNonce++
s.nonceMutex.Unlock()
paramNonce = &nonce
paramTo = to
paramData = data
valueFromBatch = fromBatch
Expand All @@ -623,7 +607,6 @@ func (s *SequenceSender) sendTx(
return errors.New("resend tx with nil hash monitor id")
}
paramTo = &s.ethTransactions[*txOldHash].To
paramNonce = &s.ethTransactions[*txOldHash].Nonce
paramData = s.ethTxData[*txOldHash]
valueFromBatch = s.ethTransactions[*txOldHash].FromBatch
valueToBatch = s.ethTransactions[*txOldHash].ToBatch
Expand All @@ -633,7 +616,7 @@ func (s *SequenceSender) sendTx(
}

// Add sequence tx
txHash, err := s.ethTxManager.AddWithGas(ctx, paramTo, paramNonce, big.NewInt(0), paramData, s.cfg.GasOffset, nil, gas)
txHash, err := s.ethTxManager.AddWithGas(ctx, paramTo, big.NewInt(0), paramData, s.cfg.GasOffset, nil, gas)
if err != nil {
s.logger.Errorf("error adding sequence to ethtxmanager: %v", err)
return err
Expand Down
20 changes: 10 additions & 10 deletions test/helpers/mock_ethtxmanager.go

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

0 comments on commit 60f0f7c

Please sign in to comment.