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

Juno panics when receiving Transaction message with nil transaction_hash in P2P sync #2239

Open
wojciechos opened this issue Oct 24, 2024 · 0 comments
Labels
Bug Something isn't working or security issue P2P

Comments

@wojciechos
Copy link
Contributor

wojciechos commented Oct 24, 2024

Juno panics and exits when it receives a Transaction message with a nil transaction_hash in P2P sync. According to the Starnet P2P spec, transaction_hash is required, but this could happen due to bugs or even malicious nodes. Juno should handle such cases gracefully without panicking.

Steps to Reproduce:

  1. Set up Juno to sync via P2P with another client (e.g Pathfinder<=v0.14.4).
  2. If a Transaction message with a nil transaction_hash is received, Juno panics.

Expected Behavior:

Juno should not panic when receiving a Transaction message with a missing or nil transaction_hash. It should log an error or reject the message, allowing the node to continue running.

Logs:

(*core.DeclareTransaction)(0xc00081cb40)({
 TransactionHash: (*felt.Felt)(<nil>),
 ClassHash: (*felt.Felt)(0xc0005012c0)(0x5c478ee27f2112411f86f207605b2e2c58cdb647bac0df27f660ef2252359c6),
 SenderAddress: (*felt.Felt)(0xc0005012e0)(0x1),
 MaxFee: (*felt.Felt)(0xc000501300)(0x0),
 TransactionSignature: ([]*felt.Felt) <nil>,
 Nonce: (*felt.Felt)(<nil>),
 Version: (*core.TransactionVersion)(0xc000501320)(0x0),
 CompiledClassHash: (*felt.Felt)(<nil>),
 ResourceBounds: (map[core.Resource]core.ResourceBounds) <nil>,
 Tip: (uint64) 0,
 PaymasterData: ([]*felt.Felt) <nil>,
 AccountDeploymentData: ([]*felt.Felt) <nil>,
 NonceDAMode: (core.DataAvailabilityMode) 0,
 FeeDAMode: (core.DataAvailabilityMode) 0
})
panic: TX hash 0 is nil

goroutine 242 [running]:
github.com/NethermindEth/juno/p2p.(*syncService).adaptAndSanityCheckBlock.func1()
	/app/p2p/sync.go:297 +0xee5
created by github.com/NethermindEth/juno/p2p.(*syncService).adaptAndSanityCheckBlock in goroutine 229
	/app/p2p/sync.go:271 +0x1eb
@wojciechos wojciechos added Bug Something isn't working or security issue P2P labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working or security issue P2P
Projects
Status: Todo
Development

No branches or pull requests

2 participants
@wojciechos and others