mdbx_go: use right version in devel (#8250)

This commit is contained in:
Alex Sharov 2023-09-21 04:58:15 +07:00 committed by GitHub
parent 9192ef8f5c
commit 69941e0a9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 13 deletions

View File

@ -72,14 +72,14 @@ jobs:
if: runner.os == 'Linux'
run: cd erigon-lib && make lint-licenses-deps lint-licenses
- name: Test
run: make test
- name: Test erigon-lib
env:
CGO_CXXFLAGS: "-g -O2 -std=c++17"
run: cd erigon-lib && make test
- name: Test
run: make test
tests-windows:
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
strategy:

View File

@ -39,20 +39,26 @@ func TestChangeInfoHashOfSameFile(t *testing.T) {
tt, ok = d.torrentClient.Torrent(snaptype.Hex2InfoHash("aa"))
require.True(ok)
require.Equal("a.seg", tt.Name())
}
// allow adding files only if they are insidesnapshots dir
_, err = BuildTorrentIfNeed(d.ctx, "a.seg", dirs.Snap)
func TestNoEscape(t *testing.T) {
require := require.New(t)
dirs := datadir.New(t.TempDir())
ctx := context.Background()
// allow adding files only if they are inside snapshots dir
_, err := BuildTorrentIfNeed(ctx, "a.seg", dirs.Snap)
require.NoError(err)
_, err = BuildTorrentIfNeed(d.ctx, "b/a.seg", dirs.Snap)
_, err = BuildTorrentIfNeed(ctx, "b/a.seg", dirs.Snap)
require.NoError(err)
_, err = BuildTorrentIfNeed(d.ctx, filepath.Join(dirs.Snap, "a.seg"), dirs.Snap)
_, err = BuildTorrentIfNeed(ctx, filepath.Join(dirs.Snap, "a.seg"), dirs.Snap)
require.NoError(err)
_, err = BuildTorrentIfNeed(d.ctx, filepath.Join(dirs.Snap, "b", "a.seg"), dirs.Snap)
_, err = BuildTorrentIfNeed(ctx, filepath.Join(dirs.Snap, "b", "a.seg"), dirs.Snap)
require.NoError(err)
// reject escaping snapshots dir
_, err = BuildTorrentIfNeed(d.ctx, filepath.Join(dirs.Chaindata, "b", "a.seg"), dirs.Snap)
_, err = BuildTorrentIfNeed(ctx, filepath.Join(dirs.Chaindata, "b", "a.seg"), dirs.Snap)
require.Error(err)
_, err = BuildTorrentIfNeed(d.ctx, "./../a.seg", dirs.Snap)
_, err = BuildTorrentIfNeed(ctx, "./../a.seg", dirs.Snap)
require.Error(err)
}

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/ledgerwatch/erigon
go 1.19
require (
github.com/erigontech/mdbx-go v0.33.1
github.com/erigontech/mdbx-go v0.27.14
github.com/ledgerwatch/erigon-lib v0.0.0-20230920112310-93d9c9d9fe4b
github.com/ledgerwatch/erigon-snapshot v1.2.1-0.20230911054727-4e865b051314
github.com/ledgerwatch/log/v3 v3.9.0

4
go.sum
View File

@ -248,8 +248,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/erigontech/mdbx-go v0.33.1 h1:j4UV+kHlSSPLD/e1vLI6PuaTcjsJAX0heBryewyk7fA=
github.com/erigontech/mdbx-go v0.33.1/go.mod h1:FAMxbOgqOnRDx51j8HjuJZIgznbDwjX7LItd+/UWyA4=
github.com/erigontech/mdbx-go v0.27.14 h1:IVVeQVCAjZRpAR8bThlP2ISxrOwdV35NZdGwAgotaRw=
github.com/erigontech/mdbx-go v0.27.14/go.mod h1:FAMxbOgqOnRDx51j8HjuJZIgznbDwjX7LItd+/UWyA4=
github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c h1:CndMRAH4JIwxbW8KYq6Q+cGWcGHz0FjGR3QqcInWcW0=
github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=