Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"license": "ISC",
"homepage": "https://unicitynetwork.github.io/state-transition-sdk/",
"dependencies": {
"@unicitylabs/commons": "2.4.0-rc.24d6a7c"
"@unicitylabs/commons": "2.4.0-rc.f631bc4"
},
"devDependencies": {
"@babel/preset-env": "7.27.2",
Expand Down
10 changes: 5 additions & 5 deletions src/transaction/split/TokenSplitBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DataHasherFactory } from '@unicitylabs/commons/lib/hash/DataHasherFactory.js';
import type { IDataHasher } from '@unicitylabs/commons/lib/hash/IDataHasher.js';
import { MerkleSumTreeRootNode } from '@unicitylabs/commons/lib/smst/MerkleSumTreeRootNode.js';
import { SparseMerkleSumTreeBuilder } from '@unicitylabs/commons/lib/smst/SparseMerkleSumTreeBuilder.js';
import { SparseMerkleTreeBuilder } from '@unicitylabs/commons/lib/smt/SparseMerkleTreeBuilder.js';
import { SparseMerkleSumTree } from '@unicitylabs/commons/lib/smst/SparseMerkleSumTree.js';
import { SparseMerkleTree } from '@unicitylabs/commons/lib/smt/SparseMerkleTree.js';
import { HexConverter } from '@unicitylabs/commons/lib/util/HexConverter.js';

import { SplitResult } from './SplitResult.js';
Expand Down Expand Up @@ -36,16 +36,16 @@ export class TokenSplitBuilder {
}

public async build(factory: DataHasherFactory<IDataHasher>): Promise<SplitResult> {
const aggregationTree = new SparseMerkleTreeBuilder(factory);
const trees = new Map<string, SparseMerkleSumTreeBuilder>();
const aggregationTree = new SparseMerkleTree(factory);
const trees = new Map<string, SparseMerkleSumTree>();
const tokens: SplitToken[] = [];
for (const builder of this.tokens.values()) {
const token = builder.build();
for (const [coinId, amount] of token.coins) {
const treesKey = coinId.toJSON();
let tree = trees.get(treesKey);
if (!tree) {
tree = new SparseMerkleSumTreeBuilder(factory);
tree = new SparseMerkleSumTree(factory);
trees.set(treesKey, tree);
}
tree.addLeaf(builder.tokenId.toBitString().toBigInt(), coinId.toCBOR(), amount);
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/docker/aggregator/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ services:
# build:
# context: ${AGGREGATOR_HOME:-../../../../../aggregators_net} # path to aggregator dockerfile directory
# dockerfile: Dockerfile
image: ghcr.io/unicitynetwork/aggregators_net:bbabb5f093e829fa789ed6e83f57af98df3f1752
image: ghcr.io/unicitynetwork/aggregators_net:d96cc8292c55341217e2b80a895479ac1f9644c9
container_name: aggregator-test # must be specified for Testcontainers docker compose API
depends_on:
- mongo-setup
ports:
- '3000' # port inside the container; host port is chosen randomly
environment:
- MONGODB_URI=mongodb://mongo1:27017
- USE_MOCK_ALPHABILL=true
- ALPHABILL_PRIVATE_KEY=FF00000000000000000000000000000000000000000000000000000000000000 # must be specified for some reason, even though we use the mock
- USE_MOCK_BFT=true
- BFT_PRIVATE_KEY=FF00000000000000000000000000000000000000000000000000000000000000 # must be specified for some reason, even though we use the mock
- DISABLE_HIGH_AVAILABILITY=true
- PORT=3000
4 changes: 2 additions & 2 deletions tests/unit/TestAggregatorClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SubmitCommitmentStatus,
} from '@unicitylabs/commons/lib/api/SubmitCommitmentResponse.js';
import { DataHash } from '@unicitylabs/commons/lib/hash/DataHash.js';
import { SparseMerkleTreeBuilder } from '@unicitylabs/commons/lib/smt/SparseMerkleTreeBuilder.js';
import { SparseMerkleTree } from '@unicitylabs/commons/lib/smt/SparseMerkleTree.js';

import { IAggregatorClient } from '../../src/api/IAggregatorClient.js';

Expand All @@ -21,7 +21,7 @@ class Transaction {
export class TestAggregatorClient implements IAggregatorClient {
private readonly requests: Map<bigint, Transaction> = new Map();

public constructor(private readonly smt: SparseMerkleTreeBuilder) {}
public constructor(private readonly smt: SparseMerkleTree) {}

public async submitTransaction(
requestId: RequestId,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/token/TokenUsageExampleTest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DataHasherFactory } from '@unicitylabs/commons/lib/hash/DataHasherFactory.js';
import { HashAlgorithm } from '@unicitylabs/commons/lib/hash/HashAlgorithm.js';
import { NodeDataHasher } from '@unicitylabs/commons/lib/hash/NodeDataHasher.js';
import { SparseMerkleTreeBuilder } from '@unicitylabs/commons/lib/smt/SparseMerkleTreeBuilder.js';
import { SparseMerkleTree } from '@unicitylabs/commons/lib/smt/SparseMerkleTree.js';

import { StateTransitionClient } from '../../../src/StateTransitionClient.js';
import {
Expand All @@ -14,7 +14,7 @@ import { TestAggregatorClient } from '../TestAggregatorClient.js';

describe('Transition', function () {
const client = new StateTransitionClient(
new TestAggregatorClient(new SparseMerkleTreeBuilder(new DataHasherFactory(HashAlgorithm.SHA256, NodeDataHasher))),
new TestAggregatorClient(new SparseMerkleTree(new DataHasherFactory(HashAlgorithm.SHA256, NodeDataHasher))),
);

it('should verify the token transfer', async () => {
Expand Down