Skip to content

Conversation

@rjl493456442
Copy link
Member

In trie/types package, a few node wrappers are defined, which will be used
in both trie package, trie/snap package, etc. Therefore, a standalone common
package is created to place these stuffs.

In trie/types package, a few node wrappers are defined, which will be used
in both trie package, trie/snap package, etc. Therefore, a standalone common
package is created to put these stuffs.
@karalabe
Copy link
Member

Hmm, this seems a bit leaky to all of a sudden have trie depend on core/types. The core/types are very high level stuff vs the trie is a low level data structure. If you want to separate the nodes into their own package, perhaps have them in trie/types? Or can't trie/snap depend on trie?

@fjl
Copy link
Contributor

fjl commented Apr 25, 2023

The new package is not core/types, it's trie/types. The name isn't perfect though, types is too generic.
Depending on what else will be in this package, we could call it

  • trie/trienode if only node types will be there
  • trie/triedb if other database-related types will be added to this package later

@rjl493456442
Copy link
Member Author

@karalabe Yes, I define stuffs in trie/types.

Or can't trie/snap depend on trie?

trie/snap will be imported by trie package, because trie.DatabaseWrapper is in trie package. And these types in trie/types will be used by trie(nodeset) and trie/snap. So we need another separate package.

@fjl I prefer trie/trienode. I expect this package will only be used to place some very common stuffs, like node wrapper. I think this name is more suitable.

@fjl
Copy link
Contributor

fjl commented Apr 25, 2023

Very nice! Let's go with trie/trienode then!

@rjl493456442
Copy link
Member Author

What about trie/nodes then? Feel like trie/trienode is a bit too long. e.g. n *trienode.NodeWithPrev. But if you feel trie/nodes is also too general then I am fine with it.

@fjl
Copy link
Contributor

fjl commented Apr 25, 2023

When the package name is trienode, the type names can be shorter and do not need to contain Node.
So you can have a type name like *trienode.WithPrev.

@fjl
Copy link
Contributor

fjl commented Apr 25, 2023

Maybe trienode.Node is acceptable though?

If not, we can use trienode.Enc (encoded node) or trienode.Hashed (because it contains encoded + hash).

@rjl493456442
Copy link
Member Author

Updated.

@karalabe karalabe added this to the 1.11.7 milestone Apr 26, 2023
Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@karalabe karalabe merged commit 5d3f580 into ethereum:master Apr 26, 2023
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
* trie: add node type common package

In trie/types package, a few node wrappers are defined, which will be used
in both trie package, trie/snap package, etc. Therefore, a standalone common
package is created to put these stuffs.

* trie: rename trie/types to trie/trienode
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
* trie: add node type common package

In trie/types package, a few node wrappers are defined, which will be used
in both trie package, trie/snap package, etc. Therefore, a standalone common
package is created to put these stuffs.

* trie: rename trie/types to trie/trienode
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jun 25, 2025
* trie: add node type common package

In trie/types package, a few node wrappers are defined, which will be used
in both trie package, trie/snap package, etc. Therefore, a standalone common
package is created to put these stuffs.

* trie: rename trie/types to trie/trienode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants