Skip to content

Fix compatibility with basicnode.Prototype.Any.NewBuilder() #52

@i-norden

Description

@i-norden

Trying to use the basicnode.Prototype.Any.NewBuilder() instead of a specifically typed builder from our typeSlab (e.g. dageth.Type.TrieNode.NewBuilder()) causes a panic to be thrown, e.g. while working on #47

--- FAIL: TestEthCodecs (0.00s)
    --- FAIL: TestEthCodecs/eth-log-trie-branch-node-with-embedded-log-leaf-and-value (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1012521f0]

goroutine 174 [running]:
testing.tRunner.func1.2({0x1013ebb80, 0x10173c680})
	/usr/local/go/src/testing/testing.go:1396 +0x1c8
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1399 +0x378
panic({0x1013ebb80, 0x10173c680})
	/usr/local/go/src/runtime/panic.go:884 +0x204
github.com/vulcanize/go-codec-dageth.(*_Value__KeyAssembler).AssignString(0x140004997f8?, {0x10130bb57, 0x3})
	/Users/iannorden/go/src/github.com/vulcanize/go-codec-dageth/ipldsch_satisfaction.go:27306 +0x70
github.com/vulcanize/go-codec-dageth.(*_Value__KeyAssembler).AssignNode(0x14000245160?, {0x101475dd8?, 0x14000245180?})
	/Users/iannorden/go/src/github.com/vulcanize/go-codec-dageth/ipldsch_satisfaction.go:27322 +0x58
github.com/vulcanize/go-codec-dageth.(*_Value__Assembler).AssignNode(0x140002e7bc8, {0x101475d38, 0x14000245160})
	/Users/iannorden/go/src/github.com/vulcanize/go-codec-dageth/ipldsch_satisfaction.go:27079 +0x37c
github.com/vulcanize/go-codec-dageth.(*_TrieBranchNode__Assembler).AssignNode(0x140002e7818, {0x101475d38, 0x14000245120})
	/Users/iannorden/go/src/github.com/vulcanize/go-codec-dageth/ipldsch_satisfaction.go:19108 +0x36c
github.com/vulcanize/go-codec-dageth.(*_TrieNode__Assembler).AssignNode(0x140002e7800, {0x101475d38, 0x140002450e0})
	/Users/iannorden/go/src/github.com/vulcanize/go-codec-dageth/ipldsch_satisfaction.go:23216 +0x3a0
github.com/vulcanize/go-codec-dageth/trie.AppendEncode({0x14000284000, 0x0, 0x400}, {0x101475d38, 0x140002450e0})
	/Users/iannorden/go/src/github.com/vulcanize/go-codec-dageth/trie/marshal.go:70 +0x134
github.com/vulcanize/go-codec-dageth/trie.Encode({0x101475d38, 0x140002450e0}, {0x128f87a60, 0x14000272e00})
	/Users/iannorden/go/src/github.com/vulcanize/go-codec-dageth/trie/marshal.go:56 +0x50
github.com/vulcanize/go-codec-dageth/log_trie.Encode({0x101475d38?, 0x140002450e0?}, {0x128f87a60?, 0x14000272e00?})
	/Users/iannorden/go/src/github.com/vulcanize/go-codec-dageth/log_trie/marshal.go:16 +0x2c
github.com/ipld/codec-fixtures/go.nodeToCid({0x14000258de0, 0x14000258df0, 0x1014681e8, 0x0, 0x0, 0x0, 0x0, 0x0}, {0x10146b008, 0x140000244c0}, ...)
	/Users/iannorden/go/src/github.com/ipld/codec-fixtures/go/fixtures.go:242 +0x150
github.com/ipld/codec-fixtures/go.verifyCid(0x14000327040, {0x1400022b300, 0x3a}, {0x101475d38?, 0x140002450e0?}, {0x10146b008?, 0x140000244c0?}, {{0x14000289e00?, 0x5000?}}, {0x14000258de0, ...})
	/Users/iannorden/go/src/github.com/ipld/codec-fixtures/go/codecs_test.go:76 +0x9c
github.com/ipld/codec-fixtures/go.TestEthCodecs.func1(0x14000327040)
	/Users/iannorden/go/src/github.com/ipld/codec-fixtures/go/codecs_test.go:68 +0x2b8
testing.tRunner(0x14000327040, 0x14000296e40)
	/usr/local/go/src/testing/testing.go:1446 +0x10c
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1493 +0x300
exit status 2
FAIL	github.com/ipld/codec-fixtures/go	0.179s

This appears to only occur for Union types. I believe this related to #19 and #20, but need to investigate further (and close out those issues as well, in any case).

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