Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Fix encoding for account permissioning check call #1549

Merged
merged 1 commit into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,11 @@ private static BytesValue encodeLong(final long l) {

// A bytes array is a uint256 of its length, then the bytes that make up its value, then pad to
// next 32 bytes interval
// It needs to be preceded by the bytes offset of the first dynamic parameter (192 bytes)
private static BytesValue encodeBytes(final BytesValue value) {
final BytesValue dynamicParameterOffset = encodeLong(192);
final BytesValue length = encodeLong(value.size());
final BytesValue padding = BytesValue.wrap(new byte[(32 - (value.size() % 32))]);
return BytesValues.concatenate(length, value, padding);
return BytesValues.concatenate(dynamicParameterOffset, length, value, padding);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private Transaction transactionForAccount(final Address address) {
.value(Wei.ZERO)
.gasPrice(Wei.ZERO)
.gasLimit(0)
.payload(BytesValue.EMPTY)
.payload(BytesValue.fromHexString("0x1234"))
.nonce(1)
.signature(Signature.create(BigInteger.ONE, BigInteger.TEN, (byte) 1))
.build();
Expand Down