diff --git a/go.mod b/go.mod index 9b8db14fb5..f4022570f5 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.1 github.com/CortexFoundation/inference v1.0.2-0.20230307032835-9197d586a4e8 github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 - github.com/CortexFoundation/torrentfs v1.0.69-0.20241018084445-786f28fec5ce + github.com/CortexFoundation/torrentfs v1.0.69-0.20241027142008-6bf9445f396f github.com/VictoriaMetrics/fastcache v1.12.2 github.com/arsham/figurine v1.3.0 github.com/aws/aws-sdk-go-v2 v1.32.2 @@ -16,17 +16,17 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.17.41 github.com/aws/aws-sdk-go-v2/service/route53 v1.45.2 github.com/cespare/cp v1.1.1 - github.com/charmbracelet/bubbletea v1.1.1 - github.com/cloudflare/cloudflare-go v0.107.0 + github.com/charmbracelet/bubbletea v1.1.2 + github.com/cloudflare/cloudflare-go v0.108.0 github.com/cockroachdb/pebble v1.1.2 github.com/consensys/gnark-crypto v0.14.0 github.com/crate-crypto/go-kzg-4844 v1.1.0 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/deckarep/golang-set/v2 v2.6.0 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 - github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 + github.com/dop251/goja v0.0.0-20241024094426-79f3a7efcdbd github.com/ethereum/c-kzg-4844 v1.0.3 - github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 + github.com/ethereum/go-verkle v0.2.1 github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776 github.com/fsnotify/fsnotify v1.7.0 @@ -126,8 +126,8 @@ require ( github.com/bwmarrin/snowflake v0.3.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/charmbracelet/lipgloss v0.13.0 // indirect - github.com/charmbracelet/x/ansi v0.3.2 // indirect + github.com/charmbracelet/lipgloss v0.13.1 // indirect + github.com/charmbracelet/x/ansi v0.4.0 // indirect github.com/charmbracelet/x/term v0.2.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect @@ -138,8 +138,8 @@ require ( github.com/consensys/bavard v0.1.22 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect - github.com/dgraph-io/badger/v4 v4.3.1 // indirect - github.com/dgraph-io/ristretto v1.0.0 // indirect + github.com/dgraph-io/badger/v4 v4.3.2-0.20241025163334-7f657f862cbd // indirect + github.com/dgraph-io/ristretto/v2 v2.0.0-alpha // indirect github.com/dlclark/regexp2 v1.11.4 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/edsrzf/mmap-go v1.2.0 // indirect @@ -161,11 +161,11 @@ require ( github.com/google/btree v1.1.3 // indirect github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/pprof v0.0.0-20241017200806-017d972448fc // indirect + github.com/google/pprof v0.0.0-20241023014458-598669927662 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect - github.com/jedib0t/go-pretty/v6 v6.6.0 // indirect + github.com/jedib0t/go-pretty/v6 v6.6.1 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect @@ -208,7 +208,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.60.0 // indirect + github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/protolambda/ctxlock v0.1.0 // indirect github.com/rakyll/statik v0.1.7 // indirect @@ -226,7 +226,7 @@ require ( github.com/tklauser/numcpus v0.9.0 // indirect github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd // indirect github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb // indirect - github.com/ucwong/golang-kv v1.0.24-0.20241016100820-f20ccc488463 // indirect + github.com/ucwong/golang-kv v1.0.24-0.20241027140620-922b40f404bb // indirect github.com/ucwong/shard v1.0.1-0.20240327124306-59a521744cae // indirect github.com/wlynxg/anet v0.0.5 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect diff --git a/go.sum b/go.sum index 2e3fdfda99..4000ec9788 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,8 @@ github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66/go.mod h1: github.com/CortexFoundation/torrentfs v1.0.13-0.20200623060705-ce027f43f2f8/go.mod h1:Ma+tGhPPvz4CEZHaqEJQMOEGOfHeQBiAoNd1zyc/w3Q= github.com/CortexFoundation/torrentfs v1.0.14-0.20200703071639-3fcabcabf274/go.mod h1:qnb3YlIJmuetVBtC6Lsejr0Xru+1DNmDCdTqnwy7lhk= github.com/CortexFoundation/torrentfs v1.0.20-0.20200810031954-d36d26f82fcc/go.mod h1:N5BsicP5ynjXIi/Npl/SRzlJ630n1PJV2sRj0Z0t2HA= -github.com/CortexFoundation/torrentfs v1.0.69-0.20241018084445-786f28fec5ce h1:lYPJo5XHt1REsd4cXedMLTFgu8wS3OthdZREEgaZ+w0= -github.com/CortexFoundation/torrentfs v1.0.69-0.20241018084445-786f28fec5ce/go.mod h1:FTHA/hM7OzUWX8Aj2ushrAPPkmLSpN+1/szVYYRNClA= +github.com/CortexFoundation/torrentfs v1.0.69-0.20241027142008-6bf9445f396f h1:/+vigzB/54Fp3cFzcUjmypEHZe5oRX/1DNc6vPqb1X0= +github.com/CortexFoundation/torrentfs v1.0.69-0.20241027142008-6bf9445f396f/go.mod h1:Rnt25WhynJWxd1zf1pCT8jaDw8UeV53fegF25T8BZO8= github.com/CortexFoundation/wormhole v0.0.2-0.20240624201423-33e289eb7662 h1:rmM5WDx5UX7V4LF1D8LtAOPDzcCKulpZ++NkP8/+Ook= github.com/CortexFoundation/wormhole v0.0.2-0.20240624201423-33e289eb7662/go.mod h1:ipzmPabDgzYKUbXkGVe2gTkBEp+MsDx6pXGiuYzmP6s= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= @@ -337,12 +337,12 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charmbracelet/bubbletea v1.1.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqKOCvppbPY= -github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= -github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw= -github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY= -github.com/charmbracelet/x/ansi v0.3.2 h1:wsEwgAN+C9U06l9dCVMX0/L3x7ptvY1qmjMwyfE6USY= -github.com/charmbracelet/x/ansi v0.3.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= +github.com/charmbracelet/bubbletea v1.1.2 h1:naQXF2laRxyLyil/i7fxdpiz1/k06IKquhm4vBfHsIc= +github.com/charmbracelet/bubbletea v1.1.2/go.mod h1:9HIU/hBV24qKjlehyj8z1r/tR9TYTQEag+cWZnuXo8E= +github.com/charmbracelet/lipgloss v0.13.1 h1:Oik/oqDTMVA01GetT4JdEC033dNzWoQHdWnHnQmXE2A= +github.com/charmbracelet/lipgloss v0.13.1/go.mod h1:zaYVJ2xKSKEnTEEbX6uAHabh2d975RJ+0yfkFpRBz5U= +github.com/charmbracelet/x/ansi v0.4.0 h1:NqwHA4B23VwsDn4H3VcNX1W1tOmgnvY1NDx5tOXdnOU= +github.com/charmbracelet/x/ansi v0.4.0/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0= github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0= github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= @@ -355,8 +355,8 @@ github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMn github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.11.7/go.mod h1:GyEn0B58Zvn/XOrkE/R31DrKqjTsBQ9E5ICzRlE09hk= -github.com/cloudflare/cloudflare-go v0.107.0 h1:cMDIw2tzt6TXCJyMFVyP+BPOVkIfMvcKjhMNSNvuEPc= -github.com/cloudflare/cloudflare-go v0.107.0/go.mod h1:5cYGzVBqNTLxMYSLdVjuSs5LJL517wJDSvMPWUrzHzc= +github.com/cloudflare/cloudflare-go v0.108.0 h1:C4Skfjd8I8X3uEOGmQUT4/iGyZcWdkIU7HwvMoLkEE0= +github.com/cloudflare/cloudflare-go v0.108.0/go.mod h1:m492eNahT/9MsN7Ppnoge8AaI7QhVFtEgVm3I9HJFeU= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= @@ -412,10 +412,10 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/dgraph-io/badger/v4 v4.3.1 h1:7r5wKqmoRpGgSxqa0S/nGdpOpvvzuREGPLSua73C8tw= -github.com/dgraph-io/badger/v4 v4.3.1/go.mod h1:oObz97DImXpd6O/Dt8BqdKLLTDmEmarAimo72VV5whQ= -github.com/dgraph-io/ristretto v1.0.0 h1:SYG07bONKMlFDUYu5pEu3DGAh8c2OFNzKm6G9J4Si84= -github.com/dgraph-io/ristretto v1.0.0/go.mod h1:jTi2FiYEhQ1NsMmA7DeBykizjOuY88NhKBkepyu1jPc= +github.com/dgraph-io/badger/v4 v4.3.2-0.20241025163334-7f657f862cbd h1:gBEojGbRiFsAekJZQ9HqrRLJayUJrxuHICJajqGRqVs= +github.com/dgraph-io/badger/v4 v4.3.2-0.20241025163334-7f657f862cbd/go.mod h1:O6a0iYGnDcrYfGWM/haKT7/WfztAlGFEJrv63EkyZbk= +github.com/dgraph-io/ristretto/v2 v2.0.0-alpha h1:JBy5Mm/z1HBj3hyDLFBS2uHalL971q3yjUaKcia0Sgo= +github.com/dgraph-io/ristretto/v2 v2.0.0-alpha/go.mod h1:7bFGBdXzLfFFjKCN8YDQ7+98m/AEYcrdqH7s0En96Qg= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= @@ -427,8 +427,8 @@ github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cn github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 h1:MXsAuToxwsTn5BEEYm2DheqIiC4jWGmkEJ1uy+KFhvQ= -github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4= +github.com/dop251/goja v0.0.0-20241024094426-79f3a7efcdbd h1:QMSNEh9uQkDjyPwu/J541GgSH+4hw+0skJDIj9HJ3mE= +github.com/dop251/goja v0.0.0-20241024094426-79f3a7efcdbd/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v0.0.0-20180421182945-02af3965c54e/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -460,8 +460,8 @@ github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97 github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/ethereum/c-kzg-4844 v1.0.3 h1:IEnbOHwjixW2cTvKRUlAAUOeleV7nNM/umJR+qy4WDs= github.com/ethereum/c-kzg-4844 v1.0.3/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4= -github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w= +github.com/ethereum/go-verkle v0.2.1 h1:FYWEByFT19jT/ym/dy++E+f1SSw899uXGNrhCkwjYJw= +github.com/ethereum/go-verkle v0.2.1/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e h1:bBLctRc7kr01YGvaDfgLbTwjFNW5jdp5y5rj8XXBHfY= github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= @@ -622,8 +622,8 @@ github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OI github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= -github.com/google/pprof v0.0.0-20241017200806-017d972448fc h1:NGyrhhFhwvRAZg02jnYVg3GBQy0qGBKmFQJwaPmpmxs= -github.com/google/pprof v0.0.0-20241017200806-017d972448fc/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241023014458-598669927662 h1:SKMkD83p7FwUqKmBsPdLHF5dNyxq3jOWwu9w9UyH5vA= +github.com/google/pprof v0.0.0-20241023014458-598669927662/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -732,8 +732,8 @@ github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1: github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jedib0t/go-pretty/v6 v6.6.0 h1:wmZVuAcEkZRT+Aq1xXpE8IGat4vE5WXOMmBpbQqERXw= -github.com/jedib0t/go-pretty/v6 v6.6.0/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= +github.com/jedib0t/go-pretty/v6 v6.6.1 h1:iJ65Xjb680rHcikRj6DSIbzCex2huitmc7bDtxYVWyc= +github.com/jedib0t/go-pretty/v6 v6.6.1/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 h1:TMtDYDHKYY15rFihtRfck/bfFqNfvcabqvXAFQfAUpY= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= @@ -1073,8 +1073,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= -github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= +github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= +github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -1249,8 +1249,8 @@ github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd h1:gBtlvLAsgLk+ github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd/go.mod h1:ddwX+NCjMZPdpzcGh1fcEbNTUTCtKgt2hC2rqvmLKgA= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb h1:dVZH3AH9f7zB3VBmsjn25B7lfcAyMP4QxdFYTrfj7tg= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb/go.mod h1:3yswsBsVuwsOjDvFfC5Na9XSEf4HC7mj3W3g6jvSY/s= -github.com/ucwong/golang-kv v1.0.24-0.20241016100820-f20ccc488463 h1:poClXhIju1Oi6FYGjAakeZYsavrEj7rTLnHqwNWtRI8= -github.com/ucwong/golang-kv v1.0.24-0.20241016100820-f20ccc488463/go.mod h1:Hz8aWKtvxBApLGQnKhdzq8RfQBIiFmvbjvbx1e4HsOU= +github.com/ucwong/golang-kv v1.0.24-0.20241027140620-922b40f404bb h1:477J6za6lOi6/U+r+/8rVejhRsqY0Mm3rjm/F1KS7vU= +github.com/ucwong/golang-kv v1.0.24-0.20241027140620-922b40f404bb/go.mod h1:PeHyOfhlJ3FbvoABVJQb3dQhfRcCiHkZFlDRFtMKLVU= github.com/ucwong/golang-set v1.8.1-0.20200419153428-d7b0b1ac2d43/go.mod h1:xu0FaiQFGbBcFZj2o7udZ5rbA8jRTsv47hkPoG5qQNM= github.com/ucwong/goleveldb v1.0.3-0.20200508074755-578cba616f37/go.mod h1:dgJUTtDxq/ne6/JzZhHzF24OL/uqILz9IWk8HmT4V2g= github.com/ucwong/goleveldb v1.0.3-0.20200618184106-f1c6bc3a428b/go.mod h1:7Sq6w7AfEZuB/a6mrlvHCSXCSkqojCMMrM3Ei12QAT0= diff --git a/vendor/github.com/charmbracelet/bubbletea/.golangci-soft.yml b/vendor/github.com/charmbracelet/bubbletea/.golangci-soft.yml deleted file mode 100644 index 1b6824bb2d..0000000000 --- a/vendor/github.com/charmbracelet/bubbletea/.golangci-soft.yml +++ /dev/null @@ -1,46 +0,0 @@ -run: - tests: false - -issues: - include: - - EXC0001 - - EXC0005 - - EXC0011 - - EXC0012 - - EXC0013 - - max-issues-per-linter: 0 - max-same-issues: 0 - -linters: - enable: - # - dupl - - exhaustive - # - exhaustivestruct - - goconst - - godot - - godox - - gomnd - - gomoddirectives - - goprintffuncname - # - lll - - misspell - - nakedret - - nestif - - noctx - - nolintlint - - prealloc - - wrapcheck - - # disable default linters, they are already enabled in .golangci.yml - disable: - - deadcode - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - structcheck - - typecheck - - unused - - varcheck diff --git a/vendor/github.com/charmbracelet/bubbletea/.golangci.yml b/vendor/github.com/charmbracelet/bubbletea/.golangci.yml index 3affce9147..d6789e014c 100644 --- a/vendor/github.com/charmbracelet/bubbletea/.golangci.yml +++ b/vendor/github.com/charmbracelet/bubbletea/.golangci.yml @@ -15,12 +15,10 @@ issues: linters: enable: - bodyclose - - exportloopref - gofumpt - goimports - gosec - nilerr - - predeclared - revive - rowserrcheck - sqlclosecheck diff --git a/vendor/github.com/charmbracelet/bubbletea/CONTRIBUTING.md b/vendor/github.com/charmbracelet/bubbletea/CONTRIBUTING.md deleted file mode 100644 index 19ee18c766..0000000000 --- a/vendor/github.com/charmbracelet/bubbletea/CONTRIBUTING.md +++ /dev/null @@ -1,13 +0,0 @@ -# Contributing - -Pull requests are welcome for any changes. - -Consider opening an issue for larger changes to get feedback on the idea from the team. - -If your change touches parts of the Bubble Tea renderer or internals, make sure -that all the examples in the `examples/` folder continue to run correctly. - -For commit messages, please use conventional commits[^1] to make it easier to -generate release notes. - -[^1]: https://www.conventionalcommits.org/en/v1.0.0 diff --git a/vendor/github.com/charmbracelet/bubbletea/README.md b/vendor/github.com/charmbracelet/bubbletea/README.md index f80e04ea21..4dbe75eb14 100644 --- a/vendor/github.com/charmbracelet/bubbletea/README.md +++ b/vendor/github.com/charmbracelet/bubbletea/README.md @@ -3,8 +3,8 @@

Bubble Tea Title Treatment
Latest Release - GoDoc - Build Status + GoDoc + Build Status phorm.ai

@@ -254,8 +254,8 @@ look at the [Command Tutorial][cmd]. It's pretty simple. There are also several [Bubble Tea examples][examples] available and, of course, there are [Go Docs][docs]. -[cmd]: http://github.com/charmbracelet/bubbletea/tree/master/tutorials/commands/ -[examples]: http://github.com/charmbracelet/bubbletea/tree/master/examples +[cmd]: https://github.com/charmbracelet/bubbletea/tree/master/tutorials/commands/ +[examples]: https://github.com/charmbracelet/bubbletea/tree/master/examples [docs]: https://pkg.go.dev/github.com/charmbracelet/bubbletea?tab=doc ## Debugging @@ -354,6 +354,12 @@ For more applications built with Bubble Tea see [Charm & Friends][community]. Is there something cool you made with Bubble Tea you want to share? [PRs][community] are welcome! +## Contributing + +See [contributing][contribute]. + +[contribute]: https://github.com/charmbracelet/bubbletea/contribute + ## Feedback We’d love to hear your thoughts on this project. Feel free to drop us a note! diff --git a/vendor/github.com/charmbracelet/bubbletea/options.go b/vendor/github.com/charmbracelet/bubbletea/options.go index 06abf4a983..12e92e4e8e 100644 --- a/vendor/github.com/charmbracelet/bubbletea/options.go +++ b/vendor/github.com/charmbracelet/bubbletea/options.go @@ -185,6 +185,9 @@ func WithoutRenderer() ProgramOption { // // This feature is provisional, and may be changed or removed in a future version // of this package. +// +// Deprecated: this incurs a noticable performance hit. A future release will +// optimize ANSI automatically without the performance penalty. func WithANSICompressor() ProgramOption { return func(p *Program) { p.startupOptions |= withANSICompressor diff --git a/vendor/github.com/charmbracelet/bubbletea/standard_renderer.go b/vendor/github.com/charmbracelet/bubbletea/standard_renderer.go index 59448e1d41..0cb0ef374b 100644 --- a/vendor/github.com/charmbracelet/bubbletea/standard_renderer.go +++ b/vendor/github.com/charmbracelet/bubbletea/standard_renderer.go @@ -276,7 +276,7 @@ func (r *standardRenderer) flush() { // This case fixes a bug in macOS terminal. In other terminals the // other case seems to do the job regardless of whether or not we're // using the full terminal window. - buf.WriteString(ansi.MoveCursor(r.linesRendered, 0)) + buf.WriteString(ansi.SetCursorPosition(0, r.linesRendered)) } else { buf.WriteString(ansi.CursorLeft(r.width)) } @@ -312,8 +312,8 @@ func (r *standardRenderer) clearScreen() { r.mtx.Lock() defer r.mtx.Unlock() - r.execute(ansi.EraseEntireDisplay) - r.execute(ansi.MoveCursorOrigin) + r.execute(ansi.EraseEntireScreen) + r.execute(ansi.CursorOrigin) r.repaint() } @@ -342,8 +342,8 @@ func (r *standardRenderer) enterAltScreen() { // // Note: we can't use r.clearScreen() here because the mutex is already // locked. - r.execute(ansi.EraseEntireDisplay) - r.execute(ansi.MoveCursorOrigin) + r.execute(ansi.EraseEntireScreen) + r.execute(ansi.CursorOrigin) // cmd.exe and other terminals keep separate cursor states for the AltScreen // and the main buffer. We have to explicitly reset the cursor visibility @@ -516,7 +516,7 @@ func (r *standardRenderer) setIgnoredLines(from int, to int) { } buf.WriteString(ansi.CursorUp1) } - buf.WriteString(ansi.MoveCursor(r.linesRendered, 0)) // put cursor back + buf.WriteString(ansi.SetCursorPosition(0, r.linesRendered)) // put cursor back _, _ = r.out.Write(buf.Bytes()) } } @@ -546,6 +546,9 @@ func (r *standardRenderer) clearIgnoredLines() { // use in high-performance rendering, such as a pager that could potentially // be rendering very complicated ansi. In cases where the content is simpler // standard Bubble Tea rendering should suffice. +// +// Deprecated: This option is deprecated and will be removed in a future +// version of this package. func (r *standardRenderer) insertTop(lines []string, topBoundary, bottomBoundary int) { r.mtx.Lock() defer r.mtx.Unlock() @@ -553,13 +556,13 @@ func (r *standardRenderer) insertTop(lines []string, topBoundary, bottomBoundary buf := &bytes.Buffer{} buf.WriteString(ansi.SetScrollingRegion(topBoundary, bottomBoundary)) - buf.WriteString(ansi.MoveCursor(topBoundary, 0)) + buf.WriteString(ansi.SetCursorPosition(0, topBoundary)) buf.WriteString(ansi.InsertLine(len(lines))) _, _ = buf.WriteString(strings.Join(lines, "\r\n")) buf.WriteString(ansi.SetScrollingRegion(0, r.height)) // Move cursor back to where the main rendering routine expects it to be - buf.WriteString(ansi.MoveCursor(r.linesRendered, 0)) + buf.WriteString(ansi.SetCursorPosition(0, r.linesRendered)) _, _ = r.out.Write(buf.Bytes()) } @@ -573,6 +576,9 @@ func (r *standardRenderer) insertTop(lines []string, topBoundary, bottomBoundary // See note in insertTop() for caveats, how this function only makes sense for // full-window applications, and how it differs from the normal way we do // rendering in Bubble Tea. +// +// Deprecated: This option is deprecated and will be removed in a future +// version of this package. func (r *standardRenderer) insertBottom(lines []string, topBoundary, bottomBoundary int) { r.mtx.Lock() defer r.mtx.Unlock() @@ -580,12 +586,12 @@ func (r *standardRenderer) insertBottom(lines []string, topBoundary, bottomBound buf := &bytes.Buffer{} buf.WriteString(ansi.SetScrollingRegion(topBoundary, bottomBoundary)) - buf.WriteString(ansi.MoveCursor(bottomBoundary, 0)) + buf.WriteString(ansi.SetCursorPosition(0, bottomBoundary)) _, _ = buf.WriteString("\r\n" + strings.Join(lines, "\r\n")) buf.WriteString(ansi.SetScrollingRegion(0, r.height)) // Move cursor back to where the main rendering routine expects it to be - buf.WriteString(ansi.MoveCursor(r.linesRendered, 0)) + buf.WriteString(ansi.SetCursorPosition(0, r.linesRendered)) _, _ = r.out.Write(buf.Bytes()) } @@ -657,6 +663,8 @@ type syncScrollAreaMsg struct { // should also be called on resize (WindowSizeMsg). // // For high-performance, scroll-based rendering only. +// +// Deprecated: This option will be removed in a future version of this package. func SyncScrollArea(lines []string, topBoundary int, bottomBoundary int) Cmd { return func() Msg { return syncScrollAreaMsg{ @@ -673,6 +681,8 @@ type clearScrollAreaMsg struct{} // those lines to the main rendering routine. // // For high-performance, scroll-based rendering only. +// +// Deprecated: This option will be removed in a future version of this package. func ClearScrollArea() Msg { return clearScrollAreaMsg{} } @@ -688,6 +698,8 @@ type scrollUpMsg struct { // from view. // // For high-performance, scroll-based rendering only. +// +// Deprecated: This option will be removed in a future version of this package. func ScrollUp(newLines []string, topBoundary, bottomBoundary int) Cmd { return func() Msg { return scrollUpMsg{ @@ -709,6 +721,8 @@ type scrollDownMsg struct { // disappear from view. // // For high-performance, scroll-based rendering only. +// +// Deprecated: This option will be removed in a future version of this package. func ScrollDown(newLines []string, topBoundary, bottomBoundary int) Cmd { return func() Msg { return scrollDownMsg{ diff --git a/vendor/github.com/charmbracelet/lipgloss/.golangci-soft.yml b/vendor/github.com/charmbracelet/lipgloss/.golangci-soft.yml deleted file mode 100644 index 1b6824bb2d..0000000000 --- a/vendor/github.com/charmbracelet/lipgloss/.golangci-soft.yml +++ /dev/null @@ -1,46 +0,0 @@ -run: - tests: false - -issues: - include: - - EXC0001 - - EXC0005 - - EXC0011 - - EXC0012 - - EXC0013 - - max-issues-per-linter: 0 - max-same-issues: 0 - -linters: - enable: - # - dupl - - exhaustive - # - exhaustivestruct - - goconst - - godot - - godox - - gomnd - - gomoddirectives - - goprintffuncname - # - lll - - misspell - - nakedret - - nestif - - noctx - - nolintlint - - prealloc - - wrapcheck - - # disable default linters, they are already enabled in .golangci.yml - disable: - - deadcode - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - structcheck - - typecheck - - unused - - varcheck diff --git a/vendor/github.com/charmbracelet/lipgloss/.golangci.yml b/vendor/github.com/charmbracelet/lipgloss/.golangci.yml deleted file mode 100644 index 3affce9147..0000000000 --- a/vendor/github.com/charmbracelet/lipgloss/.golangci.yml +++ /dev/null @@ -1,30 +0,0 @@ -run: - tests: false - -issues: - include: - - EXC0001 - - EXC0005 - - EXC0011 - - EXC0012 - - EXC0013 - - max-issues-per-linter: 0 - max-same-issues: 0 - -linters: - enable: - - bodyclose - - exportloopref - - gofumpt - - goimports - - gosec - - nilerr - - predeclared - - revive - - rowserrcheck - - sqlclosecheck - - tparallel - - unconvert - - unparam - - whitespace diff --git a/vendor/github.com/charmbracelet/lipgloss/README.md b/vendor/github.com/charmbracelet/lipgloss/README.md index 42661d6cad..f171e7d08c 100644 --- a/vendor/github.com/charmbracelet/lipgloss/README.md +++ b/vendor/github.com/charmbracelet/lipgloss/README.md @@ -10,7 +10,7 @@ Style definitions for nice terminal layouts. Built with TUIs in mind. -![Lip Gloss example](https://stuff.charm.sh/lipgloss/lipgloss-example.png) +![Lip Gloss example](https://github.com/user-attachments/assets/99c5c015-551b-4897-8cd1-bcaafa0aad5a) Lip Gloss takes an expressive, declarative approach to terminal rendering. Users familiar with CSS will feel at home with Lip Gloss. @@ -402,7 +402,7 @@ block := lipgloss.Place(30, 80, lipgloss.Right, lipgloss.Bottom, fancyStyledPara You can also style the whitespace. For details, see [the docs][docs]. -### Rendering Tables +## Rendering Tables Lip Gloss ships with a table rendering sub-package. @@ -483,15 +483,15 @@ Lists have the ability to nest. ```go l := list.New( - "A", list.New("Artichoke"), - "B", list.New("Baking Flour", "Bananas", "Barley", "Bean Sprouts"), - "C", list.New("Cashew Apple", "Cashews", "Coconut Milk", "Curry Paste", "Currywurst"), - "D", list.New("Dill", "Dragonfruit", "Dried Shrimp"), - "E", list.New("Eggs"), - "F", list.New("Fish Cake", "Furikake"), - "J", list.New("Jicama"), - "K", list.New("Kohlrabi"), - "L", list.New("Leeks", "Lentils", "Licorice Root"), + "A", list.New("Artichoke"), + "B", list.New("Baking Flour", "Bananas", "Barley", "Bean Sprouts"), + "C", list.New("Cashew Apple", "Cashews", "Coconut Milk", "Curry Paste", "Currywurst"), + "D", list.New("Dill", "Dragonfruit", "Dried Shrimp"), + "E", list.New("Eggs"), + "F", list.New("Fish Cake", "Furikake"), + "J", list.New("Jicama"), + "K", list.New("Kohlrabi"), + "L", list.New("Leeks", "Lentils", "Licorice Root"), ) ``` @@ -513,15 +513,15 @@ enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("99")).MarginRi itemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("212")).MarginRight(1) l := list.New( - "Glossier", - "Claire’s Boutique", - "Nyx", - "Mac", - "Milk", -). - Enumerator(list.Roman). - EnumeratorStyle(enumeratorStyle). - ItemStyle(itemStyle) + "Glossier", + "Claire’s Boutique", + "Nyx", + "Mac", + "Milk", + ). + Enumerator(list.Roman). + EnumeratorStyle(enumeratorStyle). + ItemStyle(itemStyle) ``` Print the list. @@ -574,7 +574,7 @@ Define a new tree. ```go t := tree.Root("."). - Child("A", "B", "C") + Child("A", "B", "C") ``` Print the tree. @@ -592,18 +592,20 @@ Trees have the ability to nest. ```go t := tree.Root("."). - Child("Item 1"). - Child( - tree.Root("Item 2"). - Child("Item 2.1"). - Child("Item 2.2"). - Child("Item 2.3"), - ). - Child( - tree.Root("Item 3"). - Child("Item 3.1"). - Child("Item 3.2"), - ) + Child("macOS"). + Child( + tree.New(). + Root("Linux"). + Child("NixOS"). + Child("Arch Linux (btw)"). + Child("Void Linux"), + ). + Child( + tree.New(). + Root("BSD"). + Child("FreeBSD"). + Child("OpenBSD"), + ) ``` Print the tree. @@ -613,34 +615,40 @@ fmt.Println(t) ```

-Tree Example (simple) +Tree Example (simple)

Trees can be customized via their enumeration function as well as using `lipgloss.Style`s. ```go -enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("99")).MarginRight(1) -itemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("212")).MarginRight(1) - -t := tree.Root("Makeup"). - Child( - "Glossier", - "Claire’s Boutique", - "Nyx", - "Mac", - "Milk", - ). - Enumerator(tree.RoundedEnumerator). - EnumeratorStyle(enumeratorStyle). - ItemStyle(itemStyle). - RootStyle(lipgloss.NewStyle().Foreground(lipgloss.Color("#04B575"))) +enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("63")).MarginRight(1) +rootStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("35")) +itemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("212")) + +t := tree. + Root("⁜ Makeup"). + Child( + "Glossier", + "Fenty Beauty", + tree.New().Child( + "Gloss Bomb Universal Lip Luminizer", + "Hot Cheeks Velour Blushlighter", + ), + "Nyx", + "Mac", + "Milk", + ). + Enumerator(tree.RoundedEnumerator). + EnumeratorStyle(enumeratorStyle). + RootStyle(rootStyle). + ItemStyle(itemStyle) ``` Print the tree.

-Tree Example (makeup) +Tree Example (makeup)

The predefined enumerators for trees are `DefaultEnumerator` and `RoundedEnumerator`. @@ -726,6 +734,12 @@ the stylesheet-based Markdown renderer. [glamour]: https://github.com/charmbracelet/glamour +## Contributing + +See [contributing][contribute]. + +[contribute]: https://github.com/charmbracelet/lipgloss/contribute + ## Feedback We’d love to hear your thoughts on this project. Feel free to drop us a note! diff --git a/vendor/github.com/charmbracelet/lipgloss/style.go b/vendor/github.com/charmbracelet/lipgloss/style.go index 4343d3cd64..0eb5c016b3 100644 --- a/vendor/github.com/charmbracelet/lipgloss/style.go +++ b/vendor/github.com/charmbracelet/lipgloss/style.go @@ -353,6 +353,8 @@ func (s Style) Render(strs ...string) string { // Potentially convert tabs to spaces str = s.maybeConvertTabs(str) + // carriage returns can cause strange behaviour when rendering. + str = strings.ReplaceAll(str, "\r\n", "\n") // Strip newlines in single line mode if inline { @@ -562,14 +564,14 @@ func pad(str string, n int, style *termenv.Style) string { return b.String() } -func max(a, b int) int { //nolint:unparam +func max(a, b int) int { //nolint:unparam,predeclared if a > b { return a } return b } -func min(a, b int) int { +func min(a, b int) int { //nolint:predeclared if a < b { return a } diff --git a/vendor/github.com/charmbracelet/x/ansi/cursor.go b/vendor/github.com/charmbracelet/x/ansi/cursor.go index ec1fc4d201..f79e1e7e5b 100644 --- a/vendor/github.com/charmbracelet/x/ansi/cursor.go +++ b/vendor/github.com/charmbracelet/x/ansi/cursor.go @@ -147,13 +147,13 @@ func CursorPreviousLine(n int) string { return "\x1b[" + s + "F" } -// MoveCursor (CUP) returns a sequence for moving the cursor to the given row -// and column. +// SetCursorPosition (CUP) returns a sequence for setting the cursor to the +// given row and column. // // CSI n ; m H // // See: https://vt100.net/docs/vt510-rm/CUP.html -func MoveCursor(row, col int) string { +func SetCursorPosition(col, row int) string { if row < 0 { row = 0 } @@ -163,9 +163,9 @@ func MoveCursor(row, col int) string { return "\x1b[" + strconv.Itoa(row) + ";" + strconv.Itoa(col) + "H" } -// MoveCursorOrigin is a sequence for moving the cursor to the upper left -// corner of the screen. This is equivalent to MoveCursor(1, 1). -const MoveCursorOrigin = "\x1b[1;1H" +// CursorOrigin is a sequence for moving the cursor to the upper left corner of +// the display. This is equivalent to `SetCursorPosition(1, 1)`. +const CursorOrigin = "\x1b[1;1H" // SaveCursorPosition (SCP or SCOSC) is a sequence for saving the cursor // position. diff --git a/vendor/github.com/charmbracelet/x/ansi/mode.go b/vendor/github.com/charmbracelet/x/ansi/mode.go index 5d70543456..10dfcf5af8 100644 --- a/vendor/github.com/charmbracelet/x/ansi/mode.go +++ b/vendor/github.com/charmbracelet/x/ansi/mode.go @@ -1,5 +1,7 @@ package ansi +import "strconv" + // This file define uses multiple sequences to set (SM), reset (RM), and request // (DECRQM) different ANSI and DEC modes. // @@ -21,27 +23,43 @@ package ansi // Where Pa is the mode number, and Ps is the mode value. // See: https://vt100.net/docs/vt510-rm/DECRPM.html +// Mode represents an ANSI terminal mode. +type Mode int + +// String returns the mode as a string. +func (m Mode) String() string { + return strconv.Itoa(int(m)) +} + +// PrivateMode represents a private DEC terminal mode. +type PrivateMode int + +// String returns the private mode as a string. +func (m PrivateMode) String() string { + return "?" + strconv.Itoa(int(m)) +} + // Application Cursor Keys (DECCKM) is a mode that determines whether the // cursor keys send ANSI cursor sequences or application sequences. // // See: https://vt100.net/docs/vt510-rm/DECCKM.html const ( - CursorKeysMode = "?1" + CursorKeysMode = PrivateMode(1) - EnableCursorKeys = "\x1b[" + CursorKeysMode + "h" - DisableCursorKeys = "\x1b[" + CursorKeysMode + "l" - RequestCursorKeys = "\x1b[" + CursorKeysMode + "$p" + EnableCursorKeys = "\x1b[?1h" + DisableCursorKeys = "\x1b[?1l" + RequestCursorKeys = "\x1b[?1$p" ) // Text Cursor Enable Mode (DECTCEM) is a mode that shows/hides the cursor. // // See: https://vt100.net/docs/vt510-rm/DECTCEM.html const ( - CursorVisibilityMode = "?25" + CursorEnableMode = PrivateMode(25) - ShowCursor = "\x1b[" + CursorVisibilityMode + "h" - HideCursor = "\x1b[" + CursorVisibilityMode + "l" - RequestCursorVisibility = "\x1b[" + CursorVisibilityMode + "$p" + ShowCursor = "\x1b[?25h" + HideCursor = "\x1b[?25l" + RequestCursorVisibility = "\x1b[?25$p" ) // VT Mouse Tracking is a mode that determines whether the mouse reports on @@ -49,11 +67,11 @@ const ( // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking const ( - MouseMode = "?1000" + MouseMode = PrivateMode(1000) - EnableMouse = "\x1b[" + MouseMode + "h" - DisableMouse = "\x1b[" + MouseMode + "l" - RequestMouse = "\x1b[" + MouseMode + "$p" + EnableMouse = "\x1b[?1000h" + DisableMouse = "\x1b[?1000l" + RequestMouse = "\x1b[?1000$p" ) // VT Hilite Mouse Tracking is a mode that determines whether the mouse reports on @@ -61,11 +79,11 @@ const ( // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking const ( - MouseHiliteMode = "?1001" + MouseHiliteMode = PrivateMode(1001) - EnableMouseHilite = "\x1b[" + MouseHiliteMode + "h" - DisableMouseHilite = "\x1b[" + MouseHiliteMode + "l" - RequestMouseHilite = "\x1b[" + MouseHiliteMode + "$p" + EnableMouseHilite = "\x1b[?1001h" + DisableMouseHilite = "\x1b[?1001l" + RequestMouseHilite = "\x1b[?1001$p" ) // Cell Motion Mouse Tracking is a mode that determines whether the mouse @@ -73,11 +91,11 @@ const ( // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking const ( - MouseCellMotionMode = "?1002" + MouseCellMotionMode = PrivateMode(1002) - EnableMouseCellMotion = "\x1b[" + MouseCellMotionMode + "h" - DisableMouseCellMotion = "\x1b[" + MouseCellMotionMode + "l" - RequestMouseCellMotion = "\x1b[" + MouseCellMotionMode + "$p" + EnableMouseCellMotion = "\x1b[?1002h" + DisableMouseCellMotion = "\x1b[?1002l" + RequestMouseCellMotion = "\x1b[?1002$p" ) // All Mouse Tracking is a mode that determines whether the mouse reports on @@ -85,22 +103,22 @@ const ( // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking const ( - MouseAllMotionMode = "?1003" + MouseAllMotionMode = PrivateMode(1003) - EnableMouseAllMotion = "\x1b[" + MouseAllMotionMode + "h" - DisableMouseAllMotion = "\x1b[" + MouseAllMotionMode + "l" - RequestMouseAllMotion = "\x1b[" + MouseAllMotionMode + "$p" + EnableMouseAllMotion = "\x1b[?1003h" + DisableMouseAllMotion = "\x1b[?1003l" + RequestMouseAllMotion = "\x1b[?1003$p" ) // Report Focus is a mode that makes the terminal report focus-in and focus-out events. // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-FocusIn_FocusOut const ( - ReportFocusMode = "?1004" + ReportFocusMode = PrivateMode(1004) - EnableReportFocus = "\x1b[" + ReportFocusMode + "h" - DisableReportFocus = "\x1b[" + ReportFocusMode + "l" - RequestReportFocus = "\x1b[" + ReportFocusMode + "$p" + EnableReportFocus = "\x1b[?1004h" + DisableReportFocus = "\x1b[?1004l" + RequestReportFocus = "\x1b[?1004$p" ) // SGR Mouse Extension is a mode that determines whether the mouse reports events @@ -108,11 +126,11 @@ const ( // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking const ( - MouseSgrExtMode = "?1006" + MouseSgrExtMode = PrivateMode(1006) - EnableMouseSgrExt = "\x1b[" + MouseSgrExtMode + "h" - DisableMouseSgrExt = "\x1b[" + MouseSgrExtMode + "l" - RequestMouseSgrExt = "\x1b[" + MouseSgrExtMode + "$p" + EnableMouseSgrExt = "\x1b[?1006h" + DisableMouseSgrExt = "\x1b[?1006l" + RequestMouseSgrExt = "\x1b[?1006$p" ) // Alternate Screen Buffer is a mode that determines whether the alternate screen @@ -120,11 +138,11 @@ const ( // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer const ( - AltScreenBufferMode = "?1049" + AltScreenBufferMode = PrivateMode(1049) - EnableAltScreenBuffer = "\x1b[" + AltScreenBufferMode + "h" - DisableAltScreenBuffer = "\x1b[" + AltScreenBufferMode + "l" - RequestAltScreenBuffer = "\x1b[" + AltScreenBufferMode + "$p" + EnableAltScreenBuffer = "\x1b[?1049h" + DisableAltScreenBuffer = "\x1b[?1049l" + RequestAltScreenBuffer = "\x1b[?1049$p" ) // Bracketed Paste Mode is a mode that determines whether pasted text is @@ -133,11 +151,11 @@ const ( // See: https://cirw.in/blog/bracketed-paste // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode const ( - BracketedPasteMode = "?2004" + BracketedPasteMode = PrivateMode(2004) - EnableBracketedPaste = "\x1b[" + BracketedPasteMode + "h" - DisableBracketedPaste = "\x1b[" + BracketedPasteMode + "l" - RequestBracketedPaste = "\x1b[" + BracketedPasteMode + "$p" + EnableBracketedPaste = "\x1b[?2004h" + DisableBracketedPaste = "\x1b[?2004l" + RequestBracketedPaste = "\x1b[?2004$p" ) // Synchronized Output Mode is a mode that determines whether output is @@ -145,11 +163,11 @@ const ( // // See: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036 const ( - SyncdOutputMode = "?2026" + SyncdOutputMode = PrivateMode(2026) - EnableSyncdOutput = "\x1b[" + SyncdOutputMode + "h" - DisableSyncdOutput = "\x1b[" + SyncdOutputMode + "l" - RequestSyncdOutput = "\x1b[" + SyncdOutputMode + "$p" + EnableSyncdOutput = "\x1b[?2026h" + DisableSyncdOutput = "\x1b[?2026l" + RequestSyncdOutput = "\x1b[?2026$p" ) // Grapheme Clustering Mode is a mode that determines whether the terminal @@ -159,11 +177,11 @@ const ( // // See: https://github.com/contour-terminal/terminal-unicode-core const ( - GraphemeClusteringMode = "?2027" + GraphemeClusteringMode = PrivateMode(2027) - EnableGraphemeClustering = "\x1b[" + GraphemeClusteringMode + "h" - DisableGraphemeClustering = "\x1b[" + GraphemeClusteringMode + "l" - RequestGraphemeClustering = "\x1b[" + GraphemeClusteringMode + "$p" + EnableGraphemeClustering = "\x1b[?2027h" + DisableGraphemeClustering = "\x1b[?2027l" + RequestGraphemeClustering = "\x1b[?2027$p" ) // Win32Input is a mode that determines whether input is processed by the @@ -171,9 +189,9 @@ const ( // // See: https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md const ( - Win32InputMode = "?9001" + Win32InputMode = PrivateMode(9001) - EnableWin32Input = "\x1b[" + Win32InputMode + "h" - DisableWin32Input = "\x1b[" + Win32InputMode + "l" - RequestWin32Input = "\x1b[" + Win32InputMode + "$p" + EnableWin32Input = "\x1b[?9001h" + DisableWin32Input = "\x1b[?9001l" + RequestWin32Input = "\x1b[?9001$p" ) diff --git a/vendor/github.com/charmbracelet/x/ansi/parser_decode.go b/vendor/github.com/charmbracelet/x/ansi/parser_decode.go index 76688d0b8f..5fa0ff4d79 100644 --- a/vendor/github.com/charmbracelet/x/ansi/parser_decode.go +++ b/vendor/github.com/charmbracelet/x/ansi/parser_decode.go @@ -40,15 +40,15 @@ const ( // [Cmd] and [Param] types to unpack command intermediates and markers as well // as parameters. // -// Zero [p.Cmd] means the CSI, DCS, or ESC sequence is invalid. Moreover, checking the +// Zero [Cmd] means the CSI, DCS, or ESC sequence is invalid. Moreover, checking the // validity of other data sequences, OSC, DCS, etc, will require checking for // the returned sequence terminator bytes such as ST (ESC \\) and BEL). // -// We store the command byte in [p.Cmd] in the most significant byte, the +// We store the command byte in [Cmd] in the most significant byte, the // marker byte in the next byte, and the intermediate byte in the least // significant byte. This is done to avoid using a struct to store the command // and its intermediates and markers. The command byte is always the least -// significant byte i.e. [p.Cmd & 0xff]. Use the [Cmd] type to unpack the +// significant byte i.e. [Cmd & 0xff]. Use the [Cmd] type to unpack the // command, intermediate, and marker bytes. Note that we only collect the last // marker character and intermediate byte. // diff --git a/vendor/github.com/charmbracelet/x/ansi/parser_sync.go b/vendor/github.com/charmbracelet/x/ansi/parser_sync.go index 562e806a3a..c6f24d3554 100644 --- a/vendor/github.com/charmbracelet/x/ansi/parser_sync.go +++ b/vendor/github.com/charmbracelet/x/ansi/parser_sync.go @@ -8,7 +8,7 @@ import ( var parserPool = sync.Pool{ New: func() any { - return NewParser(parser.MaxParamsSize, 1024*4) // 4MB data buffer + return NewParser(parser.MaxParamsSize, 1024*1024*4) // 4MB of data buffer }, } diff --git a/vendor/github.com/charmbracelet/x/ansi/screen.go b/vendor/github.com/charmbracelet/x/ansi/screen.go index f1fd30c47f..a37eed7a3f 100644 --- a/vendor/github.com/charmbracelet/x/ansi/screen.go +++ b/vendor/github.com/charmbracelet/x/ansi/screen.go @@ -2,12 +2,14 @@ package ansi import "strconv" -// EraseDisplay (ED) clears the screen or parts of the screen. Possible values: +// EraseDisplay (ED) clears the display or parts of the display. A screen is +// the shown part of the terminal display excluding the scrollback buffer. +// Possible values: // // 0: Clear from cursor to end of screen. // 1: Clear from cursor to beginning of the screen. // 2: Clear entire screen (and moves cursor to upper left on DOS). -// 3: Clear entire screen and delete all lines saved in the scrollback buffer. +// 3: Clear entire display which delete all lines saved in the scrollback buffer (xterm). // // CSI J // @@ -22,9 +24,10 @@ func EraseDisplay(n int) string { // EraseDisplay constants. // These are the possible values for the EraseDisplay function. const ( - EraseDisplayBelow = "\x1b[0J" - EraseDisplayAbove = "\x1b[1J" - EraseEntireDisplay = "\x1b[2J" + EraseScreenBelow = "\x1b[0J" + EraseScreenAbove = "\x1b[1J" + EraseEntireScreen = "\x1b[2J" + EraseEntireDisplay = "\x1b[3J" ) // EraseLine (EL) clears the current line or parts of the line. Possible values: diff --git a/vendor/github.com/charmbracelet/x/ansi/wrap.go b/vendor/github.com/charmbracelet/x/ansi/wrap.go index 2cab5cec14..d080a77a3e 100644 --- a/vendor/github.com/charmbracelet/x/ansi/wrap.go +++ b/vendor/github.com/charmbracelet/x/ansi/wrap.go @@ -349,6 +349,9 @@ func Wrap(s string, limit int, breakpoints string) string { curWidth++ } default: + if curWidth == limit { + addNewline() + } word.WriteRune(r) wordLen++ diff --git a/vendor/github.com/cloudflare/cloudflare-go/CHANGELOG.md b/vendor/github.com/cloudflare/cloudflare-go/CHANGELOG.md index ff79a636ce..64b376e817 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/CHANGELOG.md +++ b/vendor/github.com/cloudflare/cloudflare-go/CHANGELOG.md @@ -1,4 +1,16 @@ -## 0.108.0 (Unreleased) +## 0.109.0 (Unreleased) + +## 0.108.0 (October 23rd, 2024) + +ENHANCEMENTS: + +* snippets: add CRUD support ([#3458](https://github.com/cloudflare/cloudflare-go/issues/3458)) +* snippets_rules: add CRUD support ([#3458](https://github.com/cloudflare/cloudflare-go/issues/3458)) +* waiting_room: Add CookieAttributes property ([#3388](https://github.com/cloudflare/cloudflare-go/issues/3388)) + +DEPENDENCIES: + +* deps: bumps github.com/urfave/cli/v2 from 2.27.4 to 2.27.5 ([#3391](https://github.com/cloudflare/cloudflare-go/issues/3391)) ## 0.107.0 (October 9th, 2024) diff --git a/vendor/github.com/cloudflare/cloudflare-go/snippets.go b/vendor/github.com/cloudflare/cloudflare-go/snippets.go new file mode 100644 index 0000000000..870b8f73a9 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/snippets.go @@ -0,0 +1,114 @@ +package cloudflare + +import ( + "bytes" + "context" + "fmt" + "mime/multipart" + "net/http" + "time" + + "github.com/goccy/go-json" +) + +type SnippetsResponse struct { + Response + Result []Snippet `json:"result"` +} + +type Snippet struct { + CreatedOn *time.Time `json:"created_on"` + ModifiedOn *time.Time `json:"modified_on"` + SnippetName string `json:"snippet_name"` +} + +type SnippetFile struct { + FileName string `json:"file_name"` + Content string `json:"content"` +} + +type SnippetRequest struct { + SnippetName string `json:"snippet_name"` + MainFile string `json:"main_file"` + Files []SnippetFile `json:"files"` +} + +func (api *API) ListZoneSnippets(ctx context.Context, rc *ResourceContainer) ([]Snippet, error) { + if rc.Identifier == "" { + return nil, ErrMissingZoneID + } + + uri := buildURI(fmt.Sprintf("/zones/%s/snippets", rc.Identifier), nil) + res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil) + if err != nil { + return nil, err + } + + result := SnippetsResponse{} + if err := json.Unmarshal(res, &result); err != nil { + return nil, fmt.Errorf("%s: %w", errUnmarshalError, err) + } + + return result.Result, nil +} + +type SnippetMetadata struct { + MainModule string `json:"main_module"` +} + +func snippetMultipartBody(request SnippetRequest) (string, *bytes.Buffer, error) { + body := new(bytes.Buffer) + mw := multipart.NewWriter(body) + defer mw.Close() + + for _, file := range request.Files { + tp, err := mw.CreateFormFile(file.FileName, file.FileName) + if err != nil { + return "", nil, err + } + _, err = tp.Write([]byte(file.Content)) + if err != nil { + return "", nil, err + } + } + + tp, err := mw.CreateFormField("metadata") + if err != nil { + return "", nil, err + } + + if err = json.NewEncoder(tp).Encode(SnippetMetadata{ + MainModule: request.MainFile, + }); err != nil { + return "", nil, err + } + + return mw.Boundary(), body, nil +} + +func (api *API) UpdateZoneSnippet(ctx context.Context, rc *ResourceContainer, params SnippetRequest) ([]Snippet, error) { + if rc.Identifier == "" { + return nil, ErrMissingZoneID + } + + uri := fmt.Sprintf("/zones/%s/snippets/%s", rc.Identifier, params.SnippetName) + + boundary, body, err := snippetMultipartBody(params) + if err != nil { + return nil, err + } + + res, err := api.makeRequestContextWithHeaders(ctx, http.MethodPut, uri, body, http.Header{ + "Content-Type": []string{fmt.Sprintf("multipart/form-data; boundary=%s", boundary)}, + }) + if err != nil { + return nil, err + } + + result := SnippetsResponse{} + if err := json.Unmarshal(res, &result); err != nil { + return nil, fmt.Errorf("%s: %w", errUnmarshalError, err) + } + + return result.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/snippets_rules.go b/vendor/github.com/cloudflare/cloudflare-go/snippets_rules.go new file mode 100644 index 0000000000..37a92d2126 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/snippets_rules.go @@ -0,0 +1,66 @@ +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/goccy/go-json" +) + +type SnippetsRulesResponse struct { + Response + Result []SnippetRule `json:"result"` +} + +type SnippetRule struct { + ID string `json:"id"` + Enabled *bool `json:"enabled,omitempty"` + Expression string `json:"expression"` + SnippetName string `json:"snippet_name"` + Description string `json:"description"` +} + +func (api *API) ListZoneSnippetsRules(ctx context.Context, rc *ResourceContainer) ([]SnippetRule, error) { + if rc.Identifier == "" { + return nil, ErrMissingZoneID + } + + uri := buildURI(fmt.Sprintf("/zones/%s/snippets/rules", rc.Identifier), nil) + res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil) + if err != nil { + return nil, err + } + + result := SnippetsRulesResponse{} + if err := json.Unmarshal(res, &result); err != nil { + return nil, fmt.Errorf("%s: %w", errUnmarshalError, err) + } + + return result.Result, nil +} + +func (api *API) UpdateZoneSnippetsRules(ctx context.Context, rc *ResourceContainer, params []SnippetRule) ([]SnippetRule, error) { + if rc.Identifier == "" { + return nil, ErrMissingZoneID + } + + uri := fmt.Sprintf("/zones/%s/snippets/rules", rc.Identifier) + + payload, err := json.Marshal(params) + if err != nil { + return nil, err + } + + res, err := api.makeRequestContext(ctx, http.MethodPut, uri, payload) + if err != nil { + return nil, err + } + + result := SnippetsRulesResponse{} + if err := json.Unmarshal(res, &result); err != nil { + return nil, fmt.Errorf("%s: %w", errUnmarshalError, err) + } + + return result.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/waiting_room.go b/vendor/github.com/cloudflare/cloudflare-go/waiting_room.go index 0cb787b4ce..c765bd057e 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/waiting_room.go +++ b/vendor/github.com/cloudflare/cloudflare-go/waiting_room.go @@ -17,29 +17,30 @@ var ( // WaitingRoom describes a WaitingRoom object. type WaitingRoom struct { - CreatedOn time.Time `json:"created_on,omitempty"` - ModifiedOn time.Time `json:"modified_on,omitempty"` - Path string `json:"path"` - Name string `json:"name"` - Description string `json:"description,omitempty"` - QueueingMethod string `json:"queueing_method,omitempty"` - CustomPageHTML string `json:"custom_page_html,omitempty"` - DefaultTemplateLanguage string `json:"default_template_language,omitempty"` - Host string `json:"host"` - ID string `json:"id,omitempty"` - NewUsersPerMinute int `json:"new_users_per_minute"` - TotalActiveUsers int `json:"total_active_users"` - SessionDuration int `json:"session_duration"` - QueueAll bool `json:"queue_all"` - DisableSessionRenewal bool `json:"disable_session_renewal"` - Suspended bool `json:"suspended"` - JsonResponseEnabled bool `json:"json_response_enabled"` - NextEventPrequeueStartTime *time.Time `json:"next_event_prequeue_start_time,omitempty"` - NextEventStartTime *time.Time `json:"next_event_start_time,omitempty"` - CookieSuffix string `json:"cookie_suffix"` - AdditionalRoutes []*WaitingRoomRoute `json:"additional_routes,omitempty"` - QueueingStatusCode int `json:"queueing_status_code"` - EnabledOriginCommands []string `json:"enabled_origin_commands,omitempty"` + CreatedOn time.Time `json:"created_on,omitempty"` + ModifiedOn time.Time `json:"modified_on,omitempty"` + Path string `json:"path"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + QueueingMethod string `json:"queueing_method,omitempty"` + CustomPageHTML string `json:"custom_page_html,omitempty"` + DefaultTemplateLanguage string `json:"default_template_language,omitempty"` + Host string `json:"host"` + ID string `json:"id,omitempty"` + NewUsersPerMinute int `json:"new_users_per_minute"` + TotalActiveUsers int `json:"total_active_users"` + SessionDuration int `json:"session_duration"` + QueueAll bool `json:"queue_all"` + DisableSessionRenewal bool `json:"disable_session_renewal"` + Suspended bool `json:"suspended"` + JsonResponseEnabled bool `json:"json_response_enabled"` + NextEventPrequeueStartTime *time.Time `json:"next_event_prequeue_start_time,omitempty"` + NextEventStartTime *time.Time `json:"next_event_start_time,omitempty"` + CookieSuffix string `json:"cookie_suffix"` + AdditionalRoutes []*WaitingRoomRoute `json:"additional_routes,omitempty"` + QueueingStatusCode int `json:"queueing_status_code"` + EnabledOriginCommands []string `json:"enabled_origin_commands,omitempty"` + CookieAttributes *WaitingRoomCookieAttributes `json:"cookie_attributes,omitempty"` } // WaitingRoomStatus describes the status of a waiting room. @@ -103,6 +104,12 @@ type WaitingRoomRoute struct { Path string `json:"path"` } +// WaitingRoomCookieAttributes describes a WaitingRoomCookieAttributes object. +type WaitingRoomCookieAttributes struct { + Samesite string `json:"samesite"` + Secure string `json:"secure"` +} + // WaitingRoomDetailResponse is the API response, containing a single WaitingRoom. type WaitingRoomDetailResponse struct { Response diff --git a/vendor/github.com/dgraph-io/badger/v4/.go-version b/vendor/github.com/dgraph-io/badger/v4/.go-version index bc4493477a..193d140301 100644 --- a/vendor/github.com/dgraph-io/badger/v4/.go-version +++ b/vendor/github.com/dgraph-io/badger/v4/.go-version @@ -1 +1 @@ -1.19 +1.23 \ No newline at end of file diff --git a/vendor/github.com/dgraph-io/badger/v4/README.md b/vendor/github.com/dgraph-io/badger/v4/README.md index 36dbd4fc54..3fd64d7683 100644 --- a/vendor/github.com/dgraph-io/badger/v4/README.md +++ b/vendor/github.com/dgraph-io/badger/v4/README.md @@ -62,7 +62,7 @@ For more details on our version naming schema please read [Choosing a version](# ## Getting Started ### Installing -To start using Badger, install Go 1.19 or above. Badger v3 and above needs go modules. From your project, run the following command +To start using Badger, install Go 1.23 or above. Badger v3 and above needs go modules. From your project, run the following command ```sh $ go get github.com/dgraph-io/badger/v4 diff --git a/vendor/github.com/dgraph-io/badger/v4/appveyor.yml b/vendor/github.com/dgraph-io/badger/v4/appveyor.yml deleted file mode 100644 index a3eaffdd43..0000000000 --- a/vendor/github.com/dgraph-io/badger/v4/appveyor.yml +++ /dev/null @@ -1,49 +0,0 @@ -# version format -version: "{build}" - -# Operating system (build VM template) -os: Windows Server 2012 R2 - -# Platform. -platform: x64 - -clone_folder: c:\gopath\src\github.com\dgraph-io\badger - -# Environment variables -environment: - GOVERSION: 1.19 - GOPATH: c:\gopath - GO111MODULE: on - -# scripts that run after cloning repository -install: - - set PATH=%GOPATH%\bin;c:\go\bin;c:\msys64\mingw64\bin;%PATH% - - go version - - go env - - python --version - - gcc --version - -# To run your custom scripts instead of automatic MSBuild -build_script: - # We need to disable firewall - https://github.com/appveyor/ci/issues/1579#issuecomment-309830648 - - ps: Disable-NetFirewallRule -DisplayName 'File and Printer Sharing (SMB-Out)' - - cd c:\gopath\src\github.com\dgraph-io\badger - - git branch - - go get -t ./... - -# To run your custom scripts instead of automatic tests -test_script: - # Unit tests - - ps: Add-AppveyorTest "Unit Tests" -Outcome Running - - go test -v github.com/dgraph-io/badger/... - - ps: Update-AppveyorTest "Unit Tests" -Outcome Passed - -notifications: - - provider: Email - to: - - pawan@dgraph.io - on_build_failure: true - on_build_status_changed: true -# to disable deployment -deploy: off - diff --git a/vendor/github.com/dgraph-io/badger/v4/backup.go b/vendor/github.com/dgraph-io/badger/v4/backup.go index f9629064fd..dd5c5d0a4b 100644 --- a/vendor/github.com/dgraph-io/badger/v4/backup.go +++ b/vendor/github.com/dgraph-io/badger/v4/backup.go @@ -28,7 +28,7 @@ import ( "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) // flushThreshold determines when a buffer will be flushed. When performing a diff --git a/vendor/github.com/dgraph-io/badger/v4/batch.go b/vendor/github.com/dgraph-io/badger/v4/batch.go index 885451fe9c..a9974d29b4 100644 --- a/vendor/github.com/dgraph-io/badger/v4/batch.go +++ b/vendor/github.com/dgraph-io/badger/v4/batch.go @@ -24,7 +24,7 @@ import ( "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) // WriteBatch holds the necessary info to perform batched writes. diff --git a/vendor/github.com/dgraph-io/badger/v4/db.go b/vendor/github.com/dgraph-io/badger/v4/db.go index ba060cc57b..dbf5b7e7a8 100644 --- a/vendor/github.com/dgraph-io/badger/v4/db.go +++ b/vendor/github.com/dgraph-io/badger/v4/db.go @@ -20,6 +20,7 @@ import ( "bytes" "context" "encoding/binary" + stderrors "errors" "expvar" "fmt" "math" @@ -40,8 +41,8 @@ import ( "github.com/dgraph-io/badger/v4/skl" "github.com/dgraph-io/badger/v4/table" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2" + "github.com/dgraph-io/ristretto/v2/z" ) var ( @@ -1015,7 +1016,7 @@ func (db *DB) batchSetAsync(entries []*Entry, f func(error)) error { return nil } -var errNoRoom = errors.New("No room for write") +var errNoRoom = stderrors.New("No room for write") // ensureRoomForWrite is always called serially. func (db *DB) ensureRoomForWrite() error { diff --git a/vendor/github.com/dgraph-io/badger/v4/discard.go b/vendor/github.com/dgraph-io/badger/v4/discard.go index 439897cbb0..409939efc0 100644 --- a/vendor/github.com/dgraph-io/badger/v4/discard.go +++ b/vendor/github.com/dgraph-io/badger/v4/discard.go @@ -24,7 +24,7 @@ import ( "sync" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) // discardStats keeps track of the amount of data that could be discarded for diff --git a/vendor/github.com/dgraph-io/badger/v4/errors.go b/vendor/github.com/dgraph-io/badger/v4/errors.go index f5df6d5118..ffdac6a244 100644 --- a/vendor/github.com/dgraph-io/badger/v4/errors.go +++ b/vendor/github.com/dgraph-io/badger/v4/errors.go @@ -17,9 +17,8 @@ package badger import ( + stderrors "errors" "math" - - "github.com/pkg/errors" ) const ( @@ -30,97 +29,97 @@ const ( var ( // ErrValueLogSize is returned when opt.ValueLogFileSize option is not within the valid // range. - ErrValueLogSize = errors.New("Invalid ValueLogFileSize, must be in range [1MB, 2GB)") + ErrValueLogSize = stderrors.New("Invalid ValueLogFileSize, must be in range [1MB, 2GB)") // ErrKeyNotFound is returned when key isn't found on a txn.Get. - ErrKeyNotFound = errors.New("Key not found") + ErrKeyNotFound = stderrors.New("Key not found") // ErrTxnTooBig is returned if too many writes are fit into a single transaction. - ErrTxnTooBig = errors.New("Txn is too big to fit into one request") + ErrTxnTooBig = stderrors.New("Txn is too big to fit into one request") // ErrConflict is returned when a transaction conflicts with another transaction. This can // happen if the read rows had been updated concurrently by another transaction. - ErrConflict = errors.New("Transaction Conflict. Please retry") + ErrConflict = stderrors.New("Transaction Conflict. Please retry") // ErrReadOnlyTxn is returned if an update function is called on a read-only transaction. - ErrReadOnlyTxn = errors.New("No sets or deletes are allowed in a read-only transaction") + ErrReadOnlyTxn = stderrors.New("No sets or deletes are allowed in a read-only transaction") // ErrDiscardedTxn is returned if a previously discarded transaction is re-used. - ErrDiscardedTxn = errors.New("This transaction has been discarded. Create a new one") + ErrDiscardedTxn = stderrors.New("This transaction has been discarded. Create a new one") // ErrEmptyKey is returned if an empty key is passed on an update function. - ErrEmptyKey = errors.New("Key cannot be empty") + ErrEmptyKey = stderrors.New("Key cannot be empty") // ErrInvalidKey is returned if the key has a special !badger! prefix, // reserved for internal usage. - ErrInvalidKey = errors.New("Key is using a reserved !badger! prefix") + ErrInvalidKey = stderrors.New("Key is using a reserved !badger! prefix") // ErrBannedKey is returned if the read/write key belongs to any banned namespace. - ErrBannedKey = errors.New("Key is using the banned prefix") + ErrBannedKey = stderrors.New("Key is using the banned prefix") // ErrThresholdZero is returned if threshold is set to zero, and value log GC is called. // In such a case, GC can't be run. - ErrThresholdZero = errors.New( + ErrThresholdZero = stderrors.New( "Value log GC can't run because threshold is set to zero") // ErrNoRewrite is returned if a call for value log GC doesn't result in a log file rewrite. - ErrNoRewrite = errors.New( + ErrNoRewrite = stderrors.New( "Value log GC attempt didn't result in any cleanup") // ErrRejected is returned if a value log GC is called either while another GC is running, or // after DB::Close has been called. - ErrRejected = errors.New("Value log GC request rejected") + ErrRejected = stderrors.New("Value log GC request rejected") // ErrInvalidRequest is returned if the user request is invalid. - ErrInvalidRequest = errors.New("Invalid request") + ErrInvalidRequest = stderrors.New("Invalid request") // ErrManagedTxn is returned if the user tries to use an API which isn't // allowed due to external management of transactions, when using ManagedDB. - ErrManagedTxn = errors.New( + ErrManagedTxn = stderrors.New( "Invalid API request. Not allowed to perform this action using ManagedDB") // ErrNamespaceMode is returned if the user tries to use an API which is allowed only when // NamespaceOffset is non-negative. - ErrNamespaceMode = errors.New( + ErrNamespaceMode = stderrors.New( "Invalid API request. Not allowed to perform this action when NamespaceMode is not set.") // ErrInvalidDump if a data dump made previously cannot be loaded into the database. - ErrInvalidDump = errors.New("Data dump cannot be read") + ErrInvalidDump = stderrors.New("Data dump cannot be read") // ErrZeroBandwidth is returned if the user passes in zero bandwidth for sequence. - ErrZeroBandwidth = errors.New("Bandwidth must be greater than zero") + ErrZeroBandwidth = stderrors.New("Bandwidth must be greater than zero") // ErrWindowsNotSupported is returned when opt.ReadOnly is used on Windows - ErrWindowsNotSupported = errors.New("Read-only mode is not supported on Windows") + ErrWindowsNotSupported = stderrors.New("Read-only mode is not supported on Windows") // ErrPlan9NotSupported is returned when opt.ReadOnly is used on Plan 9 - ErrPlan9NotSupported = errors.New("Read-only mode is not supported on Plan 9") + ErrPlan9NotSupported = stderrors.New("Read-only mode is not supported on Plan 9") // ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of // corrupt data to allow Badger to run properly. - ErrTruncateNeeded = errors.New( + ErrTruncateNeeded = stderrors.New( "Log truncate required to run DB. This might result in data loss") // ErrBlockedWrites is returned if the user called DropAll. During the process of dropping all // data from Badger, we stop accepting new writes, by returning this error. - ErrBlockedWrites = errors.New("Writes are blocked, possibly due to DropAll or Close") + ErrBlockedWrites = stderrors.New("Writes are blocked, possibly due to DropAll or Close") // ErrNilCallback is returned when subscriber's callback is nil. - ErrNilCallback = errors.New("Callback cannot be nil") + ErrNilCallback = stderrors.New("Callback cannot be nil") // ErrEncryptionKeyMismatch is returned when the storage key is not // matched with the key previously given. - ErrEncryptionKeyMismatch = errors.New("Encryption key mismatch") + ErrEncryptionKeyMismatch = stderrors.New("Encryption key mismatch") // ErrInvalidDataKeyID is returned if the datakey id is invalid. - ErrInvalidDataKeyID = errors.New("Invalid datakey id") + ErrInvalidDataKeyID = stderrors.New("Invalid datakey id") // ErrInvalidEncryptionKey is returned if length of encryption keys is invalid. - ErrInvalidEncryptionKey = errors.New("Encryption key's length should be" + + ErrInvalidEncryptionKey = stderrors.New("Encryption key's length should be" + "either 16, 24, or 32 bytes") // ErrGCInMemoryMode is returned when db.RunValueLogGC is called in in-memory mode. - ErrGCInMemoryMode = errors.New("Cannot run value log GC when DB is opened in InMemory mode") + ErrGCInMemoryMode = stderrors.New("Cannot run value log GC when DB is opened in InMemory mode") // ErrDBClosed is returned when a get operation is performed after closing the DB. - ErrDBClosed = errors.New("DB Closed") + ErrDBClosed = stderrors.New("DB Closed") ) diff --git a/vendor/github.com/dgraph-io/badger/v4/iterator.go b/vendor/github.com/dgraph-io/badger/v4/iterator.go index 8662a85936..54d2bf27dc 100644 --- a/vendor/github.com/dgraph-io/badger/v4/iterator.go +++ b/vendor/github.com/dgraph-io/badger/v4/iterator.go @@ -27,7 +27,7 @@ import ( "github.com/dgraph-io/badger/v4/table" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) type prefetchStatus uint8 diff --git a/vendor/github.com/dgraph-io/badger/v4/levels.go b/vendor/github.com/dgraph-io/badger/v4/levels.go index 6bbaf55cac..7b32cffa9f 100644 --- a/vendor/github.com/dgraph-io/badger/v4/levels.go +++ b/vendor/github.com/dgraph-io/badger/v4/levels.go @@ -20,6 +20,7 @@ import ( "bytes" "context" "encoding/hex" + stderrors "errors" "fmt" "math" "math/rand" @@ -36,7 +37,7 @@ import ( "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/table" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) type levelsController struct { @@ -1512,7 +1513,7 @@ func tablesToString(tables []*table.Table) []string { return res } -var errFillTables = errors.New("Unable to fill tables") +var errFillTables = stderrors.New("Unable to fill tables") // doCompact picks some table on level l and compacts it away to the next level. func (s *levelsController) doCompact(id int, p compactionPriority) error { diff --git a/vendor/github.com/dgraph-io/badger/v4/manifest.go b/vendor/github.com/dgraph-io/badger/v4/manifest.go index e681ae0a01..2355f281e4 100644 --- a/vendor/github.com/dgraph-io/badger/v4/manifest.go +++ b/vendor/github.com/dgraph-io/badger/v4/manifest.go @@ -20,6 +20,7 @@ import ( "bufio" "bytes" "encoding/binary" + stderrors "errors" "fmt" "hash/crc32" "io" @@ -352,8 +353,8 @@ func (r *countingReader) ReadByte() (b byte, err error) { } var ( - errBadMagic = errors.New("manifest has bad magic") - errBadChecksum = errors.New("manifest has checksum mismatch") + errBadMagic = stderrors.New("manifest has bad magic") + errBadChecksum = stderrors.New("manifest has checksum mismatch") ) // ReplayManifestFile reads the manifest file and constructs two manifest objects. (We need one diff --git a/vendor/github.com/dgraph-io/badger/v4/memtable.go b/vendor/github.com/dgraph-io/badger/v4/memtable.go index b78895e481..f5950b419b 100644 --- a/vendor/github.com/dgraph-io/badger/v4/memtable.go +++ b/vendor/github.com/dgraph-io/badger/v4/memtable.go @@ -38,7 +38,7 @@ import ( "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/skl" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) // memTable structure stores a skiplist and a corresponding WAL. Writes to memTable are written diff --git a/vendor/github.com/dgraph-io/badger/v4/merge.go b/vendor/github.com/dgraph-io/badger/v4/merge.go index 3ec28e90ed..ec610e67ac 100644 --- a/vendor/github.com/dgraph-io/badger/v4/merge.go +++ b/vendor/github.com/dgraph-io/badger/v4/merge.go @@ -17,13 +17,12 @@ package badger import ( + stderrors "errors" "sync" "time" - "github.com/pkg/errors" - "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) // MergeOperator represents a Badger merge operator. @@ -58,7 +57,7 @@ func (db *DB) GetMergeOperator(key []byte, return op } -var errNoMerge = errors.New("No need for merge") +var errNoMerge = stderrors.New("No need for merge") func (op *MergeOperator) iterateAndMerge() (newVal []byte, latest uint64, err error) { txn := op.db.NewTransaction(false) diff --git a/vendor/github.com/dgraph-io/badger/v4/options.go b/vendor/github.com/dgraph-io/badger/v4/options.go index bb6131b30d..06ec2b6bec 100644 --- a/vendor/github.com/dgraph-io/badger/v4/options.go +++ b/vendor/github.com/dgraph-io/badger/v4/options.go @@ -29,7 +29,7 @@ import ( "github.com/dgraph-io/badger/v4/options" "github.com/dgraph-io/badger/v4/table" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) // Note: If you add a new option X make sure you also add a WithX method on Options. diff --git a/vendor/github.com/dgraph-io/badger/v4/publisher.go b/vendor/github.com/dgraph-io/badger/v4/publisher.go index dce524f090..6b13a34564 100644 --- a/vendor/github.com/dgraph-io/badger/v4/publisher.go +++ b/vendor/github.com/dgraph-io/badger/v4/publisher.go @@ -23,7 +23,7 @@ import ( "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/trie" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) type subscriber struct { diff --git a/vendor/github.com/dgraph-io/badger/v4/skl/skl.go b/vendor/github.com/dgraph-io/badger/v4/skl/skl.go index 3fe8cc4a88..7d122a8ac5 100644 --- a/vendor/github.com/dgraph-io/badger/v4/skl/skl.go +++ b/vendor/github.com/dgraph-io/badger/v4/skl/skl.go @@ -38,7 +38,7 @@ import ( "unsafe" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) const ( diff --git a/vendor/github.com/dgraph-io/badger/v4/stream.go b/vendor/github.com/dgraph-io/badger/v4/stream.go index 21c5e99260..017ddb4ed0 100644 --- a/vendor/github.com/dgraph-io/badger/v4/stream.go +++ b/vendor/github.com/dgraph-io/badger/v4/stream.go @@ -28,7 +28,7 @@ import ( "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) const batchSize = 16 << 20 // 16 MB @@ -62,6 +62,14 @@ type Stream struct { // Note: Calls to ChooseKey are concurrent. ChooseKey func(item *Item) bool + // MaxSize is the maximum allowed size of a stream batch. This is a soft limit + // as a single list that is still over the limit will have to be sent as is since it + // cannot be split further. This limit prevents the framework from creating batches + // so big that sending them causes issues (e.g running into the max size gRPC limit). + // If necessary, set it up before the Stream starts synchronisation + // This is not a concurrency-safe setting + MaxSize uint64 + // KeyToList, similar to ChooseKey, is only invoked on the highest version of the value. It // is upto the caller to iterate over the versions and generate zero, one or more KVs. It // is expected that the user would advance the iterator to go through the versions of the @@ -315,7 +323,7 @@ func (st *Stream) streamKVs(ctx context.Context) error { // Send the batch immediately if it already exceeds the maximum allowed size. // If the size of the batch exceeds maxStreamSize, break from the loop to // avoid creating a batch that is so big that certain limits are reached. - if batch.LenNoPadding() > int(maxStreamSize) { + if uint64(batch.LenNoPadding()) > st.MaxSize { break loop } select { @@ -452,6 +460,7 @@ func (db *DB) newStream() *Stream { db: db, NumGo: db.opt.NumGoroutines, LogPrefix: "Badger.Stream", + MaxSize: maxStreamSize, } } diff --git a/vendor/github.com/dgraph-io/badger/v4/stream_writer.go b/vendor/github.com/dgraph-io/badger/v4/stream_writer.go index a160e55cb9..36cc5b86dd 100644 --- a/vendor/github.com/dgraph-io/badger/v4/stream_writer.go +++ b/vendor/github.com/dgraph-io/badger/v4/stream_writer.go @@ -27,7 +27,7 @@ import ( "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/table" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) // StreamWriter is used to write data coming from multiple streams. The streams must not have any diff --git a/vendor/github.com/dgraph-io/badger/v4/table/builder.go b/vendor/github.com/dgraph-io/badger/v4/table/builder.go index bf0ac319a8..14a357cf1f 100644 --- a/vendor/github.com/dgraph-io/badger/v4/table/builder.go +++ b/vendor/github.com/dgraph-io/badger/v4/table/builder.go @@ -33,7 +33,7 @@ import ( "github.com/dgraph-io/badger/v4/options" "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) const ( diff --git a/vendor/github.com/dgraph-io/badger/v4/table/table.go b/vendor/github.com/dgraph-io/badger/v4/table/table.go index 432bec3f20..3eabae4d07 100644 --- a/vendor/github.com/dgraph-io/badger/v4/table/table.go +++ b/vendor/github.com/dgraph-io/badger/v4/table/table.go @@ -40,8 +40,8 @@ import ( "github.com/dgraph-io/badger/v4/options" "github.com/dgraph-io/badger/v4/pb" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2" + "github.com/dgraph-io/ristretto/v2/z" ) const fileSuffix = ".sst" diff --git a/vendor/github.com/dgraph-io/badger/v4/txn.go b/vendor/github.com/dgraph-io/badger/v4/txn.go index 438af8d5df..a7d0528aa9 100644 --- a/vendor/github.com/dgraph-io/badger/v4/txn.go +++ b/vendor/github.com/dgraph-io/badger/v4/txn.go @@ -29,7 +29,7 @@ import ( "github.com/pkg/errors" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) type oracle struct { diff --git a/vendor/github.com/dgraph-io/badger/v4/value.go b/vendor/github.com/dgraph-io/badger/v4/value.go index 6b2f81016f..0b4e0aa7a5 100644 --- a/vendor/github.com/dgraph-io/badger/v4/value.go +++ b/vendor/github.com/dgraph-io/badger/v4/value.go @@ -19,6 +19,7 @@ package badger import ( "bytes" "context" + stderrors "errors" "fmt" "hash" "hash/crc32" @@ -35,7 +36,7 @@ import ( otrace "go.opencensus.io/trace" "github.com/dgraph-io/badger/v4/y" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) // maxVlogFileSize is the maximum size of the vlog file which can be created. Vlog Offset is of @@ -63,8 +64,8 @@ const ( vlogHeaderSize = 20 ) -var errStop = errors.New("Stop iteration") -var errTruncate = errors.New("Do truncate") +var errStop = stderrors.New("Stop iteration") +var errTruncate = stderrors.New("Do truncate") type logEntry func(e Entry, vp valuePointer) error diff --git a/vendor/github.com/dgraph-io/badger/v4/y/checksum.go b/vendor/github.com/dgraph-io/badger/v4/y/checksum.go index 5a4ac11b6f..555c22e324 100644 --- a/vendor/github.com/dgraph-io/badger/v4/y/checksum.go +++ b/vendor/github.com/dgraph-io/badger/v4/y/checksum.go @@ -17,16 +17,16 @@ package y import ( + stderrors "errors" "hash/crc32" "github.com/cespare/xxhash/v2" - "github.com/pkg/errors" "github.com/dgraph-io/badger/v4/pb" ) // ErrChecksumMismatch is returned at checksum mismatch. -var ErrChecksumMismatch = errors.New("checksum mismatch") +var ErrChecksumMismatch = stderrors.New("checksum mismatch") // CalculateChecksum calculates checksum for data using ct checksum type. func CalculateChecksum(data []byte, ct pb.Checksum_Algorithm) uint64 { diff --git a/vendor/github.com/dgraph-io/badger/v4/y/watermark.go b/vendor/github.com/dgraph-io/badger/v4/y/watermark.go index 7fc0c82c49..fe685088be 100644 --- a/vendor/github.com/dgraph-io/badger/v4/y/watermark.go +++ b/vendor/github.com/dgraph-io/badger/v4/y/watermark.go @@ -21,7 +21,7 @@ import ( "context" "sync/atomic" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) type uint64Heap []uint64 diff --git a/vendor/github.com/dgraph-io/badger/v4/y/y.go b/vendor/github.com/dgraph-io/badger/v4/y/y.go index 83da2c1d5a..8f61eb2818 100644 --- a/vendor/github.com/dgraph-io/badger/v4/y/y.go +++ b/vendor/github.com/dgraph-io/badger/v4/y/y.go @@ -19,6 +19,7 @@ package y import ( "bytes" "encoding/binary" + stderrors "errors" "fmt" "hash/crc32" "io" @@ -30,20 +31,18 @@ import ( "time" "unsafe" - "github.com/pkg/errors" - "github.com/dgraph-io/badger/v4/pb" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) var ( // ErrEOF indicates an end of file when trying to read from a memory mapped file // and encountering the end of slice. - ErrEOF = errors.New("ErrEOF: End of file") + ErrEOF = stderrors.New("ErrEOF: End of file") // ErrCommitAfterFinish indicates that write batch commit was called after // finish - ErrCommitAfterFinish = errors.New("Batch commit not permitted after finish") + ErrCommitAfterFinish = stderrors.New("Batch commit not permitted after finish") ) type Flags int diff --git a/vendor/github.com/dgraph-io/ristretto/.go-version b/vendor/github.com/dgraph-io/ristretto/.go-version deleted file mode 100644 index bc4493477a..0000000000 --- a/vendor/github.com/dgraph-io/ristretto/.go-version +++ /dev/null @@ -1 +0,0 @@ -1.19 diff --git a/vendor/github.com/dgraph-io/ristretto/.gitignore b/vendor/github.com/dgraph-io/ristretto/v2/.gitignore similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/.gitignore rename to vendor/github.com/dgraph-io/ristretto/v2/.gitignore diff --git a/vendor/github.com/dgraph-io/ristretto/v2/.go-version b/vendor/github.com/dgraph-io/ristretto/v2/.go-version new file mode 100644 index 0000000000..a1b6e17d61 --- /dev/null +++ b/vendor/github.com/dgraph-io/ristretto/v2/.go-version @@ -0,0 +1 @@ +1.23 diff --git a/vendor/github.com/dgraph-io/ristretto/.golangci.yml b/vendor/github.com/dgraph-io/ristretto/v2/.golangci.yml similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/.golangci.yml rename to vendor/github.com/dgraph-io/ristretto/v2/.golangci.yml diff --git a/vendor/github.com/dgraph-io/ristretto/CHANGELOG.md b/vendor/github.com/dgraph-io/ristretto/v2/CHANGELOG.md similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/CHANGELOG.md rename to vendor/github.com/dgraph-io/ristretto/v2/CHANGELOG.md diff --git a/vendor/github.com/dgraph-io/ristretto/LICENSE b/vendor/github.com/dgraph-io/ristretto/v2/LICENSE similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/LICENSE rename to vendor/github.com/dgraph-io/ristretto/v2/LICENSE diff --git a/vendor/github.com/dgraph-io/ristretto/README.md b/vendor/github.com/dgraph-io/ristretto/v2/README.md similarity index 99% rename from vendor/github.com/dgraph-io/ristretto/README.md rename to vendor/github.com/dgraph-io/ristretto/v2/README.md index 8793ad0d4d..41861bfb96 100644 --- a/vendor/github.com/dgraph-io/ristretto/README.md +++ b/vendor/github.com/dgraph-io/ristretto/v2/README.md @@ -64,7 +64,7 @@ import ( ) func main() { - cache, err := ristretto.NewCache(&ristretto.Config{ + cache, err := ristretto.NewCache(&ristretto.Config[string,string]{ NumCounters: 1e7, // number of keys to track frequency of (10M). MaxCost: 1 << 30, // maximum cost of cache (1GB). BufferItems: 64, // number of keys per Get buffer. diff --git a/vendor/github.com/dgraph-io/ristretto/cache.go b/vendor/github.com/dgraph-io/ristretto/v2/cache.go similarity index 99% rename from vendor/github.com/dgraph-io/ristretto/cache.go rename to vendor/github.com/dgraph-io/ristretto/v2/cache.go index 7a40b0e754..d29c93d0fe 100644 --- a/vendor/github.com/dgraph-io/ristretto/cache.go +++ b/vendor/github.com/dgraph-io/ristretto/v2/cache.go @@ -28,7 +28,7 @@ import ( "time" "unsafe" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) var ( @@ -52,7 +52,7 @@ type Cache[K Key, V any] struct { // storedItems is the central concurrent hashmap where key-value items are stored. storedItems store[V] // cachePolicy determines what gets let in to the cache and what gets kicked out. - cachePolicy policy[V] + cachePolicy *defaultPolicy[V] // getBuf is a custom ring buffer implementation that gets pushed to when // keys are read. getBuf *ringBuffer diff --git a/vendor/github.com/dgraph-io/ristretto/policy.go b/vendor/github.com/dgraph-io/ristretto/v2/policy.go similarity index 87% rename from vendor/github.com/dgraph-io/ristretto/policy.go rename to vendor/github.com/dgraph-io/ristretto/v2/policy.go index 290488d87e..d4e340ad42 100644 --- a/vendor/github.com/dgraph-io/ristretto/policy.go +++ b/vendor/github.com/dgraph-io/ristretto/v2/policy.go @@ -21,7 +21,7 @@ import ( "sync" "sync/atomic" - "github.com/dgraph-io/ristretto/z" + "github.com/dgraph-io/ristretto/v2/z" ) const ( @@ -30,38 +30,7 @@ const ( lfuSample = 5 ) -// policy is the interface encapsulating eviction/admission behavior. -// TODO: remove this interface and just rename defaultPolicy to policy, as we -// are probably only going to use/implement/maintain one policy. -type policy[V any] interface { - ringConsumer - // Add attempts to Add the key-cost pair to the Policy. It returns a slice - // of evicted keys and a bool denoting whether or not the key-cost pair - // was added. If it returns true, the key should be stored in cache. - Add(uint64, int64) ([]*Item[V], bool) - // Has returns true if the key exists in the Policy. - Has(uint64) bool - // Del deletes the key from the Policy. - Del(uint64) - // Cap returns the available capacity. - Cap() int64 - // Close stops all goroutines and closes all channels. - Close() - // Update updates the cost value for the key. - Update(uint64, int64) - // Cost returns the cost value of a key or -1 if missing. - Cost(uint64) int64 - // Optionally, set stats object to track how policy is performing. - CollectMetrics(*Metrics) - // Clear zeroes out all counters and clears hashmaps. - Clear() - // MaxCost returns the current max cost of the cache policy. - MaxCost() int64 - // UpdateMaxCost updates the max cost of the cache policy. - UpdateMaxCost(int64) -} - -func newPolicy[V any](numCounters, maxCost int64) policy[V] { +func newPolicy[V any](numCounters, maxCost int64) *defaultPolicy[V] { return newDefaultPolicy[V](numCounters, maxCost) } diff --git a/vendor/github.com/dgraph-io/ristretto/ring.go b/vendor/github.com/dgraph-io/ristretto/v2/ring.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/ring.go rename to vendor/github.com/dgraph-io/ristretto/v2/ring.go diff --git a/vendor/github.com/dgraph-io/ristretto/sketch.go b/vendor/github.com/dgraph-io/ristretto/v2/sketch.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/sketch.go rename to vendor/github.com/dgraph-io/ristretto/v2/sketch.go diff --git a/vendor/github.com/dgraph-io/ristretto/store.go b/vendor/github.com/dgraph-io/ristretto/v2/store.go similarity index 97% rename from vendor/github.com/dgraph-io/ristretto/store.go rename to vendor/github.com/dgraph-io/ristretto/v2/store.go index e2ca800c17..dfcfaa8db3 100644 --- a/vendor/github.com/dgraph-io/ristretto/store.go +++ b/vendor/github.com/dgraph-io/ristretto/v2/store.go @@ -50,7 +50,7 @@ type store[V any] interface { // successful. Update(*Item[V]) (V, bool) // Cleanup removes items that have an expired TTL. - Cleanup(policy policy[V], onEvict func(item *Item[V])) + Cleanup(policy *defaultPolicy[V], onEvict func(item *Item[V])) // Clear clears all contents of the store. Clear(onEvict func(item *Item[V])) } @@ -103,7 +103,7 @@ func (sm *shardedMap[V]) Update(newItem *Item[V]) (V, bool) { return sm.shards[newItem.Key%numShards].Update(newItem) } -func (sm *shardedMap[V]) Cleanup(policy policy[V], onEvict func(item *Item[V])) { +func (sm *shardedMap[V]) Cleanup(policy *defaultPolicy[V], onEvict func(item *Item[V])) { sm.expiryMap.cleanup(sm, policy, onEvict) } diff --git a/vendor/github.com/dgraph-io/ristretto/ttl.go b/vendor/github.com/dgraph-io/ristretto/v2/ttl.go similarity index 97% rename from vendor/github.com/dgraph-io/ristretto/ttl.go rename to vendor/github.com/dgraph-io/ristretto/v2/ttl.go index 08e77c1697..ccb0d7cb51 100644 --- a/vendor/github.com/dgraph-io/ristretto/ttl.go +++ b/vendor/github.com/dgraph-io/ristretto/v2/ttl.go @@ -121,7 +121,7 @@ func (m *expirationMap[_]) del(key uint64, expiration time.Time) { // cleanup removes all the items in the bucket that was just completed. It deletes // those items from the store, and calls the onEvict function on those items. // This function is meant to be called periodically. -func (m *expirationMap[V]) cleanup(store store[V], policy policy[V], onEvict func(item *Item[V])) { +func (m *expirationMap[V]) cleanup(store store[V], policy *defaultPolicy[V], onEvict func(item *Item[V])) { if m == nil { return } diff --git a/vendor/github.com/dgraph-io/ristretto/z/LICENSE b/vendor/github.com/dgraph-io/ristretto/v2/z/LICENSE similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/LICENSE rename to vendor/github.com/dgraph-io/ristretto/v2/z/LICENSE diff --git a/vendor/github.com/dgraph-io/ristretto/z/README.md b/vendor/github.com/dgraph-io/ristretto/v2/z/README.md similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/README.md rename to vendor/github.com/dgraph-io/ristretto/v2/z/README.md diff --git a/vendor/github.com/dgraph-io/ristretto/z/allocator.go b/vendor/github.com/dgraph-io/ristretto/v2/z/allocator.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/allocator.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/allocator.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/bbloom.go b/vendor/github.com/dgraph-io/ristretto/v2/z/bbloom.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/bbloom.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/bbloom.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/btree.go b/vendor/github.com/dgraph-io/ristretto/v2/z/btree.go similarity index 99% rename from vendor/github.com/dgraph-io/ristretto/z/btree.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/btree.go index 33c3046b9c..a8a83816e0 100644 --- a/vendor/github.com/dgraph-io/ristretto/z/btree.go +++ b/vendor/github.com/dgraph-io/ristretto/v2/z/btree.go @@ -24,7 +24,7 @@ import ( "strings" "unsafe" - "github.com/dgraph-io/ristretto/z/simd" + "github.com/dgraph-io/ristretto/v2/z/simd" ) var ( diff --git a/vendor/github.com/dgraph-io/ristretto/z/buffer.go b/vendor/github.com/dgraph-io/ristretto/v2/z/buffer.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/buffer.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/buffer.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/calloc.go b/vendor/github.com/dgraph-io/ristretto/v2/z/calloc.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/calloc.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/calloc.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/calloc_32bit.go b/vendor/github.com/dgraph-io/ristretto/v2/z/calloc_32bit.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/calloc_32bit.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/calloc_32bit.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/calloc_64bit.go b/vendor/github.com/dgraph-io/ristretto/v2/z/calloc_64bit.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/calloc_64bit.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/calloc_64bit.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/calloc_jemalloc.go b/vendor/github.com/dgraph-io/ristretto/v2/z/calloc_jemalloc.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/calloc_jemalloc.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/calloc_jemalloc.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/calloc_nojemalloc.go b/vendor/github.com/dgraph-io/ristretto/v2/z/calloc_nojemalloc.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/calloc_nojemalloc.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/calloc_nojemalloc.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/file.go b/vendor/github.com/dgraph-io/ristretto/v2/z/file.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/file.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/file.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/file_default.go b/vendor/github.com/dgraph-io/ristretto/v2/z/file_default.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/file_default.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/file_default.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/file_linux.go b/vendor/github.com/dgraph-io/ristretto/v2/z/file_linux.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/file_linux.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/file_linux.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/flags.go b/vendor/github.com/dgraph-io/ristretto/v2/z/flags.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/flags.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/flags.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/histogram.go b/vendor/github.com/dgraph-io/ristretto/v2/z/histogram.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/histogram.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/histogram.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mmap.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mmap.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mmap.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mmap.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mmap_darwin.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mmap_darwin.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mmap_darwin.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mmap_darwin.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mmap_js.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mmap_js.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mmap_js.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mmap_js.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mmap_linux.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mmap_linux.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mmap_linux.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mmap_linux.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mmap_plan9.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mmap_plan9.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mmap_plan9.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mmap_plan9.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mmap_unix.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mmap_unix.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mmap_unix.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mmap_unix.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mmap_wasip1.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mmap_wasip1.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mmap_wasip1.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mmap_wasip1.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mmap_windows.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mmap_windows.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mmap_windows.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mmap_windows.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mremap_nosize.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mremap_nosize.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mremap_nosize.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mremap_nosize.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/mremap_size.go b/vendor/github.com/dgraph-io/ristretto/v2/z/mremap_size.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/mremap_size.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/mremap_size.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/rtutil.go b/vendor/github.com/dgraph-io/ristretto/v2/z/rtutil.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/rtutil.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/rtutil.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/rtutil.s b/vendor/github.com/dgraph-io/ristretto/v2/z/rtutil.s similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/rtutil.s rename to vendor/github.com/dgraph-io/ristretto/v2/z/rtutil.s diff --git a/vendor/github.com/dgraph-io/ristretto/z/simd/baseline.go b/vendor/github.com/dgraph-io/ristretto/v2/z/simd/baseline.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/simd/baseline.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/simd/baseline.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/simd/search.go b/vendor/github.com/dgraph-io/ristretto/v2/z/simd/search.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/simd/search.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/simd/search.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/simd/search_amd64.s b/vendor/github.com/dgraph-io/ristretto/v2/z/simd/search_amd64.s similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/simd/search_amd64.s rename to vendor/github.com/dgraph-io/ristretto/v2/z/simd/search_amd64.s diff --git a/vendor/github.com/dgraph-io/ristretto/z/simd/stub_search_amd64.go b/vendor/github.com/dgraph-io/ristretto/v2/z/simd/stub_search_amd64.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/simd/stub_search_amd64.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/simd/stub_search_amd64.go diff --git a/vendor/github.com/dgraph-io/ristretto/z/z.go b/vendor/github.com/dgraph-io/ristretto/v2/z/z.go similarity index 100% rename from vendor/github.com/dgraph-io/ristretto/z/z.go rename to vendor/github.com/dgraph-io/ristretto/v2/z/z.go diff --git a/vendor/github.com/dop251/goja/builtin_promise.go b/vendor/github.com/dop251/goja/builtin_promise.go index d51f27d17a..205f155279 100644 --- a/vendor/github.com/dop251/goja/builtin_promise.go +++ b/vendor/github.com/dop251/goja/builtin_promise.go @@ -595,14 +595,17 @@ func (r *Runtime) getPromise() *Object { return ret } -func (r *Runtime) wrapPromiseReaction(fObj *Object) func(interface{}) { +func (r *Runtime) wrapPromiseReaction(fObj *Object) func(interface{}) error { f, _ := AssertFunction(fObj) - return func(x interface{}) { - _, _ = f(nil, r.ToValue(x)) + return func(x interface{}) error { + _, err := f(nil, r.ToValue(x)) + return err } } // NewPromise creates and returns a Promise and resolving functions for it. +// The returned errors will be uncatchable errors, such as InterruptedError or StackOverflowError, which should be propagated upwards. +// Exceptions are handled through [PromiseRejectionTracker]. // // WARNING: The returned values are not goroutine-safe and must not be called in parallel with VM running. // In order to make use of this method you need an event loop such as the one in goja_nodejs (https://github.com/dop251/goja_nodejs) @@ -617,11 +620,12 @@ func (r *Runtime) wrapPromiseReaction(fObj *Object) func(interface{}) { // go func() { // time.Sleep(500 * time.Millisecond) // or perform any other blocking operation // loop.RunOnLoop(func(*goja.Runtime) { // resolve() must be called on the loop, cannot call it here -// resolve(result) +// err := resolve(result) +// // Handle uncatchable errors (e.g. by stopping the loop, panicking or setting a flag) // }) // }() // } -func (r *Runtime) NewPromise() (promise *Promise, resolve func(result interface{}), reject func(reason interface{})) { +func (r *Runtime) NewPromise() (promise *Promise, resolve, reject func(reason interface{}) error) { p := r.newPromise(r.getPromisePrototype()) resolveF, rejectF := p.createResolvingFunctions() return p, r.wrapPromiseReaction(resolveF), r.wrapPromiseReaction(rejectF) diff --git a/vendor/github.com/ethereum/go-verkle/README.md b/vendor/github.com/ethereum/go-verkle/README.md index 2a1e7ce95d..88c8ff201a 100644 --- a/vendor/github.com/ethereum/go-verkle/README.md +++ b/vendor/github.com/ethereum/go-verkle/README.md @@ -1,16 +1,12 @@ [![Go Version](https://img.shields.io/badge/go-v1.19-green.svg)](https://golang.org/dl/) [![Lint and Test](https://github.com/ethereum/go-verkle/actions/workflows/go.yml/badge.svg)](https://github.com/ethereum/go-verkle/actions/workflows/go.yml) -[![DeepSource](https://deepsource.io/gh/ethereum/go-verkle.svg/?label=active+issues&show_trend=true&token=OjuF5Q2HbKzpWY8LgWuffNZp)](https://deepsource.io/gh/ethereum/go-verkle/?ref=repository-badge) [![goreports](https://goreportcard.com/badge/github.com/ethereum/go-verkle)](https://goreportcard.com/report/github.com/ethereum/go-verkle) [![API Reference](https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667)](https://pkg.go.dev/github.com/ethereum/go-verkle) -[![Block replay](https://github.com/ethereum/go-verkle/actions/workflows/block_replay.yml/badge.svg)](https://github.com/ethereum/go-verkle/actions/workflows/block_replay.yml) - # go-verkle > A Go implementation of Verkle Tree datastructure defined in the [spec](https://github.com/crate-crypto/verkle-trie-ref/tree/master/verkle). - ## Test & Benchmarks To run the tests and benchmarks, run the following commands: diff --git a/vendor/github.com/ethereum/go-verkle/config_ipa.go b/vendor/github.com/ethereum/go-verkle/config_ipa.go index fc8f41c8c1..f4fa2daf15 100644 --- a/vendor/github.com/ethereum/go-verkle/config_ipa.go +++ b/vendor/github.com/ethereum/go-verkle/config_ipa.go @@ -26,7 +26,6 @@ package verkle import ( - "encoding/hex" "sync" "github.com/crate-crypto/go-ipa/ipa" @@ -74,9 +73,8 @@ func GetConfig() *Config { cfg = &IPAConfig{conf: conf} // Initialize the empty code cached values. - emptyHashCode, _ := hex.DecodeString("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") values := make([][]byte, NodeWidth) - values[CodeHashVectorPosition] = emptyHashCode + values[CodeHashVectorPosition] = EmptyCodeHash var c1poly [NodeWidth]Fr if _, err := fillSuffixTreePoly(c1poly[:], values[:NodeWidth/2]); err != nil { panic(err) diff --git a/vendor/github.com/ethereum/go-verkle/doc.go b/vendor/github.com/ethereum/go-verkle/doc.go index 8e8d1f0453..258ec2c162 100644 --- a/vendor/github.com/ethereum/go-verkle/doc.go +++ b/vendor/github.com/ethereum/go-verkle/doc.go @@ -30,6 +30,8 @@ import "errors" var ( errInsertIntoHash = errors.New("trying to insert into hashed node") errDeleteHash = errors.New("trying to delete from a hashed subtree") + errDeleteMissing = errors.New("trying to delete a missing group") + errDeleteUnknown = errors.New("trying to delete an out-of-view node") errReadFromInvalid = errors.New("trying to read from an invalid child") errSerializeHashedNode = errors.New("trying to serialize a hashed internal node") errInsertIntoOtherStem = errors.New("insert splits a stem where it should not happen") diff --git a/vendor/github.com/ethereum/go-verkle/encoding.go b/vendor/github.com/ethereum/go-verkle/encoding.go index 2d19f56934..d5e27d17f6 100644 --- a/vendor/github.com/ethereum/go-verkle/encoding.go +++ b/vendor/github.com/ethereum/go-verkle/encoding.go @@ -50,12 +50,18 @@ const ( internalCommitmentOffset = internalBitlistOffset + bitlistSize // Leaf node offsets. - leafSteamOffset = nodeTypeOffset + nodeTypeSize - leafBitlistOffset = leafSteamOffset + StemSize + leafStemOffset = nodeTypeOffset + nodeTypeSize + leafBitlistOffset = leafStemOffset + StemSize leafCommitmentOffset = leafBitlistOffset + bitlistSize leafC1CommitmentOffset = leafCommitmentOffset + banderwagon.UncompressedSize leafC2CommitmentOffset = leafC1CommitmentOffset + banderwagon.UncompressedSize leafChildrenOffset = leafC2CommitmentOffset + banderwagon.UncompressedSize + leafBalanceSize = 32 + leafNonceSize = 8 + leafSlotSize = 32 + leafValueIndexSize = 1 + singleSlotLeafSize = nodeTypeSize + StemSize + 2*banderwagon.UncompressedSize + leafValueIndexSize + leafSlotSize + eoaLeafSize = nodeTypeSize + StemSize + 2*banderwagon.UncompressedSize + leafBalanceSize + leafNonceSize ) func bit(bitlist []byte, nr int) bool { @@ -69,8 +75,10 @@ var errSerializedPayloadTooShort = errors.New("verkle payload is too short") // ParseNode deserializes a node into its proper VerkleNode instance. // The serialized bytes have the format: -// - Internal nodes: -// - Leaf nodes: +// - Internal nodes: +// - Leaf nodes: +// - EoA nodes: +// - single slot node: func ParseNode(serializedNode []byte, depth byte) (VerkleNode, error) { // Check that the length of the serialized node is at least the smallest possible serialized node. if len(serializedNode) < nodeTypeSize+banderwagon.UncompressedSize { @@ -78,10 +86,14 @@ func ParseNode(serializedNode []byte, depth byte) (VerkleNode, error) { } switch serializedNode[0] { - case leafRLPType: + case leafType: return parseLeafNode(serializedNode, depth) - case internalRLPType: + case internalType: return CreateInternalNode(serializedNode[internalBitlistOffset:internalCommitmentOffset], serializedNode[internalCommitmentOffset:], depth) + case eoAccountType: + return parseEoAccountNode(serializedNode, depth) + case singleSlotType: + return parseSingleSlotNode(serializedNode, depth) default: return nil, ErrInvalidNodeEncoding } @@ -100,7 +112,7 @@ func parseLeafNode(serialized []byte, depth byte) (VerkleNode, error) { offset += LeafValueSize } } - ln := NewLeafNodeWithNoComms(serialized[leafSteamOffset:leafSteamOffset+StemSize], values[:]) + ln := NewLeafNodeWithNoComms(serialized[leafStemOffset:leafStemOffset+StemSize], values[:]) ln.setDepth(depth) ln.c1 = new(Point) @@ -123,6 +135,64 @@ func parseLeafNode(serialized []byte, depth byte) (VerkleNode, error) { return ln, nil } +func parseEoAccountNode(serialized []byte, depth byte) (VerkleNode, error) { + var values [NodeWidth][]byte + offset := leafStemOffset + StemSize + 2*banderwagon.UncompressedSize + values[0] = zero32[:] // 0 version + values[1] = serialized[offset : offset+leafBalanceSize] // balance + var nonce [32]byte + offset += leafBalanceSize + copy(nonce[:leafNonceSize], serialized[offset:offset+leafNonceSize]) + values[2] = nonce[:] // nonce + values[3] = EmptyCodeHash[:] + values[4] = zero32[:] // 0 code size + ln := NewLeafNodeWithNoComms(serialized[leafStemOffset:leafStemOffset+StemSize], values[:]) + ln.setDepth(depth) + ln.c1 = new(Point) + if err := ln.c1.SetBytesUncompressed(serialized[leafStemOffset+StemSize:leafStemOffset+StemSize+banderwagon.UncompressedSize], true); err != nil { + return nil, fmt.Errorf("error setting leaf C1 commitment: %w", err) + } + ln.c2 = &banderwagon.Identity + ln.commitment = new(Point) + if err := ln.commitment.SetBytesUncompressed(serialized[leafStemOffset+StemSize+banderwagon.UncompressedSize:leafStemOffset+StemSize+banderwagon.UncompressedSize*2], true); err != nil { + return nil, fmt.Errorf("error setting leaf root commitment: %w", err) + } + return ln, nil +} + +func parseSingleSlotNode(serialized []byte, depth byte) (VerkleNode, error) { + var values [NodeWidth][]byte + offset := leafStemOffset + ln := NewLeafNodeWithNoComms(serialized[offset:offset+StemSize], values[:]) + offset += StemSize + cnCommBytes := serialized[offset : offset+banderwagon.UncompressedSize] + offset += banderwagon.UncompressedSize + rootCommBytes := serialized[offset : offset+banderwagon.UncompressedSize] + offset += banderwagon.UncompressedSize + idx := serialized[offset] + offset += leafValueIndexSize + values[idx] = serialized[offset : offset+leafSlotSize] // copy slot + ln.setDepth(depth) + if idx < 128 { + ln.c1 = new(Point) + if err := ln.c1.SetBytesUncompressed(cnCommBytes, true); err != nil { + return nil, fmt.Errorf("error setting leaf C1 commitment: %w", err) + } + ln.c2 = &banderwagon.Identity + } else { + ln.c2 = new(Point) + if err := ln.c2.SetBytesUncompressed(cnCommBytes, true); err != nil { + return nil, fmt.Errorf("error setting leaf C2 commitment: %w", err) + } + ln.c1 = &banderwagon.Identity + } + ln.commitment = new(Point) + if err := ln.commitment.SetBytesUncompressed(rootCommBytes, true); err != nil { + return nil, fmt.Errorf("error setting leaf root commitment: %w", err) + } + return ln, nil +} + func CreateInternalNode(bitlist []byte, raw []byte, depth byte) (*InternalNode, error) { // GetTreeConfig caches computation result, hence // this op has low overhead diff --git a/vendor/github.com/ethereum/go-verkle/proof_ipa.go b/vendor/github.com/ethereum/go-verkle/proof_ipa.go index 3f7af94149..15d4e8a85f 100644 --- a/vendor/github.com/ethereum/go-verkle/proof_ipa.go +++ b/vendor/github.com/ethereum/go-verkle/proof_ipa.go @@ -53,6 +53,9 @@ type VerkleProof struct { } func (vp *VerkleProof) Copy() *VerkleProof { + if vp == nil { + return nil + } ret := &VerkleProof{ OtherStems: make([][StemSize]byte, len(vp.OtherStems)), DepthExtensionPresent: make([]byte, len(vp.DepthExtensionPresent)), @@ -73,6 +76,35 @@ func (vp *VerkleProof) Copy() *VerkleProof { return ret } +func (vp *VerkleProof) Equal(other *VerkleProof) error { + if len(vp.OtherStems) != len(other.OtherStems) { + return fmt.Errorf("different number of other stems: %d != %d", len(vp.OtherStems), len(other.OtherStems)) + } + for i := range vp.OtherStems { + if vp.OtherStems[i] != other.OtherStems[i] { + return fmt.Errorf("different other stem: %x != %x", vp.OtherStems[i], other.OtherStems[i]) + } + } + if len(vp.DepthExtensionPresent) != len(other.DepthExtensionPresent) { + return fmt.Errorf("different number of depth extension present: %d != %d", len(vp.DepthExtensionPresent), len(other.DepthExtensionPresent)) + } + if !bytes.Equal(vp.DepthExtensionPresent, other.DepthExtensionPresent) { + return fmt.Errorf("different depth extension present: %x != %x", vp.DepthExtensionPresent, other.DepthExtensionPresent) + } + if len(vp.CommitmentsByPath) != len(other.CommitmentsByPath) { + return fmt.Errorf("different number of commitments by path: %d != %d", len(vp.CommitmentsByPath), len(other.CommitmentsByPath)) + } + for i := range vp.CommitmentsByPath { + if vp.CommitmentsByPath[i] != other.CommitmentsByPath[i] { + return fmt.Errorf("different commitment by path: %x != %x", vp.CommitmentsByPath[i], other.CommitmentsByPath[i]) + } + } + if vp.D != other.D { + return fmt.Errorf("different D: %x != %x", vp.D, other.D) + } + return nil +} + type Proof struct { Multipoint *ipa.MultiProof // multipoint argument ExtStatus []byte // the extension status of each stem @@ -118,6 +150,40 @@ func (sd StateDiff) Copy() StateDiff { return ret } +func (sd StateDiff) Equal(other StateDiff) error { + if len(sd) != len(other) { + return fmt.Errorf("different number of stem state diffs: %d != %d", len(sd), len(other)) + } + for i := range sd { + if sd[i].Stem != other[i].Stem { + return fmt.Errorf("different stem: %x != %x", sd[i].Stem, other[i].Stem) + } + if len(sd[i].SuffixDiffs) != len(other[i].SuffixDiffs) { + return fmt.Errorf("different number of suffix state diffs: %d != %d", len(sd[i].SuffixDiffs), len(other[i].SuffixDiffs)) + } + for j := range sd[i].SuffixDiffs { + if sd[i].SuffixDiffs[j].Suffix != other[i].SuffixDiffs[j].Suffix { + return fmt.Errorf("different suffix: %x != %x", sd[i].SuffixDiffs[j].Suffix, other[i].SuffixDiffs[j].Suffix) + } + if sd[i].SuffixDiffs[j].CurrentValue != nil && other[i].SuffixDiffs[j].CurrentValue != nil { + if *sd[i].SuffixDiffs[j].CurrentValue != *other[i].SuffixDiffs[j].CurrentValue { + return fmt.Errorf("different current value: %x != %x", *sd[i].SuffixDiffs[j].CurrentValue, *other[i].SuffixDiffs[j].CurrentValue) + } + } else if sd[i].SuffixDiffs[j].CurrentValue != nil || other[i].SuffixDiffs[j].CurrentValue != nil { + return fmt.Errorf("different current value: %x != %x", sd[i].SuffixDiffs[j].CurrentValue, other[i].SuffixDiffs[j].CurrentValue) + } + if sd[i].SuffixDiffs[j].NewValue != nil && other[i].SuffixDiffs[j].NewValue != nil { + if *sd[i].SuffixDiffs[j].NewValue != *other[i].SuffixDiffs[j].NewValue { + return fmt.Errorf("different new value: %x != %x", *sd[i].SuffixDiffs[j].NewValue, *other[i].SuffixDiffs[j].NewValue) + } + } else if sd[i].SuffixDiffs[j].NewValue != nil || other[i].SuffixDiffs[j].NewValue != nil { + return fmt.Errorf("different new value: %x != %x", sd[i].SuffixDiffs[j].NewValue, other[i].SuffixDiffs[j].NewValue) + } + } + } + return nil +} + func GetCommitmentsForMultiproof(root VerkleNode, keys [][]byte, resolver NodeResolverFn) (*ProofElements, []byte, []Stem, error) { sort.Sort(keylist(keys)) return root.GetProofItems(keylist(keys), resolver) @@ -202,21 +268,21 @@ func MakeVerkleMultiProof(preroot, postroot VerkleNode, keys [][]byte, resolver return proof, pe.Cis, pe.Zis, pe.Yis, nil } -// VerifyVerkleProofWithPreState takes a proof and a trusted tree root and verifies that the proof is valid. -func VerifyVerkleProofWithPreState(proof *Proof, preroot VerkleNode) error { +// verifyVerkleProofWithPreState takes a proof and a trusted tree root and verifies that the proof is valid. +func verifyVerkleProofWithPreState(proof *Proof, preroot VerkleNode) error { pe, _, _, _, err := getProofElementsFromTree(preroot, nil, proof.Keys, nil) if err != nil { return fmt.Errorf("error getting proof elements: %w", err) } - if ok, err := VerifyVerkleProof(proof, pe.Cis, pe.Zis, pe.Yis, GetConfig()); !ok || err != nil { + if ok, err := verifyVerkleProof(proof, pe.Cis, pe.Zis, pe.Yis, GetConfig()); !ok || err != nil { return fmt.Errorf("error verifying proof: verifies=%v, error=%w", ok, err) } return nil } -func VerifyVerkleProof(proof *Proof, Cs []*Point, indices []uint8, ys []*Fr, tc *Config) (bool, error) { +func verifyVerkleProof(proof *Proof, Cs []*Point, indices []uint8, ys []*Fr, tc *Config) (bool, error) { tr := common.NewTranscript("vt") return ipa.CheckMultiProof(tr, tc.conf, proof.Multipoint, Cs, ys, indices) } @@ -555,3 +621,59 @@ type bytesSlice []Stem func (x bytesSlice) Len() int { return len(x) } func (x bytesSlice) Less(i, j int) bool { return bytes.Compare(x[i], x[j]) < 0 } func (x bytesSlice) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +// Verify is the API function that verifies a verkle proofs as found in a block/execution payload. +func Verify(vp *VerkleProof, preStateRoot []byte, postStateRoot []byte, statediff StateDiff) error { + + proof, err := DeserializeProof(vp, statediff) + if err != nil { + return fmt.Errorf("verkle proof deserialization error: %w", err) + } + + rootC := new(Point) + if err := rootC.SetBytes(preStateRoot); err != nil { + return fmt.Errorf("error setting prestate root: %w", err) + } + pretree, err := PreStateTreeFromProof(proof, rootC) + if err != nil { + return fmt.Errorf("error rebuilding the pre-tree from proof: %w", err) + } + // TODO this should not be necessary, remove it + // after the new proof generation code has stabilized. + for _, stemdiff := range statediff { + for _, suffixdiff := range stemdiff.SuffixDiffs { + var key [32]byte + copy(key[:31], stemdiff.Stem[:]) + key[31] = suffixdiff.Suffix + + val, err := pretree.Get(key[:], nil) + if err != nil { + return fmt.Errorf("could not find key %x in tree rebuilt from proof: %w", key, err) + } + if len(val) > 0 { + if !bytes.Equal(val, suffixdiff.CurrentValue[:]) { + return fmt.Errorf("could not find correct value at %x in tree rebuilt from proof: %x != %x", key, val, *suffixdiff.CurrentValue) + } + } else { + if suffixdiff.CurrentValue != nil && len(suffixdiff.CurrentValue) != 0 { + return fmt.Errorf("could not find correct value at %x in tree rebuilt from proof: %x != %x", key, val, *suffixdiff.CurrentValue) + } + } + } + } + + // TODO: this is necessary to verify that the post-values are the correct ones. + // But all this can be avoided with a even faster way. The EVM block execution can + // keep track of the written keys, and compare that list with this post-values list. + // This can avoid regenerating the post-tree which is somewhat expensive. + posttree, err := PostStateTreeFromStateDiff(pretree, statediff) + if err != nil { + return fmt.Errorf("error rebuilding the post-tree from proof: %w", err) + } + regeneratedPostTreeRoot := posttree.Commitment().Bytes() + if !bytes.Equal(regeneratedPostTreeRoot[:], postStateRoot) { + return fmt.Errorf("post tree root mismatch: %x != %x", regeneratedPostTreeRoot, postStateRoot) + } + + return verifyVerkleProofWithPreState(proof, pretree) +} diff --git a/vendor/github.com/ethereum/go-verkle/tree.go b/vendor/github.com/ethereum/go-verkle/tree.go index e7c6ba468a..38c2128a23 100644 --- a/vendor/github.com/ethereum/go-verkle/tree.go +++ b/vendor/github.com/ethereum/go-verkle/tree.go @@ -27,6 +27,7 @@ package verkle import ( "bytes" + "encoding/hex" "encoding/json" "errors" "fmt" @@ -165,8 +166,10 @@ func (pe *ProofElements) Merge(other *ProofElements) { const ( // These types will distinguish internal // and leaf nodes when decoding from RLP. - internalRLPType byte = 1 - leafRLPType byte = 2 + internalType byte = 1 + leafType byte = 2 + eoAccountType byte = 3 + singleSlotType byte = 4 ) type ( @@ -273,8 +276,7 @@ func NewLeafNode(stem Stem, values [][]byte) (*LeafNode, error) { if err != nil { return nil, err } - containsEmptyCodeHash := len(c1poly) >= EmptyCodeHashSecondHalfIdx && - c1poly[EmptyCodeHashFirstHalfIdx].Equal(&EmptyCodeHashFirstHalfValue) && + containsEmptyCodeHash := c1poly[EmptyCodeHashFirstHalfIdx].Equal(&EmptyCodeHashFirstHalfValue) && c1poly[EmptyCodeHashSecondHalfIdx].Equal(&EmptyCodeHashSecondHalfValue) if containsEmptyCodeHash { // Clear out values of the cached point. @@ -629,6 +631,78 @@ func (n *InternalNode) Delete(key []byte, resolver NodeResolverFn) (bool, error) } } +// DeleteAtStem delete a full stem. Unlike Delete, it will error out if the stem that is to +// be deleted does not exist in the tree, because it's meant to be used by rollback code, +// that should only delete things that exist. +func (n *InternalNode) DeleteAtStem(key []byte, resolver NodeResolverFn) (bool, error) { + nChild := offset2key(key, n.depth) + switch child := n.children[nChild].(type) { + case Empty: + return false, errDeleteMissing + case HashedNode: + if resolver == nil { + return false, errDeleteHash + } + payload, err := resolver(key[:n.depth+1]) + if err != nil { + return false, err + } + // deserialize the payload and set it as the child + c, err := ParseNode(payload, n.depth+1) + if err != nil { + return false, err + } + n.children[nChild] = c + return n.DeleteAtStem(key, resolver) + case *LeafNode: + if !bytes.Equal(child.stem, key[:31]) { + return false, errDeleteMissing + } + + n.cowChild(nChild) + n.children[nChild] = Empty{} + + // Check if all children are gone, if so + // signal that this node should be deleted + // as well. + for _, c := range n.children { + if _, ok := c.(Empty); !ok { + return false, nil + } + } + + return true, nil + case *InternalNode: + n.cowChild(nChild) + del, err := child.DeleteAtStem(key, resolver) + if err != nil { + return false, err + } + + // delete the entire child if instructed to by + // the recursive algorigthm. + if del { + n.children[nChild] = Empty{} + + // Check if all children are gone, if so + // signal that this node should be deleted + // as well. + for _, c := range n.children { + if _, ok := c.(Empty); !ok { + return false, nil + } + } + + return true, nil + } + + return false, nil + default: + // only unknown nodes are left + return false, errDeleteUnknown + } +} + // Flush hashes the children of an internal node and replaces them // with HashedNode. It also sends the current node on the flush channel. func (n *InternalNode) Flush(flush NodeFlushFn) { @@ -988,7 +1062,7 @@ func (n *InternalNode) Serialize() ([]byte, error) { } // Write the - ret[nodeTypeOffset] = internalRLPType + ret[nodeTypeOffset] = internalType // Write the comm := n.commitment.BytesUncompressedTrusted() @@ -1747,7 +1821,7 @@ func (n *InternalNode) serializeInternalWithUncompressedCommitment(pointsIdx map setBit(bitlist, i) } } - serialized[nodeTypeOffset] = internalRLPType + serialized[nodeTypeOffset] = internalType pointidx, ok := pointsIdx[n] if !ok { return nil, fmt.Errorf("child node not found in cache") @@ -1757,32 +1831,92 @@ func (n *InternalNode) serializeInternalWithUncompressedCommitment(pointsIdx map return serialized, nil } +var ( + zero24 [24]byte + zero32 [32]byte + EmptyCodeHash, _ = hex.DecodeString("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") +) + func (n *LeafNode) serializeLeafWithUncompressedCommitments(cBytes, c1Bytes, c2Bytes [banderwagon.UncompressedSize]byte) []byte { // Empty value in LeafNode used for padding. var emptyValue [LeafValueSize]byte // Create bitlist and store in children LeafValueSize (padded) values. children := make([]byte, 0, NodeWidth*LeafValueSize) - var bitlist [bitlistSize]byte + var ( + bitlist [bitlistSize]byte + isEoA = false // TODO: EoA serialization optimization is broken -- re-enable when fixed. + count, lastIdx int + ) for i, v := range n.values { if v != nil { + count++ + lastIdx = i setBit(bitlist[:], i) children = append(children, v...) if padding := emptyValue[:LeafValueSize-len(v)]; len(padding) != 0 { children = append(children, padding...) } } + + if isEoA { + switch i { + case 0: + // Version should be 0 + isEoA = v != nil && bytes.Equal(v, zero32[:]) + case 1: + // Balance should not be nil + isEoA = v != nil + case 2: + // Nonce should have its last 24 bytes set to 0 + isEoA = v != nil && bytes.Equal(v[leafNonceSize:], zero24[:]) + case 3: + // Code hash should be the empty code hash + isEoA = v != nil && bytes.Equal(v, EmptyCodeHash[:]) + case 4: + // Code size must be 0 + isEoA = v != nil && bytes.Equal(v, zero32[:]) + default: + // All other values must be nil + isEoA = v == nil + } + } } + // TODO: single slot serialization optimization is apparently broken -- force disabling it until is fixed. + count = 256 + // Create the serialization. - result := make([]byte, nodeTypeSize+StemSize+bitlistSize+3*banderwagon.UncompressedSize+len(children)) - result[0] = leafRLPType - copy(result[leafSteamOffset:], n.stem[:StemSize]) - copy(result[leafBitlistOffset:], bitlist[:]) - copy(result[leafCommitmentOffset:], cBytes[:]) - copy(result[leafC1CommitmentOffset:], c1Bytes[:]) - copy(result[leafC2CommitmentOffset:], c2Bytes[:]) - copy(result[leafChildrenOffset:], children) + var result []byte + switch { + case count == 1: + var buf [singleSlotLeafSize]byte + result = buf[:] + result[0] = singleSlotType + copy(result[leafStemOffset:], n.stem[:StemSize]) + copy(result[leafStemOffset+StemSize:], c1Bytes[:]) + copy(result[leafStemOffset+StemSize+banderwagon.UncompressedSize:], cBytes[:]) + result[leafStemOffset+StemSize+2*banderwagon.UncompressedSize] = byte(lastIdx) + copy(result[leafStemOffset+StemSize+2*banderwagon.UncompressedSize+leafValueIndexSize:], n.values[lastIdx][:]) + case isEoA: + var buf [eoaLeafSize]byte + result = buf[:] + result[0] = eoAccountType + copy(result[leafStemOffset:], n.stem[:StemSize]) + copy(result[leafStemOffset+StemSize:], c1Bytes[:]) + copy(result[leafStemOffset+StemSize+banderwagon.UncompressedSize:], cBytes[:]) + copy(result[leafStemOffset+StemSize+2*banderwagon.UncompressedSize:], n.values[1]) // copy balance + copy(result[leafStemOffset+StemSize+2*banderwagon.UncompressedSize+leafBalanceSize:], n.values[2][:leafNonceSize]) // copy nonce + default: + result = make([]byte, nodeTypeSize+StemSize+bitlistSize+3*banderwagon.UncompressedSize+len(children)) + result[0] = leafType + copy(result[leafStemOffset:], n.stem[:StemSize]) + copy(result[leafBitlistOffset:], bitlist[:]) + copy(result[leafCommitmentOffset:], cBytes[:]) + copy(result[leafC1CommitmentOffset:], c1Bytes[:]) + copy(result[leafC2CommitmentOffset:], c2Bytes[:]) + copy(result[leafChildrenOffset:], children) + } return result } diff --git a/vendor/github.com/jedib0t/go-pretty/v6/progress/render.go b/vendor/github.com/jedib0t/go-pretty/v6/progress/render.go index 697d8aa4da..6e54d3c393 100644 --- a/vendor/github.com/jedib0t/go-pretty/v6/progress/render.go +++ b/vendor/github.com/jedib0t/go-pretty/v6/progress/render.go @@ -78,7 +78,7 @@ func (p *Progress) extractDoneAndActiveTrackers() ([]*Tracker, []*Tracker) { if eta := tracker.ETA(); eta > maxETA { maxETA = eta } - } else { + } else if !tracker.RemoveOnCompletion { trackersDone = append(trackersDone, tracker) } } @@ -230,14 +230,16 @@ func (p *Progress) renderTracker(out *strings.Builder, t *Tracker, hint renderHi } func (p *Progress) renderTrackerDone(out *strings.Builder, t *Tracker, message string) { - out.WriteString(p.style.Colors.Message.Sprint(message)) - out.WriteString(p.style.Colors.Message.Sprint(p.style.Options.Separator)) - if !t.IsErrored() { - out.WriteString(p.style.Colors.Message.Sprint(p.style.Options.DoneString)) - } else { - out.WriteString(p.style.Colors.Error.Sprint(p.style.Options.ErrorString)) + if !t.RemoveOnCompletion { + out.WriteString(p.style.Colors.Message.Sprint(message)) + out.WriteString(p.style.Colors.Message.Sprint(p.style.Options.Separator)) + if !t.IsErrored() { + out.WriteString(p.style.Colors.Message.Sprint(p.style.Options.DoneString)) + } else { + out.WriteString(p.style.Colors.Error.Sprint(p.style.Options.ErrorString)) + } + p.renderTrackerStats(out, t, renderHint{hideTime: !p.style.Visibility.Time, hideValue: !p.style.Visibility.Value}) } - p.renderTrackerStats(out, t, renderHint{hideTime: !p.style.Visibility.Time, hideValue: !p.style.Visibility.Value}) } func (p *Progress) renderTrackerMessage(out *strings.Builder, t *Tracker, message string) { diff --git a/vendor/github.com/jedib0t/go-pretty/v6/progress/tracker.go b/vendor/github.com/jedib0t/go-pretty/v6/progress/tracker.go index 30cb57c670..dd70124565 100644 --- a/vendor/github.com/jedib0t/go-pretty/v6/progress/tracker.go +++ b/vendor/github.com/jedib0t/go-pretty/v6/progress/tracker.go @@ -24,6 +24,9 @@ type Tracker struct { // ExpectedDuration tells how long this task is expected to take; and will // be used in calculation of the ETA value ExpectedDuration time.Duration + // RemoveOnCompletion tells the Progress Bar to remove this tracker when + // it is done, instead of rendering a "completed" line + RemoveOnCompletion bool // Total should be set to the (expected) Total/Final value to be reached Total int64 // Units defines the type of the "value" being tracked diff --git a/vendor/modules.txt b/vendor/modules.txt index 56ed31c3fb..0a1a8766a9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -61,7 +61,7 @@ github.com/CortexFoundation/robot/backend # github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 ## explicit; go 1.16 github.com/CortexFoundation/statik -# github.com/CortexFoundation/torrentfs v1.0.69-0.20241018084445-786f28fec5ce +# github.com/CortexFoundation/torrentfs v1.0.69-0.20241027142008-6bf9445f396f ## explicit; go 1.23.0 github.com/CortexFoundation/torrentfs github.com/CortexFoundation/torrentfs/backend @@ -344,20 +344,20 @@ github.com/cespare/xxhash # github.com/cespare/xxhash/v2 v2.3.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 -# github.com/charmbracelet/bubbletea v1.1.1 +# github.com/charmbracelet/bubbletea v1.1.2 ## explicit; go 1.18 github.com/charmbracelet/bubbletea -# github.com/charmbracelet/lipgloss v0.13.0 +# github.com/charmbracelet/lipgloss v0.13.1 ## explicit; go 1.18 github.com/charmbracelet/lipgloss -# github.com/charmbracelet/x/ansi v0.3.2 +# github.com/charmbracelet/x/ansi v0.4.0 ## explicit; go 1.18 github.com/charmbracelet/x/ansi github.com/charmbracelet/x/ansi/parser # github.com/charmbracelet/x/term v0.2.0 ## explicit; go 1.18 github.com/charmbracelet/x/term -# github.com/cloudflare/cloudflare-go v0.107.0 +# github.com/cloudflare/cloudflare-go v0.108.0 ## explicit; go 1.19 github.com/cloudflare/cloudflare-go # github.com/cockroachdb/errors v1.11.3 @@ -490,8 +490,8 @@ github.com/deckarep/golang-set/v2 ## explicit; go 1.17 github.com/decred/dcrd/dcrec/secp256k1/v4 github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa -# github.com/dgraph-io/badger/v4 v4.3.1 -## explicit; go 1.19 +# github.com/dgraph-io/badger/v4 v4.3.2-0.20241025163334-7f657f862cbd +## explicit; go 1.23 github.com/dgraph-io/badger/v4 github.com/dgraph-io/badger/v4/fb github.com/dgraph-io/badger/v4/options @@ -500,16 +500,16 @@ github.com/dgraph-io/badger/v4/skl github.com/dgraph-io/badger/v4/table github.com/dgraph-io/badger/v4/trie github.com/dgraph-io/badger/v4/y -# github.com/dgraph-io/ristretto v1.0.0 -## explicit; go 1.19 -github.com/dgraph-io/ristretto -github.com/dgraph-io/ristretto/z -github.com/dgraph-io/ristretto/z/simd +# github.com/dgraph-io/ristretto/v2 v2.0.0-alpha +## explicit; go 1.23 +github.com/dgraph-io/ristretto/v2 +github.com/dgraph-io/ristretto/v2/z +github.com/dgraph-io/ristretto/v2/z/simd # github.com/dlclark/regexp2 v1.11.4 ## explicit; go 1.13 github.com/dlclark/regexp2 github.com/dlclark/regexp2/syntax -# github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 +# github.com/dop251/goja v0.0.0-20241024094426-79f3a7efcdbd ## explicit; go 1.20 github.com/dop251/goja github.com/dop251/goja/ast @@ -534,8 +534,8 @@ github.com/erikgeiser/coninput # github.com/ethereum/c-kzg-4844 v1.0.3 ## explicit; go 1.19 github.com/ethereum/c-kzg-4844/bindings/go -# github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 -## explicit; go 1.19 +# github.com/ethereum/go-verkle v0.2.1 +## explicit; go 1.22 github.com/ethereum/go-verkle # github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e ## explicit; go 1.18 @@ -631,7 +631,7 @@ github.com/google/go-querystring/query ## explicit; go 1.12 github.com/google/gofuzz github.com/google/gofuzz/bytesource -# github.com/google/pprof v0.0.0-20241017200806-017d972448fc +# github.com/google/pprof v0.0.0-20241023014458-598669927662 ## explicit; go 1.22 github.com/google/pprof/profile # github.com/google/uuid v1.6.0 @@ -692,7 +692,7 @@ github.com/influxdata/line-protocol # github.com/jackpal/go-nat-pmp v1.0.2 ## explicit github.com/jackpal/go-nat-pmp -# github.com/jedib0t/go-pretty/v6 v6.6.0 +# github.com/jedib0t/go-pretty/v6 v6.6.1 ## explicit; go 1.17 github.com/jedib0t/go-pretty/v6/progress github.com/jedib0t/go-pretty/v6/text @@ -945,7 +945,7 @@ github.com/prometheus/client_golang/prometheus/internal # github.com/prometheus/client_model v0.6.1 ## explicit; go 1.19 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.60.0 +# github.com/prometheus/common v0.60.1 ## explicit; go 1.21 github.com/prometheus/common/expfmt github.com/prometheus/common/model @@ -1038,8 +1038,8 @@ github.com/ucwong/filecache # github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb ## explicit; go 1.19 github.com/ucwong/go-ttlmap -# github.com/ucwong/golang-kv v1.0.24-0.20241016100820-f20ccc488463 -## explicit; go 1.22.0 +# github.com/ucwong/golang-kv v1.0.24-0.20241027140620-922b40f404bb +## explicit; go 1.23 github.com/ucwong/golang-kv github.com/ucwong/golang-kv/badger github.com/ucwong/golang-kv/bolt