Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add basic persistence, fixes #19

Merged
merged 22 commits into from
Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8f929b9
chore: update deps, add argon2, lint/format tweaks
kincaidoneil Feb 27, 2019
ddb63d3
chore: precompile for nyc/ava
kincaidoneil Feb 27, 2019
b5575da
feat: serialize and persist config, simplify internals
kincaidoneil Feb 27, 2019
6b8260d
fix: more stringent linting
kincaidoneil Feb 27, 2019
aa7f1ff
fix: update eth plugin
kincaidoneil Feb 28, 2019
5081bce
fix: error deleting config
kincaidoneil Feb 28, 2019
b9eec09
fix: codecov reporting with sourcemaps
kincaidoneil Feb 28, 2019
1e1d2e9
Merge branch 'master' into ko-persist-config
kincaidoneil Feb 28, 2019
5f46e38
fix(eth): error loading persisted channel state
kincaidoneil Mar 1, 2019
4345eda
test: try to fix codecov, again
kincaidoneil Mar 1, 2019
bc8fb98
test: reorganize test logic
kincaidoneil Mar 1, 2019
656bc64
fix: xrp withdrawal issues (#16 and #9)
kincaidoneil Mar 1, 2019
45c9d36
fix: bump ava timeout to 2m
kincaidoneil Mar 1, 2019
e2f8d04
fix(xrp): insufficient outgoing amount
kincaidoneil Mar 1, 2019
b2f8ec1
feat: authorize by default
kincaidoneil Mar 4, 2019
3165bf9
fix: incoming packets not piped through balance middleware
kincaidoneil Mar 4, 2019
7091e4c
test: basic persistence/serialization test
kincaidoneil Mar 4, 2019
a958750
fix: simplify persist test
kincaidoneil Mar 4, 2019
c96aa87
fix(persist): add w flag when writing file
kincaidoneil Mar 5, 2019
8be1b98
fix: use r+ mode, truncate file before writing
kincaidoneil Mar 5, 2019
ff3586f
docs(readme): add persistence note
kincaidoneil Mar 5, 2019
537691d
fix: address comments
kincaidoneil Mar 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"include": ["src/**/*.ts"],
"exclude": ["**/__tests__/**/*.ts", "**/*.d.ts"],
"extension": [".ts"],
"require": ["ts-node/register"],
"include": ["build/**/*.js"],
"exclude": ["**/__tests__/**/*.js", "**/*.ts"],
"extension": [".js"],
"reporter": ["text", "html", "lcov"]
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Create an instance of the API, which automatically connects to the underlying le
import { connect, LedgerEnv, SettlementEngineType } from '@kava-labs/switch-api'

// Connect to testnet
// (State is loaded and persisted to ~/.switch/config.json automatically)
const api = await connect()

// Alternatively, run a local connector using Kava's connector-config
Expand Down Expand Up @@ -229,15 +230,15 @@ await api.disconnect()

## Known Issues

- Currently, no state is persisted, meaning payment channels claims and credentials are not saved after the session ends. We've architected the API to enable this, and it's a top priority within the next week or two.
- Persisted private keys, secrets and other data is currently stored **unencrypted**.
- By design, clients do not currently pay for incoming capacity on ETH nor XRP. However, that's not a sustainable solution. In order to scale and prevent liquidity denial of service attacks, clients should pay a fee to "buy" incoming capacity/bandwidth for a period of time. However, this negotiation and accounting adds a great deal of complexity.
- Uplinks don't operate an internal `ilp-connector`, which may introduce some minor security risks. We intend to update this after the internal plugin architecture is refactored.
- Machinomy payment channels don't currently support watchtowers, which can become a security risk if a client is offline for an extended period of time and the connector disputes the channel. (In XRP, this is less of an issue, since the on-chain fees are low enough that regular checkpoints of the latest claim can be submitted to the ledger).
- The speed of Lightning settlements degrades significantly as the number of hops increases, and even with a direct channel between peers, is currently much slower than XRP or ETH. We can make some optimizations (albeit minor) to improve this.

## Roadmap

- [ ] Persistence and encryption of the configuration, so the uplinks and payment channel claims are restored between sessions (very soon)
- [ ] Encryption of stored credentials
- [ ] Internal refactoring/improving code quality
- [ ] Support for user-defined connectors
- [ ] Additional assets, including ERC-20 tokens such as DAI
Expand Down
8 changes: 3 additions & 5 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
export default {
files: ['src/__tests__/**/*.ts'],
files: ['build/__tests__/**/*.test.js'],
failFast: true,
verbose: true,
serial: true,
timeout: '3m',
compileEnhancements: false,
extensions: ['ts'],
require: ['ts-node/register']
timeout: '2m',
require: ['source-map-support/register']
}
Loading