Update templateId type in agreement hash, fix signature and consumeasset tests. Update readme file regarding running integration tests.

This commit is contained in:
ssallam 2020-01-20 11:44:13 +01:00
parent aae8172993
commit 9fe9422ff7
5 changed files with 16 additions and 5 deletions

View File

@ -160,6 +160,8 @@ export SEED_WORDS="taxi music thumb unique chat sand crew more leg another off l
Once everything is up, run the integration tests:
```bash
# integration tests work with the spree network and the SEED_WORDS in previous step are required.
# Make sure to reset `ETH_PORT` to 8545 (or whatever port is used in `spree1)
npm run integration
```

View File

@ -97,6 +97,9 @@ describe('Consume Asset', () => {
})
it('should get the agreement conditions status not fulfilled', async () => {
// Wait for the agreement event
await ocean.keeper.agreementStoreManager
.getAgreementCreatedEvent(serviceAgreementSignatureResult.agreementId).once()
const status = await ocean.agreements.status(
serviceAgreementSignatureResult.agreementId
)

View File

@ -18,7 +18,7 @@ describe('Signature', () => {
})
it('hashServiceAgreement should generate the correct signature', () => {
const templateId = `0x${'f'.repeat(40)}`
const templateId = `0x${'f'.repeat(64)}`
const agreementId = `0x${'e'.repeat(64)}`
const accessId = `0x${'a'.repeat(64)}`
@ -35,7 +35,7 @@ describe('Signature', () => {
assert.equal(
hash,
'0x67901517c18a3d23e05806fff7f04235cc8ae3b1f82345b8bfb3e4b02b5800c7',
'0x464dac3b79a47f8acad54f67a0f4473249330f025c69687531e58c2e43b36437',
'The signature is not correct.'
)
})
@ -44,7 +44,7 @@ describe('Signature', () => {
const { templates } = ocean.keeper
const did = `did:op:${'c'.repeat(64)}`
const templateId = `0x${'f'.repeat(40)}`
const templateId = `0x${'f'.repeat(64)}`
const agreementId = `0x${'e'.repeat(64)}`
const serviceAgreementTemplate = await templates.escrowAccessSecretStoreTemplate.getServiceAgreementTemplate()
@ -84,7 +84,7 @@ describe('Signature', () => {
assert.equal(
signature,
'0x3aa8a1c48b8e582d694bbd4ba3a29fde573b78da9720dc48baeb831b2163e1fa6e10e983882ebf8a00f4124de2505136354fd146934053f0d58bba4eced5f8d01b',
'0xa04568fccdda7e1594e3e615f8d71b14733705aabe5294af0b7f46f0aedb9d5906a2caa6142ee4de10534a47c5a7083b21b2d3e9a96ac462bc0b9d25070e981e1c',
'The signature is not correct.'
)
})

View File

@ -149,6 +149,12 @@ export class OceanAgreements extends Instantiable {
const { templateId } = await this.ocean.keeper.agreementStoreManager.getAgreement(
agreementId
)
if (templateId === `0x${'0'.repeat(64)}`) {
console.error('agreement is not found: ' + agreementId + ' ' + templateId)
return
}
const fullStatus = await this.ocean.keeper
.getTemplateById(templateId)
.getAgreementStatus(agreementId, this.ocean.keeper.conditionStoreManager)

View File

@ -76,7 +76,7 @@ export class ServiceAgreement extends Instantiable {
timeouts: number[]
): string {
const args: any = [
{ type: 'address', value: zeroX(serviceAgreementTemplateId) },
{ type: 'bytes32', value: zeroX(serviceAgreementTemplateId) },
{ type: 'bytes32[]', value: valueHashes.map(zeroX) },
{ type: 'uint256[]', value: timelocks },
{ type: 'uint256[]', value: timeouts },