Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add new testcase for odd length address #8

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

geoknee
Copy link
Contributor

@geoknee geoknee commented Oct 9, 2020

hashState › Odd-length appData state
@statechannels/native-utils:     RuntimeError: unreachable
@statechannels/native-utils:         at wasm-function[241]:0x44a8e
@statechannels/native-utils:         at wasm-function[318]:0x46f69
@statechannels/native-utils:         at wasm-function[336]:0x4731f
@statechannels/native-utils:         at wasm-function[277]:0x46155
@statechannels/native-utils:         at wasm-function[181]:0x40af2
@statechannels/native-utils:         at wasm-function[346]:0x47495
@statechannels/native-utils:       253 |   test('Odd-length appData state', () => {
@statechannels/native-utils:       254 |     const oddLengthAppDataState = { ...DEFAULT_STATE, appData: '0x0' }
@statechannels/native-utils:     > 255 |     expect(native.hashState(oddLengthAppDataState)).toStrictEqual(
@statechannels/native-utils:           |                   ^
@statechannels/native-utils:       256 |       nitro.hashState(oddLengthAppDataState),
@statechannels/native-utils:       257 |     )
@statechannels/native-utils:       258 |     expect(wasm.hashState(oddLengthAppDataState)).toStrictEqual(
@statechannels/native-utils:       at Object.module.exports.hashState (node_modules/@statechannels/wasm-utils/wasm_utils.js:143:24)
@statechannels/native-utils:       at Object.<anonymous> (tests/hash.test.ts:255:19)

@geoknee
Copy link
Contributor Author

geoknee commented Oct 9, 2020

For context, the nitro-protocol function also throws an error with this input, but at least it provides a decent error message, bubbled up from ethers:

hex data is odd-length (argument="value", value="0x0", code=INVALID_ARGUMENT, version=bytes/5.0.4)

If the wasm function did the same thing, I would be happy.

@Jannis
Copy link
Contributor

Jannis commented Oct 12, 2020

I tried to get this to work but failed. I'll give it another shot when I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants