Ver Fonte

evm unit tests in tilt (#186)

* Enable and fix Rust unit tests in Tilt for p2w-sdk and p2w-attest

commit-id:cae6ee05

* p2w-sdk/rust/src/lib.rs: comment about hex payload generation

commit-id:f9f3a249

* p2w-sdk/rust/src/lib.rs: Comment about hex payload generation

commit-id:352e74f9

* Fix and enable EVM unit tests in Tilt

commit-id:11bcb841

* EVM p2w tests: ensure true negatives in "should cache price updates"

commit-id:3aaa0527

* pyth.js: typo

commit-id:f76c5465

* EVM: Remove unrelated setup scripts, build contracts in Dockerfile

commit-id:b09c1d83

* ethereum/dockerfile: Remove node_modules caching

commit-id:c66c79c1

* EVM: revert dockerfile

commit-id:2b9e0b7a

* trigger build

commit-id:c7689ec4

* EVM: change stale timestamp test to the exact edge case

commit-id:d2709f47
Stanisław Drozd há 3 anos atrás
pai
commit
ded0fb37bd

+ 8 - 2
devnet/eth-devnet.yaml

@@ -54,7 +54,11 @@ spec:
             - ganache-cli
             - -e 10000
             - --deterministic
-            - --time="1970-01-01T00:00:00+00:00"
+            # NOTE(2022-04-13): Some unit tests need block timestamp
+            # to be sufficiently far above UNIX epoch (Pyth EVM tests
+            # check feed staleness logic against 0 as lowest possible
+            # timestamp)
+            - --time="1970-01-02T00:00:00+00:00"
             - --host=0.0.0.0
           ports:
             - containerPort: 8545
@@ -69,7 +73,9 @@ spec:
           command:
             - /bin/sh
             - -c
-            - "npm run migrate && npx truffle exec scripts/deploy_test_token.js && npx truffle exec scripts/register_solana_chain.js && npx truffle exec scripts/register_terra_chain.js && npx truffle exec scripts/register_bsc_chain.js && nc -lkp 2000 0.0.0.0"
+            - "npm run migrate &&
+            npx truffle test test/pyth.js 2>&1 &&
+            nc -lkp 2000 0.0.0.0"
           readinessProbe:
             periodSeconds: 1
             failureThreshold: 300

+ 1 - 1
ethereum/contracts/pyth/Pyth.sol

@@ -173,7 +173,7 @@ contract Pyth is PythGetters, PythSetters, AbstractPyth {
     /// This includes attestation delay which currently might up to a minute.
     uint private constant VALID_TIME_PERIOD_SECS = 180;
 
-    function queryPriceFeed(bytes32 id) public override returns (PythStructs.PriceFeed memory priceFeed){
+    function queryPriceFeed(bytes32 id) public view override returns (PythStructs.PriceFeed memory priceFeed){
 
         // Look up the latest price info for the given ID
         PythInternalStructs.PriceInfo memory info = latestPriceInfo(id);

Diff do ficheiro suprimidas por serem muito extensas
+ 36727 - 1
ethereum/package-lock.json


+ 1 - 1
ethereum/package.json

@@ -31,7 +31,7 @@
   "license": "ISC",
   "dependencies": {
     "@openzeppelin/contracts-upgradeable": "^4.5.2",
-    "@pythnetwork/pyth-sdk-solidity": "0.0.2",
+    "@pythnetwork/pyth-sdk-solidity": "0.0.3",
     "dotenv": "^10.0.0",
     "elliptic": "^6.5.2",
     "ganache-cli": "^6.12.1",

Diff do ficheiro suprimidas por serem muito extensas
+ 21 - 8
ethereum/test/pyth.js


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff