Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.

Commit 5943dc0

Browse files
author
Ommi Shimizu
authored
Merge pull request #1490 from hyperledger/bytesnn
Return bytesNN as Buffer and inline sources
2 parents fe242ae + a97046c commit 5943dc0

10 files changed

+34
-40
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# [Hyperledger Burrow](https://github.com/hyperledger/burrow) Changelog
2+
## [0.33.1] - 2021-05-24
3+
### Fixed
4+
- [JS] Return bytesNN as Buffer to agree with typings
5+
6+
### Added
7+
- [JS] Inline sources and source maps
8+
9+
210
## [0.33.0] - 2021-05-24
311
### Changed
412
- [JS] Changed Burrow interface and renamed Burrow client object to to Client (merging in features needed for solts support)
@@ -767,6 +775,7 @@ This release marks the start of Eris-DB as the full permissioned blockchain node
767775
- [Blockchain] Fix getBlocks to respect block height cap.
768776

769777

778+
[0.33.1]: https://github.com/hyperledger/burrow/compare/v0.33.0...v0.33.1
770779
[0.33.0]: https://github.com/hyperledger/burrow/compare/v0.32.1...v0.33.0
771780
[0.32.1]: https://github.com/hyperledger/burrow/compare/v0.32.0...v0.32.1
772781
[0.32.0]: https://github.com/hyperledger/burrow/compare/v0.31.3...v0.32.0

NOTES.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
### Changed
2-
- [JS] Changed Burrow interface and renamed Burrow client object to to Client (merging in features needed for solts support)
3-
41
### Fixed
5-
- [JS] Fixed RLP encoding extra leading zeros on uint64 (thanks Matthieu Vachon!)
6-
- [JS] Improved compatibility with legacy Solidity bytes types and padding conventions
7-
- [Events] Fixed Burrow event stream wrongly switching to streaming mode for block ranges that are available in state (when the latest block is an empty block - so not stored in state)
2+
- [JS] Return bytesNN as Buffer to agree with typings
83

94
### Added
10-
- [JS] Added Solidity-to-Typescript code generation support (merging in solts) - this provides helpers (build.ts, api.ts) to compile Solidity files into corresponding .abi.ts files that include types for functions, events, the ABI, and EVM bytecode, and includes bindings into Burrow JS to deploy and interact with contracts via Typescript/Javascript with strong static types
11-
- [JS] Improved interactions with events which can now be queried over any range and with strong types, see the listenerFor, reduceEvents, readEvents, and iterateEvents functions.
5+
- [JS] Inline sources and source maps
126

js/src/convert.ts

-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ function postDecode(arg: unknown, type: string): unknown {
6868
if (/address/.test(type)) {
6969
return recApply(unprefixedHexString, arg as NestedArray<string>);
7070
}
71-
if (bytesNN.test(type)) {
72-
// Handle bytes32 differently - for legacy reasons they are used as identifiers and represented as hex strings
73-
return recApply(unprefixedHexString, arg as NestedArray<string>);
74-
}
7571
if (/bytes/.test(type)) {
7672
return recApply(toBuffer, arg as NestedArray<string>);
7773
}

js/src/test/functional.test.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,9 @@ describe('Functional Contract Usage', function () {
4646
instance1.getCombination.at(address2)(),
4747
]);
4848

49-
const expected1 = [
50-
100,
51-
address1,
52-
'hello moto',
53-
'000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
54-
'88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F',
55-
];
56-
const expected2 = [
57-
100,
58-
address2,
59-
'hello moto',
60-
'000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
61-
'ABCDEFABCDEFABCDEFABCDEFABCDEFABCDEF0123',
62-
];
49+
const randomBytes = Buffer.from('000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE', 'hex');
50+
const expected1 = [100, address1, 'hello moto', randomBytes, '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F'];
51+
const expected2 = [100, address2, 'hello moto', randomBytes, 'ABCDEFABCDEFABCDEFABCDEFABCDEFABCDEF0123'];
6352
assert.deepStrictEqual([...ret1], expected1);
6453
assert.deepStrictEqual([...ret2], expected2);
6554
// Check we are assigning names to hybrid record/array Result object

js/src/test/get-set.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ contract GetSet {
6060
`;
6161

6262
const testUint = 42;
63-
const testBytes = 'DEADBEEF00000000000000000000000000000000000000000000000000000000';
63+
const testBytes = Buffer.from('DEADBEEF00000000000000000000000000000000000000000000000000000000', 'hex');
6464
const testString = 'Hello World!';
6565
const testBool = true;
6666

@@ -86,7 +86,7 @@ contract GetSet {
8686
it('Bytes', async () => {
8787
await TestContract.setBytes(testBytes);
8888
const output = await TestContract.getBytes();
89-
assert.strictEqual(output[0], testBytes);
89+
assert.deepStrictEqual(output[0], testBytes);
9090
});
9191

9292
it('String', async () => {

js/src/test/handler-overwriting.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ describe('Testing Per-contract handler overwriting', function () {
4141
});
4242
const address = getMetadata(instance).address;
4343
const returnObject = await instance.getCombination();
44+
const randomBytes = Buffer.from('000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE', 'hex');
4445
const expected = {
4546
values: {
4647
_number: 100,
4748
_address: address,
4849
_saying: 'hello moto',
49-
_randomBytes: '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
50+
_randomBytes: randomBytes,
5051
},
51-
raw: [100, address, 'hello moto', '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE'],
52+
raw: [100, address, 'hello moto', randomBytes],
5253
};
5354
assert.deepStrictEqual(returnObject, expected);
5455
});

js/src/test/return-types.test.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,15 @@ describe('Multiple return types', function () {
3636
};
3737
},
3838
});
39+
const randomBytes = Buffer.from('000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE', 'hex');
3940
const expected = {
4041
values: {
4142
_number: 100,
4243
_address: getAddress(instance),
4344
_saying: 'hello moto',
44-
_randomBytes: '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
45+
_randomBytes: randomBytes,
4546
},
46-
raw: [
47-
100,
48-
getAddress(instance),
49-
'hello moto',
50-
'000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
51-
],
47+
raw: [100, getAddress(instance), 'hello moto', randomBytes],
5248
};
5349
const result = await instance.getCombination();
5450
assert.deepStrictEqual(result, expected);

js/src/test/solts.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ describe('solts', () => {
3434
// Look ma, type narrowing!
3535
events.map((event) => {
3636
if (event.name === 'Init') {
37-
assert.strictEqual(event.payload.eventId, '6576656E74310000000000000000000000000000000000000000000000000000');
37+
const eventId = Buffer.from('6576656E74310000000000000000000000000000000000000000000000000000', 'hex');
38+
assert.deepStrictEqual(event.payload.eventId, eventId);
3839
} else if (event.name === 'MonoRampage') {
3940
assert.strictEqual(event.payload.timestamp, 123);
4041
}

js/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"preserveSymlinks": true,
66
"esModuleInterop": true,
77
"alwaysStrict": true,
8-
"sourceMap": true,
8+
"inlineSourceMap": true,
9+
"inlineSources": true,
910
"declaration": true,
1011
"strict": true,
1112
"noImplicitAny": true,

project/history.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ func FullVersion() string {
4747
// To cut a new release add a release to the front of this slice then run the
4848
// release tagging script: ./scripts/tag_release.sh
4949
var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "https://github.com/hyperledger/burrow").
50-
MustDeclareReleases("0.33.0 - 2021-05-24",
50+
MustDeclareReleases("0.33.1 - 2021-05-24",
51+
`### Fixed
52+
- [JS] Return bytesNN as Buffer to agree with typings
53+
54+
### Added
55+
- [JS] Inline sources and source maps
56+
`,
57+
"0.33.0 - 2021-05-24",
5158
`### Changed
5259
- [JS] Changed Burrow interface and renamed Burrow client object to to Client (merging in features needed for solts support)
5360

0 commit comments

Comments
 (0)