juno
juno copied to clipboard
Missing version validation for pending blocks
Juno currently accepts and stores pending blocks regardless of whether their versions are supported by the current version of Juno. This behavior is inconsistent with how Juno handles normal (latest) blocks, where there is a version compatibility check.
Current Behavior: When Juno encounters a pending block with an unsupported version, it still stores this block.
Result: This leads to operational problems, including panics:
/usr/lib/go-1.21/src/net/http/server.go:3086 +0x5cb
created by net/http.(*Server).Serve in goroutine 10
/usr/lib/go-1.21/src/net/http/server.go:2009 +0x5f4
net/http.(*conn).serve(0xc0009903f0, {0x3235de0, 0xc00039a030})
/usr/lib/go-1.21/src/net/http/server.go:2938 +0x8e
net/http.serverHandler.ServeHTTP({0x322cf30?}, {0x3231180?, 0xc000b3a1c0?}, 0x6?)
/usr/lib/go-1.21/src/net/http/server.go:2136 +0x29
net/http.HandlerFunc.ServeHTTP(0x4b9aa5?, {0x3231180?, 0xc000b3a1c0?}, 0xc000b3a101?)
/root/go/pkg/mod/github.com/rs/[email protected]/cors.go:281 +0x184
github.com/NethermindEth/juno/node.makeRPCOverHTTP.(*Cors).Handler.func2({0x3231180, 0xc000b3a1c0}, 0xc000ff7d00)
/usr/lib/go-1.21/src/net/http/server.go:2514 +0x142
net/http.(*ServeMux).ServeHTTP(0xc00049a2a0?, {0x3231180, 0xc000b3a1c0}, 0xc000ff7d00)
/usr/lib/go-1.21/src/net/http/server.go:2136 +0x29
net/http.HandlerFunc.ServeHTTP(0xc000f40d20?, {0x3231180?, 0xc000b3a1c0?}, 0x2da8b6b?)
/app/node/http.go:71 +0x98
github.com/NethermindEth/juno/node.makeRPCOverHTTP.exactPathServer.func1({0x3231180, 0xc000b3a1c0}, 0xc000ff7d00)
/app/jsonrpc/http.go:49 +0x227
github.com/NethermindEth/juno/jsonrpc.(*HTTP).ServeHTTP(0xc000112f60, {0x3231180, 0xc000b3a1c0}, 0xc000ff7d00)
/app/jsonrpc/server.go:289 +0x474
github.com/NethermindEth/juno/jsonrpc.(*Server).HandleReader(0xc0002939d0?, {0x3235e18, 0xc001249bd0}, {0x7d055ce132f0?, 0xc0011ed440?})
/app/jsonrpc/server.go:434 +0x41d
github.com/NethermindEth/juno/jsonrpc.(*Server).handleRequest(0xc000404f40, {0x3235e18, 0xc001249bd0}, 0xc0011ed500)
/usr/lib/go-1.21/src/reflect/value.go:380 +0xb9
reflect.Value.Call({0x2b1f1a0?, 0xc0007fad00?, 0xc000575938?}, {0xc000f40d80?, 0x1?, 0x2b1f1a0?})
/usr/lib/go-1.21/src/reflect/value.go:596 +0xce7
reflect.Value.call({0x2b1f1a0?, 0xc0007fad00?, 0xc000f40d80?}, {0x2d74354, 0x4}, {0xc000f40d80, 0x2, 0x2c4dd40?})
/app/rpc/handlers.go:1382 +0x65
github.com/NethermindEth/juno/rpc.(*Handler).TraceBlockTransactions(0x2c4dd40?, {0x3235e18, 0xc001249bd0}, {0x1, 0x0, 0x0, 0x0})
/app/rpc/handlers.go:1484 +0xc5a
github.com/NethermindEth/juno/rpc.(*Handler).traceBlockTransactions(0xc0003fe460, {0x3235e18?, 0xc001249bd0?}, 0xc0011ed580, 0x0)
/app/node/throttled_vm.go:39 +0x185
github.com/NethermindEth/juno/node.(*ThrottledVM).Execute(0xe06ae8?, {0xc0007ceea0?, 0x0?, 0x0?}, {0x0?, 0x0?, 0x47aa?}, 0x47aa?, 0x0?, 0xc000878f60, ...)
/app/utils/throttler.go:45 +0xdb
github.com/NethermindEth/juno/utils.(*Throttler[...]).Do(0x322cc60, 0xc00098eb40)
/app/node/throttled_vm.go:41 +0x16b
github.com/NethermindEth/juno/node.(*ThrottledVM).Execute.func1(0x3227180?)
/app/vm/vm.go:186 +0x3e0
github.com/NethermindEth/juno/vm.(*vm).Execute(0xc0007fa210, {0xc0007ceea0, 0xd, 0xd}, {0x0, 0x0, 0x0}, 0xc00098eae0?, 0x0?, 0xc000878f60, ...)
/app/core/felt/felt.go:150
github.com/NethermindEth/juno/core/felt.(*Felt).Bytes(...)
/usr/lib/go-1.21/src/runtime/panic.go:920 +0x270
panic({0x2b38ea0?, 0x44995f0?})
/usr/lib/go-1.21/src/net/http/server.go:1868 +0xb9
net/http.(*conn).serve.func1()
goroutine 607353 [running]:
2023/11/22 14:33:02 http: panic serving 130.211.2.107:50730: runtime error: invalid memory address or nil pointer dereference
Expected Behavior: Juno should validate the version of pending blocks, similar to the validation for latest blocks. If a pending block's version is not supported, Juno should appropriately handle it (e.g., reject/not store it) to prevent such operational issues.