Skip to content

Commit 9c67dbd

Browse files
committed
disabled arweave signatures, we are moving to EVM signatures only
1 parent effb120 commit 9c67dbd

File tree

3 files changed

+30
-38
lines changed

3 files changed

+30
-38
lines changed

__tests__/fluent-interface.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import redstone from "../src/index";
22

3-
const MAX_TIME_DIFF = 120000; // 120s
3+
const MAX_TIME_DIFF = 150000; // 150s
44

55
describe("Fluent interface tests ", () => {
66

__tests__/get-all-prices.test.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import redstone from "../src/index";
22

3-
const MAX_TIME_DIFF = 120000; // 120s
3+
const MAX_TIME_DIFF = 150000; // 150s
44
const MAX_TIME_DIFF_ARWEAVE = 7200 * 1000; // 2 hours
55

66
const shouldNotHaveTechProps = (price: any) => {
@@ -37,15 +37,4 @@ describe("Test getAllPrices method", () => {
3737
}
3838
});
3939

40-
test("Should get all prices from arweave", async () => {
41-
const noCacheApi = new redstone.Api({ useCache: false });
42-
const prices = await noCacheApi.getAllPrices();
43-
expect(Object.keys(prices).length).toBeGreaterThan(3);
44-
expect(Date.now() - prices["AR"].timestamp).toBeLessThan(MAX_TIME_DIFF_ARWEAVE);
45-
expect(Date.now() - prices["BTC"].timestamp).toBeLessThan(MAX_TIME_DIFF_ARWEAVE);
46-
for (const price of Object.values(prices)) {
47-
shouldNotHaveTechProps(price);
48-
}
49-
});
50-
5140
});

src/signature-verifier.ts

+28-25
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,35 @@ export default class SignatureVerifier {
1111
}
1212

1313
public async assertValidSignature(
14-
price: PriceDataWithSignature,
14+
_price: PriceDataWithSignature,
1515
): Promise<void> {
16-
const signedData = this.getPriceSignedData(price);
17-
const publicKey = price.providerPublicKey;
18-
19-
const validSignature = await this.arweaveProxy.verifySignature({
20-
signedData,
21-
signature: price.signature,
22-
signerPublicKey: publicKey,
23-
});
24-
25-
const addressFromPublicKey = await this.arweaveProxy.arweaveClient.wallets.ownerToAddress(
26-
publicKey,
27-
);
28-
29-
if (!validSignature) {
30-
throw new Error("Signature verification failed for price: " + signedData);
31-
}
32-
33-
if (addressFromPublicKey !== price.provider) {
34-
throw new Error(
35-
`Provider address doesn't match the public key.` +
36-
` Address: ${price.provider}.` +
37-
` Public key: ${publicKey}.`,
38-
);
39-
}
16+
// We've decided to disable signing with Arweave signature
17+
// and use only EVM compatible signatures instead
18+
19+
// const signedData = this.getPriceSignedData(price);
20+
// const publicKey = price.providerPublicKey;
21+
22+
// const validSignature = await this.arweaveProxy.verifySignature({
23+
// signedData,
24+
// signature: price.signature,
25+
// signerPublicKey: publicKey,
26+
// });
27+
28+
// const addressFromPublicKey = await this.arweaveProxy.arweaveClient.wallets.ownerToAddress(
29+
// publicKey,
30+
// );
31+
32+
// if (!validSignature) {
33+
// throw new Error("Signature verification failed for price: " + signedData);
34+
// }
35+
36+
// if (addressFromPublicKey !== price.provider) {
37+
// throw new Error(
38+
// `Provider address doesn't match the public key.` +
39+
// ` Address: ${price.provider}.` +
40+
// ` Public key: ${publicKey}.`,
41+
// );
42+
// }
4043
}
4144

4245
private getPriceSignedData(price: PriceDataWithSignature) {

0 commit comments

Comments
 (0)