Skip to content

GetRail fails for raw FIL (payer-is-operator) Rails #8

@JAG-UK

Description

@JAG-UK

What I did:

I called GetRail() on a native FIL rail (where payment contract is 0x0 and payer-is-operator). Specifically I did this:

`// FindActiveFILRail returns a rail ID where payer pays payee in native FIL, rail not terminated and not past end epoch.
func (c *Client) FindActiveFILRail(ctx context.Context, payer, payee common.Address) (*big.Int, error) {

    [...]

for {
	results, nextOff, total, err := c.payments.GetRailsForPayerAndToken(ctx, payer, filToken, offset, limit)
	
             [... bunch of checks ...]

	for _, ri := range results {
		view, err := c.payments.GetRail(ctx, ri.RailId)
		
                     [... bunch of checks ...]

		return ri.RailId, nil
	}
}
c.payInfo("no matching FIL rail", "payer", payer.Hex(), "payee", payee.Hex())
return nil, fmt.Errorf("filpay: no active native-FIL rail from %s to %s", payer.Hex(), payee.Hex())

}`

What I expected to happen:

Either a valid rail returned with nice inspectable info, or a clean error

What actually happened:

It panicked:

2026/03/24 10:43:36 http: panic serving 127.0.0.1:62322: reflect: call of reflect.Value.Len on struct Value goroutine 37 [running]: net/http.(*conn).serve.func1() /opt/homebrew/Cellar/go/1.24.4/libexec/src/net/http/server.go:1947 +0xb0 panic({0x100caace0?, 0x140004988a0?}) /opt/homebrew/Cellar/go/1.24.4/libexec/src/runtime/panic.go:792 +0x124 reflect.Value.lenNonSlice({0x14000121b00?, 0x14000020bb0?, 0x140002f7250?}) /opt/homebrew/Cellar/go/1.24.4/libexec/src/reflect/value.go:1782 +0x20c reflect.Value.Len(...) /opt/homebrew/Cellar/go/1.24.4/libexec/src/reflect/value.go:1761 github.com/ethereum/go-ethereum/accounts/abi.setArray({0x100d2c300?, 0x14000020a50?, 0x100d2c300?}, {0x14000121b00?, 0x14000020bb0?, 0x100d73fc0?}) /Users/jag/go/pkg/mod/github.com/ethereum/go-ethereum@v1.14.12/accounts/abi/reflect.go:145 +0xbc github.com/ethereum/go-ethereum/accounts/abi.set({0x100d2c300?, 0x14000020a50?, 0x140003002a0?}, {0x14000121b00?, 0x14000020bb0?, 0x0?}) /Users/jag/go/pkg/mod/github.com/ethereum/go-ethereum@v1.14.12/accounts/abi/reflect.go:114 +0x3e4 github.com/ethereum/go-ethereum/accounts/abi.Arguments.copyAtomic({0x0?, 0x1400029a090?, 0x14000035f18?}, {0x100c6e500?, 0x14000020a50?}, {0x14000121b00, 0x14000020bb0}) /Users/jag/go/pkg/mod/github.com/ethereum/go-ethereum@v1.14.12/accounts/abi/argument.go:136 +0x114 github.com/ethereum/go-ethereum/accounts/abi.Arguments.Copy({0x1400022a5a0?, 0x0?, 0x0?}, {0x100c6e500?, 0x14000020a50?}, {0x14000298040?, 0x0?, 0x0?}) /Users/jag/go/pkg/mod/github.com/ethereum/go-ethereum@v1.14.12/accounts/abi/argument.go:127 +0xb8 github.com/ethereum/go-ethereum/accounts/abi.ABI.UnpackIntoInterface({{{0x0, 0x0}, {0x0, 0x0}, 0x0, {0x0, 0x0}, 0x0, 0x0, {0x0, ...}, ...}, ...}, ...) /Users/jag/go/pkg/mod/github.com/ethereum/go-ethereum@v1.14.12/accounts/abi/abi.go:125 +0xc8 github.com/data-preservation-programs/go-synapse/contracts.(*PaymentsContract).GetRail(0x140001dd208, {0x100d6bc58, 0x140003cc140}, 0x14000036ae8?) /Users/jag/go/pkg/mod/github.com/data-preservation-programs/go-synapse@v0.0.0-20260310124115-0faeb6924d36/contracts/payments.go:358 +0x1fc github.com/fidlabs/paid-retrievals/internal/filpay.(*Client).FindActiveFILRail(0x1400003ee40, {0x100d6bc58, 0x140003cc140}, {0x20, 0x15, 0x45, 0xe0, 0x4c, 0xc9, 0x79, ...}, ...) /Users/jag/repos/filecoin_stuff/paid-retrievals/internal/filpay/settlement.go:385 +0x7e8 github.com/fidlabs/paid-retrievals/internal/filpay.(*Client).SettleIfFunded(0x1400003ee40, {0x100d6bc58, 0x140003cc140}, {0x20, 0x15, 0x45, 0xe0, 0x4c, 0xc9, 0x79, ...}, ...) /Users/jag/repos/filecoin_stuff/paid-retrievals/internal/filpay/settlement.go:423 +0x224 github.com/fidlabs/paid-retrievals/internal/spproxy.handlePaid({0x100d6ad68, 0x140003d00e0}, 0x1400031c140, 0x140001a4260, {{0x16f98f5eb, 0x4}, {0x100ae73b0, 0x6}, {0x100aee940, 0x10}, ...}, ...) /Users/jag/repos/filecoin_stuff/paid-retrievals/internal/spproxy/proxy.go:227 +0xd10 github.com/fidlabs/paid-retrievals/internal/spproxy.NewHandler.func1({0x100d6ad68, 0x140003d00e0}, 0x1400031c140) /Users/jag/repos/filecoin_stuff/paid-retrievals/internal/spproxy/proxy.go:95 +0x52c net/http.HandlerFunc.ServeHTTP(0x0?, {0x100d6ad68?, 0x140003d00e0?}, 0x14000037b60?) /opt/homebrew/Cellar/go/1.24.4/libexec/src/net/http/server.go:2294 +0x38 net/http.serverHandler.ServeHTTP({0x140002306c0?}, {0x100d6ad68?, 0x140003d00e0?}, 0x1?) /opt/homebrew/Cellar/go/1.24.4/libexec/src/net/http/server.go:3301 +0xbc net/http.(*conn).serve(0x14000554000, {0x100d6bc20, 0x140001e9e90}) /opt/homebrew/Cellar/go/1.24.4/libexec/src/net/http/server.go:2102 +0x52c created by net/http.(*Server).Serve in goroutine 1 /opt/homebrew/Cellar/go/1.24.4/libexec/src/net/http/server.go:3454 +0x3d8

System:

MacOS, go-synapse main head commit 0faeb69

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