Skip to content

Commit

Permalink
feat(state channels): make state channels compatible with node v5.0.0… (
Browse files Browse the repository at this point in the history
#688)

* feat(Lima): Create Lima branch

* feat(Compiler): Compiler 4.0.0 compatibility (#632)

* feat(newCompiler): Increase compiler version. Add `backend` option to compiler API

* fix(TX): Add fate vm version

* feat(Contract): Make Contract works with node 5.0.0 rc1 (lima hard-fork) and compiler 4.0.0 rc2

* chore(test): Debug channel test

* fix(channel): fix contract in channel test

* chore(test): Remove logs

* feat(ACI): Add `payable` to contract call

* feat(ACI): Add test for payable

* fix(Linter): Fix linter error

* feat(Compiler): Point to compiler 3.2.0. Improve `payble` to support old compiler

* feat(Compiler): disable payable test

* feat(Lima): Point compiler to 4.0.0. Enable tests for `payable`

* feat(Lima): Make contact for channel test payable

* chore(test): Enable tests

* feat(Contract/ACI): Add ability to use contract with external deps(`include "someLib"`) (#653)

* docs(Contract): Adjust contract docs (#658)

* Release 4.7.0-next.1 (#660)

* chore(release): Generate CHANGELOG. Bump version

* chore(test): Test backward compatibility

* chore(test): revert

* feat(SCHEMA): Add fate constants

* chore(release): bump version to 5.0.0-next.1

* feat(Lima): add check for compiler <-> consensus protocol version check

* feat(Lima): add check for abi/vm <-> backend(FATE/AEVM) (#680)

* feat(Lima): add check for abi/vm <-> backend(FATE/AEVM)

* feat(Lima): add check for abi/vm <-> backend(FATE/AEVM)

* feat(Contract): Add fate tests

* feat(Contract): enable all tests

* feat(Node): Add check in dry-run endpoint(node cross compatibility)

* feat(Contract): enable all tests

* feat(Contract): enable all tests

* feat(Contract): fix docker file run command

* feat(Swagger): Resolve refs

* feat(tests): Skip Channel and AENS

* feat(Node): Change compatibility range from 4.x.x to 5.x.x

* feat(Node): Change compatibility range from 4.x.x to 6.0.0

* fix(Oracle): fix abi field resolving

* chrome(build): Regenerate lock

* feat(state channels): make state channels compatible with node v5.0.0-rc.2

* feat(Compiler): make FATE by default (#693)

* feat(Contract): Use FATE by default

* Fix lint error

* feat(AENS): Lima compatibility (#687)

* Aens lima compatibility

* Make aens cross compatible with pre-lima releases

* Remove .only

* Fix native build of claim tx test

* feat(GA): Make GA compatible with Lima. Add cross compiler compatibility

* fix(Test): Fix test for cross compatibility. Add test for AEVM

* fix(AE): Add pointers verification for spend by name. Improve AENS cross node tests

* build(Node): Point node to 5.0.0-rc3

* Change node version to v5.0.0-rc.3

* Fix test

* Fix channel contracts tests
  • Loading branch information
mpowaga authored and nduchak committed Oct 16, 2019
1 parent c1854bf commit 23936f5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1080,4 +1080,4 @@ fix(AEP exampe): Fix contract in AEPP example
### Bug Fixes
* **Chore** More consistent code examples
* **Chore** More consistent code examples
3 changes: 3 additions & 0 deletions docs/api/ae/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ Compile contract source code
| source | `String` | | Contract sourece code |
| [options] | `Object` | <code>{}</code> | Transaction options (fee, ttl, gas, amount, deposit) |
| [options.filesystem] | `Object` | <code>{}</code> | Contract external namespaces map* @return {Promise<Object>} Result object |
<<<<<<< HEAD
=======
| [options.backend] | `Object` | <code>&#x27;aevm&#x27;</code> | Contract backend version (aevm|fate) |
>>>>>>> develop

**Example**
```js
Expand Down
2 changes: 2 additions & 0 deletions es/channel/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ export async function channelOpen (channel, message, state) {
case 'died':
changeStatus(channel, 'died')
return { handler: channelClosed }
case 'shutdown':
return { handler: channelOpen }
}
break
case 'channels.on_chain_tx':
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions test/integration/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const wsUrl = process.env.TEST_WS_URL || 'ws://localhost:3014/channel'
plan(BigNumber('1000e18').toString())

const identityContract = `
payable contract Identity =
payable entrypoint main(x : int): int = x
contract Identity =
entrypoint main(x : int) : int = x
`

function waitForChannel (channel) {
Expand Down Expand Up @@ -73,7 +73,8 @@ describe.skip('Channel', function () {
ttl: 10000,
host: 'localhost',
port: 3001,
lockPeriod: 1
lockPeriod: 1,
statePassword: 'correct horse battery staple'
}

before(async function () {
Expand Down Expand Up @@ -735,24 +736,24 @@ describe.skip('Channel', function () {
sign: responderSign
})
await Promise.all([waitForChannel(initiatorCh), waitForChannel(responderCh)])
const code = await initiator.compileContractAPI(identityContract)
const callData = await initiator.contractEncodeCallDataAPI(identityContract, 'init', [])
const code = await initiator.compileContractAPI(identityContract, { backend: 'aevm' })
const callData = await initiator.contractEncodeCallDataAPI(identityContract, 'init', [], { backend: 'aevm' })
const result = await initiatorCh.createContract({
code,
callData,
deposit: 1000,
vmVersion: 4,
vmVersion: 6,
abiVersion: 1
}, async (tx) => initiator.signTransaction(tx))
result.should.eql({ accepted: true, address: result.address, signedTx: (await initiatorCh.state()).signedTx })
contractAddress = result.address
contractEncodeCall = (method, args) => initiator.contractEncodeCallDataAPI(identityContract, method, args)
contractEncodeCall = (method, args) => initiator.contractEncodeCallDataAPI(identityContract, method, args, { backend: 'aevm' })
})

it('can create a contract and reject', async () => {
responderShouldRejectUpdate = true
const code = await initiator.compileContractAPI(identityContract)
const callData = await initiator.contractEncodeCallDataAPI(identityContract, 'init', [])
const code = await initiator.compileContractAPI(identityContract, { backend: 'aevm' })
const callData = await initiator.contractEncodeCallDataAPI(identityContract, 'init', [], { backend: 'aevm' })
const result = await initiatorCh.createContract({
code,
callData,
Expand Down Expand Up @@ -808,7 +809,7 @@ describe.skip('Channel', function () {

it('can call a contract using dry-run', async () => {
const result = await initiatorCh.callContractStatic({
amount: BigNumber('2e18'),
amount: 0,
callData: await contractEncodeCall('main', ['42']),
contract: contractAddress,
abiVersion: 1
Expand All @@ -834,7 +835,7 @@ describe.skip('Channel', function () {
caller: await initiator.address(),
contract: contractAddress,
round: callerNonce
}).should.eventually.be.rejectedWith('Rejected: Call not found')
}).should.eventually.be.rejected
})

it('can get contract state', async () => {
Expand All @@ -847,7 +848,7 @@ describe.skip('Channel', function () {
id: contractAddress,
ownerId: await initiator.address(),
referrerIds: [],
vmVersion: 4
vmVersion: 6
},
contractState: result.contractState
})
Expand Down

0 comments on commit 23936f5

Please sign in to comment.