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

Commit

Permalink
Merge pull request #1490 from hyperledger/bytesnn
Browse files Browse the repository at this point in the history
Return bytesNN as Buffer and inline sources
  • Loading branch information
Ommi Shimizu authored May 24, 2021
2 parents fe242ae + a97046c commit 5943dc0
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 40 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# [Hyperledger Burrow](https://github.com/hyperledger/burrow) Changelog
## [0.33.1] - 2021-05-24
### Fixed
- [JS] Return bytesNN as Buffer to agree with typings

### Added
- [JS] Inline sources and source maps


## [0.33.0] - 2021-05-24
### Changed
- [JS] Changed Burrow interface and renamed Burrow client object to to Client (merging in features needed for solts support)
Expand Down Expand Up @@ -767,6 +775,7 @@ This release marks the start of Eris-DB as the full permissioned blockchain node
- [Blockchain] Fix getBlocks to respect block height cap.


[0.33.1]: https://github.com/hyperledger/burrow/compare/v0.33.0...v0.33.1
[0.33.0]: https://github.com/hyperledger/burrow/compare/v0.32.1...v0.33.0
[0.32.1]: https://github.com/hyperledger/burrow/compare/v0.32.0...v0.32.1
[0.32.0]: https://github.com/hyperledger/burrow/compare/v0.31.3...v0.32.0
Expand Down
10 changes: 2 additions & 8 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
### Changed
- [JS] Changed Burrow interface and renamed Burrow client object to to Client (merging in features needed for solts support)

### Fixed
- [JS] Fixed RLP encoding extra leading zeros on uint64 (thanks Matthieu Vachon!)
- [JS] Improved compatibility with legacy Solidity bytes types and padding conventions
- [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)
- [JS] Return bytesNN as Buffer to agree with typings

### Added
- [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
- [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.
- [JS] Inline sources and source maps

4 changes: 0 additions & 4 deletions js/src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ function postDecode(arg: unknown, type: string): unknown {
if (/address/.test(type)) {
return recApply(unprefixedHexString, arg as NestedArray<string>);
}
if (bytesNN.test(type)) {
// Handle bytes32 differently - for legacy reasons they are used as identifiers and represented as hex strings
return recApply(unprefixedHexString, arg as NestedArray<string>);
}
if (/bytes/.test(type)) {
return recApply(toBuffer, arg as NestedArray<string>);
}
Expand Down
17 changes: 3 additions & 14 deletions js/src/test/functional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,9 @@ describe('Functional Contract Usage', function () {
instance1.getCombination.at(address2)(),
]);

const expected1 = [
100,
address1,
'hello moto',
'000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
'88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F',
];
const expected2 = [
100,
address2,
'hello moto',
'000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
'ABCDEFABCDEFABCDEFABCDEFABCDEFABCDEF0123',
];
const randomBytes = Buffer.from('000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE', 'hex');
const expected1 = [100, address1, 'hello moto', randomBytes, '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F'];
const expected2 = [100, address2, 'hello moto', randomBytes, 'ABCDEFABCDEFABCDEFABCDEFABCDEFABCDEF0123'];
assert.deepStrictEqual([...ret1], expected1);
assert.deepStrictEqual([...ret2], expected2);
// Check we are assigning names to hybrid record/array Result object
Expand Down
4 changes: 2 additions & 2 deletions js/src/test/get-set.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract GetSet {
`;

const testUint = 42;
const testBytes = 'DEADBEEF00000000000000000000000000000000000000000000000000000000';
const testBytes = Buffer.from('DEADBEEF00000000000000000000000000000000000000000000000000000000', 'hex');
const testString = 'Hello World!';
const testBool = true;

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

it('String', async () => {
Expand Down
5 changes: 3 additions & 2 deletions js/src/test/handler-overwriting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ describe('Testing Per-contract handler overwriting', function () {
});
const address = getMetadata(instance).address;
const returnObject = await instance.getCombination();
const randomBytes = Buffer.from('000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE', 'hex');
const expected = {
values: {
_number: 100,
_address: address,
_saying: 'hello moto',
_randomBytes: '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
_randomBytes: randomBytes,
},
raw: [100, address, 'hello moto', '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE'],
raw: [100, address, 'hello moto', randomBytes],
};
assert.deepStrictEqual(returnObject, expected);
});
Expand Down
10 changes: 3 additions & 7 deletions js/src/test/return-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,15 @@ describe('Multiple return types', function () {
};
},
});
const randomBytes = Buffer.from('000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE', 'hex');
const expected = {
values: {
_number: 100,
_address: getAddress(instance),
_saying: 'hello moto',
_randomBytes: '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
_randomBytes: randomBytes,
},
raw: [
100,
getAddress(instance),
'hello moto',
'000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE',
],
raw: [100, getAddress(instance), 'hello moto', randomBytes],
};
const result = await instance.getCombination();
assert.deepStrictEqual(result, expected);
Expand Down
3 changes: 2 additions & 1 deletion js/src/test/solts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ describe('solts', () => {
// Look ma, type narrowing!
events.map((event) => {
if (event.name === 'Init') {
assert.strictEqual(event.payload.eventId, '6576656E74310000000000000000000000000000000000000000000000000000');
const eventId = Buffer.from('6576656E74310000000000000000000000000000000000000000000000000000', 'hex');
assert.deepStrictEqual(event.payload.eventId, eventId);
} else if (event.name === 'MonoRampage') {
assert.strictEqual(event.payload.timestamp, 123);
}
Expand Down
3 changes: 2 additions & 1 deletion js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"preserveSymlinks": true,
"esModuleInterop": true,
"alwaysStrict": true,
"sourceMap": true,
"inlineSourceMap": true,
"inlineSources": true,
"declaration": true,
"strict": true,
"noImplicitAny": true,
Expand Down
9 changes: 8 additions & 1 deletion project/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ func FullVersion() string {
// To cut a new release add a release to the front of this slice then run the
// release tagging script: ./scripts/tag_release.sh
var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "https://github.com/hyperledger/burrow").
MustDeclareReleases("0.33.0 - 2021-05-24",
MustDeclareReleases("0.33.1 - 2021-05-24",
`### Fixed
- [JS] Return bytesNN as Buffer to agree with typings
### Added
- [JS] Inline sources and source maps
`,
"0.33.0 - 2021-05-24",
`### Changed
- [JS] Changed Burrow interface and renamed Burrow client object to to Client (merging in features needed for solts support)
Expand Down

0 comments on commit 5943dc0

Please sign in to comment.