Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion execution_chain/db/aristo/aristo_desc/desc_identifiers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func hash*(a: HashKey): Hash =

func append*(w: var RlpWriter; key: HashKey) =
if 1 < key.len and key.len < 32:
w.appendRawBytes key.data
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chirag-parmar Do you know of any reason why this might be encoding values as a list rather than a blob?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the code that decodes the trie nodes and expects a blob to be present in each of the branch node indexes, not a list:

link = rlpNode.listElem(path[0].int).toBytes

Copy link
Contributor

Choose a reason for hiding this comment

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

This is weird.

All I can say is that HashKey is being encoded as a list because the overloading resolution algorithm at the time of compilation uses the generic method defined here https://github.com/status-im/nim-eth/blob/master/eth/rlp/writer.nim#L202 for serializing it. At the time of compilation, for some unknown reason, it doesn't mixin the append method defined in desc_identifiers.nim.

I have been facing a similar issue #3572. Even here, the score gets serialized as a list (because it is an object: UInt256) UNLESS I include that one magical line of code.

So I think the change you made has nothing to do with the incorrect serialization. This is just my educated guess (even writeBlob calls appendRawBytes internally)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is weird.

All I can say is that HashKey is being encoded as a list because the overloading resolution algorithm at the time of compilation uses the generic method defined here https://github.com/status-im/nim-eth/blob/master/eth/rlp/writer.nim#L202 for serializing it. At the time of compilation, for some unknown reason, it doesn't mixin the append method defined in desc_identifiers.nim.

I have been facing a similar issue #3572. Even here, the score gets serialized as a list (because it is an object: UInt256) UNLESS I include that one magical line of code.

So I think the change you made has nothing to do with the incorrect serialization. This is just my educated guess (even writeBlob calls appendRawBytes internally)

I see, well thanks for the info. I'll keep looking into it as it would be good to know definitively the root cause.

w.writeBlob key.data
else:
w.append key.data

Expand Down
Loading