Skip to content

Commit

Permalink
Merge branch 'develop' into chore/master-to-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
timlind committed Apr 29, 2022
2 parents 3258235 + 893cde9 commit e32141a
Show file tree
Hide file tree
Showing 42 changed files with 1,863 additions and 800 deletions.
3 changes: 2 additions & 1 deletion scripts/pmtp/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.env*
.env*
rewards.json-*
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -x

sifnoded tx clp add-liquidity \
--from $SIF_ACT \
--keyring-backend test \
--symbol cusdt \
--nativeAmount 1000000000000000000000000 \
--externalAmount 25378853317 \
--fees 100000000000000000rowan \
--node ${SIFNODE_NODE} \
--chain-id $SIFNODE_CHAIN_ID \
--broadcast-mode block \
-y
14 changes: 14 additions & 0 deletions scripts/pmtp/send.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -x

sifnoded tx bank send \
$SIF_ACT \
sif144w8cpva2xkly74xrms8djg69y3mljzplx3fjt \
9299999999750930000rowan \
--keyring-backend test \
--node ${SIFNODE_NODE} \
--chain-id $SIFNODE_CHAIN_ID \
--fees 100000000000000000rowan \
--broadcast-mode block \
-y
15 changes: 15 additions & 0 deletions scripts/pmtp/set-rewards-params.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -x

sifnoded tx clp reward-params \
--cancelPeriod 60 \
--lockPeriod 20 \
--from=$SIF_ACT \
--keyring-backend=test \
--fees 100000000000000000rowan \
--gas 500000 \
--node ${SIFNODE_NODE} \
--chain-id=$SIFNODE_CHAIN_ID \
--broadcast-mode=block \
-y
37 changes: 20 additions & 17 deletions scripts/rewards/rewards-period.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

const fs = require("fs");

async function createAssetRewardsFile() {
const csv = fs.readFileSync("./pools.csv", "utf-8");
async function createAssetRewardsFile(periodId, startBlock, endBlock) {
const csv = fs.readFileSync(`./${periodId}.csv`, "utf-8");
const entries = JSON.parse(fs.readFileSync("./entries.json", "utf-8")).result
.registry.entries;
const lines = csv.split("\r\n");
const lines = csv.split("\r\n").filter((line) => line.split(",")[1] !== "");

let [, allocation] = lines[0].split('"');
allocation = parseInt(allocation.trim().split(",").join(""));
let [, allocation] = lines[1].split('"');
allocation = `${allocation.trim().split(",").join("")}${"0".repeat(18)}`;

const multipliers = lines.slice(1).map((line) => {
const [, poolName, multiplier] = line.split(",");
Expand All @@ -30,22 +30,25 @@ async function createAssetRewardsFile() {
};
});

const rewards = [
{
reward_period_id: "RP_1",
reward_period_start_block: 1,
reward_period_end_block: 100,
reward_period_allocation: allocation,
reward_period_pool_multipliers: multipliers,
reward_period_default_multiplier: "0.0",
},
];
const rewardPeriod = {
reward_period_id: periodId,
reward_period_start_block: startBlock,
reward_period_end_block: endBlock,
reward_period_allocation: allocation,
reward_period_pool_multipliers: multipliers,
reward_period_default_multiplier: "0.0",
};

fs.writeFileSync("./rewards.json", JSON.stringify(rewards, null, 2));
return rewardPeriod;
}

async function start() {
await createAssetRewardsFile();
const rewardPeriods = [
await createAssetRewardsFile("RP_2", 6586931, 6687730),
await createAssetRewardsFile("RP_1", 6486131, 6586930),
];

fs.writeFileSync("./rewards.json", JSON.stringify(rewardPeriods, null, 2));
}

start();
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ python3 -m pytest -olog_level=$loglevel -v -olog_file=/tmp/log.txt -v \
${TEST_INTEGRATION_PY_DIR}/test_random_currency_roundtrip.py \
${TEST_INTEGRATION_PY_DIR}/test_rollback_chain.py \
${TEST_INTEGRATION_PY_DIR}/test_ofac_blocklist.py \
${TEST_INTEGRATION_PY_DIR}/test_integration_framework.py \
${TEST_INTEGRATION_PY_DIR}/test_siftool_framework.py \
${TEST_INTEGRATION_PY_DIR}/test_inflate_tokens.py \

# run replay tests after other tests since they interact badly with replaydb
Expand Down
3 changes: 2 additions & 1 deletion test/integration/framework/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/venv/
/__pycache__/
/build/
/src/siftool/__pycache__/
/.lock
65 changes: 10 additions & 55 deletions test/integration/framework/README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,16 @@
# Resources
# siftool

1. Docker setup in docker/ (currently only on future/peggy2 branch, Tim Lind):
- setups two sifnode instances running independent chains + IBC relayer (ts-relayer)
To start the local environment:

2. Brent's PoC (docker): https://github.com/Sifchain/sifchain-deploy/tree/feature/ibc-poc/docker/localnet/ibc
siftool run-env

3. Test environment for testing the new Sifchain public SDK (Caner):
- https://docs.google.com/document/d/1MAlg-I0xMnUvbavAZdAN---WuqbyuRyKw-6Lfgfe130/edit
- https://github.com/sifchain/sifchain-ui/blob/3868ac7138c6c4149dced4ced5b36690e5fc1da7/ui/core/src/config/chains/index.ts#L1
- https://github.com/Sifchain/sifchain-ui/blob/3868ac7138c6c4149dced4ced5b36690e5fc1da7/ui/core/src/config/chains/cosmoshub/index.ts
It will automatically install Python dependencies upon first use. This command will detect if you are on Peggy1 or
Peggy2 branch, and will start local processes accordingly:
- For Peggy1, it will run ganache-cli, sifnoded and ebrelayer.
- For Peggy2, it will run hardhat, sifnoded and two instances of ebrelayer.

4. scripts/init-multichain.sh (on future/peggy2 branch)
At the moment, the environment consists of Ethereum-compliant local node (ganache/hardhat), one `sifnode` validator and
a Peggy bridge implemented by `ebrelayer` binary.

5. https://github.com/Sifchain/sifnode/commit/9ab620e148be8f4850eef59d39b0e869956f87a4

6. sifchain-devops script to deploy TestNet (by _IM): https://github.com/Sifchain/sifchain-devops/blob/main/scripts/testnet/launch.sh#L19

7. Tempnet scripts by chainops

8. In Sifchain/sifnode/scripts there's init.sh which, if you have everything installed, will run a single node. Ping
@Brianosaurus for more info.

9. erowan should be deployed and whitelisted (assumption)

# RPC endpoints:
e.g. SIFNODE="https://api-testnet.sifchain.finance"
- $SIFNODE/node_info
- $SIFNODE/tokenregistry/entries

# Peggy2 devenv
- Directory: smart-contracts/scripts/src/devenv
- Init: cd smart-contracts; rm -rf node_modules; npm install (plan is to move to yarn eventually)
- Run: GOBIN=/home/anderson/go/bin npx hardhat run scripts/devenv.ts
```
{
// vscode launch.json file to debug the Dev Environment Scripts
"version": "0.2.0",
"configurations": [
{
"runtimeArgs": [
"node_modules/.bin/hardhat",
"run"
],
"cwd": "${workspaceFolder}/smart-contracts",
"type": "node",
"request": "launch",
"name": "Dev Environment Debugger",
"env": {
"GOBIN": "/home/anderson/go/bin"
},
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/smart-contracts/scripts/devenv.ts",
}
]
}
```
- Integration test to be targeted for PoC: test_eth_transfers.py
- Dependency diagram: https://files.slack.com/files-pri/T0187TWB4V8-F02BC477N79/sifchaindevenv.jpg
Original design document: https://docs.google.com/document/d/1IhE2Y03Z48ROmTwO9-J_0x_lx2vIOFkyDFG7BkAIqCk/edit#
95 changes: 0 additions & 95 deletions test/integration/framework/hardhat.py

This file was deleted.

Loading

0 comments on commit e32141a

Please sign in to comment.