@audius/sdk 2.0.3-beta.7 → 2.0.3-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +16 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +16 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +16 -8
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +16 -8
- package/dist/native-libs.js.map +1 -1
- package/dist/services/solana/rewardsAttester.d.ts +5 -2
- package/package.json +1 -1
- package/src/eth-contracts/ABIs/Wormhole.json +11 -121
- package/src/services/solana/rewardsAttester.ts +14 -6
|
@@ -55,12 +55,14 @@ export declare class AttestationDelayCalculator {
|
|
|
55
55
|
solanaPollingInterval: number;
|
|
56
56
|
logger: any;
|
|
57
57
|
intervalHandle: NodeJS.Timer | null;
|
|
58
|
-
|
|
58
|
+
private readonly blockOffset;
|
|
59
|
+
constructor({ libs, runBehindSec, allowedStalenessSec, blockOffset, solanaPollingInterval, logger }: {
|
|
59
60
|
libs: any;
|
|
60
61
|
runBehindSec: number;
|
|
61
62
|
allowedStalenessSec: number;
|
|
62
63
|
solanaPollingInterval?: number;
|
|
63
64
|
logger: any;
|
|
65
|
+
blockOffset: number;
|
|
64
66
|
});
|
|
65
67
|
start(): Promise<void>;
|
|
66
68
|
stop(): void;
|
|
@@ -92,6 +94,7 @@ declare type ConstructorArgs = {
|
|
|
92
94
|
maxAggregationAttempts?: number;
|
|
93
95
|
updateStateCallback?: (state: AttesterState) => Promise<void>;
|
|
94
96
|
maxCooldownMsec?: number;
|
|
97
|
+
blockOffset: number;
|
|
95
98
|
};
|
|
96
99
|
declare type Challenge = {
|
|
97
100
|
challengeId: string;
|
|
@@ -167,7 +170,7 @@ export declare class RewardsAttester {
|
|
|
167
170
|
* Creates an instance of RewardsAttester.
|
|
168
171
|
* @memberof RewardsAttester
|
|
169
172
|
*/
|
|
170
|
-
constructor({ libs, startingBlock, offset, parallelization, logger, quorumSize, aaoEndpoint, aaoAddress, updateValues, getStartingBlockOverride, maxRetries, reporter, challengeIdsDenyList, endpoints, runBehindSec, isSolanaChallenge, feePayerOverride, maxAggregationAttempts, updateStateCallback, maxCooldownMsec }: ConstructorArgs);
|
|
173
|
+
constructor({ libs, startingBlock, offset, parallelization, logger, quorumSize, aaoEndpoint, aaoAddress, updateValues, getStartingBlockOverride, maxRetries, reporter, challengeIdsDenyList, endpoints, runBehindSec, isSolanaChallenge, feePayerOverride, maxAggregationAttempts, updateStateCallback, maxCooldownMsec, blockOffset }: ConstructorArgs);
|
|
171
174
|
/**
|
|
172
175
|
* Begin attestation loop. Entry point for identity attestations
|
|
173
176
|
*
|
package/package.json
CHANGED
|
@@ -1,71 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"contractName": "Wormhole",
|
|
3
3
|
"abi": [
|
|
4
|
-
{
|
|
5
|
-
"constant": true,
|
|
6
|
-
"inputs": [],
|
|
7
|
-
"name": "DOMAIN_SEPARATOR",
|
|
8
|
-
"outputs": [
|
|
9
|
-
{
|
|
10
|
-
"internalType": "bytes32",
|
|
11
|
-
"name": "",
|
|
12
|
-
"type": "bytes32"
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"payable": false,
|
|
16
|
-
"stateMutability": "view",
|
|
17
|
-
"type": "function"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"constant": true,
|
|
21
|
-
"inputs": [],
|
|
22
|
-
"name": "LOCK_ASSETS_TYPEHASH",
|
|
23
|
-
"outputs": [
|
|
24
|
-
{
|
|
25
|
-
"internalType": "bytes32",
|
|
26
|
-
"name": "",
|
|
27
|
-
"type": "bytes32"
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"payable": false,
|
|
31
|
-
"stateMutability": "view",
|
|
32
|
-
"type": "function"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"constant": false,
|
|
36
|
-
"inputs": [
|
|
37
|
-
{
|
|
38
|
-
"internalType": "address",
|
|
39
|
-
"name": "_tokenAddress",
|
|
40
|
-
"type": "address"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"internalType": "address",
|
|
44
|
-
"name": "_wormholeAddress",
|
|
45
|
-
"type": "address"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"name": "initialize",
|
|
49
|
-
"outputs": [],
|
|
50
|
-
"payable": false,
|
|
51
|
-
"stateMutability": "nonpayable",
|
|
52
|
-
"type": "function"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"constant": false,
|
|
56
|
-
"inputs": [],
|
|
57
|
-
"name": "initialize",
|
|
58
|
-
"outputs": [],
|
|
59
|
-
"payable": false,
|
|
60
|
-
"stateMutability": "nonpayable",
|
|
61
|
-
"type": "function"
|
|
62
|
-
},
|
|
63
4
|
{
|
|
64
5
|
"constant": false,
|
|
65
6
|
"inputs": [
|
|
66
7
|
{
|
|
67
8
|
"internalType": "address",
|
|
68
|
-
"name": "
|
|
9
|
+
"name": "token",
|
|
69
10
|
"type": "address"
|
|
70
11
|
},
|
|
71
12
|
{
|
|
@@ -73,82 +14,31 @@
|
|
|
73
14
|
"name": "amount",
|
|
74
15
|
"type": "uint256"
|
|
75
16
|
},
|
|
17
|
+
{
|
|
18
|
+
"internalType": "uint16",
|
|
19
|
+
"name": "recipientChain",
|
|
20
|
+
"type": "uint16"
|
|
21
|
+
},
|
|
76
22
|
{
|
|
77
23
|
"internalType": "bytes32",
|
|
78
24
|
"name": "recipient",
|
|
79
25
|
"type": "bytes32"
|
|
80
26
|
},
|
|
81
|
-
{
|
|
82
|
-
"internalType": "uint8",
|
|
83
|
-
"name": "targetChain",
|
|
84
|
-
"type": "uint8"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"internalType": "bool",
|
|
88
|
-
"name": "refundDust",
|
|
89
|
-
"type": "bool"
|
|
90
|
-
},
|
|
91
27
|
{
|
|
92
28
|
"internalType": "uint256",
|
|
93
|
-
"name": "
|
|
29
|
+
"name": "arbiterFee",
|
|
94
30
|
"type": "uint256"
|
|
95
31
|
},
|
|
96
|
-
{
|
|
97
|
-
"internalType": "uint8",
|
|
98
|
-
"name": "v",
|
|
99
|
-
"type": "uint8"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"internalType": "bytes32",
|
|
103
|
-
"name": "r",
|
|
104
|
-
"type": "bytes32"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"internalType": "bytes32",
|
|
108
|
-
"name": "s",
|
|
109
|
-
"type": "bytes32"
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
"name": "lockAssets",
|
|
113
|
-
"outputs": [],
|
|
114
|
-
"payable": false,
|
|
115
|
-
"stateMutability": "nonpayable",
|
|
116
|
-
"type": "function"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"constant": true,
|
|
120
|
-
"inputs": [
|
|
121
|
-
{
|
|
122
|
-
"internalType": "address",
|
|
123
|
-
"name": "",
|
|
124
|
-
"type": "address"
|
|
125
|
-
}
|
|
126
|
-
],
|
|
127
|
-
"name": "nonces",
|
|
128
|
-
"outputs": [
|
|
129
32
|
{
|
|
130
33
|
"internalType": "uint32",
|
|
131
|
-
"name": "",
|
|
34
|
+
"name": "nonce",
|
|
132
35
|
"type": "uint32"
|
|
133
36
|
}
|
|
134
37
|
],
|
|
38
|
+
"name": "transferTokens",
|
|
39
|
+
"outputs": [],
|
|
135
40
|
"payable": false,
|
|
136
|
-
"stateMutability": "
|
|
137
|
-
"type": "function"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"constant": true,
|
|
141
|
-
"inputs": [],
|
|
142
|
-
"name": "token",
|
|
143
|
-
"outputs": [
|
|
144
|
-
{
|
|
145
|
-
"internalType": "address",
|
|
146
|
-
"name": "",
|
|
147
|
-
"type": "address"
|
|
148
|
-
}
|
|
149
|
-
],
|
|
150
|
-
"payable": false,
|
|
151
|
-
"stateMutability": "view",
|
|
41
|
+
"stateMutability": "nonpayable",
|
|
152
42
|
"type": "function"
|
|
153
43
|
}
|
|
154
44
|
]
|
|
@@ -62,7 +62,7 @@ class BaseRewardsReporter {
|
|
|
62
62
|
|
|
63
63
|
const MAX_DISBURSED_CACHE_SIZE = 100
|
|
64
64
|
const SOLANA_EST_SEC_PER_SLOT = 0.5
|
|
65
|
-
const POA_SEC_PER_BLOCK =
|
|
65
|
+
const POA_SEC_PER_BLOCK = 1
|
|
66
66
|
const MAX_DISCOVERY_NODE_BLOCKLIST_LEN = 10
|
|
67
67
|
|
|
68
68
|
type ATTESTER_PHASE =
|
|
@@ -94,10 +94,13 @@ export class AttestationDelayCalculator {
|
|
|
94
94
|
logger: any
|
|
95
95
|
intervalHandle: NodeJS.Timer | null
|
|
96
96
|
|
|
97
|
+
private readonly blockOffset: number
|
|
98
|
+
|
|
97
99
|
constructor({
|
|
98
100
|
libs,
|
|
99
101
|
runBehindSec,
|
|
100
102
|
allowedStalenessSec,
|
|
103
|
+
blockOffset,
|
|
101
104
|
solanaPollingInterval = 30,
|
|
102
105
|
logger = console
|
|
103
106
|
}: {
|
|
@@ -106,6 +109,7 @@ export class AttestationDelayCalculator {
|
|
|
106
109
|
allowedStalenessSec: number
|
|
107
110
|
solanaPollingInterval?: number
|
|
108
111
|
logger: any
|
|
112
|
+
blockOffset: number
|
|
109
113
|
}) {
|
|
110
114
|
this.libs = libs
|
|
111
115
|
this.solanaSecPerSlot = SOLANA_EST_SEC_PER_SLOT
|
|
@@ -116,6 +120,7 @@ export class AttestationDelayCalculator {
|
|
|
116
120
|
this.solanaPollingInterval = solanaPollingInterval
|
|
117
121
|
this.logger = logger
|
|
118
122
|
this.intervalHandle = null
|
|
123
|
+
this.blockOffset = blockOffset
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
async start() {
|
|
@@ -146,9 +151,9 @@ export class AttestationDelayCalculator {
|
|
|
146
151
|
) {
|
|
147
152
|
return this.lastPOAThreshold.threshold
|
|
148
153
|
}
|
|
149
|
-
const currentBlock =
|
|
150
|
-
.getWeb3()
|
|
151
|
-
.
|
|
154
|
+
const currentBlock =
|
|
155
|
+
Number(await this.libs.web3Manager.getWeb3().eth.getBlockNumber()) +
|
|
156
|
+
this.blockOffset
|
|
152
157
|
const threshold = currentBlock - this.runBehindSec / POA_SEC_PER_BLOCK
|
|
153
158
|
this.lastPOAThreshold = {
|
|
154
159
|
threshold,
|
|
@@ -205,6 +210,7 @@ type ConstructorArgs = {
|
|
|
205
210
|
maxAggregationAttempts?: number
|
|
206
211
|
updateStateCallback?: (state: AttesterState) => Promise<void>
|
|
207
212
|
maxCooldownMsec?: number
|
|
213
|
+
blockOffset: number
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
type Challenge = {
|
|
@@ -338,7 +344,8 @@ export class RewardsAttester {
|
|
|
338
344
|
feePayerOverride = null,
|
|
339
345
|
maxAggregationAttempts = 20,
|
|
340
346
|
updateStateCallback = async (_) => {},
|
|
341
|
-
maxCooldownMsec = 15000
|
|
347
|
+
maxCooldownMsec = 15000,
|
|
348
|
+
blockOffset
|
|
342
349
|
}: ConstructorArgs) {
|
|
343
350
|
this.libs = libs
|
|
344
351
|
this.logger = logger
|
|
@@ -374,7 +381,8 @@ export class RewardsAttester {
|
|
|
374
381
|
libs,
|
|
375
382
|
runBehindSec,
|
|
376
383
|
logger,
|
|
377
|
-
allowedStalenessSec: 5
|
|
384
|
+
allowedStalenessSec: 5,
|
|
385
|
+
blockOffset
|
|
378
386
|
})
|
|
379
387
|
this.isSolanaChallenge = isSolanaChallenge
|
|
380
388
|
|