-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8881ca
commit a062c58
Showing
15 changed files
with
1,363 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"env": { | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
"prettier/prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint", "import"], | ||
"rules": { | ||
"no-use-before-define": "off", | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"ts": "never" | ||
} | ||
], | ||
"no-shadow": "off", | ||
"@typescript-eslint/no-shadow": ["off"], | ||
"@typescript-eslint/explicit-function-return-type": [ | ||
"error", | ||
{ | ||
"allowExpressions": true | ||
} | ||
], | ||
"import/prefer-default-export": "off" | ||
}, | ||
"settings": { | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts"] | ||
}, | ||
"import/resolver": { | ||
"typescript": { | ||
"paths": ["./src"] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.namada |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
# Genesis configuration source for E2E tests with: | ||
# - 1 genesis validator | ||
# - User accounts same as the ones in "dev" build (Albert, Bertha, Christel) | ||
|
||
genesis_time = "2021-09-30T10:00:00Z" | ||
native_token = "NAM" | ||
faucet_pow_difficulty = 1 | ||
faucet_withdrawal_limit = "1000000000" | ||
|
||
[validator.validator-0] | ||
# Validator's staked NAM at genesis. | ||
tokens = 200000 | ||
# Amount of the validator's genesis token balance which is not staked. | ||
non_staked_balance = 1000000000000 | ||
# VP for the validator account | ||
validator_vp = "vp_validator" | ||
# Commission rate for rewards | ||
commission_rate = "0.05" | ||
# Maximum change per epoch in the commission rate | ||
max_commission_rate_change = "0.01" | ||
# Public IP:port address. | ||
# We set the port to be the default+1000, so that if a local node was running at | ||
# the same time as the E2E tests, it wouldn't affect them. | ||
net_address = "127.0.0.1:27656" | ||
|
||
# Some tokens present at genesis. | ||
|
||
[token.NAM] | ||
address = "atest1v4ehgw36x3prswzxggunzv6pxqmnvdj9xvcyzvpsggeyvs3cg9qnywf589qnwvfsg5erg3fkl09rg5" | ||
denom = 6 | ||
vp = "vp_token" | ||
[token.NAM.balances] | ||
Albert = "1000000" | ||
"Albert.public_key" = "100" | ||
Bertha = "1000000" | ||
"Bertha.public_key" = "2000" | ||
Christel = "1000000" | ||
"Christel.public_key" = "100" | ||
Daewon = "1000000" | ||
Ester = "1000000" | ||
faucet = "9223372036854" | ||
"faucet.public_key" = "100" | ||
"validator-0.public_key" = "100" | ||
|
||
[token.BTC] | ||
address = "atest1v4ehgw36xdzryve5gsc52veeg5cnsv2yx5eygvp38qcrvd29xy6rys6p8yc5xvp4xfpy2v694wgwcp" | ||
denom = 8 | ||
vp = "vp_token" | ||
[token.BTC.balances] | ||
Albert = "1000000" | ||
Bertha = "1000000" | ||
Christel = "1000000" | ||
Daewon = "1000000" | ||
Ester = "1000000" | ||
faucet = "9223372036854" | ||
|
||
[token.ETH] | ||
address = "atest1v4ehgw36xqmr2d3nx3ryvd2xxgmrq33j8qcns33sxezrgv6zxdzrydjrxveygd2yxumrsdpsf9jc2p" | ||
denom = 18 | ||
vp = "vp_token" | ||
[token.ETH.balances] | ||
Albert = "1000000" | ||
Bertha = "1000000" | ||
Christel = "1000000" | ||
Daewon = "1000000" | ||
Ester = "1000000" | ||
faucet = "9223372036854" | ||
|
||
[token.DOT] | ||
address = "atest1v4ehgw36gg6nvs2zgfpyxsfjgc65yv6pxy6nwwfsxgungdzrggeyzv35gveyxsjyxymyz335hur2jn" | ||
denom = 10 | ||
vp = "vp_token" | ||
[token.DOT.balances] | ||
Albert = "1000000" | ||
Bertha = "1000000" | ||
Christel = "1000000" | ||
Daewon = "1000000" | ||
Ester = "1000000" | ||
faucet = "9223372036854" | ||
|
||
[token.Schnitzel] | ||
address = "atest1v4ehgw36xue5xvf5xvuyzvpjx5un2v3k8qeyvd3cxdqns32p89rrxd6xx9zngvpegccnzs699rdnnt" | ||
denom = 6 | ||
vp = "vp_token" | ||
[token.Schnitzel.balances] | ||
Albert = "1000000" | ||
Bertha = "1000000" | ||
Christel = "1000000" | ||
Daewon = "1000000" | ||
Ester = "1000000" | ||
faucet = "9223372036854" | ||
|
||
[token.Apfel] | ||
address = "atest1v4ehgw36gfryydj9g3p5zv3kg9znyd358ycnzsfcggc5gvecgc6ygs2rxv6ry3zpg4zrwdfeumqcz9" | ||
denom = 6 | ||
vp = "vp_token" | ||
[token.Apfel.balances] | ||
Albert = "1000000" | ||
Bertha = "1000000" | ||
Christel = "1000000" | ||
Daewon = "1000000" | ||
Ester = "1000000" | ||
faucet = "9223372036854" | ||
|
||
[token.Kartoffel] | ||
address = "atest1v4ehgw36gep5ysecxq6nyv3jg3zygv3e89qn2vp48pryxsf4xpznvve5gvmy23fs89pryvf5a6ht90" | ||
public_key = "" | ||
denom = 6 | ||
vp = "vp_token" | ||
[token.Kartoffel.balances] | ||
Albert = "1000000" | ||
Bertha = "1000000" | ||
Christel = "1000000" | ||
Daewon = "1000000" | ||
Ester = "1000000" | ||
faucet = "9223372036854" | ||
|
||
# Some established accounts present at genesis. | ||
[established.faucet] | ||
vp = "vp_testnet_faucet" | ||
|
||
[established.Albert] | ||
vp = "vp_user" | ||
|
||
[established.Bertha] | ||
vp = "vp_user" | ||
|
||
[established.Christel] | ||
vp = "vp_user" | ||
|
||
[established.masp] | ||
address = "atest1v4ehgw36xaryysfsx5unvve4g5my2vjz89p52sjxxgenzd348yuyyv3hg3pnjs35g5unvde4ca36y5" | ||
vp = "vp_masp" | ||
|
||
[implicit.Daewon] | ||
|
||
[implicit.Ester] | ||
|
||
[implicit.Test] | ||
address = "atest1d9khqw36xccyydp3xpznjvzrx3zrq3fexep5y33nxverqdz9xcc5ydeexgm52djrxvuyxsjr44hd2f" | ||
|
||
# Wasm VP definitions | ||
|
||
# Implicit VP | ||
[wasm.vp_implicit] | ||
filename = "vp_implicit.wasm" | ||
|
||
# Default user VP in established accounts | ||
[wasm.vp_user] | ||
filename = "vp_user.wasm" | ||
|
||
# Default validator VP | ||
[wasm.vp_validator] | ||
# filename (relative to wasm path used by the node) | ||
filename = "vp_validator.wasm" | ||
|
||
# Token VP | ||
[wasm.vp_token] | ||
filename = "vp_token.wasm" | ||
|
||
# Faucet VP | ||
[wasm.vp_testnet_faucet] | ||
filename = "vp_testnet_faucet.wasm" | ||
|
||
# MASP VP | ||
[wasm.vp_masp] | ||
filename = "vp_masp.wasm" | ||
|
||
# General protocol parameters. | ||
[parameters] | ||
# Minimum number of blocks in an epoch. | ||
min_num_of_blocks = 4 | ||
# Maximum expected time per block (in seconds). | ||
max_expected_time_per_block = 30 | ||
# Max payload size, in bytes, for a tx batch proposal. | ||
max_proposal_bytes = 22020096 | ||
# vp whitelist | ||
vp_whitelist = [] | ||
# tx whitelist | ||
tx_whitelist = [] | ||
# Implicit VP WASM name | ||
implicit_vp = "vp_implicit" | ||
# Expected number of epochs per year (also sets the min duration of an epoch in seconds) | ||
epochs_per_year = 525_600 | ||
# The P gain factor in the Proof of Stake rewards controller | ||
pos_gain_p = "0.1" | ||
# The D gain factor in the Proof of Stake rewards controller | ||
pos_gain_d = "0.1" | ||
|
||
# Proof of stake parameters. | ||
[pos_params] | ||
# Maximum number of consensus validators. | ||
max_validator_slots = 128 | ||
# Pipeline length (in epochs). Any change in the validator set made in | ||
# epoch 'n' will become active in epoch 'n + pipeline_len'. | ||
pipeline_len = 2 | ||
# Unbonding length (in epochs). Validators may have their stake slashed | ||
# for a fault in epoch 'n' up through epoch 'n + unbonding_len'. | ||
unbonding_len = 3 | ||
# Votes per fundamental staking token (namnam) | ||
tm_votes_per_token = "0.1" | ||
# Reward for proposing a block. | ||
block_proposer_reward = "0.125" | ||
# Reward for voting on a block. | ||
block_vote_reward = "0.1" | ||
# Maximum inflation rate per annum (10%) | ||
max_inflation_rate = "0.1" | ||
# Targeted ratio of staked tokens to total tokens in the supply | ||
target_staked_ratio = "0.6667" | ||
# Portion of a validator's stake that should be slashed on a duplicate | ||
# vote. | ||
duplicate_vote_min_slash_rate = "0.001" | ||
# Portion of a validator's stake that should be slashed on a light | ||
# client attack. | ||
light_client_attack_min_slash_rate = "0.001" | ||
# Number of epochs above and below (separately) the current epoch to | ||
# consider when doing cubic slashing | ||
cubic_slashing_window_length = 1 | ||
# The minimum amount of bonded tokens that a validator needs to be in | ||
# either the `consensus` or `below_capacity` validator sets | ||
validator_stake_threshold = "1" | ||
|
||
# Governance parameters. | ||
[gov_params] | ||
# minimum amount of nam token to lock | ||
min_proposal_fund = 500 | ||
# proposal code size in bytes | ||
max_proposal_code_size = 1000000 | ||
# min proposal period length in epochs | ||
min_proposal_period = 3 | ||
# max proposal period length in epochs | ||
max_proposal_period = 27 | ||
# maximum number of characters in the proposal content | ||
max_proposal_content_size = 10000 | ||
# minimum epochs between end and grace epoch | ||
min_proposal_grace_epochs = 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { Config } from "@jest/types"; | ||
|
||
const config: Config.InitialOptions = { | ||
verbose: true, | ||
preset: "ts-jest", | ||
transform: { | ||
"^.+\\.ts$": "ts-jest", | ||
}, | ||
moduleDirectories: ["node_modules", "e2e/tests"], | ||
testEnvironment: "node", | ||
roots: ["src"], | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@anoma/e2e", | ||
"version": "0.1.0", | ||
"description": "e2e tests for apps", | ||
"main": "src/index.ts", | ||
"repository": "https://github.com/anoma/namada-interface", | ||
"author": "Heliax Dev <[email protected]>", | ||
"license": "MIT", | ||
"private": true, | ||
"scripts": { | ||
"lint": "npx eslint src --ext .ts", | ||
"lint:fix": "yarn lint -- --fix", | ||
"lint:ci": "yarn lint --max-warnings 0", | ||
"setup": "./setup-tests.sh", | ||
"test": "jest --runInBand", | ||
"test:watch": "jest --watch", | ||
"e2e": "start-server-and-test setup http://localhost:3000 test" | ||
}, | ||
"dependencies": { | ||
"typescript": "^5.1.3" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.0.0", | ||
"@types/puppeteer": "^7.0.4", | ||
"eslint": "^8.23.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-import-resolver-typescript": "^3.5.1", | ||
"jest": "^29.0.2", | ||
"jest-puppeteer": "^9.0.0", | ||
"puppeteer": "^20.8.2" | ||
} | ||
} |
Oops, something went wrong.