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

State proof fixes #736

Merged
merged 2 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e/service/StateProofService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { NamespaceRegistrationType } from '../../src/model/namespace';
import { StateMerkleProof } from '../../src/model/state';
import { StateProofService } from '../../src/service';

const url = 'http://api-01.us-west-2.0.10.0.x.symboldev.network:3000';
const url = 'http://localhost:3000';
const repositoryFactory = new RepositoryFactoryHttp(url);
const service = new StateProofService(repositoryFactory);
const stateCounts = 50;
Expand All @@ -46,7 +46,7 @@ async function test<E, C extends SearchCriteria>(
try {
const merkle = await merkleMethod(info).toPromise();
expect(merkle).to.not.undefined;
if (merkle.valid) console.log(stateUrl + ' ' + merkle.valid);
if (merkle.valid) console.log(stateUrl + ' ' + merkle.valid + ' ' + merkle.stateHash);
else {
console.error(stateUrl + ' ' + merkle.valid);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils/DtoMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class DtoMapping {
*/
public static extractAccountRestrictionFromDto(accountRestrictions: AccountRestrictionsInfoDTO): AccountRestrictions {
return new AccountRestrictions(
accountRestrictions.accountRestrictions.version,
accountRestrictions.accountRestrictions.version || 1,
accountRestrictions['id'],
Address.createFromEncoded(accountRestrictions.accountRestrictions.address),
accountRestrictions.accountRestrictions.restrictions.map((prop) => {
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/AccountHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class AccountHttp extends Http implements AccountRepository {
*/
public static toAccountInfo(dto: AccountInfoDTO): AccountInfo {
return new AccountInfo(
dto.account.version,
dto.account.version || 1,
dto.id,
Address.createFromEncoded(dto.account.address),
UInt64.fromNumericString(dto.account.addressHeight),
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/HashLockHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class HashLockHttp extends Http implements HashLockRepository {
*/
private toHashLockInfo(dto: HashLockInfoDTO): HashLockInfo {
return new HashLockInfo(
dto.lock.version,
dto.lock.version || 1,
dto.id,
Address.createFromEncoded(dto.lock.ownerAddress),
new MosaicId(dto.lock.mosaicId),
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/MetadataHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class MetadataHttp extends Http implements MetadataRepository {
return new Metadata(
metadata.id,
new MetadataEntry(
metadataEntry.version,
metadataEntry.version || 1,
metadataEntry.compositeHash,
Address.createFromEncoded(metadataEntry.sourceAddress),
Address.createFromEncoded(metadataEntry.targetAddress),
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/MosaicHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class MosaicHttp extends Http implements MosaicRepository {
*/
public static toMosaicInfo(mosaicInfo: MosaicInfoDTO): MosaicInfo {
return new MosaicInfo(
mosaicInfo.mosaic.version,
mosaicInfo.mosaic.version || 1,
mosaicInfo.id,
new MosaicId(mosaicInfo.mosaic.id),
UInt64.fromNumericString(mosaicInfo.mosaic.supply),
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/MultisigHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class MultisigHttp extends Http implements MultisigRepository {
*/
private toMultisigAccountInfo(dto: MultisigAccountInfoDTO): MultisigAccountInfo {
return new MultisigAccountInfo(
dto.multisig.version,
dto.multisig.version || 1,
Address.createFromEncoded(dto.multisig.accountAddress),
dto.multisig.minApproval,
dto.multisig.minRemoval,
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/NamespaceHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class NamespaceHttp extends Http implements NamespaceRepository {
*/
private toNamespaceInfo(dto: NamespaceInfoDTO): NamespaceInfo {
return new NamespaceInfo(
dto.namespace.version,
dto.namespace.version || 1,
dto.meta.active,
dto.meta.index,
dto.id,
Expand Down
4 changes: 2 additions & 2 deletions src/infrastructure/RestrictionMosaicHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class RestrictionMosaicHttp extends Http implements RestrictionMosaicRepo
if ((dto.mosaicRestrictionEntry as any).targetAddress) {
const addressRestrictionDto = dto as MosaicAddressRestrictionDTO;
return new MosaicAddressRestriction(
dto.mosaicRestrictionEntry.version,
dto.mosaicRestrictionEntry.version || 1,
dto.mosaicRestrictionEntry.compositeHash,
dto.mosaicRestrictionEntry.entryType.valueOf(),
new MosaicId(dto.mosaicRestrictionEntry.mosaicId),
Expand All @@ -107,7 +107,7 @@ export class RestrictionMosaicHttp extends Http implements RestrictionMosaicRepo

const globalRestrictionDto = dto as MosaicGlobalRestrictionDTO;
return new MosaicGlobalRestriction(
dto.mosaicRestrictionEntry.version,
dto.mosaicRestrictionEntry.version || 1,
dto.mosaicRestrictionEntry.compositeHash,
dto.mosaicRestrictionEntry.entryType.valueOf(),
new MosaicId(dto.mosaicRestrictionEntry.mosaicId),
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/SecretLockHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class SecretLockHttp extends Http implements SecretLockRepository {
*/
private toSecretLockInfo(dto: SecretLockInfoDTO): SecretLockInfo {
return new SecretLockInfo(
dto.lock.version,
dto.lock.version || 1,
dto.id,
Address.createFromEncoded(dto.lock.ownerAddress),
new MosaicId(dto.lock.mosaicId),
Expand Down