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

Realign 6.1.3 #825

Merged
merged 57 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
081bc4e
Release/6.0.2 (#741)
mpowaga Oct 31, 2019
66cef36
removed empty lines
tarasherasymchuk Oct 31, 2019
1f801ab
style(changelog): added whitespaces to separate changelog sections
tarasherasymchuk Oct 31, 2019
1128bbd
Feat(AENS): auction name fee calculation (#706)
nduchak Oct 8, 2019
6d4078e
refactor(AENS): refactor claim (#709)
nduchak Oct 10, 2019
deed7fc
feat(state channels): make state channels compatible with node v5.0.0…
mpowaga Oct 16, 2019
9725b08
Realign 6.0.0 (#719)
nduchak Oct 17, 2019
c8ebb76
Update libsodium-wrappers-sumo to the latest version 🚀 (#721)
greenkeeper[bot] Oct 22, 2019
4ff3345
Update commander to the latest version 🚀 (#743)
greenkeeper[bot] Nov 1, 2019
b580057
Update vue-loader in group default to the latest version 🚀 (#745)
greenkeeper[bot] Nov 4, 2019
13cdd07
Update rlp to the latest version 🚀 (#744)
greenkeeper[bot] Nov 4, 2019
4c1f5e4
fix(AENS): auction end block calculation (#746)
nduchak Nov 4, 2019
fd14225
fix(AENS): Fix `produceNameId` function(Make name lowercase). Enable …
nduchak Nov 4, 2019
bf11eb6
aensQuery: Fix default value of pointers field (#735)
davidyuk Nov 4, 2019
11d8055
Update @aeternity/aepp-sdk in group default to the latest version 🚀 (…
greenkeeper[bot] Nov 4, 2019
e0166c2
Remove extra eslint exceptions (#729)
davidyuk Nov 4, 2019
232e0ab
Update babel7 in group default to the latest version 🚀 (#754)
greenkeeper[bot] Nov 6, 2019
ddc6611
feat(state channels): allow to pass metadata to transfer update (#755)
mpowaga Nov 6, 2019
ae4426e
feat(state channels): allow off chain updates to be cancelled with cu…
mpowaga Nov 6, 2019
c5f35d1
fix(state channels): wait for connection to be established before sen…
mpowaga Nov 6, 2019
c950937
feat(state channels): add round method (#763)
mpowaga Nov 6, 2019
07cb0e7
feat(ACI): Add validation for contractAddress (#764)
nduchak Nov 6, 2019
5250e75
feat(AENS): Add nameFee validation to TxValidator (#765)
nduchak Nov 7, 2019
de83204
feat(Crypto): Implement asymmetric encoding/decoding using `tweennac…
nduchak Nov 7, 2019
12aaca3
feat(Contract): Add ability to pass arguments or callData for contrac…
nduchak Nov 7, 2019
ca8b467
Update babel7 in group default to the latest version 🚀 (#771)
greenkeeper[bot] Nov 11, 2019
c5f2582
feat(AENS): Increase default nameTtl (#775)
nduchak Nov 11, 2019
87062ea
feat(Http): Assign error object to http error (#770)
nduchak Nov 11, 2019
74952aa
feat(state channels): make state channels compatible with node v5.1.0…
mpowaga Nov 11, 2019
06129de
docs(Examples): Fix contract example (#778)
nduchak Nov 11, 2019
777c012
fix(TxHelpers): Use BigNumber in auction end block calculation
nduchak Nov 11, 2019
a3e78d3
docs(Helpers): Add missed jsdocs
nduchak Nov 11, 2019
65b3111
chore(release): Bump version. Regenerate docs and CHANGELOG
nduchak Nov 11, 2019
2edf518
Merge pull request #779 from aeternity/release/6.1.0
nduchak Nov 11, 2019
233ce3a
removed empty lines
tarasherasymchuk Oct 31, 2019
3fe875e
style(changelog): added whitespaces to separate changelog sections
tarasherasymchuk Oct 31, 2019
3afef67
feat(Crypto): Implement asymmetric encoding/decoding using `tweennac…
nduchak Nov 7, 2019
545af20
feat(Http): Assign error object to http error (#770)
nduchak Nov 11, 2019
fcf6b1d
docs(Examples): Fix contract example (#778)
nduchak Nov 11, 2019
c18047e
feat(KeyStore): Remove `argon2` package, use `libsodium` for both bro…
nduchak Nov 12, 2019
fe6021b
fix(ACI): Disable bytecode check for source and code on-chain (#783)
nduchak Nov 12, 2019
6b0af4e
chore(release): Regenerate docs
nduchak Nov 12, 2019
39d3625
Merge pull request #785 from aeternity/release/6.1.1
nduchak Nov 12, 2019
9ac705f
fix(Composition): Chain composition
nduchak Nov 12, 2019
d43ca5a
fix(Composition): Chain composition
nduchak Nov 12, 2019
e8aaed8
Merge remote-tracking branch 'origin/hotfix/chain-composition' into h…
nduchak Nov 12, 2019
d0a29ff
Merge pull request #789 from aeternity/hotfix/chain-composition
nduchak Nov 12, 2019
4be8eb8
fix(Channel): 5.2.0 compatibility
nduchak Dec 11, 2019
5dd2fc1
Fix lint error
mpowaga Dec 11, 2019
d4d8767
chore(release): Bump version. Generate CHANGELOG
nduchak Dec 11, 2019
da747c0
Fix internal.js
mpowaga Dec 11, 2019
b5642bf
Merge branch 'fix/channel-5.2.0-compatibility' of https://github.com/…
mpowaga Dec 11, 2019
d738d9f
chore(release): Point docker to node 5.2.0
nduchak Dec 11, 2019
6296133
Merge remote-tracking branch 'origin/fix/channel-5.2.0-compatibility'…
nduchak Dec 11, 2019
178b662
Merge pull request #823 from aeternity/fix/channel-5.2.0-compatibility
shekhar-shubhendu Dec 11, 2019
c24df3e
Merge branch 'master' into realign/6.1.3
nduchak Dec 11, 2019
82af04b
fix(.env): Fix env name
nduchak Dec 11, 2019
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
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NODE_TAG=v5.1.0
NODE_TAG=v5.2.0
COMPILER_TAG=v4.1.0
16 changes: 9 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [6.1.3](https://github.com/aeternity/aepp-sdk-js/compare/6.1.2...6.1.3) (2019-12-11)


### Bug Fixes

* **Channel:** 5.2.0 compatibility ([4be8eb8](https://github.com/aeternity/aepp-sdk-js/commit/4be8eb8))



## [6.1.2](https://github.com/aeternity/aepp-sdk-js/compare/6.1.1...6.1.2) (2019-11-12)


Expand Down Expand Up @@ -66,13 +75,6 @@










# [6.0.0](https://github.com/aeternity/aepp-sdk-js/compare/4.7.0...6.0.0) (2019-10-16)


Expand Down
7 changes: 7 additions & 0 deletions docs/api/channel/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Channel from '@aeternity/aepp-sdk/es/channel/index'
* [~state()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..state) ⇒ `Promise.<Object>`
* [~round()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..round) ⇒ `Number`
* [~id()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..id) ⇒ `String`
* [~fsmId()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..fsmId) ⇒ `String`
* [~update(from, to, amount, sign, metadata)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..update) ⇒ `Promise.<Object>`
* [~poi(addresses)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..poi) ⇒ `Promise.<String>`
* [~balances(accounts)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..balances) ⇒ `Promise.<Object>`
Expand Down Expand Up @@ -151,6 +152,12 @@ it will return `null`.
#### Channel~id() ⇒ `String`
Get channel id

**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel)
<a id="module_@aeternity/aepp-sdk/es/channel/index--Channel..fsmId"></a>

#### Channel~fsmId() ⇒ `String`
Get channel's fsm id

**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel)
<a id="module_@aeternity/aepp-sdk/es/channel/index--Channel..update"></a>

Expand Down
12 changes: 10 additions & 2 deletions es/channel/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
send,
emit,
channelId,
disconnect
disconnect,
fsmId
} from './internal'
import { unpackTx, buildTx } from '../tx/builder'

Expand Down Expand Up @@ -67,6 +68,10 @@ export function awaitingConnection (channel, message, state) {
if (message.params.data.event === 'channel_reestablished') {
return { handler: awaitingOpenConfirmation }
}
if (message.params.data.event === 'fsm_up') {
fsmId.set(channel, message.params.data.fsm_id)
return { handler: awaitingConnection }
}
return { handler: awaitingConnection }
}
if (message.method === 'channels.error') {
Expand All @@ -78,6 +83,7 @@ export function awaitingConnection (channel, message, state) {
export async function awaitingReconnection (channel, message, state) {
if (message.method === 'channels.info') {
if (message.params.data.event === 'fsm_up') {
fsmId.set(channel, message.params.data.fsm_id)
changeState(channel, (await call(channel, 'channels.get.offchain_state', {})).signed_tx)
return { handler: channelOpen }
}
Expand Down Expand Up @@ -175,14 +181,16 @@ export async function channelOpen (channel, message, state) {
case 'deposit_locked':
case 'peer_disconnected':
case 'channel_reestablished':
case 'fsm_up':
case 'open':
// TODO: Better handling of peer_disconnected event.
//
// We should enter intermediate state where offchain transactions
// are blocked until channel is reestablished.
emit(channel, message.params.data.event)
return { handler: channelOpen }
case 'fsm_up':
fsmId.set(channel, message.params.data.fsm_id)
return { handler: channelOpen }
case 'close_mutual':
return { handler: channelOpen }
case 'closing':
Expand Down
13 changes: 12 additions & 1 deletion es/channel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import {
send,
channelId,
call,
disconnect as channelDisconnect
disconnect as channelDisconnect,
fsmId as channelFsmId
} from './internal'
import * as R from 'ramda'

Expand Down Expand Up @@ -136,6 +137,15 @@ function id () {
return channelId.get(this)
}

/**
* Get channel's fsm id
*
* @return {String}
*/
function fsmId () {
return channelFsmId.get(this)
}

/**
* Trigger a transfer update
*
Expand Down Expand Up @@ -783,6 +793,7 @@ const Channel = AsyncInit.compose({
state,
round,
id,
fsmId,
update,
poi,
balances,
Expand Down
10 changes: 4 additions & 6 deletions es/channel/internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ import { EventEmitter } from 'events'
import * as R from 'ramda'
import JSONBig from '../utils/json-big'
import { pascalToSnake } from '../utils/string'
import {
awaitingConnection,
awaitingReconnection,
channelOpen
} from './handlers'
import { awaitingConnection, awaitingReconnection, channelOpen } from './handlers'

// Send ping message every 10 seconds
const PING_TIMEOUT_MS = 10000
Expand All @@ -46,6 +42,7 @@ const channelId = new WeakMap()
const rpcCallbacks = new WeakMap()
const pingTimeoutId = new WeakMap()
const pongTimeoutId = new WeakMap()
const fsmId = new WeakMap()

function channelURL (url, params) {
const paramString = R.join('&', R.values(R.mapObjIndexed((value, key) =>
Expand Down Expand Up @@ -268,5 +265,6 @@ export {
enqueueAction,
channelId,
call,
disconnect
disconnect,
fsmId
}
43 changes: 30 additions & 13 deletions test/integration/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1065,19 +1065,35 @@ describe('Channel', function () {
result.accepted.should.be.true
const channelId = await initiatorCh.id()
const round = initiatorCh.round()
initiatorCh.disconnect()
const ch = await Channel.reconnect({
...sharedParams,
role: 'initiator',
port: 3006,
sign: initiatorSign
}, {
channelId,
round,
role: 'initiator',
pubkey: await initiator.address()
})
await waitForChannel(ch)
let ch
if (majorVersion > 5 || (majorVersion === 5 && minorVersion >= 2)) {
const fsmId = initiatorCh.fsmId()
initiatorCh.disconnect()
ch = await Channel({
url: sharedParams.url,
host: sharedParams.host,
port: 3006,
role: 'initiator',
existingChannelId: channelId,
existingFsmId: fsmId
})
await waitForChannel(ch)
ch.fsmId().should.equal(fsmId)
} else {
initiatorCh.disconnect()
ch = await Channel.reconnect({
...sharedParams,
role: 'initiator',
port: 3006,
sign: initiatorSign
}, {
channelId,
round,
role: 'initiator',
pubkey: await initiator.address()
})
await waitForChannel(ch)
}
// TODO: why node doesn't return signed_tx when channel is reestablished?
// await new Promise((resolve) => {
// const checkRound = () => {
Expand All @@ -1089,6 +1105,7 @@ describe('Channel', function () {
// ch.on('stateChanged', checkRound)
// })
ch.state().should.eventually.be.fulfilled
await new Promise(resolve => setTimeout(resolve, 10 * 1000))
})

it('can post backchannel update', async () => {
Expand Down