Skip to content
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

improve tx forwarding race condition #74

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alecsavvy
Copy link
Contributor

@alecsavvy alecsavvy commented Mar 4, 2025

  • adds a deadline, submitted_at, and forwarded_from to the forward tx request

  • uses these to implement some gating at the reception level so old txs get ignored and syncing nodes can still send them

  • if a tx has a deadline too far the receiving node sets it back to 10 blocks away

  • if it's from a long time ago blockwise but the timestamp is recent then the node accepts it, likely from syncing node. this should be hardened later

@alecsavvy alecsavvy requested review from endline and phelpsdb March 4, 2025 19:38
@alecsavvy alecsavvy self-assigned this Mar 4, 2025
Comment on lines +22 to +25
func (c *Cache) CurrentHeight() int64 {
return atomic.LoadInt64(&c.currentHeight)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

In my pr I'm actually changing currentHeight to be an atomic.Int64 for more ergonomic use, thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no preference, I think I like it typed how you did so i'll deal with the conflicts!

Comment on lines +128 to +129
// exclude deadlines that are more than 120 blocks behind the current block
deadline = currentBlock + 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems misleading, we're not actually excluding the deadline in this condition. Should the comment read "exclude deadlines that are more than 120 blocks behind the current block unless transaction is recent (came from syncing node)"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep! way better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants