Skip to content

Commit

Permalink
fix: conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniRamirezM committed Sep 10, 2024
2 parents 1f53982 + 10fee93 commit 6e3a029
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 34 deletions.
31 changes: 1 addition & 30 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,30 +1 @@
# This is a comment.

# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in the repo.
* @default-owner

# Order is important. The last matching pattern has the most precedence.

# To set ownership of a particular folder, add a line like this:
/docs/ @documentation-team

# To set ownership of all .js files in the src/js/ directory, add a line like this:
/src/js/*.js @js-developers

# You can also specify individual users. This will make @octocat the owner of any .md files at the root of the repository:
/*.md @octocat

# In this example, @doctocat owns any files in the /apps/ directory and any of its subdirectories.
/apps/ @doctocat

# The `@backend-team` team owns any files in the `/api/` directory in the root of your repository and any of its subdirectories.
/api/ @backend-team

# The `@frontend-team` team owns any files in the `/web/` directory in the root of your repository and any of its subdirectories.
/web/ @frontend-team

# Add this line at the end of the file to always require pull request reviews
# when someone on the team is not an owner and the pull request modifies code owned by the team.
* @global-owner
@0xPolygon/core-cdk
9 changes: 5 additions & 4 deletions sequencesender/ethtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ func (s *SequenceSender) sendTx(ctx context.Context, resend bool, txOldHash *com
var valueToAddress common.Address

if !resend {
s.nonceMutex.Lock()
nonce := s.currentNonce
s.currentNonce++
s.nonceMutex.Unlock()
paramNonce = &nonce
paramTo = to
paramNonce = &s.currentNonce
paramData = data
valueFromBatch = fromBatch
valueToBatch = toBatch
Expand All @@ -73,9 +77,6 @@ func (s *SequenceSender) sendTx(ctx context.Context, resend bool, txOldHash *com
log.Errorf("error adding sequence to ethtxmanager: %v", err)
return err
}
if !resend {
s.currentNonce++
}

// Add new eth tx
txData := ethTxData{
Expand Down
3 changes: 3 additions & 0 deletions sequencesender/sequencesender.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type SequenceSender struct {
ethTxManager *ethtxmanager.Client
etherman *etherman.Client
currentNonce uint64
nonceMutex sync.Mutex
latestVirtualBatchNumber 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 @@ -92,12 +93,14 @@ 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 {
log.Fatalf("failed to get current nonce from %v, error: %v", s.cfg.L2Coinbase, err)
} else {
log.Infof("current nonce for %v is %d", s.cfg.L2Coinbase, s.currentNonce)
}
s.nonceMutex.Unlock()

// Get latest virtual state batch from L1
err = s.getLatestVirtualBatch()
Expand Down

0 comments on commit 6e3a029

Please sign in to comment.