Skip to content
This repository was archived by the owner on Apr 11, 2021. It is now read-only.

fix: latest value cleanups#248

Closed
tynes wants to merge 1 commit into
masterfrom
fix/timestamp-fix
Closed

fix: latest value cleanups#248
tynes wants to merge 1 commit into
masterfrom
fix/timestamp-fix

Conversation

@tynes
Copy link
Copy Markdown
Collaborator

@tynes tynes commented Mar 4, 2021

Description

Moves the timestamp logic into the same general area and also deduplicates the logic around setting the index/queue index

Metadata

Fixes

  • Fixes # [Link to Issue]

Contributing Agreement

Copy link
Copy Markdown
Contributor

@smartcontracts smartcontracts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asked some clarifying questions.

Comment thread rollup/sync_service.go
if err != nil {
log.Error("Cannot apply transaction", "msg", err)
}
s.SetLatestIndex(&i)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed because it now occurs within applyTransaction which would be called by maybeApplyTransaction. Is that correct?

Comment thread rollup/sync_service.go
func (s *SyncService) applyTransaction(tx *types.Transaction) error {
meta := tx.GetMeta()
if tx.QueueOrigin().Uint64() == uint64(types.QueueOriginL1ToL2) {
s.SetLatestEnqueueIndex(meta.QueueIndex)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there ever a situation in which meta.QueueIndex could be greater than the previous enqueue index?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean less than? It should not
See the note below the Types section here: https://github.com/ethereum-optimism/specs/blob/main/transaction-ingestor.md#types

Comment thread rollup/sync_service.go
}
// Queue origin sequencer transactions should not have an index here
if meta.Index != nil {
s.SetLatestIndex(meta.Index)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as above for this SetLatestIndex and the one below.

Comment thread rollup/sync_service.go
if err != nil {
return fmt.Errorf("invalid transaction: %w", err)
}
tx.SetL1Timestamp(s.GetLatestL1Timestamp())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this ever be a race condition?

@tynes
Copy link
Copy Markdown
Collaborator Author

tynes commented Mar 5, 2021

Really what we want to do is implement the spec seen here: https://github.com/ethereum-optimism/specs/blob/main/transaction-ingestor.md

@tynes
Copy link
Copy Markdown
Collaborator Author

tynes commented Mar 27, 2021

Closing in favor of #271

@tynes tynes closed this Mar 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants