Skip to content

Cardano initialization fails with nil pointer dereference in CardanoSignerProvider.GetDockerServiceDefinition #344

@ShehanSuraweera

Description

@ShehanSuraweera

Bug Description

FireFly CLI crashes with segmentation violation when attempting to initialize any Cardano development stack.

Environment

  • FireFly CLI Version: Latest (based on stack trace paths)
  • OS: Linux (Ubuntu)
  • Docker: Working (Ethereum stacks initialize successfully)
  • Go Version: go1.24.5

Command That Fails

ff init cardano dev --network preview --blockfrost-key previewXXX

Error Stack Trace

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x887577]

goroutine 1 [running]:
github.com/hyperledger/firefly-cli/pkg/types.(*ManifestEntry).GetDockerImageString(0x0)
/home/runner/work/firefly-cli/firefly-cli/pkg/types/manifest.go:65 +0x17
github.com/hyperledger/firefly-cli/internal/blockchain/cardano/cardanosigner.(*CardanoSignerProvider).GetDockerServiceDefinition(0xc00058e258, {0xc00078f888?, 0x0?})
/home/runner/work/firefly-cli/firefly-cli/internal/blockchain/cardano/cardanosigner/cardanosigner.go:91 +0x39
github.com/hyperledger/firefly-cli/internal/blockchain/cardano/remoterpc.(*RemoteRPCProvider).GetDockerServiceDefinitions(0xc00058cc30)
/home/runner/work/firefly-cli/firefly-cli/internal/blockchain/cardano/remoterpc/remoterpc_provider.go:93 +0x35
github.com/hyperledger/firefly-cli/internal/stacks.(*StackManager).buildDockerCompose(0xc00078fc10)
/home/runner/work/firefly-cli/firefly-cli/internal/stacks/stack_manager.go:234 +0x4c
github.com/hyperledger/firefly-cli/internal/stacks.(*StackManager).InitStack(0xc00078fc10, 0x186c720)
/home/runner/work/firefly-cli/firefly-cli/internal/stacks/stack_manager.go:207 +0xd3b
github.com/hyperledger/firefly-cli/cmd.init.func18(0xc00063a700?, {0xc000616690, 0x1, 0x5})
/home/runner/work/firefly-cli/firefly-cli/cmd/init_cardano.go:51 +0x2ef
github.com/spf13/cobra.(*Command).execute(0x1859120, {0xc000616640, 0x5, 0x5})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x1858880)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/hyperledger/firefly-cli/cmd.Execute()
/home/runner/work/firefly-cli/firefly-cli/cmd/root.go:90 +0xa6
main.main()
/home/runner/work/firefly-cli/firefly-cli/ff/main.go:24 +0xf

Root Cause Analysis

The issue occurs because the m.Cardanosigner field in the VersionManifest struct is nil when GetDockerImageString() is called.

Code Location: pkg/types/manifest.go line 65

Problem: The Entries() method in VersionManifest was missing m.Cardanosigner from the returned slice, but even after adding it, the manifest entry itself remains nil during initialization.

Steps to Reproduce

  1. Install FireFly CLI
  2. Run any Cardano initialization command:
    • ff init cardano dev --network preview --blockfrost-key XXX
    • ff init cardano dev --socket /path/to/node.socket
  3. Observe segmentation violation panic

Expected Behavior

Cardano stack should initialize successfully, similar to Ethereum stacks.

Actual Behavior

CLI crashes with nil pointer dereference before stack creation completes.

Additional Context

  • Ethereum initialization works perfectly: ff init ethereum dev succeeds
  • Both local node and Blockfrost configurations fail: Issue affects all Cardano setup methods
  • Missing Docker images: Stack creation also fails due to non-existent hyperledger/firefly-cardanosigner image
  • Workaround exists: Using the official firefly-cardano repository works correctly

Suggested Investigation

  1. Check manifest loading process for Cardano components
  2. Ensure Docker images exist for all Cardano services
  3. Verify VersionManifest initialization includes all required fields
  4. Add nil-safety checks in GetDockerImageString() method

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions