Skip to content
Merged
42 changes: 25 additions & 17 deletions gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func accumulateChainTypes(ts *schema.TypeSystem) {
ParentCID &Header
UnclesCID &Uncles
Coinbase Address
StateRootCID &StateTrieNode
TxRootCID &TxTrieNode
RctRootCID &RctTrieNode
StateRootCID &TrieNode
TxRootCID &TrieNode
RctRootCID &TrieNode
Bloom Bloom
Difficulty BigInt
Number BigInt
Expand Down Expand Up @@ -176,29 +176,32 @@ func accumulateChainTypes(ts *schema.TypeSystem) {
}

type Logs [Log]
*/
ts.Accumulate(schema.SpawnList("Topics", "Hash", false))
ts.Accumulate(schema.SpawnStruct("Log",
[]schema.StructField{
schema.SpawnStructField("Address", "Address", false, false),
schema.SpawnStructField("Topics", "Topics", false, false),
schema.SpawnStructField("Data", "Bytes", false, false),
},
schema.SpawnStructRepresentationMap(nil),
))
ts.Accumulate(schema.SpawnList("Logs", "Log", false))

/*
type Receipt struct {
TxType TxType
// We could make Status an enum
Status Uint // nullable
PostState Hash // nullable
CumulativeGasUsed Uint
Bloom Bloom
Logs Logs
Logs Logs
LogRootCID &TrieNode
}

type Receipts [Receipt]
*/
ts.Accumulate(schema.SpawnList("Topics", "Hash", false))
ts.Accumulate(schema.SpawnStruct("Log",
[]schema.StructField{
schema.SpawnStructField("Address", "Address", false, false),
schema.SpawnStructField("Topics", "Topics", false, false),
schema.SpawnStructField("Data", "Bytes", false, false),
},
schema.SpawnStructRepresentationMap(nil),
))
ts.Accumulate(schema.SpawnList("Logs", "Log", false))
ts.Accumulate(schema.SpawnStruct("Receipt",
[]schema.StructField{
schema.SpawnStructField("TxType", "TxType", false, false),
Expand All @@ -207,6 +210,7 @@ func accumulateChainTypes(ts *schema.TypeSystem) {
schema.SpawnStructField("CumulativeGasUsed", "Uint", false, false),
schema.SpawnStructField("Bloom", "Bloom", false, false),
schema.SpawnStructField("Logs", "Logs", false, false),
schema.SpawnStructField("LogRootCID", "Link", false, false),
},
schema.SpawnStructRepresentationMap(nil),
))
Expand Down Expand Up @@ -251,6 +255,7 @@ func accumulateStateDataStructures(ts *schema.TypeSystem) {
| Receipt "rct"
| Account "state"
| Bytes "storage"
| Log "log"
} representation keyed

# Child union type used to handle the case where the node is stored directly in the parent node because it is smaller
Expand All @@ -262,7 +267,7 @@ func accumulateStateDataStructures(ts *schema.TypeSystem) {

type TrieExtensionNode struct {
PartialPath Bytes
Child Child
Child &TrieNode
}

type TrieLeafNode struct {
Expand All @@ -276,12 +281,14 @@ func accumulateStateDataStructures(ts *schema.TypeSystem) {
"Receipt",
"Account",
"Bytes",
"Log",
},
schema.SpawnUnionRepresentationKeyed(map[string]schema.TypeName{
"tx": "Transaction",
"rct": "Receipt",
"state": "Account",
"storage": "Bytes",
"log": "Log",
}),
))
ts.Accumulate(schema.SpawnUnion("Child",
Expand Down Expand Up @@ -319,10 +326,11 @@ func accumulateStateDataStructures(ts *schema.TypeSystem) {
ts.Accumulate(schema.SpawnStruct("TrieExtensionNode",
[]schema.StructField{
schema.SpawnStructField("PartialPath", "Bytes", false, false),
schema.SpawnStructField("Child", "Child", false, false),
schema.SpawnStructField("Child", "Link", false, false),
},
schema.SpawnStructRepresentationMap(nil),
))

ts.Accumulate(schema.SpawnStruct("TrieLeafNode",
[]schema.StructField{
schema.SpawnStructField("PartialPath", "Bytes", false, false),
Expand All @@ -348,7 +356,7 @@ func accumulateStateDataStructures(ts *schema.TypeSystem) {
type Account struct {
Nonce Uint
Balance Balance
StorageRootCID &StorageTrieNode
StorageRootCID &TrieNode
CodeCID &ByteCode
}
*/
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ go 1.15
require (
github.com/ethereum/go-ethereum v1.10.4
github.com/ipfs/go-cid v0.0.7
github.com/ipfs/go-ipfs-blockstore v1.0.4
github.com/ipfs/go-ipfs-ds-help v1.0.0
github.com/ipld/go-ipld-prime v0.10.0
github.com/multiformats/go-multihash v0.0.15
golang.org/dl v0.0.0-20210805175753-70f86bf65abd // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
)

replace github.com/ethereum/go-ethereum v1.10.4 => github.com/vulcanize/go-ethereum v1.10.4-ir-0.0.1
56 changes: 2 additions & 54 deletions go.sum

Large diffs are not rendered by default.

Loading