Skip to content

Commit

Permalink
bug fix: AVM contract storage incorrectly encoded
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandraRoatis committed Apr 10, 2019
1 parent 380d2e3 commit 0d313cb
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,15 @@ public byte[] getEncoded() {

byte[] rlpAddress = RLP.encodeElement(address.toBytes());
byte[] rlpIsExternalStorage = RLP.encodeByte((byte) (externalStorage ? 1 : 0));
byte[] rlpStorageRoot =
RLP.encodeElement(
externalStorage ? storageTrie.getRootHash() : EMPTY_BYTE_ARRAY);
byte[] rlpStorageRoot;
// encoding for AVM
if (vmType == TransactionTypes.AVM_CREATE_CODE) {
rlpStorageRoot = RLP.encodeElement(computeAvmStorageHash());
} else {
rlpStorageRoot =
RLP.encodeElement(
externalStorage ? storageTrie.getRootHash() : EMPTY_BYTE_ARRAY);
}
byte[] rlpStorage =
RLP.encodeElement(externalStorage ? EMPTY_BYTE_ARRAY : storageTrie.serialize());
byte[][] codes = new byte[getCodes().size()][];
Expand Down

0 comments on commit 0d313cb

Please sign in to comment.