Skip to content

Commit 88e089d

Browse files
paulgnzclaude
andcommitted
fix(tests): patch IndexObject.compare operator precedence bug, unskip remaining tests
Second @proton/vert v0.2.15 bug: IndexObject.compare() in table.ts has a JS operator precedence issue where || binds tighter than ?:, causing BTree lookups to return secondary index entries from wrong tables. This triggered "db access violation" in cross-contract inline actions (e.g., approve/arbitrate calling incjobs on agentcore). Fix: add parentheses around the ternary expression. All 114 tests now pass with zero pending. Updated upstream PR: XPRNetwork/vert#5 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d82e3b8 commit 88e089d

File tree

5 files changed

+131
-3
lines changed

5 files changed

+131
-3
lines changed

contracts/agentcore/patches/@proton+vert+0.2.15.patch

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
diff --git a/node_modules/@proton/vert/dist/proton/table.js b/node_modules/@proton/vert/dist/proton/table.js
2+
index f3f3b10..4bac9a9 100644
3+
--- a/node_modules/@proton/vert/dist/proton/table.js
4+
+++ b/node_modules/@proton/vert/dist/proton/table.js
5+
@@ -118,9 +118,9 @@ class IndexObject {
6+
}
7+
static compare(a, b) {
8+
return IndexObject.compareTable(a, b) ||
9+
- (a.ignorePrimaryKey || b.ignorePrimaryKey)
10+
+ ((a.ignorePrimaryKey || b.ignorePrimaryKey)
11+
? 0
12+
- : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0);
13+
+ : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0));
14+
}
15+
static comparePrimitives(a, b) {
16+
return IndexObject.compareTable(a, b) ||
117
diff --git a/node_modules/@proton/vert/dist/proton/vm.js b/node_modules/@proton/vert/dist/proton/vm.js
218
index bb63985..1759e3f 100644
319
--- a/node_modules/@proton/vert/dist/proton/vm.js
@@ -24,6 +40,22 @@ index bb63985..1759e3f 100644
2440
(0, assert_1.default)(tab.code === this.context.receiver.toBigInt(), 'db access violation');
2541
index.delete(obj);
2642
cache.remove(iterator);
43+
diff --git a/node_modules/@proton/vert/src/proton/table.ts b/node_modules/@proton/vert/src/proton/table.ts
44+
index 0f5d5e2..3c55c4f 100644
45+
--- a/node_modules/@proton/vert/src/proton/table.ts
46+
+++ b/node_modules/@proton/vert/src/proton/table.ts
47+
@@ -148,9 +148,9 @@ class IndexObject<K> implements IndexKey<K> {
48+
49+
static compare(a, b): number {
50+
return IndexObject.compareTable(a, b) ||
51+
- (a.ignorePrimaryKey || b.ignorePrimaryKey)
52+
+ ((a.ignorePrimaryKey || b.ignorePrimaryKey)
53+
? 0
54+
- : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0);
55+
+ : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0));
56+
}
57+
58+
static comparePrimitives(a, b) {
2759
diff --git a/node_modules/@proton/vert/src/proton/vm.ts b/node_modules/@proton/vert/src/proton/vm.ts
2860
index 962e43d..2e22744 100644
2961
--- a/node_modules/@proton/vert/src/proton/vm.ts

contracts/agentescrow/patches/@proton+vert+0.2.15.patch

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
diff --git a/node_modules/@proton/vert/dist/proton/table.js b/node_modules/@proton/vert/dist/proton/table.js
2+
index f3f3b10..4bac9a9 100644
3+
--- a/node_modules/@proton/vert/dist/proton/table.js
4+
+++ b/node_modules/@proton/vert/dist/proton/table.js
5+
@@ -118,9 +118,9 @@ class IndexObject {
6+
}
7+
static compare(a, b) {
8+
return IndexObject.compareTable(a, b) ||
9+
- (a.ignorePrimaryKey || b.ignorePrimaryKey)
10+
+ ((a.ignorePrimaryKey || b.ignorePrimaryKey)
11+
? 0
12+
- : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0);
13+
+ : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0));
14+
}
15+
static comparePrimitives(a, b) {
16+
return IndexObject.compareTable(a, b) ||
117
diff --git a/node_modules/@proton/vert/dist/proton/vm.js b/node_modules/@proton/vert/dist/proton/vm.js
218
index bb63985..1759e3f 100644
319
--- a/node_modules/@proton/vert/dist/proton/vm.js
@@ -24,6 +40,22 @@ index bb63985..1759e3f 100644
2440
(0, assert_1.default)(tab.code === this.context.receiver.toBigInt(), 'db access violation');
2541
index.delete(obj);
2642
cache.remove(iterator);
43+
diff --git a/node_modules/@proton/vert/src/proton/table.ts b/node_modules/@proton/vert/src/proton/table.ts
44+
index 0f5d5e2..3c55c4f 100644
45+
--- a/node_modules/@proton/vert/src/proton/table.ts
46+
+++ b/node_modules/@proton/vert/src/proton/table.ts
47+
@@ -148,9 +148,9 @@ class IndexObject<K> implements IndexKey<K> {
48+
49+
static compare(a, b): number {
50+
return IndexObject.compareTable(a, b) ||
51+
- (a.ignorePrimaryKey || b.ignorePrimaryKey)
52+
+ ((a.ignorePrimaryKey || b.ignorePrimaryKey)
53+
? 0
54+
- : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0);
55+
+ : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0));
56+
}
57+
58+
static comparePrimitives(a, b) {
2759
diff --git a/node_modules/@proton/vert/src/proton/vm.ts b/node_modules/@proton/vert/src/proton/vm.ts
2860
index 962e43d..2e22744 100644
2961
--- a/node_modules/@proton/vert/src/proton/vm.ts

contracts/agentescrow/tests/agentescrow.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ describe('agentescrow', () => {
219219
expect(job.state).to.equal(4); // DELIVERED
220220
});
221221

222-
it.skip('should approve a delivered job (inline token transfer triggers db access violation in vert)', async () => {
222+
it('should approve a delivered job', async () => {
223223
await createAndFundJob();
224224
await agentescrow.actions.acceptjob(['agent1', 0]).send('agent1@active');
225225
await agentescrow.actions.startjob(['agent1', 0]).send('agent1@active');
@@ -328,7 +328,7 @@ describe('agentescrow', () => {
328328
expect(job.state).to.equal(5); // DISPUTED
329329
});
330330

331-
it.skip('should arbitrate a dispute (inline token transfer db access violation)', async () => {
331+
it('should arbitrate a dispute', async () => {
332332
await agentescrow.actions.dispute([
333333
'client', 0, 'Low quality deliverables', 'ipfs://evidence'
334334
]).send('client@active');
@@ -343,7 +343,7 @@ describe('agentescrow', () => {
343343
expect(arb.successful_cases).to.equal(1);
344344
});
345345

346-
it.skip('should track active_disputes counter (inline token transfer db access violation)', async () => {
346+
it('should track active_disputes counter', async () => {
347347
await agentescrow.actions.dispute([
348348
'client', 0, 'Low quality', 'ipfs://evidence'
349349
]).send('client@active');

contracts/agentfeed/patches/@proton+vert+0.2.15.patch

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
diff --git a/node_modules/@proton/vert/dist/proton/table.js b/node_modules/@proton/vert/dist/proton/table.js
2+
index f3f3b10..4bac9a9 100644
3+
--- a/node_modules/@proton/vert/dist/proton/table.js
4+
+++ b/node_modules/@proton/vert/dist/proton/table.js
5+
@@ -118,9 +118,9 @@ class IndexObject {
6+
}
7+
static compare(a, b) {
8+
return IndexObject.compareTable(a, b) ||
9+
- (a.ignorePrimaryKey || b.ignorePrimaryKey)
10+
+ ((a.ignorePrimaryKey || b.ignorePrimaryKey)
11+
? 0
12+
- : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0);
13+
+ : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0));
14+
}
15+
static comparePrimitives(a, b) {
16+
return IndexObject.compareTable(a, b) ||
117
diff --git a/node_modules/@proton/vert/dist/proton/vm.js b/node_modules/@proton/vert/dist/proton/vm.js
218
index bb63985..1759e3f 100644
319
--- a/node_modules/@proton/vert/dist/proton/vm.js
@@ -24,6 +40,22 @@ index bb63985..1759e3f 100644
2440
(0, assert_1.default)(tab.code === this.context.receiver.toBigInt(), 'db access violation');
2541
index.delete(obj);
2642
cache.remove(iterator);
43+
diff --git a/node_modules/@proton/vert/src/proton/table.ts b/node_modules/@proton/vert/src/proton/table.ts
44+
index 0f5d5e2..3c55c4f 100644
45+
--- a/node_modules/@proton/vert/src/proton/table.ts
46+
+++ b/node_modules/@proton/vert/src/proton/table.ts
47+
@@ -148,9 +148,9 @@ class IndexObject<K> implements IndexKey<K> {
48+
49+
static compare(a, b): number {
50+
return IndexObject.compareTable(a, b) ||
51+
- (a.ignorePrimaryKey || b.ignorePrimaryKey)
52+
+ ((a.ignorePrimaryKey || b.ignorePrimaryKey)
53+
? 0
54+
- : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0);
55+
+ : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0));
56+
}
57+
58+
static comparePrimitives(a, b) {
2759
diff --git a/node_modules/@proton/vert/src/proton/vm.ts b/node_modules/@proton/vert/src/proton/vm.ts
2860
index 962e43d..2e22744 100644
2961
--- a/node_modules/@proton/vert/src/proton/vm.ts

contracts/agentvalid/patches/@proton+vert+0.2.15.patch

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
diff --git a/node_modules/@proton/vert/dist/proton/table.js b/node_modules/@proton/vert/dist/proton/table.js
2+
index f3f3b10..4bac9a9 100644
3+
--- a/node_modules/@proton/vert/dist/proton/table.js
4+
+++ b/node_modules/@proton/vert/dist/proton/table.js
5+
@@ -118,9 +118,9 @@ class IndexObject {
6+
}
7+
static compare(a, b) {
8+
return IndexObject.compareTable(a, b) ||
9+
- (a.ignorePrimaryKey || b.ignorePrimaryKey)
10+
+ ((a.ignorePrimaryKey || b.ignorePrimaryKey)
11+
? 0
12+
- : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0);
13+
+ : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0));
14+
}
15+
static comparePrimitives(a, b) {
16+
return IndexObject.compareTable(a, b) ||
117
diff --git a/node_modules/@proton/vert/dist/proton/vm.js b/node_modules/@proton/vert/dist/proton/vm.js
218
index bb63985..1759e3f 100644
319
--- a/node_modules/@proton/vert/dist/proton/vm.js
@@ -24,6 +40,22 @@ index bb63985..1759e3f 100644
2440
(0, assert_1.default)(tab.code === this.context.receiver.toBigInt(), 'db access violation');
2541
index.delete(obj);
2642
cache.remove(iterator);
43+
diff --git a/node_modules/@proton/vert/src/proton/table.ts b/node_modules/@proton/vert/src/proton/table.ts
44+
index 0f5d5e2..3c55c4f 100644
45+
--- a/node_modules/@proton/vert/src/proton/table.ts
46+
+++ b/node_modules/@proton/vert/src/proton/table.ts
47+
@@ -148,9 +148,9 @@ class IndexObject<K> implements IndexKey<K> {
48+
49+
static compare(a, b): number {
50+
return IndexObject.compareTable(a, b) ||
51+
- (a.ignorePrimaryKey || b.ignorePrimaryKey)
52+
+ ((a.ignorePrimaryKey || b.ignorePrimaryKey)
53+
? 0
54+
- : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0);
55+
+ : ((a.primaryKey < b.primaryKey) ? -1 : (a.primaryKey > b.primaryKey) ? 1 : 0));
56+
}
57+
58+
static comparePrimitives(a, b) {
2759
diff --git a/node_modules/@proton/vert/src/proton/vm.ts b/node_modules/@proton/vert/src/proton/vm.ts
2860
index 962e43d..2e22744 100644
2961
--- a/node_modules/@proton/vert/src/proton/vm.ts

0 commit comments

Comments
 (0)