Commit Graph

84 Commits

Author SHA1 Message Date
naveen
06433d351e
Upgrade to go 1.16 for the left over packages
Upgraded the go to 1.16 for the rest of the packages.
2021-10-19 03:55:13 +00:00
naveen
d5e3302265
mod : replace gogo/protobuf for GO-2021-0053
The gogo/protobuf has OSV GO-2021-0053
https://deps.dev/advisory/OSV/GO-2021-0053?from=%2Fgo%2Fgithub.com%252Flightningnetwork%252Flnd

This is used indirectly and has to be replaced in go.mod to avoid the
direct reference to that version.

The OSV has been addressed in v1.3.2
2021-10-01 13:07:52 +00:00
Olaoluwa Osuntokun
8ba68ca59f
Merge pull request #5789 from naveensrinivasan/naveen/feat/fix-CVE-2021-29482
mod: Upgraded xz library to FIX the CVE-2021-29482
2021-09-30 20:16:13 -07:00
Oliver Gugger
0b4e03f5fc
multi: add golang 1.17 compatible build tags
With go 1.17 a change to the build flags was implemented:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

The formatter now automatically adds the forward-compatible build tag
format and the linter checks for them, so we need to include them in our
code.
2021-09-29 17:31:37 -07:00
naveen
04f57c6f57
mod: Upgraded xz library to FIX the CVE-2021-29482
Included a replace directive to avoid using an high severity CVE
https://github.com/advisories/GHSA-25xm-hr59-7c27

This library is indirectly referenced and cannot be upgraded directly.

The https://github.com/fergusstrange/embedded-postgres/pull/42 was
merged to fix the CVE issue.
2021-09-29 15:16:26 +00:00
ErikEk
d5463818a8 bbolt sync-freelist ignored 2021-09-27 06:49:56 +01:00
Joost Jager
3eb80cac97
kvdb: add postgres 2021-09-21 10:44:18 +02:00
Oliver Gugger
29a8661517
Merge pull request #5640 from bhandras/kvdb-prefetch
kvdb+channeld: extend `kvdb` with `Prefetch` for prefetching buckets in one go and speed up payment control by prefetching payments on hot paths
2021-09-20 09:42:18 +02:00
naveen
8b4bbfbf61 mod : Replace for OSV GO-2020-0017 JWT
The github.com/dgrijalva/jwt-go is no longer maintained
has this CVE https://github.com/advisories/GHSA-w73w-5m7g-f7qc

But it is being used by https://github.com/etcd-io/etcd/issues/13254
which `lnd` uses.

The https://github.com/golang-jwt/jwt/releases/tag/v3.2.1 is a fork of
the same version which was 3.2.0 with the security fix.
2021-09-16 11:23:28 +00:00
Andras Banki-Horvath
152d1dc36a
kvdb: extra test coverage for kvdb.Prefetch 2021-09-14 13:12:23 +02:00
Andras Banki-Horvath
256b62e0d5
etcd: add kvdb.Prefetch
This commit extends the kvdb interface in a backwards compatible way
such that we'll be able to prefetch all keys in a bucket in one go reducing the
number of roundtrips.
2021-09-14 13:12:22 +02:00
Andras Banki-Horvath
daec66a4e4
etcd: STM to allow prefetching of keys and full ranges
This commit adds more full range caching to the STM such that we'll
be able to prefetch keys and ranges on the kvdb level. This will allow
us to reduce roundtrips to etcd do fast iteration of small ranges.
2021-09-14 13:12:19 +02:00
Andras Banki-Horvath
6c2d8bb176
etcd: enable optional log file for embedded etcd log output
In this commit we add an extra config for enabling logging to an
external file when using embedded etcd. This can be useful when running
integration tests to see more details about etcd related issues.
2021-09-10 14:40:54 +02:00
Andras Banki-Horvath
b29ae94e10
etcd: redesign commit queue to make it more robust and scalable
This commit builds on the ideas of @cfromknecht in lnd/5153. The
addition is that the design is now simpler and more robust by queueing
up everything, but allowing maximal parallelism where txns don't block.
Furthermore the commit makes CommitQueue.Done() private essentially
removing the need to understand the queue externally.
2021-08-06 07:53:13 +02:00
Andras Banki-Horvath
02aa77261d
etcd: fix dereferncing issue in etcd.CommitQueue causing contention
This commit fixes an issue where subsequent transaction retries may have
changed the read/write sets inside the STM which in turn left junk
references to these keys in the CommitQueue. The left keys potentially
conflicted with subsequent transactions, queueing them up causing
througput degradation.
2021-08-06 07:53:10 +02:00
Oliver Gugger
fe931d179f
etcd+channeldb: fix linter issues, rename receiver
With this commit we address some issues the linter picked up after
touching older code.
2021-08-04 14:55:56 +02:00
Oliver Gugger
482f76a0f4
mod+kvdb+channeldb: use btcwallet new DB interface
Depends on btcsuite/btcwallet#757.
Pulls in the updated version of btcwallet and walletdb that have the DB
interface enhanced by their own View() and Update() methods with the
reset callback/closure supported out of the box. That way the global
package-level View() and Update() functions now become pure redirects.
2021-08-04 14:55:55 +02:00
Oliver Gugger
1e84b52fee
lncfg+etcd: add namespace support for etcd databases
Since we're now storing the content of multiple previously distinct
database files in etcd, we want to properly namespace them as not to
provoke any key collisions. We append a sub namespace to the given
global namespace in order to still support multiple lnd nodes using the
same etcd database simultaneously.

Because the btcwallet code uses the legacy walletdb interface we must
assume it is not fully concurrency safe. Therefore we make sure only a
single writer can be active at any given time for the wallet DB backend
when using etcd.
2021-08-04 14:55:54 +02:00
Oliver Gugger
b1b0aac643
kvdb+lncfg: fix some typos in comments 2021-08-04 14:55:48 +02:00
Oliver Gugger
76e1223bf2
mod+kvdb: update etcd to v3.5.0 2021-07-27 13:09:59 +02:00
Oliver Gugger
724ca7a358
kvdb: exclude anything bbolt related from JS builds
Since bbolt uses syscalls for memory mapping that aren't available in
JS/WASM builds, we need to make sure we don't reference that code at
all. Otherwise we can't use parts of lnd as a library in projects that
are being compiled down to a WASM binary.
2021-07-22 09:47:37 +02:00
Oliver Gugger
73aa40f00e
lnwallet+kvdb: remove duplicate bdb backend imports
We only want to register the bbolt DB backend ("bdb") when we're not
compiling for a JS/WASM build targets. That's why we want to have that
import in only one file that we can add a build tag to. We remove it in
two other places since only one import is enough anyway.
2021-07-22 09:47:36 +02:00
Andras Banki-Horvath
bc4ffb489d
etcd: optionally reduce concurrency to single writer for legacy code 2021-07-20 21:02:11 +02:00
Andras Banki-Horvath
96caa6f242
etcd: remove assertion when creating bucket and value with the same key
This commit removes an assertion which is not needed because with etcd
we can safely create keys and values with the same key since they are
stored under different keys in the DB. This saves us one unnecessary Get
on every Put.
2021-07-16 16:06:32 +02:00
Andras Banki-Horvath
11a44a94b1
etcd: remove unnecessary iterator step from cursor Delete
The etcd cursor Delete stepped to the next item in the range before
Delete to not invalidate the iteation. This is unnecessary and not
compatible with bbolt, resulting in an extra fetch too.
2021-07-16 15:21:14 +02:00
Oliver Gugger
8acbe177fa
Merge pull request #5525 from bhandras/etcd_failover_itest_flake_fix
harness: remove killed nodes from active nodes
2021-07-15 17:27:07 +02:00
Andras Banki-Horvath
6dc64f7d2f
etcd: disable excessive logging when using embedded etcd 2021-07-15 15:35:38 +02:00
Joost Jager
e9cba1a526
kvdb/test: add bolt test 2021-07-12 11:31:11 +02:00
Joost Jager
f592375d1b
kvdb/test: fix cursor tests to match bbolt semantics
From bbolt docs:
// Seek positions the cursor at the passed seek key. If the key does not exist,
// the cursor is moved to the next key after seek. Returns the new pair.
2021-07-12 11:31:09 +02:00
Joost Jager
84490466be
kvdb/test: remove invalid operations
Accessing buckets that have been removed is not an allowed operation.
2021-07-12 11:31:07 +02:00
Joost Jager
3c6d35ec41
kvdb/test: generalize etcd tests 2021-07-12 11:31:05 +02:00
Andras Banki-Horvath
fc139d9bb8
kvdb: add ForEachBucket implementation 2021-05-13 10:35:35 +02:00
Andras Banki-Horvath
3c6f036bee
kvdb: make lnd/kvdb a submodule 2021-05-07 14:18:57 +02:00
Andras Banki-Horvath
14c851c8fc
kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00