Skip to content

Commit

Permalink
Merge pull request #270 from /issues/269
Browse files Browse the repository at this point in the history
issues/269 - Fixed byte serialisation of StoredVersionedContractByHash
  • Loading branch information
cnorburn authored Apr 25, 2024
2 parents b14e111 + 6aa3c41 commit e6f90d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import dev.oak3.sbs4j.SerializerBuffer;
import lombok.*;
import org.bouncycastle.util.encoders.Hex;

import java.util.List;

Expand Down Expand Up @@ -41,6 +42,6 @@ public byte getOrder() {

@Override
protected void serializeCustom(final SerializerBuffer ser) {
ser.writeString(getHash());
ser.writeByteArray(Hex.decode(getHash()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void serializeStoredVersionedContractByHashTest() throws Exception {

final SerializerBuffer serializerBuffer = new SerializerBuffer();
versionedContractByHash.serialize(serializerBuffer, Target.BYTE);
final String expectedBytes = "0340000000393231373364343937343463373930643437653530643031316438396531623561333365643264396661653864393435393332353232346438663938663365350101000000080000007472616e7366657202000000030000006f6e650400000001000000010300000074776f040000000200000001";
final String expectedBytes = "0392173d49744c790d47e50d011d89e1b5a33ed2d9fae8d9459325224d8f98f3e50101000000080000007472616e7366657202000000030000006f6e650400000001000000010300000074776f040000000200000001";
final String actual = Hex.encode(serializerBuffer.toByteArray());
assertThat(actual, is(expectedBytes));
}
Expand Down

0 comments on commit e6f90d8

Please sign in to comment.