From 8fee49ffceb2008ce070b141e29f9fe87e7ec010 Mon Sep 17 00:00:00 2001 From: Tei Im Date: Wed, 31 Jan 2024 18:00:54 +0900 Subject: [PATCH 01/12] Implement LoadElf, Witness command based on Cannon Update optimism dependency version Group rvgo tests into package --- .gitignore | 3 + go.sum | 374 +++++++--------------------------- rvgo/cmd/json.go | 62 ++++++ rvgo/cmd/load_elf.go | 51 +++++ rvgo/cmd/witness.go | 56 +++++ rvgo/main.go | 46 +++++ rvgo/{ => test}/evm_test.go | 14 +- rvgo/{ => test}/vm_go_test.go | 6 +- rvgo/{ => test}/vm_test.go | 2 +- 9 files changed, 303 insertions(+), 311 deletions(-) create mode 100644 rvgo/cmd/json.go create mode 100644 rvgo/cmd/load_elf.go create mode 100644 rvgo/cmd/witness.go create mode 100644 rvgo/main.go rename rvgo/{ => test}/evm_test.go (90%) rename rvgo/{ => test}/vm_go_test.go (97%) rename rvgo/{ => test}/vm_test.go (99%) diff --git a/.gitignore b/.gitignore index 324233a6..a963bcb8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ rvsol/cache rvsol/out tests/go-tests/bin + +# jetbrains +.idea/ \ No newline at end of file diff --git a/go.sum b/go.sum index 56426d2e..cadde6c9 100644 --- a/go.sum +++ b/go.sum @@ -1,61 +1,46 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= -github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= -github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= -github.com/VictoriaMetrics/fastcache v1.10.0 h1:5hDJnLsKLpnUEToub7ETuRu8RCkb40woBZAUiKonXzY= -github.com/VictoriaMetrics/fastcache v1.10.0/go.mod h1:tjiYeEfYXCqacuvYw/7UoDIeJaNxq6132xHICNP77w8= -github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo= github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= -github.com/btcsuite/btcd v0.23.3 h1:4KH/JKy9WiCd+iUS9Mu0Zp7Dnj17TGdKrg9xc/FGj24= +github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877 h1:1MLK4YpFtIEo3ZtMA5C795Wtv5VuUnrXX7mQG+aHg6o= -github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= -github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= -github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 h1:T+Np/xtzIjYM/P5NAw0e2Rf1FGvzDau1h54MKvx8G7w= -github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06/go.mod h1:bynZ3gvVyhlvjLI7PT6dmZ7g76xzJ7HpxfjgkzCGz6s= -github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= -github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4 h1:PuHFhOUMnD62r80dN+Ik5qco2drekgsUSVdcHsvllec= +github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA= -github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A= -github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= +github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= +github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= +github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -66,179 +51,84 @@ 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.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/ethereum-optimism/op-geth v1.101200.2-rc.1.0.20230922185314-7997a6fed17c h1:EfBySl/7PCIeDFnEt2TCMXSPjg9Fe60peHCY5YkNzDM= -github.com/ethereum-optimism/op-geth v1.101200.2-rc.1.0.20230922185314-7997a6fed17c/go.mod h1:TATnHMajC8fpMPagb5Np97yt6kvke7if2An4PeIlhps= -github.com/ethereum-optimism/optimism v1.1.5-rc.1.0.20230922205554-a7ff5a811612 h1:5j3BuSeZKhGMPXRwjv3bhfFtrMoISdhoNqCyperX1l0= -github.com/ethereum-optimism/optimism v1.1.5-rc.1.0.20230922205554-a7ff5a811612/go.mod h1:GY10vs8ja988bb0IVDrLobOMp0hZD/XaLXPN3myDbeQ= -github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20230921190252-f29074de9e36 h1:HGDz8DcAkHvZy+iPnBa8yr4MdLqKpb7oAks01P08JOg= -github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20230921190252-f29074de9e36/go.mod h1:q0u2UbyOr1q/y94AgMOj/V8b1KO05ZwILTR/qKt7Auo= -github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= -github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 h1:hIVC7qCb6yC+W/THmNeJCsklUb19zjBjl04ymYtsNUs= +github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195/go.mod h1:ZzHgkhz1NBvaFACB/Vmcbb//h1/7nTdgtZfFv+0G76M= +github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= +github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk= +github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= -github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= -github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= -github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= -github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= -github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= -github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= -github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= -github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= -github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= -github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= -github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= -github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= @@ -248,54 +138,36 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= -github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= +github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -307,191 +179,98 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= -github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= -github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= +github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= +github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= -gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -499,12 +278,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/rvgo/cmd/json.go b/rvgo/cmd/json.go new file mode 100644 index 00000000..615baced --- /dev/null +++ b/rvgo/cmd/json.go @@ -0,0 +1,62 @@ +package cmd + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "os" + + "github.com/ethereum-optimism/optimism/op-service/ioutil" +) + +func loadJSON[X any](inputPath string) (*X, error) { + if inputPath == "" { + return nil, errors.New("no path specified") + } + var f io.ReadCloser + f, err := ioutil.OpenDecompressed(inputPath) + if err != nil { + return nil, fmt.Errorf("failed to open file %q: %w", inputPath, err) + } + defer f.Close() + var state X + if err := json.NewDecoder(f).Decode(&state); err != nil { + return nil, fmt.Errorf("failed to decode file %q: %w", inputPath, err) + } + return &state, nil +} + +func writeJSON[X any](outputPath string, value X) error { + if outputPath == "" { + return nil + } + var out io.Writer + finish := func() error { return nil } + if outputPath != "-" { + f, err := ioutil.NewAtomicWriterCompressed(outputPath, 0755) + if err != nil { + return fmt.Errorf("failed to open output file: %w", err) + } + // Ensure we close the stream even if failures occur. + defer f.Close() + out = f + // Closing the file causes it to be renamed to the final destination + // so make sure we handle any errors it returns + finish = f.Close + } else { + out = os.Stdout + } + enc := json.NewEncoder(out) + if err := enc.Encode(value); err != nil { + return fmt.Errorf("failed to encode to JSON: %w", err) + } + _, err := out.Write([]byte{'\n'}) + if err != nil { + return fmt.Errorf("failed to append new-line: %w", err) + } + if err := finish(); err != nil { + return fmt.Errorf("failed to finish write: %w", err) + } + return nil +} diff --git a/rvgo/cmd/load_elf.go b/rvgo/cmd/load_elf.go new file mode 100644 index 00000000..48df024e --- /dev/null +++ b/rvgo/cmd/load_elf.go @@ -0,0 +1,51 @@ +package cmd + +import ( + "debug/elf" + "fmt" + "github.com/urfave/cli/v2" + + "github.com/ethereum-optimism/asterisc/rvgo/fast" +) + +var ( + LoadELFPathFlag = &cli.PathFlag{ + Name: "path", + Usage: "Path to RISC-V ELF file", + TakesFile: true, + Required: true, + } + LoadELFOutFlag = &cli.PathFlag{ + Name: "out", + Usage: "Output path to write JSON state to. State is dumped to stdout if set to -. Not written if empty.", + Value: "state.json", + Required: false, + } +) + +func LoadELF(ctx *cli.Context) error { + elfPath := ctx.Path(LoadELFPathFlag.Name) + elfProgram, err := elf.Open(elfPath) + if err != nil { + return fmt.Errorf("failed to open ELF file %q: %w", elfPath, err) + } + if elfProgram.Machine != elf.EM_RISCV { + return fmt.Errorf("ELF is not RISC-V, but got %q", elfProgram.Machine.String()) + } + state, err := fast.LoadELF(elfProgram) + if err != nil { + return fmt.Errorf("failed to load ELF data into VM state: %w", err) + } + return writeJSON[*fast.VMState](ctx.Path(LoadELFOutFlag.Name), state) +} + +var LoadELFCommand = &cli.Command{ + Name: "load-elf", + Usage: "Load ELF file into Cannon JSON state", + Description: "Load ELF file into Cannon JSON state, optionally patch out functions", + Action: LoadELF, + Flags: []cli.Flag{ + LoadELFPathFlag, + LoadELFOutFlag, + }, +} diff --git a/rvgo/cmd/witness.go b/rvgo/cmd/witness.go new file mode 100644 index 00000000..29ad0133 --- /dev/null +++ b/rvgo/cmd/witness.go @@ -0,0 +1,56 @@ +package cmd + +import ( + "fmt" + "os" + + "github.com/urfave/cli/v2" + + "github.com/ethereum-optimism/asterisc/rvgo/fast" +) + +var ( + WitnessInputFlag = &cli.PathFlag{ + Name: "input", + Usage: "path of input JSON state.", + TakesFile: true, + Required: true, + } + WitnessOutputFlag = &cli.PathFlag{ + Name: "output", + Usage: "path to write binary witness.", + TakesFile: true, + } +) + +func Witness(ctx *cli.Context) error { + input := ctx.Path(WitnessInputFlag.Name) + output := ctx.Path(WitnessOutputFlag.Name) + state, err := loadJSON[fast.VMState](input) + if err != nil { + return fmt.Errorf("invalid input state (%v): %w", input, err) + } + witness := state.EncodeWitness() + h, err := witness.StateHash() + if err != nil { + return fmt.Errorf("failed to compute witness hash: %w", err) + } + if output != "" { + if err := os.WriteFile(output, witness, 0755); err != nil { + return fmt.Errorf("writing output to %v: %w", output, err) + } + } + fmt.Println(h.Hex()) + return nil +} + +var WitnessCommand = &cli.Command{ + Name: "witness", + Usage: "Convert a Cannon JSON state into a binary witness", + Description: "Convert a Cannon JSON state into a binary witness. The hash of the witness is written to stdout", + Action: Witness, + Flags: []cli.Flag{ + WitnessInputFlag, + WitnessOutputFlag, + }, +} diff --git a/rvgo/main.go b/rvgo/main.go new file mode 100644 index 00000000..ac2473bf --- /dev/null +++ b/rvgo/main.go @@ -0,0 +1,46 @@ +package main + +import ( + "context" + "errors" + "fmt" + "os" + "os/signal" + "syscall" + + "github.com/ethereum-optimism/asterisc/rvgo/cmd" + "github.com/urfave/cli/v2" +) + +func main() { + app := cli.NewApp() + app.Name = "asterisc" + app.Usage = "RISC-V Fault Proof tool" + app.Description = "RISC-V Fault Proof tool" + app.Commands = []*cli.Command{ + cmd.LoadELFCommand, + cmd.WitnessCommand, + } + ctx, cancel := context.WithCancel(context.Background()) + + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) + go func() { + for { + <-c + cancel() + fmt.Println("\r\nExiting...") + } + }() + + err := app.RunContext(ctx, os.Args) + if err != nil { + if errors.Is(err, ctx.Err()) { + _, _ = fmt.Fprintf(os.Stderr, "command interrupted") + os.Exit(130) + } else { + _, _ = fmt.Fprintf(os.Stderr, "error: %v", err) + os.Exit(1) + } + } +} diff --git a/rvgo/evm_test.go b/rvgo/test/evm_test.go similarity index 90% rename from rvgo/evm_test.go rename to rvgo/test/evm_test.go index 1580654d..d3d73178 100644 --- a/rvgo/evm_test.go +++ b/rvgo/test/evm_test.go @@ -1,4 +1,4 @@ -package fast +package test import ( "encoding/binary" @@ -55,7 +55,7 @@ func fakeHeader(n uint64, parentHash common.Hash) *types.Header { } func loadStepContractCode(t *testing.T) *Contract { - dat, err := os.ReadFile("../rvsol/out/Step.sol/Step.json") + dat, err := os.ReadFile("../../rvsol/out/Step.sol/Step.json") require.NoError(t, err) var outDat Contract err = json.Unmarshal(dat, &outDat) @@ -64,7 +64,7 @@ func loadStepContractCode(t *testing.T) *Contract { } func loadPreimageOracleContractCode(t *testing.T) *Contract { - dat, err := os.ReadFile("../rvsol/out/PreimageOracle.sol/PreimageOracle.json") + dat, err := os.ReadFile("../../rvsol/out/PreimageOracle.sol/PreimageOracle.json") require.NoError(t, err) var outDat Contract err = json.Unmarshal(dat, &outDat) @@ -103,13 +103,13 @@ func newEVMEnv(t *testing.T, contracts *Contracts, addrs *Addresses) *vm.EVM { statedb := state.NewDatabase(db) state, err := state.New(types.EmptyRootHash, statedb, nil) require.NoError(t, err) - blockContext := core.NewEVMBlockContext(header, bc, nil, chainCfg, state) + blockContext := core.NewEVMBlockContext(header, bc, nil) vmCfg := vm.Config{} env := vm.NewEVM(blockContext, vm.TxContext{}, state, chainCfg, vmCfg) env.StateDB.SetCode(addrs.RISCV, contracts.RISCV.DeployedBytecode.Object) env.StateDB.SetCode(addrs.Oracle, contracts.Oracle.DeployedBytecode.Object) - env.StateDB.SetState(addrs.RISCV, common.Hash{}, addrs.Oracle.Hash()) // set storage slot pointing to preimage oracle + env.StateDB.SetState(addrs.RISCV, common.Hash{}, common.BytesToHash(addrs.Oracle.Bytes())) // set storage slot pointing to preimage oracle rules := env.ChainConfig().Rules(header.Number, true, header.Time) env.StateDB.Prepare(rules, addrs.Sender, addrs.FeeRecipient, &addrs.RISCV, vm.ActivePrecompiles(rules), nil) @@ -133,9 +133,9 @@ func testContracts(t *testing.T) *Contracts { func addTracer(t *testing.T, env *vm.EVM, addrs *Addresses, contracts *Contracts) { //env.Config.Tracer = logger.NewMarkdownLogger(&logger.Config{}, os.Stdout) - a, err := contracts.RISCV.SourceMap([]string{"../rvsol/src/Step.sol"}) + a, err := contracts.RISCV.SourceMap([]string{"../../rvsol/src/Step.sol"}) require.NoError(t, err) - b, err := contracts.Oracle.SourceMap([]string{"../rvsol/src/PreimageOracle.sol"}) + b, err := contracts.Oracle.SourceMap([]string{"../../rvsol/src/PreimageOracle.sol"}) require.NoError(t, err) env.Config.Tracer = srcmap.NewSourceMapTracer(map[common.Address]*srcmap.SourceMap{ addrs.RISCV: a, diff --git a/rvgo/vm_go_test.go b/rvgo/test/vm_go_test.go similarity index 97% rename from rvgo/vm_go_test.go rename to rvgo/test/vm_go_test.go index a484b448..67133643 100644 --- a/rvgo/vm_go_test.go +++ b/rvgo/test/vm_go_test.go @@ -1,4 +1,4 @@ -package fast +package test import ( "debug/elf" @@ -142,7 +142,7 @@ func fullTest(t *testing.T, vmState *fast.VMState, po *testOracle, symbols fast. } func TestSimple(t *testing.T) { - programELF, err := elf.Open("../tests/go-tests/bin/simple") + programELF, err := elf.Open("../../tests/go-tests/bin/simple") require.NoError(t, err) defer programELF.Close() @@ -211,7 +211,7 @@ func TestSimple(t *testing.T) { } func TestMinimal(t *testing.T) { - programELF, err := elf.Open("../tests/go-tests/bin/minimal") + programELF, err := elf.Open("../../tests/go-tests/bin/minimal") require.NoError(t, err) defer programELF.Close() diff --git a/rvgo/vm_test.go b/rvgo/test/vm_test.go similarity index 99% rename from rvgo/vm_test.go rename to rvgo/test/vm_test.go index 081b84eb..841b3683 100644 --- a/rvgo/vm_test.go +++ b/rvgo/test/vm_test.go @@ -1,4 +1,4 @@ -package fast +package test import ( "debug/elf" From 5b6dccada161c0cf9415d03099e70ff70eaa8b7b Mon Sep 17 00:00:00 2001 From: Tei Im Date: Wed, 31 Jan 2024 19:04:36 +0900 Subject: [PATCH 02/12] Implement run command based on Canon --- go.mod | 69 ++++--- go.sum | 37 +++- rvgo/cmd/run.go | 410 ++++++++++++++++++++++++++++++++++++++++++ rvgo/fast/state.go | 2 + rvgo/main.go | 1 + rvgo/test/evm_test.go | 2 +- 6 files changed, 488 insertions(+), 33 deletions(-) create mode 100644 rvgo/cmd/run.go diff --git a/go.mod b/go.mod index b8962bac..59d27abc 100644 --- a/go.mod +++ b/go.mod @@ -4,72 +4,85 @@ go 1.21 toolchain go1.21.1 +// dev +replace github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 => github.com/testinprod-io/optimism v0.2.1-0.20240131095754-7dd88a772c74 + +replace github.com/ethereum/go-ethereum v1.13.5 => github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498 + require ( - github.com/ethereum-optimism/optimism v1.1.5-rc.1.0.20230922205554-a7ff5a811612 - github.com/ethereum/go-ethereum v1.12.2 + github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 + github.com/ethereum/go-ethereum v1.13.5 github.com/holiman/uint256 v1.2.3 + github.com/pkg/profile v1.7.0 github.com/stretchr/testify v1.8.4 + github.com/urfave/cli/v2 v2.27.1 ) require ( github.com/DataDog/zstd v1.5.2 // indirect - github.com/VictoriaMetrics/fastcache v1.10.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cockroachdb/errors v1.9.1 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect - github.com/cockroachdb/redact v1.1.3 // indirect + github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4 // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.10.0 // indirect - github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect + github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20230921190252-f29074de9e36 // indirect - github.com/ethereum/c-kzg-4844 v0.3.1 // indirect + github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240129235549-0a582d7654ee // indirect + github.com/ethereum/c-kzg-4844 v0.4.0 // indirect + github.com/felixge/fgprof v0.9.3 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.18.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect + github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.17.2 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect - github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/client_golang v1.18.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/rivo/uniseg v0.4.3 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/supranational/blst v0.3.11 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect - gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.1 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) - -replace github.com/ethereum/go-ethereum v1.12.2 => github.com/ethereum-optimism/op-geth v1.101200.2-rc.1.0.20230922185314-7997a6fed17c diff --git a/go.sum b/go.sum index cadde6c9..e8f5496f 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPx github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -51,17 +53,21 @@ 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.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 h1:hIVC7qCb6yC+W/THmNeJCsklUb19zjBjl04ymYtsNUs= -github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195/go.mod h1:ZzHgkhz1NBvaFACB/Vmcbb//h1/7nTdgtZfFv+0G76M= +github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498 h1://rSBcCLKS9lz9fs9q8aLKgjLp7AgQQVlAV7JHF7v1k= +github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498/go.mod h1:dQVCa+D5zi0oJJyrP3nwWciio0BJLZ2urH8OU7RJ2qs= +github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240129235549-0a582d7654ee h1:1a7ZvkuPhLJ6uAAsAAfaD7K0wYr45l9eH3TdIMpYl+M= +github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240129235549-0a582d7654ee/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0= github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk= -github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0= +github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= +github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= +github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= @@ -94,7 +100,12 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= @@ -102,7 +113,12 @@ github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iU github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= +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/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= @@ -145,6 +161,8 @@ github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTw github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= +github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= @@ -165,20 +183,29 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= +github.com/testinprod-io/optimism v0.2.1-0.20240131095754-7dd88a772c74 h1:IPihRjZCk6KTK69MMNIs3gHBbLowkWLcOx/Frs7OcPM= +github.com/testinprod-io/optimism v0.2.1-0.20240131095754-7dd88a772c74/go.mod h1:ZzHgkhz1NBvaFACB/Vmcbb//h1/7nTdgtZfFv+0G76M= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= @@ -229,6 +256,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -278,6 +306,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= diff --git a/rvgo/cmd/run.go b/rvgo/cmd/run.go new file mode 100644 index 00000000..81bcdd94 --- /dev/null +++ b/rvgo/cmd/run.go @@ -0,0 +1,410 @@ +package cmd + +import ( + "context" + "fmt" + "os" + "os/exec" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/log" + "github.com/urfave/cli/v2" + + "github.com/pkg/profile" + + "github.com/ethereum-optimism/optimism/cannon/cmd" + "github.com/ethereum-optimism/optimism/cannon/mipsevm" + preimage "github.com/ethereum-optimism/optimism/op-preimage" + + "github.com/ethereum-optimism/asterisc/rvgo/fast" +) + +var ( + RunInputFlag = &cli.PathFlag{ + Name: "input", + Usage: "path of input JSON state. Stdin if left empty.", + TakesFile: true, + Value: "state.json", + Required: true, + } + RunOutputFlag = &cli.PathFlag{ + Name: "output", + Usage: "path of output JSON state. Not written if empty, use - to write to Stdout.", + TakesFile: true, + Value: "out.json", + Required: false, + } + patternHelp = "'never' (default), 'always', '=123' at exactly step 123, '%123' for every 123 steps" + RunProofAtFlag = &cli.GenericFlag{ + Name: "proof-at", + Usage: "step pattern to output proof at: " + patternHelp, + Value: new(cmd.StepMatcherFlag), + Required: false, + } + RunProofFmtFlag = &cli.StringFlag{ + Name: "proof-fmt", + Usage: "format for proof data output file names. Proof data is written to stdout if -.", + Value: "proof-%d.json", + Required: false, + } + RunSnapshotAtFlag = &cli.GenericFlag{ + Name: "snapshot-at", + Usage: "step pattern to output snapshots at: " + patternHelp, + Value: new(cmd.StepMatcherFlag), + Required: false, + } + RunSnapshotFmtFlag = &cli.StringFlag{ + Name: "snapshot-fmt", + Usage: "format for snapshot output file names.", + Value: "state-%d.json", + Required: false, + } + RunStopAtFlag = &cli.GenericFlag{ + Name: "stop-at", + Usage: "step pattern to stop at: " + patternHelp, + Value: new(cmd.StepMatcherFlag), + Required: false, + } + RunStopAtPreimageTypeFlag = &cli.StringFlag{ + Name: "stop-at-preimage-type", + Usage: "stop at the first preimage request matching this type (must be either 'any', 'local' or 'global')", + Required: false, + } + RunStopAtPreimageKeyFlag = &cli.StringFlag{ + Name: "stop-at-preimage-key", + Usage: "stop at the first step that requests the specified preimage key", + Required: false, + } + RunMetaFlag = &cli.PathFlag{ + Name: "meta", + Usage: "path to metadata file for symbol lookup for enhanced debugging info during execution.", + Value: "meta.json", + Required: false, + } + RunInfoAtFlag = &cli.GenericFlag{ + Name: "info-at", + Usage: "step pattern to print info at: " + patternHelp, + Value: cmd.MustStepMatcherFlag("%100000"), + Required: false, + } + RunPProfCPU = &cli.BoolFlag{ + Name: "pprof.cpu", + Usage: "enable pprof cpu profiling", + } +) + +type Proof struct { + Step uint64 `json:"step"` + + Pre common.Hash `json:"pre"` + Post common.Hash `json:"post"` + + StateData hexutil.Bytes `json:"state-data"` + ProofData hexutil.Bytes `json:"proof-data"` + + OracleKey hexutil.Bytes `json:"oracle-key,omitempty"` + OracleValue hexutil.Bytes `json:"oracle-value,omitempty"` + OracleOffset uint64 `json:"oracle-offset,omitempty"` +} + +type rawHint string + +func (rh rawHint) Hint() string { + return string(rh) +} + +type rawKey [32]byte + +func (rk rawKey) PreimageKey() [32]byte { + return rk +} + +type ProcessPreimageOracle struct { + pCl *preimage.OracleClient + hCl *preimage.HintWriter + cmd *exec.Cmd + waitErr chan error + cancelIO context.CancelCauseFunc +} + +const clientPollTimeout = time.Second * 15 + +func NewProcessPreimageOracle(name string, args []string) (*ProcessPreimageOracle, error) { + if name == "" { + return &ProcessPreimageOracle{}, nil + } + + pClientRW, pOracleRW, err := preimage.CreateBidirectionalChannel() + if err != nil { + return nil, err + } + hClientRW, hOracleRW, err := preimage.CreateBidirectionalChannel() + if err != nil { + return nil, err + } + + cmd := exec.Command(name, args...) // nosemgrep + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.ExtraFiles = []*os.File{ + hOracleRW.Reader(), + hOracleRW.Writer(), + pOracleRW.Reader(), + pOracleRW.Writer(), + } + + // Note that the client file descriptors are not closed when the pre-image server exits. + // So we use the FilePoller to ensure that we don't get stuck in a blocking read/write. + ctx, cancelIO := context.WithCancelCause(context.Background()) + preimageClientIO := preimage.NewFilePoller(ctx, pClientRW, clientPollTimeout) + hostClientIO := preimage.NewFilePoller(ctx, hClientRW, clientPollTimeout) + out := &ProcessPreimageOracle{ + pCl: preimage.NewOracleClient(preimageClientIO), + hCl: preimage.NewHintWriter(hostClientIO), + cmd: cmd, + waitErr: make(chan error), + cancelIO: cancelIO, + } + return out, nil +} + +func (p *ProcessPreimageOracle) Hint(v []byte) error { + if p.hCl == nil { // no hint processor + return nil + } + p.hCl.Hint(rawHint(v)) + return nil +} + +func (p *ProcessPreimageOracle) GetPreimage(k [32]byte) ([]byte, error) { + if p.pCl == nil { + panic("no pre-image retriever available") + } + return p.pCl.Get(rawKey(k)), nil +} + +func (p *ProcessPreimageOracle) Start() error { + if p.cmd == nil { + return nil + } + err := p.cmd.Start() + go p.wait() + return err +} + +func (p *ProcessPreimageOracle) Close() error { + if p.cmd == nil { + return nil + } + // Give the pre-image server time to exit cleanly before killing it. + time.Sleep(time.Second * 1) + _ = p.cmd.Process.Signal(os.Interrupt) + return <-p.waitErr +} + +func (p *ProcessPreimageOracle) wait() { + err := p.cmd.Wait() + var waitErr error + if err, ok := err.(*exec.ExitError); !ok || !err.Success() { + waitErr = err + } + p.cancelIO(fmt.Errorf("%w: pre-image server has exited", waitErr)) + p.waitErr <- waitErr + close(p.waitErr) +} + +type StepFn func(proof bool) (*fast.StepWitness, error) + +func Guard(proc *os.ProcessState, fn StepFn) StepFn { + return func(proof bool) (*fast.StepWitness, error) { + wit, err := fn(proof) + if err != nil { + if proc.Exited() { + return nil, fmt.Errorf("pre-image server exited with code %d, resulting in err %w", proc.ExitCode(), err) + } else { + return nil, err + } + } + return wit, nil + } +} + +var _ fast.PreimageOracle = (*ProcessPreimageOracle)(nil) + +func Run(ctx *cli.Context) error { + if ctx.Bool(RunPProfCPU.Name) { + defer profile.Start(profile.NoShutdownHook, profile.ProfilePath("."), profile.CPUProfile).Stop() + } + + state, err := cmd.LoadJSON[fast.VMState](ctx.Path(RunInputFlag.Name)) + if err != nil { + return err + } + + l := cmd.Logger(os.Stderr, log.LvlInfo) + outLog := &mipsevm.LoggingWriter{Name: "program std-out", Log: l} + errLog := &mipsevm.LoggingWriter{Name: "program std-err", Log: l} + + stopAtPreimageType := ctx.String(RunStopAtPreimageTypeFlag.Name) + if stopAtPreimageType != "" && stopAtPreimageType != "any" && stopAtPreimageType != "local" && stopAtPreimageType != "global" { + return fmt.Errorf("invalid preimage type %q, must be either 'any', 'local' or 'global'", stopAtPreimageType) + } + stopAtPreimageKey := common.HexToHash(ctx.String(RunStopAtPreimageKeyFlag.Name)) + + // split CLI args after first '--' + args := ctx.Args().Slice() + for i, arg := range args { + if arg == "--" { + args = args[i+1:] + break + } + } + if len(args) == 0 { + args = []string{""} + } + + po, err := NewProcessPreimageOracle(args[0], args[1:]) + if err != nil { + return fmt.Errorf("failed to create pre-image oracle process: %w", err) + } + if err := po.Start(); err != nil { + return fmt.Errorf("failed to start pre-image oracle server: %w", err) + } + defer func() { + if err := po.Close(); err != nil { + l.Error("failed to close pre-image server", "err", err) + } + }() + + stopAt := ctx.Generic(RunStopAtFlag.Name).(*cmd.StepMatcherFlag).Matcher() + proofAt := ctx.Generic(RunProofAtFlag.Name).(*cmd.StepMatcherFlag).Matcher() + snapshotAt := ctx.Generic(RunSnapshotAtFlag.Name).(*cmd.StepMatcherFlag).Matcher() + infoAt := ctx.Generic(RunInfoAtFlag.Name).(*cmd.StepMatcherFlag).Matcher() + + us := fast.NewInstrumentedState(state, po, outLog, errLog) + proofFmt := ctx.String(RunProofFmtFlag.Name) + snapshotFmt := ctx.String(RunSnapshotFmtFlag.Name) + + stepFn := us.Step + if po.cmd != nil { + stepFn = Guard(po.cmd.ProcessState, stepFn) + } + + start := time.Now() + startStep := state.Step + + for !state.Exited { + if state.Step%100 == 0 { // don't do the ctx err check (includes lock) too often + if err := ctx.Context.Err(); err != nil { + return err + } + } + + step := state.Step + + if infoAt(state) { + delta := time.Since(start) + l.Info("processing", + "step", step, + "pc", mipsevm.HexU32(state.PC), + "insn", mipsevm.HexU32(state.Instr()), + "ips", float64(step-startStep)/(float64(delta)/float64(time.Second)), + "pages", state.Memory.PageCount(), + "mem", state.Memory.Usage(), + ) + } + + if stopAt(state) { + break + } + + if snapshotAt(state) { + if err := cmd.WriteJSON(fmt.Sprintf(snapshotFmt, step), state); err != nil { + return fmt.Errorf("failed to write state snapshot: %w", err) + } + } + + prevPreimageOffset := state.PreimageOffset + + if proofAt(state) { + preStateHash, err := state.EncodeWitness().StateHash() + if err != nil { + return fmt.Errorf("failed to hash prestate witness: %w", err) + } + witness, err := stepFn(true) + if err != nil { + return fmt.Errorf("failed at proof-gen step %d (PC: %08x): %w", step, state.PC, err) + } + postStateHash, err := state.EncodeWitness().StateHash() + if err != nil { + return fmt.Errorf("failed to hash poststate witness: %w", err) + } + proof := &Proof{ + Step: step, + Pre: preStateHash, + Post: postStateHash, + StateData: witness.State, + ProofData: witness.MemProof, + } + if witness.HasPreimage() { + proof.OracleKey = witness.PreimageKey[:] + proof.OracleValue = witness.PreimageValue + proof.OracleOffset = witness.PreimageOffset + } + if err := cmd.WriteJSON(fmt.Sprintf(proofFmt, step), proof); err != nil { + return fmt.Errorf("failed to write proof data: %w", err) + } + } else { + _, err = stepFn(false) + if err != nil { + return fmt.Errorf("failed at step %d (PC: %08x): %w", step, state.PC, err) + } + } + + if preimageRead := state.PreimageOffset > prevPreimageOffset; preimageRead { + if stopAtPreimageType == "any" { + break + } + if stopAtPreimageType != "" { + keyType := byte(preimage.LocalKeyType) + if stopAtPreimageType == "global" { + keyType = byte(preimage.Keccak256KeyType) + } + if state.PreimageKey[0] == keyType { + break + } + } + if (stopAtPreimageKey != common.Hash{}) && state.PreimageKey == stopAtPreimageKey { + break + } + } + } + + if err := cmd.WriteJSON(ctx.Path(RunOutputFlag.Name), state); err != nil { + return fmt.Errorf("failed to write state output: %w", err) + } + return nil +} + +var RunCommand = &cli.Command{ + Name: "run", + Usage: "Run VM step(s) and generate proof data to replicate onchain.", + Description: "Run VM step(s) and generate proof data to replicate onchain. See flags to match when to output a proof, a snapshot, or to stop early.", + Action: Run, + Flags: []cli.Flag{ + RunInputFlag, + RunOutputFlag, + RunProofAtFlag, + RunProofFmtFlag, + RunSnapshotAtFlag, + RunSnapshotFmtFlag, + RunStopAtFlag, + RunStopAtPreimageTypeFlag, + RunStopAtPreimageKeyFlag, + RunMetaFlag, + RunInfoAtFlag, + RunPProfCPU, + }, +} diff --git a/rvgo/fast/state.go b/rvgo/fast/state.go index 4ba9c4d4..64e36483 100644 --- a/rvgo/fast/state.go +++ b/rvgo/fast/state.go @@ -58,6 +58,8 @@ func NewVMState() *VMState { } } +func (state *VMState) GetStep() uint64 { return state.Step } + func (state *VMState) EncodeWitness() StateWitness { out := make([]byte, 0) memRoot := state.Memory.MerkleRoot() diff --git a/rvgo/main.go b/rvgo/main.go index ac2473bf..4f9e8f58 100644 --- a/rvgo/main.go +++ b/rvgo/main.go @@ -20,6 +20,7 @@ func main() { app.Commands = []*cli.Command{ cmd.LoadELFCommand, cmd.WitnessCommand, + cmd.RunCommand, } ctx, cancel := context.WithCancel(context.Background()) diff --git a/rvgo/test/evm_test.go b/rvgo/test/evm_test.go index d3d73178..61d7aa8c 100644 --- a/rvgo/test/evm_test.go +++ b/rvgo/test/evm_test.go @@ -103,7 +103,7 @@ func newEVMEnv(t *testing.T, contracts *Contracts, addrs *Addresses) *vm.EVM { statedb := state.NewDatabase(db) state, err := state.New(types.EmptyRootHash, statedb, nil) require.NoError(t, err) - blockContext := core.NewEVMBlockContext(header, bc, nil) + blockContext := core.NewEVMBlockContext(header, bc, nil, chainCfg, state) vmCfg := vm.Config{} env := vm.NewEVM(blockContext, vm.TxContext{}, state, chainCfg, vmCfg) From 5d1885a8f1b0f8fb8cc5be5753b543680b128548 Mon Sep 17 00:00:00 2001 From: Tei Im Date: Thu, 1 Feb 2024 17:00:22 +0900 Subject: [PATCH 03/12] Use cannon cmd dependencies --- go.mod | 2 +- go.sum | 4 +-- rvgo/cmd/json.go | 62 -------------------------------------------- rvgo/cmd/load_elf.go | 4 ++- rvgo/cmd/run.go | 9 +++---- rvgo/cmd/witness.go | 3 ++- 6 files changed, 12 insertions(+), 72 deletions(-) delete mode 100644 rvgo/cmd/json.go diff --git a/go.mod b/go.mod index 59d27abc..3e4cfc9c 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.21.1 // dev -replace github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 => github.com/testinprod-io/optimism v0.2.1-0.20240131095754-7dd88a772c74 +replace github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 => github.com/testinprod-io/optimism v0.2.1-0.20240201075727-ccefcbe9a895 replace github.com/ethereum/go-ethereum v1.13.5 => github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498 diff --git a/go.sum b/go.sum index e8f5496f..94602b76 100644 --- a/go.sum +++ b/go.sum @@ -198,8 +198,8 @@ github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbe github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/testinprod-io/optimism v0.2.1-0.20240131095754-7dd88a772c74 h1:IPihRjZCk6KTK69MMNIs3gHBbLowkWLcOx/Frs7OcPM= -github.com/testinprod-io/optimism v0.2.1-0.20240131095754-7dd88a772c74/go.mod h1:ZzHgkhz1NBvaFACB/Vmcbb//h1/7nTdgtZfFv+0G76M= +github.com/testinprod-io/optimism v0.2.1-0.20240201075727-ccefcbe9a895 h1:C6tciPdq48jYseCqdM+NFhCSs/6h8qRB+2ggkN5LQ+s= +github.com/testinprod-io/optimism v0.2.1-0.20240201075727-ccefcbe9a895/go.mod h1:ZzHgkhz1NBvaFACB/Vmcbb//h1/7nTdgtZfFv+0G76M= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= diff --git a/rvgo/cmd/json.go b/rvgo/cmd/json.go deleted file mode 100644 index 615baced..00000000 --- a/rvgo/cmd/json.go +++ /dev/null @@ -1,62 +0,0 @@ -package cmd - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "os" - - "github.com/ethereum-optimism/optimism/op-service/ioutil" -) - -func loadJSON[X any](inputPath string) (*X, error) { - if inputPath == "" { - return nil, errors.New("no path specified") - } - var f io.ReadCloser - f, err := ioutil.OpenDecompressed(inputPath) - if err != nil { - return nil, fmt.Errorf("failed to open file %q: %w", inputPath, err) - } - defer f.Close() - var state X - if err := json.NewDecoder(f).Decode(&state); err != nil { - return nil, fmt.Errorf("failed to decode file %q: %w", inputPath, err) - } - return &state, nil -} - -func writeJSON[X any](outputPath string, value X) error { - if outputPath == "" { - return nil - } - var out io.Writer - finish := func() error { return nil } - if outputPath != "-" { - f, err := ioutil.NewAtomicWriterCompressed(outputPath, 0755) - if err != nil { - return fmt.Errorf("failed to open output file: %w", err) - } - // Ensure we close the stream even if failures occur. - defer f.Close() - out = f - // Closing the file causes it to be renamed to the final destination - // so make sure we handle any errors it returns - finish = f.Close - } else { - out = os.Stdout - } - enc := json.NewEncoder(out) - if err := enc.Encode(value); err != nil { - return fmt.Errorf("failed to encode to JSON: %w", err) - } - _, err := out.Write([]byte{'\n'}) - if err != nil { - return fmt.Errorf("failed to append new-line: %w", err) - } - if err := finish(); err != nil { - return fmt.Errorf("failed to finish write: %w", err) - } - return nil -} diff --git a/rvgo/cmd/load_elf.go b/rvgo/cmd/load_elf.go index 48df024e..7e3a956a 100644 --- a/rvgo/cmd/load_elf.go +++ b/rvgo/cmd/load_elf.go @@ -3,6 +3,8 @@ package cmd import ( "debug/elf" "fmt" + + "github.com/ethereum-optimism/optimism/cannon/cmd" "github.com/urfave/cli/v2" "github.com/ethereum-optimism/asterisc/rvgo/fast" @@ -36,7 +38,7 @@ func LoadELF(ctx *cli.Context) error { if err != nil { return fmt.Errorf("failed to load ELF data into VM state: %w", err) } - return writeJSON[*fast.VMState](ctx.Path(LoadELFOutFlag.Name), state) + return cmd.WriteJSON[*fast.VMState](ctx.Path(LoadELFOutFlag.Name), state) } var LoadELFCommand = &cli.Command{ diff --git a/rvgo/cmd/run.go b/rvgo/cmd/run.go index 81bcdd94..df9941c0 100644 --- a/rvgo/cmd/run.go +++ b/rvgo/cmd/run.go @@ -15,7 +15,6 @@ import ( "github.com/pkg/profile" "github.com/ethereum-optimism/optimism/cannon/cmd" - "github.com/ethereum-optimism/optimism/cannon/mipsevm" preimage "github.com/ethereum-optimism/optimism/op-preimage" "github.com/ethereum-optimism/asterisc/rvgo/fast" @@ -244,8 +243,8 @@ func Run(ctx *cli.Context) error { } l := cmd.Logger(os.Stderr, log.LvlInfo) - outLog := &mipsevm.LoggingWriter{Name: "program std-out", Log: l} - errLog := &mipsevm.LoggingWriter{Name: "program std-err", Log: l} + outLog := &cmd.LoggingWriter{Name: "program std-out", Log: l} + errLog := &cmd.LoggingWriter{Name: "program std-err", Log: l} stopAtPreimageType := ctx.String(RunStopAtPreimageTypeFlag.Name) if stopAtPreimageType != "" && stopAtPreimageType != "any" && stopAtPreimageType != "local" && stopAtPreimageType != "global" { @@ -308,8 +307,8 @@ func Run(ctx *cli.Context) error { delta := time.Since(start) l.Info("processing", "step", step, - "pc", mipsevm.HexU32(state.PC), - "insn", mipsevm.HexU32(state.Instr()), + "pc", cmd.HexU32(state.PC), + "insn", cmd.HexU32(state.Instr()), "ips", float64(step-startStep)/(float64(delta)/float64(time.Second)), "pages", state.Memory.PageCount(), "mem", state.Memory.Usage(), diff --git a/rvgo/cmd/witness.go b/rvgo/cmd/witness.go index 29ad0133..341eac35 100644 --- a/rvgo/cmd/witness.go +++ b/rvgo/cmd/witness.go @@ -4,6 +4,7 @@ import ( "fmt" "os" + "github.com/ethereum-optimism/optimism/cannon/cmd" "github.com/urfave/cli/v2" "github.com/ethereum-optimism/asterisc/rvgo/fast" @@ -26,7 +27,7 @@ var ( func Witness(ctx *cli.Context) error { input := ctx.Path(WitnessInputFlag.Name) output := ctx.Path(WitnessOutputFlag.Name) - state, err := loadJSON[fast.VMState](input) + state, err := cmd.LoadJSON[fast.VMState](input) if err != nil { return fmt.Errorf("invalid input state (%v): %w", input, err) } From 4b4ec67bd08df6a31dd26221123be3ab22a4decb Mon Sep 17 00:00:00 2001 From: Tei Im Date: Mon, 5 Feb 2024 16:38:46 +0900 Subject: [PATCH 04/12] Import ProcessPreimageOracle from Cannon --- go.mod | 4 +- go.sum | 8 +-- rvgo/cmd/run.go | 117 ++------------------------------------ rvgo/fast/instrumented.go | 9 +-- 4 files changed, 14 insertions(+), 124 deletions(-) diff --git a/go.mod b/go.mod index 3e4cfc9c..dce94bd9 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.21.1 // dev -replace github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 => github.com/testinprod-io/optimism v0.2.1-0.20240201075727-ccefcbe9a895 +replace github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 => github.com/testinprod-io/optimism v0.2.1-0.20240205073531-4904d6a711dc replace github.com/ethereum/go-ethereum v1.13.5 => github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498 @@ -38,7 +38,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240129235549-0a582d7654ee // indirect + github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240131175747-1300b1825140 // indirect github.com/ethereum/c-kzg-4844 v0.4.0 // indirect github.com/felixge/fgprof v0.9.3 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect diff --git a/go.sum b/go.sum index 94602b76..d06090df 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etly github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498 h1://rSBcCLKS9lz9fs9q8aLKgjLp7AgQQVlAV7JHF7v1k= github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498/go.mod h1:dQVCa+D5zi0oJJyrP3nwWciio0BJLZ2urH8OU7RJ2qs= -github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240129235549-0a582d7654ee h1:1a7ZvkuPhLJ6uAAsAAfaD7K0wYr45l9eH3TdIMpYl+M= -github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240129235549-0a582d7654ee/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0= +github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240131175747-1300b1825140 h1:F2Q+Gj4+W67CKZpVR+MEDL+EiIpgbx6VtwtdsPR4mbQ= +github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240131175747-1300b1825140/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0= github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= @@ -198,8 +198,8 @@ github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbe github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/testinprod-io/optimism v0.2.1-0.20240201075727-ccefcbe9a895 h1:C6tciPdq48jYseCqdM+NFhCSs/6h8qRB+2ggkN5LQ+s= -github.com/testinprod-io/optimism v0.2.1-0.20240201075727-ccefcbe9a895/go.mod h1:ZzHgkhz1NBvaFACB/Vmcbb//h1/7nTdgtZfFv+0G76M= +github.com/testinprod-io/optimism v0.2.1-0.20240205073531-4904d6a711dc h1:XSeA1e7AozzChNWEImuHmYY0UgAGFmsOU9wFUhbfAjA= +github.com/testinprod-io/optimism v0.2.1-0.20240205073531-4904d6a711dc/go.mod h1:oYNJlRzj4BcANKRyYDfvEWdM3b+X/9nOfx6/KlWP0yg= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= diff --git a/rvgo/cmd/run.go b/rvgo/cmd/run.go index df9941c0..f8914f97 100644 --- a/rvgo/cmd/run.go +++ b/rvgo/cmd/run.go @@ -1,10 +1,8 @@ package cmd import ( - "context" "fmt" "os" - "os/exec" "time" "github.com/ethereum/go-ethereum/common" @@ -108,112 +106,6 @@ type Proof struct { OracleOffset uint64 `json:"oracle-offset,omitempty"` } -type rawHint string - -func (rh rawHint) Hint() string { - return string(rh) -} - -type rawKey [32]byte - -func (rk rawKey) PreimageKey() [32]byte { - return rk -} - -type ProcessPreimageOracle struct { - pCl *preimage.OracleClient - hCl *preimage.HintWriter - cmd *exec.Cmd - waitErr chan error - cancelIO context.CancelCauseFunc -} - -const clientPollTimeout = time.Second * 15 - -func NewProcessPreimageOracle(name string, args []string) (*ProcessPreimageOracle, error) { - if name == "" { - return &ProcessPreimageOracle{}, nil - } - - pClientRW, pOracleRW, err := preimage.CreateBidirectionalChannel() - if err != nil { - return nil, err - } - hClientRW, hOracleRW, err := preimage.CreateBidirectionalChannel() - if err != nil { - return nil, err - } - - cmd := exec.Command(name, args...) // nosemgrep - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - cmd.ExtraFiles = []*os.File{ - hOracleRW.Reader(), - hOracleRW.Writer(), - pOracleRW.Reader(), - pOracleRW.Writer(), - } - - // Note that the client file descriptors are not closed when the pre-image server exits. - // So we use the FilePoller to ensure that we don't get stuck in a blocking read/write. - ctx, cancelIO := context.WithCancelCause(context.Background()) - preimageClientIO := preimage.NewFilePoller(ctx, pClientRW, clientPollTimeout) - hostClientIO := preimage.NewFilePoller(ctx, hClientRW, clientPollTimeout) - out := &ProcessPreimageOracle{ - pCl: preimage.NewOracleClient(preimageClientIO), - hCl: preimage.NewHintWriter(hostClientIO), - cmd: cmd, - waitErr: make(chan error), - cancelIO: cancelIO, - } - return out, nil -} - -func (p *ProcessPreimageOracle) Hint(v []byte) error { - if p.hCl == nil { // no hint processor - return nil - } - p.hCl.Hint(rawHint(v)) - return nil -} - -func (p *ProcessPreimageOracle) GetPreimage(k [32]byte) ([]byte, error) { - if p.pCl == nil { - panic("no pre-image retriever available") - } - return p.pCl.Get(rawKey(k)), nil -} - -func (p *ProcessPreimageOracle) Start() error { - if p.cmd == nil { - return nil - } - err := p.cmd.Start() - go p.wait() - return err -} - -func (p *ProcessPreimageOracle) Close() error { - if p.cmd == nil { - return nil - } - // Give the pre-image server time to exit cleanly before killing it. - time.Sleep(time.Second * 1) - _ = p.cmd.Process.Signal(os.Interrupt) - return <-p.waitErr -} - -func (p *ProcessPreimageOracle) wait() { - err := p.cmd.Wait() - var waitErr error - if err, ok := err.(*exec.ExitError); !ok || !err.Success() { - waitErr = err - } - p.cancelIO(fmt.Errorf("%w: pre-image server has exited", waitErr)) - p.waitErr <- waitErr - close(p.waitErr) -} - type StepFn func(proof bool) (*fast.StepWitness, error) func Guard(proc *os.ProcessState, fn StepFn) StepFn { @@ -230,7 +122,7 @@ func Guard(proc *os.ProcessState, fn StepFn) StepFn { } } -var _ fast.PreimageOracle = (*ProcessPreimageOracle)(nil) +var _ fast.PreimageOracle = (*cmd.ProcessPreimageOracle)(nil) func Run(ctx *cli.Context) error { if ctx.Bool(RunPProfCPU.Name) { @@ -264,7 +156,7 @@ func Run(ctx *cli.Context) error { args = []string{""} } - po, err := NewProcessPreimageOracle(args[0], args[1:]) + po, err := cmd.NewProcessPreimageOracle(args[0], args[1:]) if err != nil { return fmt.Errorf("failed to create pre-image oracle process: %w", err) } @@ -287,8 +179,9 @@ func Run(ctx *cli.Context) error { snapshotFmt := ctx.String(RunSnapshotFmtFlag.Name) stepFn := us.Step - if po.cmd != nil { - stepFn = Guard(po.cmd.ProcessState, stepFn) + poCmd := po.GetCmd() + if poCmd != nil { + stepFn = Guard(poCmd.ProcessState, stepFn) } start := time.Now() diff --git a/rvgo/fast/instrumented.go b/rvgo/fast/instrumented.go index 54da581a..b2ed534e 100644 --- a/rvgo/fast/instrumented.go +++ b/rvgo/fast/instrumented.go @@ -7,8 +7,8 @@ import ( ) type PreimageOracle interface { - Hint(v []byte) error - GetPreimage(k [32]byte) ([]byte, error) + Hint(v []byte) + GetPreimage(k [32]byte) []byte } const memProofSize = (64 - 5 + 1) * 32 @@ -77,10 +77,7 @@ func (m *InstrumentedState) readPreimage(key [32]byte, offset uint64) (dat [32]b preimage := m.lastPreimage if key != m.lastPreimageKey { m.lastPreimageKey = key - data, err := m.preimageOracle.GetPreimage(key) - if err != nil { - return [32]byte{}, 0, fmt.Errorf("failed to read preimage %x at offset %d: %w", key, offset, err) - } + data := m.preimageOracle.GetPreimage(key) // add the length prefix preimage = make([]byte, 0, 8+len(data)) preimage = binary.BigEndian.AppendUint64(preimage, uint64(len(data))) From 056e716671b0bbf0d5de5bc123753d41c751a2ed Mon Sep 17 00:00:00 2001 From: Tei Im Date: Mon, 5 Feb 2024 16:47:05 +0900 Subject: [PATCH 05/12] Import flags from Cannon --- rvgo/cmd/load_elf.go | 29 ++------ rvgo/cmd/run.go | 142 +++++++++----------------------------- rvgo/cmd/witness.go | 30 +++----- rvgo/fast/instrumented.go | 4 ++ 4 files changed, 53 insertions(+), 152 deletions(-) diff --git a/rvgo/cmd/load_elf.go b/rvgo/cmd/load_elf.go index 7e3a956a..22d98e69 100644 --- a/rvgo/cmd/load_elf.go +++ b/rvgo/cmd/load_elf.go @@ -4,29 +4,14 @@ import ( "debug/elf" "fmt" - "github.com/ethereum-optimism/optimism/cannon/cmd" + cannon "github.com/ethereum-optimism/optimism/cannon/cmd" "github.com/urfave/cli/v2" "github.com/ethereum-optimism/asterisc/rvgo/fast" ) -var ( - LoadELFPathFlag = &cli.PathFlag{ - Name: "path", - Usage: "Path to RISC-V ELF file", - TakesFile: true, - Required: true, - } - LoadELFOutFlag = &cli.PathFlag{ - Name: "out", - Usage: "Output path to write JSON state to. State is dumped to stdout if set to -. Not written if empty.", - Value: "state.json", - Required: false, - } -) - func LoadELF(ctx *cli.Context) error { - elfPath := ctx.Path(LoadELFPathFlag.Name) + elfPath := ctx.Path(cannon.LoadELFPathFlag.Name) elfProgram, err := elf.Open(elfPath) if err != nil { return fmt.Errorf("failed to open ELF file %q: %w", elfPath, err) @@ -38,16 +23,16 @@ func LoadELF(ctx *cli.Context) error { if err != nil { return fmt.Errorf("failed to load ELF data into VM state: %w", err) } - return cmd.WriteJSON[*fast.VMState](ctx.Path(LoadELFOutFlag.Name), state) + return cannon.WriteJSON[*fast.VMState](ctx.Path(cannon.LoadELFOutFlag.Name), state) } var LoadELFCommand = &cli.Command{ Name: "load-elf", - Usage: "Load ELF file into Cannon JSON state", - Description: "Load ELF file into Cannon JSON state, optionally patch out functions", + Usage: "Load ELF file into Asterisc JSON state", + Description: "Load ELF file into Asterisc JSON state, optionally patch out functions", Action: LoadELF, Flags: []cli.Flag{ - LoadELFPathFlag, - LoadELFOutFlag, + cannon.LoadELFPathFlag, + cannon.LoadELFOutFlag, }, } diff --git a/rvgo/cmd/run.go b/rvgo/cmd/run.go index f8914f97..d37ee393 100644 --- a/rvgo/cmd/run.go +++ b/rvgo/cmd/run.go @@ -12,86 +12,12 @@ import ( "github.com/pkg/profile" - "github.com/ethereum-optimism/optimism/cannon/cmd" + cannon "github.com/ethereum-optimism/optimism/cannon/cmd" preimage "github.com/ethereum-optimism/optimism/op-preimage" "github.com/ethereum-optimism/asterisc/rvgo/fast" ) -var ( - RunInputFlag = &cli.PathFlag{ - Name: "input", - Usage: "path of input JSON state. Stdin if left empty.", - TakesFile: true, - Value: "state.json", - Required: true, - } - RunOutputFlag = &cli.PathFlag{ - Name: "output", - Usage: "path of output JSON state. Not written if empty, use - to write to Stdout.", - TakesFile: true, - Value: "out.json", - Required: false, - } - patternHelp = "'never' (default), 'always', '=123' at exactly step 123, '%123' for every 123 steps" - RunProofAtFlag = &cli.GenericFlag{ - Name: "proof-at", - Usage: "step pattern to output proof at: " + patternHelp, - Value: new(cmd.StepMatcherFlag), - Required: false, - } - RunProofFmtFlag = &cli.StringFlag{ - Name: "proof-fmt", - Usage: "format for proof data output file names. Proof data is written to stdout if -.", - Value: "proof-%d.json", - Required: false, - } - RunSnapshotAtFlag = &cli.GenericFlag{ - Name: "snapshot-at", - Usage: "step pattern to output snapshots at: " + patternHelp, - Value: new(cmd.StepMatcherFlag), - Required: false, - } - RunSnapshotFmtFlag = &cli.StringFlag{ - Name: "snapshot-fmt", - Usage: "format for snapshot output file names.", - Value: "state-%d.json", - Required: false, - } - RunStopAtFlag = &cli.GenericFlag{ - Name: "stop-at", - Usage: "step pattern to stop at: " + patternHelp, - Value: new(cmd.StepMatcherFlag), - Required: false, - } - RunStopAtPreimageTypeFlag = &cli.StringFlag{ - Name: "stop-at-preimage-type", - Usage: "stop at the first preimage request matching this type (must be either 'any', 'local' or 'global')", - Required: false, - } - RunStopAtPreimageKeyFlag = &cli.StringFlag{ - Name: "stop-at-preimage-key", - Usage: "stop at the first step that requests the specified preimage key", - Required: false, - } - RunMetaFlag = &cli.PathFlag{ - Name: "meta", - Usage: "path to metadata file for symbol lookup for enhanced debugging info during execution.", - Value: "meta.json", - Required: false, - } - RunInfoAtFlag = &cli.GenericFlag{ - Name: "info-at", - Usage: "step pattern to print info at: " + patternHelp, - Value: cmd.MustStepMatcherFlag("%100000"), - Required: false, - } - RunPProfCPU = &cli.BoolFlag{ - Name: "pprof.cpu", - Usage: "enable pprof cpu profiling", - } -) - type Proof struct { Step uint64 `json:"step"` @@ -122,27 +48,27 @@ func Guard(proc *os.ProcessState, fn StepFn) StepFn { } } -var _ fast.PreimageOracle = (*cmd.ProcessPreimageOracle)(nil) +var _ fast.PreimageOracle = (*cannon.ProcessPreimageOracle)(nil) func Run(ctx *cli.Context) error { - if ctx.Bool(RunPProfCPU.Name) { + if ctx.Bool(cannon.RunPProfCPU.Name) { defer profile.Start(profile.NoShutdownHook, profile.ProfilePath("."), profile.CPUProfile).Stop() } - state, err := cmd.LoadJSON[fast.VMState](ctx.Path(RunInputFlag.Name)) + state, err := cannon.LoadJSON[fast.VMState](ctx.Path(cannon.RunInputFlag.Name)) if err != nil { return err } - l := cmd.Logger(os.Stderr, log.LvlInfo) - outLog := &cmd.LoggingWriter{Name: "program std-out", Log: l} - errLog := &cmd.LoggingWriter{Name: "program std-err", Log: l} + l := cannon.Logger(os.Stderr, log.LvlInfo) + outLog := &cannon.LoggingWriter{Name: "program std-out", Log: l} + errLog := &cannon.LoggingWriter{Name: "program std-err", Log: l} - stopAtPreimageType := ctx.String(RunStopAtPreimageTypeFlag.Name) + stopAtPreimageType := ctx.String(cannon.RunStopAtPreimageTypeFlag.Name) if stopAtPreimageType != "" && stopAtPreimageType != "any" && stopAtPreimageType != "local" && stopAtPreimageType != "global" { return fmt.Errorf("invalid preimage type %q, must be either 'any', 'local' or 'global'", stopAtPreimageType) } - stopAtPreimageKey := common.HexToHash(ctx.String(RunStopAtPreimageKeyFlag.Name)) + stopAtPreimageLargerThan := ctx.Int(cannon.RunStopAtPreimageLargerThanFlag.Name) // split CLI args after first '--' args := ctx.Args().Slice() @@ -156,7 +82,7 @@ func Run(ctx *cli.Context) error { args = []string{""} } - po, err := cmd.NewProcessPreimageOracle(args[0], args[1:]) + po, err := cannon.NewProcessPreimageOracle(args[0], args[1:]) if err != nil { return fmt.Errorf("failed to create pre-image oracle process: %w", err) } @@ -169,14 +95,14 @@ func Run(ctx *cli.Context) error { } }() - stopAt := ctx.Generic(RunStopAtFlag.Name).(*cmd.StepMatcherFlag).Matcher() - proofAt := ctx.Generic(RunProofAtFlag.Name).(*cmd.StepMatcherFlag).Matcher() - snapshotAt := ctx.Generic(RunSnapshotAtFlag.Name).(*cmd.StepMatcherFlag).Matcher() - infoAt := ctx.Generic(RunInfoAtFlag.Name).(*cmd.StepMatcherFlag).Matcher() + stopAt := ctx.Generic(cannon.RunStopAtFlag.Name).(*cannon.StepMatcherFlag).Matcher() + proofAt := ctx.Generic(cannon.RunProofAtFlag.Name).(*cannon.StepMatcherFlag).Matcher() + snapshotAt := ctx.Generic(cannon.RunSnapshotAtFlag.Name).(*cannon.StepMatcherFlag).Matcher() + infoAt := ctx.Generic(cannon.RunInfoAtFlag.Name).(*cannon.StepMatcherFlag).Matcher() us := fast.NewInstrumentedState(state, po, outLog, errLog) - proofFmt := ctx.String(RunProofFmtFlag.Name) - snapshotFmt := ctx.String(RunSnapshotFmtFlag.Name) + proofFmt := ctx.String(cannon.RunProofFmtFlag.Name) + snapshotFmt := ctx.String(cannon.RunSnapshotFmtFlag.Name) stepFn := us.Step poCmd := po.GetCmd() @@ -200,8 +126,8 @@ func Run(ctx *cli.Context) error { delta := time.Since(start) l.Info("processing", "step", step, - "pc", cmd.HexU32(state.PC), - "insn", cmd.HexU32(state.Instr()), + "pc", cannon.HexU32(state.PC), + "insn", cannon.HexU32(state.Instr()), "ips", float64(step-startStep)/(float64(delta)/float64(time.Second)), "pages", state.Memory.PageCount(), "mem", state.Memory.Usage(), @@ -213,7 +139,7 @@ func Run(ctx *cli.Context) error { } if snapshotAt(state) { - if err := cmd.WriteJSON(fmt.Sprintf(snapshotFmt, step), state); err != nil { + if err := cannon.WriteJSON(fmt.Sprintf(snapshotFmt, step), state); err != nil { return fmt.Errorf("failed to write state snapshot: %w", err) } } @@ -245,7 +171,7 @@ func Run(ctx *cli.Context) error { proof.OracleValue = witness.PreimageValue proof.OracleOffset = witness.PreimageOffset } - if err := cmd.WriteJSON(fmt.Sprintf(proofFmt, step), proof); err != nil { + if err := cannon.WriteJSON(fmt.Sprintf(proofFmt, step), proof); err != nil { return fmt.Errorf("failed to write proof data: %w", err) } } else { @@ -268,13 +194,13 @@ func Run(ctx *cli.Context) error { break } } - if (stopAtPreimageKey != common.Hash{}) && state.PreimageKey == stopAtPreimageKey { + if stopAtPreimageLargerThan != 0 && len(us.LastPreimage()) > stopAtPreimageLargerThan { break } } } - if err := cmd.WriteJSON(ctx.Path(RunOutputFlag.Name), state); err != nil { + if err := cannon.WriteJSON(ctx.Path(cannon.RunOutputFlag.Name), state); err != nil { return fmt.Errorf("failed to write state output: %w", err) } return nil @@ -286,17 +212,17 @@ var RunCommand = &cli.Command{ Description: "Run VM step(s) and generate proof data to replicate onchain. See flags to match when to output a proof, a snapshot, or to stop early.", Action: Run, Flags: []cli.Flag{ - RunInputFlag, - RunOutputFlag, - RunProofAtFlag, - RunProofFmtFlag, - RunSnapshotAtFlag, - RunSnapshotFmtFlag, - RunStopAtFlag, - RunStopAtPreimageTypeFlag, - RunStopAtPreimageKeyFlag, - RunMetaFlag, - RunInfoAtFlag, - RunPProfCPU, + cannon.RunInputFlag, + cannon.RunOutputFlag, + cannon.RunProofAtFlag, + cannon.RunProofFmtFlag, + cannon.RunSnapshotAtFlag, + cannon.RunSnapshotFmtFlag, + cannon.RunStopAtFlag, + cannon.RunStopAtPreimageTypeFlag, + cannon.RunStopAtPreimageLargerThanFlag, + cannon.RunMetaFlag, + cannon.RunInfoAtFlag, + cannon.RunPProfCPU, }, } diff --git a/rvgo/cmd/witness.go b/rvgo/cmd/witness.go index 341eac35..17c0264c 100644 --- a/rvgo/cmd/witness.go +++ b/rvgo/cmd/witness.go @@ -4,30 +4,16 @@ import ( "fmt" "os" - "github.com/ethereum-optimism/optimism/cannon/cmd" + cannon "github.com/ethereum-optimism/optimism/cannon/cmd" "github.com/urfave/cli/v2" "github.com/ethereum-optimism/asterisc/rvgo/fast" ) -var ( - WitnessInputFlag = &cli.PathFlag{ - Name: "input", - Usage: "path of input JSON state.", - TakesFile: true, - Required: true, - } - WitnessOutputFlag = &cli.PathFlag{ - Name: "output", - Usage: "path to write binary witness.", - TakesFile: true, - } -) - func Witness(ctx *cli.Context) error { - input := ctx.Path(WitnessInputFlag.Name) - output := ctx.Path(WitnessOutputFlag.Name) - state, err := cmd.LoadJSON[fast.VMState](input) + input := ctx.Path(cannon.WitnessInputFlag.Name) + output := ctx.Path(cannon.WitnessOutputFlag.Name) + state, err := cannon.LoadJSON[fast.VMState](input) if err != nil { return fmt.Errorf("invalid input state (%v): %w", input, err) } @@ -47,11 +33,11 @@ func Witness(ctx *cli.Context) error { var WitnessCommand = &cli.Command{ Name: "witness", - Usage: "Convert a Cannon JSON state into a binary witness", - Description: "Convert a Cannon JSON state into a binary witness. The hash of the witness is written to stdout", + Usage: "Convert a Asterisc JSON state into a binary witness", + Description: "Convert a Asterisc JSON state into a binary witness. The hash of the witness is written to stdout", Action: Witness, Flags: []cli.Flag{ - WitnessInputFlag, - WitnessOutputFlag, + cannon.WitnessInputFlag, + cannon.WitnessOutputFlag, }, } diff --git a/rvgo/fast/instrumented.go b/rvgo/fast/instrumented.go index b2ed534e..6ac8b11a 100644 --- a/rvgo/fast/instrumented.go +++ b/rvgo/fast/instrumented.go @@ -117,3 +117,7 @@ func (m *InstrumentedState) verifyMemChange(effAddr uint64, proofIndex uint8) { panic(fmt.Errorf("mem access at %016x with mismatching prior proof verification for address %016x", effAddr, m.memAccess[proofIndex])) } } + +func (m *InstrumentedState) LastPreimage() []byte { + return m.lastPreimage +} From 62bd4f786cd46180c51864be12dc65c4e4fb83c7 Mon Sep 17 00:00:00 2001 From: Tei Im Date: Mon, 5 Feb 2024 16:53:05 +0900 Subject: [PATCH 06/12] Apply new oracle interfaces to test --- rvgo/test/vm_go_test.go | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/rvgo/test/vm_go_test.go b/rvgo/test/vm_go_test.go index 67133643..ee3fe374 100644 --- a/rvgo/test/vm_go_test.go +++ b/rvgo/test/vm_go_test.go @@ -21,23 +21,20 @@ import ( ) type testOracle struct { - hint func(v []byte) error - getPreimage func(k [32]byte) ([]byte, error) + hint func(v []byte) + getPreimage func(k [32]byte) []byte } -func (t *testOracle) Hint(v []byte) error { - return t.hint(v) +func (t *testOracle) Hint(v []byte) { + t.hint(v) } -func (t *testOracle) GetPreimage(k [32]byte) ([]byte, error) { +func (t *testOracle) GetPreimage(k [32]byte) []byte { return t.getPreimage(k) } func (t *testOracle) ReadPreimagePart(key [32]byte, offset uint64) (dat [32]byte, datlen uint8, err error) { - v, err := t.getPreimage(key) - if err != nil { - return [32]byte{}, 0, fmt.Errorf("failed to get pre-image of %x: %w", key, err) - } + v := t.getPreimage(key) if offset == uint64(len(v))+8 { return [32]byte{}, 0, nil // datlen==0 signals EOF } @@ -165,16 +162,16 @@ func TestSimple(t *testing.T) { addPreimage([]byte("world")) // input pre-image po := &testOracle{ - hint: func(v []byte) error { + hint: func(v []byte) { t.Logf("received hint: %x", v) - return nil }, - getPreimage: func(k [32]byte) ([]byte, error) { + getPreimage: func(k [32]byte) []byte { t.Logf("reading pre-image: %x", k) if v, ok := preImages[k]; ok { - return v, nil + return v } else { - return nil, fmt.Errorf("unknown pre-image %x", k) + t.Fatalf("unknown pre-image %x", k) + return nil } }, } @@ -219,13 +216,12 @@ func TestMinimal(t *testing.T) { require.NoError(t, err) po := &testOracle{ - hint: func(v []byte) error { + hint: func(v []byte) { t.Fatalf("unexpected pre-image hint %x", v) - return nil }, - getPreimage: func(k [32]byte) ([]byte, error) { + getPreimage: func(k [32]byte) []byte { t.Fatalf("unexpected pre-image request %x", k) - return nil, nil + return nil }, } From 1d6fe372e2d5cc5baf34bce0ab3568f1337ba05a Mon Sep 17 00:00:00 2001 From: Tei Im Date: Mon, 5 Feb 2024 19:13:24 +0900 Subject: [PATCH 07/12] Fix witness command desc --- rvgo/cmd/witness.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rvgo/cmd/witness.go b/rvgo/cmd/witness.go index 17c0264c..c66c9c21 100644 --- a/rvgo/cmd/witness.go +++ b/rvgo/cmd/witness.go @@ -33,8 +33,8 @@ func Witness(ctx *cli.Context) error { var WitnessCommand = &cli.Command{ Name: "witness", - Usage: "Convert a Asterisc JSON state into a binary witness", - Description: "Convert a Asterisc JSON state into a binary witness. The hash of the witness is written to stdout", + Usage: "Convert an Asterisc JSON state into a binary witness", + Description: "Convert an Asterisc JSON state into a binary witness. The hash of the witness is written to stdout", Action: Witness, Flags: []cli.Flag{ cannon.WitnessInputFlag, From d1c14c9a22e2fdccee9223a203409b2271691c57 Mon Sep 17 00:00:00 2001 From: Tei Im Date: Mon, 5 Feb 2024 19:40:38 +0900 Subject: [PATCH 08/12] Patch VM --- rvgo/cmd/load_elf.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rvgo/cmd/load_elf.go b/rvgo/cmd/load_elf.go index 22d98e69..d51b9e84 100644 --- a/rvgo/cmd/load_elf.go +++ b/rvgo/cmd/load_elf.go @@ -23,6 +23,10 @@ func LoadELF(ctx *cli.Context) error { if err != nil { return fmt.Errorf("failed to load ELF data into VM state: %w", err) } + err = fast.PatchVM(elfProgram, state) + if err != nil { + return fmt.Errorf("failed to patch VM") + } return cannon.WriteJSON[*fast.VMState](ctx.Path(cannon.LoadELFOutFlag.Name), state) } From 7a015d46c2a36495c0dffc4521d529989390276d Mon Sep 17 00:00:00 2001 From: Tei Im Date: Wed, 7 Feb 2024 14:27:48 +0900 Subject: [PATCH 09/12] Remove cannon dependencies --- go.mod | 2 +- go.sum | 4 +- rvgo/cmd/load_elf.go | 4 +- rvgo/cmd/log.go | 56 +++++++++++++ rvgo/cmd/process_preimage_oracle.go | 120 ++++++++++++++++++++++++++++ rvgo/cmd/run.go | 25 +++--- rvgo/cmd/witness.go | 3 +- 7 files changed, 197 insertions(+), 17 deletions(-) create mode 100644 rvgo/cmd/log.go create mode 100644 rvgo/cmd/process_preimage_oracle.go diff --git a/go.mod b/go.mod index dce94bd9..65a3df82 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.21.1 // dev -replace github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 => github.com/testinprod-io/optimism v0.2.1-0.20240205073531-4904d6a711dc +replace github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 => github.com/testinprod-io/optimism v0.2.1-0.20240207052458-cb3cb29a1a0b replace github.com/ethereum/go-ethereum v1.13.5 => github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498 diff --git a/go.sum b/go.sum index d06090df..e15ad336 100644 --- a/go.sum +++ b/go.sum @@ -198,8 +198,8 @@ github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbe github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/testinprod-io/optimism v0.2.1-0.20240205073531-4904d6a711dc h1:XSeA1e7AozzChNWEImuHmYY0UgAGFmsOU9wFUhbfAjA= -github.com/testinprod-io/optimism v0.2.1-0.20240205073531-4904d6a711dc/go.mod h1:oYNJlRzj4BcANKRyYDfvEWdM3b+X/9nOfx6/KlWP0yg= +github.com/testinprod-io/optimism v0.2.1-0.20240207052458-cb3cb29a1a0b h1:n0gf6QU3PBSNqfHR+ZqAm5FqHPDouIvdCJQdG6Djdto= +github.com/testinprod-io/optimism v0.2.1-0.20240207052458-cb3cb29a1a0b/go.mod h1:oYNJlRzj4BcANKRyYDfvEWdM3b+X/9nOfx6/KlWP0yg= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= diff --git a/rvgo/cmd/load_elf.go b/rvgo/cmd/load_elf.go index d51b9e84..2e97c9bc 100644 --- a/rvgo/cmd/load_elf.go +++ b/rvgo/cmd/load_elf.go @@ -3,8 +3,8 @@ package cmd import ( "debug/elf" "fmt" - cannon "github.com/ethereum-optimism/optimism/cannon/cmd" + "github.com/ethereum-optimism/optimism/op-service/jsonutil" "github.com/urfave/cli/v2" "github.com/ethereum-optimism/asterisc/rvgo/fast" @@ -27,7 +27,7 @@ func LoadELF(ctx *cli.Context) error { if err != nil { return fmt.Errorf("failed to patch VM") } - return cannon.WriteJSON[*fast.VMState](ctx.Path(cannon.LoadELFOutFlag.Name), state) + return jsonutil.WriteJSON[*fast.VMState](ctx.Path(cannon.LoadELFOutFlag.Name), state, OutFilePerm) } var LoadELFCommand = &cli.Command{ diff --git a/rvgo/cmd/log.go b/rvgo/cmd/log.go new file mode 100644 index 00000000..2a81599b --- /dev/null +++ b/rvgo/cmd/log.go @@ -0,0 +1,56 @@ +package cmd + +import ( + "fmt" + "io" + + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/log" +) + +func Logger(w io.Writer, lvl log.Lvl) log.Logger { + h := log.StreamHandler(w, log.LogfmtFormat()) + h = log.SyncHandler(h) + h = log.LvlFilterHandler(lvl, h) + l := log.New() + l.SetHandler(h) + return l +} + +// LoggingWriter is a simple util to wrap a logger, +// and expose an io Writer interface, +// for the program running within the VM to write to. +type LoggingWriter struct { + Name string + Log log.Logger +} + +func logAsText(b string) bool { + for _, c := range b { + if (c < 0x20 || c >= 0x7F) && (c != '\n' && c != '\t') { + return false + } + } + return true +} + +func (lw *LoggingWriter) Write(b []byte) (int, error) { + t := string(b) + if logAsText(t) { + lw.Log.Info("", "text", t) + } else { + lw.Log.Info("", "data", hexutil.Bytes(b)) + } + return len(b), nil +} + +// HexU32 to lazy-format integer attributes for logging +type HexU32 uint32 + +func (v HexU32) String() string { + return fmt.Sprintf("%08x", uint32(v)) +} + +func (v HexU32) MarshalText() ([]byte, error) { + return []byte(v.String()), nil +} diff --git a/rvgo/cmd/process_preimage_oracle.go b/rvgo/cmd/process_preimage_oracle.go new file mode 100644 index 00000000..864e3256 --- /dev/null +++ b/rvgo/cmd/process_preimage_oracle.go @@ -0,0 +1,120 @@ +package cmd + +import ( + "context" + "fmt" + "os" + "os/exec" + "time" + + preimage "github.com/ethereum-optimism/optimism/op-preimage" +) + +type rawHint string + +func (rh rawHint) Hint() string { + return string(rh) +} + +type rawKey [32]byte + +func (rk rawKey) PreimageKey() [32]byte { + return rk +} + +type ProcessPreimageOracle struct { + pCl *preimage.OracleClient + hCl *preimage.HintWriter + cmd *exec.Cmd + waitErr chan error + cancelIO context.CancelCauseFunc +} + +const clientPollTimeout = time.Second * 15 + +func NewProcessPreimageOracle(name string, args []string) (*ProcessPreimageOracle, error) { + if name == "" { + return &ProcessPreimageOracle{}, nil + } + + pClientRW, pOracleRW, err := preimage.CreateBidirectionalChannel() + if err != nil { + return nil, err + } + hClientRW, hOracleRW, err := preimage.CreateBidirectionalChannel() + if err != nil { + return nil, err + } + + cmd := exec.Command(name, args...) // nosemgrep + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.ExtraFiles = []*os.File{ + hOracleRW.Reader(), + hOracleRW.Writer(), + pOracleRW.Reader(), + pOracleRW.Writer(), + } + + // Note that the client file descriptors are not closed when the pre-image server exits. + // So we use the FilePoller to ensure that we don't get stuck in a blocking read/write. + ctx, cancelIO := context.WithCancelCause(context.Background()) + preimageClientIO := preimage.NewFilePoller(ctx, pClientRW, clientPollTimeout) + hostClientIO := preimage.NewFilePoller(ctx, hClientRW, clientPollTimeout) + out := &ProcessPreimageOracle{ + pCl: preimage.NewOracleClient(preimageClientIO), + hCl: preimage.NewHintWriter(hostClientIO), + cmd: cmd, + waitErr: make(chan error), + cancelIO: cancelIO, + } + return out, nil +} + +func (p *ProcessPreimageOracle) Hint(v []byte) { + if p.hCl == nil { // no hint processor + return + } + p.hCl.Hint(rawHint(v)) +} + +func (p *ProcessPreimageOracle) GetPreimage(k [32]byte) []byte { + if p.pCl == nil { + panic("no pre-image retriever available") + } + return p.pCl.Get(rawKey(k)) +} + +func (p *ProcessPreimageOracle) GetCmd() *exec.Cmd { + return p.cmd +} + +func (p *ProcessPreimageOracle) Start() error { + if p.cmd == nil { + return nil + } + err := p.cmd.Start() + go p.wait() + return err +} + +func (p *ProcessPreimageOracle) Close() error { + if p.cmd == nil { + return nil + } + // Give the pre-image server time to exit cleanly before killing it. + time.Sleep(time.Second * 1) + _ = p.cmd.Process.Signal(os.Interrupt) + return <-p.waitErr +} + +func (p *ProcessPreimageOracle) wait() { + err := p.cmd.Wait() + var waitErr error + if err, ok := err.(*exec.ExitError); !ok || !err.Success() { + waitErr = err + } + p.cancelIO(fmt.Errorf("%w: pre-image server has exited", waitErr)) + p.waitErr <- waitErr + close(p.waitErr) +} diff --git a/rvgo/cmd/run.go b/rvgo/cmd/run.go index d37ee393..011951bd 100644 --- a/rvgo/cmd/run.go +++ b/rvgo/cmd/run.go @@ -14,6 +14,7 @@ import ( cannon "github.com/ethereum-optimism/optimism/cannon/cmd" preimage "github.com/ethereum-optimism/optimism/op-preimage" + "github.com/ethereum-optimism/optimism/op-service/jsonutil" "github.com/ethereum-optimism/asterisc/rvgo/fast" ) @@ -48,21 +49,23 @@ func Guard(proc *os.ProcessState, fn StepFn) StepFn { } } -var _ fast.PreimageOracle = (*cannon.ProcessPreimageOracle)(nil) +var _ fast.PreimageOracle = (*ProcessPreimageOracle)(nil) + +var OutFilePerm = os.FileMode(0o755) func Run(ctx *cli.Context) error { if ctx.Bool(cannon.RunPProfCPU.Name) { defer profile.Start(profile.NoShutdownHook, profile.ProfilePath("."), profile.CPUProfile).Stop() } - state, err := cannon.LoadJSON[fast.VMState](ctx.Path(cannon.RunInputFlag.Name)) + state, err := jsonutil.LoadJSON[fast.VMState](ctx.Path(cannon.RunInputFlag.Name)) if err != nil { return err } - l := cannon.Logger(os.Stderr, log.LvlInfo) - outLog := &cannon.LoggingWriter{Name: "program std-out", Log: l} - errLog := &cannon.LoggingWriter{Name: "program std-err", Log: l} + l := Logger(os.Stderr, log.LvlInfo) + outLog := &LoggingWriter{Name: "program std-out", Log: l} + errLog := &LoggingWriter{Name: "program std-err", Log: l} stopAtPreimageType := ctx.String(cannon.RunStopAtPreimageTypeFlag.Name) if stopAtPreimageType != "" && stopAtPreimageType != "any" && stopAtPreimageType != "local" && stopAtPreimageType != "global" { @@ -82,7 +85,7 @@ func Run(ctx *cli.Context) error { args = []string{""} } - po, err := cannon.NewProcessPreimageOracle(args[0], args[1:]) + po, err := NewProcessPreimageOracle(args[0], args[1:]) if err != nil { return fmt.Errorf("failed to create pre-image oracle process: %w", err) } @@ -126,8 +129,8 @@ func Run(ctx *cli.Context) error { delta := time.Since(start) l.Info("processing", "step", step, - "pc", cannon.HexU32(state.PC), - "insn", cannon.HexU32(state.Instr()), + "pc", HexU32(state.PC), + "insn", HexU32(state.Instr()), "ips", float64(step-startStep)/(float64(delta)/float64(time.Second)), "pages", state.Memory.PageCount(), "mem", state.Memory.Usage(), @@ -139,7 +142,7 @@ func Run(ctx *cli.Context) error { } if snapshotAt(state) { - if err := cannon.WriteJSON(fmt.Sprintf(snapshotFmt, step), state); err != nil { + if err := jsonutil.WriteJSON(fmt.Sprintf(snapshotFmt, step), state, OutFilePerm); err != nil { return fmt.Errorf("failed to write state snapshot: %w", err) } } @@ -171,7 +174,7 @@ func Run(ctx *cli.Context) error { proof.OracleValue = witness.PreimageValue proof.OracleOffset = witness.PreimageOffset } - if err := cannon.WriteJSON(fmt.Sprintf(proofFmt, step), proof); err != nil { + if err := jsonutil.WriteJSON(fmt.Sprintf(proofFmt, step), proof, OutFilePerm); err != nil { return fmt.Errorf("failed to write proof data: %w", err) } } else { @@ -200,7 +203,7 @@ func Run(ctx *cli.Context) error { } } - if err := cannon.WriteJSON(ctx.Path(cannon.RunOutputFlag.Name), state); err != nil { + if err := jsonutil.WriteJSON(ctx.Path(cannon.RunOutputFlag.Name), state, OutFilePerm); err != nil { return fmt.Errorf("failed to write state output: %w", err) } return nil diff --git a/rvgo/cmd/witness.go b/rvgo/cmd/witness.go index c66c9c21..c1118105 100644 --- a/rvgo/cmd/witness.go +++ b/rvgo/cmd/witness.go @@ -5,6 +5,7 @@ import ( "os" cannon "github.com/ethereum-optimism/optimism/cannon/cmd" + "github.com/ethereum-optimism/optimism/op-service/jsonutil" "github.com/urfave/cli/v2" "github.com/ethereum-optimism/asterisc/rvgo/fast" @@ -13,7 +14,7 @@ import ( func Witness(ctx *cli.Context) error { input := ctx.Path(cannon.WitnessInputFlag.Name) output := ctx.Path(cannon.WitnessOutputFlag.Name) - state, err := cannon.LoadJSON[fast.VMState](input) + state, err := jsonutil.LoadJSON[fast.VMState](input) if err != nil { return fmt.Errorf("invalid input state (%v): %w", input, err) } From 6afbf09c2e69b11e5313933f18631ad9acddd351 Mon Sep 17 00:00:00 2001 From: Tei Im Date: Wed, 7 Feb 2024 14:47:11 +0900 Subject: [PATCH 10/12] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f46bf82..0ce1b925 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Asterisc -Asterisc proves execution of a RISC-V program with an interactive fraud-proof. +Asterisc is an alternative fault-proof VM for OP Stack that proves execution of a RISC-V program with an interactive fraud-proof. + +The interface of the Asterisk binary is essentially the same as Cannon for op-challenger compatibility; therefore, the binary commands implementation is based on [Cannon](https://github.com/ethereum-optimism/optimism/tree/develop/cannon). *Deploy/run this at your own risk, this is highly experimental software* From a5d5ba48edaf60786626186261a6a6e0c37f448c Mon Sep 17 00:00:00 2001 From: Tei Im Date: Thu, 8 Feb 2024 11:04:01 +0900 Subject: [PATCH 11/12] Update optimism dependency version Apply logging changes Update op-geth version --- go.mod | 22 ++++++++++------------ go.sum | 32 ++++++++++++++++++-------------- rvgo/cmd/log.go | 11 ++++------- rvgo/cmd/run.go | 2 +- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/go.mod b/go.mod index 65a3df82..1508abc0 100644 --- a/go.mod +++ b/go.mod @@ -4,18 +4,16 @@ go 1.21 toolchain go1.21.1 -// dev -replace github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 => github.com/testinprod-io/optimism v0.2.1-0.20240207052458-cb3cb29a1a0b - -replace github.com/ethereum/go-ethereum v1.13.5 => github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498 +replace github.com/ethereum/go-ethereum v1.13.8 => github.com/ethereum-optimism/op-geth v1.101308.0-rc.2 require ( - github.com/ethereum-optimism/optimism v1.5.0-rc.3.0.20240131040122-c874ecc9f195 - github.com/ethereum/go-ethereum v1.13.5 - github.com/holiman/uint256 v1.2.3 + github.com/ethereum-optimism/optimism v1.5.1-0.20240208011224-517132573eb7 + github.com/ethereum/go-ethereum v1.13.8 + github.com/holiman/uint256 v1.2.4 github.com/pkg/profile v1.7.0 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.27.1 + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa ) require ( @@ -23,7 +21,7 @@ require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.7.0 // indirect + github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cockroachdb/errors v1.11.1 // indirect @@ -34,17 +32,18 @@ require ( github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240131175747-1300b1825140 // indirect + github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240207091552-bfa80184df11 // indirect github.com/ethereum/c-kzg-4844 v0.4.0 // indirect github.com/felixge/fgprof v0.9.3 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect github.com/getsentry/sentry-go v0.18.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-stack/stack v1.8.1 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect @@ -76,10 +75,9 @@ require ( github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect golang.org/x/crypto v0.18.0 // indirect - golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.16.1 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/go.sum b/go.sum index e15ad336..1e50a321 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKS github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo= -github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= @@ -41,6 +41,8 @@ github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJ github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -53,10 +55,12 @@ 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.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498 h1://rSBcCLKS9lz9fs9q8aLKgjLp7AgQQVlAV7JHF7v1k= -github.com/ethereum-optimism/op-geth v1.101305.3-rc.2.0.20240130011842-33cb3315f498/go.mod h1:dQVCa+D5zi0oJJyrP3nwWciio0BJLZ2urH8OU7RJ2qs= -github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240131175747-1300b1825140 h1:F2Q+Gj4+W67CKZpVR+MEDL+EiIpgbx6VtwtdsPR4mbQ= -github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240131175747-1300b1825140/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0= +github.com/ethereum-optimism/op-geth v1.101308.0-rc.2 h1:DM77TNDS2fOnhuPBAwYHQEo+wNB62DvXl2DYdnF83Zc= +github.com/ethereum-optimism/op-geth v1.101308.0-rc.2/go.mod h1:8y9amiujojvpgaKbNCRm7Kcy3FIvHhp4SdrGIFzXhgI= +github.com/ethereum-optimism/optimism v1.5.1-0.20240208011224-517132573eb7 h1:rZVLRTnpPTYcScZ+e55cLc7LtwsdczaOhe9/8gionFU= +github.com/ethereum-optimism/optimism v1.5.1-0.20240208011224-517132573eb7/go.mod h1:5Ri/v23pw9lA/yoo9e6YWN1wbVaE0533ubanxEKN/AM= +github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240207091552-bfa80184df11 h1:PL3cFhrsPcO5FR2+ZYw+/yuZXU4C5oE4r18AShIJbUY= +github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240207091552-bfa80184df11/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0= github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= @@ -68,14 +72,14 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= -github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= @@ -99,6 +103,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.2.1-0.20220503160820-4a35382e8fc8 h1:Ep/joEub9YwcjRY6ND3+Y/w0ncE540RtGatVhtZL0/Q= +github.com/google/gofuzz v1.2.1-0.20220503160820-4a35382e8fc8/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= @@ -110,8 +116,8 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= -github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= @@ -198,8 +204,6 @@ github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbe github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= -github.com/testinprod-io/optimism v0.2.1-0.20240207052458-cb3cb29a1a0b h1:n0gf6QU3PBSNqfHR+ZqAm5FqHPDouIvdCJQdG6Djdto= -github.com/testinprod-io/optimism v0.2.1-0.20240207052458-cb3cb29a1a0b/go.mod h1:oYNJlRzj4BcANKRyYDfvEWdM3b+X/9nOfx6/KlWP0yg= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -263,8 +267,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/rvgo/cmd/log.go b/rvgo/cmd/log.go index 2a81599b..c54e96db 100644 --- a/rvgo/cmd/log.go +++ b/rvgo/cmd/log.go @@ -4,17 +4,14 @@ import ( "fmt" "io" + "golang.org/x/exp/slog" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/log" ) -func Logger(w io.Writer, lvl log.Lvl) log.Logger { - h := log.StreamHandler(w, log.LogfmtFormat()) - h = log.SyncHandler(h) - h = log.LvlFilterHandler(lvl, h) - l := log.New() - l.SetHandler(h) - return l +func Logger(w io.Writer, lvl slog.Level) log.Logger { + return log.NewLogger(log.LogfmtHandlerWithLevel(w, lvl)) } // LoggingWriter is a simple util to wrap a logger, diff --git a/rvgo/cmd/run.go b/rvgo/cmd/run.go index 011951bd..dcbef77f 100644 --- a/rvgo/cmd/run.go +++ b/rvgo/cmd/run.go @@ -63,7 +63,7 @@ func Run(ctx *cli.Context) error { return err } - l := Logger(os.Stderr, log.LvlInfo) + l := Logger(os.Stderr, log.LevelInfo) outLog := &LoggingWriter{Name: "program std-out", Log: l} errLog := &LoggingWriter{Name: "program std-err", Log: l} From 657208d16de769daf3a31d73e3f88ecc82ada9f0 Mon Sep 17 00:00:00 2001 From: Tei Im Date: Thu, 8 Feb 2024 11:10:48 +0900 Subject: [PATCH 12/12] Handle blob preimage key --- rvgo/cmd/run.go | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/rvgo/cmd/run.go b/rvgo/cmd/run.go index dcbef77f..ae03d4ee 100644 --- a/rvgo/cmd/run.go +++ b/rvgo/cmd/run.go @@ -67,9 +67,23 @@ func Run(ctx *cli.Context) error { outLog := &LoggingWriter{Name: "program std-out", Log: l} errLog := &LoggingWriter{Name: "program std-err", Log: l} - stopAtPreimageType := ctx.String(cannon.RunStopAtPreimageTypeFlag.Name) - if stopAtPreimageType != "" && stopAtPreimageType != "any" && stopAtPreimageType != "local" && stopAtPreimageType != "global" { - return fmt.Errorf("invalid preimage type %q, must be either 'any', 'local' or 'global'", stopAtPreimageType) + stopAtAnyPreimage := false + var stopAtPreimageTypeByte preimage.KeyType + switch ctx.String(cannon.RunStopAtPreimageTypeFlag.Name) { + case "local": + stopAtPreimageTypeByte = preimage.LocalKeyType + case "keccak": + stopAtPreimageTypeByte = preimage.Keccak256KeyType + case "sha256": + stopAtPreimageTypeByte = preimage.Sha256KeyType + case "blob": + stopAtPreimageTypeByte = preimage.BlobKeyType + case "any": + stopAtAnyPreimage = true + case "": + // 0 preimage type is forbidden so will not stop at any preimage + default: + return fmt.Errorf("invalid preimage type %q", ctx.String(cannon.RunStopAtPreimageTypeFlag.Name)) } stopAtPreimageLargerThan := ctx.Int(cannon.RunStopAtPreimageLargerThanFlag.Name) @@ -185,17 +199,11 @@ func Run(ctx *cli.Context) error { } if preimageRead := state.PreimageOffset > prevPreimageOffset; preimageRead { - if stopAtPreimageType == "any" { + if stopAtAnyPreimage { break } - if stopAtPreimageType != "" { - keyType := byte(preimage.LocalKeyType) - if stopAtPreimageType == "global" { - keyType = byte(preimage.Keccak256KeyType) - } - if state.PreimageKey[0] == keyType { - break - } + if state.PreimageKey[0] == byte(stopAtPreimageTypeByte) { + break } if stopAtPreimageLargerThan != 0 && len(us.LastPreimage()) > stopAtPreimageLargerThan { break