From 0709f2e12954a29b43d159927d0535417393afa6 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Fri, 10 May 2024 02:54:47 +0800 Subject: [PATCH 01/26] feat: precompile --- .gitignore | 4 + app/app.go | 28 +- app/app_test.go | 10 +- crypto/bn254util/bn254util.go | 166 +++ go.mod | 110 +- go.sum | 284 ++-- precompiles/common/errors.go | 6 + precompiles/dasigners/IDASigners.abi | 363 ++++++ precompiles/dasigners/IDASigners.sol | 387 ++++++ precompiles/dasigners/contract.go | 678 ++++++++++ precompiles/dasigners/dasigners.go | 108 ++ precompiles/dasigners/errors.go | 5 + precompiles/dasigners/events.go | 58 + precompiles/dasigners/query.go | 57 + precompiles/dasigners/tx.go | 64 + precompiles/dasigners/types.go | 130 ++ proto/zgc/council/v1/genesis.proto | 2 +- proto/zgc/council/v1/tx.proto | 14 +- proto/zgc/dasigners/v1/dasigners.proto | 25 + proto/zgc/dasigners/v1/genesis.proto | 29 + proto/zgc/dasigners/v1/query.proto | 59 + proto/zgc/dasigners/v1/tx.proto | 39 + tests/e2e/runner/kvtool.go | 2 +- tests/e2e/testutil/account.go | 4 +- x/dasigners/v1/client/cli/query.go | 57 + x/dasigners/v1/client/cli/tx.go | 22 + x/dasigners/v1/genesis.go | 50 + x/dasigners/v1/keeper/abci.go | 88 ++ x/dasigners/v1/keeper/grpc_query.go | 88 ++ x/dasigners/v1/keeper/keeper.go | 181 +++ x/dasigners/v1/keeper/msg_server.go | 92 ++ x/dasigners/v1/module.go | 181 +++ x/dasigners/v1/types/codec.go | 44 + x/dasigners/v1/types/dasigners.pb.go | 626 +++++++++ x/dasigners/v1/types/errors.go | 12 + x/dasigners/v1/types/events.go | 11 + x/dasigners/v1/types/genesis.go | 48 + x/dasigners/v1/types/genesis.pb.go | 775 +++++++++++ x/dasigners/v1/types/hash.go | 43 + x/dasigners/v1/types/interfaces.go | 10 + x/dasigners/v1/types/keys.go | 45 + x/dasigners/v1/types/msg.go | 96 ++ x/dasigners/v1/types/query.pb.go | 1648 ++++++++++++++++++++++++ x/dasigners/v1/types/query.pb.gw.go | 402 ++++++ x/dasigners/v1/types/signer.go | 55 + x/dasigners/v1/types/tx.pb.go | 1312 +++++++++++++++++++ 46 files changed, 8332 insertions(+), 186 deletions(-) create mode 100644 crypto/bn254util/bn254util.go create mode 100644 precompiles/common/errors.go create mode 100644 precompiles/dasigners/IDASigners.abi create mode 100644 precompiles/dasigners/IDASigners.sol create mode 100644 precompiles/dasigners/contract.go create mode 100644 precompiles/dasigners/dasigners.go create mode 100644 precompiles/dasigners/errors.go create mode 100644 precompiles/dasigners/events.go create mode 100644 precompiles/dasigners/query.go create mode 100644 precompiles/dasigners/tx.go create mode 100644 precompiles/dasigners/types.go create mode 100644 proto/zgc/dasigners/v1/dasigners.proto create mode 100644 proto/zgc/dasigners/v1/genesis.proto create mode 100644 proto/zgc/dasigners/v1/query.proto create mode 100644 proto/zgc/dasigners/v1/tx.proto create mode 100644 x/dasigners/v1/client/cli/query.go create mode 100644 x/dasigners/v1/client/cli/tx.go create mode 100644 x/dasigners/v1/genesis.go create mode 100644 x/dasigners/v1/keeper/abci.go create mode 100644 x/dasigners/v1/keeper/grpc_query.go create mode 100644 x/dasigners/v1/keeper/keeper.go create mode 100644 x/dasigners/v1/keeper/msg_server.go create mode 100644 x/dasigners/v1/module.go create mode 100644 x/dasigners/v1/types/codec.go create mode 100644 x/dasigners/v1/types/dasigners.pb.go create mode 100644 x/dasigners/v1/types/errors.go create mode 100644 x/dasigners/v1/types/events.go create mode 100644 x/dasigners/v1/types/genesis.go create mode 100644 x/dasigners/v1/types/genesis.pb.go create mode 100644 x/dasigners/v1/types/hash.go create mode 100644 x/dasigners/v1/types/interfaces.go create mode 100644 x/dasigners/v1/types/keys.go create mode 100644 x/dasigners/v1/types/msg.go create mode 100644 x/dasigners/v1/types/query.pb.go create mode 100644 x/dasigners/v1/types/query.pb.gw.go create mode 100644 x/dasigners/v1/types/signer.go create mode 100644 x/dasigners/v1/types/tx.pb.go diff --git a/.gitignore b/.gitignore index 195c68db..398d9ecb 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,7 @@ build/linux go.work go.work.sum .build/0gchaind +.build/da + +# runtime +run diff --git a/app/app.go b/app/app.go index a6b8b9f0..07f25f59 100644 --- a/app/app.go +++ b/app/app.go @@ -84,7 +84,6 @@ import ( "github.com/evmos/ethermint/x/evm" evmkeeper "github.com/evmos/ethermint/x/evm/keeper" evmtypes "github.com/evmos/ethermint/x/evm/types" - "github.com/evmos/ethermint/x/evm/vm/geth" "github.com/evmos/ethermint/x/feemarket" feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper" feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" @@ -98,6 +97,8 @@ import ( "github.com/0glabs/0g-chain/app/ante" chainparams "github.com/0glabs/0g-chain/app/params" "github.com/0glabs/0g-chain/chaincfg" + dasignersprecompile "github.com/0glabs/0g-chain/precompiles/dasigners" + "github.com/0glabs/0g-chain/x/bep3" bep3keeper "github.com/0glabs/0g-chain/x/bep3/keeper" bep3types "github.com/0glabs/0g-chain/x/bep3/types" @@ -111,6 +112,9 @@ import ( das "github.com/0glabs/0g-chain/x/das/v1" daskeeper "github.com/0glabs/0g-chain/x/das/v1/keeper" dastypes "github.com/0glabs/0g-chain/x/das/v1/types" + dasigners "github.com/0glabs/0g-chain/x/dasigners/v1" + dasignerskeeper "github.com/0glabs/0g-chain/x/dasigners/v1/keeper" + dasignerstypes "github.com/0glabs/0g-chain/x/dasigners/v1/types" evmutil "github.com/0glabs/0g-chain/x/evmutil" evmutilkeeper "github.com/0glabs/0g-chain/x/evmutil/keeper" evmutiltypes "github.com/0glabs/0g-chain/x/evmutil/types" @@ -123,6 +127,8 @@ import ( validatorvesting "github.com/0glabs/0g-chain/x/validator-vesting" validatorvestingrest "github.com/0glabs/0g-chain/x/validator-vesting/client/rest" validatorvestingtypes "github.com/0glabs/0g-chain/x/validator-vesting/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" ) var ( @@ -164,6 +170,7 @@ var ( mint.AppModuleBasic{}, council.AppModuleBasic{}, das.AppModuleBasic{}, + dasigners.AppModuleBasic{}, ) // module account permissions @@ -247,6 +254,7 @@ type App struct { pricefeedKeeper pricefeedkeeper.Keeper committeeKeeper committeekeeper.Keeper mintKeeper mintkeeper.Keeper + dasignersKeeper dasignerskeeper.Keeper // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper @@ -296,6 +304,7 @@ func NewApp( minttypes.StoreKey, counciltypes.StoreKey, dastypes.StoreKey, + dasignerstypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -437,14 +446,23 @@ func NewApp( ) evmBankKeeper := evmutilkeeper.NewEvmBankKeeper(app.evmutilKeeper, app.bankKeeper, app.accountKeeper) + // dasigners keeper + app.dasignersKeeper = dasignerskeeper.NewKeeper(keys[dasignerstypes.StoreKey], appCodec, app.stakingKeeper) + // precopmiles + precompiles := make(map[common.Address]vm.PrecompiledContract) + daSignersPrecompile, err := dasignersprecompile.NewDASignersPrecompile(app.dasignersKeeper) + if err != nil { + panic("initialize precompile failed") + } + precompiles[daSignersPrecompile.Address()] = daSignersPrecompile + // evm keeper app.evmKeeper = evmkeeper.NewKeeper( appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], govAuthorityAddr, app.accountKeeper, evmBankKeeper, app.stakingKeeper, app.feeMarketKeeper, - nil, // precompiled contracts - geth.NewEVM, options.EVMTrace, evmSubspace, + precompiles, ) app.evmutilKeeper.SetEvmKeeper(app.evmKeeper) @@ -591,6 +609,7 @@ func NewApp( mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper, nil), council.NewAppModule(app.CouncilKeeper, app.stakingKeeper), das.NewAppModule(app.DasKeeper), + dasigners.NewAppModule(app.dasignersKeeper, app.stakingKeeper), ) // Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list. @@ -635,6 +654,7 @@ func NewApp( counciltypes.ModuleName, dastypes.ModuleName, + dasignerstypes.ModuleName, ) // Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list. @@ -668,6 +688,7 @@ func NewApp( minttypes.ModuleName, counciltypes.ModuleName, dastypes.ModuleName, + dasignerstypes.ModuleName, ) // Warning: Some init genesis methods must run before others. Ensure the dependencies are understood before modifying this list @@ -700,6 +721,7 @@ func NewApp( validatorvestingtypes.ModuleName, counciltypes.ModuleName, dastypes.ModuleName, + dasignerstypes.ModuleName, ) app.mm.RegisterInvariants(&app.crisisKeeper) diff --git a/app/app_test.go b/app/app_test.go index 9fd6cd60..d2569381 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -3,11 +3,7 @@ package app import ( "encoding/json" "fmt" - "os" - "sort" - "testing" - "time" - "github.com/0glabs/0g-chain/chaincfg" + "github.com/0glabs/0g-chain/chaincfg" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" @@ -19,6 +15,10 @@ import ( "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" db "github.com/tendermint/tm-db" + "os" + "sort" + "testing" + "time" ) func TestNewApp(t *testing.T) { diff --git a/crypto/bn254util/bn254util.go b/crypto/bn254util/bn254util.go new file mode 100644 index 00000000..ea03660a --- /dev/null +++ b/crypto/bn254util/bn254util.go @@ -0,0 +1,166 @@ +package bn254util + +import ( + "math/big" + + "github.com/consensys/gnark-crypto/ecc/bn254" + "github.com/consensys/gnark-crypto/ecc/bn254/fp" + "github.com/consensys/gnark-crypto/ecc/bn254/fr" + "github.com/ethereum/go-ethereum/crypto" +) + +const ( + G1PointSize = 32 * 2 + G2PointSize = 32 * 2 * 2 +) + +var ( + FR_MODULUS, _ = new(big.Int).SetString("21888242871839275222246405745257275088548364400416034343698204186575808495617", 10) +) + +func VerifySig(sig *bn254.G1Affine, pubkey *bn254.G2Affine, msgBytes [32]byte) (bool, error) { + + g2Gen := GetG2Generator() + + msgPoint := MapToCurve(msgBytes) + + var negSig bn254.G1Affine + negSig.Neg((*bn254.G1Affine)(sig)) + + P := [2]bn254.G1Affine{*msgPoint, negSig} + Q := [2]bn254.G2Affine{*pubkey, *g2Gen} + + ok, err := bn254.PairingCheck(P[:], Q[:]) + if err != nil { + return false, nil + } + return ok, nil + +} + +func MapToCurve(digest [32]byte) *bn254.G1Affine { + + one := new(big.Int).SetUint64(1) + three := new(big.Int).SetUint64(3) + x := new(big.Int) + x.SetBytes(digest[:]) + for { + // y = x^3 + 3 + xP3 := new(big.Int).Exp(x, big.NewInt(3), fp.Modulus()) + y := new(big.Int).Add(xP3, three) + y.Mod(y, fp.Modulus()) + + if y.ModSqrt(y, fp.Modulus()) == nil { + x.Add(x, one).Mod(x, fp.Modulus()) + } else { + var fpX, fpY fp.Element + fpX.SetBigInt(x) + fpY.SetBigInt(y) + return &bn254.G1Affine{ + X: fpX, + Y: fpY, + } + } + } +} + +func CheckG1AndG2DiscreteLogEquality(pointG1 *bn254.G1Affine, pointG2 *bn254.G2Affine) (bool, error) { + negGenG1 := new(bn254.G1Affine).Neg(GetG1Generator()) + return bn254.PairingCheck([]bn254.G1Affine{*pointG1, *negGenG1}, []bn254.G2Affine{*GetG2Generator(), *pointG2}) +} + +func GetG1Generator() *bn254.G1Affine { + g1Gen := new(bn254.G1Affine) + _, err := g1Gen.X.SetString("1") + if err != nil { + return nil + } + _, err = g1Gen.Y.SetString("2") + if err != nil { + return nil + } + return g1Gen +} + +func GetG2Generator() *bn254.G2Affine { + g2Gen := new(bn254.G2Affine) + g2Gen.X.SetString("10857046999023057135944570762232829481370756359578518086990519993285655852781", + "11559732032986387107991004021392285783925812861821192530917403151452391805634") + g2Gen.Y.SetString("8495653923123431417604973247489272438418190587263600148770280649306958101930", + "4082367875863433681332203403145435568316851327593401208105741076214120093531") + return g2Gen +} + +func MulByGeneratorG1(a *fr.Element) *bn254.G1Affine { + g1Gen := GetG1Generator() + return new(bn254.G1Affine).ScalarMultiplication(g1Gen, a.BigInt(new(big.Int))) +} + +func MulByGeneratorG2(a *fr.Element) *bn254.G2Affine { + g2Gen := GetG2Generator() + return new(bn254.G2Affine).ScalarMultiplication(g2Gen, a.BigInt(new(big.Int))) +} + +func SerializeG1(p *bn254.G1Affine) []byte { + b := make([]byte, 0) + tmp := p.X.Bytes() + for i := 0; i < 32; i++ { + b = append(b, tmp[i]) + } + tmp = p.Y.Bytes() + for i := 0; i < 32; i++ { + b = append(b, tmp[i]) + } + return b +} + +func DeserializeG1(b []byte) *bn254.G1Affine { + p := new(bn254.G1Affine) + p.X.SetBytes(b[0:32]) + p.Y.SetBytes(b[32:64]) + return p +} + +func SerializeG2(p *bn254.G2Affine) []byte { + b := make([]byte, 0) + tmp := p.X.A0.Bytes() + for i := 0; i < 32; i++ { + b = append(b, tmp[i]) + } + tmp = p.X.A1.Bytes() + for i := 0; i < 32; i++ { + b = append(b, tmp[i]) + } + tmp = p.Y.A0.Bytes() + for i := 0; i < 32; i++ { + b = append(b, tmp[i]) + } + tmp = p.Y.A1.Bytes() + for i := 0; i < 32; i++ { + b = append(b, tmp[i]) + } + return b +} + +func DeserializeG2(b []byte) *bn254.G2Affine { + p := new(bn254.G2Affine) + p.X.A0.SetBytes(b[0:32]) + p.X.A1.SetBytes(b[32:64]) + p.Y.A0.SetBytes(b[64:96]) + p.Y.A1.SetBytes(b[96:128]) + return p +} + +func Gamma(hash *bn254.G1Affine, signature *bn254.G1Affine, pkG1 *bn254.G1Affine, pkG2 *bn254.G2Affine) *big.Int { + toHash := make([]byte, 0) + toHash = append(toHash, SerializeG1(hash)...) + toHash = append(toHash, SerializeG1(signature)...) + toHash = append(toHash, SerializeG1(pkG1)...) + toHash = append(toHash, SerializeG2(pkG2)...) + + msgHash := crypto.Keccak256(toHash) + gamma := new(big.Int) + gamma.SetBytes(msgHash) + gamma.Mod(gamma, FR_MODULUS) + return gamma +} diff --git a/go.mod b/go.mod index f7a0e479..d1a24845 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,15 @@ module github.com/0glabs/0g-chain -go 1.20 +go 1.21 + +toolchain go1.21.5 require ( cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 github.com/cenkalti/backoff/v4 v4.1.3 github.com/coniks-sys/coniks-go v0.0.0-20180722014011-11acf4819b71 + github.com/consensys/gnark-crypto v0.12.1 github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.46.11 github.com/cosmos/go-bip39 v1.0.0 @@ -19,32 +22,34 @@ require ( github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/linxGnu/grocksdb v1.8.0 - github.com/pelletier/go-toml/v2 v2.0.6 + github.com/pelletier/go-toml/v2 v2.1.0 github.com/prometheus/client_golang v1.14.0 - github.com/spf13/cast v1.5.0 - github.com/spf13/cobra v1.6.1 - github.com/spf13/viper v1.15.0 - github.com/stretchr/testify v1.8.3 - github.com/subosito/gotenv v1.4.2 + github.com/spf13/cast v1.6.0 + github.com/spf13/cobra v1.8.0 + github.com/spf13/viper v1.18.1 + github.com/stretchr/testify v1.8.4 + github.com/subosito/gotenv v1.6.0 github.com/tendermint/tendermint v0.34.27 github.com/tendermint/tm-db v0.6.7 - golang.org/x/crypto v0.14.0 - google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 - google.golang.org/grpc v1.58.3 + golang.org/x/crypto v0.21.0 + google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 + google.golang.org/grpc v1.60.0 google.golang.org/protobuf v1.31.0 sigs.k8s.io/yaml v1.3.0 ) require ( - cloud.google.com/go v0.110.8 // indirect - cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go v0.110.10 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.2 // indirect - cloud.google.com/go/storage v1.30.1 // indirect + cloud.google.com/go/iam v1.1.5 // indirect + cloud.google.com/go/storage v1.35.1 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/StackExchange/wmi v1.2.1 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect @@ -54,58 +59,61 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd v0.23.4 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect + github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect github.com/cometbft/cometbft-db v0.7.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect + github.com/consensys/bavard v0.1.13 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/gogoproto v1.4.6 // indirect + github.com/cosmos/gogoproto v1.4.11 // indirect github.com/cosmos/iavl v0.19.5 // indirect github.com/cosmos/ledger-cosmos-go v0.13.1 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set v1.8.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/badger/v3 v3.2103.2 // indirect - github.com/dgraph-io/ristretto v0.1.0 // indirect + github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect - github.com/dustin/go-humanize v1.0.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/gin-gonic/gin v1.8.1 // indirect github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-playground/validator/v10 v10.11.1 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/gateway v1.1.0 // indirect - github.com/golang/glog v1.1.0 // indirect + github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v1.12.1 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect + github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.4.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect @@ -125,12 +133,11 @@ require ( github.com/holiman/uint256 v1.2.1 // indirect github.com/huin/goupnp v1.0.3 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.15.15 // indirect + github.com/klauspost/compress v1.17.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -144,28 +151,28 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.40.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/rjeczalik/notify v0.9.1 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.29.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/spf13/afero v1.9.3 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect @@ -180,23 +187,26 @@ require ( github.com/zondax/ledger-go v0.14.2 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + go.uber.org/multierr v1.10.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/oauth2 v0.15.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.128.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c // indirect + google.golang.org/api v0.153.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect + rsc.io/tmplfunc v0.0.3 // indirect ) replace ( @@ -208,8 +218,10 @@ replace ( github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.46.11-kava.3 // See https://github.com/cosmos/cosmos-sdk/pull/13093 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 + // Use go-ethereum fork with precompiles + github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2 // Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support - github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.0-kava-v23-1 + github.com/evmos/ethermint => github.com/0glabs/ethermint v0.21.0-0g.v2.0.0 // See https://github.com/cosmos/cosmos-sdk/pull/10401, https://github.com/cosmos/cosmos-sdk/commit/0592ba6158cd0bf49d894be1cef4faeec59e8320 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 // Use the cosmos modified protobufs diff --git a/go.sum b/go.sum index bbd2b093..fecc78bd 100644 --- a/go.sum +++ b/go.sum @@ -4,7 +4,6 @@ cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSR cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -18,7 +17,6 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -34,8 +32,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= -cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= +cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= +cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -73,8 +71,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -114,8 +112,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= -cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -173,12 +171,11 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cloud.google.com/go/storage v1.35.1 h1:B59ahL//eDfx2IIKFBeT5Atm9wnNmj3+8xG/W4WB//w= +cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -200,13 +197,17 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmG filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= +github.com/0glabs/ethermint v0.21.0-0g.v2.0.0 h1:3sfsRkaPaG7v2smfxEJ2TvwPcVMIkG8yRRVR8+tbYkc= +github.com/0glabs/ethermint v0.21.0-0g.v2.0.0/go.mod h1:peUmQT71k9BOBgoWoIRWRrM/O01mffVjIH0RLnoaFuI= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= @@ -214,8 +215,10 @@ github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +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/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -231,6 +234,7 @@ github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSa github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= +github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -276,6 +280,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1U github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +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/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= @@ -287,8 +293,8 @@ github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZg github.com/btcsuite/btcd v0.23.4 h1:IzV6qqkfwbItOS/sg/aDfPDsjPP8twrCOE2R93hxMlQ= github.com/btcsuite/btcd v0.23.4/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= -github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= @@ -327,12 +333,15 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL 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/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -360,9 +369,14 @@ github.com/coniks-sys/coniks-go v0.0.0-20180722014011-11acf4819b71 h1:MFLTqgfJcl github.com/coniks-sys/coniks-go v0.0.0-20180722014011-11acf4819b71/go.mod h1:TrHYHH4Wze7v7Hkwu1MH1W+mCPQKM+gs+PicdEV14o8= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +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.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0= +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/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= 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= @@ -376,8 +390,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960Bvc github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gogoproto v1.4.6 h1:Ee7z15dWJaGlgM2rWrK8N2IX7PQcuccu8oG68jp5RL4= -github.com/cosmos/gogoproto v1.4.6/go.mod h1:VS/ASYmPgv6zkPKLjR9EB91lwbLHOzaGCirmKKhncfI= +github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= +github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/ibc-go/v6 v6.1.1 h1:oqqMNyjj6SLQF8rvgCaDGwfdITEIsbhs8F77/8xvRIo= @@ -389,8 +403,9 @@ github.com/cosmos/ledger-cosmos-go v0.13.1/go.mod h1:5tv2RVJEd2+Y38TIQN4CRjJeQGy github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -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/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -401,8 +416,9 @@ github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnG github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= @@ -421,8 +437,9 @@ github.com/dgraph-io/badger/v3 v3.2103.2 h1:dpyM5eCJAtQCBcMCZcT4UBZchuTJgCywerHH github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= +github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= @@ -432,16 +449,18 @@ github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16 github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -461,24 +480,27 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= -github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= -github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= +github.com/evmos/go-ethereum v1.10.26-evmos-rc2 h1:tYghk1ZZ8X4/OQ4YI9hvtm8aSN8OSqO0g9vo/sCMdBo= +github.com/evmos/go-ethereum v1.10.26-evmos-rc2/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= 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.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +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/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= @@ -504,9 +526,10 @@ github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -531,6 +554,7 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me 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 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +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 h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -550,8 +574,8 @@ github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -614,8 +638,9 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -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-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -626,6 +651,7 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -637,27 +663,29 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 h1:CqYfpuYIjnlNxM3msdyPRKabhXZWbKjf3Q8BWROFBso= +github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= -github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -670,7 +698,6 @@ github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMd github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= @@ -749,7 +776,6 @@ github.com/holiman/uint256 v1.2.1 h1:XRtyuda/zw2l+Bq/38n5XUoEF72aSOu/77Thd9pPp2o github.com/holiman/uint256 v1.2.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= @@ -758,8 +784,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= @@ -778,6 +804,7 @@ github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1C github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b h1:izTof8BKh/nE1wrKOrloNA5q4odOarjf+Xpe+4qow98= +github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -810,8 +837,6 @@ github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1 h1:EZnZAkZ+dqK+1OM github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1/go.mod h1:mI/4J4IxRzPrXvMiwefrt0fucGwaQ5Hm9IKS7HnoJeI= github.com/kava-labs/cosmos-sdk v0.46.11-kava.3 h1:TOhyyW/xHso/9uIOgYdsrOWDIhXi6foORWZxVRe/wS0= github.com/kava-labs/cosmos-sdk v0.46.11-kava.3/go.mod h1:bSUUbmVwWkv1ZNVTWrQHa/i+73xIUvYYPsCvl5doiCs= -github.com/kava-labs/ethermint v0.21.0-kava-v23-1 h1:5TSyCtPvFdMuSe8p2iMVqXmFBlK3lHyjaT9EqN752aI= -github.com/kava-labs/ethermint v0.21.0-kava-v23-1/go.mod h1:rdm6AinxZ4dzPEv/cjH+/AGyTbKufJ3RE7M2MDyklH0= github.com/kava-labs/tm-db v0.6.7-kava.4 h1:M2RibOKmbi+k2OhAFry8z9+RJF0CYuDETB7/PrSdoro= github.com/kava-labs/tm-db v0.6.7-kava.4/go.mod h1:70tpLhNfwCP64nAlq+bU+rOiVfWr3Nnju1D1nhGDGKs= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -822,26 +847,28 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= -github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= 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 v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= 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/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= @@ -915,6 +942,9 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +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 h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -951,19 +981,25 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N 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.7.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.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= +github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= +github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= +github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= +github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -974,6 +1010,7 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -981,8 +1018,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= -github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= @@ -998,10 +1035,10 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE 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.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= -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/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= @@ -1027,16 +1064,16 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.40.0 h1:Afz7EVRqGg2Mqqf4JuF9vdvp1pi220m55Pi9T2JnO4Q= -github.com/prometheus/common v0.40.0/go.mod h1:L65ZJPSmfn/UBWLQIHV7dBrKFidB/wPlF1y5TlSt9OE= +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.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -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/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1070,6 +1107,10 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD 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/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= @@ -1086,33 +1127,34 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= 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/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= -github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= -github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= +github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM= +github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= 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= @@ -1132,12 +1174,14 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +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/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= @@ -1177,6 +1221,7 @@ github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= +github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= 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= @@ -1187,12 +1232,14 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= 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/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/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/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= @@ -1219,6 +1266,8 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= +go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -1242,14 +1291,11 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1264,8 +1310,9 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb h1:PaBZQdo+iSDyHT053FjUCgZQ/9uqVwPOcl7KSWhKn6w= -golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= +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/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1292,8 +1339,11 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +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-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 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= @@ -1337,7 +1387,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -1360,8 +1409,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1387,8 +1436,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= +golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= 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= @@ -1403,8 +1452,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/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/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1467,7 +1516,6 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1476,7 +1524,6 @@ golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/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-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1485,7 +1532,6 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1497,6 +1543,7 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/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-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/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-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1508,16 +1555,16 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 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/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1529,15 +1576,16 @@ 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.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -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/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.1.0 h1:xYY+Bajn2a7VBmTM5GikTmnK8ZuX8YgnQCqZpbBNtmA= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1563,6 +1611,7 @@ golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1594,15 +1643,16 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= 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= @@ -1667,8 +1717,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= -google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= +google.golang.org/api v0.153.0 h1:N1AwGhielyKFaUqH07/ZSIQR3uNPcV7NVw0vj+j4iR4= +google.golang.org/api v0.153.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1676,8 +1726,9 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1719,10 +1770,8 @@ google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1788,12 +1837,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= -google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 h1:U7+wNaVuSTaUqNvK2+osJ9ejEZxbjHHk8F2b6Hpx0AE= -google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:RdyHbowztCGQySiCvQPgWQWgWhGnouTdCflKoDBt32U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c h1:jHkCUWkseRf+W+edG5hMzr/Uh1xkDREY4caybAq4dpY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= +google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= +google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1836,8 +1885,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 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= @@ -1872,11 +1921,9 @@ gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= 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/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= 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/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1892,7 +1939,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C 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= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1905,10 +1951,12 @@ honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= +pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= diff --git a/precompiles/common/errors.go b/precompiles/common/errors.go new file mode 100644 index 00000000..ca8c494e --- /dev/null +++ b/precompiles/common/errors.go @@ -0,0 +1,6 @@ +package common + +const ( + ErrGetStateDB = "get EVM StateDB failed" + ErrInvalidNumberOfArgs = "invalid number of arguments; expected %d; got: %d" +) diff --git a/precompiles/dasigners/IDASigners.abi b/precompiles/dasigners/IDASigners.abi new file mode 100644 index 00000000..6215c2c5 --- /dev/null +++ b/precompiles/dasigners/IDASigners.abi @@ -0,0 +1,363 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "X", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "Y", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct BN254.G1Point", + "name": "pkG1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256[2]", + "name": "X", + "type": "uint256[2]" + }, + { + "internalType": "uint256[2]", + "name": "Y", + "type": "uint256[2]" + } + ], + "indexed": false, + "internalType": "struct BN254.G2Point", + "name": "pkG2", + "type": "tuple" + } + ], + "name": "NewSigner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "socket", + "type": "string" + } + ], + "name": "SocketUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "epochNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "signersBitmap", + "type": "bytes" + } + ], + "name": "getAggPkG1", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "X", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "Y", + "type": "uint256" + } + ], + "internalType": "struct BN254.G1Point", + "name": "aggPkG1", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getSigner", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "string", + "name": "socket", + "type": "string" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "X", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "Y", + "type": "uint256" + } + ], + "internalType": "struct BN254.G1Point", + "name": "pkG1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256[2]", + "name": "X", + "type": "uint256[2]" + }, + { + "internalType": "uint256[2]", + "name": "Y", + "type": "uint256[2]" + } + ], + "internalType": "struct BN254.G2Point", + "name": "pkG2", + "type": "tuple" + } + ], + "internalType": "struct IDASigners.SignerDetail", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + } + ], + "name": "getSigners", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "string", + "name": "socket", + "type": "string" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "X", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "Y", + "type": "uint256" + } + ], + "internalType": "struct BN254.G1Point", + "name": "pkG1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256[2]", + "name": "X", + "type": "uint256[2]" + }, + { + "internalType": "uint256[2]", + "name": "Y", + "type": "uint256[2]" + } + ], + "internalType": "struct BN254.G2Point", + "name": "pkG2", + "type": "tuple" + } + ], + "internalType": "struct IDASigners.SignerDetail[]", + "name": "details", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "X", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "Y", + "type": "uint256" + } + ], + "internalType": "struct BN254.G1Point", + "name": "_signature", + "type": "tuple" + } + ], + "name": "registerNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "string", + "name": "socket", + "type": "string" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "X", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "Y", + "type": "uint256" + } + ], + "internalType": "struct BN254.G1Point", + "name": "pkG1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256[2]", + "name": "X", + "type": "uint256[2]" + }, + { + "internalType": "uint256[2]", + "name": "Y", + "type": "uint256[2]" + } + ], + "internalType": "struct BN254.G2Point", + "name": "pkG2", + "type": "tuple" + } + ], + "internalType": "struct IDASigners.SignerDetail", + "name": "_signer", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "X", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "Y", + "type": "uint256" + } + ], + "internalType": "struct BN254.G1Point", + "name": "_signature", + "type": "tuple" + } + ], + "name": "registerSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "socket", + "type": "string" + } + ], + "name": "updateSocket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/precompiles/dasigners/IDASigners.sol b/precompiles/dasigners/IDASigners.sol new file mode 100644 index 00000000..889ae39a --- /dev/null +++ b/precompiles/dasigners/IDASigners.sol @@ -0,0 +1,387 @@ +// Sources flattened with hardhat v2.22.2 https://hardhat.org + +// SPDX-License-Identifier: LGPL-3.0-only AND MIT + +// File contracts/libraries/BN254.sol + +// Original license: SPDX_License_Identifier: MIT +// several functions are taken or adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol (MIT license): +// Copyright 2017 Christian Reitwiessner +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + +// The remainder of the code in this library is written by LayrLabs Inc. and is also under an MIT license + +pragma solidity ^0.8.12; + +/** + * @title Library for operations on the BN254 elliptic curve. + * @author Layr Labs, Inc. + * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service + * @notice Contains BN254 parameters, common operations (addition, scalar mul, pairing), and BLS signature functionality. + */ +library BN254 { + // modulus for the underlying field F_p of the elliptic curve + uint internal constant FP_MODULUS = 21888242871839275222246405745257275088696311157297823662689037894645226208583; + // modulus for the underlying field F_r of the elliptic curve + uint internal constant FR_MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617; + + struct G1Point { + uint X; + uint Y; + } + + // Encoding of field elements is: X[1] * i + X[0] + struct G2Point { + uint[2] X; + uint[2] Y; + } + + function generatorG1() internal pure returns (G1Point memory) { + return G1Point(1, 2); + } + + // generator of group G2 + /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1). + uint internal constant G2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; + uint internal constant G2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; + uint internal constant G2y1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531; + uint internal constant G2y0 = 8495653923123431417604973247489272438418190587263600148770280649306958101930; + + /// @notice returns the G2 generator + /// @dev mind the ordering of the 1s and 0s! + /// this is because of the (unknown to us) convention used in the bn254 pairing precompile contract + /// "Elements a * i + b of F_p^2 are encoded as two elements of F_p, (a, b)." + /// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-197.md#encoding + function generatorG2() internal pure returns (G2Point memory) { + return G2Point([G2x1, G2x0], [G2y1, G2y0]); + } + + // negation of the generator of group G2 + /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1). + uint internal constant nG2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; + uint internal constant nG2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; + uint internal constant nG2y1 = 17805874995975841540914202342111839520379459829704422454583296818431106115052; + uint internal constant nG2y0 = 13392588948715843804641432497768002650278120570034223513918757245338268106653; + + function negGeneratorG2() internal pure returns (G2Point memory) { + return G2Point([nG2x1, nG2x0], [nG2y1, nG2y0]); + } + + bytes32 internal constant powersOfTauMerkleRoot = + 0x22c998e49752bbb1918ba87d6d59dd0e83620a311ba91dd4b2cc84990b31b56f; + + /** + * @param p Some point in G1. + * @return The negation of `p`, i.e. p.plus(p.negate()) should be zero. + */ + function negate(G1Point memory p) internal pure returns (G1Point memory) { + // The prime q in the base field F_q for G1 + if (p.X == 0 && p.Y == 0) { + return G1Point(0, 0); + } else { + return G1Point(p.X, FP_MODULUS - (p.Y % FP_MODULUS)); + } + } + + /** + * @return r the sum of two points of G1 + */ + function plus(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) { + uint[4] memory input; + input[0] = p1.X; + input[1] = p1.Y; + input[2] = p2.X; + input[3] = p2.Y; + bool success; + + // solium-disable-next-line security/no-inline-assembly + assembly { + success := staticcall(sub(gas(), 2000), 6, input, 0x80, r, 0x40) + // Use "invalid" to make gas estimation work + switch success + case 0 { + invalid() + } + } + + require(success, "ec-add-failed"); + } + + /** + * @notice an optimized ecMul implementation that takes O(log_2(s)) ecAdds + * @param p the point to multiply + * @param s the scalar to multiply by + * @dev this function is only safe to use if the scalar is 9 bits or less + */ + function scalar_mul_tiny(BN254.G1Point memory p, uint16 s) internal view returns (BN254.G1Point memory) { + require(s < 2 ** 9, "scalar-too-large"); + + // if s is 1 return p + if (s == 1) { + return p; + } + + // the accumulated product to return + BN254.G1Point memory acc = BN254.G1Point(0, 0); + // the 2^n*p to add to the accumulated product in each iteration + BN254.G1Point memory p2n = p; + // value of most significant bit + uint16 m = 1; + // index of most significant bit + uint8 i = 0; + + //loop until we reach the most significant bit + while (s >= m) { + unchecked { + // if the current bit is 1, add the 2^n*p to the accumulated product + if ((s >> i) & 1 == 1) { + acc = plus(acc, p2n); + } + // double the 2^n*p for the next iteration + p2n = plus(p2n, p2n); + + // increment the index and double the value of the most significant bit + m <<= 1; + ++i; + } + } + + // return the accumulated product + return acc; + } + + /** + * @return r the product of a point on G1 and a scalar, i.e. + * p == p.scalar_mul(1) and p.plus(p) == p.scalar_mul(2) for all + * points p. + */ + function scalar_mul(G1Point memory p, uint s) internal view returns (G1Point memory r) { + uint[3] memory input; + input[0] = p.X; + input[1] = p.Y; + input[2] = s; + bool success; + // solium-disable-next-line security/no-inline-assembly + assembly { + success := staticcall(sub(gas(), 2000), 7, input, 0x60, r, 0x40) + // Use "invalid" to make gas estimation work + switch success + case 0 { + invalid() + } + } + require(success, "ec-mul-failed"); + } + + /** + * @return The result of computing the pairing check + * e(p1[0], p2[0]) * .... * e(p1[n], p2[n]) == 1 + * For example, + * pairing([P1(), P1().negate()], [P2(), P2()]) should return true. + */ + function pairing( + G1Point memory a1, + G2Point memory a2, + G1Point memory b1, + G2Point memory b2 + ) internal view returns (bool) { + G1Point[2] memory p1 = [a1, b1]; + G2Point[2] memory p2 = [a2, b2]; + + uint[12] memory input; + + for (uint i = 0; i < 2; i++) { + uint j = i * 6; + input[j + 0] = p1[i].X; + input[j + 1] = p1[i].Y; + input[j + 2] = p2[i].X[0]; + input[j + 3] = p2[i].X[1]; + input[j + 4] = p2[i].Y[0]; + input[j + 5] = p2[i].Y[1]; + } + + uint[1] memory out; + bool success; + + // solium-disable-next-line security/no-inline-assembly + assembly { + success := staticcall(sub(gas(), 2000), 8, input, mul(12, 0x20), out, 0x20) + // Use "invalid" to make gas estimation work + switch success + case 0 { + invalid() + } + } + + require(success, "pairing-opcode-failed"); + + return out[0] != 0; + } + + /** + * @notice This function is functionally the same as pairing(), however it specifies a gas limit + * the user can set, as a precompile may use the entire gas budget if it reverts. + */ + function safePairing( + G1Point memory a1, + G2Point memory a2, + G1Point memory b1, + G2Point memory b2, + uint pairingGas + ) internal view returns (bool, bool) { + G1Point[2] memory p1 = [a1, b1]; + G2Point[2] memory p2 = [a2, b2]; + + uint[12] memory input; + + for (uint i = 0; i < 2; i++) { + uint j = i * 6; + input[j + 0] = p1[i].X; + input[j + 1] = p1[i].Y; + input[j + 2] = p2[i].X[0]; + input[j + 3] = p2[i].X[1]; + input[j + 4] = p2[i].Y[0]; + input[j + 5] = p2[i].Y[1]; + } + + uint[1] memory out; + bool success; + + // solium-disable-next-line security/no-inline-assembly + assembly { + success := staticcall(pairingGas, 8, input, mul(12, 0x20), out, 0x20) + } + + //Out is the output of the pairing precompile, either 0 or 1 based on whether the two pairings are equal. + //Success is true if the precompile actually goes through (aka all inputs are valid) + + return (success, out[0] != 0); + } + + /// @return hashedG1 the keccak256 hash of the G1 Point + /// @dev used for BLS signatures + function hashG1Point(BN254.G1Point memory pk) internal pure returns (bytes32 hashedG1) { + assembly { + mstore(0, mload(pk)) + mstore(0x20, mload(add(0x20, pk))) + hashedG1 := keccak256(0, 0x40) + } + } + + /// @return the keccak256 hash of the G2 Point + /// @dev used for BLS signatures + function hashG2Point(BN254.G2Point memory pk) internal pure returns (bytes32) { + return keccak256(abi.encodePacked(pk.X[0], pk.X[1], pk.Y[0], pk.Y[1])); + } + + /** + * @notice adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol + */ + function hashToG1(bytes32 _x) internal view returns (G1Point memory) { + uint beta = 0; + uint y = 0; + + uint x = uint(_x) % FP_MODULUS; + + while (true) { + (beta, y) = findYFromX(x); + + // y^2 == beta + if (beta == mulmod(y, y, FP_MODULUS)) { + return G1Point(x, y); + } + + x = addmod(x, 1, FP_MODULUS); + } + return G1Point(0, 0); + } + + /** + * Given X, find Y + * + * where y = sqrt(x^3 + b) + * + * Returns: (x^3 + b), y + */ + function findYFromX(uint x) internal view returns (uint, uint) { + // beta = (x^3 + b) % p + uint beta = addmod(mulmod(mulmod(x, x, FP_MODULUS), x, FP_MODULUS), 3, FP_MODULUS); + + // y^2 = x^3 + b + // this acts like: y = sqrt(beta) = beta^((p+1) / 4) + uint y = expMod(beta, 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52, FP_MODULUS); + + return (beta, y); + } + + function expMod(uint _base, uint _exponent, uint _modulus) internal view returns (uint retval) { + bool success; + uint[1] memory output; + uint[6] memory input; + input[0] = 0x20; // baseLen = new(big.Int).SetBytes(getData(input, 0, 32)) + input[1] = 0x20; // expLen = new(big.Int).SetBytes(getData(input, 32, 32)) + input[2] = 0x20; // modLen = new(big.Int).SetBytes(getData(input, 64, 32)) + input[3] = _base; + input[4] = _exponent; + input[5] = _modulus; + assembly { + success := staticcall(sub(gas(), 2000), 5, input, 0xc0, output, 0x20) + // Use "invalid" to make gas estimation work + switch success + case 0 { + invalid() + } + } + require(success, "BN254.expMod: call failure"); + return output[0]; + } +} + + +// File contracts/interface/IDASigners.sol + +// Original license: SPDX_License_Identifier: LGPL-3.0-only + +pragma solidity >=0.8.0 <0.9.0; + +interface IDASigners { + /*=== struct ===*/ + struct SignerDetail { + string socket; + BN254.G1Point pkG1; + BN254.G2Point pkG2; + } + + /*=== event ===*/ + event NewSigner(address indexed signer, BN254.G1Point pkG1, BN254.G2Point pkG2); + event SocketUpdated(address indexed signer, string socket); + + /*=== function ===*/ + function epochNumber() external view returns (uint); + + function getSigners(uint epoch) external view returns (address[] memory accounts, SignerDetail[] memory details); + + function registerSigner(SignerDetail memory _signer, BN254.G1Point memory _signature) external; + + function checkSignatures( + BN254.G1Point memory _hash, + uint epoch, + bytes memory signerBitmap, + BN254.G2Point memory _aggPkG2, + BN254.G1Point memory _signature + ) external view returns (bool); +} \ No newline at end of file diff --git a/precompiles/dasigners/contract.go b/precompiles/dasigners/contract.go new file mode 100644 index 00000000..2fe9629b --- /dev/null +++ b/precompiles/dasigners/contract.go @@ -0,0 +1,678 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package dasigners + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// BN254G1Point is an auto generated low-level Go binding around an user-defined struct. +type BN254G1Point struct { + X *big.Int + Y *big.Int +} + +// BN254G2Point is an auto generated low-level Go binding around an user-defined struct. +type BN254G2Point struct { + X [2]*big.Int + Y [2]*big.Int +} + +// IDASignersSignerDetail is an auto generated low-level Go binding around an user-defined struct. +type IDASignersSignerDetail struct { + Signer common.Address + Socket string + PkG1 BN254G1Point + PkG2 BN254G2Point +} + +// DASignersMetaData contains all meta data concerning the DASigners contract. +var DASignersMetaData = &bind.MetaData{ + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signersBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"}],\"name\":\"getSigners\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"details\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// DASignersABI is the input ABI used to generate the binding from. +// Deprecated: Use DASignersMetaData.ABI instead. +var DASignersABI = DASignersMetaData.ABI + +// DASigners is an auto generated Go binding around an Ethereum contract. +type DASigners struct { + DASignersCaller // Read-only binding to the contract + DASignersTransactor // Write-only binding to the contract + DASignersFilterer // Log filterer for contract events +} + +// DASignersCaller is an auto generated read-only Go binding around an Ethereum contract. +type DASignersCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DASignersTransactor is an auto generated write-only Go binding around an Ethereum contract. +type DASignersTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DASignersFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type DASignersFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DASignersSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type DASignersSession struct { + Contract *DASigners // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// DASignersCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type DASignersCallerSession struct { + Contract *DASignersCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// DASignersTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type DASignersTransactorSession struct { + Contract *DASignersTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// DASignersRaw is an auto generated low-level Go binding around an Ethereum contract. +type DASignersRaw struct { + Contract *DASigners // Generic contract binding to access the raw methods on +} + +// DASignersCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type DASignersCallerRaw struct { + Contract *DASignersCaller // Generic read-only contract binding to access the raw methods on +} + +// DASignersTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type DASignersTransactorRaw struct { + Contract *DASignersTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewDASigners creates a new instance of DASigners, bound to a specific deployed contract. +func NewDASigners(address common.Address, backend bind.ContractBackend) (*DASigners, error) { + contract, err := bindDASigners(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &DASigners{DASignersCaller: DASignersCaller{contract: contract}, DASignersTransactor: DASignersTransactor{contract: contract}, DASignersFilterer: DASignersFilterer{contract: contract}}, nil +} + +// NewDASignersCaller creates a new read-only instance of DASigners, bound to a specific deployed contract. +func NewDASignersCaller(address common.Address, caller bind.ContractCaller) (*DASignersCaller, error) { + contract, err := bindDASigners(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &DASignersCaller{contract: contract}, nil +} + +// NewDASignersTransactor creates a new write-only instance of DASigners, bound to a specific deployed contract. +func NewDASignersTransactor(address common.Address, transactor bind.ContractTransactor) (*DASignersTransactor, error) { + contract, err := bindDASigners(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &DASignersTransactor{contract: contract}, nil +} + +// NewDASignersFilterer creates a new log filterer instance of DASigners, bound to a specific deployed contract. +func NewDASignersFilterer(address common.Address, filterer bind.ContractFilterer) (*DASignersFilterer, error) { + contract, err := bindDASigners(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &DASignersFilterer{contract: contract}, nil +} + +// bindDASigners binds a generic wrapper to an already deployed contract. +func bindDASigners(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(DASignersABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_DASigners *DASignersRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _DASigners.Contract.DASignersCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_DASigners *DASignersRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DASigners.Contract.DASignersTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_DASigners *DASignersRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _DASigners.Contract.DASignersTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_DASigners *DASignersCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _DASigners.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_DASigners *DASignersTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DASigners.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_DASigners *DASignersTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _DASigners.Contract.contract.Transact(opts, method, params...) +} + +// EpochNumber is a free data retrieval call binding the contract method 0xf4145a83. +// +// Solidity: function epochNumber() view returns(uint256) +func (_DASigners *DASignersCaller) EpochNumber(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _DASigners.contract.Call(opts, &out, "epochNumber") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// EpochNumber is a free data retrieval call binding the contract method 0xf4145a83. +// +// Solidity: function epochNumber() view returns(uint256) +func (_DASigners *DASignersSession) EpochNumber() (*big.Int, error) { + return _DASigners.Contract.EpochNumber(&_DASigners.CallOpts) +} + +// EpochNumber is a free data retrieval call binding the contract method 0xf4145a83. +// +// Solidity: function epochNumber() view returns(uint256) +func (_DASigners *DASignersCallerSession) EpochNumber() (*big.Int, error) { + return _DASigners.Contract.EpochNumber(&_DASigners.CallOpts) +} + +// GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. +// +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) +func (_DASigners *DASignersCaller) GetAggPkG1(opts *bind.CallOpts, epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { + var out []interface{} + err := _DASigners.contract.Call(opts, &out, "getAggPkG1", epoch, signersBitmap) + + if err != nil { + return *new(BN254G1Point), err + } + + out0 := *abi.ConvertType(out[0], new(BN254G1Point)).(*BN254G1Point) + + return out0, err + +} + +// GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. +// +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) +func (_DASigners *DASignersSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { + return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, epoch, signersBitmap) +} + +// GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. +// +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) +func (_DASigners *DASignersCallerSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { + return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, epoch, signersBitmap) +} + +// GetSigner is a free data retrieval call binding the contract method 0x1180b553. +// +// Solidity: function getSigner(address account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))) +func (_DASigners *DASignersCaller) GetSigner(opts *bind.CallOpts, account common.Address) (IDASignersSignerDetail, error) { + var out []interface{} + err := _DASigners.contract.Call(opts, &out, "getSigner", account) + + if err != nil { + return *new(IDASignersSignerDetail), err + } + + out0 := *abi.ConvertType(out[0], new(IDASignersSignerDetail)).(*IDASignersSignerDetail) + + return out0, err + +} + +// GetSigner is a free data retrieval call binding the contract method 0x1180b553. +// +// Solidity: function getSigner(address account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))) +func (_DASigners *DASignersSession) GetSigner(account common.Address) (IDASignersSignerDetail, error) { + return _DASigners.Contract.GetSigner(&_DASigners.CallOpts, account) +} + +// GetSigner is a free data retrieval call binding the contract method 0x1180b553. +// +// Solidity: function getSigner(address account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))) +func (_DASigners *DASignersCallerSession) GetSigner(account common.Address) (IDASignersSignerDetail, error) { + return _DASigners.Contract.GetSigner(&_DASigners.CallOpts, account) +} + +// GetSigners is a free data retrieval call binding the contract method 0xdfceceae. +// +// Solidity: function getSigners(uint256 epoch) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[] details) +func (_DASigners *DASignersCaller) GetSigners(opts *bind.CallOpts, epoch *big.Int) ([]IDASignersSignerDetail, error) { + var out []interface{} + err := _DASigners.contract.Call(opts, &out, "getSigners", epoch) + + if err != nil { + return *new([]IDASignersSignerDetail), err + } + + out0 := *abi.ConvertType(out[0], new([]IDASignersSignerDetail)).(*[]IDASignersSignerDetail) + + return out0, err + +} + +// GetSigners is a free data retrieval call binding the contract method 0xdfceceae. +// +// Solidity: function getSigners(uint256 epoch) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[] details) +func (_DASigners *DASignersSession) GetSigners(epoch *big.Int) ([]IDASignersSignerDetail, error) { + return _DASigners.Contract.GetSigners(&_DASigners.CallOpts, epoch) +} + +// GetSigners is a free data retrieval call binding the contract method 0xdfceceae. +// +// Solidity: function getSigners(uint256 epoch) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[] details) +func (_DASigners *DASignersCallerSession) GetSigners(epoch *big.Int) ([]IDASignersSignerDetail, error) { + return _DASigners.Contract.GetSigners(&_DASigners.CallOpts, epoch) +} + +// RegisterNextEpoch is a paid mutator transaction binding the contract method 0x56a32372. +// +// Solidity: function registerNextEpoch((uint256,uint256) _signature) returns() +func (_DASigners *DASignersTransactor) RegisterNextEpoch(opts *bind.TransactOpts, _signature BN254G1Point) (*types.Transaction, error) { + return _DASigners.contract.Transact(opts, "registerNextEpoch", _signature) +} + +// RegisterNextEpoch is a paid mutator transaction binding the contract method 0x56a32372. +// +// Solidity: function registerNextEpoch((uint256,uint256) _signature) returns() +func (_DASigners *DASignersSession) RegisterNextEpoch(_signature BN254G1Point) (*types.Transaction, error) { + return _DASigners.Contract.RegisterNextEpoch(&_DASigners.TransactOpts, _signature) +} + +// RegisterNextEpoch is a paid mutator transaction binding the contract method 0x56a32372. +// +// Solidity: function registerNextEpoch((uint256,uint256) _signature) returns() +func (_DASigners *DASignersTransactorSession) RegisterNextEpoch(_signature BN254G1Point) (*types.Transaction, error) { + return _DASigners.Contract.RegisterNextEpoch(&_DASigners.TransactOpts, _signature) +} + +// RegisterSigner is a paid mutator transaction binding the contract method 0x7ca4dd5e. +// +// Solidity: function registerSigner((address,string,(uint256,uint256),(uint256[2],uint256[2])) _signer, (uint256,uint256) _signature) returns() +func (_DASigners *DASignersTransactor) RegisterSigner(opts *bind.TransactOpts, _signer IDASignersSignerDetail, _signature BN254G1Point) (*types.Transaction, error) { + return _DASigners.contract.Transact(opts, "registerSigner", _signer, _signature) +} + +// RegisterSigner is a paid mutator transaction binding the contract method 0x7ca4dd5e. +// +// Solidity: function registerSigner((address,string,(uint256,uint256),(uint256[2],uint256[2])) _signer, (uint256,uint256) _signature) returns() +func (_DASigners *DASignersSession) RegisterSigner(_signer IDASignersSignerDetail, _signature BN254G1Point) (*types.Transaction, error) { + return _DASigners.Contract.RegisterSigner(&_DASigners.TransactOpts, _signer, _signature) +} + +// RegisterSigner is a paid mutator transaction binding the contract method 0x7ca4dd5e. +// +// Solidity: function registerSigner((address,string,(uint256,uint256),(uint256[2],uint256[2])) _signer, (uint256,uint256) _signature) returns() +func (_DASigners *DASignersTransactorSession) RegisterSigner(_signer IDASignersSignerDetail, _signature BN254G1Point) (*types.Transaction, error) { + return _DASigners.Contract.RegisterSigner(&_DASigners.TransactOpts, _signer, _signature) +} + +// UpdateSocket is a paid mutator transaction binding the contract method 0x0cf4b767. +// +// Solidity: function updateSocket(string socket) returns() +func (_DASigners *DASignersTransactor) UpdateSocket(opts *bind.TransactOpts, socket string) (*types.Transaction, error) { + return _DASigners.contract.Transact(opts, "updateSocket", socket) +} + +// UpdateSocket is a paid mutator transaction binding the contract method 0x0cf4b767. +// +// Solidity: function updateSocket(string socket) returns() +func (_DASigners *DASignersSession) UpdateSocket(socket string) (*types.Transaction, error) { + return _DASigners.Contract.UpdateSocket(&_DASigners.TransactOpts, socket) +} + +// UpdateSocket is a paid mutator transaction binding the contract method 0x0cf4b767. +// +// Solidity: function updateSocket(string socket) returns() +func (_DASigners *DASignersTransactorSession) UpdateSocket(socket string) (*types.Transaction, error) { + return _DASigners.Contract.UpdateSocket(&_DASigners.TransactOpts, socket) +} + +// DASignersNewSignerIterator is returned from FilterNewSigner and is used to iterate over the raw logs and unpacked data for NewSigner events raised by the DASigners contract. +type DASignersNewSignerIterator struct { + Event *DASignersNewSigner // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *DASignersNewSignerIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(DASignersNewSigner) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(DASignersNewSigner) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *DASignersNewSignerIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DASignersNewSignerIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DASignersNewSigner represents a NewSigner event raised by the DASigners contract. +type DASignersNewSigner struct { + Signer common.Address + PkG1 BN254G1Point + PkG2 BN254G2Point + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewSigner is a free log retrieval operation binding the contract event 0x679917c2006df1daaa987a56bf1d66e99764d5ad317892d9e83a6eb4e3f051e7. +// +// Solidity: event NewSigner(address indexed signer, (uint256,uint256) pkG1, (uint256[2],uint256[2]) pkG2) +func (_DASigners *DASignersFilterer) FilterNewSigner(opts *bind.FilterOpts, signer []common.Address) (*DASignersNewSignerIterator, error) { + + var signerRule []interface{} + for _, signerItem := range signer { + signerRule = append(signerRule, signerItem) + } + + logs, sub, err := _DASigners.contract.FilterLogs(opts, "NewSigner", signerRule) + if err != nil { + return nil, err + } + return &DASignersNewSignerIterator{contract: _DASigners.contract, event: "NewSigner", logs: logs, sub: sub}, nil +} + +// WatchNewSigner is a free log subscription operation binding the contract event 0x679917c2006df1daaa987a56bf1d66e99764d5ad317892d9e83a6eb4e3f051e7. +// +// Solidity: event NewSigner(address indexed signer, (uint256,uint256) pkG1, (uint256[2],uint256[2]) pkG2) +func (_DASigners *DASignersFilterer) WatchNewSigner(opts *bind.WatchOpts, sink chan<- *DASignersNewSigner, signer []common.Address) (event.Subscription, error) { + + var signerRule []interface{} + for _, signerItem := range signer { + signerRule = append(signerRule, signerItem) + } + + logs, sub, err := _DASigners.contract.WatchLogs(opts, "NewSigner", signerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(DASignersNewSigner) + if err := _DASigners.contract.UnpackLog(event, "NewSigner", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseNewSigner is a log parse operation binding the contract event 0x679917c2006df1daaa987a56bf1d66e99764d5ad317892d9e83a6eb4e3f051e7. +// +// Solidity: event NewSigner(address indexed signer, (uint256,uint256) pkG1, (uint256[2],uint256[2]) pkG2) +func (_DASigners *DASignersFilterer) ParseNewSigner(log types.Log) (*DASignersNewSigner, error) { + event := new(DASignersNewSigner) + if err := _DASigners.contract.UnpackLog(event, "NewSigner", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// DASignersSocketUpdatedIterator is returned from FilterSocketUpdated and is used to iterate over the raw logs and unpacked data for SocketUpdated events raised by the DASigners contract. +type DASignersSocketUpdatedIterator struct { + Event *DASignersSocketUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *DASignersSocketUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(DASignersSocketUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(DASignersSocketUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *DASignersSocketUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DASignersSocketUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DASignersSocketUpdated represents a SocketUpdated event raised by the DASigners contract. +type DASignersSocketUpdated struct { + Signer common.Address + Socket string + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSocketUpdated is a free log retrieval operation binding the contract event 0x09617a966176a40f8f1410768b118506db0096484acd5811064fcc12038798de. +// +// Solidity: event SocketUpdated(address indexed signer, string socket) +func (_DASigners *DASignersFilterer) FilterSocketUpdated(opts *bind.FilterOpts, signer []common.Address) (*DASignersSocketUpdatedIterator, error) { + + var signerRule []interface{} + for _, signerItem := range signer { + signerRule = append(signerRule, signerItem) + } + + logs, sub, err := _DASigners.contract.FilterLogs(opts, "SocketUpdated", signerRule) + if err != nil { + return nil, err + } + return &DASignersSocketUpdatedIterator{contract: _DASigners.contract, event: "SocketUpdated", logs: logs, sub: sub}, nil +} + +// WatchSocketUpdated is a free log subscription operation binding the contract event 0x09617a966176a40f8f1410768b118506db0096484acd5811064fcc12038798de. +// +// Solidity: event SocketUpdated(address indexed signer, string socket) +func (_DASigners *DASignersFilterer) WatchSocketUpdated(opts *bind.WatchOpts, sink chan<- *DASignersSocketUpdated, signer []common.Address) (event.Subscription, error) { + + var signerRule []interface{} + for _, signerItem := range signer { + signerRule = append(signerRule, signerItem) + } + + logs, sub, err := _DASigners.contract.WatchLogs(opts, "SocketUpdated", signerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(DASignersSocketUpdated) + if err := _DASigners.contract.UnpackLog(event, "SocketUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSocketUpdated is a log parse operation binding the contract event 0x09617a966176a40f8f1410768b118506db0096484acd5811064fcc12038798de. +// +// Solidity: event SocketUpdated(address indexed signer, string socket) +func (_DASigners *DASignersFilterer) ParseSocketUpdated(log types.Log) (*DASignersSocketUpdated, error) { + event := new(DASignersSocketUpdated) + if err := _DASigners.contract.UnpackLog(event, "SocketUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/precompiles/dasigners/dasigners.go b/precompiles/dasigners/dasigners.go new file mode 100644 index 00000000..601e626c --- /dev/null +++ b/precompiles/dasigners/dasigners.go @@ -0,0 +1,108 @@ +package dasigners + +import ( + "fmt" + "strings" + + precopmiles_common "github.com/0glabs/0g-chain/precompiles/common" + dasignerskeeper "github.com/0glabs/0g-chain/x/dasigners/v1/keeper" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/evmos/ethermint/x/evm/statedb" +) + +const ( + PrecompileAddress = "0x0000000000000000000000000000000000001000" + RequiredGasBasic uint64 = 100 + + DASignersFunctionEpochNumber = "epochNumber" + DASignersFunctionGetSigner = "getSigner" + DASignersFunctionGetSigners = "getSigners" + DASignersFunctionUpdateSocket = "updateSocket" + DASignersFunctionRegisterNextEpoch = "registerNextEpoch" + DASignersFunctionRegisterSigner = "registerSigner" + DASignersFunctionGetAggPkG1 = "getAggPkG1" +) + +var _ vm.PrecompiledContract = &DASignersPrecompile{} + +type DASignersPrecompile struct { + abi abi.ABI + dasignersKeeper dasignerskeeper.Keeper +} + +func NewDASignersPrecompile(dasignersKeeper dasignerskeeper.Keeper) (*DASignersPrecompile, error) { + abi, err := abi.JSON(strings.NewReader(DASignersABI)) + if err != nil { + return nil, err + } + return &DASignersPrecompile{ + abi: abi, + dasignersKeeper: dasignersKeeper, + }, nil +} + +// Address implements vm.PrecompiledContract. +func (d *DASignersPrecompile) Address() common.Address { + return common.HexToAddress(PrecompileAddress) +} + +// RequiredGas implements vm.PrecompiledContract. +func (d *DASignersPrecompile) RequiredGas(input []byte) uint64 { + return RequiredGasBasic +} + +// Run implements vm.PrecompiledContract. +func (d *DASignersPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error) { + // parse input + if len(contract.Input) < 4 { + return nil, vm.ErrExecutionReverted + } + method, err := d.abi.MethodById(contract.Input[:4]) + if err != nil { + return nil, vm.ErrExecutionReverted + } + args, err := method.Inputs.Unpack(contract.Input[4:]) + if err != nil { + return nil, err + } + // get state db and context + stateDB, ok := evm.StateDB.(*statedb.StateDB) + if !ok { + return nil, fmt.Errorf(precopmiles_common.ErrGetStateDB) + } + ctx := stateDB.GetContext() + initialGas := ctx.GasMeter().GasConsumed() + + var bz []byte + switch method.Name { + // queries + case DASignersFunctionEpochNumber: + bz, err = d.EpochNumber(ctx, evm, method, args) + case DASignersFunctionGetSigner: + bz, err = d.GetSigner(ctx, evm, method, args) + case DASignersFunctionGetSigners: + bz, err = d.GetSigners(ctx, evm, method, args) + case DASignersFunctionGetAggPkG1: + bz, err = d.GetAggPkG1(ctx, evm, method, args) + // txs + case DASignersFunctionRegisterSigner: + bz, err = d.RegisterSigner(ctx, evm, stateDB, method, args) + case DASignersFunctionRegisterNextEpoch: + bz, err = d.RegisterNextEpoch(ctx, evm, stateDB, method, args) + case DASignersFunctionUpdateSocket: + bz, err = d.UpdateSocket(ctx, evm, stateDB, method, args) + } + + if err != nil { + return nil, err + } + + cost := ctx.GasMeter().GasConsumed() - initialGas + + if !contract.UseGas(cost) { + return nil, vm.ErrOutOfGas + } + return bz, nil +} diff --git a/precompiles/dasigners/errors.go b/precompiles/dasigners/errors.go new file mode 100644 index 00000000..ad08d35e --- /dev/null +++ b/precompiles/dasigners/errors.go @@ -0,0 +1,5 @@ +package dasigners + +const ( + ErrInvalidSender = "sender address %s is not the same as signer address %s" +) diff --git a/precompiles/dasigners/events.go b/precompiles/dasigners/events.go new file mode 100644 index 00000000..5abd8431 --- /dev/null +++ b/precompiles/dasigners/events.go @@ -0,0 +1,58 @@ +package dasigners + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/evmos/ethermint/x/evm/statedb" +) + +const ( + NewSignerEvent = "NewSigner" + SocketUpdatedEvent = "SocketUpdated" +) + +func (d *DASignersPrecompile) EmitNewSignerEvent(ctx sdk.Context, stateDB *statedb.StateDB, signer IDASignersSignerDetail) error { + event := d.abi.Events[NewSignerEvent] + quries := make([]interface{}, 2) + quries[0] = event.ID + quries[1] = signer.Signer + topics, err := abi.MakeTopics(quries) + if err != nil { + return err + } + b, err := event.Inputs.Pack(signer.Signer, signer.PkG1, signer.PkG2) + if err != nil { + return err + } + stateDB.AddLog(&types.Log{ + Address: d.Address(), + Topics: topics[0], + Data: b, + BlockNumber: uint64(ctx.BlockHeight()), + }) + return d.EmitSocketUpdatedEvent(ctx, stateDB, signer.Signer, signer.Socket) +} + +func (d *DASignersPrecompile) EmitSocketUpdatedEvent(ctx sdk.Context, stateDB *statedb.StateDB, signer common.Address, socket string) error { + event := d.abi.Events[SocketUpdatedEvent] + quries := make([]interface{}, 2) + quries[0] = event.ID + quries[1] = signer + topics, err := abi.MakeTopics(quries) + if err != nil { + return err + } + b, err := event.Inputs.Pack(signer, socket) + if err != nil { + return err + } + stateDB.AddLog(&types.Log{ + Address: d.Address(), + Topics: topics[0], + Data: b, + BlockNumber: uint64(ctx.BlockHeight()), + }) + return nil +} diff --git a/precompiles/dasigners/query.go b/precompiles/dasigners/query.go new file mode 100644 index 00000000..8753d97d --- /dev/null +++ b/precompiles/dasigners/query.go @@ -0,0 +1,57 @@ +package dasigners + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/core/vm" +) + +func (d *DASignersPrecompile) EpochNumber(ctx sdk.Context, _ *vm.EVM, method *abi.Method, _ []interface{}) ([]byte, error) { + epochNumber, err := d.dasignersKeeper.GetEpochNumber(ctx) + if err != nil { + return nil, err + } + return method.Outputs.Pack(big.NewInt(int64(epochNumber))) +} + +func (d *DASignersPrecompile) GetSigner(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { + req, err := NewQuerySignerRequest(args) + if err != nil { + return nil, err + } + response, err := d.dasignersKeeper.Signer(sdk.WrapSDKContext(ctx), req) + if err != nil { + return nil, err + } + return method.Outputs.Pack(NewIDASignersSignerDetail(response.Signer)) +} + +func (d *DASignersPrecompile) GetSigners(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { + req, err := NewQueryEpochSignerSetRequest(args) + if err != nil { + return nil, err + } + response, err := d.dasignersKeeper.EpochSignerSet(sdk.WrapSDKContext(ctx), req) + if err != nil { + return nil, err + } + signers := make([]IDASignersSignerDetail, 0) + for _, signer := range response.Signers { + signers = append(signers, NewIDASignersSignerDetail(signer)) + } + return method.Outputs.Pack(signers) +} + +func (d *DASignersPrecompile) GetAggPkG1(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { + req, err := NewQueryAggregatePubkeyG1Request(args) + if err != nil { + return nil, err + } + response, err := d.dasignersKeeper.AggregatePubkeyG1(sdk.WrapSDKContext(ctx), req) + if err != nil { + return nil, err + } + return method.Outputs.Pack(NewBN254G1Point(response.AggregatePubkeyG1)) +} diff --git a/precompiles/dasigners/tx.go b/precompiles/dasigners/tx.go new file mode 100644 index 00000000..ac7a7a5c --- /dev/null +++ b/precompiles/dasigners/tx.go @@ -0,0 +1,64 @@ +package dasigners + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/evmos/ethermint/x/evm/statedb" +) + +func (d *DASignersPrecompile) RegisterSigner(ctx sdk.Context, evm *vm.EVM, stateDB *statedb.StateDB, method *abi.Method, args []interface{}) ([]byte, error) { + msg, err := NewMsgRegisterSigner(args) + if err != nil { + return nil, err + } + // validation + sender := ToLowerHexWithoutPrefix(evm.Origin) + if sender != msg.Signer.Account { + return nil, fmt.Errorf(ErrInvalidSender, sender, msg.Signer.Account) + } + // execute + _, err = d.dasignersKeeper.RegisterSigner(sdk.WrapSDKContext(ctx), msg) + if err != nil { + return nil, err + } + // emit events + err = d.EmitNewSignerEvent(ctx, stateDB, args[0].(IDASignersSignerDetail)) + if err != nil { + return nil, err + } + return method.Outputs.Pack() +} + +func (d *DASignersPrecompile) RegisterNextEpoch(ctx sdk.Context, evm *vm.EVM, stateDB *statedb.StateDB, method *abi.Method, args []interface{}) ([]byte, error) { + msg, err := NewMsgRegisterNextEpoch(args, ToLowerHexWithoutPrefix(evm.Origin)) + if err != nil { + return nil, err + } + // execute + _, err = d.dasignersKeeper.RegisterNextEpoch(sdk.WrapSDKContext(ctx), msg) + if err != nil { + return nil, err + } + return method.Outputs.Pack() +} + +func (d *DASignersPrecompile) UpdateSocket(ctx sdk.Context, evm *vm.EVM, stateDB *statedb.StateDB, method *abi.Method, args []interface{}) ([]byte, error) { + msg, err := NewMsgUpdateSocket(args, ToLowerHexWithoutPrefix(evm.Origin)) + if err != nil { + return nil, err + } + // execute + _, err = d.dasignersKeeper.UpdateSocket(sdk.WrapSDKContext(ctx), msg) + if err != nil { + return nil, err + } + // emit events + err = d.EmitSocketUpdatedEvent(ctx, stateDB, evm.Origin, args[0].(string)) + if err != nil { + return nil, err + } + return method.Outputs.Pack() +} diff --git a/precompiles/dasigners/types.go b/precompiles/dasigners/types.go new file mode 100644 index 00000000..a7fe5e5e --- /dev/null +++ b/precompiles/dasigners/types.go @@ -0,0 +1,130 @@ +package dasigners + +import ( + "fmt" + "math/big" + "strings" + + precopmiles_common "github.com/0glabs/0g-chain/precompiles/common" + dasignerstypes "github.com/0glabs/0g-chain/x/dasigners/v1/types" + "github.com/ethereum/go-ethereum/common" +) + +func NewBN254G1Point(b []byte) BN254G1Point { + return BN254G1Point{ + X: new(big.Int).SetBytes(b[:32]), + Y: new(big.Int).SetBytes(b[32:64]), + } +} + +func (p BN254G1Point) Serialize() []byte { + b := make([]byte, 0) + b = append(b, common.LeftPadBytes(p.X.Bytes(), 32)...) + b = append(b, common.LeftPadBytes(p.Y.Bytes(), 32)...) + return b +} + +func NewBN254G2Point(b []byte) BN254G2Point { + return BN254G2Point{ + X: [2]*big.Int{ + new(big.Int).SetBytes(b[:32]), + new(big.Int).SetBytes(b[32:64]), + }, + Y: [2]*big.Int{ + new(big.Int).SetBytes(b[64:96]), + new(big.Int).SetBytes(b[96:128]), + }, + } +} + +func (p BN254G2Point) Serialize() []byte { + b := make([]byte, 0) + b = append(b, common.LeftPadBytes(p.X[0].Bytes(), 32)...) + b = append(b, common.LeftPadBytes(p.X[1].Bytes(), 32)...) + b = append(b, common.LeftPadBytes(p.Y[0].Bytes(), 32)...) + b = append(b, common.LeftPadBytes(p.Y[1].Bytes(), 32)...) + return b +} + +func NewQuerySignerRequest(args []interface{}) (*dasignerstypes.QuerySignerRequest, error) { + if len(args) != 1 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 1, len(args)) + } + + return &dasignerstypes.QuerySignerRequest{ + Account: args[0].(string), + }, nil +} + +func NewQueryEpochSignerSetRequest(args []interface{}) (*dasignerstypes.QueryEpochSignerSetRequest, error) { + if len(args) != 1 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 1, len(args)) + } + + return &dasignerstypes.QueryEpochSignerSetRequest{ + EpochNumber: args[0].(*big.Int).Uint64(), + }, nil +} + +func NewQueryAggregatePubkeyG1Request(args []interface{}) (*dasignerstypes.QueryAggregatePubkeyG1Request, error) { + if len(args) != 2 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 2, len(args)) + } + + return &dasignerstypes.QueryAggregatePubkeyG1Request{ + EpochNumber: args[0].(*big.Int).Uint64(), + SignersBitmap: args[1].([]byte), + }, nil +} + +func NewIDASignersSignerDetail(signer *dasignerstypes.Signer) IDASignersSignerDetail { + return IDASignersSignerDetail{ + Signer: common.HexToAddress(signer.Account), + Socket: signer.Socket, + PkG1: NewBN254G1Point(signer.PubkeyG1), + PkG2: NewBN254G2Point(signer.PubkeyG2), + } +} + +func ToLowerHexWithoutPrefix(addr common.Address) string { + return strings.ToLower(addr.Hex()[2:]) +} + +func NewMsgRegisterSigner(args []interface{}) (*dasignerstypes.MsgRegisterSigner, error) { + if len(args) != 2 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 2, len(args)) + } + + signer := args[0].(IDASignersSignerDetail) + return &dasignerstypes.MsgRegisterSigner{ + Signer: &dasignerstypes.Signer{ + Account: ToLowerHexWithoutPrefix(signer.Signer), + Socket: signer.Socket, + PubkeyG1: signer.PkG1.Serialize(), + PubkeyG2: signer.PkG2.Serialize(), + }, + Signature: args[1].(BN254G1Point).Serialize(), + }, nil +} + +func NewMsgRegisterNextEpoch(args []interface{}, account string) (*dasignerstypes.MsgRegisterNextEpoch, error) { + if len(args) != 1 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 1, len(args)) + } + + return &dasignerstypes.MsgRegisterNextEpoch{ + Account: account, + Signature: args[0].(BN254G1Point).Serialize(), + }, nil +} + +func NewMsgUpdateSocket(args []interface{}, account string) (*dasignerstypes.MsgUpdateSocket, error) { + if len(args) != 1 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 1, len(args)) + } + + return &dasignerstypes.MsgUpdateSocket{ + Account: account, + Socket: args[0].(string), + }, nil +} diff --git a/proto/zgc/council/v1/genesis.proto b/proto/zgc/council/v1/genesis.proto index fbfcc07b..04bd2acc 100644 --- a/proto/zgc/council/v1/genesis.proto +++ b/proto/zgc/council/v1/genesis.proto @@ -28,7 +28,7 @@ message Council { uint64 voting_start_height = 2; uint64 start_height = 3; uint64 end_height = 4; - repeated Vote votes = 5 [(gogoproto.nullable) = false]; + repeated Vote votes = 5 [(gogoproto.nullable) = false]; repeated bytes members = 6 [ (cosmos_proto.scalar) = "cosmos.AddressBytes", (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress" diff --git a/proto/zgc/council/v1/tx.proto b/proto/zgc/council/v1/tx.proto index 323f6fde..70472762 100644 --- a/proto/zgc/council/v1/tx.proto +++ b/proto/zgc/council/v1/tx.proto @@ -11,21 +11,21 @@ option (gogoproto.goproto_getters_all) = false; // Msg defines the council Msg service service Msg { - rpc Register(MsgRegister) returns (MsgRegisterResponse); - rpc Vote(MsgVote) returns (MsgVoteResponse); + rpc Register(MsgRegister) returns (MsgRegisterResponse); + rpc Vote(MsgVote) returns (MsgVoteResponse); } message MsgRegister { - string voter = 1; - bytes key = 2; + string voter = 1; + bytes key = 2; } message MsgRegisterResponse {} message MsgVote { - uint64 council_id = 1 [(gogoproto.customname) = "CouncilID"]; - string voter = 2; - repeated Ballot ballots = 3; + uint64 council_id = 1 [(gogoproto.customname) = "CouncilID"]; + string voter = 2; + repeated Ballot ballots = 3; } message MsgVoteResponse {} diff --git a/proto/zgc/dasigners/v1/dasigners.proto b/proto/zgc/dasigners/v1/dasigners.proto new file mode 100644 index 00000000..91dc6dec --- /dev/null +++ b/proto/zgc/dasigners/v1/dasigners.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package zgc.dasigners.v1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; +option (gogoproto.goproto_getters_all) = false; + +message Signer { + // account defines the hex address of signer without 0x + string account = 1; + // socket defines the da node socket address + string socket = 2; + // pubkey_g1 defines the public key on bn254 G1 + bytes pubkey_g1 = 3; + // pubkey_g1 defines the public key on bn254 G2 + bytes pubkey_g2 = 4; +} + +message EpochSignerSet { + repeated string signers = 1; +} diff --git a/proto/zgc/dasigners/v1/genesis.proto b/proto/zgc/dasigners/v1/genesis.proto new file mode 100644 index 00000000..154cb987 --- /dev/null +++ b/proto/zgc/dasigners/v1/genesis.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package zgc.dasigners.v1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import "zgc/dasigners/v1/dasigners.proto"; + +option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; + +message Params { + uint64 quorum_size = 1; + string tokens_per_vote = 2; + uint64 max_votes = 3; + uint64 epoch_blocks = 4; +} + +// GenesisState defines the dasigners module's genesis state. +message GenesisState { + // params defines all the parameters of related to deposit. + Params params = 1 [(gogoproto.nullable) = false]; + // params epoch_number the epoch number + uint64 epoch_number = 2; + // signers defines all signers information + repeated Signer signers = 3; + // signers_by_epoch defines chosen signers by epoch + repeated EpochSignerSet signers_by_epoch = 4; +} diff --git a/proto/zgc/dasigners/v1/query.proto b/proto/zgc/dasigners/v1/query.proto new file mode 100644 index 00000000..336ac30e --- /dev/null +++ b/proto/zgc/dasigners/v1/query.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; +package zgc.dasigners.v1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import "zgc/dasigners/v1/dasigners.proto"; + +option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; +option (gogoproto.goproto_getters_all) = false; + +// Query defines the gRPC querier service for the dasigners module +service Query { + rpc EpochNumber(QueryEpochNumberRequest) returns (QueryEpochNumberResponse) { + option (google.api.http).get = "/0gchain/dasigners/v1/epoch-number"; + } + rpc EpochSignerSet(QueryEpochSignerSetRequest) returns (QueryEpochSignerSetResponse) { + option (google.api.http).get = "/0gchain/dasigners/v1/epoch-signer-set"; + } + rpc AggregatePubkeyG1(QueryAggregatePubkeyG1Request) returns (QueryAggregatePubkeyG1Response) { + option (google.api.http).get = "/0gchain/dasigners/v1/aggregate-pubkey-g1"; + } + rpc Signer(QuerySignerRequest) returns (QuerySignerResponse) { + option (google.api.http).get = "/0gchain/dasigners/v1/signer"; + } +} + +message QuerySignerRequest { + string account = 1; +} + +message QuerySignerResponse { + Signer signer = 1; +} + +message QueryEpochNumberRequest {} + +message QueryEpochNumberResponse { + uint64 epoch_number = 1; +} + +message QueryEpochSignerSetRequest { + uint64 epoch_number = 1; +} + +message QueryEpochSignerSetResponse { + repeated Signer signers = 1; +} + +message QueryAggregatePubkeyG1Request { + uint64 epoch_number = 1; + bytes signersBitmap = 2; +} + +message QueryAggregatePubkeyG1Response { + bytes aggregate_pubkey_g1 = 1; +} diff --git a/proto/zgc/dasigners/v1/tx.proto b/proto/zgc/dasigners/v1/tx.proto new file mode 100644 index 00000000..9e5fd0e2 --- /dev/null +++ b/proto/zgc/dasigners/v1/tx.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; +package zgc.dasigners.v1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "zgc/das/v1/genesis.proto"; +import "zgc/dasigners/v1/dasigners.proto"; + +option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; +option (gogoproto.goproto_getters_all) = false; + +// Msg defines the dasigners Msg service +service Msg { + rpc RegisterSigner(MsgRegisterSigner) returns (MsgRegisterSignerResponse); + rpc UpdateSocket(MsgUpdateSocket) returns (MsgUpdateSocketResponse); + rpc RegisterNextEpoch(MsgRegisterNextEpoch) returns (MsgRegisterNextEpochResponse); +} + +message MsgRegisterSigner { + Signer signer = 1; + bytes signature = 2; +} + +message MsgRegisterSignerResponse {} + +message MsgUpdateSocket { + string account = 1; + string socket = 2; +} + +message MsgUpdateSocketResponse {} + +message MsgRegisterNextEpoch { + string account = 1; + bytes signature = 2; +} + +message MsgRegisterNextEpochResponse {} diff --git a/tests/e2e/runner/kvtool.go b/tests/e2e/runner/kvtool.go index a6f46096..a7a2e355 100644 --- a/tests/e2e/runner/kvtool.go +++ b/tests/e2e/runner/kvtool.go @@ -13,7 +13,7 @@ type KvtoolRunnerConfig struct { ImageTag string IncludeIBC bool - EnableAutomatedUpgrade bool + EnableAutomatedUpgrade bool ZgChainUpgradeName string ZgChainUpgradeHeight int64 ZgChainUpgradeBaseImageTag string diff --git a/tests/e2e/testutil/account.go b/tests/e2e/testutil/account.go index 65e8122e..95025afd 100644 --- a/tests/e2e/testutil/account.go +++ b/tests/e2e/testutil/account.go @@ -142,8 +142,8 @@ func (chain *Chain) AddNewSigningAccountFromPrivKey( evmResChan: evmResChan, zgChainSigner: zgChainSigner, - sdkReqChan: sdkReqChan, - sdkResChan: sdkResChan, + sdkReqChan: sdkReqChan, + sdkResChan: sdkResChan, EvmAuth: evmSigner.Auth, diff --git a/x/dasigners/v1/client/cli/query.go b/x/dasigners/v1/client/cli/query.go new file mode 100644 index 00000000..6561bb51 --- /dev/null +++ b/x/dasigners/v1/client/cli/query.go @@ -0,0 +1,57 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/spf13/cobra" + + "github.com/0glabs/0g-chain/x/dasigners/v1/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" +) + +// GetQueryCmd returns the cli query commands for the inflation module. +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the dasigners module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + GetEpochNumber(), + ) + + return cmd +} + +func GetEpochNumber() *cobra.Command { + cmd := &cobra.Command{ + Use: "epoch-number", + Short: "Query current epoch number", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryEpochNumberRequest{} + res, err := queryClient.EpochNumber(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintString(fmt.Sprintf("%v\n", res.EpochNumber)) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/dasigners/v1/client/cli/tx.go b/x/dasigners/v1/client/cli/tx.go new file mode 100644 index 00000000..0bfd045b --- /dev/null +++ b/x/dasigners/v1/client/cli/tx.go @@ -0,0 +1,22 @@ +package cli + +import ( + "fmt" + + "github.com/0glabs/0g-chain/x/das/v1/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + cmd.AddCommand() + return cmd +} diff --git a/x/dasigners/v1/genesis.go b/x/dasigners/v1/genesis.go new file mode 100644 index 00000000..64354d00 --- /dev/null +++ b/x/dasigners/v1/genesis.go @@ -0,0 +1,50 @@ +package dasigners + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/0glabs/0g-chain/x/dasigners/v1/keeper" + "github.com/0glabs/0g-chain/x/dasigners/v1/types" +) + +// InitGenesis initializes the store state from a genesis state. +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, gs types.GenesisState) { + if err := gs.Validate(); err != nil { + panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) + } + keeper.SetEpochNumber(ctx, gs.EpochNumber) + for _, signer := range gs.Signers { + if err := keeper.SetSigner(ctx, *signer); err != nil { + panic(fmt.Sprintf("failed to write genesis state into store: %s", err)) + } + } + for epoch, signers := range gs.SignersByEpoch { + keeper.SetEpochSignerSet(ctx, uint64(epoch), *signers) + } + keeper.SetParams(ctx, gs.Params) +} + +// ExportGenesis returns a GenesisState for a given context and keeper. +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { + params := keeper.GetParams(ctx) + epochNumber, err := keeper.GetEpochNumber(ctx) + if err != nil { + panic(err) + } + signers := make([]*types.Signer, 0) + keeper.IterateSigners(ctx, func(_ int64, signer types.Signer) (stop bool) { + signers = append(signers, &signer) + return false + }) + epochSignerSets := make([]*types.EpochSignerSet, 0) + for i := 0; i < int(epochNumber); i += 1 { + epochSignerSet, found := keeper.GetEpochSignerSet(ctx, uint64(i)) + if !found { + panic("historical epoch signer set not found") + } + epochSignerSets = append(epochSignerSets, &epochSignerSet) + } + return types.NewGenesisState(params, epochNumber, signers, epochSignerSets) +} diff --git a/x/dasigners/v1/keeper/abci.go b/x/dasigners/v1/keeper/abci.go new file mode 100644 index 00000000..bff45f85 --- /dev/null +++ b/x/dasigners/v1/keeper/abci.go @@ -0,0 +1,88 @@ +package keeper + +import ( + "bytes" + "math/big" + "sort" + + "github.com/0glabs/0g-chain/x/dasigners/v1/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/crypto" + abci "github.com/tendermint/tendermint/abci/types" +) + +type Ballot struct { + account string + content []byte +} + +func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + epochNumber, err := k.GetEpochNumber(ctx) + if err != nil { + k.Logger(ctx).Error("[BeginBlock] cannot get epoch number") + panic(err) + } + params := k.GetParams(ctx) + expectedEpoch := uint64(ctx.BlockHeight()) / params.EpochBlocks + if expectedEpoch == epochNumber { + return + } + if expectedEpoch > epochNumber+1 || expectedEpoch < epochNumber { + panic("block height is not continuous") + } + // new epoch + registrations := []Ballot{} + k.IterateRegistrations(ctx, expectedEpoch, func(account string, signature []byte) (stop bool) { + registrations = append(registrations, Ballot{ + account: account, + content: signature, + }) + return false + }) + ballots := []Ballot{} + tokensPerVote, ok := sdk.NewIntFromString(params.TokensPerVote) + if !ok { + panic("failed to load params tokens_per_vote") + } + for _, registration := range registrations { + // get validator + valAddr, err := sdk.ValAddressFromHex(registration.account) + if err != nil { + k.Logger(ctx).Error("[BeginBlock] invalid account") + continue + } + validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) + if !found { + continue + } + num := validator.Tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(tokensPerVote).Abs().BigInt() + if num.Cmp(big.NewInt(int64(params.MaxVotes))) > 0 { + num = big.NewInt(int64(params.MaxVotes)) + } + content := registration.content + ballotNum := num.Int64() + for j := 0; j < int(ballotNum); j += 1 { + ballots = append(ballots, Ballot{ + account: registration.account, + content: content, + }) + content = crypto.Keccak256(content) + } + } + sort.Slice(ballots, func(i, j int) bool { + return bytes.Compare(ballots[i].content, ballots[j].content) < 0 + }) + chosen := make(map[string]struct{}) + epochSignerSet := types.EpochSignerSet{ + Signers: make([]string, 0), + } + for _, ballot := range ballots { + if _, ok := chosen[ballot.account]; !ok { + chosen[ballot.account] = struct{}{} + epochSignerSet.Signers = append(epochSignerSet.Signers, ballot.account) + } + } + // save to store + k.SetEpochSignerSet(ctx, expectedEpoch, epochSignerSet) + k.SetEpochNumber(ctx, expectedEpoch) +} diff --git a/x/dasigners/v1/keeper/grpc_query.go b/x/dasigners/v1/keeper/grpc_query.go new file mode 100644 index 00000000..51ed5c7e --- /dev/null +++ b/x/dasigners/v1/keeper/grpc_query.go @@ -0,0 +1,88 @@ +package keeper + +import ( + "context" + + "github.com/0glabs/0g-chain/crypto/bn254util" + "github.com/0glabs/0g-chain/x/dasigners/v1/types" + "github.com/consensys/gnark-crypto/ecc/bn254" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ types.QueryServer = Keeper{} + +func (k Keeper) Signer( + c context.Context, + req *types.QuerySignerRequest, +) (*types.QuerySignerResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + signer, found, err := k.GetSigner(ctx, req.Account) + if err != nil { + return nil, err + } + if !found { + return nil, nil + } + return &types.QuerySignerResponse{Signer: &signer}, nil +} + +func (k Keeper) EpochNumber( + c context.Context, + _ *types.QueryEpochNumberRequest, +) (*types.QueryEpochNumberResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + epochNumber, err := k.GetEpochNumber(ctx) + if err != nil { + return nil, err + } + return &types.QueryEpochNumberResponse{EpochNumber: epochNumber}, nil +} + +func (k Keeper) EpochSignerSet(c context.Context, request *types.QueryEpochSignerSetRequest) (*types.QueryEpochSignerSetResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + epochSignerSet := make([]*types.Signer, 0) + signers, found := k.GetEpochSignerSet(ctx, request.EpochNumber) + if !found { + return &types.QueryEpochSignerSetResponse{Signers: epochSignerSet}, nil + } + for _, account := range signers.Signers { + signer, found, err := k.GetSigner(ctx, account) + if err != nil { + return nil, err + } + if !found { + return nil, types.ErrSignerNotFound + } + epochSignerSet = append(epochSignerSet, &signer) + } + return &types.QueryEpochSignerSetResponse{Signers: epochSignerSet}, nil +} + +func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggregatePubkeyG1Request) (*types.QueryAggregatePubkeyG1Response, error) { + ctx := sdk.UnwrapSDKContext(c) + signers, found := k.GetEpochSignerSet(ctx, request.EpochNumber) + if !found { + return nil, types.ErrEpochSignerSetNotFound + } + if len(request.SignersBitmap) != (len(signers.Signers)+7)/8 { + return nil, types.ErrSignerLengthNotMatch + } + aggPubkeyG1 := new(bn254.G1Affine) + for i, account := range signers.Signers { + b := request.SignersBitmap[i/8] & (1 << (i % 8)) + if b == 0 { + continue + } + signer, found, err := k.GetSigner(ctx, account) + if err != nil { + return nil, err + } + if !found { + return nil, types.ErrSignerNotFound + } + aggPubkeyG1.Add(aggPubkeyG1, bn254util.DeserializeG1(signer.PubkeyG1)) + } + return &types.QueryAggregatePubkeyG1Response{ + AggregatePubkeyG1: bn254util.SerializeG1(aggPubkeyG1), + }, nil +} diff --git a/x/dasigners/v1/keeper/keeper.go b/x/dasigners/v1/keeper/keeper.go new file mode 100644 index 00000000..dad48038 --- /dev/null +++ b/x/dasigners/v1/keeper/keeper.go @@ -0,0 +1,181 @@ +package keeper + +import ( + "encoding/hex" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/libs/log" + + "github.com/0glabs/0g-chain/x/dasigners/v1/types" +) + +type Keeper struct { + storeKey storetypes.StoreKey + cdc codec.BinaryCodec + stakingKeeper types.StakingKeeper +} + +// NewKeeper creates a new das Keeper instance +func NewKeeper( + storeKey storetypes.StoreKey, + cdc codec.BinaryCodec, + stakingKeeper types.StakingKeeper, +) Keeper { + return Keeper{ + storeKey: storeKey, + cdc: cdc, + stakingKeeper: stakingKeeper, + } +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", "x/"+types.ModuleName) +} + +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + var params types.Params + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) +} + +func (k Keeper) GetEpochNumber(ctx sdk.Context) (uint64, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.EpochNumberKey) + if bz == nil { + return 0, types.ErrEpochNumberNotSet + } + return sdk.BigEndianToUint64(bz), nil +} + +func (k Keeper) SetEpochNumber(ctx sdk.Context, epoch uint64) { + store := ctx.KVStore(k.storeKey) + store.Set(types.EpochNumberKey, sdk.Uint64ToBigEndian(epoch)) +} + +func (k Keeper) GetSigner(ctx sdk.Context, account string) (types.Signer, bool, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.SignerKeyPrefix) + key, err := types.GetSignerKeyFromAccount(account) + if err != nil { + return types.Signer{}, false, err + } + bz := store.Get(key) + if bz == nil { + return types.Signer{}, false, nil + } + var signer types.Signer + k.cdc.MustUnmarshal(bz, &signer) + return signer, true, nil +} + +func (k Keeper) SetSigner(ctx sdk.Context, signer types.Signer) error { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.SignerKeyPrefix) + bz := k.cdc.MustMarshal(&signer) + key, err := types.GetSignerKeyFromAccount(signer.Account) + if err != nil { + return err + } + store.Set(key, bz) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeUpdateSigner, + sdk.NewAttribute(types.AttributeKeySigner, signer.Account), + sdk.NewAttribute(types.AttributeKeySocket, signer.Socket), + sdk.NewAttribute(types.AttributeKeyPublicKeyG1, hex.EncodeToString(signer.PubkeyG1)), + sdk.NewAttribute(types.AttributeKeyPublicKeyG2, hex.EncodeToString(signer.PubkeyG2)), + ), + ) + return nil +} + +// iterate through the signers set and perform the provided function +func (k Keeper) IterateSigners(ctx sdk.Context, fn func(index int64, signer types.Signer) (stop bool)) { + store := ctx.KVStore(k.storeKey) + + iterator := sdk.KVStorePrefixIterator(store, types.SignerKeyPrefix) + defer iterator.Close() + + i := int64(0) + + for ; iterator.Valid(); iterator.Next() { + var signer types.Signer + k.cdc.MustUnmarshal(iterator.Value(), &signer) + stop := fn(i, signer) + + if stop { + break + } + i++ + } +} + +func (k Keeper) GetEpochSignerSet(ctx sdk.Context, epoch uint64) (types.EpochSignerSet, bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.SignerKeyPrefix) + bz := store.Get(types.GetEpochSignerSetKeyFromEpoch(epoch)) + if bz == nil { + return types.EpochSignerSet{}, false + } + var signers types.EpochSignerSet + k.cdc.MustUnmarshal(bz, &signers) + return signers, true +} + +func (k Keeper) SetEpochSignerSet(ctx sdk.Context, epoch uint64, signers types.EpochSignerSet) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.EpochSignerSetKeyPrefix) + bz := k.cdc.MustMarshal(&signers) + store.Set(types.GetEpochSignerSetKeyFromEpoch(epoch), bz) +} + +func (k Keeper) GetRegistration(ctx sdk.Context, epoch uint64, account string) ([]byte, bool, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetEpochRegistrationKeyPrefix(epoch)) + key, err := types.GetRegistrationKey(account) + if err != nil { + return nil, false, err + } + signature := store.Get(key) + if signature == nil { + return nil, false, nil + } + return signature, true, nil +} + +// iterate through the registrations set and perform the provided function +func (k Keeper) IterateRegistrations(ctx sdk.Context, epoch uint64, fn func(account string, signature []byte) (stop bool)) { + store := ctx.KVStore(k.storeKey) + + iterator := sdk.KVStorePrefixIterator(store, types.GetEpochRegistrationKeyPrefix(epoch)) + defer iterator.Close() + + i := int64(0) + + for ; iterator.Valid(); iterator.Next() { + stop := fn(hex.EncodeToString(iterator.Key()), iterator.Value()) + + if stop { + break + } + i++ + } +} + +func (k Keeper) SetRegistration(ctx sdk.Context, epoch uint64, account string, signature []byte) error { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetEpochRegistrationKeyPrefix(epoch)) + key, err := types.GetRegistrationKey(account) + if err != nil { + return err + } + store.Set(key, signature) + return nil +} diff --git a/x/dasigners/v1/keeper/msg_server.go b/x/dasigners/v1/keeper/msg_server.go new file mode 100644 index 00000000..0c76fc28 --- /dev/null +++ b/x/dasigners/v1/keeper/msg_server.go @@ -0,0 +1,92 @@ +package keeper + +import ( + "context" + + "github.com/0glabs/0g-chain/crypto/bn254util" + "github.com/0glabs/0g-chain/x/dasigners/v1/types" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" + etherminttypes "github.com/evmos/ethermint/types" +) + +var _ types.MsgServer = &Keeper{} + +func (k Keeper) RegisterSigner(goCtx context.Context, msg *types.MsgRegisterSigner) (*types.MsgRegisterSignerResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + // validate sender + valAddr, err := sdk.ValAddressFromHex(msg.Signer.Account) + if err != nil { + return nil, err + } + _, found := k.stakingKeeper.GetValidator(ctx, valAddr) + if !found { + return nil, stakingtypes.ErrNoValidatorFound + } + _, found, err = k.GetSigner(ctx, msg.Signer.Account) + if err != nil { + return nil, err + } + if found { + return nil, types.ErrSignerExists + } + // validate signature + chainID, err := etherminttypes.ParseChainID(ctx.ChainID()) + if err != nil { + return nil, err + } + hash := types.PubkeyRegistrationHash(common.HexToAddress(msg.Signer.Account), chainID) + if !msg.Signer.ValidateSignature(hash, bn254util.DeserializeG1(msg.Signature)) { + return nil, types.ErrInvalidSignature + } + // save signer + if err := k.SetSigner(ctx, *msg.Signer); err != nil { + return nil, err + } + return &types.MsgRegisterSignerResponse{}, nil +} + +func (k Keeper) UpdateSocket(goCtx context.Context, msg *types.MsgUpdateSocket) (*types.MsgUpdateSocketResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + signer, found, err := k.GetSigner(ctx, msg.Account) + if err != nil { + return nil, err + } + if !found { + return nil, types.ErrSignerNotFound + } + signer.Socket = msg.Socket + if err := k.SetSigner(ctx, signer); err != nil { + return nil, err + } + return &types.MsgUpdateSocketResponse{}, nil +} + +func (k Keeper) RegisterNextEpoch(goCtx context.Context, msg *types.MsgRegisterNextEpoch) (*types.MsgRegisterNextEpochResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + // get signer + signer, found, err := k.GetSigner(ctx, msg.Account) + if err != nil { + return nil, err + } + if !found { + return nil, types.ErrSignerNotFound + } + // validate signature + epochNumber, err := k.GetEpochNumber(ctx) + if err != nil { + return nil, err + } + chainID, err := etherminttypes.ParseChainID(ctx.ChainID()) + if err != nil { + return nil, err + } + hash := types.EpochRegistrationHash(common.HexToAddress(msg.Account), epochNumber+1, chainID) + if !signer.ValidateSignature(hash, bn254util.DeserializeG1(msg.Signature)) { + return nil, types.ErrInvalidSignature + } + // save registration + k.SetRegistration(ctx, epochNumber+1, msg.Account, msg.Signature) + return &types.MsgRegisterNextEpochResponse{}, nil +} diff --git a/x/dasigners/v1/module.go b/x/dasigners/v1/module.go new file mode 100644 index 00000000..c5acc6e6 --- /dev/null +++ b/x/dasigners/v1/module.go @@ -0,0 +1,181 @@ +package dasigners + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/0glabs/0g-chain/x/dasigners/v1/client/cli" + "github.com/0glabs/0g-chain/x/dasigners/v1/keeper" + "github.com/0glabs/0g-chain/x/dasigners/v1/types" +) + +// consensusVersion defines the current x/council module consensus version. +const consensusVersion = 1 + +// type check to ensure the interface is properly implemented +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// app module Basics object +type AppModuleBasic struct{} + +// Name returns the inflation module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the inflation module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// ConsensusVersion returns the consensus state-breaking version for the module. +func (AppModuleBasic) ConsensusVersion() uint64 { + return consensusVersion +} + +// RegisterInterfaces registers interfaces and implementations of the incentives +// module. +func (AppModuleBasic) RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(interfaceRegistry) +} + +// DefaultGenesis returns default genesis state as raw bytes for the incentives +// module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis performs genesis state validation for the inflation module. +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var genesisState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return genesisState.Validate() +} + +// RegisterRESTRoutes performs a no-op as the inflation module doesn't expose REST +// endpoints +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the inflation module. +func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil { + panic(err) + } +} + +// GetTxCmd returns the root tx command for the inflation module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns no root query command for the inflation module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ___________________________________________________________________________ + +// AppModule implements an application module for the inflation module. +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper + sk stakingkeeper.Keeper +} + +// NewAppModule creates a new AppModule Object +func NewAppModule( + k keeper.Keeper, + sk stakingkeeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{}, + keeper: k, + sk: sk, + } +} + +// Name returns the inflation module's name. +func (AppModule) Name() string { + return types.ModuleName +} + +// Route returns dasigners module's message route. +func (am AppModule) Route() sdk.Route { return sdk.Route{} } + +// QuerierRoute returns dasigners module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// LegacyQuerierHandler returns dasigners module's Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +// RegisterInvariants registers the inflation module invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// RegisterServices registers a gRPC query service to respond to the +// module-specific gRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), am.keeper) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { + am.keeper.BeginBlock(ctx, req) +} + +func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { + // am.keeper.EndBlock(ctx, req) + return []abci.ValidatorUpdate{} +} + +// InitGenesis performs genesis initialization for the inflation module. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + + cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, genesisState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the exported genesis state as raw bytes for the inflation +// module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(gs) +} + +// ___________________________________________________________________________ + +// AppModuleSimulation functions + +// GenerateGenesisState creates a randomized GenState of the inflation module. +func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { +} + +// RegisterStoreDecoder registers a decoder for inflation module's types. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { +} + +// WeightedOperations doesn't return any inflation module operation. +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { + return []simtypes.WeightedOperation{} +} diff --git a/x/dasigners/v1/types/codec.go b/x/dasigners/v1/types/codec.go new file mode 100644 index 00000000..778dc76b --- /dev/null +++ b/x/dasigners/v1/types/codec.go @@ -0,0 +1,44 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +var ( + amino = codec.NewLegacyAmino() + // ModuleCdc references the global evm module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding. + ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + + // AminoCdc is a amino codec created to support amino JSON compatible msgs. + AminoCdc = codec.NewAminoCodec(amino) +) + +const ( +// Amino names +) + +// NOTE: This is required for the GetSignBytes function +func init() { + RegisterLegacyAminoCodec(amino) + amino.Seal() +} + +// RegisterInterfaces register implementations +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgRegisterSigner{}, + &MsgUpdateSocket{}, + &MsgRegisterNextEpoch{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +// RegisterLegacyAminoCodec required for EIP-712 +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +} diff --git a/x/dasigners/v1/types/dasigners.pb.go b/x/dasigners/v1/types/dasigners.pb.go new file mode 100644 index 00000000..8310ff9c --- /dev/null +++ b/x/dasigners/v1/types/dasigners.pb.go @@ -0,0 +1,626 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zgc/dasigners/v1/dasigners.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/protobuf/types/known/durationpb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Signer struct { + // account defines the hex address of signer without 0x + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + // socket defines the da node socket address + Socket string `protobuf:"bytes,2,opt,name=socket,proto3" json:"socket,omitempty"` + // pubkey_g1 defines the public key on bn254 G1 + PubkeyG1 []byte `protobuf:"bytes,3,opt,name=pubkey_g1,json=pubkeyG1,proto3" json:"pubkey_g1,omitempty"` + // pubkey_g1 defines the public key on bn254 G2 + PubkeyG2 []byte `protobuf:"bytes,4,opt,name=pubkey_g2,json=pubkeyG2,proto3" json:"pubkey_g2,omitempty"` +} + +func (m *Signer) Reset() { *m = Signer{} } +func (m *Signer) String() string { return proto.CompactTextString(m) } +func (*Signer) ProtoMessage() {} +func (*Signer) Descriptor() ([]byte, []int) { + return fileDescriptor_b7328dc8ffac059e, []int{0} +} +func (m *Signer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Signer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Signer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Signer) XXX_Merge(src proto.Message) { + xxx_messageInfo_Signer.Merge(m, src) +} +func (m *Signer) XXX_Size() int { + return m.Size() +} +func (m *Signer) XXX_DiscardUnknown() { + xxx_messageInfo_Signer.DiscardUnknown(m) +} + +var xxx_messageInfo_Signer proto.InternalMessageInfo + +type EpochSignerSet struct { + Signers []string `protobuf:"bytes,1,rep,name=signers,proto3" json:"signers,omitempty"` +} + +func (m *EpochSignerSet) Reset() { *m = EpochSignerSet{} } +func (m *EpochSignerSet) String() string { return proto.CompactTextString(m) } +func (*EpochSignerSet) ProtoMessage() {} +func (*EpochSignerSet) Descriptor() ([]byte, []int) { + return fileDescriptor_b7328dc8ffac059e, []int{1} +} +func (m *EpochSignerSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochSignerSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochSignerSet.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EpochSignerSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochSignerSet.Merge(m, src) +} +func (m *EpochSignerSet) XXX_Size() int { + return m.Size() +} +func (m *EpochSignerSet) XXX_DiscardUnknown() { + xxx_messageInfo_EpochSignerSet.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochSignerSet proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Signer)(nil), "zgc.dasigners.v1.Signer") + proto.RegisterType((*EpochSignerSet)(nil), "zgc.dasigners.v1.EpochSignerSet") +} + +func init() { proto.RegisterFile("zgc/dasigners/v1/dasigners.proto", fileDescriptor_b7328dc8ffac059e) } + +var fileDescriptor_b7328dc8ffac059e = []byte{ + // 287 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xc1, 0x4a, 0xc3, 0x30, + 0x1c, 0xc6, 0x1b, 0x27, 0xd3, 0x05, 0x11, 0x29, 0x22, 0xd9, 0x84, 0x50, 0x76, 0x1a, 0x82, 0xcd, + 0x3a, 0xdf, 0x40, 0x10, 0x4f, 0x5e, 0xb6, 0x9b, 0x97, 0x91, 0x66, 0x31, 0x2d, 0xdb, 0xfa, 0x2f, + 0x4d, 0x3a, 0xec, 0x9e, 0xc2, 0xc7, 0xda, 0x71, 0x47, 0x8f, 0xda, 0xbe, 0x88, 0xb4, 0xa9, 0xcc, + 0x79, 0xcb, 0xef, 0xfb, 0x05, 0x3e, 0xfe, 0x1f, 0xf6, 0xb6, 0x4a, 0xb0, 0x05, 0xd7, 0xb1, 0x4a, + 0x64, 0xa6, 0xd9, 0x26, 0x38, 0x80, 0x9f, 0x66, 0x60, 0xc0, 0xbd, 0xda, 0x2a, 0xe1, 0x1f, 0xc2, + 0x4d, 0x30, 0xe8, 0x0b, 0xd0, 0x6b, 0xd0, 0xf3, 0xc6, 0x33, 0x0b, 0xf6, 0xf3, 0xe0, 0x5a, 0x81, + 0x02, 0x9b, 0xd7, 0xaf, 0x36, 0xed, 0x2b, 0x00, 0xb5, 0x92, 0xac, 0xa1, 0x30, 0x7f, 0x63, 0x3c, + 0x29, 0x5a, 0x45, 0xff, 0xab, 0x45, 0x9e, 0x71, 0x13, 0x43, 0x62, 0xfd, 0xd0, 0xe0, 0xee, 0xac, + 0x69, 0x76, 0x09, 0x3e, 0xe3, 0x42, 0x40, 0x9e, 0x18, 0x82, 0x3c, 0x34, 0xea, 0x4d, 0x7f, 0xd1, + 0xbd, 0xc1, 0x5d, 0x0d, 0x62, 0x29, 0x0d, 0x39, 0x69, 0x44, 0x4b, 0xee, 0x2d, 0xee, 0xa5, 0x79, + 0xb8, 0x94, 0xc5, 0x5c, 0x05, 0xa4, 0xe3, 0xa1, 0xd1, 0xc5, 0xf4, 0xdc, 0x06, 0xcf, 0xc1, 0x5f, + 0x39, 0x21, 0xa7, 0x47, 0x72, 0x32, 0xbc, 0xc3, 0x97, 0x4f, 0x29, 0x88, 0xc8, 0x56, 0xcf, 0xa4, + 0xa9, 0xdb, 0xdb, 0x05, 0x08, 0xf2, 0x3a, 0x75, 0x7b, 0x8b, 0x8f, 0x2f, 0xbb, 0x6f, 0xea, 0xec, + 0x4a, 0x8a, 0xf6, 0x25, 0x45, 0x5f, 0x25, 0x45, 0x1f, 0x15, 0x75, 0xf6, 0x15, 0x75, 0x3e, 0x2b, + 0xea, 0xbc, 0x32, 0x15, 0x9b, 0x28, 0x0f, 0x7d, 0x01, 0x6b, 0x36, 0x56, 0x2b, 0x1e, 0x6a, 0x36, + 0x56, 0xf7, 0x22, 0xe2, 0x71, 0xc2, 0xde, 0x8f, 0x87, 0x37, 0x45, 0x2a, 0x75, 0xd8, 0x6d, 0xee, + 0x7e, 0xf8, 0x09, 0x00, 0x00, 0xff, 0xff, 0x77, 0x51, 0x09, 0xd9, 0x99, 0x01, 0x00, 0x00, +} + +func (m *Signer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Signer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Signer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PubkeyG2) > 0 { + i -= len(m.PubkeyG2) + copy(dAtA[i:], m.PubkeyG2) + i = encodeVarintDasigners(dAtA, i, uint64(len(m.PubkeyG2))) + i-- + dAtA[i] = 0x22 + } + if len(m.PubkeyG1) > 0 { + i -= len(m.PubkeyG1) + copy(dAtA[i:], m.PubkeyG1) + i = encodeVarintDasigners(dAtA, i, uint64(len(m.PubkeyG1))) + i-- + dAtA[i] = 0x1a + } + if len(m.Socket) > 0 { + i -= len(m.Socket) + copy(dAtA[i:], m.Socket) + i = encodeVarintDasigners(dAtA, i, uint64(len(m.Socket))) + i-- + dAtA[i] = 0x12 + } + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintDasigners(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EpochSignerSet) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EpochSignerSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochSignerSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signers) > 0 { + for iNdEx := len(m.Signers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Signers[iNdEx]) + copy(dAtA[i:], m.Signers[iNdEx]) + i = encodeVarintDasigners(dAtA, i, uint64(len(m.Signers[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintDasigners(dAtA []byte, offset int, v uint64) int { + offset -= sovDasigners(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Signer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovDasigners(uint64(l)) + } + l = len(m.Socket) + if l > 0 { + n += 1 + l + sovDasigners(uint64(l)) + } + l = len(m.PubkeyG1) + if l > 0 { + n += 1 + l + sovDasigners(uint64(l)) + } + l = len(m.PubkeyG2) + if l > 0 { + n += 1 + l + sovDasigners(uint64(l)) + } + return n +} + +func (m *EpochSignerSet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Signers) > 0 { + for _, s := range m.Signers { + l = len(s) + n += 1 + l + sovDasigners(uint64(l)) + } + } + return n +} + +func sovDasigners(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDasigners(x uint64) (n int) { + return sovDasigners(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Signer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Signer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Signer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDasigners + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDasigners + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Socket", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDasigners + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDasigners + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Socket = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubkeyG1", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDasigners + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDasigners + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubkeyG1 = append(m.PubkeyG1[:0], dAtA[iNdEx:postIndex]...) + if m.PubkeyG1 == nil { + m.PubkeyG1 = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubkeyG2", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDasigners + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDasigners + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubkeyG2 = append(m.PubkeyG2[:0], dAtA[iNdEx:postIndex]...) + if m.PubkeyG2 == nil { + m.PubkeyG2 = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDasigners(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDasigners + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EpochSignerSet) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EpochSignerSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochSignerSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signers", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDasigners + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDasigners + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signers = append(m.Signers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDasigners(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDasigners + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDasigners(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDasigners + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDasigners + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDasigners + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthDasigners + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDasigners + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDasigners + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDasigners = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDasigners = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDasigners = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dasigners/v1/types/errors.go b/x/dasigners/v1/types/errors.go new file mode 100644 index 00000000..f2d5d88f --- /dev/null +++ b/x/dasigners/v1/types/errors.go @@ -0,0 +1,12 @@ +package types + +import errorsmod "cosmossdk.io/errors" + +var ( + ErrSignerExists = errorsmod.Register(ModuleName, 1, "signer exists") + ErrEpochNumberNotSet = errorsmod.Register(ModuleName, 2, "epoch number not set") + ErrSignerNotFound = errorsmod.Register(ModuleName, 3, "signer not found") + ErrInvalidSignature = errorsmod.Register(ModuleName, 4, "invalid signature") + ErrEpochSignerSetNotFound = errorsmod.Register(ModuleName, 5, "signer set for epoch not found") + ErrSignerLengthNotMatch = errorsmod.Register(ModuleName, 6, "signer set length not match") +) diff --git a/x/dasigners/v1/types/events.go b/x/dasigners/v1/types/events.go new file mode 100644 index 00000000..00927dae --- /dev/null +++ b/x/dasigners/v1/types/events.go @@ -0,0 +1,11 @@ +package types + +// Module event types +const ( + EventTypeUpdateSigner = "update_signer" + + AttributeKeySigner = "signer" + AttributeKeySocket = "socket" + AttributeKeyPublicKeyG1 = "pubkey_g1" + AttributeKeyPublicKeyG2 = "pubkey_g2" +) diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go new file mode 100644 index 00000000..423fa102 --- /dev/null +++ b/x/dasigners/v1/types/genesis.go @@ -0,0 +1,48 @@ +package types + +import "fmt" + +// NewGenesisState returns a new genesis state object for the module. +func NewGenesisState(params Params, epoch uint64, signers []*Signer, signersByEpoch []*EpochSignerSet) *GenesisState { + return &GenesisState{ + Params: params, + EpochNumber: epoch, + Signers: signers, + SignersByEpoch: signersByEpoch, + } +} + +// DefaultGenesisState returns the default genesis state for the module. +func DefaultGenesisState() *GenesisState { + return NewGenesisState(Params{ + QuorumSize: 1024, + TokensPerVote: "1000", + MaxVotes: 100, + EpochBlocks: 5, + }, 0, make([]*Signer, 0), make([]*EpochSignerSet, 0)) +} + +// Validate performs basic validation of genesis data. +func (gs GenesisState) Validate() error { + registered := make(map[string]struct{}) + for _, signer := range gs.Signers { + if err := signer.Validate(); err != nil { + return err + } + registered[signer.Account] = struct{}{} + } + if len(gs.SignersByEpoch) != int(gs.EpochNumber) { + return fmt.Errorf("epoch history missing") + } + for _, signers := range gs.SignersByEpoch { + for _, signer := range signers.Signers { + if err := ValidateHexAddress(signer); err != nil { + return err + } + if _, ok := registered[signer]; !ok { + return fmt.Errorf("historical signer detail missing") + } + } + } + return nil +} diff --git a/x/dasigners/v1/types/genesis.pb.go b/x/dasigners/v1/types/genesis.pb.go new file mode 100644 index 00000000..0564b2c4 --- /dev/null +++ b/x/dasigners/v1/types/genesis.pb.go @@ -0,0 +1,775 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zgc/dasigners/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Params struct { + QuorumSize uint64 `protobuf:"varint,1,opt,name=quorum_size,json=quorumSize,proto3" json:"quorum_size,omitempty"` + TokensPerVote string `protobuf:"bytes,2,opt,name=tokens_per_vote,json=tokensPerVote,proto3" json:"tokens_per_vote,omitempty"` + MaxVotes uint64 `protobuf:"varint,3,opt,name=max_votes,json=maxVotes,proto3" json:"max_votes,omitempty"` + EpochBlocks uint64 `protobuf:"varint,4,opt,name=epoch_blocks,json=epochBlocks,proto3" json:"epoch_blocks,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_896efa766aaca3be, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetQuorumSize() uint64 { + if m != nil { + return m.QuorumSize + } + return 0 +} + +func (m *Params) GetTokensPerVote() string { + if m != nil { + return m.TokensPerVote + } + return "" +} + +func (m *Params) GetMaxVotes() uint64 { + if m != nil { + return m.MaxVotes + } + return 0 +} + +func (m *Params) GetEpochBlocks() uint64 { + if m != nil { + return m.EpochBlocks + } + return 0 +} + +// GenesisState defines the dasigners module's genesis state. +type GenesisState struct { + // params defines all the parameters of related to deposit. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // params epoch_number the epoch number + EpochNumber uint64 `protobuf:"varint,2,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + // signers defines all signers information + Signers []*Signer `protobuf:"bytes,3,rep,name=signers,proto3" json:"signers,omitempty"` + // signers_by_epoch defines chosen signers by epoch + SignersByEpoch []*EpochSignerSet `protobuf:"bytes,4,rep,name=signers_by_epoch,json=signersByEpoch,proto3" json:"signers_by_epoch,omitempty"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_896efa766aaca3be, []int{1} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetEpochNumber() uint64 { + if m != nil { + return m.EpochNumber + } + return 0 +} + +func (m *GenesisState) GetSigners() []*Signer { + if m != nil { + return m.Signers + } + return nil +} + +func (m *GenesisState) GetSignersByEpoch() []*EpochSignerSet { + if m != nil { + return m.SignersByEpoch + } + return nil +} + +func init() { + proto.RegisterType((*Params)(nil), "zgc.dasigners.v1.Params") + proto.RegisterType((*GenesisState)(nil), "zgc.dasigners.v1.GenesisState") +} + +func init() { proto.RegisterFile("zgc/dasigners/v1/genesis.proto", fileDescriptor_896efa766aaca3be) } + +var fileDescriptor_896efa766aaca3be = []byte{ + // 415 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x6e, 0xd3, 0x30, + 0x1c, 0xc6, 0x6b, 0x1a, 0x15, 0xe6, 0x0e, 0x98, 0x2c, 0x0e, 0xd9, 0x90, 0xd2, 0xb0, 0x03, 0xda, + 0x85, 0x78, 0x1b, 0x12, 0x0f, 0x10, 0x09, 0x21, 0x38, 0xa0, 0x29, 0x91, 0x38, 0x70, 0x89, 0x9c, + 0xf0, 0xc7, 0x8d, 0x56, 0xc7, 0x21, 0x76, 0xaa, 0x26, 0x4f, 0x01, 0x6f, 0xb5, 0xe3, 0x8e, 0x9c, + 0x10, 0x6a, 0x4f, 0xbc, 0x05, 0xea, 0xdf, 0x19, 0x13, 0xeb, 0x6e, 0x7f, 0x7f, 0xbf, 0xcf, 0x9f, + 0x3f, 0xdb, 0x34, 0xe8, 0x65, 0xc1, 0xbf, 0x08, 0x53, 0xca, 0x0a, 0x1a, 0xc3, 0x97, 0x67, 0x5c, + 0x42, 0x05, 0xa6, 0x34, 0x51, 0xdd, 0x68, 0xab, 0xd9, 0x41, 0x2f, 0x8b, 0xe8, 0x1f, 0x8f, 0x96, + 0x67, 0x47, 0x87, 0x85, 0x36, 0x4a, 0x9b, 0x0c, 0x39, 0x77, 0x0b, 0x67, 0x3e, 0x7a, 0x26, 0xb5, + 0xd4, 0x4e, 0xdf, 0x4e, 0x83, 0x7a, 0x28, 0xb5, 0x96, 0x0b, 0xe0, 0xb8, 0xca, 0xdb, 0xaf, 0x5c, + 0x54, 0xdd, 0x80, 0x66, 0x77, 0x91, 0x2d, 0x15, 0x18, 0x2b, 0x54, 0x3d, 0x18, 0xc2, 0x9d, 0x7a, + 0xb7, 0x5d, 0xd0, 0x71, 0xfc, 0x83, 0xd0, 0xc9, 0x85, 0x68, 0x84, 0x32, 0x6c, 0x46, 0xa7, 0xdf, + 0x5a, 0xdd, 0xb4, 0x2a, 0x33, 0x65, 0x0f, 0x3e, 0x09, 0xc9, 0x89, 0x97, 0x50, 0x27, 0xa5, 0x65, + 0x0f, 0xec, 0x25, 0x7d, 0x6a, 0xf5, 0x25, 0x54, 0x26, 0xab, 0xa1, 0xc9, 0x96, 0xda, 0x82, 0xff, + 0x20, 0x24, 0x27, 0x7b, 0xc9, 0x63, 0x27, 0x5f, 0x40, 0xf3, 0x49, 0x5b, 0x60, 0xcf, 0xe9, 0x9e, + 0x12, 0x2b, 0x34, 0x18, 0x7f, 0x8c, 0x31, 0x8f, 0x94, 0x58, 0x6d, 0x99, 0x61, 0x2f, 0xe8, 0x3e, + 0xd4, 0xba, 0x98, 0x67, 0xf9, 0x42, 0x17, 0x97, 0xc6, 0xf7, 0x90, 0x4f, 0x51, 0x8b, 0x51, 0x3a, + 0xfe, 0x43, 0xe8, 0xfe, 0x3b, 0xf7, 0x8c, 0xa9, 0x15, 0x16, 0xd8, 0x1b, 0x3a, 0xa9, 0xb1, 0x23, + 0x96, 0x9a, 0x9e, 0xfb, 0xd1, 0xdd, 0x67, 0x8d, 0xdc, 0x1d, 0x62, 0xef, 0xea, 0xd7, 0x6c, 0x94, + 0x0c, 0xee, 0xdb, 0xb3, 0xaa, 0x56, 0xe5, 0xd0, 0x60, 0xdb, 0x9b, 0xb3, 0x3e, 0xa2, 0xc4, 0xce, + 0xe9, 0xc3, 0x21, 0xc5, 0x1f, 0x87, 0xe3, 0xfb, 0xb3, 0x53, 0x1c, 0x93, 0x1b, 0x23, 0xfb, 0x40, + 0x0f, 0x86, 0x31, 0xcb, 0xbb, 0x0c, 0xd3, 0x7c, 0x0f, 0x37, 0x87, 0xbb, 0x9b, 0xdf, 0x6e, 0xb1, + 0x4b, 0x48, 0xc1, 0x26, 0x4f, 0x06, 0x14, 0x77, 0x08, 0xe2, 0xf7, 0x57, 0xeb, 0x80, 0x5c, 0xaf, + 0x03, 0xf2, 0x7b, 0x1d, 0x90, 0xef, 0x9b, 0x60, 0x74, 0xbd, 0x09, 0x46, 0x3f, 0x37, 0xc1, 0xe8, + 0x33, 0x97, 0xa5, 0x9d, 0xb7, 0x79, 0x54, 0x68, 0xc5, 0x4f, 0xe5, 0x42, 0xe4, 0x86, 0x9f, 0xca, + 0x57, 0xc5, 0x5c, 0x94, 0x15, 0x5f, 0xfd, 0xff, 0xa9, 0xb6, 0xab, 0xc1, 0xe4, 0x13, 0xfc, 0xd1, + 0xd7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x84, 0xf4, 0xab, 0x94, 0x02, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EpochBlocks != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.EpochBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.MaxVotes != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.MaxVotes)) + i-- + dAtA[i] = 0x18 + } + if len(m.TokensPerVote) > 0 { + i -= len(m.TokensPerVote) + copy(dAtA[i:], m.TokensPerVote) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.TokensPerVote))) + i-- + dAtA[i] = 0x12 + } + if m.QuorumSize != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.QuorumSize)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SignersByEpoch) > 0 { + for iNdEx := len(m.SignersByEpoch) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SignersByEpoch[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Signers) > 0 { + for iNdEx := len(m.Signers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.EpochNumber != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.QuorumSize != 0 { + n += 1 + sovGenesis(uint64(m.QuorumSize)) + } + l = len(m.TokensPerVote) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.MaxVotes != 0 { + n += 1 + sovGenesis(uint64(m.MaxVotes)) + } + if m.EpochBlocks != 0 { + n += 1 + sovGenesis(uint64(m.EpochBlocks)) + } + return n +} + +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if m.EpochNumber != 0 { + n += 1 + sovGenesis(uint64(m.EpochNumber)) + } + if len(m.Signers) > 0 { + for _, e := range m.Signers { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.SignersByEpoch) > 0 { + for _, e := range m.SignersByEpoch { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QuorumSize", wireType) + } + m.QuorumSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QuorumSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokensPerVote", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokensPerVote = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxVotes", wireType) + } + m.MaxVotes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxVotes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochBlocks", wireType) + } + m.EpochBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signers = append(m.Signers, &Signer{}) + if err := m.Signers[len(m.Signers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignersByEpoch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignersByEpoch = append(m.SignersByEpoch, &EpochSignerSet{}) + if err := m.SignersByEpoch[len(m.SignersByEpoch)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dasigners/v1/types/hash.go b/x/dasigners/v1/types/hash.go new file mode 100644 index 00000000..75e1cac8 --- /dev/null +++ b/x/dasigners/v1/types/hash.go @@ -0,0 +1,43 @@ +package types + +import ( + "math/big" + + "github.com/0glabs/0g-chain/crypto/bn254util" + "github.com/consensys/gnark-crypto/ecc/bn254" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func PubkeyRegistrationHash(operatorAddress common.Address, chainId *big.Int) *bn254.G1Affine { + toHash := make([]byte, 0) + toHash = append(toHash, operatorAddress.Bytes()...) + // make sure chainId is 32 bytes + toHash = append(toHash, common.LeftPadBytes(chainId.Bytes(), 32)...) + toHash = append(toHash, []byte("0G_BN254_Pubkey_Registration")...) + + msgHash := crypto.Keccak256(toHash) + // convert to [32]byte + var msgHash32 [32]byte + copy(msgHash32[:], msgHash) + + // hash to G1 + return bn254util.MapToCurve(msgHash32) +} + +func EpochRegistrationHash(operatorAddress common.Address, epoch uint64, chainId *big.Int) *bn254.G1Affine { + toHash := make([]byte, 0) + toHash = append(toHash, operatorAddress.Bytes()...) + toHash = append(toHash, sdk.Uint64ToBigEndian(epoch)...) + toHash = append(toHash, common.LeftPadBytes(chainId.Bytes(), 32)...) + + msgHash := crypto.Keccak256(toHash) + // convert to [32]byte + var msgHash32 [32]byte + copy(msgHash32[:], msgHash) + + // hash to G1 + return bn254util.MapToCurve(msgHash32) +} diff --git a/x/dasigners/v1/types/interfaces.go b/x/dasigners/v1/types/interfaces.go new file mode 100644 index 00000000..e7409261 --- /dev/null +++ b/x/dasigners/v1/types/interfaces.go @@ -0,0 +1,10 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +type StakingKeeper interface { + GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) +} diff --git a/x/dasigners/v1/types/keys.go b/x/dasigners/v1/types/keys.go new file mode 100644 index 00000000..47ad3b95 --- /dev/null +++ b/x/dasigners/v1/types/keys.go @@ -0,0 +1,45 @@ +package types + +import ( + "encoding/hex" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // ModuleName The name that will be used throughout the module + ModuleName = "da-signers" + + // StoreKey Top level store key where all module items will be stored + StoreKey = ModuleName + + // QuerierRoute Top level query string + QuerierRoute = ModuleName +) + +var ( + // prefix + SignerKeyPrefix = []byte{0x00} + EpochSignerSetKeyPrefix = []byte{0x01} + RegistrationKeyPrefix = []byte{0x02} + + // keys + ParamsKey = []byte{0x05} + EpochNumberKey = []byte{0x06} +) + +func GetSignerKeyFromAccount(account string) ([]byte, error) { + return hex.DecodeString(account) +} + +func GetEpochSignerSetKeyFromEpoch(epoch uint64) []byte { + return sdk.Uint64ToBigEndian(epoch) +} + +func GetEpochRegistrationKeyPrefix(epoch uint64) []byte { + return append(RegistrationKeyPrefix, sdk.Uint64ToBigEndian(epoch)...) +} + +func GetRegistrationKey(account string) ([]byte, error) { + return hex.DecodeString(account) +} diff --git a/x/dasigners/v1/types/msg.go b/x/dasigners/v1/types/msg.go new file mode 100644 index 00000000..6c234f3a --- /dev/null +++ b/x/dasigners/v1/types/msg.go @@ -0,0 +1,96 @@ +package types + +import ( + "encoding/hex" + fmt "fmt" + + "github.com/0glabs/0g-chain/crypto/bn254util" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _, _, _ sdk.Msg = &MsgRegisterSigner{}, &MsgUpdateSocket{}, &MsgRegisterNextEpoch{} + +// GetSigners returns the expected signers for a MsgRegister message. +func (msg *MsgRegisterSigner) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromHex(msg.Signer.Account) + if err != nil { + panic(err) + } + accAddr, err := sdk.AccAddressFromHexUnsafe(hex.EncodeToString(valAddr.Bytes())) + if err != nil { + panic(err) + } + return []sdk.AccAddress{accAddr} +} + +// ValidateBasic does a sanity check of the provided data +func (msg *MsgRegisterSigner) ValidateBasic() error { + if err := msg.Signer.Validate(); err != nil { + return err + } + if len(msg.Signature) != bn254util.G1PointSize { + return fmt.Errorf("invalid signature") + } + return nil +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgRegisterSigner) GetSignBytes() []byte { + return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgVote message. +func (msg *MsgUpdateSocket) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromHex(msg.Account) + if err != nil { + panic(err) + } + accAddr, err := sdk.AccAddressFromHexUnsafe(hex.EncodeToString(valAddr.Bytes())) + if err != nil { + panic(err) + } + return []sdk.AccAddress{accAddr} +} + +// ValidateBasic does a sanity check of the provided data +func (msg *MsgUpdateSocket) ValidateBasic() error { + if err := ValidateHexAddress(msg.Account); err != nil { + return err + } + return nil +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgUpdateSocket) GetSignBytes() []byte { + return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgVote message. +func (msg *MsgRegisterNextEpoch) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromHex(msg.Account) + if err != nil { + panic(err) + } + accAddr, err := sdk.AccAddressFromHexUnsafe(hex.EncodeToString(valAddr.Bytes())) + if err != nil { + panic(err) + } + return []sdk.AccAddress{accAddr} +} + +// ValidateBasic does a sanity check of the provided data +func (msg *MsgRegisterNextEpoch) ValidateBasic() error { + if err := ValidateHexAddress(msg.Account); err != nil { + return err + } + if len(msg.Signature) != bn254util.G1PointSize { + return fmt.Errorf("invalid signature") + } + return nil +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgRegisterNextEpoch) GetSignBytes() []byte { + return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg)) +} diff --git a/x/dasigners/v1/types/query.pb.go b/x/dasigners/v1/types/query.pb.go new file mode 100644 index 00000000..18418579 --- /dev/null +++ b/x/dasigners/v1/types/query.pb.go @@ -0,0 +1,1648 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zgc/dasigners/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type QuerySignerRequest struct { + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *QuerySignerRequest) Reset() { *m = QuerySignerRequest{} } +func (m *QuerySignerRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySignerRequest) ProtoMessage() {} +func (*QuerySignerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{0} +} +func (m *QuerySignerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySignerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySignerRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySignerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySignerRequest.Merge(m, src) +} +func (m *QuerySignerRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySignerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySignerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySignerRequest proto.InternalMessageInfo + +type QuerySignerResponse struct { + Signer *Signer `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *QuerySignerResponse) Reset() { *m = QuerySignerResponse{} } +func (m *QuerySignerResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySignerResponse) ProtoMessage() {} +func (*QuerySignerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{1} +} +func (m *QuerySignerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySignerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySignerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySignerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySignerResponse.Merge(m, src) +} +func (m *QuerySignerResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySignerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySignerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySignerResponse proto.InternalMessageInfo + +type QueryEpochNumberRequest struct { +} + +func (m *QueryEpochNumberRequest) Reset() { *m = QueryEpochNumberRequest{} } +func (m *QueryEpochNumberRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEpochNumberRequest) ProtoMessage() {} +func (*QueryEpochNumberRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{2} +} +func (m *QueryEpochNumberRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEpochNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEpochNumberRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryEpochNumberRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochNumberRequest.Merge(m, src) +} +func (m *QueryEpochNumberRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEpochNumberRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochNumberRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEpochNumberRequest proto.InternalMessageInfo + +type QueryEpochNumberResponse struct { + EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` +} + +func (m *QueryEpochNumberResponse) Reset() { *m = QueryEpochNumberResponse{} } +func (m *QueryEpochNumberResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEpochNumberResponse) ProtoMessage() {} +func (*QueryEpochNumberResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{3} +} +func (m *QueryEpochNumberResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEpochNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEpochNumberResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryEpochNumberResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochNumberResponse.Merge(m, src) +} +func (m *QueryEpochNumberResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEpochNumberResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochNumberResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEpochNumberResponse proto.InternalMessageInfo + +type QueryEpochSignerSetRequest struct { + EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` +} + +func (m *QueryEpochSignerSetRequest) Reset() { *m = QueryEpochSignerSetRequest{} } +func (m *QueryEpochSignerSetRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEpochSignerSetRequest) ProtoMessage() {} +func (*QueryEpochSignerSetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{4} +} +func (m *QueryEpochSignerSetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEpochSignerSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEpochSignerSetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryEpochSignerSetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochSignerSetRequest.Merge(m, src) +} +func (m *QueryEpochSignerSetRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEpochSignerSetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochSignerSetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEpochSignerSetRequest proto.InternalMessageInfo + +type QueryEpochSignerSetResponse struct { + Signers []*Signer `protobuf:"bytes,1,rep,name=signers,proto3" json:"signers,omitempty"` +} + +func (m *QueryEpochSignerSetResponse) Reset() { *m = QueryEpochSignerSetResponse{} } +func (m *QueryEpochSignerSetResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEpochSignerSetResponse) ProtoMessage() {} +func (*QueryEpochSignerSetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{5} +} +func (m *QueryEpochSignerSetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEpochSignerSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEpochSignerSetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryEpochSignerSetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochSignerSetResponse.Merge(m, src) +} +func (m *QueryEpochSignerSetResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEpochSignerSetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochSignerSetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEpochSignerSetResponse proto.InternalMessageInfo + +type QueryAggregatePubkeyG1Request struct { + EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + SignersBitmap []byte `protobuf:"bytes,2,opt,name=signersBitmap,proto3" json:"signersBitmap,omitempty"` +} + +func (m *QueryAggregatePubkeyG1Request) Reset() { *m = QueryAggregatePubkeyG1Request{} } +func (m *QueryAggregatePubkeyG1Request) String() string { return proto.CompactTextString(m) } +func (*QueryAggregatePubkeyG1Request) ProtoMessage() {} +func (*QueryAggregatePubkeyG1Request) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{6} +} +func (m *QueryAggregatePubkeyG1Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAggregatePubkeyG1Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAggregatePubkeyG1Request.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAggregatePubkeyG1Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAggregatePubkeyG1Request.Merge(m, src) +} +func (m *QueryAggregatePubkeyG1Request) XXX_Size() int { + return m.Size() +} +func (m *QueryAggregatePubkeyG1Request) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAggregatePubkeyG1Request.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAggregatePubkeyG1Request proto.InternalMessageInfo + +type QueryAggregatePubkeyG1Response struct { + AggregatePubkeyG1 []byte `protobuf:"bytes,1,opt,name=aggregate_pubkey_g1,json=aggregatePubkeyG1,proto3" json:"aggregate_pubkey_g1,omitempty"` +} + +func (m *QueryAggregatePubkeyG1Response) Reset() { *m = QueryAggregatePubkeyG1Response{} } +func (m *QueryAggregatePubkeyG1Response) String() string { return proto.CompactTextString(m) } +func (*QueryAggregatePubkeyG1Response) ProtoMessage() {} +func (*QueryAggregatePubkeyG1Response) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{7} +} +func (m *QueryAggregatePubkeyG1Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAggregatePubkeyG1Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAggregatePubkeyG1Response.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAggregatePubkeyG1Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAggregatePubkeyG1Response.Merge(m, src) +} +func (m *QueryAggregatePubkeyG1Response) XXX_Size() int { + return m.Size() +} +func (m *QueryAggregatePubkeyG1Response) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAggregatePubkeyG1Response.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAggregatePubkeyG1Response proto.InternalMessageInfo + +func init() { + proto.RegisterType((*QuerySignerRequest)(nil), "zgc.dasigners.v1.QuerySignerRequest") + proto.RegisterType((*QuerySignerResponse)(nil), "zgc.dasigners.v1.QuerySignerResponse") + proto.RegisterType((*QueryEpochNumberRequest)(nil), "zgc.dasigners.v1.QueryEpochNumberRequest") + proto.RegisterType((*QueryEpochNumberResponse)(nil), "zgc.dasigners.v1.QueryEpochNumberResponse") + proto.RegisterType((*QueryEpochSignerSetRequest)(nil), "zgc.dasigners.v1.QueryEpochSignerSetRequest") + proto.RegisterType((*QueryEpochSignerSetResponse)(nil), "zgc.dasigners.v1.QueryEpochSignerSetResponse") + proto.RegisterType((*QueryAggregatePubkeyG1Request)(nil), "zgc.dasigners.v1.QueryAggregatePubkeyG1Request") + proto.RegisterType((*QueryAggregatePubkeyG1Response)(nil), "zgc.dasigners.v1.QueryAggregatePubkeyG1Response") +} + +func init() { proto.RegisterFile("zgc/dasigners/v1/query.proto", fileDescriptor_991a610b84b5964c) } + +var fileDescriptor_991a610b84b5964c = []byte{ + // 575 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x30, + 0x14, 0x6f, 0xc6, 0xe8, 0x84, 0x5b, 0x10, 0xf3, 0x90, 0x48, 0x43, 0x09, 0x25, 0x2a, 0xa8, 0x1b, + 0x24, 0x6e, 0xca, 0x19, 0x21, 0x26, 0xa1, 0x9d, 0x40, 0x5b, 0x77, 0xe3, 0x52, 0x39, 0xc1, 0xb8, + 0x11, 0x4b, 0x9c, 0xd5, 0xce, 0x44, 0xc7, 0x8d, 0x4f, 0x30, 0x89, 0x33, 0x1f, 0x80, 0x6f, 0xb2, + 0xe3, 0x24, 0x2e, 0x1c, 0xa1, 0xe5, 0x83, 0xa0, 0xda, 0x6e, 0x4b, 0xfa, 0x6f, 0xbd, 0xd9, 0xef, + 0xfd, 0xde, 0xef, 0xf7, 0x7b, 0x7e, 0x4f, 0x06, 0xd5, 0x73, 0x1a, 0xa2, 0x0f, 0x98, 0x47, 0x34, + 0x21, 0x3d, 0x8e, 0xce, 0x7c, 0x74, 0x9a, 0x91, 0x5e, 0xdf, 0x4b, 0x7b, 0x4c, 0x30, 0x78, 0xf7, + 0x9c, 0x86, 0xde, 0x24, 0xeb, 0x9d, 0xf9, 0x56, 0x25, 0x64, 0x3c, 0x66, 0xbc, 0x23, 0xf3, 0x48, + 0x5d, 0x14, 0xd8, 0xba, 0x47, 0x19, 0x65, 0x2a, 0x3e, 0x3a, 0xe9, 0x68, 0x95, 0x32, 0x46, 0x4f, + 0x08, 0xc2, 0x69, 0x84, 0x70, 0x92, 0x30, 0x81, 0x45, 0xc4, 0x92, 0x71, 0x4d, 0x45, 0x67, 0xe5, + 0x2d, 0xc8, 0x3e, 0x22, 0x9c, 0x68, 0x6d, 0xeb, 0xd1, 0x6c, 0x4a, 0x44, 0x31, 0xe1, 0x02, 0xc7, + 0xa9, 0x06, 0xd4, 0xe6, 0xac, 0x4f, 0x9d, 0x4a, 0x84, 0xe3, 0x01, 0x78, 0x34, 0xea, 0xe6, 0x58, + 0x46, 0xdb, 0xe4, 0x34, 0x23, 0x5c, 0x40, 0x13, 0x6c, 0xe1, 0x30, 0x64, 0x59, 0x22, 0x4c, 0xa3, + 0x66, 0x34, 0x6e, 0xb5, 0xc7, 0x57, 0xe7, 0x00, 0xec, 0xe4, 0xf0, 0x3c, 0x65, 0x09, 0x27, 0xb0, + 0x09, 0x8a, 0x8a, 0x57, 0xe2, 0x4b, 0x2d, 0xd3, 0x9b, 0x7d, 0x16, 0x4f, 0x57, 0x68, 0x9c, 0x53, + 0x01, 0xf7, 0x25, 0xd1, 0x9b, 0x94, 0x85, 0xdd, 0x77, 0x59, 0x1c, 0x4c, 0xd4, 0x9d, 0x97, 0xc0, + 0x9c, 0x4f, 0x69, 0xa1, 0xc7, 0xa0, 0x4c, 0x46, 0xe1, 0x4e, 0x22, 0xe3, 0x52, 0x6e, 0xb3, 0x5d, + 0x22, 0x53, 0xa8, 0xf3, 0x0a, 0x58, 0xd3, 0x72, 0xa5, 0x7a, 0x4c, 0xc4, 0xb8, 0xb5, 0x35, 0x08, + 0x8e, 0xc0, 0x83, 0x85, 0x04, 0xda, 0x42, 0x0b, 0x6c, 0xe9, 0xb6, 0x4c, 0xa3, 0x76, 0x63, 0x65, + 0xb3, 0x63, 0xa0, 0xd3, 0x05, 0x0f, 0x25, 0xe5, 0x6b, 0x4a, 0x7b, 0x84, 0x62, 0x41, 0x0e, 0xb3, + 0xe0, 0x13, 0xe9, 0x1f, 0xf8, 0xeb, 0xdb, 0x82, 0x75, 0x70, 0x5b, 0xd3, 0xed, 0x47, 0x22, 0xc6, + 0xa9, 0xb9, 0x51, 0x33, 0x1a, 0xe5, 0x76, 0x3e, 0xe8, 0x1c, 0x02, 0x7b, 0x99, 0x92, 0xf6, 0xef, + 0x81, 0x1d, 0x3c, 0x4e, 0x76, 0x52, 0x99, 0xed, 0x50, 0x5f, 0x2a, 0x96, 0xdb, 0xdb, 0x78, 0xb6, + 0xae, 0x35, 0xdc, 0x04, 0x37, 0x25, 0x25, 0xbc, 0x30, 0x40, 0xe9, 0xbf, 0xa1, 0xc0, 0xdd, 0xf9, + 0xc6, 0x97, 0xcc, 0xd4, 0xda, 0x5b, 0x07, 0xaa, 0x0c, 0x3a, 0x7b, 0x5f, 0x7f, 0xfe, 0xfd, 0xb6, + 0x51, 0x87, 0x0e, 0x6a, 0xd2, 0xb0, 0x8b, 0xa3, 0x24, 0xbf, 0xc2, 0xf2, 0x4d, 0x5c, 0xf5, 0x4e, + 0xf0, 0xbb, 0x01, 0xee, 0xe4, 0xe7, 0x04, 0x9f, 0xaf, 0x92, 0x9a, 0xdd, 0x07, 0xcb, 0x5d, 0x13, + 0xad, 0xbd, 0x79, 0xd2, 0x5b, 0x03, 0x3e, 0x5d, 0xe5, 0x4d, 0x05, 0x5c, 0x4e, 0x04, 0xfc, 0x61, + 0x80, 0xed, 0xb9, 0x51, 0x40, 0xb4, 0x44, 0x74, 0xd9, 0x7a, 0x58, 0xcd, 0xf5, 0x0b, 0xb4, 0x51, + 0x5f, 0x1a, 0x7d, 0x06, 0x77, 0x17, 0x1b, 0x9d, 0x8c, 0xd9, 0x55, 0x1b, 0xe0, 0x52, 0x1f, 0x7e, + 0x01, 0x45, 0xd5, 0x30, 0xac, 0x2f, 0x91, 0xcb, 0xfd, 0x12, 0xd6, 0x93, 0x6b, 0x50, 0xda, 0x49, + 0x5d, 0x3a, 0xb1, 0x61, 0x75, 0xb1, 0x13, 0x75, 0xdc, 0x7f, 0x7b, 0xf9, 0xc7, 0x2e, 0x5c, 0x0e, + 0x6c, 0xe3, 0x6a, 0x60, 0x1b, 0xbf, 0x07, 0xb6, 0x71, 0x31, 0xb4, 0x0b, 0x57, 0x43, 0xbb, 0xf0, + 0x6b, 0x68, 0x17, 0xde, 0x23, 0x1a, 0x89, 0x6e, 0x16, 0x78, 0x21, 0x8b, 0x51, 0x93, 0x9e, 0xe0, + 0x80, 0xa3, 0x26, 0x75, 0x15, 0xdb, 0xe7, 0x3c, 0x9f, 0xe8, 0xa7, 0x84, 0x07, 0x45, 0xf9, 0xbd, + 0xbd, 0xf8, 0x17, 0x00, 0x00, 0xff, 0xff, 0x83, 0xb0, 0xab, 0x12, 0xbd, 0x05, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + EpochNumber(ctx context.Context, in *QueryEpochNumberRequest, opts ...grpc.CallOption) (*QueryEpochNumberResponse, error) + EpochSignerSet(ctx context.Context, in *QueryEpochSignerSetRequest, opts ...grpc.CallOption) (*QueryEpochSignerSetResponse, error) + AggregatePubkeyG1(ctx context.Context, in *QueryAggregatePubkeyG1Request, opts ...grpc.CallOption) (*QueryAggregatePubkeyG1Response, error) + Signer(ctx context.Context, in *QuerySignerRequest, opts ...grpc.CallOption) (*QuerySignerResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) EpochNumber(ctx context.Context, in *QueryEpochNumberRequest, opts ...grpc.CallOption) (*QueryEpochNumberResponse, error) { + out := new(QueryEpochNumberResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/EpochNumber", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) EpochSignerSet(ctx context.Context, in *QueryEpochSignerSetRequest, opts ...grpc.CallOption) (*QueryEpochSignerSetResponse, error) { + out := new(QueryEpochSignerSetResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/EpochSignerSet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AggregatePubkeyG1(ctx context.Context, in *QueryAggregatePubkeyG1Request, opts ...grpc.CallOption) (*QueryAggregatePubkeyG1Response, error) { + out := new(QueryAggregatePubkeyG1Response) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/AggregatePubkeyG1", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Signer(ctx context.Context, in *QuerySignerRequest, opts ...grpc.CallOption) (*QuerySignerResponse, error) { + out := new(QuerySignerResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/Signer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + EpochNumber(context.Context, *QueryEpochNumberRequest) (*QueryEpochNumberResponse, error) + EpochSignerSet(context.Context, *QueryEpochSignerSetRequest) (*QueryEpochSignerSetResponse, error) + AggregatePubkeyG1(context.Context, *QueryAggregatePubkeyG1Request) (*QueryAggregatePubkeyG1Response, error) + Signer(context.Context, *QuerySignerRequest) (*QuerySignerResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) EpochNumber(ctx context.Context, req *QueryEpochNumberRequest) (*QueryEpochNumberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EpochNumber not implemented") +} +func (*UnimplementedQueryServer) EpochSignerSet(ctx context.Context, req *QueryEpochSignerSetRequest) (*QueryEpochSignerSetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EpochSignerSet not implemented") +} +func (*UnimplementedQueryServer) AggregatePubkeyG1(ctx context.Context, req *QueryAggregatePubkeyG1Request) (*QueryAggregatePubkeyG1Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method AggregatePubkeyG1 not implemented") +} +func (*UnimplementedQueryServer) Signer(ctx context.Context, req *QuerySignerRequest) (*QuerySignerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Signer not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_EpochNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEpochNumberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EpochNumber(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Query/EpochNumber", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EpochNumber(ctx, req.(*QueryEpochNumberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_EpochSignerSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEpochSignerSetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EpochSignerSet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Query/EpochSignerSet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EpochSignerSet(ctx, req.(*QueryEpochSignerSetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AggregatePubkeyG1_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAggregatePubkeyG1Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AggregatePubkeyG1(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Query/AggregatePubkeyG1", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AggregatePubkeyG1(ctx, req.(*QueryAggregatePubkeyG1Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Signer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySignerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Signer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Query/Signer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Signer(ctx, req.(*QuerySignerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "zgc.dasigners.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "EpochNumber", + Handler: _Query_EpochNumber_Handler, + }, + { + MethodName: "EpochSignerSet", + Handler: _Query_EpochSignerSet_Handler, + }, + { + MethodName: "AggregatePubkeyG1", + Handler: _Query_AggregatePubkeyG1_Handler, + }, + { + MethodName: "Signer", + Handler: _Query_Signer_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "zgc/dasigners/v1/query.proto", +} + +func (m *QuerySignerRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySignerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySignerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySignerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySignerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySignerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Signer != nil { + { + size, err := m.Signer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryEpochNumberRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEpochNumberRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEpochNumberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryEpochNumberResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEpochNumberResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEpochNumberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EpochNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEpochSignerSetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEpochSignerSetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEpochSignerSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EpochNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEpochSignerSetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEpochSignerSetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEpochSignerSetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signers) > 0 { + for iNdEx := len(m.Signers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAggregatePubkeyG1Request) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAggregatePubkeyG1Request) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAggregatePubkeyG1Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SignersBitmap) > 0 { + i -= len(m.SignersBitmap) + copy(dAtA[i:], m.SignersBitmap) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SignersBitmap))) + i-- + dAtA[i] = 0x12 + } + if m.EpochNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryAggregatePubkeyG1Response) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAggregatePubkeyG1Response) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAggregatePubkeyG1Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AggregatePubkeyG1) > 0 { + i -= len(m.AggregatePubkeyG1) + copy(dAtA[i:], m.AggregatePubkeyG1) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AggregatePubkeyG1))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QuerySignerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySignerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Signer != nil { + l = m.Signer.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryEpochNumberRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryEpochNumberResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNumber != 0 { + n += 1 + sovQuery(uint64(m.EpochNumber)) + } + return n +} + +func (m *QueryEpochSignerSetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNumber != 0 { + n += 1 + sovQuery(uint64(m.EpochNumber)) + } + return n +} + +func (m *QueryEpochSignerSetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Signers) > 0 { + for _, e := range m.Signers { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAggregatePubkeyG1Request) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNumber != 0 { + n += 1 + sovQuery(uint64(m.EpochNumber)) + } + l = len(m.SignersBitmap) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAggregatePubkeyG1Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AggregatePubkeyG1) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QuerySignerRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySignerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySignerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySignerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySignerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySignerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signer == nil { + m.Signer = &Signer{} + } + if err := m.Signer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEpochNumberRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEpochNumberRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEpochNumberRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEpochNumberResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEpochNumberResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEpochNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEpochSignerSetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEpochSignerSetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEpochSignerSetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEpochSignerSetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEpochSignerSetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEpochSignerSetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signers = append(m.Signers, &Signer{}) + if err := m.Signers[len(m.Signers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAggregatePubkeyG1Request) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAggregatePubkeyG1Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAggregatePubkeyG1Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignersBitmap", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignersBitmap = append(m.SignersBitmap[:0], dAtA[iNdEx:postIndex]...) + if m.SignersBitmap == nil { + m.SignersBitmap = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAggregatePubkeyG1Response) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAggregatePubkeyG1Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAggregatePubkeyG1Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AggregatePubkeyG1", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AggregatePubkeyG1 = append(m.AggregatePubkeyG1[:0], dAtA[iNdEx:postIndex]...) + if m.AggregatePubkeyG1 == nil { + m.AggregatePubkeyG1 = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dasigners/v1/types/query.pb.gw.go b/x/dasigners/v1/types/query.pb.gw.go new file mode 100644 index 00000000..e905a08f --- /dev/null +++ b/x/dasigners/v1/types/query.pb.gw.go @@ -0,0 +1,402 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: zgc/dasigners/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_EpochNumber_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochNumberRequest + var metadata runtime.ServerMetadata + + msg, err := client.EpochNumber(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EpochNumber_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochNumberRequest + var metadata runtime.ServerMetadata + + msg, err := server.EpochNumber(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EpochSignerSet_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_EpochSignerSet_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochSignerSetRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochSignerSet_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EpochSignerSet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EpochSignerSet_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochSignerSetRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochSignerSet_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EpochSignerSet(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_AggregatePubkeyG1_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_AggregatePubkeyG1_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAggregatePubkeyG1Request + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AggregatePubkeyG1_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AggregatePubkeyG1(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AggregatePubkeyG1_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAggregatePubkeyG1Request + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AggregatePubkeyG1_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AggregatePubkeyG1(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Signer_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Signer_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySignerRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Signer_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Signer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Signer_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySignerRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Signer_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Signer(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_EpochNumber_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_EpochNumber_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EpochNumber_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EpochSignerSet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_EpochSignerSet_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EpochSignerSet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AggregatePubkeyG1_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AggregatePubkeyG1_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AggregatePubkeyG1_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Signer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Signer_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Signer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_EpochNumber_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EpochNumber_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EpochNumber_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EpochSignerSet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EpochSignerSet_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EpochSignerSet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AggregatePubkeyG1_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AggregatePubkeyG1_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AggregatePubkeyG1_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Signer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Signer_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Signer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_EpochNumber_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "epoch-number"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EpochSignerSet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "epoch-signer-set"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AggregatePubkeyG1_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "aggregate-pubkey-g1"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Signer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "signer"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_EpochNumber_0 = runtime.ForwardResponseMessage + + forward_Query_EpochSignerSet_0 = runtime.ForwardResponseMessage + + forward_Query_AggregatePubkeyG1_0 = runtime.ForwardResponseMessage + + forward_Query_Signer_0 = runtime.ForwardResponseMessage +) diff --git a/x/dasigners/v1/types/signer.go b/x/dasigners/v1/types/signer.go new file mode 100644 index 00000000..77c19b08 --- /dev/null +++ b/x/dasigners/v1/types/signer.go @@ -0,0 +1,55 @@ +package types + +import ( + "encoding/hex" + fmt "fmt" + + "github.com/0glabs/0g-chain/crypto/bn254util" + "github.com/consensys/gnark-crypto/ecc/bn254" +) + +func ValidateHexAddress(account string) error { + addr, err := hex.DecodeString(account) + if err != nil { + return err + } + if len(addr) != 20 { + return fmt.Errorf("invalid address length") + } + return nil +} + +func (s *Signer) Validate() error { + if len(s.PubkeyG1) != bn254util.G1PointSize { + return fmt.Errorf("invalid G1 pubkey length") + } + if len(s.PubkeyG2) != bn254util.G2PointSize { + return fmt.Errorf("invalid G2 pubkey length") + } + if err := ValidateHexAddress(s.Account); err != nil { + return err + } + return nil +} + +func (s *Signer) ValidateSignature(hash *bn254.G1Affine, signature *bn254.G1Affine) bool { + pubkeyG1 := bn254util.DeserializeG1(s.PubkeyG1) + pubkeyG2 := bn254util.DeserializeG2(s.PubkeyG2) + gamma := bn254util.Gamma(hash, signature, pubkeyG1, pubkeyG2) + + // pairing + P := [2]bn254.G1Affine{ + *new(bn254.G1Affine).Add(signature, new(bn254.G1Affine).ScalarMultiplication(pubkeyG1, gamma)), + *new(bn254.G1Affine).Add(hash, new(bn254.G1Affine).ScalarMultiplication(bn254util.GetG1Generator(), gamma)), + } + Q := [2]bn254.G2Affine{ + *new(bn254.G2Affine).Neg(bn254util.GetG2Generator()), + *pubkeyG2, + } + + ok, err := bn254.PairingCheck(P[:], Q[:]) + if err != nil { + return false + } + return ok +} diff --git a/x/dasigners/v1/types/tx.pb.go b/x/dasigners/v1/types/tx.pb.go new file mode 100644 index 00000000..66132018 --- /dev/null +++ b/x/dasigners/v1/types/tx.pb.go @@ -0,0 +1,1312 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zgc/dasigners/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/0glabs/0g-chain/x/das/v1/types" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type MsgRegisterSigner struct { + Signer *Signer `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *MsgRegisterSigner) Reset() { *m = MsgRegisterSigner{} } +func (m *MsgRegisterSigner) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterSigner) ProtoMessage() {} +func (*MsgRegisterSigner) Descriptor() ([]byte, []int) { + return fileDescriptor_8bfa0cc0bd2f98e0, []int{0} +} +func (m *MsgRegisterSigner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterSigner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterSigner.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterSigner) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterSigner.Merge(m, src) +} +func (m *MsgRegisterSigner) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterSigner) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterSigner.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterSigner proto.InternalMessageInfo + +type MsgRegisterSignerResponse struct { +} + +func (m *MsgRegisterSignerResponse) Reset() { *m = MsgRegisterSignerResponse{} } +func (m *MsgRegisterSignerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterSignerResponse) ProtoMessage() {} +func (*MsgRegisterSignerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_8bfa0cc0bd2f98e0, []int{1} +} +func (m *MsgRegisterSignerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterSignerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterSignerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterSignerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterSignerResponse.Merge(m, src) +} +func (m *MsgRegisterSignerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterSignerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterSignerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterSignerResponse proto.InternalMessageInfo + +type MsgUpdateSocket struct { + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + Socket string `protobuf:"bytes,2,opt,name=socket,proto3" json:"socket,omitempty"` +} + +func (m *MsgUpdateSocket) Reset() { *m = MsgUpdateSocket{} } +func (m *MsgUpdateSocket) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateSocket) ProtoMessage() {} +func (*MsgUpdateSocket) Descriptor() ([]byte, []int) { + return fileDescriptor_8bfa0cc0bd2f98e0, []int{2} +} +func (m *MsgUpdateSocket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateSocket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateSocket.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateSocket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateSocket.Merge(m, src) +} +func (m *MsgUpdateSocket) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateSocket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateSocket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateSocket proto.InternalMessageInfo + +type MsgUpdateSocketResponse struct { +} + +func (m *MsgUpdateSocketResponse) Reset() { *m = MsgUpdateSocketResponse{} } +func (m *MsgUpdateSocketResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateSocketResponse) ProtoMessage() {} +func (*MsgUpdateSocketResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_8bfa0cc0bd2f98e0, []int{3} +} +func (m *MsgUpdateSocketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateSocketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateSocketResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateSocketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateSocketResponse.Merge(m, src) +} +func (m *MsgUpdateSocketResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateSocketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateSocketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateSocketResponse proto.InternalMessageInfo + +type MsgRegisterNextEpoch struct { + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *MsgRegisterNextEpoch) Reset() { *m = MsgRegisterNextEpoch{} } +func (m *MsgRegisterNextEpoch) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterNextEpoch) ProtoMessage() {} +func (*MsgRegisterNextEpoch) Descriptor() ([]byte, []int) { + return fileDescriptor_8bfa0cc0bd2f98e0, []int{4} +} +func (m *MsgRegisterNextEpoch) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterNextEpoch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterNextEpoch.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterNextEpoch) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterNextEpoch.Merge(m, src) +} +func (m *MsgRegisterNextEpoch) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterNextEpoch) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterNextEpoch.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterNextEpoch proto.InternalMessageInfo + +type MsgRegisterNextEpochResponse struct { +} + +func (m *MsgRegisterNextEpochResponse) Reset() { *m = MsgRegisterNextEpochResponse{} } +func (m *MsgRegisterNextEpochResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterNextEpochResponse) ProtoMessage() {} +func (*MsgRegisterNextEpochResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_8bfa0cc0bd2f98e0, []int{5} +} +func (m *MsgRegisterNextEpochResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterNextEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterNextEpochResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterNextEpochResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterNextEpochResponse.Merge(m, src) +} +func (m *MsgRegisterNextEpochResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterNextEpochResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterNextEpochResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterNextEpochResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgRegisterSigner)(nil), "zgc.dasigners.v1.MsgRegisterSigner") + proto.RegisterType((*MsgRegisterSignerResponse)(nil), "zgc.dasigners.v1.MsgRegisterSignerResponse") + proto.RegisterType((*MsgUpdateSocket)(nil), "zgc.dasigners.v1.MsgUpdateSocket") + proto.RegisterType((*MsgUpdateSocketResponse)(nil), "zgc.dasigners.v1.MsgUpdateSocketResponse") + proto.RegisterType((*MsgRegisterNextEpoch)(nil), "zgc.dasigners.v1.MsgRegisterNextEpoch") + proto.RegisterType((*MsgRegisterNextEpochResponse)(nil), "zgc.dasigners.v1.MsgRegisterNextEpochResponse") +} + +func init() { proto.RegisterFile("zgc/dasigners/v1/tx.proto", fileDescriptor_8bfa0cc0bd2f98e0) } + +var fileDescriptor_8bfa0cc0bd2f98e0 = []byte{ + // 410 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcf, 0xae, 0xd2, 0x40, + 0x18, 0xc5, 0x5b, 0x4c, 0x30, 0x8c, 0x44, 0xa5, 0x21, 0xda, 0x56, 0x32, 0xc1, 0x9a, 0x18, 0x8c, + 0xb1, 0x03, 0xf8, 0x06, 0x1a, 0x97, 0x65, 0x51, 0xe2, 0xc6, 0x98, 0x98, 0x76, 0x18, 0x87, 0x06, + 0xe8, 0x34, 0x9d, 0x29, 0x01, 0x9e, 0xc2, 0x87, 0xf1, 0x21, 0x58, 0xb2, 0x74, 0xe9, 0x85, 0x17, + 0xb9, 0x61, 0xfa, 0x07, 0x6e, 0x4b, 0xb8, 0xec, 0xe6, 0x9b, 0xef, 0xd7, 0x73, 0x4e, 0x4f, 0x5a, + 0x60, 0x6c, 0x28, 0x46, 0x13, 0x8f, 0x07, 0x34, 0x24, 0x31, 0x47, 0xcb, 0x01, 0x12, 0x2b, 0x3b, + 0x8a, 0x99, 0x60, 0xda, 0xcb, 0x0d, 0xc5, 0x76, 0xb1, 0xb2, 0x97, 0x03, 0xd3, 0xc0, 0x8c, 0x2f, + 0x18, 0xff, 0x25, 0xf7, 0x28, 0x1d, 0x52, 0xd8, 0x6c, 0x53, 0x46, 0x59, 0x7a, 0x7f, 0x3c, 0x65, + 0xb7, 0x06, 0x65, 0x8c, 0xce, 0x09, 0x92, 0x93, 0x9f, 0xfc, 0x46, 0x5e, 0xb8, 0xce, 0x56, 0x7a, + 0x66, 0x7c, 0xb4, 0xa4, 0x24, 0x24, 0x3c, 0xc8, 0xa5, 0xba, 0x95, 0x48, 0xa7, 0x10, 0x92, 0xb0, + 0x30, 0x68, 0x39, 0x9c, 0xba, 0x84, 0x06, 0x5c, 0x90, 0x78, 0x2c, 0x77, 0x5a, 0x1f, 0xd4, 0x53, + 0x4a, 0x57, 0xbb, 0x6a, 0xef, 0xd9, 0x50, 0xb7, 0xcb, 0xf9, 0xed, 0x94, 0x74, 0x33, 0x4e, 0xeb, + 0x80, 0xc6, 0xf1, 0xe4, 0x89, 0x24, 0x26, 0x7a, 0xad, 0xab, 0xf6, 0x9a, 0xee, 0xe9, 0xc2, 0x7a, + 0x03, 0x8c, 0x8a, 0x89, 0x4b, 0x78, 0xc4, 0x42, 0x4e, 0xac, 0xaf, 0xe0, 0x85, 0xc3, 0xe9, 0xf7, + 0x68, 0xe2, 0x09, 0x32, 0x66, 0x78, 0x46, 0x84, 0xa6, 0x83, 0xa7, 0x1e, 0xc6, 0x2c, 0x09, 0x85, + 0x0c, 0xd0, 0x70, 0xf3, 0x51, 0x7b, 0x05, 0xea, 0x5c, 0x32, 0xd2, 0xa4, 0xe1, 0x66, 0x93, 0x65, + 0x80, 0xd7, 0x25, 0x91, 0x42, 0x7f, 0x04, 0xda, 0x67, 0xe6, 0x23, 0xb2, 0x12, 0xdf, 0x22, 0x86, + 0xa7, 0x57, 0x4c, 0xae, 0xbf, 0x0c, 0x04, 0x9d, 0x4b, 0x7a, 0xb9, 0xdf, 0xf0, 0x6f, 0x0d, 0x3c, + 0x71, 0x38, 0xd5, 0x7c, 0xf0, 0xbc, 0x54, 0xeb, 0xbb, 0x6a, 0x8d, 0x95, 0x5a, 0xcc, 0x8f, 0x37, + 0x40, 0xb9, 0x97, 0xf6, 0x13, 0x34, 0x1f, 0x14, 0xf7, 0xf6, 0xe2, 0xc3, 0xe7, 0x88, 0xf9, 0xe1, + 0x51, 0xa4, 0x50, 0x9f, 0x81, 0x56, 0xb5, 0xb6, 0xf7, 0x57, 0xf3, 0x15, 0x9c, 0x69, 0xdf, 0xc6, + 0xe5, 0x66, 0x5f, 0x9c, 0xed, 0x1d, 0x54, 0xb6, 0x7b, 0xa8, 0xee, 0xf6, 0x50, 0xfd, 0xbf, 0x87, + 0xea, 0x9f, 0x03, 0x54, 0x76, 0x07, 0xa8, 0xfc, 0x3b, 0x40, 0xe5, 0x07, 0xa2, 0x81, 0x98, 0x26, + 0xbe, 0x8d, 0xd9, 0x02, 0xf5, 0xe9, 0xdc, 0xf3, 0x39, 0xea, 0xd3, 0x4f, 0x78, 0xea, 0x05, 0x21, + 0x5a, 0x95, 0x7e, 0xba, 0x75, 0x44, 0xb8, 0x5f, 0x97, 0x9f, 0xf7, 0xe7, 0xfb, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xa3, 0x4c, 0x19, 0x64, 0x95, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + RegisterSigner(ctx context.Context, in *MsgRegisterSigner, opts ...grpc.CallOption) (*MsgRegisterSignerResponse, error) + UpdateSocket(ctx context.Context, in *MsgUpdateSocket, opts ...grpc.CallOption) (*MsgUpdateSocketResponse, error) + RegisterNextEpoch(ctx context.Context, in *MsgRegisterNextEpoch, opts ...grpc.CallOption) (*MsgRegisterNextEpochResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) RegisterSigner(ctx context.Context, in *MsgRegisterSigner, opts ...grpc.CallOption) (*MsgRegisterSignerResponse, error) { + out := new(MsgRegisterSignerResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Msg/RegisterSigner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateSocket(ctx context.Context, in *MsgUpdateSocket, opts ...grpc.CallOption) (*MsgUpdateSocketResponse, error) { + out := new(MsgUpdateSocketResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Msg/UpdateSocket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RegisterNextEpoch(ctx context.Context, in *MsgRegisterNextEpoch, opts ...grpc.CallOption) (*MsgRegisterNextEpochResponse, error) { + out := new(MsgRegisterNextEpochResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Msg/RegisterNextEpoch", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + RegisterSigner(context.Context, *MsgRegisterSigner) (*MsgRegisterSignerResponse, error) + UpdateSocket(context.Context, *MsgUpdateSocket) (*MsgUpdateSocketResponse, error) + RegisterNextEpoch(context.Context, *MsgRegisterNextEpoch) (*MsgRegisterNextEpochResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) RegisterSigner(ctx context.Context, req *MsgRegisterSigner) (*MsgRegisterSignerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterSigner not implemented") +} +func (*UnimplementedMsgServer) UpdateSocket(ctx context.Context, req *MsgUpdateSocket) (*MsgUpdateSocketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSocket not implemented") +} +func (*UnimplementedMsgServer) RegisterNextEpoch(ctx context.Context, req *MsgRegisterNextEpoch) (*MsgRegisterNextEpochResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterNextEpoch not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_RegisterSigner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterSigner) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterSigner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Msg/RegisterSigner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterSigner(ctx, req.(*MsgRegisterSigner)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateSocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateSocket) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateSocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Msg/UpdateSocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateSocket(ctx, req.(*MsgUpdateSocket)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RegisterNextEpoch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterNextEpoch) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterNextEpoch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Msg/RegisterNextEpoch", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterNextEpoch(ctx, req.(*MsgRegisterNextEpoch)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "zgc.dasigners.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterSigner", + Handler: _Msg_RegisterSigner_Handler, + }, + { + MethodName: "UpdateSocket", + Handler: _Msg_UpdateSocket_Handler, + }, + { + MethodName: "RegisterNextEpoch", + Handler: _Msg_RegisterNextEpoch_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "zgc/dasigners/v1/tx.proto", +} + +func (m *MsgRegisterSigner) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterSigner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterSigner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.Signer != nil { + { + size, err := m.Signer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterSignerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterSignerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterSignerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateSocket) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateSocket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateSocket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Socket) > 0 { + i -= len(m.Socket) + copy(dAtA[i:], m.Socket) + i = encodeVarintTx(dAtA, i, uint64(len(m.Socket))) + i-- + dAtA[i] = 0x12 + } + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintTx(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateSocketResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateSocketResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateSocketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRegisterNextEpoch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterNextEpoch) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterNextEpoch) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintTx(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterNextEpochResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterNextEpochResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterNextEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgRegisterSigner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Signer != nil { + l = m.Signer.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRegisterSignerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateSocket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Socket) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateSocketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRegisterNextEpoch) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRegisterNextEpochResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgRegisterSigner) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterSigner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterSigner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signer == nil { + m.Signer = &Signer{} + } + if err := m.Signer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterSignerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterSignerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterSignerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateSocket) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateSocket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateSocket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Socket", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Socket = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateSocketResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateSocketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateSocketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterNextEpoch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterNextEpoch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterNextEpoch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterNextEpochResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterNextEpochResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterNextEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From c7a31a1a9f5505e594cdec8c4efd69d900a6f876 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Fri, 10 May 2024 03:44:37 +0800 Subject: [PATCH 02/26] chore: dependency --- go.mod | 101 ++++++++++---------- go.sum | 238 +++++++++++++++++++++--------------------------- localtestnet.sh | 4 +- 3 files changed, 155 insertions(+), 188 deletions(-) diff --git a/go.mod b/go.mod index d1a24845..885752a0 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/0glabs/0g-chain -go 1.21 - -toolchain go1.21.5 +go 1.20 require ( cosmossdk.io/errors v1.0.0-beta.7 @@ -22,34 +20,32 @@ require ( github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/linxGnu/grocksdb v1.8.0 - github.com/pelletier/go-toml/v2 v2.1.0 + github.com/pelletier/go-toml/v2 v2.0.6 github.com/prometheus/client_golang v1.14.0 - github.com/spf13/cast v1.6.0 - github.com/spf13/cobra v1.8.0 - github.com/spf13/viper v1.18.1 - github.com/stretchr/testify v1.8.4 - github.com/subosito/gotenv v1.6.0 + github.com/spf13/cast v1.5.0 + github.com/spf13/cobra v1.6.1 + github.com/spf13/viper v1.15.0 + github.com/stretchr/testify v1.8.3 + github.com/subosito/gotenv v1.4.2 github.com/tendermint/tendermint v0.34.27 github.com/tendermint/tm-db v0.6.7 - golang.org/x/crypto v0.21.0 - google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 - google.golang.org/grpc v1.60.0 + golang.org/x/crypto v0.14.0 + google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 + google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 sigs.k8s.io/yaml v1.3.0 ) require ( - cloud.google.com/go v0.110.10 // indirect - cloud.google.com/go/compute v1.23.3 // indirect + cloud.google.com/go v0.110.8 // indirect + cloud.google.com/go/compute v1.23.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.5 // indirect - cloud.google.com/go/storage v1.35.1 // indirect + cloud.google.com/go/iam v1.1.2 // indirect + cloud.google.com/go/storage v1.30.1 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect - github.com/Microsoft/go-winio v0.6.1 // indirect github.com/StackExchange/wmi v1.2.1 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect @@ -66,54 +62,53 @@ require ( github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/chzyer/readline v1.5.1 // indirect + github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect github.com/cometbft/cometbft-db v0.7.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/gogoproto v1.4.11 // indirect + github.com/cosmos/gogoproto v1.4.6 // indirect github.com/cosmos/iavl v0.19.5 // indirect github.com/cosmos/ledger-cosmos-go v0.13.1 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set v1.8.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/badger/v3 v3.2103.2 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect + github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect - github.com/dustin/go-humanize v1.0.1 // indirect + github.com/dustin/go-humanize v1.0.0 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/gin-gonic/gin v1.8.1 // indirect github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-playground/validator/v10 v10.11.1 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/gateway v1.1.0 // indirect - github.com/golang/glog v1.1.2 // indirect + github.com/golang/glog v1.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v1.12.1 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect - github.com/google/s2a-go v0.1.7 // indirect - github.com/google/uuid v1.4.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/google/s2a-go v0.1.4 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect @@ -133,11 +128,12 @@ require ( github.com/holiman/uint256 v1.2.1 // indirect github.com/huin/goupnp v1.0.3 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.15.15 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -152,27 +148,28 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/common v0.40.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/rjeczalik/notify v0.9.1 // indirect + github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.29.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/afero v1.9.3 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect @@ -187,20 +184,18 @@ require ( github.com/zondax/ledger-go v0.14.2 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect - go.uber.org/multierr v1.10.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/oauth2 v0.15.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.5.0 // indirect + golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/oauth2 v0.10.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.153.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect + google.golang.org/api v0.128.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index fecc78bd..a549208a 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,7 @@ cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSR cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -17,6 +18,7 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -32,8 +34,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= -cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= +cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= +cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -71,8 +73,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= -cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= +cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= +cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -112,8 +114,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= -cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= +cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= +cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -171,11 +173,12 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.35.1 h1:B59ahL//eDfx2IIKFBeT5Atm9wnNmj3+8xG/W4WB//w= -cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= +cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -204,8 +207,7 @@ github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -215,10 +217,8 @@ github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -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/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -234,7 +234,6 @@ github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSa github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= -github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -333,15 +332,12 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL 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/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= -github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= -github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -376,7 +372,6 @@ github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaO 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/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= 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= @@ -390,8 +385,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960Bvc github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= -github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= +github.com/cosmos/gogoproto v1.4.6 h1:Ee7z15dWJaGlgM2rWrK8N2IX7PQcuccu8oG68jp5RL4= +github.com/cosmos/gogoproto v1.4.6/go.mod h1:VS/ASYmPgv6zkPKLjR9EB91lwbLHOzaGCirmKKhncfI= github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/ibc-go/v6 v6.1.1 h1:oqqMNyjj6SLQF8rvgCaDGwfdITEIsbhs8F77/8xvRIo= @@ -403,9 +398,8 @@ github.com/cosmos/ledger-cosmos-go v0.13.1/go.mod h1:5tv2RVJEd2+Y38TIQN4CRjJeQGy github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +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/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -416,9 +410,8 @@ github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnG github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= @@ -437,9 +430,8 @@ github.com/dgraph-io/badger/v3 v3.2103.2 h1:dpyM5eCJAtQCBcMCZcT4UBZchuTJgCywerHH github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= @@ -451,16 +443,13 @@ github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -491,15 +480,13 @@ github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlK github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= 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.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= @@ -526,10 +513,9 @@ github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= -github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -554,7 +540,6 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me 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 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= -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 h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -574,8 +559,8 @@ github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -638,9 +623,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +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-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -651,7 +635,6 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -663,29 +646,28 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 h1:CqYfpuYIjnlNxM3msdyPRKabhXZWbKjf3Q8BWROFBso= -github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= +github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= +github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -698,6 +680,7 @@ github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMd github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= @@ -784,8 +767,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= @@ -804,7 +787,6 @@ github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1C github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b h1:izTof8BKh/nE1wrKOrloNA5q4odOarjf+Xpe+4qow98= -github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -847,19 +829,19 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= +github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= 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= @@ -986,20 +968,15 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= -github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= -github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= -github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= -github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -1010,7 +987,6 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= -github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -1018,8 +994,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= @@ -1035,10 +1011,10 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE 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.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= +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/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= @@ -1064,16 +1040,16 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.40.0 h1:Afz7EVRqGg2Mqqf4JuF9vdvp1pi220m55Pi9T2JnO4Q= +github.com/prometheus/common v0.40.0/go.mod h1:L65ZJPSmfn/UBWLQIHV7dBrKFidB/wPlF1y5TlSt9OE= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +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/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1107,10 +1083,6 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD 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/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= @@ -1127,34 +1099,33 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= 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/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= +github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= +github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM= -github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= 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= @@ -1177,10 +1148,10 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ 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.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -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/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= @@ -1266,8 +1237,6 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= -go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -1291,11 +1260,14 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1311,8 +1283,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= -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/exp v0.0.0-20230213192124-5e25df0256eb h1:PaBZQdo+iSDyHT053FjUCgZQ/9uqVwPOcl7KSWhKn6w= +golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1342,8 +1314,7 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 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= @@ -1387,6 +1358,7 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -1409,8 +1381,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1436,8 +1408,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= 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= @@ -1452,8 +1424,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +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-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1516,6 +1488,7 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1524,6 +1497,7 @@ golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/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-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1543,7 +1517,6 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/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-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/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-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1555,16 +1528,16 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 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/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1576,16 +1549,15 @@ 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.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -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/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-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.1.0 h1:xYY+Bajn2a7VBmTM5GikTmnK8ZuX8YgnQCqZpbBNtmA= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1643,6 +1615,7 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= @@ -1651,8 +1624,7 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= 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= @@ -1717,8 +1689,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.153.0 h1:N1AwGhielyKFaUqH07/ZSIQR3uNPcV7NVw0vj+j4iR4= -google.golang.org/api v0.153.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= +google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= +google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1726,9 +1698,8 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1770,8 +1741,10 @@ google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1837,12 +1810,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= +google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= +google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= +google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 h1:U7+wNaVuSTaUqNvK2+osJ9ejEZxbjHHk8F2b6Hpx0AE= +google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:RdyHbowztCGQySiCvQPgWQWgWhGnouTdCflKoDBt32U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c h1:jHkCUWkseRf+W+edG5hMzr/Uh1xkDREY4caybAq4dpY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1885,8 +1858,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 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= @@ -1951,7 +1924,6 @@ honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/localtestnet.sh b/localtestnet.sh index bde45c2c..aab02408 100755 --- a/localtestnet.sh +++ b/localtestnet.sh @@ -48,12 +48,12 @@ $BINARY config keyring-backend test # Create validator keys and add account to genesis validatorKeyName="validator" -printf "$validatorMnemonic\n" | $BINARY keys add $validatorKeyName --recover +printf "$validatorMnemonic\n" | $BINARY keys add $validatorKeyName --eth --recover $BINARY add-genesis-account $validatorKeyName 2000000000000000000000ua0gi # Create faucet keys and add account to genesis faucetKeyName="faucet" -printf "$faucetMnemonic\n" | $BINARY keys add $faucetKeyName --recover +printf "$faucetMnemonic\n" | $BINARY keys add $faucetKeyName --eth --recover $BINARY add-genesis-account $faucetKeyName 1000000000000000000000ua0gi evmFaucetKeyName="evm-faucet" From 015f6224bd0b97cced307cd85e428b390bf2bca5 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Sat, 11 May 2024 02:41:14 +0800 Subject: [PATCH 03/26] fix: dasigners module --- go.mod | 2 +- go.sum | 4 ++-- precompiles/dasigners/contract.go | 20 ---------------- precompiles/dasigners/dasigners.go | 37 ++++++++++++++++++++++++++--- precompiles/dasigners/events.go | 6 +++-- precompiles/dasigners/types.go | 31 ++++++++++++++++++------ x/dasigners/v1/keeper/grpc_query.go | 2 +- x/dasigners/v1/keeper/keeper.go | 10 ++++---- x/dasigners/v1/types/genesis.go | 4 ++-- x/dasigners/v1/types/keys.go | 2 +- 10 files changed, 75 insertions(+), 43 deletions(-) diff --git a/go.mod b/go.mod index 885752a0..3d53e2d5 100644 --- a/go.mod +++ b/go.mod @@ -216,7 +216,7 @@ replace ( // Use go-ethereum fork with precompiles github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2 // Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support - github.com/evmos/ethermint => github.com/0glabs/ethermint v0.21.0-0g.v2.0.0 + github.com/evmos/ethermint => github.com/0glabs/ethermint v0.21.0-0g.v2.0.1 // See https://github.com/cosmos/cosmos-sdk/pull/10401, https://github.com/cosmos/cosmos-sdk/commit/0592ba6158cd0bf49d894be1cef4faeec59e8320 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 // Use the cosmos modified protobufs diff --git a/go.sum b/go.sum index a549208a..bbbbb97a 100644 --- a/go.sum +++ b/go.sum @@ -200,8 +200,8 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmG filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= -github.com/0glabs/ethermint v0.21.0-0g.v2.0.0 h1:3sfsRkaPaG7v2smfxEJ2TvwPcVMIkG8yRRVR8+tbYkc= -github.com/0glabs/ethermint v0.21.0-0g.v2.0.0/go.mod h1:peUmQT71k9BOBgoWoIRWRrM/O01mffVjIH0RLnoaFuI= +github.com/0glabs/ethermint v0.21.0-0g.v2.0.1 h1:loFnZAEZ8tboo3JO3+AE+1gJcUm6hkYuwcn+ZHBhjxE= +github.com/0glabs/ethermint v0.21.0-0g.v2.0.1/go.mod h1:peUmQT71k9BOBgoWoIRWRrM/O01mffVjIH0RLnoaFuI= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= diff --git a/precompiles/dasigners/contract.go b/precompiles/dasigners/contract.go index 2fe9629b..b558627b 100644 --- a/precompiles/dasigners/contract.go +++ b/precompiles/dasigners/contract.go @@ -28,26 +28,6 @@ var ( _ = event.NewSubscription ) -// BN254G1Point is an auto generated low-level Go binding around an user-defined struct. -type BN254G1Point struct { - X *big.Int - Y *big.Int -} - -// BN254G2Point is an auto generated low-level Go binding around an user-defined struct. -type BN254G2Point struct { - X [2]*big.Int - Y [2]*big.Int -} - -// IDASignersSignerDetail is an auto generated low-level Go binding around an user-defined struct. -type IDASignersSignerDetail struct { - Signer common.Address - Socket string - PkG1 BN254G1Point - PkG2 BN254G2Point -} - // DASignersMetaData contains all meta data concerning the DASigners contract. var DASignersMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signersBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"}],\"name\":\"getSigners\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"details\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", diff --git a/precompiles/dasigners/dasigners.go b/precompiles/dasigners/dasigners.go index 601e626c..61ba2a17 100644 --- a/precompiles/dasigners/dasigners.go +++ b/precompiles/dasigners/dasigners.go @@ -6,6 +6,7 @@ import ( precopmiles_common "github.com/0glabs/0g-chain/precompiles/common" dasignerskeeper "github.com/0glabs/0g-chain/x/dasigners/v1/keeper" + storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" @@ -13,8 +14,9 @@ import ( ) const ( - PrecompileAddress = "0x0000000000000000000000000000000000001000" - RequiredGasBasic uint64 = 100 + PrecompileAddress = "0x0000000000000000000000000000000000001000" + + RequiredGasMax uint64 = 1000_000_000 DASignersFunctionEpochNumber = "epochNumber" DASignersFunctionGetSigner = "getSigner" @@ -25,6 +27,26 @@ const ( DASignersFunctionGetAggPkG1 = "getAggPkG1" ) +var RequiredGasBasic = map[string]uint64{ + "epochNumber": 1000, + "getSigner": 10000, + "getSigners": 1000000, + "updateSocket": 50000, + "registerNextEpoch": 100000, + "registerSigner": 100000, + "getAggPkG1": 1000000, +} + +var KVGasConfig storetypes.GasConfig = storetypes.GasConfig{ + HasCost: 0, + DeleteCost: 0, + ReadCostFlat: 0, + ReadCostPerByte: 0, + WriteCostFlat: 0, + WriteCostPerByte: 0, + IterNextCostFlat: 0, +} + var _ vm.PrecompiledContract = &DASignersPrecompile{} type DASignersPrecompile struct { @@ -50,7 +72,14 @@ func (d *DASignersPrecompile) Address() common.Address { // RequiredGas implements vm.PrecompiledContract. func (d *DASignersPrecompile) RequiredGas(input []byte) uint64 { - return RequiredGasBasic + method, err := d.abi.MethodById(input[:4]) + if err != nil { + return RequiredGasMax + } + if gas, ok := RequiredGasBasic[method.Name]; ok { + return gas + } + return RequiredGasMax } // Run implements vm.PrecompiledContract. @@ -73,6 +102,8 @@ func (d *DASignersPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly b return nil, fmt.Errorf(precopmiles_common.ErrGetStateDB) } ctx := stateDB.GetContext() + // reset gas config + ctx = ctx.WithKVGasConfig(KVGasConfig) initialGas := ctx.GasMeter().GasConsumed() var bz []byte diff --git a/precompiles/dasigners/events.go b/precompiles/dasigners/events.go index 5abd8431..3ac0f4b5 100644 --- a/precompiles/dasigners/events.go +++ b/precompiles/dasigners/events.go @@ -22,7 +22,8 @@ func (d *DASignersPrecompile) EmitNewSignerEvent(ctx sdk.Context, stateDB *state if err != nil { return err } - b, err := event.Inputs.Pack(signer.Signer, signer.PkG1, signer.PkG2) + arguments := abi.Arguments{event.Inputs[1], event.Inputs[2]} + b, err := arguments.Pack(signer.PkG1, signer.PkG2) if err != nil { return err } @@ -44,7 +45,8 @@ func (d *DASignersPrecompile) EmitSocketUpdatedEvent(ctx sdk.Context, stateDB *s if err != nil { return err } - b, err := event.Inputs.Pack(signer, socket) + arguments := abi.Arguments{event.Inputs[1]} + b, err := arguments.Pack(socket) if err != nil { return err } diff --git a/precompiles/dasigners/types.go b/precompiles/dasigners/types.go index a7fe5e5e..16237286 100644 --- a/precompiles/dasigners/types.go +++ b/precompiles/dasigners/types.go @@ -10,6 +10,23 @@ import ( "github.com/ethereum/go-ethereum/common" ) +type BN254G1Point = struct { + X *big.Int "json:\"X\"" + Y *big.Int "json:\"Y\"" +} + +type BN254G2Point = struct { + X [2]*big.Int "json:\"X\"" + Y [2]*big.Int "json:\"Y\"" +} + +type IDASignersSignerDetail = struct { + Signer common.Address "json:\"signer\"" + Socket string "json:\"socket\"" + PkG1 BN254G1Point "json:\"pkG1\"" + PkG2 BN254G2Point "json:\"pkG2\"" +} + func NewBN254G1Point(b []byte) BN254G1Point { return BN254G1Point{ X: new(big.Int).SetBytes(b[:32]), @@ -17,7 +34,7 @@ func NewBN254G1Point(b []byte) BN254G1Point { } } -func (p BN254G1Point) Serialize() []byte { +func SerializeG1(p BN254G1Point) []byte { b := make([]byte, 0) b = append(b, common.LeftPadBytes(p.X.Bytes(), 32)...) b = append(b, common.LeftPadBytes(p.Y.Bytes(), 32)...) @@ -37,7 +54,7 @@ func NewBN254G2Point(b []byte) BN254G2Point { } } -func (p BN254G2Point) Serialize() []byte { +func SerializeG2(p BN254G2Point) []byte { b := make([]byte, 0) b = append(b, common.LeftPadBytes(p.X[0].Bytes(), 32)...) b = append(b, common.LeftPadBytes(p.X[1].Bytes(), 32)...) @@ -52,7 +69,7 @@ func NewQuerySignerRequest(args []interface{}) (*dasignerstypes.QuerySignerReque } return &dasignerstypes.QuerySignerRequest{ - Account: args[0].(string), + Account: ToLowerHexWithoutPrefix(args[0].(common.Address)), }, nil } @@ -100,10 +117,10 @@ func NewMsgRegisterSigner(args []interface{}) (*dasignerstypes.MsgRegisterSigner Signer: &dasignerstypes.Signer{ Account: ToLowerHexWithoutPrefix(signer.Signer), Socket: signer.Socket, - PubkeyG1: signer.PkG1.Serialize(), - PubkeyG2: signer.PkG2.Serialize(), + PubkeyG1: SerializeG1(signer.PkG1), + PubkeyG2: SerializeG2(signer.PkG2), }, - Signature: args[1].(BN254G1Point).Serialize(), + Signature: SerializeG1(args[1].(BN254G1Point)), }, nil } @@ -114,7 +131,7 @@ func NewMsgRegisterNextEpoch(args []interface{}, account string) (*dasignerstype return &dasignerstypes.MsgRegisterNextEpoch{ Account: account, - Signature: args[0].(BN254G1Point).Serialize(), + Signature: SerializeG1(args[0].(BN254G1Point)), }, nil } diff --git a/x/dasigners/v1/keeper/grpc_query.go b/x/dasigners/v1/keeper/grpc_query.go index 51ed5c7e..cb0d1dbf 100644 --- a/x/dasigners/v1/keeper/grpc_query.go +++ b/x/dasigners/v1/keeper/grpc_query.go @@ -43,7 +43,7 @@ func (k Keeper) EpochSignerSet(c context.Context, request *types.QueryEpochSigne epochSignerSet := make([]*types.Signer, 0) signers, found := k.GetEpochSignerSet(ctx, request.EpochNumber) if !found { - return &types.QueryEpochSignerSetResponse{Signers: epochSignerSet}, nil + return &types.QueryEpochSignerSetResponse{Signers: epochSignerSet}, types.ErrEpochSignerSetNotFound } for _, account := range signers.Signers { signer, found, err := k.GetSigner(ctx, account) diff --git a/x/dasigners/v1/keeper/keeper.go b/x/dasigners/v1/keeper/keeper.go index dad48038..44d437e5 100644 --- a/x/dasigners/v1/keeper/keeper.go +++ b/x/dasigners/v1/keeper/keeper.go @@ -104,7 +104,8 @@ func (k Keeper) SetSigner(ctx sdk.Context, signer types.Signer) error { func (k Keeper) IterateSigners(ctx sdk.Context, fn func(index int64, signer types.Signer) (stop bool)) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.SignerKeyPrefix) + prefix := types.SignerKeyPrefix + iterator := sdk.KVStorePrefixIterator(store, prefix) defer iterator.Close() i := int64(0) @@ -122,7 +123,7 @@ func (k Keeper) IterateSigners(ctx sdk.Context, fn func(index int64, signer type } func (k Keeper) GetEpochSignerSet(ctx sdk.Context, epoch uint64) (types.EpochSignerSet, bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.SignerKeyPrefix) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.EpochSignerSetKeyPrefix) bz := store.Get(types.GetEpochSignerSetKeyFromEpoch(epoch)) if bz == nil { return types.EpochSignerSet{}, false @@ -155,13 +156,14 @@ func (k Keeper) GetRegistration(ctx sdk.Context, epoch uint64, account string) ( func (k Keeper) IterateRegistrations(ctx sdk.Context, epoch uint64, fn func(account string, signature []byte) (stop bool)) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.GetEpochRegistrationKeyPrefix(epoch)) + prefix := types.GetEpochRegistrationKeyPrefix(epoch) + iterator := sdk.KVStorePrefixIterator(store, prefix) defer iterator.Close() i := int64(0) for ; iterator.Valid(); iterator.Next() { - stop := fn(hex.EncodeToString(iterator.Key()), iterator.Value()) + stop := fn(hex.EncodeToString((iterator.Key())[len(prefix):]), iterator.Value()) if stop { break diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index 423fa102..b3a4c651 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -16,9 +16,9 @@ func NewGenesisState(params Params, epoch uint64, signers []*Signer, signersByEp func DefaultGenesisState() *GenesisState { return NewGenesisState(Params{ QuorumSize: 1024, - TokensPerVote: "1000", + TokensPerVote: "100", MaxVotes: 100, - EpochBlocks: 5, + EpochBlocks: 1000, }, 0, make([]*Signer, 0), make([]*EpochSignerSet, 0)) } diff --git a/x/dasigners/v1/types/keys.go b/x/dasigners/v1/types/keys.go index 47ad3b95..d49436fc 100644 --- a/x/dasigners/v1/types/keys.go +++ b/x/dasigners/v1/types/keys.go @@ -14,7 +14,7 @@ const ( StoreKey = ModuleName // QuerierRoute Top level query string - QuerierRoute = ModuleName + QuerierRoute = "dasigners" ) var ( From 3f7ae266fba64a2747e6ec58e3e9d5db460b6712 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Sat, 11 May 2024 17:13:54 +0800 Subject: [PATCH 04/26] feat: update dasigners proto api --- precompiles/dasigners/IDASigners.abi | 10 + precompiles/dasigners/IDASigners.sol | 387 --------------------------- precompiles/dasigners/contract.go | 39 ++- precompiles/dasigners/query.go | 2 +- proto/zgc/dasigners/v1/query.proto | 10 +- x/dasigners/v1/keeper/grpc_query.go | 8 +- x/dasigners/v1/types/genesis.go | 2 +- x/dasigners/v1/types/query.pb.go | 132 ++++++--- x/dasigners/v1/types/query.pb.gw.go | 8 +- 9 files changed, 152 insertions(+), 446 deletions(-) delete mode 100644 precompiles/dasigners/IDASigners.sol diff --git a/precompiles/dasigners/IDASigners.abi b/precompiles/dasigners/IDASigners.abi index 6215c2c5..0bb6d20f 100644 --- a/precompiles/dasigners/IDASigners.abi +++ b/precompiles/dasigners/IDASigners.abi @@ -111,6 +111,16 @@ "internalType": "struct BN254.G1Point", "name": "aggPkG1", "type": "tuple" + }, + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "hit", + "type": "uint256" } ], "stateMutability": "view", diff --git a/precompiles/dasigners/IDASigners.sol b/precompiles/dasigners/IDASigners.sol deleted file mode 100644 index 889ae39a..00000000 --- a/precompiles/dasigners/IDASigners.sol +++ /dev/null @@ -1,387 +0,0 @@ -// Sources flattened with hardhat v2.22.2 https://hardhat.org - -// SPDX-License-Identifier: LGPL-3.0-only AND MIT - -// File contracts/libraries/BN254.sol - -// Original license: SPDX_License_Identifier: MIT -// several functions are taken or adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol (MIT license): -// Copyright 2017 Christian Reitwiessner -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. - -// The remainder of the code in this library is written by LayrLabs Inc. and is also under an MIT license - -pragma solidity ^0.8.12; - -/** - * @title Library for operations on the BN254 elliptic curve. - * @author Layr Labs, Inc. - * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service - * @notice Contains BN254 parameters, common operations (addition, scalar mul, pairing), and BLS signature functionality. - */ -library BN254 { - // modulus for the underlying field F_p of the elliptic curve - uint internal constant FP_MODULUS = 21888242871839275222246405745257275088696311157297823662689037894645226208583; - // modulus for the underlying field F_r of the elliptic curve - uint internal constant FR_MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617; - - struct G1Point { - uint X; - uint Y; - } - - // Encoding of field elements is: X[1] * i + X[0] - struct G2Point { - uint[2] X; - uint[2] Y; - } - - function generatorG1() internal pure returns (G1Point memory) { - return G1Point(1, 2); - } - - // generator of group G2 - /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1). - uint internal constant G2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; - uint internal constant G2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; - uint internal constant G2y1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531; - uint internal constant G2y0 = 8495653923123431417604973247489272438418190587263600148770280649306958101930; - - /// @notice returns the G2 generator - /// @dev mind the ordering of the 1s and 0s! - /// this is because of the (unknown to us) convention used in the bn254 pairing precompile contract - /// "Elements a * i + b of F_p^2 are encoded as two elements of F_p, (a, b)." - /// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-197.md#encoding - function generatorG2() internal pure returns (G2Point memory) { - return G2Point([G2x1, G2x0], [G2y1, G2y0]); - } - - // negation of the generator of group G2 - /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1). - uint internal constant nG2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; - uint internal constant nG2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; - uint internal constant nG2y1 = 17805874995975841540914202342111839520379459829704422454583296818431106115052; - uint internal constant nG2y0 = 13392588948715843804641432497768002650278120570034223513918757245338268106653; - - function negGeneratorG2() internal pure returns (G2Point memory) { - return G2Point([nG2x1, nG2x0], [nG2y1, nG2y0]); - } - - bytes32 internal constant powersOfTauMerkleRoot = - 0x22c998e49752bbb1918ba87d6d59dd0e83620a311ba91dd4b2cc84990b31b56f; - - /** - * @param p Some point in G1. - * @return The negation of `p`, i.e. p.plus(p.negate()) should be zero. - */ - function negate(G1Point memory p) internal pure returns (G1Point memory) { - // The prime q in the base field F_q for G1 - if (p.X == 0 && p.Y == 0) { - return G1Point(0, 0); - } else { - return G1Point(p.X, FP_MODULUS - (p.Y % FP_MODULUS)); - } - } - - /** - * @return r the sum of two points of G1 - */ - function plus(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) { - uint[4] memory input; - input[0] = p1.X; - input[1] = p1.Y; - input[2] = p2.X; - input[3] = p2.Y; - bool success; - - // solium-disable-next-line security/no-inline-assembly - assembly { - success := staticcall(sub(gas(), 2000), 6, input, 0x80, r, 0x40) - // Use "invalid" to make gas estimation work - switch success - case 0 { - invalid() - } - } - - require(success, "ec-add-failed"); - } - - /** - * @notice an optimized ecMul implementation that takes O(log_2(s)) ecAdds - * @param p the point to multiply - * @param s the scalar to multiply by - * @dev this function is only safe to use if the scalar is 9 bits or less - */ - function scalar_mul_tiny(BN254.G1Point memory p, uint16 s) internal view returns (BN254.G1Point memory) { - require(s < 2 ** 9, "scalar-too-large"); - - // if s is 1 return p - if (s == 1) { - return p; - } - - // the accumulated product to return - BN254.G1Point memory acc = BN254.G1Point(0, 0); - // the 2^n*p to add to the accumulated product in each iteration - BN254.G1Point memory p2n = p; - // value of most significant bit - uint16 m = 1; - // index of most significant bit - uint8 i = 0; - - //loop until we reach the most significant bit - while (s >= m) { - unchecked { - // if the current bit is 1, add the 2^n*p to the accumulated product - if ((s >> i) & 1 == 1) { - acc = plus(acc, p2n); - } - // double the 2^n*p for the next iteration - p2n = plus(p2n, p2n); - - // increment the index and double the value of the most significant bit - m <<= 1; - ++i; - } - } - - // return the accumulated product - return acc; - } - - /** - * @return r the product of a point on G1 and a scalar, i.e. - * p == p.scalar_mul(1) and p.plus(p) == p.scalar_mul(2) for all - * points p. - */ - function scalar_mul(G1Point memory p, uint s) internal view returns (G1Point memory r) { - uint[3] memory input; - input[0] = p.X; - input[1] = p.Y; - input[2] = s; - bool success; - // solium-disable-next-line security/no-inline-assembly - assembly { - success := staticcall(sub(gas(), 2000), 7, input, 0x60, r, 0x40) - // Use "invalid" to make gas estimation work - switch success - case 0 { - invalid() - } - } - require(success, "ec-mul-failed"); - } - - /** - * @return The result of computing the pairing check - * e(p1[0], p2[0]) * .... * e(p1[n], p2[n]) == 1 - * For example, - * pairing([P1(), P1().negate()], [P2(), P2()]) should return true. - */ - function pairing( - G1Point memory a1, - G2Point memory a2, - G1Point memory b1, - G2Point memory b2 - ) internal view returns (bool) { - G1Point[2] memory p1 = [a1, b1]; - G2Point[2] memory p2 = [a2, b2]; - - uint[12] memory input; - - for (uint i = 0; i < 2; i++) { - uint j = i * 6; - input[j + 0] = p1[i].X; - input[j + 1] = p1[i].Y; - input[j + 2] = p2[i].X[0]; - input[j + 3] = p2[i].X[1]; - input[j + 4] = p2[i].Y[0]; - input[j + 5] = p2[i].Y[1]; - } - - uint[1] memory out; - bool success; - - // solium-disable-next-line security/no-inline-assembly - assembly { - success := staticcall(sub(gas(), 2000), 8, input, mul(12, 0x20), out, 0x20) - // Use "invalid" to make gas estimation work - switch success - case 0 { - invalid() - } - } - - require(success, "pairing-opcode-failed"); - - return out[0] != 0; - } - - /** - * @notice This function is functionally the same as pairing(), however it specifies a gas limit - * the user can set, as a precompile may use the entire gas budget if it reverts. - */ - function safePairing( - G1Point memory a1, - G2Point memory a2, - G1Point memory b1, - G2Point memory b2, - uint pairingGas - ) internal view returns (bool, bool) { - G1Point[2] memory p1 = [a1, b1]; - G2Point[2] memory p2 = [a2, b2]; - - uint[12] memory input; - - for (uint i = 0; i < 2; i++) { - uint j = i * 6; - input[j + 0] = p1[i].X; - input[j + 1] = p1[i].Y; - input[j + 2] = p2[i].X[0]; - input[j + 3] = p2[i].X[1]; - input[j + 4] = p2[i].Y[0]; - input[j + 5] = p2[i].Y[1]; - } - - uint[1] memory out; - bool success; - - // solium-disable-next-line security/no-inline-assembly - assembly { - success := staticcall(pairingGas, 8, input, mul(12, 0x20), out, 0x20) - } - - //Out is the output of the pairing precompile, either 0 or 1 based on whether the two pairings are equal. - //Success is true if the precompile actually goes through (aka all inputs are valid) - - return (success, out[0] != 0); - } - - /// @return hashedG1 the keccak256 hash of the G1 Point - /// @dev used for BLS signatures - function hashG1Point(BN254.G1Point memory pk) internal pure returns (bytes32 hashedG1) { - assembly { - mstore(0, mload(pk)) - mstore(0x20, mload(add(0x20, pk))) - hashedG1 := keccak256(0, 0x40) - } - } - - /// @return the keccak256 hash of the G2 Point - /// @dev used for BLS signatures - function hashG2Point(BN254.G2Point memory pk) internal pure returns (bytes32) { - return keccak256(abi.encodePacked(pk.X[0], pk.X[1], pk.Y[0], pk.Y[1])); - } - - /** - * @notice adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol - */ - function hashToG1(bytes32 _x) internal view returns (G1Point memory) { - uint beta = 0; - uint y = 0; - - uint x = uint(_x) % FP_MODULUS; - - while (true) { - (beta, y) = findYFromX(x); - - // y^2 == beta - if (beta == mulmod(y, y, FP_MODULUS)) { - return G1Point(x, y); - } - - x = addmod(x, 1, FP_MODULUS); - } - return G1Point(0, 0); - } - - /** - * Given X, find Y - * - * where y = sqrt(x^3 + b) - * - * Returns: (x^3 + b), y - */ - function findYFromX(uint x) internal view returns (uint, uint) { - // beta = (x^3 + b) % p - uint beta = addmod(mulmod(mulmod(x, x, FP_MODULUS), x, FP_MODULUS), 3, FP_MODULUS); - - // y^2 = x^3 + b - // this acts like: y = sqrt(beta) = beta^((p+1) / 4) - uint y = expMod(beta, 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52, FP_MODULUS); - - return (beta, y); - } - - function expMod(uint _base, uint _exponent, uint _modulus) internal view returns (uint retval) { - bool success; - uint[1] memory output; - uint[6] memory input; - input[0] = 0x20; // baseLen = new(big.Int).SetBytes(getData(input, 0, 32)) - input[1] = 0x20; // expLen = new(big.Int).SetBytes(getData(input, 32, 32)) - input[2] = 0x20; // modLen = new(big.Int).SetBytes(getData(input, 64, 32)) - input[3] = _base; - input[4] = _exponent; - input[5] = _modulus; - assembly { - success := staticcall(sub(gas(), 2000), 5, input, 0xc0, output, 0x20) - // Use "invalid" to make gas estimation work - switch success - case 0 { - invalid() - } - } - require(success, "BN254.expMod: call failure"); - return output[0]; - } -} - - -// File contracts/interface/IDASigners.sol - -// Original license: SPDX_License_Identifier: LGPL-3.0-only - -pragma solidity >=0.8.0 <0.9.0; - -interface IDASigners { - /*=== struct ===*/ - struct SignerDetail { - string socket; - BN254.G1Point pkG1; - BN254.G2Point pkG2; - } - - /*=== event ===*/ - event NewSigner(address indexed signer, BN254.G1Point pkG1, BN254.G2Point pkG2); - event SocketUpdated(address indexed signer, string socket); - - /*=== function ===*/ - function epochNumber() external view returns (uint); - - function getSigners(uint epoch) external view returns (address[] memory accounts, SignerDetail[] memory details); - - function registerSigner(SignerDetail memory _signer, BN254.G1Point memory _signature) external; - - function checkSignatures( - BN254.G1Point memory _hash, - uint epoch, - bytes memory signerBitmap, - BN254.G2Point memory _aggPkG2, - BN254.G1Point memory _signature - ) external view returns (bool); -} \ No newline at end of file diff --git a/precompiles/dasigners/contract.go b/precompiles/dasigners/contract.go index b558627b..8966d62f 100644 --- a/precompiles/dasigners/contract.go +++ b/precompiles/dasigners/contract.go @@ -30,7 +30,7 @@ var ( // DASignersMetaData contains all meta data concerning the DASigners contract. var DASignersMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signersBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"}],\"name\":\"getSigners\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"details\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signersBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"}],\"name\":\"getSigners\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"details\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // DASignersABI is the input ABI used to generate the binding from. @@ -212,32 +212,51 @@ func (_DASigners *DASignersCallerSession) EpochNumber() (*big.Int, error) { // GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) -func (_DASigners *DASignersCaller) GetAggPkG1(opts *bind.CallOpts, epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersCaller) GetAggPkG1(opts *bind.CallOpts, epoch *big.Int, signersBitmap []byte) (struct { + AggPkG1 BN254G1Point + Total *big.Int + Hit *big.Int +}, error) { var out []interface{} err := _DASigners.contract.Call(opts, &out, "getAggPkG1", epoch, signersBitmap) + outstruct := new(struct { + AggPkG1 BN254G1Point + Total *big.Int + Hit *big.Int + }) if err != nil { - return *new(BN254G1Point), err + return *outstruct, err } - out0 := *abi.ConvertType(out[0], new(BN254G1Point)).(*BN254G1Point) + outstruct.AggPkG1 = *abi.ConvertType(out[0], new(BN254G1Point)).(*BN254G1Point) + outstruct.Total = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Hit = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - return out0, err + return *outstruct, err } // GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) -func (_DASigners *DASignersSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (struct { + AggPkG1 BN254G1Point + Total *big.Int + Hit *big.Int +}, error) { return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, epoch, signersBitmap) } // GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) -func (_DASigners *DASignersCallerSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersCallerSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (struct { + AggPkG1 BN254G1Point + Total *big.Int + Hit *big.Int +}, error) { return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, epoch, signersBitmap) } diff --git a/precompiles/dasigners/query.go b/precompiles/dasigners/query.go index 8753d97d..2a63aeff 100644 --- a/precompiles/dasigners/query.go +++ b/precompiles/dasigners/query.go @@ -53,5 +53,5 @@ func (d *DASignersPrecompile) GetAggPkG1(ctx sdk.Context, _ *vm.EVM, method *abi if err != nil { return nil, err } - return method.Outputs.Pack(NewBN254G1Point(response.AggregatePubkeyG1)) + return method.Outputs.Pack(NewBN254G1Point(response.AggregatePubkeyG1), big.NewInt(int64(response.Total)), big.NewInt(int64(response.Hit))) } diff --git a/proto/zgc/dasigners/v1/query.proto b/proto/zgc/dasigners/v1/query.proto index 336ac30e..b8811d26 100644 --- a/proto/zgc/dasigners/v1/query.proto +++ b/proto/zgc/dasigners/v1/query.proto @@ -14,16 +14,16 @@ option (gogoproto.goproto_getters_all) = false; // Query defines the gRPC querier service for the dasigners module service Query { rpc EpochNumber(QueryEpochNumberRequest) returns (QueryEpochNumberResponse) { - option (google.api.http).get = "/0gchain/dasigners/v1/epoch-number"; + option (google.api.http).get = "/0g/dasigners/v1/epoch-number"; } rpc EpochSignerSet(QueryEpochSignerSetRequest) returns (QueryEpochSignerSetResponse) { - option (google.api.http).get = "/0gchain/dasigners/v1/epoch-signer-set"; + option (google.api.http).get = "/0g/dasigners/v1/epoch-signer-set"; } rpc AggregatePubkeyG1(QueryAggregatePubkeyG1Request) returns (QueryAggregatePubkeyG1Response) { - option (google.api.http).get = "/0gchain/dasigners/v1/aggregate-pubkey-g1"; + option (google.api.http).get = "/0g/dasigners/v1/aggregate-pubkey-g1"; } rpc Signer(QuerySignerRequest) returns (QuerySignerResponse) { - option (google.api.http).get = "/0gchain/dasigners/v1/signer"; + option (google.api.http).get = "/0g/dasigners/v1/signer"; } } @@ -56,4 +56,6 @@ message QueryAggregatePubkeyG1Request { message QueryAggregatePubkeyG1Response { bytes aggregate_pubkey_g1 = 1; + uint64 total = 2; + uint64 hit = 3; } diff --git a/x/dasigners/v1/keeper/grpc_query.go b/x/dasigners/v1/keeper/grpc_query.go index cb0d1dbf..4dc1c749 100644 --- a/x/dasigners/v1/keeper/grpc_query.go +++ b/x/dasigners/v1/keeper/grpc_query.go @@ -40,11 +40,11 @@ func (k Keeper) EpochNumber( func (k Keeper) EpochSignerSet(c context.Context, request *types.QueryEpochSignerSetRequest) (*types.QueryEpochSignerSetResponse, error) { ctx := sdk.UnwrapSDKContext(c) - epochSignerSet := make([]*types.Signer, 0) signers, found := k.GetEpochSignerSet(ctx, request.EpochNumber) if !found { - return &types.QueryEpochSignerSetResponse{Signers: epochSignerSet}, types.ErrEpochSignerSetNotFound + return nil, types.ErrEpochSignerSetNotFound } + epochSignerSet := make([]*types.Signer, len(signers.Signers)) for _, account := range signers.Signers { signer, found, err := k.GetSigner(ctx, account) if err != nil { @@ -68,6 +68,7 @@ func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggrega return nil, types.ErrSignerLengthNotMatch } aggPubkeyG1 := new(bn254.G1Affine) + hit := 0 for i, account := range signers.Signers { b := request.SignersBitmap[i/8] & (1 << (i % 8)) if b == 0 { @@ -80,9 +81,12 @@ func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggrega if !found { return nil, types.ErrSignerNotFound } + hit += 1 aggPubkeyG1.Add(aggPubkeyG1, bn254util.DeserializeG1(signer.PubkeyG1)) } return &types.QueryAggregatePubkeyG1Response{ AggregatePubkeyG1: bn254util.SerializeG1(aggPubkeyG1), + Total: uint64(len(signers.Signers)), + Hit: uint64(hit), }, nil } diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index b3a4c651..b6e5df85 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -18,7 +18,7 @@ func DefaultGenesisState() *GenesisState { QuorumSize: 1024, TokensPerVote: "100", MaxVotes: 100, - EpochBlocks: 1000, + EpochBlocks: 10, }, 0, make([]*Signer, 0), make([]*EpochSignerSet, 0)) } diff --git a/x/dasigners/v1/types/query.pb.go b/x/dasigners/v1/types/query.pb.go index 18418579..fac6e645 100644 --- a/x/dasigners/v1/types/query.pb.go +++ b/x/dasigners/v1/types/query.pb.go @@ -293,6 +293,8 @@ var xxx_messageInfo_QueryAggregatePubkeyG1Request proto.InternalMessageInfo type QueryAggregatePubkeyG1Response struct { AggregatePubkeyG1 []byte `protobuf:"bytes,1,opt,name=aggregate_pubkey_g1,json=aggregatePubkeyG1,proto3" json:"aggregate_pubkey_g1,omitempty"` + Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + Hit uint64 `protobuf:"varint,3,opt,name=hit,proto3" json:"hit,omitempty"` } func (m *QueryAggregatePubkeyG1Response) Reset() { *m = QueryAggregatePubkeyG1Response{} } @@ -342,43 +344,45 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/query.proto", fileDescriptor_991a610b84b5964c) } var fileDescriptor_991a610b84b5964c = []byte{ - // 575 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x30, - 0x14, 0x6f, 0xc6, 0xe8, 0x84, 0x5b, 0x10, 0xf3, 0x90, 0x48, 0x43, 0x09, 0x25, 0x2a, 0xa8, 0x1b, - 0x24, 0x6e, 0xca, 0x19, 0x21, 0x26, 0xa1, 0x9d, 0x40, 0x5b, 0x77, 0xe3, 0x52, 0x39, 0xc1, 0xb8, - 0x11, 0x4b, 0x9c, 0xd5, 0xce, 0x44, 0xc7, 0x8d, 0x4f, 0x30, 0x89, 0x33, 0x1f, 0x80, 0x6f, 0xb2, - 0xe3, 0x24, 0x2e, 0x1c, 0xa1, 0xe5, 0x83, 0xa0, 0xda, 0x6e, 0x4b, 0xfa, 0x6f, 0xbd, 0xd9, 0xef, - 0xfd, 0xde, 0xef, 0xf7, 0x7b, 0x7e, 0x4f, 0x06, 0xd5, 0x73, 0x1a, 0xa2, 0x0f, 0x98, 0x47, 0x34, - 0x21, 0x3d, 0x8e, 0xce, 0x7c, 0x74, 0x9a, 0x91, 0x5e, 0xdf, 0x4b, 0x7b, 0x4c, 0x30, 0x78, 0xf7, - 0x9c, 0x86, 0xde, 0x24, 0xeb, 0x9d, 0xf9, 0x56, 0x25, 0x64, 0x3c, 0x66, 0xbc, 0x23, 0xf3, 0x48, - 0x5d, 0x14, 0xd8, 0xba, 0x47, 0x19, 0x65, 0x2a, 0x3e, 0x3a, 0xe9, 0x68, 0x95, 0x32, 0x46, 0x4f, - 0x08, 0xc2, 0x69, 0x84, 0x70, 0x92, 0x30, 0x81, 0x45, 0xc4, 0x92, 0x71, 0x4d, 0x45, 0x67, 0xe5, - 0x2d, 0xc8, 0x3e, 0x22, 0x9c, 0x68, 0x6d, 0xeb, 0xd1, 0x6c, 0x4a, 0x44, 0x31, 0xe1, 0x02, 0xc7, - 0xa9, 0x06, 0xd4, 0xe6, 0xac, 0x4f, 0x9d, 0x4a, 0x84, 0xe3, 0x01, 0x78, 0x34, 0xea, 0xe6, 0x58, - 0x46, 0xdb, 0xe4, 0x34, 0x23, 0x5c, 0x40, 0x13, 0x6c, 0xe1, 0x30, 0x64, 0x59, 0x22, 0x4c, 0xa3, - 0x66, 0x34, 0x6e, 0xb5, 0xc7, 0x57, 0xe7, 0x00, 0xec, 0xe4, 0xf0, 0x3c, 0x65, 0x09, 0x27, 0xb0, - 0x09, 0x8a, 0x8a, 0x57, 0xe2, 0x4b, 0x2d, 0xd3, 0x9b, 0x7d, 0x16, 0x4f, 0x57, 0x68, 0x9c, 0x53, - 0x01, 0xf7, 0x25, 0xd1, 0x9b, 0x94, 0x85, 0xdd, 0x77, 0x59, 0x1c, 0x4c, 0xd4, 0x9d, 0x97, 0xc0, - 0x9c, 0x4f, 0x69, 0xa1, 0xc7, 0xa0, 0x4c, 0x46, 0xe1, 0x4e, 0x22, 0xe3, 0x52, 0x6e, 0xb3, 0x5d, - 0x22, 0x53, 0xa8, 0xf3, 0x0a, 0x58, 0xd3, 0x72, 0xa5, 0x7a, 0x4c, 0xc4, 0xb8, 0xb5, 0x35, 0x08, - 0x8e, 0xc0, 0x83, 0x85, 0x04, 0xda, 0x42, 0x0b, 0x6c, 0xe9, 0xb6, 0x4c, 0xa3, 0x76, 0x63, 0x65, - 0xb3, 0x63, 0xa0, 0xd3, 0x05, 0x0f, 0x25, 0xe5, 0x6b, 0x4a, 0x7b, 0x84, 0x62, 0x41, 0x0e, 0xb3, - 0xe0, 0x13, 0xe9, 0x1f, 0xf8, 0xeb, 0xdb, 0x82, 0x75, 0x70, 0x5b, 0xd3, 0xed, 0x47, 0x22, 0xc6, - 0xa9, 0xb9, 0x51, 0x33, 0x1a, 0xe5, 0x76, 0x3e, 0xe8, 0x1c, 0x02, 0x7b, 0x99, 0x92, 0xf6, 0xef, - 0x81, 0x1d, 0x3c, 0x4e, 0x76, 0x52, 0x99, 0xed, 0x50, 0x5f, 0x2a, 0x96, 0xdb, 0xdb, 0x78, 0xb6, - 0xae, 0x35, 0xdc, 0x04, 0x37, 0x25, 0x25, 0xbc, 0x30, 0x40, 0xe9, 0xbf, 0xa1, 0xc0, 0xdd, 0xf9, - 0xc6, 0x97, 0xcc, 0xd4, 0xda, 0x5b, 0x07, 0xaa, 0x0c, 0x3a, 0x7b, 0x5f, 0x7f, 0xfe, 0xfd, 0xb6, - 0x51, 0x87, 0x0e, 0x6a, 0xd2, 0xb0, 0x8b, 0xa3, 0x24, 0xbf, 0xc2, 0xf2, 0x4d, 0x5c, 0xf5, 0x4e, - 0xf0, 0xbb, 0x01, 0xee, 0xe4, 0xe7, 0x04, 0x9f, 0xaf, 0x92, 0x9a, 0xdd, 0x07, 0xcb, 0x5d, 0x13, - 0xad, 0xbd, 0x79, 0xd2, 0x5b, 0x03, 0x3e, 0x5d, 0xe5, 0x4d, 0x05, 0x5c, 0x4e, 0x04, 0xfc, 0x61, - 0x80, 0xed, 0xb9, 0x51, 0x40, 0xb4, 0x44, 0x74, 0xd9, 0x7a, 0x58, 0xcd, 0xf5, 0x0b, 0xb4, 0x51, - 0x5f, 0x1a, 0x7d, 0x06, 0x77, 0x17, 0x1b, 0x9d, 0x8c, 0xd9, 0x55, 0x1b, 0xe0, 0x52, 0x1f, 0x7e, - 0x01, 0x45, 0xd5, 0x30, 0xac, 0x2f, 0x91, 0xcb, 0xfd, 0x12, 0xd6, 0x93, 0x6b, 0x50, 0xda, 0x49, - 0x5d, 0x3a, 0xb1, 0x61, 0x75, 0xb1, 0x13, 0x75, 0xdc, 0x7f, 0x7b, 0xf9, 0xc7, 0x2e, 0x5c, 0x0e, - 0x6c, 0xe3, 0x6a, 0x60, 0x1b, 0xbf, 0x07, 0xb6, 0x71, 0x31, 0xb4, 0x0b, 0x57, 0x43, 0xbb, 0xf0, - 0x6b, 0x68, 0x17, 0xde, 0x23, 0x1a, 0x89, 0x6e, 0x16, 0x78, 0x21, 0x8b, 0x51, 0x93, 0x9e, 0xe0, - 0x80, 0xa3, 0x26, 0x75, 0x15, 0xdb, 0xe7, 0x3c, 0x9f, 0xe8, 0xa7, 0x84, 0x07, 0x45, 0xf9, 0xbd, - 0xbd, 0xf8, 0x17, 0x00, 0x00, 0xff, 0xff, 0x83, 0xb0, 0xab, 0x12, 0xbd, 0x05, 0x00, 0x00, + // 600 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x4e, + 0x10, 0x8d, 0xfb, 0x57, 0xbf, 0x6d, 0x7e, 0xa8, 0xdd, 0x56, 0xaa, 0x63, 0x5a, 0x27, 0x35, 0x29, + 0x6a, 0x51, 0xed, 0x4d, 0xc2, 0x19, 0x21, 0x2a, 0xa1, 0x9e, 0x40, 0xd4, 0xbd, 0x71, 0x89, 0xd6, + 0x66, 0xd9, 0x58, 0xc4, 0x5e, 0x37, 0x5e, 0x47, 0x4d, 0x8f, 0x5c, 0xb9, 0x20, 0x71, 0xe1, 0x03, + 0xf0, 0x61, 0x7a, 0xa3, 0x12, 0x17, 0x8e, 0x90, 0xf0, 0x41, 0x50, 0x76, 0x37, 0x09, 0x8e, 0x71, + 0xc9, 0x6d, 0xf7, 0xcd, 0x9b, 0x79, 0x6f, 0x76, 0x46, 0x0b, 0xf6, 0xae, 0xa9, 0x8f, 0xde, 0xe0, + 0x24, 0xa0, 0x11, 0xe9, 0x25, 0xa8, 0xdf, 0x44, 0x97, 0x29, 0xe9, 0x0d, 0x9c, 0xb8, 0xc7, 0x38, + 0x83, 0x9b, 0xd7, 0xd4, 0x77, 0xa6, 0x51, 0xa7, 0xdf, 0x34, 0x2a, 0x3e, 0x4b, 0x42, 0x96, 0xb4, + 0x45, 0x1c, 0xc9, 0x8b, 0x24, 0x1b, 0x3b, 0x94, 0x51, 0x26, 0xf1, 0xf1, 0x49, 0xa1, 0x7b, 0x94, + 0x31, 0xda, 0x25, 0x08, 0xc7, 0x01, 0xc2, 0x51, 0xc4, 0x38, 0xe6, 0x01, 0x8b, 0x26, 0x39, 0x15, + 0x15, 0x15, 0x37, 0x2f, 0x7d, 0x8b, 0x70, 0xa4, 0xb4, 0x8d, 0xea, 0x7c, 0x88, 0x07, 0x21, 0x49, + 0x38, 0x0e, 0x63, 0x45, 0xa8, 0xe5, 0xac, 0xcf, 0x9c, 0x0a, 0x86, 0xe5, 0x00, 0x78, 0x3e, 0xee, + 0xe6, 0x42, 0xa0, 0x2e, 0xb9, 0x4c, 0x49, 0xc2, 0xa1, 0x0e, 0xd6, 0xb1, 0xef, 0xb3, 0x34, 0xe2, + 0xba, 0x56, 0xd3, 0x8e, 0xfe, 0x73, 0x27, 0x57, 0xeb, 0x0c, 0x6c, 0x67, 0xf8, 0x49, 0xcc, 0xa2, + 0x84, 0xc0, 0x06, 0x58, 0x93, 0x75, 0x05, 0x7f, 0xa3, 0xa5, 0x3b, 0xf3, 0xcf, 0xe2, 0xa8, 0x0c, + 0xc5, 0xb3, 0x2a, 0x60, 0x57, 0x14, 0x7a, 0x1e, 0x33, 0xbf, 0xf3, 0x32, 0x0d, 0xbd, 0xa9, 0xba, + 0xf5, 0x04, 0xe8, 0xf9, 0x90, 0x12, 0x3a, 0x00, 0x65, 0x32, 0x86, 0xdb, 0x91, 0xc0, 0x85, 0xdc, + 0x8a, 0xbb, 0x41, 0x66, 0x54, 0xeb, 0x29, 0x30, 0x66, 0xe9, 0x52, 0xf5, 0x82, 0xf0, 0x49, 0x6b, + 0x0b, 0x14, 0x38, 0x07, 0xf7, 0xff, 0x5a, 0x40, 0x59, 0x68, 0x81, 0x75, 0xd5, 0x96, 0xae, 0xd5, + 0x96, 0xef, 0x6c, 0x76, 0x42, 0xb4, 0x3a, 0x60, 0x5f, 0x94, 0x7c, 0x46, 0x69, 0x8f, 0x50, 0xcc, + 0xc9, 0xab, 0xd4, 0x7b, 0x47, 0x06, 0x67, 0xcd, 0xc5, 0x6d, 0xc1, 0x3a, 0xf8, 0x5f, 0x95, 0x3b, + 0x0d, 0x78, 0x88, 0x63, 0x7d, 0xa9, 0xa6, 0x1d, 0x95, 0xdd, 0x2c, 0x68, 0x5d, 0x01, 0xb3, 0x48, + 0x49, 0xf9, 0x77, 0xc0, 0x36, 0x9e, 0x04, 0xdb, 0xb1, 0x88, 0xb6, 0x69, 0x53, 0x28, 0x96, 0xdd, + 0x2d, 0x3c, 0x9f, 0x07, 0x77, 0xc0, 0x2a, 0x67, 0x1c, 0x77, 0x85, 0xde, 0x8a, 0x2b, 0x2f, 0x70, + 0x13, 0x2c, 0x77, 0x02, 0xae, 0x2f, 0x0b, 0x6c, 0x7c, 0x6c, 0x7d, 0x5d, 0x01, 0xab, 0x42, 0x1a, + 0x7e, 0xd0, 0xc0, 0xc6, 0x1f, 0xc3, 0x83, 0xc7, 0xf9, 0x07, 0x2a, 0x98, 0xbd, 0xf1, 0x68, 0x11, + 0xaa, 0x6c, 0xc4, 0x3a, 0x7c, 0xff, 0xed, 0xd7, 0xa7, 0xa5, 0x2a, 0xdc, 0x47, 0x0d, 0x9a, 0xdd, + 0x72, 0xf1, 0x6c, 0xb6, 0x7c, 0x4a, 0xf8, 0x59, 0x03, 0xf7, 0xb2, 0xa3, 0x84, 0x27, 0x77, 0xa9, + 0xcc, 0xaf, 0x8c, 0x61, 0x2f, 0xc8, 0x56, 0xb6, 0x8e, 0x85, 0xad, 0x07, 0xf0, 0xa0, 0xc0, 0x96, + 0x04, 0xec, 0x84, 0x70, 0xf8, 0x45, 0x03, 0x5b, 0xb9, 0x41, 0x41, 0x54, 0xa0, 0x57, 0xb4, 0x3c, + 0x46, 0x63, 0xf1, 0x04, 0xe5, 0xf1, 0x44, 0x78, 0x7c, 0x08, 0xeb, 0x39, 0x8f, 0xd3, 0xf9, 0xdb, + 0x72, 0x35, 0x6c, 0xda, 0x84, 0x7d, 0xb0, 0x26, 0xdb, 0x84, 0xf5, 0x02, 0xa5, 0xcc, 0xf7, 0x61, + 0x1c, 0xfe, 0x83, 0xa5, 0x4c, 0x54, 0x85, 0x89, 0x0a, 0xdc, 0xcd, 0x99, 0x90, 0xc7, 0xd3, 0x17, + 0x37, 0x3f, 0xcd, 0xd2, 0xcd, 0xd0, 0xd4, 0x6e, 0x87, 0xa6, 0xf6, 0x63, 0x68, 0x6a, 0x1f, 0x47, + 0x66, 0xe9, 0x76, 0x64, 0x96, 0xbe, 0x8f, 0xcc, 0xd2, 0x6b, 0x44, 0x03, 0xde, 0x49, 0x3d, 0xc7, + 0x67, 0x21, 0x6a, 0xd0, 0x2e, 0xf6, 0x12, 0xd4, 0xa0, 0xb6, 0xdf, 0xc1, 0x41, 0x84, 0xae, 0xb2, + 0xf5, 0xf8, 0x20, 0x26, 0x89, 0xb7, 0x26, 0xbe, 0xbc, 0xc7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x9b, 0xb2, 0x92, 0x94, 0xd1, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -805,6 +809,16 @@ func (m *QueryAggregatePubkeyG1Response) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.Hit != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Hit)) + i-- + dAtA[i] = 0x18 + } + if m.Total != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Total)) + i-- + dAtA[i] = 0x10 + } if len(m.AggregatePubkeyG1) > 0 { i -= len(m.AggregatePubkeyG1) copy(dAtA[i:], m.AggregatePubkeyG1) @@ -926,6 +940,12 @@ func (m *QueryAggregatePubkeyG1Response) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.Total != 0 { + n += 1 + sovQuery(uint64(m.Total)) + } + if m.Hit != 0 { + n += 1 + sovQuery(uint64(m.Hit)) + } return n } @@ -1541,6 +1561,44 @@ func (m *QueryAggregatePubkeyG1Response) Unmarshal(dAtA []byte) error { m.AggregatePubkeyG1 = []byte{} } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + m.Total = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Total |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Hit", wireType) + } + m.Hit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Hit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/dasigners/v1/types/query.pb.gw.go b/x/dasigners/v1/types/query.pb.gw.go index e905a08f..362db812 100644 --- a/x/dasigners/v1/types/query.pb.gw.go +++ b/x/dasigners/v1/types/query.pb.gw.go @@ -382,13 +382,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_EpochNumber_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "epoch-number"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_EpochNumber_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-number"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_EpochSignerSet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "epoch-signer-set"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_EpochSignerSet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-signer-set"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_AggregatePubkeyG1_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "aggregate-pubkey-g1"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_AggregatePubkeyG1_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "aggregate-pubkey-g1"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Signer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "signer"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Signer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "signer"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( From dd986de44875f474607112fff9e2ece4b4849c6c Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Sat, 11 May 2024 17:33:24 +0800 Subject: [PATCH 05/26] fix: defaultGenesis --- x/dasigners/v1/types/genesis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index b6e5df85..b3a4c651 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -18,7 +18,7 @@ func DefaultGenesisState() *GenesisState { QuorumSize: 1024, TokensPerVote: "100", MaxVotes: 100, - EpochBlocks: 10, + EpochBlocks: 1000, }, 0, make([]*Signer, 0), make([]*EpochSignerSet, 0)) } From 0cc08ddba923b675eacf776f2432a4bb641ef36e Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Thu, 16 May 2024 22:49:29 +0800 Subject: [PATCH 06/26] feat: quorum --- precompiles/dasigners/IDASigners.abi | 101 ++-- precompiles/dasigners/contract.go | 127 +++-- precompiles/dasigners/dasigners.go | 11 +- precompiles/dasigners/query.go | 28 +- precompiles/dasigners/types.go | 46 +- proto/zgc/dasigners/v1/dasigners.proto | 6 +- proto/zgc/dasigners/v1/genesis.proto | 12 +- proto/zgc/dasigners/v1/query.proto | 29 +- x/dasigners/v1/genesis.go | 14 +- x/dasigners/v1/keeper/abci.go | 31 +- x/dasigners/v1/keeper/grpc_query.go | 78 +-- x/dasigners/v1/keeper/keeper.go | 37 +- x/dasigners/v1/types/dasigners.pb.go | 258 +++++++-- x/dasigners/v1/types/errors.go | 13 +- x/dasigners/v1/types/genesis.go | 26 +- x/dasigners/v1/types/genesis.pb.go | 165 +++--- x/dasigners/v1/types/keys.go | 13 +- x/dasigners/v1/types/query.pb.go | 714 +++++++++++++++++++------ x/dasigners/v1/types/query.pb.gw.go | 117 +++- 19 files changed, 1300 insertions(+), 526 deletions(-) diff --git a/precompiles/dasigners/IDASigners.abi b/precompiles/dasigners/IDASigners.abi index 0bb6d20f..37631432 100644 --- a/precompiles/dasigners/IDASigners.abi +++ b/precompiles/dasigners/IDASigners.abi @@ -84,12 +84,17 @@ "inputs": [ { "internalType": "uint256", - "name": "epoch", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_quorumId", "type": "uint256" }, { "internalType": "bytes", - "name": "signersBitmap", + "name": "_quorumBitmap", "type": "bytes" } ], @@ -129,9 +134,33 @@ { "inputs": [ { - "internalType": "address", - "name": "account", - "type": "address" + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_quorumId", + "type": "uint256" + } + ], + "name": "getQuorum", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_account", + "type": "address[]" } ], "name": "getSigner", @@ -183,9 +212,9 @@ "type": "tuple" } ], - "internalType": "struct IDASigners.SignerDetail", + "internalType": "struct IDASigners.SignerDetail[]", "name": "", - "type": "tuple" + "type": "tuple[]" } ], "stateMutability": "view", @@ -195,62 +224,16 @@ "inputs": [ { "internalType": "uint256", - "name": "epoch", + "name": "_epoch", "type": "uint256" } ], - "name": "getSigners", + "name": "quorumCount", "outputs": [ { - "components": [ - { - "internalType": "address", - "name": "signer", - "type": "address" - }, - { - "internalType": "string", - "name": "socket", - "type": "string" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "X", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "Y", - "type": "uint256" - } - ], - "internalType": "struct BN254.G1Point", - "name": "pkG1", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256[2]", - "name": "X", - "type": "uint256[2]" - }, - { - "internalType": "uint256[2]", - "name": "Y", - "type": "uint256[2]" - } - ], - "internalType": "struct BN254.G2Point", - "name": "pkG2", - "type": "tuple" - } - ], - "internalType": "struct IDASigners.SignerDetail[]", - "name": "details", - "type": "tuple[]" + "internalType": "uint256", + "name": "", + "type": "uint256" } ], "stateMutability": "view", @@ -361,7 +344,7 @@ "inputs": [ { "internalType": "string", - "name": "socket", + "name": "_socket", "type": "string" } ], diff --git a/precompiles/dasigners/contract.go b/precompiles/dasigners/contract.go index 8966d62f..566fefda 100644 --- a/precompiles/dasigners/contract.go +++ b/precompiles/dasigners/contract.go @@ -30,7 +30,7 @@ var ( // DASignersMetaData contains all meta data concerning the DASigners contract. var DASignersMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signersBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"}],\"name\":\"getSigners\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"details\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_quorumBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"}],\"name\":\"getQuorum\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_account\",\"type\":\"address[]\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"quorumCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // DASignersABI is the input ABI used to generate the binding from. @@ -210,16 +210,16 @@ func (_DASigners *DASignersCallerSession) EpochNumber() (*big.Int, error) { return _DASigners.Contract.EpochNumber(&_DASigners.CallOpts) } -// GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. +// GetAggPkG1 is a free data retrieval call binding the contract method 0x50b73739. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) -func (_DASigners *DASignersCaller) GetAggPkG1(opts *bind.CallOpts, epoch *big.Int, signersBitmap []byte) (struct { +// Solidity: function getAggPkG1(uint256 _epoch, uint256 _quorumId, bytes _quorumBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersCaller) GetAggPkG1(opts *bind.CallOpts, _epoch *big.Int, _quorumId *big.Int, _quorumBitmap []byte) (struct { AggPkG1 BN254G1Point Total *big.Int Hit *big.Int }, error) { var out []interface{} - err := _DASigners.contract.Call(opts, &out, "getAggPkG1", epoch, signersBitmap) + err := _DASigners.contract.Call(opts, &out, "getAggPkG1", _epoch, _quorumId, _quorumBitmap) outstruct := new(struct { AggPkG1 BN254G1Point @@ -238,65 +238,65 @@ func (_DASigners *DASignersCaller) GetAggPkG1(opts *bind.CallOpts, epoch *big.In } -// GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. +// GetAggPkG1 is a free data retrieval call binding the contract method 0x50b73739. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) -func (_DASigners *DASignersSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (struct { +// Solidity: function getAggPkG1(uint256 _epoch, uint256 _quorumId, bytes _quorumBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersSession) GetAggPkG1(_epoch *big.Int, _quorumId *big.Int, _quorumBitmap []byte) (struct { AggPkG1 BN254G1Point Total *big.Int Hit *big.Int }, error) { - return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, epoch, signersBitmap) + return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, _epoch, _quorumId, _quorumBitmap) } -// GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. +// GetAggPkG1 is a free data retrieval call binding the contract method 0x50b73739. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) -func (_DASigners *DASignersCallerSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (struct { +// Solidity: function getAggPkG1(uint256 _epoch, uint256 _quorumId, bytes _quorumBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersCallerSession) GetAggPkG1(_epoch *big.Int, _quorumId *big.Int, _quorumBitmap []byte) (struct { AggPkG1 BN254G1Point Total *big.Int Hit *big.Int }, error) { - return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, epoch, signersBitmap) + return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, _epoch, _quorumId, _quorumBitmap) } -// GetSigner is a free data retrieval call binding the contract method 0x1180b553. +// GetQuorum is a free data retrieval call binding the contract method 0x6ab6f654. // -// Solidity: function getSigner(address account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))) -func (_DASigners *DASignersCaller) GetSigner(opts *bind.CallOpts, account common.Address) (IDASignersSignerDetail, error) { +// Solidity: function getQuorum(uint256 _epoch, uint256 _quorumId) view returns(address[]) +func (_DASigners *DASignersCaller) GetQuorum(opts *bind.CallOpts, _epoch *big.Int, _quorumId *big.Int) ([]common.Address, error) { var out []interface{} - err := _DASigners.contract.Call(opts, &out, "getSigner", account) + err := _DASigners.contract.Call(opts, &out, "getQuorum", _epoch, _quorumId) if err != nil { - return *new(IDASignersSignerDetail), err + return *new([]common.Address), err } - out0 := *abi.ConvertType(out[0], new(IDASignersSignerDetail)).(*IDASignersSignerDetail) + out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) return out0, err } -// GetSigner is a free data retrieval call binding the contract method 0x1180b553. +// GetQuorum is a free data retrieval call binding the contract method 0x6ab6f654. // -// Solidity: function getSigner(address account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))) -func (_DASigners *DASignersSession) GetSigner(account common.Address) (IDASignersSignerDetail, error) { - return _DASigners.Contract.GetSigner(&_DASigners.CallOpts, account) +// Solidity: function getQuorum(uint256 _epoch, uint256 _quorumId) view returns(address[]) +func (_DASigners *DASignersSession) GetQuorum(_epoch *big.Int, _quorumId *big.Int) ([]common.Address, error) { + return _DASigners.Contract.GetQuorum(&_DASigners.CallOpts, _epoch, _quorumId) } -// GetSigner is a free data retrieval call binding the contract method 0x1180b553. +// GetQuorum is a free data retrieval call binding the contract method 0x6ab6f654. // -// Solidity: function getSigner(address account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))) -func (_DASigners *DASignersCallerSession) GetSigner(account common.Address) (IDASignersSignerDetail, error) { - return _DASigners.Contract.GetSigner(&_DASigners.CallOpts, account) +// Solidity: function getQuorum(uint256 _epoch, uint256 _quorumId) view returns(address[]) +func (_DASigners *DASignersCallerSession) GetQuorum(_epoch *big.Int, _quorumId *big.Int) ([]common.Address, error) { + return _DASigners.Contract.GetQuorum(&_DASigners.CallOpts, _epoch, _quorumId) } -// GetSigners is a free data retrieval call binding the contract method 0xdfceceae. +// GetSigner is a free data retrieval call binding the contract method 0xd1f5e5f8. // -// Solidity: function getSigners(uint256 epoch) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[] details) -func (_DASigners *DASignersCaller) GetSigners(opts *bind.CallOpts, epoch *big.Int) ([]IDASignersSignerDetail, error) { +// Solidity: function getSigner(address[] _account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[]) +func (_DASigners *DASignersCaller) GetSigner(opts *bind.CallOpts, _account []common.Address) ([]IDASignersSignerDetail, error) { var out []interface{} - err := _DASigners.contract.Call(opts, &out, "getSigners", epoch) + err := _DASigners.contract.Call(opts, &out, "getSigner", _account) if err != nil { return *new([]IDASignersSignerDetail), err @@ -308,18 +308,49 @@ func (_DASigners *DASignersCaller) GetSigners(opts *bind.CallOpts, epoch *big.In } -// GetSigners is a free data retrieval call binding the contract method 0xdfceceae. +// GetSigner is a free data retrieval call binding the contract method 0xd1f5e5f8. // -// Solidity: function getSigners(uint256 epoch) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[] details) -func (_DASigners *DASignersSession) GetSigners(epoch *big.Int) ([]IDASignersSignerDetail, error) { - return _DASigners.Contract.GetSigners(&_DASigners.CallOpts, epoch) +// Solidity: function getSigner(address[] _account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[]) +func (_DASigners *DASignersSession) GetSigner(_account []common.Address) ([]IDASignersSignerDetail, error) { + return _DASigners.Contract.GetSigner(&_DASigners.CallOpts, _account) } -// GetSigners is a free data retrieval call binding the contract method 0xdfceceae. +// GetSigner is a free data retrieval call binding the contract method 0xd1f5e5f8. // -// Solidity: function getSigners(uint256 epoch) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[] details) -func (_DASigners *DASignersCallerSession) GetSigners(epoch *big.Int) ([]IDASignersSignerDetail, error) { - return _DASigners.Contract.GetSigners(&_DASigners.CallOpts, epoch) +// Solidity: function getSigner(address[] _account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[]) +func (_DASigners *DASignersCallerSession) GetSigner(_account []common.Address) ([]IDASignersSignerDetail, error) { + return _DASigners.Contract.GetSigner(&_DASigners.CallOpts, _account) +} + +// QuorumCount is a free data retrieval call binding the contract method 0x5ecba503. +// +// Solidity: function quorumCount(uint256 _epoch) view returns(uint256) +func (_DASigners *DASignersCaller) QuorumCount(opts *bind.CallOpts, _epoch *big.Int) (*big.Int, error) { + var out []interface{} + err := _DASigners.contract.Call(opts, &out, "quorumCount", _epoch) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// QuorumCount is a free data retrieval call binding the contract method 0x5ecba503. +// +// Solidity: function quorumCount(uint256 _epoch) view returns(uint256) +func (_DASigners *DASignersSession) QuorumCount(_epoch *big.Int) (*big.Int, error) { + return _DASigners.Contract.QuorumCount(&_DASigners.CallOpts, _epoch) +} + +// QuorumCount is a free data retrieval call binding the contract method 0x5ecba503. +// +// Solidity: function quorumCount(uint256 _epoch) view returns(uint256) +func (_DASigners *DASignersCallerSession) QuorumCount(_epoch *big.Int) (*big.Int, error) { + return _DASigners.Contract.QuorumCount(&_DASigners.CallOpts, _epoch) } // RegisterNextEpoch is a paid mutator transaction binding the contract method 0x56a32372. @@ -366,23 +397,23 @@ func (_DASigners *DASignersTransactorSession) RegisterSigner(_signer IDASignersS // UpdateSocket is a paid mutator transaction binding the contract method 0x0cf4b767. // -// Solidity: function updateSocket(string socket) returns() -func (_DASigners *DASignersTransactor) UpdateSocket(opts *bind.TransactOpts, socket string) (*types.Transaction, error) { - return _DASigners.contract.Transact(opts, "updateSocket", socket) +// Solidity: function updateSocket(string _socket) returns() +func (_DASigners *DASignersTransactor) UpdateSocket(opts *bind.TransactOpts, _socket string) (*types.Transaction, error) { + return _DASigners.contract.Transact(opts, "updateSocket", _socket) } // UpdateSocket is a paid mutator transaction binding the contract method 0x0cf4b767. // -// Solidity: function updateSocket(string socket) returns() -func (_DASigners *DASignersSession) UpdateSocket(socket string) (*types.Transaction, error) { - return _DASigners.Contract.UpdateSocket(&_DASigners.TransactOpts, socket) +// Solidity: function updateSocket(string _socket) returns() +func (_DASigners *DASignersSession) UpdateSocket(_socket string) (*types.Transaction, error) { + return _DASigners.Contract.UpdateSocket(&_DASigners.TransactOpts, _socket) } // UpdateSocket is a paid mutator transaction binding the contract method 0x0cf4b767. // -// Solidity: function updateSocket(string socket) returns() -func (_DASigners *DASignersTransactorSession) UpdateSocket(socket string) (*types.Transaction, error) { - return _DASigners.Contract.UpdateSocket(&_DASigners.TransactOpts, socket) +// Solidity: function updateSocket(string _socket) returns() +func (_DASigners *DASignersTransactorSession) UpdateSocket(_socket string) (*types.Transaction, error) { + return _DASigners.Contract.UpdateSocket(&_DASigners.TransactOpts, _socket) } // DASignersNewSignerIterator is returned from FilterNewSigner and is used to iterate over the raw logs and unpacked data for NewSigner events raised by the DASigners contract. diff --git a/precompiles/dasigners/dasigners.go b/precompiles/dasigners/dasigners.go index 61ba2a17..87816ae6 100644 --- a/precompiles/dasigners/dasigners.go +++ b/precompiles/dasigners/dasigners.go @@ -19,11 +19,12 @@ const ( RequiredGasMax uint64 = 1000_000_000 DASignersFunctionEpochNumber = "epochNumber" + DASignersFunctionQuorumCount = "quorumCount" DASignersFunctionGetSigner = "getSigner" - DASignersFunctionGetSigners = "getSigners" + DASignersFunctionGetQuorum = "getQuorum" + DASignersFunctionRegisterSigner = "registerSigner" DASignersFunctionUpdateSocket = "updateSocket" DASignersFunctionRegisterNextEpoch = "registerNextEpoch" - DASignersFunctionRegisterSigner = "registerSigner" DASignersFunctionGetAggPkG1 = "getAggPkG1" ) @@ -111,10 +112,12 @@ func (d *DASignersPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly b // queries case DASignersFunctionEpochNumber: bz, err = d.EpochNumber(ctx, evm, method, args) + case DASignersFunctionQuorumCount: + bz, err = d.QuorumCount(ctx, evm, method, args) case DASignersFunctionGetSigner: bz, err = d.GetSigner(ctx, evm, method, args) - case DASignersFunctionGetSigners: - bz, err = d.GetSigners(ctx, evm, method, args) + case DASignersFunctionGetQuorum: + bz, err = d.GetQuorum(ctx, evm, method, args) case DASignersFunctionGetAggPkG1: bz, err = d.GetAggPkG1(ctx, evm, method, args) // txs diff --git a/precompiles/dasigners/query.go b/precompiles/dasigners/query.go index 2a63aeff..b50ec1a5 100644 --- a/precompiles/dasigners/query.go +++ b/precompiles/dasigners/query.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" ) @@ -16,6 +17,15 @@ func (d *DASignersPrecompile) EpochNumber(ctx sdk.Context, _ *vm.EVM, method *ab return method.Outputs.Pack(big.NewInt(int64(epochNumber))) } +func (d *DASignersPrecompile) QuorumCount(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { + req, err := NewQueryQuorumCountRequest(args) + response, err := d.dasignersKeeper.QuorumCount(ctx, req) + if err != nil { + return nil, err + } + return method.Outputs.Pack(big.NewInt(int64(response.QuorumCount))) +} + func (d *DASignersPrecompile) GetSigner(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { req, err := NewQuerySignerRequest(args) if err != nil { @@ -25,21 +35,25 @@ func (d *DASignersPrecompile) GetSigner(ctx sdk.Context, _ *vm.EVM, method *abi. if err != nil { return nil, err } - return method.Outputs.Pack(NewIDASignersSignerDetail(response.Signer)) + signers := make([]IDASignersSignerDetail, len(response.Signer)) + for i, signer := range response.Signer { + signers[i] = NewIDASignersSignerDetail(signer) + } + return method.Outputs.Pack(signers) } -func (d *DASignersPrecompile) GetSigners(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { - req, err := NewQueryEpochSignerSetRequest(args) +func (d *DASignersPrecompile) GetQuorum(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { + req, err := NewQueryEpochQuorumRequest(args) if err != nil { return nil, err } - response, err := d.dasignersKeeper.EpochSignerSet(sdk.WrapSDKContext(ctx), req) + response, err := d.dasignersKeeper.EpochQuorum(sdk.WrapSDKContext(ctx), req) if err != nil { return nil, err } - signers := make([]IDASignersSignerDetail, 0) - for _, signer := range response.Signers { - signers = append(signers, NewIDASignersSignerDetail(signer)) + signers := make([]common.Address, len(response.Quorum.Signers)) + for i, signer := range response.Quorum.Signers { + signers[i] = common.HexToAddress(signer) } return method.Outputs.Pack(signers) } diff --git a/precompiles/dasigners/types.go b/precompiles/dasigners/types.go index 16237286..689ed256 100644 --- a/precompiles/dasigners/types.go +++ b/precompiles/dasigners/types.go @@ -63,34 +63,50 @@ func SerializeG2(p BN254G2Point) []byte { return b } -func NewQuerySignerRequest(args []interface{}) (*dasignerstypes.QuerySignerRequest, error) { +func NewQueryQuorumCountRequest(args []interface{}) (*dasignerstypes.QueryQuorumCountRequest, error) { if len(args) != 1 { return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 1, len(args)) } - return &dasignerstypes.QuerySignerRequest{ - Account: ToLowerHexWithoutPrefix(args[0].(common.Address)), - }, nil -} - -func NewQueryEpochSignerSetRequest(args []interface{}) (*dasignerstypes.QueryEpochSignerSetRequest, error) { - if len(args) != 1 { - return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 1, len(args)) - } - - return &dasignerstypes.QueryEpochSignerSetRequest{ + return &dasignerstypes.QueryQuorumCountRequest{ EpochNumber: args[0].(*big.Int).Uint64(), }, nil } -func NewQueryAggregatePubkeyG1Request(args []interface{}) (*dasignerstypes.QueryAggregatePubkeyG1Request, error) { +func NewQuerySignerRequest(args []interface{}) (*dasignerstypes.QuerySignerRequest, error) { + if len(args) != 1 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 1, len(args)) + } + accounts := args[0].([]common.Address) + req := dasignerstypes.QuerySignerRequest{ + Accounts: make([]string, len(accounts)), + } + for i, account := range accounts { + req.Accounts[i] = ToLowerHexWithoutPrefix(account) + } + return &req, nil +} + +func NewQueryEpochQuorumRequest(args []interface{}) (*dasignerstypes.QueryEpochQuorumRequest, error) { if len(args) != 2 { return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 2, len(args)) } + return &dasignerstypes.QueryEpochQuorumRequest{ + EpochNumber: args[0].(*big.Int).Uint64(), + QuorumId: args[1].(*big.Int).Uint64(), + }, nil +} + +func NewQueryAggregatePubkeyG1Request(args []interface{}) (*dasignerstypes.QueryAggregatePubkeyG1Request, error) { + if len(args) != 3 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 3, len(args)) + } + return &dasignerstypes.QueryAggregatePubkeyG1Request{ - EpochNumber: args[0].(*big.Int).Uint64(), - SignersBitmap: args[1].([]byte), + EpochNumber: args[0].(*big.Int).Uint64(), + QuorumId: args[1].(*big.Int).Uint64(), + QuorumBitmap: args[2].([]byte), }, nil } diff --git a/proto/zgc/dasigners/v1/dasigners.proto b/proto/zgc/dasigners/v1/dasigners.proto index 91dc6dec..ee32ed3b 100644 --- a/proto/zgc/dasigners/v1/dasigners.proto +++ b/proto/zgc/dasigners/v1/dasigners.proto @@ -20,6 +20,10 @@ message Signer { bytes pubkey_g2 = 4; } -message EpochSignerSet { +message Quorum { repeated string signers = 1; } + +message Quorums { + repeated Quorum quorums = 1; +} diff --git a/proto/zgc/dasigners/v1/genesis.proto b/proto/zgc/dasigners/v1/genesis.proto index 154cb987..41f387db 100644 --- a/proto/zgc/dasigners/v1/genesis.proto +++ b/proto/zgc/dasigners/v1/genesis.proto @@ -10,10 +10,10 @@ import "zgc/dasigners/v1/dasigners.proto"; option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; message Params { - uint64 quorum_size = 1; - string tokens_per_vote = 2; - uint64 max_votes = 3; - uint64 epoch_blocks = 4; + string tokens_per_vote = 1; + uint64 max_votes = 2; + uint64 epoch_blocks = 3; + uint64 encoded_slices = 4; } // GenesisState defines the dasigners module's genesis state. @@ -24,6 +24,6 @@ message GenesisState { uint64 epoch_number = 2; // signers defines all signers information repeated Signer signers = 3; - // signers_by_epoch defines chosen signers by epoch - repeated EpochSignerSet signers_by_epoch = 4; + // quorums_by_epoch defines chosen quorums by epoch + repeated Quorums quorums_by_epoch = 4; } diff --git a/proto/zgc/dasigners/v1/query.proto b/proto/zgc/dasigners/v1/query.proto index b8811d26..2ab36c4c 100644 --- a/proto/zgc/dasigners/v1/query.proto +++ b/proto/zgc/dasigners/v1/query.proto @@ -16,8 +16,11 @@ service Query { rpc EpochNumber(QueryEpochNumberRequest) returns (QueryEpochNumberResponse) { option (google.api.http).get = "/0g/dasigners/v1/epoch-number"; } - rpc EpochSignerSet(QueryEpochSignerSetRequest) returns (QueryEpochSignerSetResponse) { - option (google.api.http).get = "/0g/dasigners/v1/epoch-signer-set"; + rpc QuorumCount(QueryQuorumCountRequest) returns (QueryQuorumCountResponse) { + option (google.api.http).get = "/0g/dasigners/v1/quorum-count"; + } + rpc EpochQuorum(QueryEpochQuorumRequest) returns (QueryEpochQuorumResponse) { + option (google.api.http).get = "/0g/dasigners/v1/epoch-quorum"; } rpc AggregatePubkeyG1(QueryAggregatePubkeyG1Request) returns (QueryAggregatePubkeyG1Response) { option (google.api.http).get = "/0g/dasigners/v1/aggregate-pubkey-g1"; @@ -28,11 +31,11 @@ service Query { } message QuerySignerRequest { - string account = 1; + repeated string accounts = 1; } message QuerySignerResponse { - Signer signer = 1; + repeated Signer signer = 1; } message QueryEpochNumberRequest {} @@ -41,17 +44,27 @@ message QueryEpochNumberResponse { uint64 epoch_number = 1; } -message QueryEpochSignerSetRequest { +message QueryQuorumCountRequest { uint64 epoch_number = 1; } -message QueryEpochSignerSetResponse { - repeated Signer signers = 1; +message QueryQuorumCountResponse { + uint64 quorum_count = 1; +} + +message QueryEpochQuorumRequest { + uint64 epoch_number = 1; + uint64 quorum_id = 2; +} + +message QueryEpochQuorumResponse { + Quorum quorum = 1; } message QueryAggregatePubkeyG1Request { uint64 epoch_number = 1; - bytes signersBitmap = 2; + uint64 quorum_id = 2; + bytes quorum_bitmap = 3; } message QueryAggregatePubkeyG1Response { diff --git a/x/dasigners/v1/genesis.go b/x/dasigners/v1/genesis.go index 64354d00..71a0339c 100644 --- a/x/dasigners/v1/genesis.go +++ b/x/dasigners/v1/genesis.go @@ -20,8 +20,8 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, gs types.GenesisState) { panic(fmt.Sprintf("failed to write genesis state into store: %s", err)) } } - for epoch, signers := range gs.SignersByEpoch { - keeper.SetEpochSignerSet(ctx, uint64(epoch), *signers) + for epoch, quorums := range gs.QuorumsByEpoch { + keeper.SetEpochQuorums(ctx, uint64(epoch), *quorums) } keeper.SetParams(ctx, gs.Params) } @@ -38,13 +38,13 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { signers = append(signers, &signer) return false }) - epochSignerSets := make([]*types.EpochSignerSet, 0) + epochQuorums := make([]*types.Quorums, 0) for i := 0; i < int(epochNumber); i += 1 { - epochSignerSet, found := keeper.GetEpochSignerSet(ctx, uint64(i)) + quorums, found := keeper.GetEpochQuorums(ctx, uint64(i)) if !found { - panic("historical epoch signer set not found") + panic("historical quorums not found") } - epochSignerSets = append(epochSignerSets, &epochSignerSet) + epochQuorums = append(epochQuorums, &quorums) } - return types.NewGenesisState(params, epochNumber, signers, epochSignerSets) + return types.NewGenesisState(params, epochNumber, signers, epochQuorums) } diff --git a/x/dasigners/v1/keeper/abci.go b/x/dasigners/v1/keeper/abci.go index bff45f85..cc509269 100644 --- a/x/dasigners/v1/keeper/abci.go +++ b/x/dasigners/v1/keeper/abci.go @@ -72,17 +72,32 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { sort.Slice(ballots, func(i, j int) bool { return bytes.Compare(ballots[i].content, ballots[j].content) < 0 }) - chosen := make(map[string]struct{}) - epochSignerSet := types.EpochSignerSet{ - Signers: make([]string, 0), + + quorums := types.Quorums{ + Quorums: make([]*types.Quorum, 0), } - for _, ballot := range ballots { - if _, ok := chosen[ballot.account]; !ok { - chosen[ballot.account] = struct{}{} - epochSignerSet.Signers = append(epochSignerSet.Signers, ballot.account) + if len(ballots) >= int(params.EncodedSlices) { + for i := 0; i+int(params.EncodedSlices) < len(ballots); i += 1 { + quorum := types.Quorum{ + Signers: make([]string, params.EncodedSlices), + } + for j := 0; j < int(params.EncodedSlices); j += 1 { + quorum.Signers[j] = ballots[i+j].account + } + quorums.Quorums = append(quorums.Quorums, &quorum) } + } else { + quorum := types.Quorum{ + Signers: make([]string, params.EncodedSlices), + } + n := len(ballots) + for i := 0; i < int(params.EncodedSlices); i += 1 { + quorum.Signers[i] = ballots[i%n].account + } + quorums.Quorums = append(quorums.Quorums, &quorum) } + // save to store - k.SetEpochSignerSet(ctx, expectedEpoch, epochSignerSet) + k.SetEpochQuorums(ctx, expectedEpoch, quorums) k.SetEpochNumber(ctx, expectedEpoch) } diff --git a/x/dasigners/v1/keeper/grpc_query.go b/x/dasigners/v1/keeper/grpc_query.go index 4dc1c749..484d970c 100644 --- a/x/dasigners/v1/keeper/grpc_query.go +++ b/x/dasigners/v1/keeper/grpc_query.go @@ -13,17 +13,22 @@ var _ types.QueryServer = Keeper{} func (k Keeper) Signer( c context.Context, - req *types.QuerySignerRequest, + request *types.QuerySignerRequest, ) (*types.QuerySignerResponse, error) { ctx := sdk.UnwrapSDKContext(c) - signer, found, err := k.GetSigner(ctx, req.Account) - if err != nil { - return nil, err + n := len(request.Accounts) + response := types.QuerySignerResponse{Signer: make([]*types.Signer, n)} + for i := 0; i < n; i += 1 { + signer, found, err := k.GetSigner(ctx, request.Accounts[i]) + if err != nil { + return nil, err + } + if !found { + return nil, nil + } + response.Signer[i] = &signer } - if !found { - return nil, nil - } - return &types.QuerySignerResponse{Signer: &signer}, nil + return &response, nil } func (k Keeper) EpochNumber( @@ -38,43 +43,56 @@ func (k Keeper) EpochNumber( return &types.QueryEpochNumberResponse{EpochNumber: epochNumber}, nil } -func (k Keeper) EpochSignerSet(c context.Context, request *types.QueryEpochSignerSetRequest) (*types.QueryEpochSignerSetResponse, error) { +func (k Keeper) QuorumCount( + c context.Context, + request *types.QueryQuorumCountRequest, +) (*types.QueryQuorumCountResponse, error) { ctx := sdk.UnwrapSDKContext(c) - signers, found := k.GetEpochSignerSet(ctx, request.EpochNumber) + quorumCount, err := k.GetQuorumCount(ctx, request.EpochNumber) + if err != nil { + return nil, err + } + return &types.QueryQuorumCountResponse{QuorumCount: quorumCount}, nil +} + +func (k Keeper) EpochQuorum(c context.Context, request *types.QueryEpochQuorumRequest) (*types.QueryEpochQuorumResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + quorums, found := k.GetEpochQuorums(ctx, request.EpochNumber) if !found { - return nil, types.ErrEpochSignerSetNotFound + return nil, types.ErrQuorumNotFound } - epochSignerSet := make([]*types.Signer, len(signers.Signers)) - for _, account := range signers.Signers { - signer, found, err := k.GetSigner(ctx, account) - if err != nil { - return nil, err - } - if !found { - return nil, types.ErrSignerNotFound - } - epochSignerSet = append(epochSignerSet, &signer) + if len(quorums.Quorums) <= int(request.QuorumId) { + return nil, types.ErrQuorumIdOutOfBound } - return &types.QueryEpochSignerSetResponse{Signers: epochSignerSet}, nil + return &types.QueryEpochQuorumResponse{Quorum: quorums.Quorums[request.QuorumId]}, nil } func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggregatePubkeyG1Request) (*types.QueryAggregatePubkeyG1Response, error) { ctx := sdk.UnwrapSDKContext(c) - signers, found := k.GetEpochSignerSet(ctx, request.EpochNumber) + quorums, found := k.GetEpochQuorums(ctx, request.EpochNumber) if !found { - return nil, types.ErrEpochSignerSetNotFound + return nil, types.ErrQuorumNotFound } - if len(request.SignersBitmap) != (len(signers.Signers)+7)/8 { - return nil, types.ErrSignerLengthNotMatch + if len(quorums.Quorums) <= int(request.QuorumId) { + return nil, types.ErrQuorumIdOutOfBound + } + quorum := quorums.Quorums[request.QuorumId] + if (len(quorum.Signers)+7)/8 != len(request.QuorumBitmap) { + return nil, types.ErrQuorumBitmapLengthMismatch } aggPubkeyG1 := new(bn254.G1Affine) hit := 0 - for i, account := range signers.Signers { - b := request.SignersBitmap[i/8] & (1 << (i % 8)) + added := make(map[string]struct{}) + for i, signer := range quorum.Signers { + b := request.QuorumBitmap[i/8] & (1 << (i % 8)) if b == 0 { continue } - signer, found, err := k.GetSigner(ctx, account) + if _, ok := added[signer]; ok { + continue + } + added[signer] = struct{}{} + signer, found, err := k.GetSigner(ctx, signer) if err != nil { return nil, err } @@ -86,7 +104,7 @@ func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggrega } return &types.QueryAggregatePubkeyG1Response{ AggregatePubkeyG1: bn254util.SerializeG1(aggPubkeyG1), - Total: uint64(len(signers.Signers)), + Total: uint64(len(quorum.Signers)), Hit: uint64(hit), }, nil } diff --git a/x/dasigners/v1/keeper/keeper.go b/x/dasigners/v1/keeper/keeper.go index 44d437e5..6d4de856 100644 --- a/x/dasigners/v1/keeper/keeper.go +++ b/x/dasigners/v1/keeper/keeper.go @@ -64,6 +64,20 @@ func (k Keeper) SetEpochNumber(ctx sdk.Context, epoch uint64) { store.Set(types.EpochNumberKey, sdk.Uint64ToBigEndian(epoch)) } +func (k Keeper) GetQuorumCount(ctx sdk.Context, epoch uint64) (uint64, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.QuorumCountKeyPrefix) + bz := store.Get(types.GetQuorumCountKey(epoch)) + if bz == nil { + return 0, types.ErrQuorumNotFound + } + return sdk.BigEndianToUint64(bz), nil +} + +func (k Keeper) SetQuorumCount(ctx sdk.Context, epoch uint64, quorums uint64) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.QuorumCountKeyPrefix) + store.Set(types.GetQuorumCountKey(epoch), sdk.Uint64ToBigEndian(quorums)) +} + func (k Keeper) GetSigner(ctx sdk.Context, account string) (types.Signer, bool, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.SignerKeyPrefix) key, err := types.GetSignerKeyFromAccount(account) @@ -122,21 +136,22 @@ func (k Keeper) IterateSigners(ctx sdk.Context, fn func(index int64, signer type } } -func (k Keeper) GetEpochSignerSet(ctx sdk.Context, epoch uint64) (types.EpochSignerSet, bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.EpochSignerSetKeyPrefix) - bz := store.Get(types.GetEpochSignerSetKeyFromEpoch(epoch)) +func (k Keeper) GetEpochQuorums(ctx sdk.Context, epoch uint64) (types.Quorums, bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.EpochQuorumsKeyPrefix) + bz := store.Get(types.GetEpochQuorumsKeyFromEpoch(epoch)) if bz == nil { - return types.EpochSignerSet{}, false + return types.Quorums{}, false } - var signers types.EpochSignerSet - k.cdc.MustUnmarshal(bz, &signers) - return signers, true + var quorums types.Quorums + k.cdc.MustUnmarshal(bz, &quorums) + return quorums, true } -func (k Keeper) SetEpochSignerSet(ctx sdk.Context, epoch uint64, signers types.EpochSignerSet) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.EpochSignerSetKeyPrefix) - bz := k.cdc.MustMarshal(&signers) - store.Set(types.GetEpochSignerSetKeyFromEpoch(epoch), bz) +func (k Keeper) SetEpochQuorums(ctx sdk.Context, epoch uint64, quorums types.Quorums) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.EpochQuorumsKeyPrefix) + bz := k.cdc.MustMarshal(&quorums) + store.Set(types.GetEpochQuorumsKeyFromEpoch(epoch), bz) + k.SetQuorumCount(ctx, epoch, uint64(len(quorums.Quorums))) } func (k Keeper) GetRegistration(ctx sdk.Context, epoch uint64, account string) ([]byte, bool, error) { diff --git a/x/dasigners/v1/types/dasigners.pb.go b/x/dasigners/v1/types/dasigners.pb.go index 8310ff9c..a26b19af 100644 --- a/x/dasigners/v1/types/dasigners.pb.go +++ b/x/dasigners/v1/types/dasigners.pb.go @@ -70,22 +70,22 @@ func (m *Signer) XXX_DiscardUnknown() { var xxx_messageInfo_Signer proto.InternalMessageInfo -type EpochSignerSet struct { +type Quorum struct { Signers []string `protobuf:"bytes,1,rep,name=signers,proto3" json:"signers,omitempty"` } -func (m *EpochSignerSet) Reset() { *m = EpochSignerSet{} } -func (m *EpochSignerSet) String() string { return proto.CompactTextString(m) } -func (*EpochSignerSet) ProtoMessage() {} -func (*EpochSignerSet) Descriptor() ([]byte, []int) { +func (m *Quorum) Reset() { *m = Quorum{} } +func (m *Quorum) String() string { return proto.CompactTextString(m) } +func (*Quorum) ProtoMessage() {} +func (*Quorum) Descriptor() ([]byte, []int) { return fileDescriptor_b7328dc8ffac059e, []int{1} } -func (m *EpochSignerSet) XXX_Unmarshal(b []byte) error { +func (m *Quorum) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EpochSignerSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Quorum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EpochSignerSet.Marshal(b, m, deterministic) + return xxx_messageInfo_Quorum.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -95,45 +95,85 @@ func (m *EpochSignerSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } -func (m *EpochSignerSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_EpochSignerSet.Merge(m, src) +func (m *Quorum) XXX_Merge(src proto.Message) { + xxx_messageInfo_Quorum.Merge(m, src) } -func (m *EpochSignerSet) XXX_Size() int { +func (m *Quorum) XXX_Size() int { return m.Size() } -func (m *EpochSignerSet) XXX_DiscardUnknown() { - xxx_messageInfo_EpochSignerSet.DiscardUnknown(m) +func (m *Quorum) XXX_DiscardUnknown() { + xxx_messageInfo_Quorum.DiscardUnknown(m) } -var xxx_messageInfo_EpochSignerSet proto.InternalMessageInfo +var xxx_messageInfo_Quorum proto.InternalMessageInfo + +type Quorums struct { + Quorums []*Quorum `protobuf:"bytes,1,rep,name=quorums,proto3" json:"quorums,omitempty"` +} + +func (m *Quorums) Reset() { *m = Quorums{} } +func (m *Quorums) String() string { return proto.CompactTextString(m) } +func (*Quorums) ProtoMessage() {} +func (*Quorums) Descriptor() ([]byte, []int) { + return fileDescriptor_b7328dc8ffac059e, []int{2} +} +func (m *Quorums) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Quorums) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Quorums.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Quorums) XXX_Merge(src proto.Message) { + xxx_messageInfo_Quorums.Merge(m, src) +} +func (m *Quorums) XXX_Size() int { + return m.Size() +} +func (m *Quorums) XXX_DiscardUnknown() { + xxx_messageInfo_Quorums.DiscardUnknown(m) +} + +var xxx_messageInfo_Quorums proto.InternalMessageInfo func init() { proto.RegisterType((*Signer)(nil), "zgc.dasigners.v1.Signer") - proto.RegisterType((*EpochSignerSet)(nil), "zgc.dasigners.v1.EpochSignerSet") + proto.RegisterType((*Quorum)(nil), "zgc.dasigners.v1.Quorum") + proto.RegisterType((*Quorums)(nil), "zgc.dasigners.v1.Quorums") } func init() { proto.RegisterFile("zgc/dasigners/v1/dasigners.proto", fileDescriptor_b7328dc8ffac059e) } var fileDescriptor_b7328dc8ffac059e = []byte{ - // 287 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xc1, 0x4a, 0xc3, 0x30, - 0x1c, 0xc6, 0x1b, 0x27, 0xd3, 0x05, 0x11, 0x29, 0x22, 0xd9, 0x84, 0x50, 0x76, 0x1a, 0x82, 0xcd, - 0x3a, 0xdf, 0x40, 0x10, 0x4f, 0x5e, 0xb6, 0x9b, 0x97, 0x91, 0x66, 0x31, 0x2d, 0xdb, 0xfa, 0x2f, - 0x4d, 0x3a, 0xec, 0x9e, 0xc2, 0xc7, 0xda, 0x71, 0x47, 0x8f, 0xda, 0xbe, 0x88, 0xb4, 0xa9, 0xcc, - 0x79, 0xcb, 0xef, 0xfb, 0x05, 0x3e, 0xfe, 0x1f, 0xf6, 0xb6, 0x4a, 0xb0, 0x05, 0xd7, 0xb1, 0x4a, - 0x64, 0xa6, 0xd9, 0x26, 0x38, 0x80, 0x9f, 0x66, 0x60, 0xc0, 0xbd, 0xda, 0x2a, 0xe1, 0x1f, 0xc2, - 0x4d, 0x30, 0xe8, 0x0b, 0xd0, 0x6b, 0xd0, 0xf3, 0xc6, 0x33, 0x0b, 0xf6, 0xf3, 0xe0, 0x5a, 0x81, - 0x02, 0x9b, 0xd7, 0xaf, 0x36, 0xed, 0x2b, 0x00, 0xb5, 0x92, 0xac, 0xa1, 0x30, 0x7f, 0x63, 0x3c, - 0x29, 0x5a, 0x45, 0xff, 0xab, 0x45, 0x9e, 0x71, 0x13, 0x43, 0x62, 0xfd, 0xd0, 0xe0, 0xee, 0xac, - 0x69, 0x76, 0x09, 0x3e, 0xe3, 0x42, 0x40, 0x9e, 0x18, 0x82, 0x3c, 0x34, 0xea, 0x4d, 0x7f, 0xd1, - 0xbd, 0xc1, 0x5d, 0x0d, 0x62, 0x29, 0x0d, 0x39, 0x69, 0x44, 0x4b, 0xee, 0x2d, 0xee, 0xa5, 0x79, - 0xb8, 0x94, 0xc5, 0x5c, 0x05, 0xa4, 0xe3, 0xa1, 0xd1, 0xc5, 0xf4, 0xdc, 0x06, 0xcf, 0xc1, 0x5f, - 0x39, 0x21, 0xa7, 0x47, 0x72, 0x32, 0xbc, 0xc3, 0x97, 0x4f, 0x29, 0x88, 0xc8, 0x56, 0xcf, 0xa4, - 0xa9, 0xdb, 0xdb, 0x05, 0x08, 0xf2, 0x3a, 0x75, 0x7b, 0x8b, 0x8f, 0x2f, 0xbb, 0x6f, 0xea, 0xec, - 0x4a, 0x8a, 0xf6, 0x25, 0x45, 0x5f, 0x25, 0x45, 0x1f, 0x15, 0x75, 0xf6, 0x15, 0x75, 0x3e, 0x2b, - 0xea, 0xbc, 0x32, 0x15, 0x9b, 0x28, 0x0f, 0x7d, 0x01, 0x6b, 0x36, 0x56, 0x2b, 0x1e, 0x6a, 0x36, - 0x56, 0xf7, 0x22, 0xe2, 0x71, 0xc2, 0xde, 0x8f, 0x87, 0x37, 0x45, 0x2a, 0x75, 0xd8, 0x6d, 0xee, - 0x7e, 0xf8, 0x09, 0x00, 0x00, 0xff, 0xff, 0x77, 0x51, 0x09, 0xd9, 0x99, 0x01, 0x00, 0x00, + // 309 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xb1, 0x6e, 0xea, 0x30, + 0x14, 0x86, 0xe3, 0xcb, 0x55, 0x28, 0x6e, 0x87, 0x2a, 0xaa, 0x2a, 0x43, 0x25, 0x2b, 0xca, 0xc4, + 0xd2, 0x98, 0xa4, 0x73, 0x97, 0x2e, 0x9d, 0x3a, 0x94, 0x6e, 0x5d, 0x90, 0x63, 0x52, 0x13, 0x01, + 0x39, 0x34, 0xb6, 0x51, 0xe1, 0x29, 0xfa, 0x58, 0x8c, 0x8c, 0x1d, 0x5b, 0x78, 0x91, 0x0a, 0x3b, + 0x88, 0xc2, 0x76, 0xbe, 0xff, 0xfb, 0xa5, 0x23, 0x1f, 0xe3, 0x70, 0x29, 0x05, 0x1b, 0x72, 0x55, + 0xc8, 0x32, 0xaf, 0x14, 0x9b, 0x27, 0x07, 0x88, 0x67, 0x15, 0x68, 0x08, 0x2e, 0x97, 0x52, 0xc4, + 0x87, 0x70, 0x9e, 0x74, 0xda, 0x02, 0xd4, 0x14, 0xd4, 0xc0, 0x7a, 0xe6, 0xc0, 0x95, 0x3b, 0x57, + 0x12, 0x24, 0xb8, 0x7c, 0x37, 0xd5, 0x69, 0x5b, 0x02, 0xc8, 0x49, 0xce, 0x2c, 0x65, 0xe6, 0x8d, + 0xf1, 0x72, 0x51, 0x2b, 0x7a, 0xaa, 0x86, 0xa6, 0xe2, 0xba, 0x80, 0xd2, 0xf9, 0x48, 0x63, 0xff, + 0xc5, 0x6e, 0x0e, 0x08, 0x6e, 0x72, 0x21, 0xc0, 0x94, 0x9a, 0xa0, 0x10, 0x75, 0x5b, 0xfd, 0x3d, + 0x06, 0xd7, 0xd8, 0x57, 0x20, 0xc6, 0xb9, 0x26, 0xff, 0xac, 0xa8, 0x29, 0xb8, 0xc1, 0xad, 0x99, + 0xc9, 0xc6, 0xf9, 0x62, 0x20, 0x13, 0xd2, 0x08, 0x51, 0xf7, 0xa2, 0x7f, 0xe6, 0x82, 0xc7, 0xe4, + 0xaf, 0x4c, 0xc9, 0xff, 0x23, 0x99, 0x46, 0x11, 0xf6, 0x9f, 0x0d, 0x54, 0x66, 0xba, 0xdb, 0x5a, + 0xbf, 0x9c, 0xa0, 0xb0, 0xb1, 0xdb, 0x5a, 0x63, 0x74, 0x8f, 0x9b, 0xae, 0xa3, 0x82, 0x14, 0x37, + 0xdf, 0xdd, 0x68, 0x4b, 0xe7, 0x29, 0x89, 0x4f, 0x8f, 0x16, 0xbb, 0x6e, 0x7f, 0x5f, 0x7c, 0x78, + 0x5a, 0xfd, 0x50, 0x6f, 0xb5, 0xa1, 0x68, 0xbd, 0xa1, 0xe8, 0x7b, 0x43, 0xd1, 0xe7, 0x96, 0x7a, + 0xeb, 0x2d, 0xf5, 0xbe, 0xb6, 0xd4, 0x7b, 0x65, 0xb2, 0xd0, 0x23, 0x93, 0xc5, 0x02, 0xa6, 0xac, + 0x27, 0x27, 0x3c, 0x53, 0xac, 0x27, 0x6f, 0xc5, 0x88, 0x17, 0x25, 0xfb, 0x38, 0xfe, 0x2f, 0xbd, + 0x98, 0xe5, 0x2a, 0xf3, 0xed, 0xb9, 0xee, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x80, 0xdc, + 0x60, 0xd0, 0x01, 0x00, 0x00, } func (m *Signer) Marshal() (dAtA []byte, err error) { @@ -187,7 +227,7 @@ func (m *Signer) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EpochSignerSet) Marshal() (dAtA []byte, err error) { +func (m *Quorum) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -197,12 +237,12 @@ func (m *EpochSignerSet) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EpochSignerSet) MarshalTo(dAtA []byte) (int, error) { +func (m *Quorum) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EpochSignerSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Quorum) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -219,6 +259,43 @@ func (m *EpochSignerSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Quorums) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Quorums) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Quorums) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Quorums) > 0 { + for iNdEx := len(m.Quorums) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Quorums[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDasigners(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintDasigners(dAtA []byte, offset int, v uint64) int { offset -= sovDasigners(v) base := offset @@ -255,7 +332,7 @@ func (m *Signer) Size() (n int) { return n } -func (m *EpochSignerSet) Size() (n int) { +func (m *Quorum) Size() (n int) { if m == nil { return 0 } @@ -270,6 +347,21 @@ func (m *EpochSignerSet) Size() (n int) { return n } +func (m *Quorums) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Quorums) > 0 { + for _, e := range m.Quorums { + l = e.Size() + n += 1 + l + sovDasigners(uint64(l)) + } + } + return n +} + func sovDasigners(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -458,7 +550,7 @@ func (m *Signer) Unmarshal(dAtA []byte) error { } return nil } -func (m *EpochSignerSet) Unmarshal(dAtA []byte) error { +func (m *Quorum) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -481,10 +573,10 @@ func (m *EpochSignerSet) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EpochSignerSet: wiretype end group for non-group") + return fmt.Errorf("proto: Quorum: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EpochSignerSet: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Quorum: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -540,6 +632,90 @@ func (m *EpochSignerSet) Unmarshal(dAtA []byte) error { } return nil } +func (m *Quorums) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Quorums: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Quorums: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quorums", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDasigners + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDasigners + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDasigners + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Quorums = append(m.Quorums, &Quorum{}) + if err := m.Quorums[len(m.Quorums)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDasigners(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDasigners + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipDasigners(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/dasigners/v1/types/errors.go b/x/dasigners/v1/types/errors.go index f2d5d88f..35d89ad6 100644 --- a/x/dasigners/v1/types/errors.go +++ b/x/dasigners/v1/types/errors.go @@ -3,10 +3,11 @@ package types import errorsmod "cosmossdk.io/errors" var ( - ErrSignerExists = errorsmod.Register(ModuleName, 1, "signer exists") - ErrEpochNumberNotSet = errorsmod.Register(ModuleName, 2, "epoch number not set") - ErrSignerNotFound = errorsmod.Register(ModuleName, 3, "signer not found") - ErrInvalidSignature = errorsmod.Register(ModuleName, 4, "invalid signature") - ErrEpochSignerSetNotFound = errorsmod.Register(ModuleName, 5, "signer set for epoch not found") - ErrSignerLengthNotMatch = errorsmod.Register(ModuleName, 6, "signer set length not match") + ErrSignerExists = errorsmod.Register(ModuleName, 1, "signer exists") + ErrEpochNumberNotSet = errorsmod.Register(ModuleName, 2, "epoch number not set") + ErrSignerNotFound = errorsmod.Register(ModuleName, 3, "signer not found") + ErrInvalidSignature = errorsmod.Register(ModuleName, 4, "invalid signature") + ErrQuorumNotFound = errorsmod.Register(ModuleName, 5, "quorum for epoch not found") + ErrQuorumIdOutOfBound = errorsmod.Register(ModuleName, 6, "quorum id out of bound") + ErrQuorumBitmapLengthMismatch = errorsmod.Register(ModuleName, 6, "quorum bitmap length mismatch") ) diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index b3a4c651..d13aa4c4 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -3,23 +3,23 @@ package types import "fmt" // NewGenesisState returns a new genesis state object for the module. -func NewGenesisState(params Params, epoch uint64, signers []*Signer, signersByEpoch []*EpochSignerSet) *GenesisState { +func NewGenesisState(params Params, epoch uint64, signers []*Signer, quorumsByEpoch []*Quorums) *GenesisState { return &GenesisState{ Params: params, EpochNumber: epoch, Signers: signers, - SignersByEpoch: signersByEpoch, + QuorumsByEpoch: quorumsByEpoch, } } // DefaultGenesisState returns the default genesis state for the module. func DefaultGenesisState() *GenesisState { return NewGenesisState(Params{ - QuorumSize: 1024, TokensPerVote: "100", MaxVotes: 100, EpochBlocks: 1000, - }, 0, make([]*Signer, 0), make([]*EpochSignerSet, 0)) + EncodedSlices: 3072, + }, 0, make([]*Signer, 0), make([]*Quorums, 0)) } // Validate performs basic validation of genesis data. @@ -31,16 +31,18 @@ func (gs GenesisState) Validate() error { } registered[signer.Account] = struct{}{} } - if len(gs.SignersByEpoch) != int(gs.EpochNumber) { + if len(gs.QuorumsByEpoch) != int(gs.EpochNumber) { return fmt.Errorf("epoch history missing") } - for _, signers := range gs.SignersByEpoch { - for _, signer := range signers.Signers { - if err := ValidateHexAddress(signer); err != nil { - return err - } - if _, ok := registered[signer]; !ok { - return fmt.Errorf("historical signer detail missing") + for _, quorums := range gs.QuorumsByEpoch { + for _, quorum := range quorums.Quorums { + for _, signer := range quorum.Signers { + if err := ValidateHexAddress(signer); err != nil { + return err + } + if _, ok := registered[signer]; !ok { + return fmt.Errorf("historical signer detail missing") + } } } } diff --git a/x/dasigners/v1/types/genesis.pb.go b/x/dasigners/v1/types/genesis.pb.go index 0564b2c4..90ce4088 100644 --- a/x/dasigners/v1/types/genesis.pb.go +++ b/x/dasigners/v1/types/genesis.pb.go @@ -27,10 +27,10 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Params struct { - QuorumSize uint64 `protobuf:"varint,1,opt,name=quorum_size,json=quorumSize,proto3" json:"quorum_size,omitempty"` - TokensPerVote string `protobuf:"bytes,2,opt,name=tokens_per_vote,json=tokensPerVote,proto3" json:"tokens_per_vote,omitempty"` - MaxVotes uint64 `protobuf:"varint,3,opt,name=max_votes,json=maxVotes,proto3" json:"max_votes,omitempty"` - EpochBlocks uint64 `protobuf:"varint,4,opt,name=epoch_blocks,json=epochBlocks,proto3" json:"epoch_blocks,omitempty"` + TokensPerVote string `protobuf:"bytes,1,opt,name=tokens_per_vote,json=tokensPerVote,proto3" json:"tokens_per_vote,omitempty"` + MaxVotes uint64 `protobuf:"varint,2,opt,name=max_votes,json=maxVotes,proto3" json:"max_votes,omitempty"` + EpochBlocks uint64 `protobuf:"varint,3,opt,name=epoch_blocks,json=epochBlocks,proto3" json:"epoch_blocks,omitempty"` + EncodedSlices uint64 `protobuf:"varint,4,opt,name=encoded_slices,json=encodedSlices,proto3" json:"encoded_slices,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -66,13 +66,6 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetQuorumSize() uint64 { - if m != nil { - return m.QuorumSize - } - return 0 -} - func (m *Params) GetTokensPerVote() string { if m != nil { return m.TokensPerVote @@ -94,6 +87,13 @@ func (m *Params) GetEpochBlocks() uint64 { return 0 } +func (m *Params) GetEncodedSlices() uint64 { + if m != nil { + return m.EncodedSlices + } + return 0 +} + // GenesisState defines the dasigners module's genesis state. type GenesisState struct { // params defines all the parameters of related to deposit. @@ -102,8 +102,8 @@ type GenesisState struct { EpochNumber uint64 `protobuf:"varint,2,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` // signers defines all signers information Signers []*Signer `protobuf:"bytes,3,rep,name=signers,proto3" json:"signers,omitempty"` - // signers_by_epoch defines chosen signers by epoch - SignersByEpoch []*EpochSignerSet `protobuf:"bytes,4,rep,name=signers_by_epoch,json=signersByEpoch,proto3" json:"signers_by_epoch,omitempty"` + // quorums_by_epoch defines chosen quorums by epoch + QuorumsByEpoch []*Quorums `protobuf:"bytes,4,rep,name=quorums_by_epoch,json=quorumsByEpoch,proto3" json:"quorums_by_epoch,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -160,9 +160,9 @@ func (m *GenesisState) GetSigners() []*Signer { return nil } -func (m *GenesisState) GetSignersByEpoch() []*EpochSignerSet { +func (m *GenesisState) GetQuorumsByEpoch() []*Quorums { if m != nil { - return m.SignersByEpoch + return m.QuorumsByEpoch } return nil } @@ -175,33 +175,34 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/genesis.proto", fileDescriptor_896efa766aaca3be) } var fileDescriptor_896efa766aaca3be = []byte{ - // 415 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x6e, 0xd3, 0x30, - 0x1c, 0xc6, 0x6b, 0x1a, 0x15, 0xe6, 0x0e, 0x98, 0x2c, 0x0e, 0xd9, 0x90, 0xd2, 0xb0, 0x03, 0xda, - 0x85, 0x78, 0x1b, 0x12, 0x0f, 0x10, 0x09, 0x21, 0x38, 0xa0, 0x29, 0x91, 0x38, 0x70, 0x89, 0x9c, - 0xf0, 0xc7, 0x8d, 0x56, 0xc7, 0x21, 0x76, 0xaa, 0x26, 0x4f, 0x01, 0x6f, 0xb5, 0xe3, 0x8e, 0x9c, - 0x10, 0x6a, 0x4f, 0xbc, 0x05, 0xea, 0xdf, 0x19, 0x13, 0xeb, 0x6e, 0x7f, 0x7f, 0xbf, 0xcf, 0x9f, - 0x3f, 0xdb, 0x34, 0xe8, 0x65, 0xc1, 0xbf, 0x08, 0x53, 0xca, 0x0a, 0x1a, 0xc3, 0x97, 0x67, 0x5c, - 0x42, 0x05, 0xa6, 0x34, 0x51, 0xdd, 0x68, 0xab, 0xd9, 0x41, 0x2f, 0x8b, 0xe8, 0x1f, 0x8f, 0x96, - 0x67, 0x47, 0x87, 0x85, 0x36, 0x4a, 0x9b, 0x0c, 0x39, 0x77, 0x0b, 0x67, 0x3e, 0x7a, 0x26, 0xb5, - 0xd4, 0x4e, 0xdf, 0x4e, 0x83, 0x7a, 0x28, 0xb5, 0x96, 0x0b, 0xe0, 0xb8, 0xca, 0xdb, 0xaf, 0x5c, - 0x54, 0xdd, 0x80, 0x66, 0x77, 0x91, 0x2d, 0x15, 0x18, 0x2b, 0x54, 0x3d, 0x18, 0xc2, 0x9d, 0x7a, - 0xb7, 0x5d, 0xd0, 0x71, 0xfc, 0x83, 0xd0, 0xc9, 0x85, 0x68, 0x84, 0x32, 0x6c, 0x46, 0xa7, 0xdf, - 0x5a, 0xdd, 0xb4, 0x2a, 0x33, 0x65, 0x0f, 0x3e, 0x09, 0xc9, 0x89, 0x97, 0x50, 0x27, 0xa5, 0x65, - 0x0f, 0xec, 0x25, 0x7d, 0x6a, 0xf5, 0x25, 0x54, 0x26, 0xab, 0xa1, 0xc9, 0x96, 0xda, 0x82, 0xff, - 0x20, 0x24, 0x27, 0x7b, 0xc9, 0x63, 0x27, 0x5f, 0x40, 0xf3, 0x49, 0x5b, 0x60, 0xcf, 0xe9, 0x9e, - 0x12, 0x2b, 0x34, 0x18, 0x7f, 0x8c, 0x31, 0x8f, 0x94, 0x58, 0x6d, 0x99, 0x61, 0x2f, 0xe8, 0x3e, - 0xd4, 0xba, 0x98, 0x67, 0xf9, 0x42, 0x17, 0x97, 0xc6, 0xf7, 0x90, 0x4f, 0x51, 0x8b, 0x51, 0x3a, - 0xfe, 0x43, 0xe8, 0xfe, 0x3b, 0xf7, 0x8c, 0xa9, 0x15, 0x16, 0xd8, 0x1b, 0x3a, 0xa9, 0xb1, 0x23, - 0x96, 0x9a, 0x9e, 0xfb, 0xd1, 0xdd, 0x67, 0x8d, 0xdc, 0x1d, 0x62, 0xef, 0xea, 0xd7, 0x6c, 0x94, - 0x0c, 0xee, 0xdb, 0xb3, 0xaa, 0x56, 0xe5, 0xd0, 0x60, 0xdb, 0x9b, 0xb3, 0x3e, 0xa2, 0xc4, 0xce, - 0xe9, 0xc3, 0x21, 0xc5, 0x1f, 0x87, 0xe3, 0xfb, 0xb3, 0x53, 0x1c, 0x93, 0x1b, 0x23, 0xfb, 0x40, - 0x0f, 0x86, 0x31, 0xcb, 0xbb, 0x0c, 0xd3, 0x7c, 0x0f, 0x37, 0x87, 0xbb, 0x9b, 0xdf, 0x6e, 0xb1, - 0x4b, 0x48, 0xc1, 0x26, 0x4f, 0x06, 0x14, 0x77, 0x08, 0xe2, 0xf7, 0x57, 0xeb, 0x80, 0x5c, 0xaf, - 0x03, 0xf2, 0x7b, 0x1d, 0x90, 0xef, 0x9b, 0x60, 0x74, 0xbd, 0x09, 0x46, 0x3f, 0x37, 0xc1, 0xe8, - 0x33, 0x97, 0xa5, 0x9d, 0xb7, 0x79, 0x54, 0x68, 0xc5, 0x4f, 0xe5, 0x42, 0xe4, 0x86, 0x9f, 0xca, - 0x57, 0xc5, 0x5c, 0x94, 0x15, 0x5f, 0xfd, 0xff, 0xa9, 0xb6, 0xab, 0xc1, 0xe4, 0x13, 0xfc, 0xd1, - 0xd7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x84, 0xf4, 0xab, 0x94, 0x02, 0x00, 0x00, + // 417 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0x63, 0x12, 0x05, 0xba, 0xfd, 0x43, 0x65, 0x71, 0x70, 0x8a, 0xe4, 0x86, 0x4a, 0xa0, + 0x5e, 0xf0, 0xb6, 0x45, 0xe2, 0x01, 0x82, 0x10, 0xe2, 0x82, 0x8a, 0x23, 0x71, 0xe0, 0x62, 0xad, + 0x37, 0xc3, 0xc6, 0x6a, 0xd6, 0x63, 0x3c, 0xeb, 0x28, 0xe9, 0x53, 0x70, 0xe3, 0x95, 0x7a, 0xec, + 0x91, 0x13, 0x42, 0xce, 0x8b, 0xa0, 0x8e, 0x17, 0x2a, 0x5a, 0x6e, 0x3b, 0xdf, 0xf7, 0x9b, 0xd1, + 0xb7, 0x33, 0x22, 0xbe, 0x34, 0x5a, 0xce, 0x14, 0x15, 0xa6, 0x84, 0x9a, 0xe4, 0xf2, 0x54, 0x1a, + 0x28, 0x81, 0x0a, 0x4a, 0xaa, 0x1a, 0x1d, 0x86, 0xfb, 0x97, 0x46, 0x27, 0x7f, 0xfd, 0x64, 0x79, + 0x7a, 0x30, 0xd2, 0x48, 0x16, 0x29, 0x63, 0x5f, 0x76, 0x45, 0x07, 0x1f, 0x3c, 0x31, 0x68, 0xb0, + 0xd3, 0x6f, 0x5e, 0x5e, 0x1d, 0x19, 0x44, 0xb3, 0x00, 0xc9, 0x55, 0xde, 0x7c, 0x91, 0xaa, 0x5c, + 0x7b, 0xeb, 0xf0, 0xae, 0xe5, 0x0a, 0x0b, 0xe4, 0x94, 0xad, 0x3c, 0x30, 0xbe, 0x17, 0xef, 0x36, + 0x0b, 0x13, 0x47, 0xdf, 0x03, 0x31, 0x3c, 0x57, 0xb5, 0xb2, 0x14, 0xbe, 0x10, 0x8f, 0x1d, 0x5e, + 0x40, 0x49, 0x59, 0x05, 0x75, 0xb6, 0x44, 0x07, 0x51, 0x30, 0x0e, 0x8e, 0xb7, 0xd2, 0xdd, 0x4e, + 0x3e, 0x87, 0xfa, 0x13, 0x3a, 0x08, 0x9f, 0x8a, 0x2d, 0xab, 0x56, 0x0c, 0x50, 0xf4, 0x60, 0x1c, + 0x1c, 0x0f, 0xd2, 0x47, 0x56, 0xad, 0x6e, 0x3c, 0x0a, 0x9f, 0x89, 0x1d, 0xa8, 0x50, 0xcf, 0xb3, + 0x7c, 0x81, 0xfa, 0x82, 0xa2, 0x3e, 0xfb, 0xdb, 0xac, 0x4d, 0x58, 0x0a, 0x9f, 0x8b, 0x3d, 0x28, + 0x35, 0xce, 0x60, 0x96, 0xd1, 0xa2, 0xd0, 0x40, 0xd1, 0x80, 0xa1, 0x5d, 0xaf, 0x4e, 0x59, 0x3c, + 0x6a, 0x03, 0xb1, 0xf3, 0xae, 0x5b, 0xe6, 0xd4, 0x29, 0x07, 0xe1, 0x6b, 0x31, 0xac, 0x38, 0x29, + 0xc7, 0xda, 0x3e, 0x8b, 0x92, 0xbb, 0xcb, 0x4d, 0xba, 0x9f, 0x4c, 0x06, 0x57, 0x3f, 0x0f, 0x7b, + 0xa9, 0xa7, 0x6f, 0x23, 0x95, 0x8d, 0xcd, 0xa1, 0xf6, 0x91, 0xbb, 0x48, 0x1f, 0x58, 0x0a, 0xcf, + 0xc4, 0x43, 0x3f, 0x25, 0xea, 0x8f, 0xfb, 0xff, 0x9f, 0x3d, 0xe5, 0x67, 0xfa, 0x07, 0x0c, 0xdf, + 0x88, 0xfd, 0xaf, 0x0d, 0xd6, 0x8d, 0xa5, 0x2c, 0x5f, 0x67, 0x3c, 0x2d, 0x1a, 0x70, 0xf3, 0xe8, + 0x7e, 0xf3, 0xc7, 0x8e, 0x4c, 0xf7, 0x7c, 0xcb, 0x64, 0xfd, 0x96, 0x37, 0xf2, 0xfe, 0xaa, 0x8d, + 0x83, 0xeb, 0x36, 0x0e, 0x7e, 0xb5, 0x71, 0xf0, 0x6d, 0x13, 0xf7, 0xae, 0x37, 0x71, 0xef, 0xc7, + 0x26, 0xee, 0x7d, 0x96, 0xa6, 0x70, 0xf3, 0x26, 0x4f, 0x34, 0x5a, 0x79, 0x62, 0x16, 0x2a, 0x27, + 0x79, 0x62, 0x5e, 0xea, 0xb9, 0x2a, 0x4a, 0xb9, 0xfa, 0xf7, 0xa6, 0x6e, 0x5d, 0x01, 0xe5, 0x43, + 0x3e, 0xe8, 0xab, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x46, 0x09, 0x1c, 0x6e, 0x93, 0x02, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -224,27 +225,27 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.EncodedSlices != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.EncodedSlices)) + i-- + dAtA[i] = 0x20 + } if m.EpochBlocks != 0 { i = encodeVarintGenesis(dAtA, i, uint64(m.EpochBlocks)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x18 } if m.MaxVotes != 0 { i = encodeVarintGenesis(dAtA, i, uint64(m.MaxVotes)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x10 } if len(m.TokensPerVote) > 0 { i -= len(m.TokensPerVote) copy(dAtA[i:], m.TokensPerVote) i = encodeVarintGenesis(dAtA, i, uint64(len(m.TokensPerVote))) i-- - dAtA[i] = 0x12 - } - if m.QuorumSize != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.QuorumSize)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -269,10 +270,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.SignersByEpoch) > 0 { - for iNdEx := len(m.SignersByEpoch) - 1; iNdEx >= 0; iNdEx-- { + if len(m.QuorumsByEpoch) > 0 { + for iNdEx := len(m.QuorumsByEpoch) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.SignersByEpoch[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.QuorumsByEpoch[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -332,9 +333,6 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.QuorumSize != 0 { - n += 1 + sovGenesis(uint64(m.QuorumSize)) - } l = len(m.TokensPerVote) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) @@ -345,6 +343,9 @@ func (m *Params) Size() (n int) { if m.EpochBlocks != 0 { n += 1 + sovGenesis(uint64(m.EpochBlocks)) } + if m.EncodedSlices != 0 { + n += 1 + sovGenesis(uint64(m.EncodedSlices)) + } return n } @@ -365,8 +366,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.SignersByEpoch) > 0 { - for _, e := range m.SignersByEpoch { + if len(m.QuorumsByEpoch) > 0 { + for _, e := range m.QuorumsByEpoch { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -410,25 +411,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field QuorumSize", wireType) - } - m.QuorumSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.QuorumSize |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TokensPerVote", wireType) } @@ -460,7 +442,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.TokensPerVote = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MaxVotes", wireType) } @@ -479,7 +461,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 4: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EpochBlocks", wireType) } @@ -498,6 +480,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EncodedSlices", wireType) + } + m.EncodedSlices = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EncodedSlices |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -636,7 +637,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignersByEpoch", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field QuorumsByEpoch", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -663,8 +664,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SignersByEpoch = append(m.SignersByEpoch, &EpochSignerSet{}) - if err := m.SignersByEpoch[len(m.SignersByEpoch)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.QuorumsByEpoch = append(m.QuorumsByEpoch, &Quorums{}) + if err := m.QuorumsByEpoch[len(m.QuorumsByEpoch)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/dasigners/v1/types/keys.go b/x/dasigners/v1/types/keys.go index d49436fc..163cdd09 100644 --- a/x/dasigners/v1/types/keys.go +++ b/x/dasigners/v1/types/keys.go @@ -19,9 +19,10 @@ const ( var ( // prefix - SignerKeyPrefix = []byte{0x00} - EpochSignerSetKeyPrefix = []byte{0x01} - RegistrationKeyPrefix = []byte{0x02} + SignerKeyPrefix = []byte{0x00} + EpochQuorumsKeyPrefix = []byte{0x01} + RegistrationKeyPrefix = []byte{0x02} + QuorumCountKeyPrefix = []byte{0x03} // keys ParamsKey = []byte{0x05} @@ -32,7 +33,11 @@ func GetSignerKeyFromAccount(account string) ([]byte, error) { return hex.DecodeString(account) } -func GetEpochSignerSetKeyFromEpoch(epoch uint64) []byte { +func GetEpochQuorumsKeyFromEpoch(epoch uint64) []byte { + return sdk.Uint64ToBigEndian(epoch) +} + +func GetQuorumCountKey(epoch uint64) []byte { return sdk.Uint64ToBigEndian(epoch) } diff --git a/x/dasigners/v1/types/query.pb.go b/x/dasigners/v1/types/query.pb.go index fac6e645..84f44e35 100644 --- a/x/dasigners/v1/types/query.pb.go +++ b/x/dasigners/v1/types/query.pb.go @@ -33,7 +33,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type QuerySignerRequest struct { - Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + Accounts []string `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"` } func (m *QuerySignerRequest) Reset() { *m = QuerySignerRequest{} } @@ -70,7 +70,7 @@ func (m *QuerySignerRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySignerRequest proto.InternalMessageInfo type QuerySignerResponse struct { - Signer *Signer `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Signer []*Signer `protobuf:"bytes,1,rep,name=signer,proto3" json:"signer,omitempty"` } func (m *QuerySignerResponse) Reset() { *m = QuerySignerResponse{} } @@ -179,22 +179,22 @@ func (m *QueryEpochNumberResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEpochNumberResponse proto.InternalMessageInfo -type QueryEpochSignerSetRequest struct { +type QueryQuorumCountRequest struct { EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` } -func (m *QueryEpochSignerSetRequest) Reset() { *m = QueryEpochSignerSetRequest{} } -func (m *QueryEpochSignerSetRequest) String() string { return proto.CompactTextString(m) } -func (*QueryEpochSignerSetRequest) ProtoMessage() {} -func (*QueryEpochSignerSetRequest) Descriptor() ([]byte, []int) { +func (m *QueryQuorumCountRequest) Reset() { *m = QueryQuorumCountRequest{} } +func (m *QueryQuorumCountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryQuorumCountRequest) ProtoMessage() {} +func (*QueryQuorumCountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_991a610b84b5964c, []int{4} } -func (m *QueryEpochSignerSetRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryQuorumCountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryEpochSignerSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryQuorumCountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryEpochSignerSetRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryQuorumCountRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -204,34 +204,34 @@ func (m *QueryEpochSignerSetRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryEpochSignerSetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryEpochSignerSetRequest.Merge(m, src) +func (m *QueryQuorumCountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryQuorumCountRequest.Merge(m, src) } -func (m *QueryEpochSignerSetRequest) XXX_Size() int { +func (m *QueryQuorumCountRequest) XXX_Size() int { return m.Size() } -func (m *QueryEpochSignerSetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryEpochSignerSetRequest.DiscardUnknown(m) +func (m *QueryQuorumCountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryQuorumCountRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryEpochSignerSetRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryQuorumCountRequest proto.InternalMessageInfo -type QueryEpochSignerSetResponse struct { - Signers []*Signer `protobuf:"bytes,1,rep,name=signers,proto3" json:"signers,omitempty"` +type QueryQuorumCountResponse struct { + QuorumCount uint64 `protobuf:"varint,1,opt,name=quorum_count,json=quorumCount,proto3" json:"quorum_count,omitempty"` } -func (m *QueryEpochSignerSetResponse) Reset() { *m = QueryEpochSignerSetResponse{} } -func (m *QueryEpochSignerSetResponse) String() string { return proto.CompactTextString(m) } -func (*QueryEpochSignerSetResponse) ProtoMessage() {} -func (*QueryEpochSignerSetResponse) Descriptor() ([]byte, []int) { +func (m *QueryQuorumCountResponse) Reset() { *m = QueryQuorumCountResponse{} } +func (m *QueryQuorumCountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryQuorumCountResponse) ProtoMessage() {} +func (*QueryQuorumCountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_991a610b84b5964c, []int{5} } -func (m *QueryEpochSignerSetResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryQuorumCountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryEpochSignerSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryQuorumCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryEpochSignerSetResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryQuorumCountResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -241,28 +241,104 @@ func (m *QueryEpochSignerSetResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryEpochSignerSetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryEpochSignerSetResponse.Merge(m, src) +func (m *QueryQuorumCountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryQuorumCountResponse.Merge(m, src) } -func (m *QueryEpochSignerSetResponse) XXX_Size() int { +func (m *QueryQuorumCountResponse) XXX_Size() int { return m.Size() } -func (m *QueryEpochSignerSetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryEpochSignerSetResponse.DiscardUnknown(m) +func (m *QueryQuorumCountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryQuorumCountResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryEpochSignerSetResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryQuorumCountResponse proto.InternalMessageInfo + +type QueryEpochQuorumRequest struct { + EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + QuorumId uint64 `protobuf:"varint,2,opt,name=quorum_id,json=quorumId,proto3" json:"quorum_id,omitempty"` +} + +func (m *QueryEpochQuorumRequest) Reset() { *m = QueryEpochQuorumRequest{} } +func (m *QueryEpochQuorumRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEpochQuorumRequest) ProtoMessage() {} +func (*QueryEpochQuorumRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{6} +} +func (m *QueryEpochQuorumRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEpochQuorumRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEpochQuorumRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryEpochQuorumRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochQuorumRequest.Merge(m, src) +} +func (m *QueryEpochQuorumRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEpochQuorumRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochQuorumRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEpochQuorumRequest proto.InternalMessageInfo + +type QueryEpochQuorumResponse struct { + Quorum *Quorum `protobuf:"bytes,1,opt,name=quorum,proto3" json:"quorum,omitempty"` +} + +func (m *QueryEpochQuorumResponse) Reset() { *m = QueryEpochQuorumResponse{} } +func (m *QueryEpochQuorumResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEpochQuorumResponse) ProtoMessage() {} +func (*QueryEpochQuorumResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{7} +} +func (m *QueryEpochQuorumResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEpochQuorumResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEpochQuorumResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryEpochQuorumResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochQuorumResponse.Merge(m, src) +} +func (m *QueryEpochQuorumResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEpochQuorumResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochQuorumResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEpochQuorumResponse proto.InternalMessageInfo type QueryAggregatePubkeyG1Request struct { - EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` - SignersBitmap []byte `protobuf:"bytes,2,opt,name=signersBitmap,proto3" json:"signersBitmap,omitempty"` + EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + QuorumId uint64 `protobuf:"varint,2,opt,name=quorum_id,json=quorumId,proto3" json:"quorum_id,omitempty"` + QuorumBitmap []byte `protobuf:"bytes,3,opt,name=quorum_bitmap,json=quorumBitmap,proto3" json:"quorum_bitmap,omitempty"` } func (m *QueryAggregatePubkeyG1Request) Reset() { *m = QueryAggregatePubkeyG1Request{} } func (m *QueryAggregatePubkeyG1Request) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePubkeyG1Request) ProtoMessage() {} func (*QueryAggregatePubkeyG1Request) Descriptor() ([]byte, []int) { - return fileDescriptor_991a610b84b5964c, []int{6} + return fileDescriptor_991a610b84b5964c, []int{8} } func (m *QueryAggregatePubkeyG1Request) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -301,7 +377,7 @@ func (m *QueryAggregatePubkeyG1Response) Reset() { *m = QueryAggregatePu func (m *QueryAggregatePubkeyG1Response) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePubkeyG1Response) ProtoMessage() {} func (*QueryAggregatePubkeyG1Response) Descriptor() ([]byte, []int) { - return fileDescriptor_991a610b84b5964c, []int{7} + return fileDescriptor_991a610b84b5964c, []int{9} } func (m *QueryAggregatePubkeyG1Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -335,8 +411,10 @@ func init() { proto.RegisterType((*QuerySignerResponse)(nil), "zgc.dasigners.v1.QuerySignerResponse") proto.RegisterType((*QueryEpochNumberRequest)(nil), "zgc.dasigners.v1.QueryEpochNumberRequest") proto.RegisterType((*QueryEpochNumberResponse)(nil), "zgc.dasigners.v1.QueryEpochNumberResponse") - proto.RegisterType((*QueryEpochSignerSetRequest)(nil), "zgc.dasigners.v1.QueryEpochSignerSetRequest") - proto.RegisterType((*QueryEpochSignerSetResponse)(nil), "zgc.dasigners.v1.QueryEpochSignerSetResponse") + proto.RegisterType((*QueryQuorumCountRequest)(nil), "zgc.dasigners.v1.QueryQuorumCountRequest") + proto.RegisterType((*QueryQuorumCountResponse)(nil), "zgc.dasigners.v1.QueryQuorumCountResponse") + proto.RegisterType((*QueryEpochQuorumRequest)(nil), "zgc.dasigners.v1.QueryEpochQuorumRequest") + proto.RegisterType((*QueryEpochQuorumResponse)(nil), "zgc.dasigners.v1.QueryEpochQuorumResponse") proto.RegisterType((*QueryAggregatePubkeyG1Request)(nil), "zgc.dasigners.v1.QueryAggregatePubkeyG1Request") proto.RegisterType((*QueryAggregatePubkeyG1Response)(nil), "zgc.dasigners.v1.QueryAggregatePubkeyG1Response") } @@ -344,45 +422,49 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/query.proto", fileDescriptor_991a610b84b5964c) } var fileDescriptor_991a610b84b5964c = []byte{ - // 600 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x4e, - 0x10, 0x8d, 0xfb, 0x57, 0xbf, 0x6d, 0x7e, 0xa8, 0xdd, 0x56, 0xaa, 0x63, 0x5a, 0x27, 0x35, 0x29, - 0x6a, 0x51, 0xed, 0x4d, 0xc2, 0x19, 0x21, 0x2a, 0xa1, 0x9e, 0x40, 0xd4, 0xbd, 0x71, 0x89, 0xd6, - 0x66, 0xd9, 0x58, 0xc4, 0x5e, 0x37, 0x5e, 0x47, 0x4d, 0x8f, 0x5c, 0xb9, 0x20, 0x71, 0xe1, 0x03, - 0xf0, 0x61, 0x7a, 0xa3, 0x12, 0x17, 0x8e, 0x90, 0xf0, 0x41, 0x50, 0x76, 0x37, 0x09, 0x8e, 0x71, - 0xc9, 0x6d, 0xf7, 0xcd, 0x9b, 0x79, 0x6f, 0x76, 0x46, 0x0b, 0xf6, 0xae, 0xa9, 0x8f, 0xde, 0xe0, - 0x24, 0xa0, 0x11, 0xe9, 0x25, 0xa8, 0xdf, 0x44, 0x97, 0x29, 0xe9, 0x0d, 0x9c, 0xb8, 0xc7, 0x38, - 0x83, 0x9b, 0xd7, 0xd4, 0x77, 0xa6, 0x51, 0xa7, 0xdf, 0x34, 0x2a, 0x3e, 0x4b, 0x42, 0x96, 0xb4, - 0x45, 0x1c, 0xc9, 0x8b, 0x24, 0x1b, 0x3b, 0x94, 0x51, 0x26, 0xf1, 0xf1, 0x49, 0xa1, 0x7b, 0x94, - 0x31, 0xda, 0x25, 0x08, 0xc7, 0x01, 0xc2, 0x51, 0xc4, 0x38, 0xe6, 0x01, 0x8b, 0x26, 0x39, 0x15, - 0x15, 0x15, 0x37, 0x2f, 0x7d, 0x8b, 0x70, 0xa4, 0xb4, 0x8d, 0xea, 0x7c, 0x88, 0x07, 0x21, 0x49, - 0x38, 0x0e, 0x63, 0x45, 0xa8, 0xe5, 0xac, 0xcf, 0x9c, 0x0a, 0x86, 0xe5, 0x00, 0x78, 0x3e, 0xee, - 0xe6, 0x42, 0xa0, 0x2e, 0xb9, 0x4c, 0x49, 0xc2, 0xa1, 0x0e, 0xd6, 0xb1, 0xef, 0xb3, 0x34, 0xe2, - 0xba, 0x56, 0xd3, 0x8e, 0xfe, 0x73, 0x27, 0x57, 0xeb, 0x0c, 0x6c, 0x67, 0xf8, 0x49, 0xcc, 0xa2, - 0x84, 0xc0, 0x06, 0x58, 0x93, 0x75, 0x05, 0x7f, 0xa3, 0xa5, 0x3b, 0xf3, 0xcf, 0xe2, 0xa8, 0x0c, - 0xc5, 0xb3, 0x2a, 0x60, 0x57, 0x14, 0x7a, 0x1e, 0x33, 0xbf, 0xf3, 0x32, 0x0d, 0xbd, 0xa9, 0xba, - 0xf5, 0x04, 0xe8, 0xf9, 0x90, 0x12, 0x3a, 0x00, 0x65, 0x32, 0x86, 0xdb, 0x91, 0xc0, 0x85, 0xdc, - 0x8a, 0xbb, 0x41, 0x66, 0x54, 0xeb, 0x29, 0x30, 0x66, 0xe9, 0x52, 0xf5, 0x82, 0xf0, 0x49, 0x6b, - 0x0b, 0x14, 0x38, 0x07, 0xf7, 0xff, 0x5a, 0x40, 0x59, 0x68, 0x81, 0x75, 0xd5, 0x96, 0xae, 0xd5, - 0x96, 0xef, 0x6c, 0x76, 0x42, 0xb4, 0x3a, 0x60, 0x5f, 0x94, 0x7c, 0x46, 0x69, 0x8f, 0x50, 0xcc, - 0xc9, 0xab, 0xd4, 0x7b, 0x47, 0x06, 0x67, 0xcd, 0xc5, 0x6d, 0xc1, 0x3a, 0xf8, 0x5f, 0x95, 0x3b, - 0x0d, 0x78, 0x88, 0x63, 0x7d, 0xa9, 0xa6, 0x1d, 0x95, 0xdd, 0x2c, 0x68, 0x5d, 0x01, 0xb3, 0x48, - 0x49, 0xf9, 0x77, 0xc0, 0x36, 0x9e, 0x04, 0xdb, 0xb1, 0x88, 0xb6, 0x69, 0x53, 0x28, 0x96, 0xdd, - 0x2d, 0x3c, 0x9f, 0x07, 0x77, 0xc0, 0x2a, 0x67, 0x1c, 0x77, 0x85, 0xde, 0x8a, 0x2b, 0x2f, 0x70, - 0x13, 0x2c, 0x77, 0x02, 0xae, 0x2f, 0x0b, 0x6c, 0x7c, 0x6c, 0x7d, 0x5d, 0x01, 0xab, 0x42, 0x1a, - 0x7e, 0xd0, 0xc0, 0xc6, 0x1f, 0xc3, 0x83, 0xc7, 0xf9, 0x07, 0x2a, 0x98, 0xbd, 0xf1, 0x68, 0x11, - 0xaa, 0x6c, 0xc4, 0x3a, 0x7c, 0xff, 0xed, 0xd7, 0xa7, 0xa5, 0x2a, 0xdc, 0x47, 0x0d, 0x9a, 0xdd, - 0x72, 0xf1, 0x6c, 0xb6, 0x7c, 0x4a, 0xf8, 0x59, 0x03, 0xf7, 0xb2, 0xa3, 0x84, 0x27, 0x77, 0xa9, - 0xcc, 0xaf, 0x8c, 0x61, 0x2f, 0xc8, 0x56, 0xb6, 0x8e, 0x85, 0xad, 0x07, 0xf0, 0xa0, 0xc0, 0x96, - 0x04, 0xec, 0x84, 0x70, 0xf8, 0x45, 0x03, 0x5b, 0xb9, 0x41, 0x41, 0x54, 0xa0, 0x57, 0xb4, 0x3c, - 0x46, 0x63, 0xf1, 0x04, 0xe5, 0xf1, 0x44, 0x78, 0x7c, 0x08, 0xeb, 0x39, 0x8f, 0xd3, 0xf9, 0xdb, - 0x72, 0x35, 0x6c, 0xda, 0x84, 0x7d, 0xb0, 0x26, 0xdb, 0x84, 0xf5, 0x02, 0xa5, 0xcc, 0xf7, 0x61, - 0x1c, 0xfe, 0x83, 0xa5, 0x4c, 0x54, 0x85, 0x89, 0x0a, 0xdc, 0xcd, 0x99, 0x90, 0xc7, 0xd3, 0x17, - 0x37, 0x3f, 0xcd, 0xd2, 0xcd, 0xd0, 0xd4, 0x6e, 0x87, 0xa6, 0xf6, 0x63, 0x68, 0x6a, 0x1f, 0x47, - 0x66, 0xe9, 0x76, 0x64, 0x96, 0xbe, 0x8f, 0xcc, 0xd2, 0x6b, 0x44, 0x03, 0xde, 0x49, 0x3d, 0xc7, - 0x67, 0x21, 0x6a, 0xd0, 0x2e, 0xf6, 0x12, 0xd4, 0xa0, 0xb6, 0xdf, 0xc1, 0x41, 0x84, 0xae, 0xb2, - 0xf5, 0xf8, 0x20, 0x26, 0x89, 0xb7, 0x26, 0xbe, 0xbc, 0xc7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x9b, 0xb2, 0x92, 0x94, 0xd1, 0x05, 0x00, 0x00, + // 658 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x4f, 0xd4, 0x4e, + 0x18, 0xde, 0xf2, 0x2f, 0x30, 0xf0, 0x4b, 0x60, 0x20, 0xa1, 0xdb, 0x1f, 0x94, 0xb5, 0x82, 0x41, + 0xe3, 0x76, 0xba, 0x78, 0xd5, 0x83, 0x18, 0x43, 0x4c, 0xd4, 0x48, 0x3d, 0xe9, 0x65, 0x33, 0x2d, + 0xe3, 0x6c, 0x23, 0xed, 0x74, 0xb7, 0x53, 0x02, 0x1c, 0x8d, 0x37, 0x2f, 0x26, 0x7e, 0x05, 0x3f, + 0x0c, 0x47, 0x12, 0x2f, 0x1e, 0x15, 0xfc, 0x20, 0x66, 0x67, 0xa6, 0xdb, 0x2d, 0xdd, 0x2e, 0x7b, + 0xf0, 0x36, 0xf3, 0xbe, 0xef, 0xf3, 0x3e, 0xcf, 0x3c, 0x3c, 0x74, 0xc1, 0xc6, 0x39, 0xf5, 0xd1, + 0x11, 0x4e, 0x02, 0x1a, 0x91, 0x5e, 0x82, 0x4e, 0x5a, 0xa8, 0x9b, 0x92, 0xde, 0x99, 0x1d, 0xf7, + 0x18, 0x67, 0x70, 0xf9, 0x9c, 0xfa, 0xf6, 0xa0, 0x6b, 0x9f, 0xb4, 0x8c, 0xba, 0xcf, 0x92, 0x90, + 0x25, 0x6d, 0xd1, 0x47, 0xf2, 0x22, 0x87, 0x8d, 0x35, 0xca, 0x28, 0x93, 0xf5, 0xfe, 0x49, 0x55, + 0x37, 0x28, 0x63, 0xf4, 0x98, 0x20, 0x1c, 0x07, 0x08, 0x47, 0x11, 0xe3, 0x98, 0x07, 0x2c, 0xca, + 0x30, 0x75, 0xd5, 0x15, 0x37, 0x2f, 0xfd, 0x80, 0x70, 0xa4, 0xb8, 0x8d, 0xad, 0x9b, 0x2d, 0x1e, + 0x84, 0x24, 0xe1, 0x38, 0x8c, 0xd5, 0x40, 0xa3, 0x24, 0x3d, 0x57, 0x2a, 0x26, 0x2c, 0x07, 0xc0, + 0xc3, 0xfe, 0x6b, 0xde, 0x8a, 0xaa, 0x4b, 0xba, 0x29, 0x49, 0x38, 0x34, 0xc0, 0x3c, 0xf6, 0x7d, + 0x96, 0x46, 0x3c, 0xd1, 0xb5, 0xc6, 0xf4, 0xee, 0x82, 0x3b, 0xb8, 0x5b, 0x07, 0x60, 0xb5, 0x80, + 0x48, 0x62, 0x16, 0x25, 0x04, 0x3a, 0x60, 0x4e, 0x6e, 0x16, 0x80, 0xc5, 0x3d, 0xdd, 0xbe, 0x69, + 0x8c, 0xad, 0x10, 0x6a, 0xce, 0xaa, 0x83, 0x75, 0xb1, 0xe8, 0x79, 0xcc, 0xfc, 0xce, 0xeb, 0x34, + 0xf4, 0x06, 0xfc, 0xd6, 0x13, 0xa0, 0x97, 0x5b, 0x8a, 0xe8, 0x0e, 0x58, 0x22, 0xfd, 0x72, 0x3b, + 0x12, 0x75, 0x5d, 0x6b, 0x68, 0xbb, 0x33, 0xee, 0x22, 0xc9, 0x47, 0xad, 0xc7, 0x6a, 0xf3, 0x61, + 0xca, 0x7a, 0x69, 0xf8, 0xac, 0xaf, 0x3b, 0x7b, 0xd9, 0x04, 0xe8, 0x8c, 0xbc, 0x80, 0xce, 0xc9, + 0xbb, 0xa2, 0xdc, 0x16, 0x6e, 0x64, 0xf0, 0x6e, 0x3e, 0x6a, 0xbd, 0x1b, 0x7e, 0x96, 0xdc, 0x31, + 0x39, 0x39, 0xfc, 0x1f, 0x2c, 0x28, 0x82, 0xe0, 0x48, 0x9f, 0x12, 0xfd, 0x79, 0x59, 0x78, 0x71, + 0x64, 0xbd, 0x1c, 0xb6, 0x25, 0x5b, 0x9d, 0xfb, 0x2f, 0xe7, 0xc4, 0xd6, 0x91, 0xfe, 0x2b, 0x84, + 0x9a, 0xb3, 0x3e, 0x6b, 0x60, 0x53, 0xac, 0x7b, 0x4a, 0x69, 0x8f, 0x50, 0xcc, 0xc9, 0x9b, 0xd4, + 0xfb, 0x48, 0xce, 0x0e, 0x5a, 0xff, 0x48, 0x2f, 0xbc, 0x0b, 0xfe, 0x53, 0x4d, 0x2f, 0xe0, 0x21, + 0x8e, 0xf5, 0xe9, 0x86, 0xb6, 0xbb, 0xe4, 0x2a, 0x0b, 0xf7, 0x45, 0xcd, 0x3a, 0x05, 0x66, 0x95, + 0x0a, 0xf5, 0x34, 0x1b, 0xac, 0xe2, 0xac, 0xd9, 0x8e, 0x45, 0xb7, 0x4d, 0x5b, 0x42, 0xcd, 0x92, + 0xbb, 0x82, 0x6f, 0xe2, 0xe0, 0x1a, 0x98, 0xe5, 0x8c, 0xe3, 0x63, 0xa5, 0x47, 0x5e, 0xe0, 0x32, + 0x98, 0xee, 0x04, 0x5c, 0x48, 0x98, 0x71, 0xfb, 0xc7, 0xbd, 0xcb, 0x59, 0x30, 0x2b, 0xa8, 0xe1, + 0x17, 0x0d, 0x2c, 0x0e, 0x65, 0x0d, 0xde, 0x1f, 0x65, 0xde, 0xc8, 0xa8, 0x1a, 0x0f, 0x26, 0x19, + 0x95, 0x0f, 0xb1, 0x76, 0x3e, 0xfd, 0xf8, 0xf3, 0x6d, 0x6a, 0x0b, 0x6e, 0x22, 0x87, 0x16, 0xff, + 0x2d, 0x85, 0xa5, 0x4d, 0x69, 0xb3, 0x50, 0x33, 0x14, 0xbe, 0x4a, 0x35, 0xe5, 0x78, 0x57, 0xaa, + 0x19, 0x91, 0xe5, 0x31, 0x6a, 0xe4, 0xdf, 0xa7, 0x29, 0x22, 0x9e, 0x7b, 0x23, 0x77, 0x8c, 0xf7, + 0xa6, 0x90, 0xf7, 0xf1, 0xde, 0x14, 0xf3, 0x7b, 0xab, 0x37, 0x52, 0x13, 0xfc, 0xae, 0x81, 0x95, + 0x52, 0x52, 0x20, 0xaa, 0x20, 0xaa, 0x4a, 0xb6, 0xe1, 0x4c, 0x0e, 0x50, 0xfa, 0x1e, 0x0a, 0x7d, + 0xf7, 0xe0, 0x76, 0x49, 0xdf, 0x20, 0x80, 0x4d, 0x99, 0xcd, 0x26, 0x6d, 0xc1, 0x13, 0x30, 0x27, + 0xbf, 0x76, 0x70, 0xbb, 0x82, 0xa9, 0xf0, 0xc1, 0x35, 0x76, 0x6e, 0x99, 0x52, 0x22, 0xb6, 0x84, + 0x88, 0x3a, 0x5c, 0x2f, 0x89, 0x90, 0xc7, 0xfd, 0x57, 0x17, 0xbf, 0xcd, 0xda, 0xc5, 0x95, 0xa9, + 0x5d, 0x5e, 0x99, 0xda, 0xaf, 0x2b, 0x53, 0xfb, 0x7a, 0x6d, 0xd6, 0x2e, 0xaf, 0xcd, 0xda, 0xcf, + 0x6b, 0xb3, 0xf6, 0x1e, 0xd1, 0x80, 0x77, 0x52, 0xcf, 0xf6, 0x59, 0x88, 0x1c, 0x7a, 0x8c, 0xbd, + 0x04, 0x39, 0xb4, 0xe9, 0x77, 0x70, 0x10, 0xa1, 0xd3, 0xe2, 0x3e, 0x7e, 0x16, 0x93, 0xc4, 0x9b, + 0x13, 0x3f, 0x12, 0x8f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x8c, 0xd5, 0xcf, 0x03, 0x07, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -398,7 +480,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { EpochNumber(ctx context.Context, in *QueryEpochNumberRequest, opts ...grpc.CallOption) (*QueryEpochNumberResponse, error) - EpochSignerSet(ctx context.Context, in *QueryEpochSignerSetRequest, opts ...grpc.CallOption) (*QueryEpochSignerSetResponse, error) + QuorumCount(ctx context.Context, in *QueryQuorumCountRequest, opts ...grpc.CallOption) (*QueryQuorumCountResponse, error) + EpochQuorum(ctx context.Context, in *QueryEpochQuorumRequest, opts ...grpc.CallOption) (*QueryEpochQuorumResponse, error) AggregatePubkeyG1(ctx context.Context, in *QueryAggregatePubkeyG1Request, opts ...grpc.CallOption) (*QueryAggregatePubkeyG1Response, error) Signer(ctx context.Context, in *QuerySignerRequest, opts ...grpc.CallOption) (*QuerySignerResponse, error) } @@ -420,9 +503,18 @@ func (c *queryClient) EpochNumber(ctx context.Context, in *QueryEpochNumberReque return out, nil } -func (c *queryClient) EpochSignerSet(ctx context.Context, in *QueryEpochSignerSetRequest, opts ...grpc.CallOption) (*QueryEpochSignerSetResponse, error) { - out := new(QueryEpochSignerSetResponse) - err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/EpochSignerSet", in, out, opts...) +func (c *queryClient) QuorumCount(ctx context.Context, in *QueryQuorumCountRequest, opts ...grpc.CallOption) (*QueryQuorumCountResponse, error) { + out := new(QueryQuorumCountResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/QuorumCount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) EpochQuorum(ctx context.Context, in *QueryEpochQuorumRequest, opts ...grpc.CallOption) (*QueryEpochQuorumResponse, error) { + out := new(QueryEpochQuorumResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/EpochQuorum", in, out, opts...) if err != nil { return nil, err } @@ -450,7 +542,8 @@ func (c *queryClient) Signer(ctx context.Context, in *QuerySignerRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { EpochNumber(context.Context, *QueryEpochNumberRequest) (*QueryEpochNumberResponse, error) - EpochSignerSet(context.Context, *QueryEpochSignerSetRequest) (*QueryEpochSignerSetResponse, error) + QuorumCount(context.Context, *QueryQuorumCountRequest) (*QueryQuorumCountResponse, error) + EpochQuorum(context.Context, *QueryEpochQuorumRequest) (*QueryEpochQuorumResponse, error) AggregatePubkeyG1(context.Context, *QueryAggregatePubkeyG1Request) (*QueryAggregatePubkeyG1Response, error) Signer(context.Context, *QuerySignerRequest) (*QuerySignerResponse, error) } @@ -462,8 +555,11 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) EpochNumber(ctx context.Context, req *QueryEpochNumberRequest) (*QueryEpochNumberResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EpochNumber not implemented") } -func (*UnimplementedQueryServer) EpochSignerSet(ctx context.Context, req *QueryEpochSignerSetRequest) (*QueryEpochSignerSetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EpochSignerSet not implemented") +func (*UnimplementedQueryServer) QuorumCount(ctx context.Context, req *QueryQuorumCountRequest) (*QueryQuorumCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QuorumCount not implemented") +} +func (*UnimplementedQueryServer) EpochQuorum(ctx context.Context, req *QueryEpochQuorumRequest) (*QueryEpochQuorumResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EpochQuorum not implemented") } func (*UnimplementedQueryServer) AggregatePubkeyG1(ctx context.Context, req *QueryAggregatePubkeyG1Request) (*QueryAggregatePubkeyG1Response, error) { return nil, status.Errorf(codes.Unimplemented, "method AggregatePubkeyG1 not implemented") @@ -494,20 +590,38 @@ func _Query_EpochNumber_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _Query_EpochSignerSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryEpochSignerSetRequest) +func _Query_QuorumCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryQuorumCountRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).EpochSignerSet(ctx, in) + return srv.(QueryServer).QuorumCount(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zgc.dasigners.v1.Query/EpochSignerSet", + FullMethod: "/zgc.dasigners.v1.Query/QuorumCount", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).EpochSignerSet(ctx, req.(*QueryEpochSignerSetRequest)) + return srv.(QueryServer).QuorumCount(ctx, req.(*QueryQuorumCountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_EpochQuorum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEpochQuorumRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EpochQuorum(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Query/EpochQuorum", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EpochQuorum(ctx, req.(*QueryEpochQuorumRequest)) } return interceptor(ctx, in, info, handler) } @@ -557,8 +671,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_EpochNumber_Handler, }, { - MethodName: "EpochSignerSet", - Handler: _Query_EpochSignerSet_Handler, + MethodName: "QuorumCount", + Handler: _Query_QuorumCount_Handler, + }, + { + MethodName: "EpochQuorum", + Handler: _Query_EpochQuorum_Handler, }, { MethodName: "AggregatePubkeyG1", @@ -593,12 +711,14 @@ func (m *QuerySignerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Account) > 0 { - i -= len(m.Account) - copy(dAtA[i:], m.Account) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) - i-- - dAtA[i] = 0xa + if len(m.Accounts) > 0 { + for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Accounts[iNdEx]) + copy(dAtA[i:], m.Accounts[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Accounts[iNdEx]))) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -623,17 +743,19 @@ func (m *QuerySignerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Signer != nil { - { - size, err := m.Signer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Signer) > 0 { + for iNdEx := len(m.Signer) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signer[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -689,7 +811,7 @@ func (m *QueryEpochNumberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryEpochSignerSetRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryQuorumCountRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -699,12 +821,12 @@ func (m *QueryEpochSignerSetRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryEpochSignerSetRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryQuorumCountRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryEpochSignerSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryQuorumCountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -717,7 +839,7 @@ func (m *QueryEpochSignerSetRequest) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *QueryEpochSignerSetResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryQuorumCountResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -727,29 +849,88 @@ func (m *QueryEpochSignerSetResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryEpochSignerSetResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryQuorumCountResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryEpochSignerSetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryQuorumCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Signers) > 0 { - for iNdEx := len(m.Signers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if m.QuorumCount != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.QuorumCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEpochQuorumRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEpochQuorumRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEpochQuorumRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.QuorumId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.QuorumId)) + i-- + dAtA[i] = 0x10 + } + if m.EpochNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEpochQuorumResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEpochQuorumResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEpochQuorumResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Quorum != nil { + { + size, err := m.Quorum.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -774,12 +955,17 @@ func (m *QueryAggregatePubkeyG1Request) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - if len(m.SignersBitmap) > 0 { - i -= len(m.SignersBitmap) - copy(dAtA[i:], m.SignersBitmap) - i = encodeVarintQuery(dAtA, i, uint64(len(m.SignersBitmap))) + if len(m.QuorumBitmap) > 0 { + i -= len(m.QuorumBitmap) + copy(dAtA[i:], m.QuorumBitmap) + i = encodeVarintQuery(dAtA, i, uint64(len(m.QuorumBitmap))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a + } + if m.QuorumId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.QuorumId)) + i-- + dAtA[i] = 0x10 } if m.EpochNumber != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.EpochNumber)) @@ -846,9 +1032,11 @@ func (m *QuerySignerRequest) Size() (n int) { } var l int _ = l - l = len(m.Account) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Accounts) > 0 { + for _, s := range m.Accounts { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } } return n } @@ -859,9 +1047,11 @@ func (m *QuerySignerResponse) Size() (n int) { } var l int _ = l - if m.Signer != nil { - l = m.Signer.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.Signer) > 0 { + for _, e := range m.Signer { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } return n } @@ -887,7 +1077,7 @@ func (m *QueryEpochNumberResponse) Size() (n int) { return n } -func (m *QueryEpochSignerSetRequest) Size() (n int) { +func (m *QueryQuorumCountRequest) Size() (n int) { if m == nil { return 0 } @@ -899,17 +1089,42 @@ func (m *QueryEpochSignerSetRequest) Size() (n int) { return n } -func (m *QueryEpochSignerSetResponse) Size() (n int) { +func (m *QueryQuorumCountResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Signers) > 0 { - for _, e := range m.Signers { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if m.QuorumCount != 0 { + n += 1 + sovQuery(uint64(m.QuorumCount)) + } + return n +} + +func (m *QueryEpochQuorumRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNumber != 0 { + n += 1 + sovQuery(uint64(m.EpochNumber)) + } + if m.QuorumId != 0 { + n += 1 + sovQuery(uint64(m.QuorumId)) + } + return n +} + +func (m *QueryEpochQuorumResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Quorum != nil { + l = m.Quorum.Size() + n += 1 + l + sovQuery(uint64(l)) } return n } @@ -923,7 +1138,10 @@ func (m *QueryAggregatePubkeyG1Request) Size() (n int) { if m.EpochNumber != 0 { n += 1 + sovQuery(uint64(m.EpochNumber)) } - l = len(m.SignersBitmap) + if m.QuorumId != 0 { + n += 1 + sovQuery(uint64(m.QuorumId)) + } + l = len(m.QuorumBitmap) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -986,7 +1204,7 @@ func (m *QuerySignerRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1014,7 +1232,7 @@ func (m *QuerySignerRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Account = string(dAtA[iNdEx:postIndex]) + m.Accounts = append(m.Accounts, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -1095,10 +1313,8 @@ func (m *QuerySignerResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Signer == nil { - m.Signer = &Signer{} - } - if err := m.Signer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Signer = append(m.Signer, &Signer{}) + if err := m.Signer[len(m.Signer)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1242,7 +1458,7 @@ func (m *QueryEpochNumberResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryEpochSignerSetRequest) Unmarshal(dAtA []byte) error { +func (m *QueryQuorumCountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1265,10 +1481,10 @@ func (m *QueryEpochSignerSetRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryEpochSignerSetRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryQuorumCountRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryEpochSignerSetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryQuorumCountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1311,7 +1527,7 @@ func (m *QueryEpochSignerSetRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryEpochSignerSetResponse) Unmarshal(dAtA []byte) error { +func (m *QueryQuorumCountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1334,15 +1550,172 @@ func (m *QueryEpochSignerSetResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryEpochSignerSetResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryQuorumCountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryEpochSignerSetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryQuorumCountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QuorumCount", wireType) + } + m.QuorumCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QuorumCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEpochQuorumRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEpochQuorumRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEpochQuorumRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QuorumId", wireType) + } + m.QuorumId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QuorumId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEpochQuorumResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEpochQuorumResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEpochQuorumResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1369,8 +1742,10 @@ func (m *QueryEpochSignerSetResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signers = append(m.Signers, &Signer{}) - if err := m.Signers[len(m.Signers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Quorum == nil { + m.Quorum = &Quorum{} + } + if err := m.Quorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1444,8 +1819,27 @@ func (m *QueryAggregatePubkeyG1Request) Unmarshal(dAtA []byte) error { } } case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QuorumId", wireType) + } + m.QuorumId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QuorumId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignersBitmap", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field QuorumBitmap", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -1472,9 +1866,9 @@ func (m *QueryAggregatePubkeyG1Request) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SignersBitmap = append(m.SignersBitmap[:0], dAtA[iNdEx:postIndex]...) - if m.SignersBitmap == nil { - m.SignersBitmap = []byte{} + m.QuorumBitmap = append(m.QuorumBitmap[:0], dAtA[iNdEx:postIndex]...) + if m.QuorumBitmap == nil { + m.QuorumBitmap = []byte{} } iNdEx = postIndex default: diff --git a/x/dasigners/v1/types/query.pb.gw.go b/x/dasigners/v1/types/query.pb.gw.go index 362db812..c4e13717 100644 --- a/x/dasigners/v1/types/query.pb.gw.go +++ b/x/dasigners/v1/types/query.pb.gw.go @@ -52,37 +52,73 @@ func local_request_Query_EpochNumber_0(ctx context.Context, marshaler runtime.Ma } var ( - filter_Query_EpochSignerSet_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_QuorumCount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_EpochSignerSet_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryEpochSignerSetRequest +func request_Query_QuorumCount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryQuorumCountRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochSignerSet_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QuorumCount_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.EpochSignerSet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.QuorumCount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_EpochSignerSet_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryEpochSignerSetRequest +func local_request_Query_QuorumCount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryQuorumCountRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochSignerSet_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QuorumCount_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.EpochSignerSet(ctx, &protoReq) + msg, err := server.QuorumCount(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EpochQuorum_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_EpochQuorum_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochQuorumRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochQuorum_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EpochQuorum(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EpochQuorum_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochQuorumRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochQuorum_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EpochQuorum(ctx, &protoReq) return msg, metadata, err } @@ -188,7 +224,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_EpochSignerSet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QuorumCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -199,7 +235,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_EpochSignerSet_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QuorumCount_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -207,7 +243,30 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_EpochSignerSet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QuorumCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EpochQuorum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_EpochQuorum_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EpochQuorum_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -318,7 +377,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_EpochSignerSet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QuorumCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -327,14 +386,34 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_EpochSignerSet_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QuorumCount_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_EpochSignerSet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QuorumCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EpochQuorum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EpochQuorum_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EpochQuorum_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -384,7 +463,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_EpochNumber_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-number"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_EpochSignerSet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-signer-set"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QuorumCount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "quorum-count"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EpochQuorum_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-quorum"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_AggregatePubkeyG1_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "aggregate-pubkey-g1"}, "", runtime.AssumeColonVerbOpt(false))) @@ -394,7 +475,9 @@ var ( var ( forward_Query_EpochNumber_0 = runtime.ForwardResponseMessage - forward_Query_EpochSignerSet_0 = runtime.ForwardResponseMessage + forward_Query_QuorumCount_0 = runtime.ForwardResponseMessage + + forward_Query_EpochQuorum_0 = runtime.ForwardResponseMessage forward_Query_AggregatePubkeyG1_0 = runtime.ForwardResponseMessage From 93595837ca3d7e058cbcf1be3c6000b26aad1d92 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Thu, 16 May 2024 23:25:43 +0800 Subject: [PATCH 07/26] fix: quorum --- precompiles/dasigners/dasigners.go | 15 ++++++++------- x/dasigners/v1/keeper/abci.go | 6 +++++- x/dasigners/v1/keeper/grpc_query.go | 9 +++++---- x/dasigners/v1/types/errors.go | 2 +- x/dasigners/v1/types/genesis.go | 6 ++++-- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/precompiles/dasigners/dasigners.go b/precompiles/dasigners/dasigners.go index 87816ae6..5a23598e 100644 --- a/precompiles/dasigners/dasigners.go +++ b/precompiles/dasigners/dasigners.go @@ -29,13 +29,14 @@ const ( ) var RequiredGasBasic = map[string]uint64{ - "epochNumber": 1000, - "getSigner": 10000, - "getSigners": 1000000, - "updateSocket": 50000, - "registerNextEpoch": 100000, - "registerSigner": 100000, - "getAggPkG1": 1000000, + DASignersFunctionEpochNumber: 1000, + DASignersFunctionQuorumCount: 1000, + DASignersFunctionGetSigner: 100000, + DASignersFunctionGetQuorum: 100000, + DASignersFunctionRegisterSigner: 100000, + DASignersFunctionUpdateSocket: 50000, + DASignersFunctionRegisterNextEpoch: 100000, + DASignersFunctionGetAggPkG1: 1000000, } var KVGasConfig storetypes.GasConfig = storetypes.GasConfig{ diff --git a/x/dasigners/v1/keeper/abci.go b/x/dasigners/v1/keeper/abci.go index cc509269..b3291c60 100644 --- a/x/dasigners/v1/keeper/abci.go +++ b/x/dasigners/v1/keeper/abci.go @@ -86,7 +86,7 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { } quorums.Quorums = append(quorums.Quorums, &quorum) } - } else { + } else if len(ballots) > 0 { quorum := types.Quorum{ Signers: make([]string, params.EncodedSlices), } @@ -95,6 +95,10 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { quorum.Signers[i] = ballots[i%n].account } quorums.Quorums = append(quorums.Quorums, &quorum) + } else { + quorums.Quorums = append(quorums.Quorums, &types.Quorum{ + Signers: make([]string, 0), + }) } // save to store diff --git a/x/dasigners/v1/keeper/grpc_query.go b/x/dasigners/v1/keeper/grpc_query.go index 484d970c..cd0fedfe 100644 --- a/x/dasigners/v1/keeper/grpc_query.go +++ b/x/dasigners/v1/keeper/grpc_query.go @@ -84,13 +84,15 @@ func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggrega hit := 0 added := make(map[string]struct{}) for i, signer := range quorum.Signers { + if _, ok := added[signer]; ok { + hit += 1 + continue + } b := request.QuorumBitmap[i/8] & (1 << (i % 8)) if b == 0 { continue } - if _, ok := added[signer]; ok { - continue - } + hit += 1 added[signer] = struct{}{} signer, found, err := k.GetSigner(ctx, signer) if err != nil { @@ -99,7 +101,6 @@ func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggrega if !found { return nil, types.ErrSignerNotFound } - hit += 1 aggPubkeyG1.Add(aggPubkeyG1, bn254util.DeserializeG1(signer.PubkeyG1)) } return &types.QueryAggregatePubkeyG1Response{ diff --git a/x/dasigners/v1/types/errors.go b/x/dasigners/v1/types/errors.go index 35d89ad6..e5c916e8 100644 --- a/x/dasigners/v1/types/errors.go +++ b/x/dasigners/v1/types/errors.go @@ -9,5 +9,5 @@ var ( ErrInvalidSignature = errorsmod.Register(ModuleName, 4, "invalid signature") ErrQuorumNotFound = errorsmod.Register(ModuleName, 5, "quorum for epoch not found") ErrQuorumIdOutOfBound = errorsmod.Register(ModuleName, 6, "quorum id out of bound") - ErrQuorumBitmapLengthMismatch = errorsmod.Register(ModuleName, 6, "quorum bitmap length mismatch") + ErrQuorumBitmapLengthMismatch = errorsmod.Register(ModuleName, 7, "quorum bitmap length mismatch") ) diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index d13aa4c4..1f87bcc2 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -19,7 +19,9 @@ func DefaultGenesisState() *GenesisState { MaxVotes: 100, EpochBlocks: 1000, EncodedSlices: 3072, - }, 0, make([]*Signer, 0), make([]*Quorums, 0)) + }, 0, make([]*Signer, 0), []*Quorums{{ + Quorums: make([]*Quorum, 0), + }}) } // Validate performs basic validation of genesis data. @@ -31,7 +33,7 @@ func (gs GenesisState) Validate() error { } registered[signer.Account] = struct{}{} } - if len(gs.QuorumsByEpoch) != int(gs.EpochNumber) { + if len(gs.QuorumsByEpoch) != int(gs.EpochNumber)+1 { return fmt.Errorf("epoch history missing") } for _, quorums := range gs.QuorumsByEpoch { From 4f8d519a4d389a3d723dfb1406b8400c9fbc1ef7 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Thu, 16 May 2024 23:39:07 +0800 Subject: [PATCH 08/26] feat: max quorum num --- proto/zgc/dasigners/v1/genesis.proto | 2 +- x/dasigners/v1/keeper/abci.go | 16 ++++-- x/dasigners/v1/types/genesis.go | 2 +- x/dasigners/v1/types/genesis.pb.go | 75 ++++++++++++++-------------- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/proto/zgc/dasigners/v1/genesis.proto b/proto/zgc/dasigners/v1/genesis.proto index 41f387db..909c9464 100644 --- a/proto/zgc/dasigners/v1/genesis.proto +++ b/proto/zgc/dasigners/v1/genesis.proto @@ -11,7 +11,7 @@ option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; message Params { string tokens_per_vote = 1; - uint64 max_votes = 2; + uint64 max_quorums = 2; uint64 epoch_blocks = 3; uint64 encoded_slices = 4; } diff --git a/x/dasigners/v1/keeper/abci.go b/x/dasigners/v1/keeper/abci.go index b3291c60..121a4492 100644 --- a/x/dasigners/v1/keeper/abci.go +++ b/x/dasigners/v1/keeper/abci.go @@ -2,7 +2,6 @@ package keeper import ( "bytes" - "math/big" "sort" "github.com/0glabs/0g-chain/x/dasigners/v1/types" @@ -56,9 +55,6 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { continue } num := validator.Tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(tokensPerVote).Abs().BigInt() - if num.Cmp(big.NewInt(int64(params.MaxVotes))) > 0 { - num = big.NewInt(int64(params.MaxVotes)) - } content := registration.content ballotNum := num.Int64() for j := 0; j < int(ballotNum); j += 1 { @@ -78,6 +74,9 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { } if len(ballots) >= int(params.EncodedSlices) { for i := 0; i+int(params.EncodedSlices) < len(ballots); i += 1 { + if int(params.MaxQuorums) < len(quorums.Quorums) { + break + } quorum := types.Quorum{ Signers: make([]string, params.EncodedSlices), } @@ -86,6 +85,15 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { } quorums.Quorums = append(quorums.Quorums, &quorum) } + if len(ballots)%int(params.EncodedSlices) != 0 && int(params.MaxQuorums) < len(quorums.Quorums) { + quorum := types.Quorum{ + Signers: make([]string, 0), + } + for j := len(ballots) - int(params.EncodedSlices); j < len(ballots); j += 1 { + quorum.Signers = append(quorum.Signers, ballots[j].account) + } + quorums.Quorums = append(quorums.Quorums, &quorum) + } } else if len(ballots) > 0 { quorum := types.Quorum{ Signers: make([]string, params.EncodedSlices), diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index 1f87bcc2..b8a8d35a 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -16,7 +16,7 @@ func NewGenesisState(params Params, epoch uint64, signers []*Signer, quorumsByEp func DefaultGenesisState() *GenesisState { return NewGenesisState(Params{ TokensPerVote: "100", - MaxVotes: 100, + MaxQuorums: 100, EpochBlocks: 1000, EncodedSlices: 3072, }, 0, make([]*Signer, 0), []*Quorums{{ diff --git a/x/dasigners/v1/types/genesis.pb.go b/x/dasigners/v1/types/genesis.pb.go index 90ce4088..6ffcb48b 100644 --- a/x/dasigners/v1/types/genesis.pb.go +++ b/x/dasigners/v1/types/genesis.pb.go @@ -28,7 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Params struct { TokensPerVote string `protobuf:"bytes,1,opt,name=tokens_per_vote,json=tokensPerVote,proto3" json:"tokens_per_vote,omitempty"` - MaxVotes uint64 `protobuf:"varint,2,opt,name=max_votes,json=maxVotes,proto3" json:"max_votes,omitempty"` + MaxQuorums uint64 `protobuf:"varint,2,opt,name=max_quorums,json=maxQuorums,proto3" json:"max_quorums,omitempty"` EpochBlocks uint64 `protobuf:"varint,3,opt,name=epoch_blocks,json=epochBlocks,proto3" json:"epoch_blocks,omitempty"` EncodedSlices uint64 `protobuf:"varint,4,opt,name=encoded_slices,json=encodedSlices,proto3" json:"encoded_slices,omitempty"` } @@ -73,9 +73,9 @@ func (m *Params) GetTokensPerVote() string { return "" } -func (m *Params) GetMaxVotes() uint64 { +func (m *Params) GetMaxQuorums() uint64 { if m != nil { - return m.MaxVotes + return m.MaxQuorums } return 0 } @@ -175,34 +175,33 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/genesis.proto", fileDescriptor_896efa766aaca3be) } var fileDescriptor_896efa766aaca3be = []byte{ - // 417 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0x63, 0x12, 0x05, 0xba, 0xfd, 0x43, 0x65, 0x71, 0x70, 0x8a, 0xe4, 0x86, 0x4a, 0xa0, - 0x5e, 0xf0, 0xb6, 0x45, 0xe2, 0x01, 0x82, 0x10, 0xe2, 0x82, 0x8a, 0x23, 0x71, 0xe0, 0x62, 0xad, - 0x37, 0xc3, 0xc6, 0x6a, 0xd6, 0x63, 0x3c, 0xeb, 0x28, 0xe9, 0x53, 0x70, 0xe3, 0x95, 0x7a, 0xec, - 0x91, 0x13, 0x42, 0xce, 0x8b, 0xa0, 0x8e, 0x17, 0x2a, 0x5a, 0x6e, 0x3b, 0xdf, 0xf7, 0x9b, 0xd1, - 0xb7, 0x33, 0x22, 0xbe, 0x34, 0x5a, 0xce, 0x14, 0x15, 0xa6, 0x84, 0x9a, 0xe4, 0xf2, 0x54, 0x1a, - 0x28, 0x81, 0x0a, 0x4a, 0xaa, 0x1a, 0x1d, 0x86, 0xfb, 0x97, 0x46, 0x27, 0x7f, 0xfd, 0x64, 0x79, - 0x7a, 0x30, 0xd2, 0x48, 0x16, 0x29, 0x63, 0x5f, 0x76, 0x45, 0x07, 0x1f, 0x3c, 0x31, 0x68, 0xb0, - 0xd3, 0x6f, 0x5e, 0x5e, 0x1d, 0x19, 0x44, 0xb3, 0x00, 0xc9, 0x55, 0xde, 0x7c, 0x91, 0xaa, 0x5c, - 0x7b, 0xeb, 0xf0, 0xae, 0xe5, 0x0a, 0x0b, 0xe4, 0x94, 0xad, 0x3c, 0x30, 0xbe, 0x17, 0xef, 0x36, - 0x0b, 0x13, 0x47, 0xdf, 0x03, 0x31, 0x3c, 0x57, 0xb5, 0xb2, 0x14, 0xbe, 0x10, 0x8f, 0x1d, 0x5e, - 0x40, 0x49, 0x59, 0x05, 0x75, 0xb6, 0x44, 0x07, 0x51, 0x30, 0x0e, 0x8e, 0xb7, 0xd2, 0xdd, 0x4e, - 0x3e, 0x87, 0xfa, 0x13, 0x3a, 0x08, 0x9f, 0x8a, 0x2d, 0xab, 0x56, 0x0c, 0x50, 0xf4, 0x60, 0x1c, - 0x1c, 0x0f, 0xd2, 0x47, 0x56, 0xad, 0x6e, 0x3c, 0x0a, 0x9f, 0x89, 0x1d, 0xa8, 0x50, 0xcf, 0xb3, - 0x7c, 0x81, 0xfa, 0x82, 0xa2, 0x3e, 0xfb, 0xdb, 0xac, 0x4d, 0x58, 0x0a, 0x9f, 0x8b, 0x3d, 0x28, - 0x35, 0xce, 0x60, 0x96, 0xd1, 0xa2, 0xd0, 0x40, 0xd1, 0x80, 0xa1, 0x5d, 0xaf, 0x4e, 0x59, 0x3c, - 0x6a, 0x03, 0xb1, 0xf3, 0xae, 0x5b, 0xe6, 0xd4, 0x29, 0x07, 0xe1, 0x6b, 0x31, 0xac, 0x38, 0x29, - 0xc7, 0xda, 0x3e, 0x8b, 0x92, 0xbb, 0xcb, 0x4d, 0xba, 0x9f, 0x4c, 0x06, 0x57, 0x3f, 0x0f, 0x7b, - 0xa9, 0xa7, 0x6f, 0x23, 0x95, 0x8d, 0xcd, 0xa1, 0xf6, 0x91, 0xbb, 0x48, 0x1f, 0x58, 0x0a, 0xcf, - 0xc4, 0x43, 0x3f, 0x25, 0xea, 0x8f, 0xfb, 0xff, 0x9f, 0x3d, 0xe5, 0x67, 0xfa, 0x07, 0x0c, 0xdf, - 0x88, 0xfd, 0xaf, 0x0d, 0xd6, 0x8d, 0xa5, 0x2c, 0x5f, 0x67, 0x3c, 0x2d, 0x1a, 0x70, 0xf3, 0xe8, - 0x7e, 0xf3, 0xc7, 0x8e, 0x4c, 0xf7, 0x7c, 0xcb, 0x64, 0xfd, 0x96, 0x37, 0xf2, 0xfe, 0xaa, 0x8d, - 0x83, 0xeb, 0x36, 0x0e, 0x7e, 0xb5, 0x71, 0xf0, 0x6d, 0x13, 0xf7, 0xae, 0x37, 0x71, 0xef, 0xc7, - 0x26, 0xee, 0x7d, 0x96, 0xa6, 0x70, 0xf3, 0x26, 0x4f, 0x34, 0x5a, 0x79, 0x62, 0x16, 0x2a, 0x27, - 0x79, 0x62, 0x5e, 0xea, 0xb9, 0x2a, 0x4a, 0xb9, 0xfa, 0xf7, 0xa6, 0x6e, 0x5d, 0x01, 0xe5, 0x43, - 0x3e, 0xe8, 0xab, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x46, 0x09, 0x1c, 0x6e, 0x93, 0x02, 0x00, - 0x00, + // 416 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x6e, 0x13, 0x31, + 0x10, 0x86, 0xb3, 0x24, 0x0a, 0xc2, 0x69, 0x4b, 0xb5, 0xe2, 0xb0, 0xe9, 0x61, 0x13, 0x2a, 0x81, + 0x7a, 0x61, 0xdd, 0x16, 0x89, 0x07, 0x08, 0x42, 0x88, 0x0b, 0x2a, 0x1b, 0x89, 0x03, 0x17, 0xcb, + 0xeb, 0x0c, 0xce, 0xaa, 0xf1, 0xce, 0xb2, 0xf6, 0x46, 0x49, 0x9f, 0x82, 0x3b, 0x2f, 0xd4, 0x63, + 0x8f, 0x9c, 0x10, 0xda, 0xbc, 0x08, 0x62, 0x6c, 0xa8, 0x68, 0xb9, 0xd9, 0xdf, 0xff, 0xcf, 0xe8, + 0xf7, 0x6f, 0x96, 0x5e, 0x69, 0xc5, 0x17, 0xd2, 0x96, 0xba, 0x82, 0xc6, 0xf2, 0xf5, 0x19, 0xd7, + 0x50, 0x81, 0x2d, 0x6d, 0x56, 0x37, 0xe8, 0x30, 0x3e, 0xbc, 0xd2, 0x2a, 0xfb, 0xab, 0x67, 0xeb, + 0xb3, 0xa3, 0xb1, 0x42, 0x6b, 0xd0, 0x0a, 0xd2, 0xb9, 0xbf, 0x78, 0xf3, 0xd1, 0x13, 0x8d, 0x1a, + 0x3d, 0xff, 0x7d, 0x0a, 0x74, 0xac, 0x11, 0xf5, 0x0a, 0x38, 0xdd, 0x8a, 0xf6, 0x33, 0x97, 0xd5, + 0x36, 0x48, 0x93, 0xbb, 0x92, 0x2b, 0x0d, 0x58, 0x27, 0x4d, 0x1d, 0x0c, 0xd3, 0x7b, 0xf1, 0x6e, + 0xb3, 0x90, 0xe3, 0xf8, 0x5b, 0xc4, 0x86, 0x17, 0xb2, 0x91, 0xc6, 0xc6, 0xcf, 0xd9, 0x63, 0x87, + 0x97, 0x50, 0x59, 0x51, 0x43, 0x23, 0xd6, 0xe8, 0x20, 0x89, 0xa6, 0xd1, 0xc9, 0xa3, 0x7c, 0xdf, + 0xe3, 0x0b, 0x68, 0x3e, 0xa2, 0x83, 0x78, 0xc2, 0x46, 0x46, 0x6e, 0xc4, 0x97, 0x16, 0x9b, 0xd6, + 0xd8, 0xe4, 0xc1, 0x34, 0x3a, 0x19, 0xe4, 0xcc, 0xc8, 0xcd, 0x07, 0x4f, 0xe2, 0xa7, 0x6c, 0x0f, + 0x6a, 0x54, 0x4b, 0x51, 0xac, 0x50, 0x5d, 0xda, 0xa4, 0x4f, 0x8e, 0x11, 0xb1, 0x19, 0xa1, 0xf8, + 0x19, 0x3b, 0x80, 0x4a, 0xe1, 0x02, 0x16, 0xc2, 0xae, 0x4a, 0x05, 0x36, 0x19, 0x90, 0x69, 0x3f, + 0xd0, 0x39, 0xc1, 0xe3, 0x2e, 0x62, 0x7b, 0x6f, 0x7d, 0xa1, 0x73, 0x27, 0x1d, 0xc4, 0xaf, 0xd8, + 0xb0, 0xa6, 0xb4, 0x14, 0x6d, 0x74, 0x9e, 0x64, 0x77, 0x0b, 0xce, 0xfc, 0x6b, 0x66, 0x83, 0xeb, + 0x1f, 0x93, 0x5e, 0x1e, 0xdc, 0xb7, 0x91, 0xaa, 0xd6, 0x14, 0xd0, 0x84, 0xd0, 0x3e, 0xd2, 0x7b, + 0x42, 0xf1, 0x39, 0x7b, 0x18, 0xb6, 0x24, 0xfd, 0x69, 0xff, 0xff, 0xbb, 0xe7, 0x74, 0xcc, 0xff, + 0x18, 0xe3, 0xd7, 0xec, 0x30, 0xd4, 0x20, 0x8a, 0xad, 0xa0, 0x6d, 0xc9, 0x80, 0x86, 0xc7, 0xf7, + 0x87, 0x43, 0x3d, 0xf9, 0x41, 0x18, 0x99, 0x6d, 0xdf, 0x50, 0x23, 0xef, 0xae, 0xbb, 0x34, 0xba, + 0xe9, 0xd2, 0xe8, 0x67, 0x97, 0x46, 0x5f, 0x77, 0x69, 0xef, 0x66, 0x97, 0xf6, 0xbe, 0xef, 0xd2, + 0xde, 0x27, 0xae, 0x4b, 0xb7, 0x6c, 0x8b, 0x4c, 0xa1, 0xe1, 0xa7, 0x7a, 0x25, 0x0b, 0xcb, 0x4f, + 0xf5, 0x0b, 0xb5, 0x94, 0x65, 0xc5, 0x37, 0xff, 0xfe, 0xab, 0xdb, 0xd6, 0x60, 0x8b, 0x21, 0x7d, + 0xea, 0xcb, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x28, 0xe1, 0x73, 0x5d, 0x97, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -235,8 +234,8 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if m.MaxVotes != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.MaxVotes)) + if m.MaxQuorums != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.MaxQuorums)) i-- dAtA[i] = 0x10 } @@ -337,8 +336,8 @@ func (m *Params) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } - if m.MaxVotes != 0 { - n += 1 + sovGenesis(uint64(m.MaxVotes)) + if m.MaxQuorums != 0 { + n += 1 + sovGenesis(uint64(m.MaxQuorums)) } if m.EpochBlocks != 0 { n += 1 + sovGenesis(uint64(m.EpochBlocks)) @@ -444,9 +443,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxVotes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxQuorums", wireType) } - m.MaxVotes = 0 + m.MaxQuorums = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -456,7 +455,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxVotes |= uint64(b&0x7F) << shift + m.MaxQuorums |= uint64(b&0x7F) << shift if b < 0x80 { break } From a501d1dae154558cb05fb21638c776fa1dc7f16d Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Thu, 16 May 2024 23:46:12 +0800 Subject: [PATCH 09/26] fix: da signers begin block --- x/dasigners/v1/keeper/abci.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/dasigners/v1/keeper/abci.go b/x/dasigners/v1/keeper/abci.go index 121a4492..d80a80d6 100644 --- a/x/dasigners/v1/keeper/abci.go +++ b/x/dasigners/v1/keeper/abci.go @@ -73,7 +73,7 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { Quorums: make([]*types.Quorum, 0), } if len(ballots) >= int(params.EncodedSlices) { - for i := 0; i+int(params.EncodedSlices) < len(ballots); i += 1 { + for i := 0; i+int(params.EncodedSlices) <= len(ballots); i += int(params.EncodedSlices) { if int(params.MaxQuorums) < len(quorums.Quorums) { break } @@ -85,7 +85,7 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { } quorums.Quorums = append(quorums.Quorums, &quorum) } - if len(ballots)%int(params.EncodedSlices) != 0 && int(params.MaxQuorums) < len(quorums.Quorums) { + if len(ballots)%int(params.EncodedSlices) != 0 && int(params.MaxQuorums) > len(quorums.Quorums) { quorum := types.Quorum{ Signers: make([]string, 0), } From cb39713e5dba28a662b3a40ee66a339d601ee4ba Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Sat, 18 May 2024 23:01:28 +0800 Subject: [PATCH 10/26] feat: add get functions --- precompiles/dasigners/IDASigners.abi | 43 +++++++++++++++++++ precompiles/dasigners/contract.go | 64 +++++++++++++++++++++++++++- precompiles/dasigners/dasigners.go | 8 ++++ precompiles/dasigners/query.go | 30 +++++++++++++ 4 files changed, 144 insertions(+), 1 deletion(-) diff --git a/precompiles/dasigners/IDASigners.abi b/precompiles/dasigners/IDASigners.abi index 37631432..31e55dc4 100644 --- a/precompiles/dasigners/IDASigners.abi +++ b/precompiles/dasigners/IDASigners.abi @@ -220,6 +220,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "isSigner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -340,6 +359,30 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "registeredEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/precompiles/dasigners/contract.go b/precompiles/dasigners/contract.go index 566fefda..74116646 100644 --- a/precompiles/dasigners/contract.go +++ b/precompiles/dasigners/contract.go @@ -30,7 +30,7 @@ var ( // DASignersMetaData contains all meta data concerning the DASigners contract. var DASignersMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_quorumBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"}],\"name\":\"getQuorum\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_account\",\"type\":\"address[]\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"quorumCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_quorumBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"}],\"name\":\"getQuorum\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_account\",\"type\":\"address[]\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"isSigner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"quorumCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"registeredEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // DASignersABI is the input ABI used to generate the binding from. @@ -322,6 +322,37 @@ func (_DASigners *DASignersCallerSession) GetSigner(_account []common.Address) ( return _DASigners.Contract.GetSigner(&_DASigners.CallOpts, _account) } +// IsSigner is a free data retrieval call binding the contract method 0x7df73e27. +// +// Solidity: function isSigner(address _account) view returns(bool) +func (_DASigners *DASignersCaller) IsSigner(opts *bind.CallOpts, _account common.Address) (bool, error) { + var out []interface{} + err := _DASigners.contract.Call(opts, &out, "isSigner", _account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsSigner is a free data retrieval call binding the contract method 0x7df73e27. +// +// Solidity: function isSigner(address _account) view returns(bool) +func (_DASigners *DASignersSession) IsSigner(_account common.Address) (bool, error) { + return _DASigners.Contract.IsSigner(&_DASigners.CallOpts, _account) +} + +// IsSigner is a free data retrieval call binding the contract method 0x7df73e27. +// +// Solidity: function isSigner(address _account) view returns(bool) +func (_DASigners *DASignersCallerSession) IsSigner(_account common.Address) (bool, error) { + return _DASigners.Contract.IsSigner(&_DASigners.CallOpts, _account) +} + // QuorumCount is a free data retrieval call binding the contract method 0x5ecba503. // // Solidity: function quorumCount(uint256 _epoch) view returns(uint256) @@ -353,6 +384,37 @@ func (_DASigners *DASignersCallerSession) QuorumCount(_epoch *big.Int) (*big.Int return _DASigners.Contract.QuorumCount(&_DASigners.CallOpts, _epoch) } +// RegisteredEpoch is a free data retrieval call binding the contract method 0x6c9e560c. +// +// Solidity: function registeredEpoch(address _account, uint256 _epoch) view returns(bool) +func (_DASigners *DASignersCaller) RegisteredEpoch(opts *bind.CallOpts, _account common.Address, _epoch *big.Int) (bool, error) { + var out []interface{} + err := _DASigners.contract.Call(opts, &out, "registeredEpoch", _account, _epoch) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// RegisteredEpoch is a free data retrieval call binding the contract method 0x6c9e560c. +// +// Solidity: function registeredEpoch(address _account, uint256 _epoch) view returns(bool) +func (_DASigners *DASignersSession) RegisteredEpoch(_account common.Address, _epoch *big.Int) (bool, error) { + return _DASigners.Contract.RegisteredEpoch(&_DASigners.CallOpts, _account, _epoch) +} + +// RegisteredEpoch is a free data retrieval call binding the contract method 0x6c9e560c. +// +// Solidity: function registeredEpoch(address _account, uint256 _epoch) view returns(bool) +func (_DASigners *DASignersCallerSession) RegisteredEpoch(_account common.Address, _epoch *big.Int) (bool, error) { + return _DASigners.Contract.RegisteredEpoch(&_DASigners.CallOpts, _account, _epoch) +} + // RegisterNextEpoch is a paid mutator transaction binding the contract method 0x56a32372. // // Solidity: function registerNextEpoch((uint256,uint256) _signature) returns() diff --git a/precompiles/dasigners/dasigners.go b/precompiles/dasigners/dasigners.go index 5a23598e..6a553e5c 100644 --- a/precompiles/dasigners/dasigners.go +++ b/precompiles/dasigners/dasigners.go @@ -26,6 +26,8 @@ const ( DASignersFunctionUpdateSocket = "updateSocket" DASignersFunctionRegisterNextEpoch = "registerNextEpoch" DASignersFunctionGetAggPkG1 = "getAggPkG1" + DASignersFunctionIsSigner = "isSigner" + DASignersFunctionRegisteredEpoch = "registeredEpoch" ) var RequiredGasBasic = map[string]uint64{ @@ -37,6 +39,8 @@ var RequiredGasBasic = map[string]uint64{ DASignersFunctionUpdateSocket: 50000, DASignersFunctionRegisterNextEpoch: 100000, DASignersFunctionGetAggPkG1: 1000000, + DASignersFunctionIsSigner: 10000, + DASignersFunctionRegisteredEpoch: 10000, } var KVGasConfig storetypes.GasConfig = storetypes.GasConfig{ @@ -121,6 +125,10 @@ func (d *DASignersPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly b bz, err = d.GetQuorum(ctx, evm, method, args) case DASignersFunctionGetAggPkG1: bz, err = d.GetAggPkG1(ctx, evm, method, args) + case DASignersFunctionIsSigner: + bz, err = d.IsSigner(ctx, evm, method, args) + case DASignersFunctionRegisteredEpoch: + bz, err = d.RegisteredEpoch(ctx, evm, method, args) // txs case DASignersFunctionRegisterSigner: bz, err = d.RegisterSigner(ctx, evm, stateDB, method, args) diff --git a/precompiles/dasigners/query.go b/precompiles/dasigners/query.go index b50ec1a5..001af214 100644 --- a/precompiles/dasigners/query.go +++ b/precompiles/dasigners/query.go @@ -1,8 +1,10 @@ package dasigners import ( + "fmt" "math/big" + precopmiles_common "github.com/0glabs/0g-chain/precompiles/common" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" @@ -19,6 +21,9 @@ func (d *DASignersPrecompile) EpochNumber(ctx sdk.Context, _ *vm.EVM, method *ab func (d *DASignersPrecompile) QuorumCount(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { req, err := NewQueryQuorumCountRequest(args) + if err != nil { + return nil, err + } response, err := d.dasignersKeeper.QuorumCount(ctx, req) if err != nil { return nil, err @@ -42,6 +47,31 @@ func (d *DASignersPrecompile) GetSigner(ctx sdk.Context, _ *vm.EVM, method *abi. return method.Outputs.Pack(signers) } +func (d *DASignersPrecompile) IsSigner(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { + if len(args) != 1 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 1, len(args)) + } + account := ToLowerHexWithoutPrefix(args[0].(common.Address)) + _, found, err := d.dasignersKeeper.GetSigner(ctx, account) + if err != nil { + return nil, err + } + return method.Outputs.Pack(found) +} + +func (d *DASignersPrecompile) RegisteredEpoch(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { + if len(args) != 2 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 2, len(args)) + } + account := ToLowerHexWithoutPrefix(args[0].(common.Address)) + epoch := args[1].(*big.Int).Uint64() + _, found, err := d.dasignersKeeper.GetRegistration(ctx, epoch, account) + if err != nil { + return nil, err + } + return method.Outputs.Pack(found) +} + func (d *DASignersPrecompile) GetQuorum(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { req, err := NewQueryEpochQuorumRequest(args) if err != nil { From db3d8316efed74eb8fb93ef69074b56cc0e8c11a Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Tue, 21 May 2024 18:15:02 +0800 Subject: [PATCH 11/26] remove das module --- app/app.go | 11 - go.mod | 22 +- go.sum | 35 + helper/da/client/client.go | 61 -- helper/da/client/pool.go | 101 -- helper/da/go.mod | 26 - helper/da/go.sum | 60 -- helper/da/light/light.pb.go | 397 -------- helper/da/light/light_grpc.pb.go | 141 --- helper/da/main.go | 89 -- helper/da/proto/light.proto | 33 - helper/da/service/handler.go | 186 ---- helper/da/types/dasreq.go | 8 - helper/da/types/keys.go | 10 - helper/da/utils/sizedw8grp/sizedw8grp.go | 51 - proto/zgc/das/v1/genesis.proto | 37 - proto/zgc/das/v1/query.proto | 24 - proto/zgc/das/v1/tx.proto | 35 - proto/zgc/dasigners/v1/tx.proto | 1 - x/das/v1/client/cli/query.go | 57 -- x/das/v1/client/cli/tx.go | 103 -- x/das/v1/genesis.go | 39 - x/das/v1/keeper/grpc_query.go | 22 - x/das/v1/keeper/keeper.go | 198 ---- x/das/v1/keeper/msg_server.go | 49 - x/das/v1/module.go | 180 ---- x/das/v1/types/codec.go | 47 - x/das/v1/types/errors.go | 8 - x/das/v1/types/events.go | 11 - x/das/v1/types/genesis.go | 28 - x/das/v1/types/genesis.pb.go | 1191 ---------------------- x/das/v1/types/interfaces.go | 10 - x/das/v1/types/keys.go | 44 - x/das/v1/types/msg.go | 57 -- x/das/v1/types/query.pb.go | 511 ---------- x/das/v1/types/query.pb.gw.go | 153 --- x/das/v1/types/tx.pb.go | 1110 -------------------- x/dasigners/v1/client/cli/tx.go | 2 +- x/dasigners/v1/types/tx.pb.go | 46 +- 39 files changed, 73 insertions(+), 5121 deletions(-) delete mode 100644 helper/da/client/client.go delete mode 100644 helper/da/client/pool.go delete mode 100644 helper/da/go.mod delete mode 100644 helper/da/go.sum delete mode 100644 helper/da/light/light.pb.go delete mode 100644 helper/da/light/light_grpc.pb.go delete mode 100644 helper/da/main.go delete mode 100644 helper/da/proto/light.proto delete mode 100644 helper/da/service/handler.go delete mode 100644 helper/da/types/dasreq.go delete mode 100644 helper/da/types/keys.go delete mode 100644 helper/da/utils/sizedw8grp/sizedw8grp.go delete mode 100644 proto/zgc/das/v1/genesis.proto delete mode 100644 proto/zgc/das/v1/query.proto delete mode 100644 proto/zgc/das/v1/tx.proto delete mode 100644 x/das/v1/client/cli/query.go delete mode 100644 x/das/v1/client/cli/tx.go delete mode 100644 x/das/v1/genesis.go delete mode 100644 x/das/v1/keeper/grpc_query.go delete mode 100644 x/das/v1/keeper/keeper.go delete mode 100644 x/das/v1/keeper/msg_server.go delete mode 100644 x/das/v1/module.go delete mode 100644 x/das/v1/types/codec.go delete mode 100644 x/das/v1/types/errors.go delete mode 100644 x/das/v1/types/events.go delete mode 100644 x/das/v1/types/genesis.go delete mode 100644 x/das/v1/types/genesis.pb.go delete mode 100644 x/das/v1/types/interfaces.go delete mode 100644 x/das/v1/types/keys.go delete mode 100644 x/das/v1/types/msg.go delete mode 100644 x/das/v1/types/query.pb.go delete mode 100644 x/das/v1/types/query.pb.gw.go delete mode 100644 x/das/v1/types/tx.pb.go diff --git a/app/app.go b/app/app.go index 07f25f59..15db0741 100644 --- a/app/app.go +++ b/app/app.go @@ -109,9 +109,6 @@ import ( council "github.com/0glabs/0g-chain/x/council/v1" councilkeeper "github.com/0glabs/0g-chain/x/council/v1/keeper" counciltypes "github.com/0glabs/0g-chain/x/council/v1/types" - das "github.com/0glabs/0g-chain/x/das/v1" - daskeeper "github.com/0glabs/0g-chain/x/das/v1/keeper" - dastypes "github.com/0glabs/0g-chain/x/das/v1/types" dasigners "github.com/0glabs/0g-chain/x/dasigners/v1" dasignerskeeper "github.com/0glabs/0g-chain/x/dasigners/v1/keeper" dasignerstypes "github.com/0glabs/0g-chain/x/dasigners/v1/types" @@ -169,7 +166,6 @@ var ( evmutil.AppModuleBasic{}, mint.AppModuleBasic{}, council.AppModuleBasic{}, - das.AppModuleBasic{}, dasigners.AppModuleBasic{}, ) @@ -248,7 +244,6 @@ type App struct { evidenceKeeper evidencekeeper.Keeper transferKeeper ibctransferkeeper.Keeper CouncilKeeper councilkeeper.Keeper - DasKeeper daskeeper.Keeper issuanceKeeper issuancekeeper.Keeper bep3Keeper bep3keeper.Keeper pricefeedKeeper pricefeedkeeper.Keeper @@ -303,7 +298,6 @@ func NewApp( committeetypes.StoreKey, evmutiltypes.StoreKey, minttypes.StoreKey, counciltypes.StoreKey, - dastypes.StoreKey, dasignerstypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) @@ -576,7 +570,6 @@ func NewApp( app.CouncilKeeper = councilkeeper.NewKeeper( keys[counciltypes.StoreKey], appCodec, app.stakingKeeper, ) - app.DasKeeper = daskeeper.NewKeeper(keys[dastypes.StoreKey], appCodec, app.stakingKeeper) // create the module manager (Note: Any module instantiated in the module manager that is later modified // must be passed by reference here.) @@ -608,7 +601,6 @@ func NewApp( // nil InflationCalculationFn, use SDK's default inflation function mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper, nil), council.NewAppModule(app.CouncilKeeper, app.stakingKeeper), - das.NewAppModule(app.DasKeeper), dasigners.NewAppModule(app.dasignersKeeper, app.stakingKeeper), ) @@ -653,7 +645,6 @@ func NewApp( evmutiltypes.ModuleName, counciltypes.ModuleName, - dastypes.ModuleName, dasignerstypes.ModuleName, ) @@ -687,7 +678,6 @@ func NewApp( evmutiltypes.ModuleName, minttypes.ModuleName, counciltypes.ModuleName, - dastypes.ModuleName, dasignerstypes.ModuleName, ) @@ -720,7 +710,6 @@ func NewApp( upgradetypes.ModuleName, validatorvestingtypes.ModuleName, counciltypes.ModuleName, - dastypes.ModuleName, dasignerstypes.ModuleName, ) diff --git a/go.mod b/go.mod index 3d53e2d5..338ababd 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/subosito/gotenv v1.4.2 github.com/tendermint/tendermint v0.34.27 github.com/tendermint/tm-db v0.6.7 - golang.org/x/crypto v0.14.0 + golang.org/x/crypto v0.23.0 google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 @@ -50,6 +50,7 @@ require ( github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect github.com/allegro/bigcache v1.2.1 // indirect + github.com/andybalholm/brotli v1.1.0 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go v1.44.122 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -83,10 +84,12 @@ require ( github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect + github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 // indirect github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect @@ -133,13 +136,14 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.15.15 // indirect + github.com/klauspost/compress v1.17.8 // indirect + github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect @@ -160,12 +164,14 @@ require ( github.com/prometheus/procfs v0.9.0 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rakyll/statik v0.1.7 // indirect + github.com/raviqqe/liche v0.0.0-20200229003944-f57a5d1c5be4 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.29.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spf13/afero v1.9.3 // indirect @@ -180,17 +186,19 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/ulikunitz/xz v0.5.10 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasthttp v1.53.0 // indirect github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.2 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/term v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.128.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index bbbbb97a..2043ba8f 100644 --- a/go.sum +++ b/go.sum @@ -246,6 +246,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -444,6 +446,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= @@ -473,6 +477,8 @@ github.com/evmos/go-ethereum v1.10.26-evmos-rc2 h1:tYghk1ZZ8X4/OQ4YI9hvtm8aSN8OS github.com/evmos/go-ethereum v1.10.26-evmos-rc2/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= @@ -825,13 +831,19 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.10.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -876,6 +888,7 @@ github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GW github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -891,6 +904,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1054,6 +1069,8 @@ github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= +github.com/raviqqe/liche v0.0.0-20200229003944-f57a5d1c5be4 h1:/24Dsgxxv7UMTvubnE6eJmyHRcTSum60viriQokArAQ= +github.com/raviqqe/liche v0.0.0-20200229003944-f57a5d1c5be4/go.mod h1:MPBuzBAJcp9B/3xrqfgR+ieBgpMzDqTeieaRP3ESJhk= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -1193,9 +1210,14 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.9.1-0.20200228200348-695f713fcf59/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasthttp v1.53.0 h1:lW/+SUkOxCx2vlIu0iaImv4JLrVRnbbkpCoaawvA4zc= +github.com/valyala/fasthttp v1.53.0/go.mod h1:6dt4/8olwq9QARP/TDuPmWyWcl4byhpvTJ4AAtcz+QM= 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/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= @@ -1268,6 +1290,8 @@ golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1336,6 +1360,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/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-20190930134127-c5a3c61f89f3/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-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1383,6 +1409,8 @@ golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1530,14 +1558,19 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 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/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1551,6 +1584,8 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 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/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/helper/da/client/client.go b/helper/da/client/client.go deleted file mode 100644 index 0d760d6b..00000000 --- a/helper/da/client/client.go +++ /dev/null @@ -1,61 +0,0 @@ -package client - -import ( - "context" - "time" - - "github.com/0glabs/0g-chain/helper/da/light" - - "github.com/pkg/errors" -) - -type DaLightRpcClient interface { - Sample(ctx context.Context, streamId, headerHash []byte, blobIdx, times uint32) (bool, error) - Destroy() - GetInstanceCount() int -} - -type daLightClient struct { - maxInstance int - pool ConnectionPool -} - -func NewDaLightClient(address string, instanceLimit int) DaLightRpcClient { - return &daLightClient{ - maxInstance: instanceLimit, - pool: NewConnectionPool(address, instanceLimit, 10*time.Minute), - } -} - -func (c *daLightClient) Sample(ctx context.Context, streamId, headerHash []byte, blobIdx, times uint32) (bool, error) { - connection, err := c.pool.GetConnection() - if err != nil { - return false, errors.Wrap(err, "failed to connect to da light server") - } - defer c.pool.ReleaseConnection(connection) - - req := &light.SampleRequest{ - StreamId: streamId, - BatchHeaderHash: headerHash, - BlobIndex: blobIdx, - Times: times, - } - client := light.NewLightClient(connection) - reply, err := client.Sample(ctx, req) - if err != nil { - return false, errors.Wrap(err, "failed to sample from da light server") - } - - return reply.Success, nil -} - -func (c *daLightClient) Destroy() { - if c.pool != nil { - c.pool.Close() - c.pool = nil - } -} - -func (c *daLightClient) GetInstanceCount() int { - return c.maxInstance -} diff --git a/helper/da/client/pool.go b/helper/da/client/pool.go deleted file mode 100644 index 887704a0..00000000 --- a/helper/da/client/pool.go +++ /dev/null @@ -1,101 +0,0 @@ -package client - -import ( - "errors" - "sync" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/backoff" - "google.golang.org/grpc/credentials/insecure" -) - -type ConnectionPool interface { - GetConnection() (*grpc.ClientConn, error) - ReleaseConnection(*grpc.ClientConn) - Close() -} - -type connectionPoolImpl struct { - address string - maxSize int - timeout time.Duration - param grpc.ConnectParams - - mu sync.Mutex - pool []*grpc.ClientConn -} - -func NewConnectionPool(address string, maxSize int, timeout time.Duration) ConnectionPool { - return &connectionPoolImpl{ - address: address, - maxSize: maxSize, - timeout: timeout, - param: grpc.ConnectParams{ - Backoff: backoff.Config{ - BaseDelay: 1.0 * time.Second, - Multiplier: 1.5, - Jitter: 0.2, - MaxDelay: 30 * time.Second, - }, - MinConnectTimeout: 30 * time.Second, - }, - pool: make([]*grpc.ClientConn, 0, maxSize), - } -} - -func (p *connectionPoolImpl) GetConnection() (*grpc.ClientConn, error) { - p.mu.Lock() - defer p.mu.Unlock() - - if p.pool == nil { - return nil, errors.New("connection pool is closed") - } - - // Check if there's any available connection in the pool - if len(p.pool) > 0 { - conn := p.pool[0] - p.pool = p.pool[1:] - return conn, nil - } - - // If the pool is empty, create a new connection - conn, err := grpc.Dial(p.address, grpc.WithBlock(), - grpc.WithConnectParams(p.param), - grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - return nil, err - } - return conn, nil -} - -func (p *connectionPoolImpl) ReleaseConnection(conn *grpc.ClientConn) { - p.mu.Lock() - defer p.mu.Unlock() - - if p.pool != nil { - // If the pool is full, close the connection - if len(p.pool) >= p.maxSize { - conn.Close() - return - } - - // Add the connection back to the pool - p.pool = append(p.pool, conn) - } else { - conn.Close() - } -} - -func (p *connectionPoolImpl) Close() { - p.mu.Lock() - defer p.mu.Unlock() - - if p.pool != nil { - for _, conn := range p.pool { - conn.Close() - } - - p.pool = nil - } -} diff --git a/helper/da/go.mod b/helper/da/go.mod deleted file mode 100644 index c42d6564..00000000 --- a/helper/da/go.mod +++ /dev/null @@ -1,26 +0,0 @@ -module github.com/0glabs/0g-chain/helper/da - -go 1.20 - -require ( - github.com/json-iterator/go v1.1.12 - github.com/lesismal/nbio v1.5.4 - github.com/pkg/errors v0.9.1 - github.com/rs/zerolog v1.32.0 - google.golang.org/grpc v1.63.2 - google.golang.org/protobuf v1.33.0 -) - -require ( - github.com/lesismal/llib v1.1.13 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/stretchr/testify v1.8.4 // indirect - golang.org/x/crypto v0.19.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect -) diff --git a/helper/da/go.sum b/helper/da/go.sum deleted file mode 100644 index cc3cf3ca..00000000 --- a/helper/da/go.sum +++ /dev/null @@ -1,60 +0,0 @@ -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -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= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/lesismal/llib v1.1.13 h1:+w1+t0PykXpj2dXQck0+p6vdC9/mnbEXHgUy/HXDGfE= -github.com/lesismal/llib v1.1.13/go.mod h1:70tFXXe7P1FZ02AU9l8LgSOK7d7sRrpnkUr3rd3gKSg= -github.com/lesismal/nbio v1.5.4 h1:fZ6FOVZOBm7nFuudYsq+WyHJuM2UNuPdlvF/1LVa6lo= -github.com/lesismal/nbio v1.5.4/go.mod h1:mvfYBAA1jmrafXf2XvkM28jWkMTfA5jGks+HKDBMmOc= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -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/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= -github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/crypto v0.0.0-20210513122933-cd7d49e622d5/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/helper/da/light/light.pb.go b/helper/da/light/light.pb.go deleted file mode 100644 index 60c987f2..00000000 --- a/helper/da/light/light.pb.go +++ /dev/null @@ -1,397 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v4.25.3 -// source: light/light.proto - -package light - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// SampleRequest contains the blob to sample (by batch and blob index) and required sample times -type SampleRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - StreamId []byte `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` - BatchHeaderHash []byte `protobuf:"bytes,2,opt,name=batch_header_hash,json=batchHeaderHash,proto3" json:"batch_header_hash,omitempty"` - BlobIndex uint32 `protobuf:"varint,3,opt,name=blob_index,json=blobIndex,proto3" json:"blob_index,omitempty"` - Times uint32 `protobuf:"varint,4,opt,name=times,proto3" json:"times,omitempty"` -} - -func (x *SampleRequest) Reset() { - *x = SampleRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_light_light_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SampleRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SampleRequest) ProtoMessage() {} - -func (x *SampleRequest) ProtoReflect() protoreflect.Message { - mi := &file_light_light_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SampleRequest.ProtoReflect.Descriptor instead. -func (*SampleRequest) Descriptor() ([]byte, []int) { - return file_light_light_proto_rawDescGZIP(), []int{0} -} - -func (x *SampleRequest) GetStreamId() []byte { - if x != nil { - return x.StreamId - } - return nil -} - -func (x *SampleRequest) GetBatchHeaderHash() []byte { - if x != nil { - return x.BatchHeaderHash - } - return nil -} - -func (x *SampleRequest) GetBlobIndex() uint32 { - if x != nil { - return x.BlobIndex - } - return 0 -} - -func (x *SampleRequest) GetTimes() uint32 { - if x != nil { - return x.Times - } - return 0 -} - -// SampleReply contains the sample result -type SampleReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` -} - -func (x *SampleReply) Reset() { - *x = SampleReply{} - if protoimpl.UnsafeEnabled { - mi := &file_light_light_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SampleReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SampleReply) ProtoMessage() {} - -func (x *SampleReply) ProtoReflect() protoreflect.Message { - mi := &file_light_light_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SampleReply.ProtoReflect.Descriptor instead. -func (*SampleReply) Descriptor() ([]byte, []int) { - return file_light_light_proto_rawDescGZIP(), []int{1} -} - -func (x *SampleReply) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -type RetrieveRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - BatchHeaderHash []byte `protobuf:"bytes,1,opt,name=batch_header_hash,json=batchHeaderHash,proto3" json:"batch_header_hash,omitempty"` - BlobIndex uint32 `protobuf:"varint,2,opt,name=blob_index,json=blobIndex,proto3" json:"blob_index,omitempty"` -} - -func (x *RetrieveRequest) Reset() { - *x = RetrieveRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_light_light_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetrieveRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetrieveRequest) ProtoMessage() {} - -func (x *RetrieveRequest) ProtoReflect() protoreflect.Message { - mi := &file_light_light_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetrieveRequest.ProtoReflect.Descriptor instead. -func (*RetrieveRequest) Descriptor() ([]byte, []int) { - return file_light_light_proto_rawDescGZIP(), []int{2} -} - -func (x *RetrieveRequest) GetBatchHeaderHash() []byte { - if x != nil { - return x.BatchHeaderHash - } - return nil -} - -func (x *RetrieveRequest) GetBlobIndex() uint32 { - if x != nil { - return x.BlobIndex - } - return 0 -} - -type RetrieveReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status bool `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *RetrieveReply) Reset() { - *x = RetrieveReply{} - if protoimpl.UnsafeEnabled { - mi := &file_light_light_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetrieveReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetrieveReply) ProtoMessage() {} - -func (x *RetrieveReply) ProtoReflect() protoreflect.Message { - mi := &file_light_light_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetrieveReply.ProtoReflect.Descriptor instead. -func (*RetrieveReply) Descriptor() ([]byte, []int) { - return file_light_light_proto_rawDescGZIP(), []int{3} -} - -func (x *RetrieveReply) GetStatus() bool { - if x != nil { - return x.Status - } - return false -} - -func (x *RetrieveReply) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -var File_light_light_proto protoreflect.FileDescriptor - -var file_light_light_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x22, 0x8d, 0x01, 0x0a, 0x0d, 0x53, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x08, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x62, 0x61, 0x74, - 0x63, 0x68, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x62, 0x5f, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x62, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x22, 0x27, 0x0a, 0x0b, 0x53, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x22, 0x5c, 0x0a, 0x0f, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x61, - 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x62, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x62, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x22, 0x3b, 0x0a, 0x0d, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0x79, - 0x0a, 0x05, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x12, 0x34, 0x0a, 0x06, 0x53, 0x61, 0x6d, 0x70, 0x6c, - 0x65, 0x12, 0x14, 0x2e, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2e, - 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, - 0x08, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x12, 0x16, 0x2e, 0x6c, 0x69, 0x67, 0x68, - 0x74, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, - 0x76, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x30, 0x5a, 0x2e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x30, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x30, - 0x67, 0x2d, 0x64, 0x61, 0x74, 0x61, 0x2d, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x2f, 0x72, 0x75, 0x6e, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_light_light_proto_rawDescOnce sync.Once - file_light_light_proto_rawDescData = file_light_light_proto_rawDesc -) - -func file_light_light_proto_rawDescGZIP() []byte { - file_light_light_proto_rawDescOnce.Do(func() { - file_light_light_proto_rawDescData = protoimpl.X.CompressGZIP(file_light_light_proto_rawDescData) - }) - return file_light_light_proto_rawDescData -} - -var file_light_light_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_light_light_proto_goTypes = []interface{}{ - (*SampleRequest)(nil), // 0: light.SampleRequest - (*SampleReply)(nil), // 1: light.SampleReply - (*RetrieveRequest)(nil), // 2: light.RetrieveRequest - (*RetrieveReply)(nil), // 3: light.RetrieveReply -} -var file_light_light_proto_depIdxs = []int32{ - 0, // 0: light.Light.Sample:input_type -> light.SampleRequest - 2, // 1: light.Light.Retrieve:input_type -> light.RetrieveRequest - 1, // 2: light.Light.Sample:output_type -> light.SampleReply - 3, // 3: light.Light.Retrieve:output_type -> light.RetrieveReply - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_light_light_proto_init() } -func file_light_light_proto_init() { - if File_light_light_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_light_light_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SampleRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_light_light_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SampleReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_light_light_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetrieveRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_light_light_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetrieveReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_light_light_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_light_light_proto_goTypes, - DependencyIndexes: file_light_light_proto_depIdxs, - MessageInfos: file_light_light_proto_msgTypes, - }.Build() - File_light_light_proto = out.File - file_light_light_proto_rawDesc = nil - file_light_light_proto_goTypes = nil - file_light_light_proto_depIdxs = nil -} diff --git a/helper/da/light/light_grpc.pb.go b/helper/da/light/light_grpc.pb.go deleted file mode 100644 index 0586c987..00000000 --- a/helper/da/light/light_grpc.pb.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v4.25.3 -// source: light/light.proto - -package light - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// LightClient is the client API for Light service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type LightClient interface { - Sample(ctx context.Context, in *SampleRequest, opts ...grpc.CallOption) (*SampleReply, error) - Retrieve(ctx context.Context, in *RetrieveRequest, opts ...grpc.CallOption) (*RetrieveReply, error) -} - -type lightClient struct { - cc grpc.ClientConnInterface -} - -func NewLightClient(cc grpc.ClientConnInterface) LightClient { - return &lightClient{cc} -} - -func (c *lightClient) Sample(ctx context.Context, in *SampleRequest, opts ...grpc.CallOption) (*SampleReply, error) { - out := new(SampleReply) - err := c.cc.Invoke(ctx, "/light.Light/Sample", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *lightClient) Retrieve(ctx context.Context, in *RetrieveRequest, opts ...grpc.CallOption) (*RetrieveReply, error) { - out := new(RetrieveReply) - err := c.cc.Invoke(ctx, "/light.Light/Retrieve", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// LightServer is the server API for Light service. -// All implementations must embed UnimplementedLightServer -// for forward compatibility -type LightServer interface { - Sample(context.Context, *SampleRequest) (*SampleReply, error) - Retrieve(context.Context, *RetrieveRequest) (*RetrieveReply, error) - mustEmbedUnimplementedLightServer() -} - -// UnimplementedLightServer must be embedded to have forward compatible implementations. -type UnimplementedLightServer struct { -} - -func (UnimplementedLightServer) Sample(context.Context, *SampleRequest) (*SampleReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Sample not implemented") -} -func (UnimplementedLightServer) Retrieve(context.Context, *RetrieveRequest) (*RetrieveReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Retrieve not implemented") -} -func (UnimplementedLightServer) mustEmbedUnimplementedLightServer() {} - -// UnsafeLightServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to LightServer will -// result in compilation errors. -type UnsafeLightServer interface { - mustEmbedUnimplementedLightServer() -} - -func RegisterLightServer(s grpc.ServiceRegistrar, srv LightServer) { - s.RegisterService(&Light_ServiceDesc, srv) -} - -func _Light_Sample_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SampleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LightServer).Sample(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/light.Light/Sample", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LightServer).Sample(ctx, req.(*SampleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Light_Retrieve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RetrieveRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LightServer).Retrieve(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/light.Light/Retrieve", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LightServer).Retrieve(ctx, req.(*RetrieveRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Light_ServiceDesc is the grpc.ServiceDesc for Light service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Light_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "light.Light", - HandlerType: (*LightServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Sample", - Handler: _Light_Sample_Handler, - }, - { - MethodName: "Retrieve", - Handler: _Light_Retrieve_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "light/light.proto", -} diff --git a/helper/da/main.go b/helper/da/main.go deleted file mode 100644 index 247f4e16..00000000 --- a/helper/da/main.go +++ /dev/null @@ -1,89 +0,0 @@ -package main - -import ( - "context" - "flag" - "fmt" - "io" - "log" - "net/url" - "os" - "os/signal" - "time" - - "github.com/0glabs/0g-chain/helper/da/service" - "github.com/0glabs/0g-chain/helper/da/types" - - "github.com/lesismal/nbio/nbhttp" - "github.com/lesismal/nbio/nbhttp/websocket" -) - -const ( - subscribeMsg = "{\"jsonrpc\":\"2.0\",\"method\":\"subscribe\",\"id\":1,\"params\":{\"query\":\"tm.event='Tx'\"}}" -) - -var ( - rpcAddress = flag.String("rpc-address", "34.214.2.28:32001", "address of da-light rpc server") - wsAddress = flag.String("ws-address", "127.0.0.1:26657", "address of emvos ws server") - relativePath = flag.String("relative-path", "", "relative path of evmosd") - account = flag.String("account", "", "account to run evmosd cli") - keyring = flag.String("keyring", "", "keyring to run evmosd cli") - homePath = flag.String("home", "", "home path of evmosd node") -) - -func newUpgrader() *websocket.Upgrader { - u := websocket.NewUpgrader() - u.OnMessage(func(c *websocket.Conn, messageType websocket.MessageType, data []byte) { - log.Println("onEcho:", string(data)) - ctx := context.WithValue(context.Background(), types.DA_RPC_ADDRESS, *rpcAddress) - ctx = context.WithValue(ctx, types.NODE_CLI_RELATIVE_PATH, *relativePath) - ctx = context.WithValue(ctx, types.NODE_CLI_EXEC_ACCOUNT, *account) - ctx = context.WithValue(ctx, types.NODE_CLI_EXEC_KEYRING, *keyring) - ctx = context.WithValue(ctx, types.NODE_HOME_PATH, *homePath) - go func() { service.OnMessage(ctx, c, messageType, data) }() - }) - - u.OnClose(func(c *websocket.Conn, err error) { - fmt.Println("OnClose:", c.RemoteAddr().String(), err) - service.OnClose() - }) - - return u -} - -func main() { - flag.Parse() - engine := nbhttp.NewEngine(nbhttp.Config{}) - err := engine.Start() - if err != nil { - fmt.Printf("nbio.Start failed: %v\n", err) - return - } - - go func() { - u := url.URL{Scheme: "ws", Host: *wsAddress, Path: "/websocket"} - dialer := &websocket.Dialer{ - Engine: engine, - Upgrader: newUpgrader(), - DialTimeout: time.Second * 3, - } - c, res, err := dialer.Dial(u.String(), nil) - if err != nil { - if res != nil && res.Body != nil { - bReason, _ := io.ReadAll(res.Body) - fmt.Printf("dial failed: %v, reason: %v\n", err, string(bReason)) - } else { - fmt.Printf("dial failed: %v\n", err) - } - return - } - c.WriteMessage(websocket.TextMessage, []byte(subscribeMsg)) - }() - - interrupt := make(chan os.Signal, 1) - signal.Notify(interrupt, os.Interrupt) - <-interrupt - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - engine.Shutdown(ctx) -} diff --git a/helper/da/proto/light.proto b/helper/da/proto/light.proto deleted file mode 100644 index f816b54f..00000000 --- a/helper/da/proto/light.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; - -package light; - -option go_package = "proto/light"; - -service Light { - rpc Sample(SampleRequest) returns (SampleReply) {} - rpc Retrieve(RetrieveRequest) returns (RetrieveReply) {} -} - -// SampleRequest contains the blob to sample (by batch and blob index) and required sample times -message SampleRequest { - bytes stream_id = 1; - bytes batch_header_hash = 2; - uint32 blob_index = 3; - uint32 times = 4; -} - -// SampleReply contains the sample result -message SampleReply { - bool success = 1; -} - -message RetrieveRequest { - bytes batch_header_hash = 1; - uint32 blob_index = 2; -} - -message RetrieveReply { - bool status = 1; - bytes data = 2; -} \ No newline at end of file diff --git a/helper/da/service/handler.go b/helper/da/service/handler.go deleted file mode 100644 index 5a379bc8..00000000 --- a/helper/da/service/handler.go +++ /dev/null @@ -1,186 +0,0 @@ -package service - -import ( - "context" - "encoding/hex" - "os" - "os/exec" - "strconv" - "strings" - - "github.com/0glabs/0g-chain/helper/da/client" - "github.com/0glabs/0g-chain/helper/da/types" - "github.com/0glabs/0g-chain/helper/da/utils/sizedw8grp" - - jsoniter "github.com/json-iterator/go" - "github.com/lesismal/nbio/nbhttp/websocket" - "github.com/pkg/errors" - "github.com/rs/zerolog/log" -) - -const ( - defaultClientInstance = 10 -) - -var rpcClient client.DaLightRpcClient - -func OnMessage(ctx context.Context, c *websocket.Conn, messageType websocket.MessageType, data []byte) { - if messageType == websocket.TextMessage { - rawMsg := unwrapJsonRpc(data) - if verifyQuery(rawMsg) { - eventStr := jsoniter.Get(rawMsg, "events").ToString() - events := map[string][]string{} - if err := jsoniter.UnmarshalFromString(eventStr, &events); err == nil { - dasRequestMap := make(map[string]string, 4) - for key, val := range events { - if strings.HasPrefix(key, "das_request.") { - dasRequestMap[strings.ReplaceAll(key, "das_request.", "")] = val[0] - } - } - if len(dasRequestMap) == 4 { - rid, _ := strconv.ParseUint(dasRequestMap["request_id"], 10, 64) - numBlobs, _ := strconv.ParseUint(dasRequestMap["num_blobs"], 10, 64) - req := types.DASRequest{ - RequestId: rid, - StreamId: dasRequestMap["stream_id"], - BatchHeaderHash: dasRequestMap["batch_header_hash"], - NumBlobs: numBlobs, - } - err := handleDasRequest(ctx, req) - - if err != nil { - log.Err(err).Msgf("failed to handle das request: %v, %v", req, err) - } else { - log.Info().Msgf("successfully handled das request: %v", req) - } - } - } - } - } else { - // TODO: handle other message - } -} - -func OnClose() { - if rpcClient != nil { - rpcClient.Destroy() - rpcClient = nil - } -} - -func unwrapJsonRpc(data []byte) []byte { - result := jsoniter.Get(data, "result") - if 0 < len(result.Keys()) { - return []byte(result.ToString()) - } - return []byte{} -} - -func verifyQuery(data []byte) bool { - if len(data) > 0 { - return jsoniter.Get(data, "query").ToString() == "tm.event='Tx'" - } - return false -} - -func min(a, b int) int { - if a < b { - return a - } - return b -} - -func handleDasRequest(ctx context.Context, request types.DASRequest) error { - if rpcClient == nil { - addrVal := ctx.Value(types.DA_RPC_ADDRESS) - if addrVal == nil { - return errors.New("da light service address not found in context") - } - - limit := ctx.Value(types.INSTANCE_LIMIT) - if limit == nil { - limit = defaultClientInstance - } - - rpcClient = client.NewDaLightClient(addrVal.(string), limit.(int)) - } - - streamID, err := hex.DecodeString(request.StreamId) - if err != nil { - return err - } - - batchHeaderHash, err := hex.DecodeString(request.BatchHeaderHash) - if err != nil { - return err - } - - result := make(chan bool, request.NumBlobs) - taskCnt := min(rpcClient.GetInstanceCount(), int(request.NumBlobs)) - wg := sizedw8grp.New(taskCnt) - - for i := uint64(0); i < request.NumBlobs; i++ { - wg.Add() - go func(idx uint64) { - defer wg.Done() - ret, err := rpcClient.Sample(ctx, streamID, batchHeaderHash, uint32(idx), 1) - if err != nil { - log.Err(err).Msgf("failed to sample data availability with blob index %d", idx) - result <- false - } else { - log.Info().Msgf("sample result for blob index %d: %v", idx, ret) - result <- ret - } - }(i) - } - wg.Wait() - close(result) - - finalResult := true - for val := range result { - if !val { - finalResult = false - break - } - } - - return runEvmosdCliReportDasResult(ctx, request.RequestId, finalResult) -} - -func runEvmosdCliReportDasResult(ctx context.Context, requestId uint64, result bool) error { - relativePath := ctx.Value(types.NODE_CLI_RELATIVE_PATH) - if relativePath == nil { - return errors.New("relativePath not found in context") - } - - account := ctx.Value(types.NODE_CLI_EXEC_ACCOUNT) - if account == nil { - return errors.New("account not found in context") - } - - args := []string{ - "tx", - "das", - "report-das-result", - strconv.FormatUint(requestId, 10), - strconv.FormatBool(result), - "--from", account.(string), - "--gas-prices", "7678500neuron", // TODO: use args to set gas prices - } - - homePath := ctx.Value(types.NODE_HOME_PATH) - if len(homePath.(string)) > 0 { - args = append(args, "--home", homePath.(string)) - } - - keyring := ctx.Value(types.NODE_CLI_EXEC_KEYRING) - if len(keyring.(string)) > 0 { - args = append(args, "--keyring-backend", keyring.(string)) - } - - cmdStr := relativePath.(string) + "0gchaind" - cmd := exec.Command(cmdStr, append(args, "-y")...) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - return cmd.Run() -} diff --git a/helper/da/types/dasreq.go b/helper/da/types/dasreq.go deleted file mode 100644 index 1c3b92e3..00000000 --- a/helper/da/types/dasreq.go +++ /dev/null @@ -1,8 +0,0 @@ -package types - -type DASRequest struct { - RequestId uint64 `json:"request_id"` - StreamId string `json:"stream_id"` - BatchHeaderHash string `json:"batch_header_hash"` - NumBlobs uint64 `json:"num_blobs"` -} diff --git a/helper/da/types/keys.go b/helper/da/types/keys.go deleted file mode 100644 index e824f793..00000000 --- a/helper/da/types/keys.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -const ( - DA_RPC_ADDRESS = "rpc_address" - INSTANCE_LIMIT = "instance_limit" - NODE_CLI_RELATIVE_PATH = "relative_path" - NODE_CLI_EXEC_ACCOUNT = "node_exec_account" - NODE_CLI_EXEC_KEYRING = "node_exec_keyring" - NODE_HOME_PATH = "home_path" -) diff --git a/helper/da/utils/sizedw8grp/sizedw8grp.go b/helper/da/utils/sizedw8grp/sizedw8grp.go deleted file mode 100644 index ac7348e6..00000000 --- a/helper/da/utils/sizedw8grp/sizedw8grp.go +++ /dev/null @@ -1,51 +0,0 @@ -package sizedw8grp - -import ( - "context" - "math" - "sync" -) - -type SizedWaitGroup struct { - Size int - - current chan struct{} - wg sync.WaitGroup -} - -func New(limit int) SizedWaitGroup { - size := math.MaxInt32 - if limit > 0 { - size = limit - } - return SizedWaitGroup{ - Size: size, - - current: make(chan struct{}, size), - wg: sync.WaitGroup{}, - } -} - -func (s *SizedWaitGroup) Add() { - _ = s.AddWithContext(context.Background()) -} - -func (s *SizedWaitGroup) AddWithContext(ctx context.Context) error { - select { - case <-ctx.Done(): - return ctx.Err() - case s.current <- struct{}{}: - break - } - s.wg.Add(1) - return nil -} - -func (s *SizedWaitGroup) Done() { - <-s.current - s.wg.Done() -} - -func (s *SizedWaitGroup) Wait() { - s.wg.Wait() -} diff --git a/proto/zgc/das/v1/genesis.proto b/proto/zgc/das/v1/genesis.proto deleted file mode 100644 index 9aae1faa..00000000 --- a/proto/zgc/das/v1/genesis.proto +++ /dev/null @@ -1,37 +0,0 @@ -syntax = "proto3"; -package zgc.das.v1; - -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/0glabs/0g-chain/x/das/v1/types"; - -message Params {} - -// GenesisState defines the das module's genesis state. -message GenesisState { - option (gogoproto.goproto_getters) = false; - - Params params = 1 [(gogoproto.nullable) = false]; - uint64 next_request_id = 2 [(gogoproto.customname) = "NextRequestID"]; - repeated DASRequest requests = 3 [(gogoproto.nullable) = false]; - repeated DASResponse responses = 4 [(gogoproto.nullable) = false]; -} - -message DASRequest { - uint64 id = 1 [(gogoproto.customname) = "ID"]; - bytes stream_id = 2 [(gogoproto.customname) = "StreamID"]; - bytes batch_header_hash = 3; - uint32 num_blobs = 4; -} - -message DASResponse { - uint64 id = 1 [(gogoproto.customname) = "ID"]; - bytes sampler = 2 [ - (cosmos_proto.scalar) = "cosmos.AddressBytes", - (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress" - ]; - repeated bool results = 3; -} diff --git a/proto/zgc/das/v1/query.proto b/proto/zgc/das/v1/query.proto deleted file mode 100644 index 371c50e8..00000000 --- a/proto/zgc/das/v1/query.proto +++ /dev/null @@ -1,24 +0,0 @@ -syntax = "proto3"; -package zgc.das.v1; - -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/0glabs/0g-chain/x/das/v1/types"; -option (gogoproto.goproto_getters_all) = false; - -// Query defines the gRPC querier service for the das module -service Query { - rpc NextRequestID(QueryNextRequestIDRequest) returns (QueryNextRequestIDResponse) { - option (google.api.http).get = "/0gchain/das/v1/next-request-id"; - } -} - -message QueryNextRequestIDRequest {} - -message QueryNextRequestIDResponse { - uint64 next_request_id = 1 [(gogoproto.customname) = "NextRequestID"]; -} diff --git a/proto/zgc/das/v1/tx.proto b/proto/zgc/das/v1/tx.proto deleted file mode 100644 index 482c4679..00000000 --- a/proto/zgc/das/v1/tx.proto +++ /dev/null @@ -1,35 +0,0 @@ -syntax = "proto3"; -package zgc.das.v1; - -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; -import "zgc/das/v1/genesis.proto"; - -option go_package = "github.com/0glabs/0g-chain/x/das/v1/types"; -option (gogoproto.goproto_getters_all) = false; - -// Msg defines the das Msg service -service Msg { - rpc RequestDAS(MsgRequestDAS) returns (MsgRequestDASResponse); - rpc ReportDASResult(MsgReportDASResult) returns (MsgReportDASResultResponse); -} - -message MsgRequestDAS { - string requester = 1 [(gogoproto.moretags) = "Requester"]; - string stream_id = 2 [(gogoproto.customname) = "StreamID"]; - string batch_header_hash = 3; - uint32 num_blobs = 4; -} - -message MsgRequestDASResponse { - uint64 request_id = 1 [(gogoproto.customname) = "RequestID"]; -} - -message MsgReportDASResult { - uint64 request_id = 1 [(gogoproto.customname) = "RequestID"]; - string sampler = 2; - repeated bool results = 3; -} - -message MsgReportDASResultResponse {} diff --git a/proto/zgc/dasigners/v1/tx.proto b/proto/zgc/dasigners/v1/tx.proto index 9e5fd0e2..43651a81 100644 --- a/proto/zgc/dasigners/v1/tx.proto +++ b/proto/zgc/dasigners/v1/tx.proto @@ -4,7 +4,6 @@ package zgc.dasigners.v1; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; -import "zgc/das/v1/genesis.proto"; import "zgc/dasigners/v1/dasigners.proto"; option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; diff --git a/x/das/v1/client/cli/query.go b/x/das/v1/client/cli/query.go deleted file mode 100644 index b7a715e3..00000000 --- a/x/das/v1/client/cli/query.go +++ /dev/null @@ -1,57 +0,0 @@ -package cli - -import ( - "context" - "fmt" - - "github.com/spf13/cobra" - - "github.com/0glabs/0g-chain/x/das/v1/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" -) - -// GetQueryCmd returns the cli query commands for the inflation module. -func GetQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: "Querying commands for the das module", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - GetNextRequestID(), - ) - - return cmd -} - -func GetNextRequestID() *cobra.Command { - cmd := &cobra.Command{ - Use: "next-request-id", - Short: "Query the next request ID", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryNextRequestIDRequest{} - res, err := queryClient.NextRequestID(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintString(fmt.Sprintf("%v\n", res.NextRequestID)) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/das/v1/client/cli/tx.go b/x/das/v1/client/cli/tx.go deleted file mode 100644 index 1a97c959..00000000 --- a/x/das/v1/client/cli/tx.go +++ /dev/null @@ -1,103 +0,0 @@ -package cli - -import ( - "encoding/hex" - "fmt" - "strconv" - - "github.com/0glabs/0g-chain/x/das/v1/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cobra" -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - cmd.AddCommand( - NewRequestDASCmd(), - NewReportDASResultCmd(), - ) - return cmd -} - -func NewRequestDASCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "request-das steram-id batch-header-hash num-blobs", - Short: "Request data-availability-sampling", - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - numBlobs, err := strconv.Atoi(args[2]) - if err != nil { - return err - } - - msg := types.NewMsgRequestDAS(clientCtx.GetFromAddress(), args[0], args[1], uint32(numBlobs)) - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd - -} - -func NewReportDASResultCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "report-das-result request-id results", - Short: "Report data-availability-sampling result", - Args: cobra.MinimumNArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - requestID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - - n := len(args) - 1 - results := make([]bool, n) - for i := 0; i < n; i++ { - var err error - results[i], err = strconv.ParseBool(args[i+1]) - if err != nil { - return err - } - } - - // get account name by address - accAddr := clientCtx.GetFromAddress() - - samplerAddr, err := sdk.ValAddressFromHex(hex.EncodeToString(accAddr.Bytes())) - if err != nil { - return err - } - - msg := &types.MsgReportDASResult{ - RequestID: requestID, - Sampler: samplerAddr.String(), - Results: results, - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} diff --git a/x/das/v1/genesis.go b/x/das/v1/genesis.go deleted file mode 100644 index 4780b693..00000000 --- a/x/das/v1/genesis.go +++ /dev/null @@ -1,39 +0,0 @@ -package das - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/0glabs/0g-chain/x/das/v1/keeper" - "github.com/0glabs/0g-chain/x/das/v1/types" -) - -// InitGenesis initializes the store state from a genesis state. -func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, gs types.GenesisState) { - if err := gs.Validate(); err != nil { - panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) - } - - keeper.SetNextRequestID(ctx, gs.NextRequestID) - for _, req := range gs.Requests { - keeper.SetDASRequest(ctx, req) - } - for _, resp := range gs.Responses { - keeper.SetDASResponse(ctx, resp) - } -} - -// ExportGenesis returns a GenesisState for a given context and keeper. -func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { - nextRequestID, err := keeper.GetNextRequestID(ctx) - if err != nil { - panic(err) - } - - return types.NewGenesisState( - nextRequestID, - keeper.GetDASRequests(ctx), - keeper.GetDASResponses(ctx), - ) -} diff --git a/x/das/v1/keeper/grpc_query.go b/x/das/v1/keeper/grpc_query.go deleted file mode 100644 index e4fddea2..00000000 --- a/x/das/v1/keeper/grpc_query.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/0glabs/0g-chain/x/das/v1/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var _ types.QueryServer = Keeper{} - -func (k Keeper) NextRequestID( - c context.Context, - _ *types.QueryNextRequestIDRequest, -) (*types.QueryNextRequestIDResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - nextRequestID, err := k.GetNextRequestID(ctx) - if err != nil { - return nil, err - } - return &types.QueryNextRequestIDResponse{NextRequestID: nextRequestID}, nil -} diff --git a/x/das/v1/keeper/keeper.go b/x/das/v1/keeper/keeper.go deleted file mode 100644 index 52e515fa..00000000 --- a/x/das/v1/keeper/keeper.go +++ /dev/null @@ -1,198 +0,0 @@ -package keeper - -import ( - "encoding/hex" - "strconv" - - errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/libs/log" - - "github.com/0glabs/0g-chain/x/das/v1/types" -) - -type Keeper struct { - storeKey storetypes.StoreKey - cdc codec.BinaryCodec - stakingKeeperRef types.StakingKeeperRef -} - -// NewKeeper creates a new das Keeper instance -func NewKeeper( - storeKey storetypes.StoreKey, - cdc codec.BinaryCodec, - stakingKeeper types.StakingKeeperRef, -) Keeper { - return Keeper{ - storeKey: storeKey, - cdc: cdc, - stakingKeeperRef: stakingKeeper, - } -} - -// Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+types.ModuleName) -} - -func (k Keeper) SetNextRequestID(ctx sdk.Context, id uint64) { - store := ctx.KVStore(k.storeKey) - store.Set(types.NextRequestIDKey, types.GetKeyFromID(id)) -} - -func (k Keeper) GetNextRequestID(ctx sdk.Context) (uint64, error) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.NextRequestIDKey) - if bz == nil { - return 0, errorsmod.Wrap(types.ErrInvalidGenesis, "next request ID not set at genesis") - } - return types.Uint64FromBytes(bz), nil -} - -func (k Keeper) IncrementNextRequestID(ctx sdk.Context) error { - id, err := k.GetNextRequestID(ctx) - if err != nil { - return err - } - k.SetNextRequestID(ctx, id+1) - return nil -} - -func (k Keeper) GetDASRequest(ctx sdk.Context, requestID uint64) (types.DASRequest, bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.RequestKeyPrefix) - bz := store.Get(types.GetKeyFromID(requestID)) - if bz == nil { - return types.DASRequest{}, false - } - var req types.DASRequest - k.cdc.MustUnmarshal(bz, &req) - return req, true -} - -func (k Keeper) SetDASRequest(ctx sdk.Context, req types.DASRequest) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.RequestKeyPrefix) - bz := k.cdc.MustMarshal(&req) - store.Set(types.GetKeyFromID(req.ID), bz) -} - -func (k Keeper) IterateDASRequest(ctx sdk.Context, cb func(req types.DASRequest) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.RequestKeyPrefix) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var req types.DASRequest - k.cdc.MustUnmarshal(iterator.Value(), &req) - if cb(req) { - break - } - } -} - -func (k Keeper) GetDASRequests(ctx sdk.Context) []types.DASRequest { - results := []types.DASRequest{} - k.IterateDASRequest(ctx, func(req types.DASRequest) bool { - results = append(results, req) - return false - }) - return results -} - -func (k Keeper) StoreNewDASRequest( - ctx sdk.Context, - streamIDHexStr string, - batchHeaderHashHexStr string, - numBlobs uint32) (uint64, error) { - requestID, err := k.GetNextRequestID(ctx) - if err != nil { - return 0, err - } - - streamID, err := hex.DecodeString(streamIDHexStr) - if err != nil { - return 0, err - } - - batchHeaderHash, err := hex.DecodeString(batchHeaderHashHexStr) - if err != nil { - return 0, err - } - - req := types.DASRequest{ - ID: requestID, - StreamID: streamID, - BatchHeaderHash: batchHeaderHash, - NumBlobs: numBlobs, - } - k.SetDASRequest(ctx, req) - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeDASRequest, - sdk.NewAttribute(types.AttributeKeyRequestID, strconv.FormatUint(requestID, 10)), - sdk.NewAttribute(types.AttributeKeyStreamID, streamIDHexStr), - sdk.NewAttribute(types.AttributeKeyBatchHeaderHash, batchHeaderHashHexStr), - sdk.NewAttribute(types.AttributeKeyNumBlobs, strconv.FormatUint(uint64(numBlobs), 10)), - ), - ) - - return requestID, nil -} - -func (k Keeper) GetDASResponse( - ctx sdk.Context, requestID uint64, sampler sdk.ValAddress, -) (types.DASResponse, bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ResponseKeyPrefix) - bz := store.Get(types.GetResponseKey(requestID, sampler)) - if bz == nil { - return types.DASResponse{}, false - } - var vote types.DASResponse - k.cdc.MustUnmarshal(bz, &vote) - return vote, true -} - -func (k Keeper) SetDASResponse(ctx sdk.Context, resp types.DASResponse) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ResponseKeyPrefix) - bz := k.cdc.MustMarshal(&resp) - store.Set(types.GetResponseKey(resp.ID, resp.Sampler), bz) -} - -func (k Keeper) IterateDASResponse(ctx sdk.Context, cb func(resp types.DASResponse) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.ResponseKeyPrefix) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var resp types.DASResponse - k.cdc.MustUnmarshal(iterator.Value(), &resp) - if cb(resp) { - break - } - } -} - -func (k Keeper) GetDASResponses(ctx sdk.Context) []types.DASResponse { - results := []types.DASResponse{} - k.IterateDASResponse(ctx, func(resp types.DASResponse) bool { - results = append(results, resp) - return false - }) - return results -} - -func (k Keeper) StoreNewDASResponse( - ctx sdk.Context, requestID uint64, sampler sdk.ValAddress, results []bool) error { - if _, found := k.GetDASRequest(ctx, requestID); !found { - return errorsmod.Wrapf(types.ErrUnknownRequest, "%d", requestID) - } - - k.SetDASResponse(ctx, types.DASResponse{ - ID: requestID, - Sampler: sampler, - Results: results, - }) - - return nil -} diff --git a/x/das/v1/keeper/msg_server.go b/x/das/v1/keeper/msg_server.go deleted file mode 100644 index 4109f90a..00000000 --- a/x/das/v1/keeper/msg_server.go +++ /dev/null @@ -1,49 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/0glabs/0g-chain/x/das/v1/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -var _ types.MsgServer = &Keeper{} - -// RequestDAS handles MsgRequestDAS messages -func (k Keeper) RequestDAS( - goCtx context.Context, msg *types.MsgRequestDAS, -) (*types.MsgRequestDASResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - requestID, err := k.StoreNewDASRequest(ctx, msg.StreamID, msg.BatchHeaderHash, msg.NumBlobs) - if err != nil { - return nil, err - } - k.IncrementNextRequestID(ctx) - return &types.MsgRequestDASResponse{ - RequestID: requestID, - }, nil -} - -// ReportDASResult handles MsgReportDASResult messages -func (k Keeper) ReportDASResult( - goCtx context.Context, msg *types.MsgReportDASResult, -) (*types.MsgReportDASResultResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - sampler, err := sdk.ValAddressFromBech32(msg.Sampler) - if err != nil { - return nil, err - } - - if _, found := k.stakingKeeperRef.GetValidator(ctx, sampler); !found { - return nil, stakingtypes.ErrNoValidatorFound - } - - if err := k.StoreNewDASResponse(ctx, msg.RequestID, sampler, msg.Results); err != nil { - return nil, err - } - - return &types.MsgReportDASResultResponse{}, nil -} diff --git a/x/das/v1/module.go b/x/das/v1/module.go deleted file mode 100644 index 03d8c644..00000000 --- a/x/das/v1/module.go +++ /dev/null @@ -1,180 +0,0 @@ -package das - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" - - "github.com/0glabs/0g-chain/x/das/v1/client/cli" - "github.com/0glabs/0g-chain/x/das/v1/keeper" - "github.com/0glabs/0g-chain/x/das/v1/types" -) - -// consensusVersion defines the current x/council module consensus version. -const consensusVersion = 1 - -// type check to ensure the interface is properly implemented -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - // _ module.AppModuleSimulation = AppModule{} - _ module.BeginBlockAppModule = AppModule{} - _ module.EndBlockAppModule = AppModule{} -) - -// app module Basics object -type AppModuleBasic struct{} - -// Name returns the inflation module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the inflation module's types on the given LegacyAmino codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} - -// ConsensusVersion returns the consensus state-breaking version for the module. -func (AppModuleBasic) ConsensusVersion() uint64 { - return consensusVersion -} - -// RegisterInterfaces registers interfaces and implementations of the incentives -// module. -func (AppModuleBasic) RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) { - types.RegisterInterfaces(interfaceRegistry) -} - -// DefaultGenesis returns default genesis state as raw bytes for the incentives -// module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) -} - -// ValidateGenesis performs genesis state validation for the inflation module. -func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var genesisState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - - return genesisState.Validate() -} - -// RegisterRESTRoutes performs a no-op as the inflation module doesn't expose REST -// endpoints -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the inflation module. -func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) { - if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil { - panic(err) - } -} - -// GetTxCmd returns the root tx command for the inflation module. -func (AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns no root query command for the inflation module. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() -} - -// ___________________________________________________________________________ - -// AppModule implements an application module for the inflation module. -type AppModule struct { - AppModuleBasic - keeper keeper.Keeper -} - -// NewAppModule creates a new AppModule Object -func NewAppModule( - k keeper.Keeper, -) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{}, - keeper: k, - } -} - -// Name returns the inflation module's name. -func (AppModule) Name() string { - return types.ModuleName -} - -// Route returns evmutil module's message route. -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - -// QuerierRoute returns evmutil module's query routing key. -func (AppModule) QuerierRoute() string { return "" } - -// LegacyQuerierHandler returns evmutil module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return nil -} - -// RegisterInvariants registers the inflation module invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// RegisterServices registers a gRPC query service to respond to the -// module-specific gRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), am.keeper) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - // am.keeper.BeginBlock(ctx, req) -} - -func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { - // am.keeper.EndBlock(ctx, req) - return []abci.ValidatorUpdate{} -} - -// InitGenesis performs genesis initialization for the inflation module. It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState - - cdc.MustUnmarshalJSON(data, &genesisState) - InitGenesis(ctx, am.keeper, genesisState) - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the exported genesis state as raw bytes for the inflation -// module. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(gs) -} - -// ___________________________________________________________________________ - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the inflation module. -func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { -} - -// RegisterStoreDecoder registers a decoder for inflation module's types. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { -} - -// WeightedOperations doesn't return any inflation module operation. -func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { - return []simtypes.WeightedOperation{} -} diff --git a/x/das/v1/types/codec.go b/x/das/v1/types/codec.go deleted file mode 100644 index 883a699e..00000000 --- a/x/das/v1/types/codec.go +++ /dev/null @@ -1,47 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -var ( - amino = codec.NewLegacyAmino() - // ModuleCdc references the global evm module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding. - ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - - // AminoCdc is a amino codec created to support amino JSON compatible msgs. - AminoCdc = codec.NewAminoCodec(amino) -) - -const ( - // Amino names - requestDASName = "evmos/das/MsgRequestDAS" - reportDASResultName = "evmos/das/MsgReportDASResult" -) - -// NOTE: This is required for the GetSignBytes function -func init() { - RegisterLegacyAminoCodec(amino) - amino.Seal() -} - -// RegisterInterfaces register implementations -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgRequestDAS{}, - &MsgReportDASResult{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -// RegisterLegacyAminoCodec required for EIP-712 -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgRequestDAS{}, requestDASName, nil) - cdc.RegisterConcrete(&MsgReportDASResult{}, reportDASResultName, nil) -} diff --git a/x/das/v1/types/errors.go b/x/das/v1/types/errors.go deleted file mode 100644 index 77469e4a..00000000 --- a/x/das/v1/types/errors.go +++ /dev/null @@ -1,8 +0,0 @@ -package types - -import errorsmod "cosmossdk.io/errors" - -var ( - ErrUnknownRequest = errorsmod.Register(ModuleName, 0, "request not found") - ErrInvalidGenesis = errorsmod.Register(ModuleName, 1, "invalid genesis") -) diff --git a/x/das/v1/types/events.go b/x/das/v1/types/events.go deleted file mode 100644 index 3a7159a4..00000000 --- a/x/das/v1/types/events.go +++ /dev/null @@ -1,11 +0,0 @@ -package types - -// Module event types -const ( - EventTypeDASRequest = "das_request" - - AttributeKeyRequestID = "request_id" - AttributeKeyStreamID = "stream_id" - AttributeKeyBatchHeaderHash = "batch_header_hash" - AttributeKeyNumBlobs = "num_blobs" -) diff --git a/x/das/v1/types/genesis.go b/x/das/v1/types/genesis.go deleted file mode 100644 index fd0c6fde..00000000 --- a/x/das/v1/types/genesis.go +++ /dev/null @@ -1,28 +0,0 @@ -package types - -const ( - DefaultNextRequestID = 0 -) - -// NewGenesisState returns a new genesis state object for the module. -func NewGenesisState(nextRequestID uint64, requests []DASRequest, responses []DASResponse) *GenesisState { - return &GenesisState{ - NextRequestID: nextRequestID, - Requests: requests, - Responses: responses, - } -} - -// DefaultGenesisState returns the default genesis state for the module. -func DefaultGenesisState() *GenesisState { - return NewGenesisState( - DefaultNextRequestID, - []DASRequest{}, - []DASResponse{}, - ) -} - -// Validate performs basic validation of genesis data. -func (gs GenesisState) Validate() error { - return nil -} diff --git a/x/das/v1/types/genesis.pb.go b/x/das/v1/types/genesis.pb.go deleted file mode 100644 index 6ebee372..00000000 --- a/x/das/v1/types/genesis.pb.go +++ /dev/null @@ -1,1191 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: zgc/das/v1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/codec/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type Params struct { -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_3f8b8b164973ed21, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -// GenesisState defines the das module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - NextRequestID uint64 `protobuf:"varint,2,opt,name=next_request_id,json=nextRequestId,proto3" json:"next_request_id,omitempty"` - Requests []DASRequest `protobuf:"bytes,3,rep,name=requests,proto3" json:"requests"` - Responses []DASResponse `protobuf:"bytes,4,rep,name=responses,proto3" json:"responses"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_3f8b8b164973ed21, []int{1} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -type DASRequest struct { - ID uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - StreamID []byte `protobuf:"bytes,2,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` - BatchHeaderHash []byte `protobuf:"bytes,3,opt,name=batch_header_hash,json=batchHeaderHash,proto3" json:"batch_header_hash,omitempty"` - NumBlobs uint32 `protobuf:"varint,4,opt,name=num_blobs,json=numBlobs,proto3" json:"num_blobs,omitempty"` -} - -func (m *DASRequest) Reset() { *m = DASRequest{} } -func (m *DASRequest) String() string { return proto.CompactTextString(m) } -func (*DASRequest) ProtoMessage() {} -func (*DASRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3f8b8b164973ed21, []int{2} -} -func (m *DASRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DASRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DASRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DASRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DASRequest.Merge(m, src) -} -func (m *DASRequest) XXX_Size() int { - return m.Size() -} -func (m *DASRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DASRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DASRequest proto.InternalMessageInfo - -func (m *DASRequest) GetID() uint64 { - if m != nil { - return m.ID - } - return 0 -} - -func (m *DASRequest) GetStreamID() []byte { - if m != nil { - return m.StreamID - } - return nil -} - -func (m *DASRequest) GetBatchHeaderHash() []byte { - if m != nil { - return m.BatchHeaderHash - } - return nil -} - -func (m *DASRequest) GetNumBlobs() uint32 { - if m != nil { - return m.NumBlobs - } - return 0 -} - -type DASResponse struct { - ID uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Sampler github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=sampler,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"sampler,omitempty"` - Results []bool `protobuf:"varint,3,rep,packed,name=results,proto3" json:"results,omitempty"` -} - -func (m *DASResponse) Reset() { *m = DASResponse{} } -func (m *DASResponse) String() string { return proto.CompactTextString(m) } -func (*DASResponse) ProtoMessage() {} -func (*DASResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3f8b8b164973ed21, []int{3} -} -func (m *DASResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DASResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DASResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DASResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DASResponse.Merge(m, src) -} -func (m *DASResponse) XXX_Size() int { - return m.Size() -} -func (m *DASResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DASResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DASResponse proto.InternalMessageInfo - -func (m *DASResponse) GetID() uint64 { - if m != nil { - return m.ID - } - return 0 -} - -func (m *DASResponse) GetSampler() github_com_cosmos_cosmos_sdk_types.ValAddress { - if m != nil { - return m.Sampler - } - return nil -} - -func (m *DASResponse) GetResults() []bool { - if m != nil { - return m.Results - } - return nil -} - -func init() { - proto.RegisterType((*Params)(nil), "zgc.das.v1.Params") - proto.RegisterType((*GenesisState)(nil), "zgc.das.v1.GenesisState") - proto.RegisterType((*DASRequest)(nil), "zgc.das.v1.DASRequest") - proto.RegisterType((*DASResponse)(nil), "zgc.das.v1.DASResponse") -} - -func init() { proto.RegisterFile("zgc/das/v1/genesis.proto", fileDescriptor_3f8b8b164973ed21) } - -var fileDescriptor_3f8b8b164973ed21 = []byte{ - // 521 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xbd, 0x6e, 0xd3, 0x50, - 0x14, 0x8e, 0x93, 0x28, 0x75, 0x6e, 0x12, 0x55, 0x35, 0xa8, 0xb8, 0x45, 0xb2, 0xa3, 0x4c, 0x29, - 0x52, 0xec, 0xb4, 0x2c, 0xfc, 0x4c, 0x35, 0x91, 0x48, 0x16, 0x84, 0x1c, 0x89, 0x81, 0xc5, 0xba, - 0xf6, 0xbd, 0xd8, 0x16, 0xb6, 0xaf, 0xf1, 0xb9, 0xae, 0x92, 0x3e, 0x01, 0x23, 0x23, 0x23, 0x12, - 0xaf, 0xc0, 0x43, 0x74, 0xac, 0x98, 0x98, 0x22, 0xe4, 0xbc, 0x04, 0x62, 0x42, 0xb1, 0x6f, 0x48, - 0x04, 0xea, 0x94, 0x7c, 0x7f, 0x3e, 0xdf, 0x91, 0x8f, 0x91, 0x7a, 0xed, 0x7b, 0x26, 0xc1, 0x60, - 0x5e, 0x9d, 0x9b, 0x3e, 0x4d, 0x28, 0x84, 0x60, 0xa4, 0x19, 0xe3, 0x4c, 0x41, 0xd7, 0xbe, 0x67, - 0x10, 0x0c, 0xc6, 0xd5, 0xf9, 0xe9, 0x89, 0xc7, 0x20, 0x66, 0xe0, 0x94, 0x8a, 0x59, 0x81, 0xca, - 0x76, 0x7a, 0xdf, 0x67, 0x3e, 0xab, 0xf8, 0xcd, 0x3f, 0xc1, 0x9e, 0xf8, 0x8c, 0xf9, 0x11, 0x35, - 0x4b, 0xe4, 0xe6, 0xef, 0x4c, 0x9c, 0x2c, 0x85, 0xa4, 0xff, 0x2b, 0xf1, 0x30, 0xa6, 0xc0, 0x71, - 0x9c, 0x56, 0x86, 0x81, 0x8c, 0x5a, 0xaf, 0x71, 0x86, 0x63, 0x18, 0xfc, 0x92, 0x50, 0xf7, 0x65, - 0x55, 0x6a, 0xce, 0x31, 0xa7, 0xca, 0x18, 0xb5, 0xd2, 0x52, 0x52, 0xa5, 0xbe, 0x34, 0xec, 0x5c, - 0x28, 0xc6, 0xae, 0xa4, 0x51, 0x85, 0xac, 0xe6, 0xcd, 0x4a, 0xaf, 0xd9, 0xc2, 0xa7, 0x3c, 0x45, - 0x87, 0x09, 0x5d, 0x70, 0x27, 0xa3, 0x1f, 0x72, 0x0a, 0xdc, 0x09, 0x89, 0x5a, 0xef, 0x4b, 0xc3, - 0xa6, 0x75, 0x54, 0xac, 0xf4, 0xde, 0x2b, 0xba, 0xe0, 0x76, 0xa5, 0xcc, 0x26, 0x76, 0x2f, 0xd9, - 0x83, 0x44, 0x79, 0x82, 0x64, 0x91, 0x02, 0xb5, 0xd1, 0x6f, 0x0c, 0x3b, 0x17, 0xc7, 0xfb, 0xe3, - 0x26, 0x97, 0x73, 0xe1, 0x15, 0x23, 0xff, 0xba, 0x95, 0xe7, 0xa8, 0x9d, 0x51, 0x48, 0x59, 0x02, - 0x14, 0xd4, 0x66, 0x19, 0x7d, 0xf0, 0x5f, 0xb4, 0xd2, 0x45, 0x76, 0xe7, 0x7f, 0xd6, 0xfc, 0xf8, - 0x45, 0xaf, 0x0d, 0x3e, 0x4b, 0x08, 0xed, 0x26, 0x28, 0xc7, 0xa8, 0x1e, 0x92, 0x72, 0xe9, 0xa6, - 0xd5, 0x2a, 0x56, 0x7a, 0x7d, 0x36, 0xb1, 0xeb, 0x21, 0x51, 0xce, 0x50, 0x1b, 0x78, 0x46, 0x71, - 0xbc, 0x5d, 0xac, 0x6b, 0x75, 0x8b, 0x95, 0x2e, 0xcf, 0x4b, 0x72, 0x36, 0xb1, 0xe5, 0x4a, 0x9e, - 0x11, 0xe5, 0x11, 0x3a, 0x72, 0x31, 0xf7, 0x02, 0x27, 0xa0, 0x98, 0xd0, 0xcc, 0x09, 0x30, 0x04, - 0x6a, 0x63, 0x13, 0xb1, 0x0f, 0x4b, 0x61, 0x5a, 0xf2, 0x53, 0x0c, 0x81, 0xf2, 0x10, 0xb5, 0x93, - 0x3c, 0x76, 0xdc, 0x88, 0xb9, 0x9b, 0x05, 0xa4, 0x61, 0xcf, 0x96, 0x93, 0x3c, 0xb6, 0x36, 0x78, - 0xf0, 0x55, 0x42, 0x9d, 0xbd, 0x0d, 0xee, 0xec, 0xe6, 0xa2, 0x03, 0xc0, 0x71, 0x1a, 0xd1, 0x4c, - 0x34, 0x9b, 0xfe, 0x5e, 0xe9, 0x23, 0x3f, 0xe4, 0x41, 0xee, 0x1a, 0x1e, 0x8b, 0xc5, 0x1d, 0x89, - 0x9f, 0x11, 0x90, 0xf7, 0x26, 0x5f, 0xa6, 0x14, 0x8c, 0x37, 0x38, 0xba, 0x24, 0x24, 0xa3, 0x00, - 0xdf, 0xbf, 0x8d, 0xee, 0x89, 0x6b, 0x13, 0x8c, 0xb5, 0xe4, 0x14, 0xec, 0xed, 0x83, 0x15, 0x15, - 0x1d, 0x64, 0x14, 0xf2, 0x48, 0xbc, 0x22, 0xd9, 0xde, 0x42, 0xeb, 0xc5, 0x4d, 0xa1, 0x49, 0xb7, - 0x85, 0x26, 0xfd, 0x2c, 0x34, 0xe9, 0xd3, 0x5a, 0xab, 0xdd, 0xae, 0xb5, 0xda, 0x8f, 0xb5, 0x56, - 0x7b, 0x7b, 0xb6, 0x57, 0x61, 0xec, 0x47, 0xd8, 0x05, 0x73, 0xec, 0x8f, 0xbc, 0x00, 0x87, 0x89, - 0xb9, 0xd8, 0x7e, 0x0b, 0x65, 0x13, 0xb7, 0x55, 0x5e, 0xe4, 0xe3, 0x3f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x5b, 0x0e, 0xfc, 0x0d, 0x26, 0x03, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Responses) > 0 { - for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Responses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Requests) > 0 { - for iNdEx := len(m.Requests) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Requests[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.NextRequestID != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.NextRequestID)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DASRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DASRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DASRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NumBlobs != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.NumBlobs)) - i-- - dAtA[i] = 0x20 - } - if len(m.BatchHeaderHash) > 0 { - i -= len(m.BatchHeaderHash) - copy(dAtA[i:], m.BatchHeaderHash) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.BatchHeaderHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.StreamID) > 0 { - i -= len(m.StreamID) - copy(dAtA[i:], m.StreamID) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.StreamID))) - i-- - dAtA[i] = 0x12 - } - if m.ID != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *DASResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DASResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DASResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Results) > 0 { - for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { - i-- - if m.Results[iNdEx] { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - } - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Results))) - i-- - dAtA[i] = 0x1a - } - if len(m.Sampler) > 0 { - i -= len(m.Sampler) - copy(dAtA[i:], m.Sampler) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Sampler))) - i-- - dAtA[i] = 0x12 - } - if m.ID != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if m.NextRequestID != 0 { - n += 1 + sovGenesis(uint64(m.NextRequestID)) - } - if len(m.Requests) > 0 { - for _, e := range m.Requests { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Responses) > 0 { - for _, e := range m.Responses { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func (m *DASRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovGenesis(uint64(m.ID)) - } - l = len(m.StreamID) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.BatchHeaderHash) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if m.NumBlobs != 0 { - n += 1 + sovGenesis(uint64(m.NumBlobs)) - } - return n -} - -func (m *DASResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ID != 0 { - n += 1 + sovGenesis(uint64(m.ID)) - } - l = len(m.Sampler) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if len(m.Results) > 0 { - n += 1 + sovGenesis(uint64(len(m.Results))) + len(m.Results)*1 - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NextRequestID", wireType) - } - m.NextRequestID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NextRequestID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Requests = append(m.Requests, DASRequest{}) - if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Responses = append(m.Responses, DASResponse{}) - if err := m.Responses[len(m.Responses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DASRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DASRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DASRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StreamID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StreamID = append(m.StreamID[:0], dAtA[iNdEx:postIndex]...) - if m.StreamID == nil { - m.StreamID = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchHeaderHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BatchHeaderHash = append(m.BatchHeaderHash[:0], dAtA[iNdEx:postIndex]...) - if m.BatchHeaderHash == nil { - m.BatchHeaderHash = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumBlobs", wireType) - } - m.NumBlobs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NumBlobs |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DASResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DASResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DASResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sampler", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sampler = append(m.Sampler[:0], dAtA[iNdEx:postIndex]...) - if m.Sampler == nil { - m.Sampler = []byte{} - } - iNdEx = postIndex - case 3: - if wireType == 0 { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Results = append(m.Results, bool(v != 0)) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - elementCount = packedLen - if elementCount != 0 && len(m.Results) == 0 { - m.Results = make([]bool, 0, elementCount) - } - for iNdEx < postIndex { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Results = append(m.Results, bool(v != 0)) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/das/v1/types/interfaces.go b/x/das/v1/types/interfaces.go deleted file mode 100644 index ff56b322..00000000 --- a/x/das/v1/types/interfaces.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -type StakingKeeperRef interface { - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) -} diff --git a/x/das/v1/types/keys.go b/x/das/v1/types/keys.go deleted file mode 100644 index 06846cb9..00000000 --- a/x/das/v1/types/keys.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - "encoding/binary" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName The name that will be used throughout the module - ModuleName = "das" - - // StoreKey Top level store key where all module items will be stored - StoreKey = ModuleName -) - -// Key prefixes -var ( - RequestKeyPrefix = []byte{0x00} // prefix for keys that store requests - ResponseKeyPrefix = []byte{0x01} // prefix for keys that store responses - - NextRequestIDKey = []byte{0x02} -) - -// GetKeyFromID returns the bytes to use as a key for a uint64 id -func GetKeyFromID(id uint64) []byte { - return Uint64ToBytes(id) -} - -func GetResponseKey(requestID uint64, sampler sdk.ValAddress) []byte { - return append(GetKeyFromID(requestID), sampler.Bytes()...) -} - -// Uint64ToBytes converts a uint64 into fixed length bytes for use in store keys. -func Uint64ToBytes(id uint64) []byte { - bz := make([]byte, 8) - binary.BigEndian.PutUint64(bz, uint64(id)) - return bz -} - -// Uint64FromBytes converts some fixed length bytes back into a uint64. -func Uint64FromBytes(bz []byte) uint64 { - return binary.BigEndian.Uint64(bz) -} diff --git a/x/das/v1/types/msg.go b/x/das/v1/types/msg.go deleted file mode 100644 index f1c07ce4..00000000 --- a/x/das/v1/types/msg.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - "encoding/hex" - - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -var _, _ sdk.Msg = &MsgRequestDAS{}, &MsgReportDASResult{} - -func NewMsgRequestDAS(fromAddr sdk.AccAddress, streamID, hash string, numBlobs uint32) *MsgRequestDAS { - return &MsgRequestDAS{ - Requester: fromAddr.String(), - StreamID: streamID, - BatchHeaderHash: hash, - NumBlobs: numBlobs, - } -} - -func (msg MsgRequestDAS) GetSigners() []sdk.AccAddress { - from, err := sdk.AccAddressFromBech32(msg.Requester) - if err != nil { - panic(err) - } - return []sdk.AccAddress{from} -} - -func (msg MsgRequestDAS) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Requester) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid requester account address (%s)", err) - } - - return nil -} - -func (msg *MsgReportDASResult) GetSigners() []sdk.AccAddress { - samplerValAddr, err := sdk.ValAddressFromBech32(msg.Sampler) - if err != nil { - panic(err) - } - accAddr, err := sdk.AccAddressFromHexUnsafe(hex.EncodeToString(samplerValAddr.Bytes())) - if err != nil { - panic(err) - } - return []sdk.AccAddress{accAddr} -} - -func (msg *MsgReportDASResult) ValidateBasic() error { - _, err := sdk.ValAddressFromBech32(msg.Sampler) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sampler validator address (%s)", err) - } - return nil -} diff --git a/x/das/v1/types/query.pb.go b/x/das/v1/types/query.pb.go deleted file mode 100644 index 76f8bfd9..00000000 --- a/x/das/v1/types/query.pb.go +++ /dev/null @@ -1,511 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: zgc/das/v1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type QueryNextRequestIDRequest struct { -} - -func (m *QueryNextRequestIDRequest) Reset() { *m = QueryNextRequestIDRequest{} } -func (m *QueryNextRequestIDRequest) String() string { return proto.CompactTextString(m) } -func (*QueryNextRequestIDRequest) ProtoMessage() {} -func (*QueryNextRequestIDRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d404c1962bca645f, []int{0} -} -func (m *QueryNextRequestIDRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNextRequestIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNextRequestIDRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryNextRequestIDRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNextRequestIDRequest.Merge(m, src) -} -func (m *QueryNextRequestIDRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryNextRequestIDRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNextRequestIDRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNextRequestIDRequest proto.InternalMessageInfo - -type QueryNextRequestIDResponse struct { - NextRequestID uint64 `protobuf:"varint,1,opt,name=next_request_id,json=nextRequestId,proto3" json:"next_request_id,omitempty"` -} - -func (m *QueryNextRequestIDResponse) Reset() { *m = QueryNextRequestIDResponse{} } -func (m *QueryNextRequestIDResponse) String() string { return proto.CompactTextString(m) } -func (*QueryNextRequestIDResponse) ProtoMessage() {} -func (*QueryNextRequestIDResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d404c1962bca645f, []int{1} -} -func (m *QueryNextRequestIDResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNextRequestIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNextRequestIDResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryNextRequestIDResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNextRequestIDResponse.Merge(m, src) -} -func (m *QueryNextRequestIDResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryNextRequestIDResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNextRequestIDResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNextRequestIDResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*QueryNextRequestIDRequest)(nil), "zgc.das.v1.QueryNextRequestIDRequest") - proto.RegisterType((*QueryNextRequestIDResponse)(nil), "zgc.das.v1.QueryNextRequestIDResponse") -} - -func init() { proto.RegisterFile("zgc/das/v1/query.proto", fileDescriptor_d404c1962bca645f) } - -var fileDescriptor_d404c1962bca645f = []byte{ - // 334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xbf, 0x4b, 0x03, 0x31, - 0x14, 0xc7, 0x2f, 0xa2, 0x0e, 0x81, 0x22, 0x1e, 0x22, 0xf6, 0x94, 0x54, 0x0b, 0xfe, 0x1a, 0x9a, - 0xb4, 0x3a, 0xb9, 0x16, 0x41, 0x5c, 0x04, 0x5d, 0x04, 0x97, 0x92, 0xbb, 0x8b, 0x69, 0xa0, 0x97, - 0x5c, 0x9b, 0x5c, 0x69, 0x3b, 0xba, 0xb8, 0x2a, 0xfe, 0x53, 0x1d, 0x0b, 0x2e, 0x4e, 0xa2, 0x57, - 0xff, 0x10, 0xe9, 0xe5, 0x0e, 0xad, 0x28, 0x6e, 0xef, 0xbd, 0xef, 0xf7, 0x7d, 0xf3, 0xe1, 0x05, - 0xae, 0x8f, 0x78, 0x40, 0x42, 0xaa, 0x49, 0xbf, 0x41, 0xba, 0x09, 0xeb, 0x0d, 0x71, 0xdc, 0x53, - 0x46, 0xb9, 0x70, 0xc4, 0x03, 0x1c, 0x52, 0x8d, 0xfb, 0x0d, 0xaf, 0x1c, 0x28, 0x1d, 0x29, 0xdd, - 0xca, 0x14, 0x62, 0x1b, 0x6b, 0xf3, 0xd6, 0xb8, 0xe2, 0xca, 0xce, 0x67, 0x55, 0x3e, 0xdd, 0xe2, - 0x4a, 0xf1, 0x0e, 0x23, 0x34, 0x16, 0x84, 0x4a, 0xa9, 0x0c, 0x35, 0x42, 0xc9, 0x62, 0xa7, 0x9c, - 0xab, 0x59, 0xe7, 0x27, 0xb7, 0x84, 0xca, 0xfc, 0x55, 0xaf, 0xf2, 0x53, 0x32, 0x22, 0x62, 0xda, - 0xd0, 0x28, 0xb6, 0x86, 0xea, 0x26, 0x2c, 0x5f, 0xce, 0x28, 0x2f, 0xd8, 0xc0, 0x5c, 0xb1, 0x6e, - 0xc2, 0xb4, 0x39, 0x3f, 0xcd, 0x8b, 0xea, 0x35, 0xf4, 0x7e, 0x13, 0x75, 0xac, 0xa4, 0x66, 0xee, - 0x09, 0x5c, 0x91, 0x6c, 0x60, 0x5a, 0x3d, 0xab, 0xb4, 0x44, 0xb8, 0x01, 0xb6, 0xc1, 0xc1, 0x62, - 0x73, 0x35, 0x7d, 0xad, 0x94, 0xe6, 0x77, 0x4a, 0xf2, 0x5b, 0x1b, 0x1e, 0x3d, 0x02, 0xb8, 0x94, - 0x25, 0xbb, 0xf7, 0x00, 0xce, 0x5b, 0xdd, 0x5d, 0xfc, 0x75, 0x29, 0xfc, 0x27, 0x9b, 0xb7, 0xf7, - 0x9f, 0xcd, 0x52, 0x56, 0xf7, 0xef, 0x9e, 0x3f, 0x9e, 0x16, 0x76, 0xdc, 0x0a, 0xa9, 0xf3, 0xa0, - 0x4d, 0x85, 0x2c, 0x3e, 0x67, 0x46, 0x54, 0xcb, 0xd9, 0x6b, 0x22, 0x6c, 0x9e, 0x8d, 0xdf, 0x91, - 0x33, 0x4e, 0x11, 0x98, 0xa4, 0x08, 0xbc, 0xa5, 0x08, 0x3c, 0x4c, 0x91, 0x33, 0x99, 0x22, 0xe7, - 0x65, 0x8a, 0x9c, 0x9b, 0x43, 0x2e, 0x4c, 0x3b, 0xf1, 0x71, 0xa0, 0x22, 0x52, 0xe7, 0x1d, 0xea, - 0x6b, 0x52, 0xe7, 0x35, 0x1b, 0x38, 0x28, 0x22, 0xcd, 0x30, 0x66, 0xda, 0x5f, 0xce, 0x2e, 0x7b, - 0xfc, 0x19, 0x00, 0x00, 0xff, 0xff, 0xd5, 0x9e, 0xd6, 0x49, 0x0a, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - NextRequestID(ctx context.Context, in *QueryNextRequestIDRequest, opts ...grpc.CallOption) (*QueryNextRequestIDResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) NextRequestID(ctx context.Context, in *QueryNextRequestIDRequest, opts ...grpc.CallOption) (*QueryNextRequestIDResponse, error) { - out := new(QueryNextRequestIDResponse) - err := c.cc.Invoke(ctx, "/zgc.das.v1.Query/NextRequestID", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - NextRequestID(context.Context, *QueryNextRequestIDRequest) (*QueryNextRequestIDResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) NextRequestID(ctx context.Context, req *QueryNextRequestIDRequest) (*QueryNextRequestIDResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NextRequestID not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_NextRequestID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryNextRequestIDRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).NextRequestID(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zgc.das.v1.Query/NextRequestID", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NextRequestID(ctx, req.(*QueryNextRequestIDRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "zgc.das.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "NextRequestID", - Handler: _Query_NextRequestID_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "zgc/das/v1/query.proto", -} - -func (m *QueryNextRequestIDRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryNextRequestIDRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryNextRequestIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryNextRequestIDResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryNextRequestIDResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryNextRequestIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NextRequestID != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.NextRequestID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryNextRequestIDRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryNextRequestIDResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NextRequestID != 0 { - n += 1 + sovQuery(uint64(m.NextRequestID)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryNextRequestIDRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNextRequestIDRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNextRequestIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNextRequestIDResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNextRequestIDResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNextRequestIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NextRequestID", wireType) - } - m.NextRequestID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NextRequestID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/das/v1/types/query.pb.gw.go b/x/das/v1/types/query.pb.gw.go deleted file mode 100644 index 5567645e..00000000 --- a/x/das/v1/types/query.pb.gw.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: zgc/das/v1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_NextRequestID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNextRequestIDRequest - var metadata runtime.ServerMetadata - - msg, err := client.NextRequestID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_NextRequestID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNextRequestIDRequest - var metadata runtime.ServerMetadata - - msg, err := server.NextRequestID(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_NextRequestID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_NextRequestID_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_NextRequestID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_NextRequestID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_NextRequestID_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_NextRequestID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_NextRequestID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "das", "v1", "next-request-id"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_NextRequestID_0 = runtime.ForwardResponseMessage -) diff --git a/x/das/v1/types/tx.pb.go b/x/das/v1/types/tx.pb.go deleted file mode 100644 index 9b814acb..00000000 --- a/x/das/v1/types/tx.pb.go +++ /dev/null @@ -1,1110 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: zgc/das/v1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type MsgRequestDAS struct { - Requester string `protobuf:"bytes,1,opt,name=requester,proto3" json:"requester,omitempty" Requester` - StreamID string `protobuf:"bytes,2,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` - BatchHeaderHash string `protobuf:"bytes,3,opt,name=batch_header_hash,json=batchHeaderHash,proto3" json:"batch_header_hash,omitempty"` - NumBlobs uint32 `protobuf:"varint,4,opt,name=num_blobs,json=numBlobs,proto3" json:"num_blobs,omitempty"` -} - -func (m *MsgRequestDAS) Reset() { *m = MsgRequestDAS{} } -func (m *MsgRequestDAS) String() string { return proto.CompactTextString(m) } -func (*MsgRequestDAS) ProtoMessage() {} -func (*MsgRequestDAS) Descriptor() ([]byte, []int) { - return fileDescriptor_030259cfeac21931, []int{0} -} -func (m *MsgRequestDAS) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRequestDAS) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRequestDAS.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgRequestDAS) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRequestDAS.Merge(m, src) -} -func (m *MsgRequestDAS) XXX_Size() int { - return m.Size() -} -func (m *MsgRequestDAS) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRequestDAS.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRequestDAS proto.InternalMessageInfo - -type MsgRequestDASResponse struct { - RequestID uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` -} - -func (m *MsgRequestDASResponse) Reset() { *m = MsgRequestDASResponse{} } -func (m *MsgRequestDASResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRequestDASResponse) ProtoMessage() {} -func (*MsgRequestDASResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_030259cfeac21931, []int{1} -} -func (m *MsgRequestDASResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRequestDASResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRequestDASResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgRequestDASResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRequestDASResponse.Merge(m, src) -} -func (m *MsgRequestDASResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRequestDASResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRequestDASResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRequestDASResponse proto.InternalMessageInfo - -type MsgReportDASResult struct { - RequestID uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` - Sampler string `protobuf:"bytes,2,opt,name=sampler,proto3" json:"sampler,omitempty"` - Results []bool `protobuf:"varint,3,rep,packed,name=results,proto3" json:"results,omitempty"` -} - -func (m *MsgReportDASResult) Reset() { *m = MsgReportDASResult{} } -func (m *MsgReportDASResult) String() string { return proto.CompactTextString(m) } -func (*MsgReportDASResult) ProtoMessage() {} -func (*MsgReportDASResult) Descriptor() ([]byte, []int) { - return fileDescriptor_030259cfeac21931, []int{2} -} -func (m *MsgReportDASResult) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgReportDASResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgReportDASResult.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgReportDASResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgReportDASResult.Merge(m, src) -} -func (m *MsgReportDASResult) XXX_Size() int { - return m.Size() -} -func (m *MsgReportDASResult) XXX_DiscardUnknown() { - xxx_messageInfo_MsgReportDASResult.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgReportDASResult proto.InternalMessageInfo - -type MsgReportDASResultResponse struct { -} - -func (m *MsgReportDASResultResponse) Reset() { *m = MsgReportDASResultResponse{} } -func (m *MsgReportDASResultResponse) String() string { return proto.CompactTextString(m) } -func (*MsgReportDASResultResponse) ProtoMessage() {} -func (*MsgReportDASResultResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_030259cfeac21931, []int{3} -} -func (m *MsgReportDASResultResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgReportDASResultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgReportDASResultResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgReportDASResultResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgReportDASResultResponse.Merge(m, src) -} -func (m *MsgReportDASResultResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgReportDASResultResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgReportDASResultResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgReportDASResultResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgRequestDAS)(nil), "zgc.das.v1.MsgRequestDAS") - proto.RegisterType((*MsgRequestDASResponse)(nil), "zgc.das.v1.MsgRequestDASResponse") - proto.RegisterType((*MsgReportDASResult)(nil), "zgc.das.v1.MsgReportDASResult") - proto.RegisterType((*MsgReportDASResultResponse)(nil), "zgc.das.v1.MsgReportDASResultResponse") -} - -func init() { proto.RegisterFile("zgc/das/v1/tx.proto", fileDescriptor_030259cfeac21931) } - -var fileDescriptor_030259cfeac21931 = []byte{ - // 452 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x6e, 0xd3, 0x40, - 0x14, 0xc6, 0x63, 0x52, 0x41, 0xf2, 0x44, 0x54, 0x31, 0x80, 0xe4, 0x18, 0xe4, 0x86, 0x2c, 0x50, - 0xca, 0x1f, 0x4f, 0x0b, 0x27, 0x20, 0x0a, 0xa2, 0x41, 0xea, 0x66, 0xba, 0x82, 0x8d, 0x35, 0xb6, - 0x87, 0x71, 0x24, 0xdb, 0x63, 0xfc, 0xec, 0xa8, 0xed, 0x29, 0x38, 0x08, 0x0b, 0x8e, 0xd1, 0x65, - 0x97, 0xac, 0x2a, 0x70, 0x6e, 0xc0, 0x09, 0x90, 0xc7, 0x76, 0xd2, 0x50, 0x81, 0xc4, 0x2e, 0xdf, - 0xf7, 0x9b, 0xf9, 0xe6, 0x7b, 0xf1, 0x83, 0xfb, 0xe7, 0xd2, 0xa7, 0x01, 0x47, 0xba, 0x3c, 0xa4, - 0xf9, 0xa9, 0x93, 0x66, 0x2a, 0x57, 0x04, 0xce, 0xa5, 0xef, 0x04, 0x1c, 0x9d, 0xe5, 0xa1, 0x35, - 0xf4, 0x15, 0xc6, 0x0a, 0x5d, 0x4d, 0x68, 0x2d, 0xea, 0x63, 0xd6, 0x03, 0xa9, 0xa4, 0xaa, 0xfd, - 0xea, 0x57, 0xe3, 0x0e, 0xa5, 0x52, 0x32, 0x12, 0x54, 0x2b, 0xaf, 0xf8, 0x44, 0x79, 0x72, 0xd6, - 0x20, 0xf3, 0xda, 0x63, 0x52, 0x24, 0x02, 0x17, 0x4d, 0xd4, 0xf8, 0x9b, 0x01, 0x83, 0x63, 0x94, - 0x4c, 0x7c, 0x2e, 0x04, 0xe6, 0xb3, 0x37, 0x27, 0xe4, 0x39, 0xf4, 0xb3, 0x5a, 0x89, 0xcc, 0x34, - 0x46, 0xc6, 0xa4, 0x3f, 0x1d, 0xfc, 0xba, 0xda, 0xeb, 0xb3, 0xd6, 0x64, 0x1b, 0x4e, 0xf6, 0xa1, - 0x8f, 0x79, 0x26, 0x78, 0xec, 0x2e, 0x02, 0xf3, 0x96, 0x3e, 0x7c, 0xb7, 0xbc, 0xda, 0xeb, 0x9d, - 0x68, 0x73, 0x3e, 0x63, 0xbd, 0x1a, 0xcf, 0x03, 0xf2, 0x0c, 0xee, 0x79, 0x3c, 0xf7, 0x43, 0x37, - 0x14, 0x3c, 0x10, 0x99, 0x1b, 0x72, 0x0c, 0xcd, 0x6e, 0x75, 0x85, 0xed, 0x6a, 0x70, 0xa4, 0xfd, - 0x23, 0x8e, 0x21, 0x79, 0x04, 0xfd, 0xa4, 0x88, 0x5d, 0x2f, 0x52, 0x1e, 0x9a, 0x3b, 0x23, 0x63, - 0x32, 0x60, 0xbd, 0xa4, 0x88, 0xa7, 0x95, 0x1e, 0xbf, 0x85, 0x87, 0x5b, 0x8d, 0x99, 0xc0, 0x54, - 0x25, 0x28, 0xc8, 0x0b, 0x80, 0xa6, 0x59, 0xd5, 0xa6, 0xaa, 0xbe, 0x33, 0x1d, 0x94, 0x9b, 0xea, - 0xf3, 0xd9, 0xba, 0xfa, 0x3c, 0x18, 0x2f, 0x81, 0xe8, 0x98, 0x54, 0x65, 0x4d, 0x4a, 0x11, 0xe5, - 0xff, 0x97, 0x41, 0x4c, 0xb8, 0x83, 0x3c, 0x4e, 0x23, 0x91, 0xd5, 0xc3, 0xb3, 0x56, 0x56, 0x24, - 0xd3, 0x89, 0x68, 0x76, 0x47, 0xdd, 0x49, 0x8f, 0xb5, 0x72, 0xfc, 0x18, 0xac, 0x9b, 0xef, 0xb6, - 0x33, 0xbc, 0xfa, 0x6a, 0x40, 0xf7, 0x18, 0x25, 0x79, 0x0f, 0x70, 0xed, 0x9b, 0x0c, 0x9d, 0xcd, - 0x62, 0x38, 0x5b, 0xc3, 0x5b, 0x4f, 0xfe, 0x8a, 0xd6, 0xff, 0xcb, 0x07, 0xd8, 0xfd, 0x73, 0x4c, - 0xfb, 0xc6, 0xad, 0x2d, 0x6e, 0x3d, 0xfd, 0x37, 0x6f, 0xa3, 0xa7, 0xef, 0x2e, 0x7e, 0xda, 0x9d, - 0x8b, 0xd2, 0x36, 0x2e, 0x4b, 0xdb, 0xf8, 0x51, 0xda, 0xc6, 0x97, 0x95, 0xdd, 0xb9, 0x5c, 0xd9, - 0x9d, 0xef, 0x2b, 0xbb, 0xf3, 0x71, 0x5f, 0x2e, 0xf2, 0xb0, 0xf0, 0x1c, 0x5f, 0xc5, 0xf4, 0x40, - 0x46, 0xdc, 0x43, 0x7a, 0x20, 0x5f, 0xfa, 0x21, 0x5f, 0x24, 0xf4, 0x74, 0xbd, 0xfc, 0x67, 0xa9, - 0x40, 0xef, 0xb6, 0x5e, 0xc7, 0xd7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xba, 0x08, 0x98, - 0x17, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - RequestDAS(ctx context.Context, in *MsgRequestDAS, opts ...grpc.CallOption) (*MsgRequestDASResponse, error) - ReportDASResult(ctx context.Context, in *MsgReportDASResult, opts ...grpc.CallOption) (*MsgReportDASResultResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) RequestDAS(ctx context.Context, in *MsgRequestDAS, opts ...grpc.CallOption) (*MsgRequestDASResponse, error) { - out := new(MsgRequestDASResponse) - err := c.cc.Invoke(ctx, "/zgc.das.v1.Msg/RequestDAS", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ReportDASResult(ctx context.Context, in *MsgReportDASResult, opts ...grpc.CallOption) (*MsgReportDASResultResponse, error) { - out := new(MsgReportDASResultResponse) - err := c.cc.Invoke(ctx, "/zgc.das.v1.Msg/ReportDASResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - RequestDAS(context.Context, *MsgRequestDAS) (*MsgRequestDASResponse, error) - ReportDASResult(context.Context, *MsgReportDASResult) (*MsgReportDASResultResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) RequestDAS(ctx context.Context, req *MsgRequestDAS) (*MsgRequestDASResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RequestDAS not implemented") -} -func (*UnimplementedMsgServer) ReportDASResult(ctx context.Context, req *MsgReportDASResult) (*MsgReportDASResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReportDASResult not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_RequestDAS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRequestDAS) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RequestDAS(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zgc.das.v1.Msg/RequestDAS", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RequestDAS(ctx, req.(*MsgRequestDAS)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ReportDASResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgReportDASResult) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ReportDASResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zgc.das.v1.Msg/ReportDASResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ReportDASResult(ctx, req.(*MsgReportDASResult)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "zgc.das.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "RequestDAS", - Handler: _Msg_RequestDAS_Handler, - }, - { - MethodName: "ReportDASResult", - Handler: _Msg_ReportDASResult_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "zgc/das/v1/tx.proto", -} - -func (m *MsgRequestDAS) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRequestDAS) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRequestDAS) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NumBlobs != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.NumBlobs)) - i-- - dAtA[i] = 0x20 - } - if len(m.BatchHeaderHash) > 0 { - i -= len(m.BatchHeaderHash) - copy(dAtA[i:], m.BatchHeaderHash) - i = encodeVarintTx(dAtA, i, uint64(len(m.BatchHeaderHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.StreamID) > 0 { - i -= len(m.StreamID) - copy(dAtA[i:], m.StreamID) - i = encodeVarintTx(dAtA, i, uint64(len(m.StreamID))) - i-- - dAtA[i] = 0x12 - } - if len(m.Requester) > 0 { - i -= len(m.Requester) - copy(dAtA[i:], m.Requester) - i = encodeVarintTx(dAtA, i, uint64(len(m.Requester))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgRequestDASResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRequestDASResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRequestDASResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RequestID != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RequestID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgReportDASResult) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgReportDASResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgReportDASResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Results) > 0 { - for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { - i-- - if m.Results[iNdEx] { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - } - i = encodeVarintTx(dAtA, i, uint64(len(m.Results))) - i-- - dAtA[i] = 0x1a - } - if len(m.Sampler) > 0 { - i -= len(m.Sampler) - copy(dAtA[i:], m.Sampler) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sampler))) - i-- - dAtA[i] = 0x12 - } - if m.RequestID != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RequestID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgReportDASResultResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgReportDASResultResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgReportDASResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgRequestDAS) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Requester) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.StreamID) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.BatchHeaderHash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.NumBlobs != 0 { - n += 1 + sovTx(uint64(m.NumBlobs)) - } - return n -} - -func (m *MsgRequestDASResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestID != 0 { - n += 1 + sovTx(uint64(m.RequestID)) - } - return n -} - -func (m *MsgReportDASResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestID != 0 { - n += 1 + sovTx(uint64(m.RequestID)) - } - l = len(m.Sampler) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Results) > 0 { - n += 1 + sovTx(uint64(len(m.Results))) + len(m.Results)*1 - } - return n -} - -func (m *MsgReportDASResultResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgRequestDAS) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRequestDAS: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRequestDAS: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Requester", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Requester = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StreamID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StreamID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchHeaderHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BatchHeaderHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumBlobs", wireType) - } - m.NumBlobs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NumBlobs |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRequestDASResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRequestDASResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRequestDASResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) - } - m.RequestID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgReportDASResult) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgReportDASResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgReportDASResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) - } - m.RequestID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sampler", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sampler = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType == 0 { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Results = append(m.Results, bool(v != 0)) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - elementCount = packedLen - if elementCount != 0 && len(m.Results) == 0 { - m.Results = make([]bool, 0, elementCount) - } - for iNdEx < postIndex { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Results = append(m.Results, bool(v != 0)) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgReportDASResultResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgReportDASResultResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgReportDASResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/dasigners/v1/client/cli/tx.go b/x/dasigners/v1/client/cli/tx.go index 0bfd045b..a723d87d 100644 --- a/x/dasigners/v1/client/cli/tx.go +++ b/x/dasigners/v1/client/cli/tx.go @@ -3,7 +3,7 @@ package cli import ( "fmt" - "github.com/0glabs/0g-chain/x/das/v1/types" + "github.com/0glabs/0g-chain/x/dasigners/v1/types" "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" ) diff --git a/x/dasigners/v1/types/tx.pb.go b/x/dasigners/v1/types/tx.pb.go index 66132018..f4dcf891 100644 --- a/x/dasigners/v1/types/tx.pb.go +++ b/x/dasigners/v1/types/tx.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/0glabs/0g-chain/x/das/v1/types" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/gogo/protobuf/gogoproto" @@ -265,33 +264,32 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/tx.proto", fileDescriptor_8bfa0cc0bd2f98e0) } var fileDescriptor_8bfa0cc0bd2f98e0 = []byte{ - // 410 bytes of a gzipped FileDescriptorProto + // 399 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcf, 0xae, 0xd2, 0x40, - 0x18, 0xc5, 0x5b, 0x4c, 0x30, 0x8c, 0x44, 0xa5, 0x21, 0xda, 0x56, 0x32, 0xc1, 0x9a, 0x18, 0x8c, + 0x14, 0x87, 0x5b, 0x4c, 0x30, 0x8c, 0x44, 0xa5, 0x21, 0xda, 0x56, 0x32, 0xc1, 0x9a, 0x18, 0x8c, 0xb1, 0x03, 0xf8, 0x06, 0x1a, 0x97, 0x65, 0x51, 0xe2, 0xc6, 0x98, 0x98, 0x76, 0x18, 0x87, 0x06, 0xe8, 0x34, 0x9d, 0x29, 0x01, 0x9e, 0xc2, 0x87, 0xf1, 0x21, 0x58, 0xb2, 0x74, 0xe9, 0x85, 0x17, - 0xb9, 0x61, 0xfa, 0x07, 0x6e, 0x4b, 0xb8, 0xec, 0xe6, 0x9b, 0xef, 0xd7, 0x73, 0x4e, 0x4f, 0x5a, + 0xb9, 0x61, 0xfa, 0x07, 0x6e, 0x4b, 0xb8, 0xec, 0xe6, 0xcc, 0xf9, 0x7a, 0xbe, 0xd3, 0x5f, 0x5a, 0x60, 0x6c, 0x28, 0x46, 0x13, 0x8f, 0x07, 0x34, 0x24, 0x31, 0x47, 0xcb, 0x01, 0x12, 0x2b, 0x3b, - 0x8a, 0x99, 0x60, 0xda, 0xcb, 0x0d, 0xc5, 0x76, 0xb1, 0xb2, 0x97, 0x03, 0xd3, 0xc0, 0x8c, 0x2f, - 0x18, 0xff, 0x25, 0xf7, 0x28, 0x1d, 0x52, 0xd8, 0x6c, 0x53, 0x46, 0x59, 0x7a, 0x7f, 0x3c, 0x65, - 0xb7, 0x06, 0x65, 0x8c, 0xce, 0x09, 0x92, 0x93, 0x9f, 0xfc, 0x46, 0x5e, 0xb8, 0xce, 0x56, 0x7a, - 0x66, 0x7c, 0xb4, 0xa4, 0x24, 0x24, 0x3c, 0xc8, 0xa5, 0xba, 0x95, 0x48, 0xa7, 0x10, 0x92, 0xb0, - 0x30, 0x68, 0x39, 0x9c, 0xba, 0x84, 0x06, 0x5c, 0x90, 0x78, 0x2c, 0x77, 0x5a, 0x1f, 0xd4, 0x53, - 0x4a, 0x57, 0xbb, 0x6a, 0xef, 0xd9, 0x50, 0xb7, 0xcb, 0xf9, 0xed, 0x94, 0x74, 0x33, 0x4e, 0xeb, - 0x80, 0xc6, 0xf1, 0xe4, 0x89, 0x24, 0x26, 0x7a, 0xad, 0xab, 0xf6, 0x9a, 0xee, 0xe9, 0xc2, 0x7a, - 0x03, 0x8c, 0x8a, 0x89, 0x4b, 0x78, 0xc4, 0x42, 0x4e, 0xac, 0xaf, 0xe0, 0x85, 0xc3, 0xe9, 0xf7, - 0x68, 0xe2, 0x09, 0x32, 0x66, 0x78, 0x46, 0x84, 0xa6, 0x83, 0xa7, 0x1e, 0xc6, 0x2c, 0x09, 0x85, - 0x0c, 0xd0, 0x70, 0xf3, 0x51, 0x7b, 0x05, 0xea, 0x5c, 0x32, 0xd2, 0xa4, 0xe1, 0x66, 0x93, 0x65, - 0x80, 0xd7, 0x25, 0x91, 0x42, 0x7f, 0x04, 0xda, 0x67, 0xe6, 0x23, 0xb2, 0x12, 0xdf, 0x22, 0x86, - 0xa7, 0x57, 0x4c, 0xae, 0xbf, 0x0c, 0x04, 0x9d, 0x4b, 0x7a, 0xb9, 0xdf, 0xf0, 0x6f, 0x0d, 0x3c, - 0x71, 0x38, 0xd5, 0x7c, 0xf0, 0xbc, 0x54, 0xeb, 0xbb, 0x6a, 0x8d, 0x95, 0x5a, 0xcc, 0x8f, 0x37, - 0x40, 0xb9, 0x97, 0xf6, 0x13, 0x34, 0x1f, 0x14, 0xf7, 0xf6, 0xe2, 0xc3, 0xe7, 0x88, 0xf9, 0xe1, - 0x51, 0xa4, 0x50, 0x9f, 0x81, 0x56, 0xb5, 0xb6, 0xf7, 0x57, 0xf3, 0x15, 0x9c, 0x69, 0xdf, 0xc6, - 0xe5, 0x66, 0x5f, 0x9c, 0xed, 0x1d, 0x54, 0xb6, 0x7b, 0xa8, 0xee, 0xf6, 0x50, 0xfd, 0xbf, 0x87, - 0xea, 0x9f, 0x03, 0x54, 0x76, 0x07, 0xa8, 0xfc, 0x3b, 0x40, 0xe5, 0x07, 0xa2, 0x81, 0x98, 0x26, - 0xbe, 0x8d, 0xd9, 0x02, 0xf5, 0xe9, 0xdc, 0xf3, 0x39, 0xea, 0xd3, 0x4f, 0x78, 0xea, 0x05, 0x21, - 0x5a, 0x95, 0x7e, 0xba, 0x75, 0x44, 0xb8, 0x5f, 0x97, 0x9f, 0xf7, 0xe7, 0xfb, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xa3, 0x4c, 0x19, 0x64, 0x95, 0x03, 0x00, 0x00, + 0x8a, 0x99, 0x60, 0xda, 0xcb, 0x0d, 0xc5, 0x76, 0xd1, 0xb2, 0x97, 0x03, 0xd3, 0xc0, 0x8c, 0x2f, + 0x18, 0xff, 0x25, 0xfb, 0x28, 0x2d, 0x52, 0xd8, 0x6c, 0x53, 0x46, 0x59, 0x7a, 0x7f, 0x3c, 0x65, + 0xb7, 0x06, 0x65, 0x8c, 0xce, 0x09, 0x92, 0x95, 0x9f, 0xfc, 0x46, 0x5e, 0xb8, 0xce, 0x5a, 0xdd, + 0x8a, 0xf8, 0xa4, 0x92, 0x84, 0x85, 0x41, 0xcb, 0xe1, 0xd4, 0x25, 0x34, 0xe0, 0x82, 0xc4, 0x63, + 0xd9, 0xd3, 0xfa, 0xa0, 0x9e, 0x52, 0xba, 0xda, 0x55, 0x7b, 0xcf, 0x86, 0xba, 0x5d, 0xde, 0xd2, + 0x4e, 0x49, 0x37, 0xe3, 0xb4, 0x0e, 0x68, 0x1c, 0x4f, 0x9e, 0x48, 0x62, 0xa2, 0xd7, 0xba, 0x6a, + 0xaf, 0xe9, 0x9e, 0x2e, 0xac, 0x37, 0xc0, 0xa8, 0x48, 0x5c, 0xc2, 0x23, 0x16, 0x72, 0x62, 0x7d, + 0x05, 0x2f, 0x1c, 0x4e, 0xbf, 0x47, 0x13, 0x4f, 0x90, 0x31, 0xc3, 0x33, 0x22, 0x34, 0x1d, 0x3c, + 0xf5, 0x30, 0x66, 0x49, 0x28, 0xe4, 0x02, 0x0d, 0x37, 0x2f, 0xb5, 0x57, 0xa0, 0xce, 0x25, 0x23, + 0x25, 0x0d, 0x37, 0xab, 0x2c, 0x03, 0xbc, 0x2e, 0x0d, 0x29, 0xe6, 0x8f, 0x40, 0xfb, 0x4c, 0x3e, + 0x22, 0x2b, 0xf1, 0x2d, 0x62, 0x78, 0x7a, 0x45, 0x72, 0xfd, 0x65, 0x20, 0xe8, 0x5c, 0x9a, 0x97, + 0xfb, 0x86, 0x7f, 0x6b, 0xe0, 0x89, 0xc3, 0xa9, 0xe6, 0x83, 0xe7, 0xa5, 0x58, 0xdf, 0x55, 0x63, + 0xac, 0xc4, 0x62, 0x7e, 0xbc, 0x01, 0xca, 0x5d, 0xda, 0x4f, 0xd0, 0x7c, 0x10, 0xdc, 0xdb, 0x8b, + 0x0f, 0x9f, 0x23, 0xe6, 0x87, 0x47, 0x91, 0x62, 0xfa, 0x0c, 0xb4, 0xaa, 0xb1, 0xbd, 0xbf, 0xba, + 0x5f, 0xc1, 0x99, 0xf6, 0x6d, 0x5c, 0x2e, 0xfb, 0xe2, 0x6c, 0xef, 0xa0, 0xb2, 0xdd, 0x43, 0x75, + 0xb7, 0x87, 0xea, 0xff, 0x3d, 0x54, 0xff, 0x1c, 0xa0, 0xb2, 0x3b, 0x40, 0xe5, 0xdf, 0x01, 0x2a, + 0x3f, 0x10, 0x0d, 0xc4, 0x34, 0xf1, 0x6d, 0xcc, 0x16, 0xa8, 0x4f, 0xe7, 0x9e, 0xcf, 0x51, 0x9f, + 0x7e, 0xc2, 0x53, 0x2f, 0x08, 0xd1, 0xaa, 0xf4, 0x6b, 0xad, 0x23, 0xc2, 0xfd, 0xba, 0xfc, 0xbc, + 0x3f, 0xdf, 0x07, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x5a, 0xce, 0x9a, 0x7b, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From f8cf8525a41d02b5f33689c44b0947117a536694 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Tue, 21 May 2024 18:29:53 +0800 Subject: [PATCH 12/26] recover go mod file --- go.mod | 22 +++++++--------------- go.sum | 35 ----------------------------------- 2 files changed, 7 insertions(+), 50 deletions(-) diff --git a/go.mod b/go.mod index 338ababd..3d53e2d5 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/subosito/gotenv v1.4.2 github.com/tendermint/tendermint v0.34.27 github.com/tendermint/tm-db v0.6.7 - golang.org/x/crypto v0.23.0 + golang.org/x/crypto v0.14.0 google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 @@ -50,7 +50,6 @@ require ( github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect github.com/allegro/bigcache v1.2.1 // indirect - github.com/andybalholm/brotli v1.1.0 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go v1.44.122 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -84,12 +83,10 @@ require ( github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect - github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 // indirect github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect - github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect @@ -136,14 +133,13 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.8 // indirect - github.com/kr/text v0.2.0 // indirect + github.com/klauspost/compress v1.15.15 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect @@ -164,14 +160,12 @@ require ( github.com/prometheus/procfs v0.9.0 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rakyll/statik v0.1.7 // indirect - github.com/raviqqe/liche v0.0.0-20200229003944-f57a5d1c5be4 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.29.0 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spf13/afero v1.9.3 // indirect @@ -186,19 +180,17 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/ulikunitz/xz v0.5.10 // indirect - github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.53.0 // indirect github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.2 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb // indirect - golang.org/x/net v0.25.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/term v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.128.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 2043ba8f..bbbbb97a 100644 --- a/go.sum +++ b/go.sum @@ -246,8 +246,6 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= -github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -446,8 +444,6 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= @@ -477,8 +473,6 @@ github.com/evmos/go-ethereum v1.10.26-evmos-rc2 h1:tYghk1ZZ8X4/OQ4YI9hvtm8aSN8OS github.com/evmos/go-ethereum v1.10.26-evmos-rc2/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= @@ -831,19 +825,13 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.10.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -888,7 +876,6 @@ github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GW github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -904,8 +891,6 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1069,8 +1054,6 @@ github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= -github.com/raviqqe/liche v0.0.0-20200229003944-f57a5d1c5be4 h1:/24Dsgxxv7UMTvubnE6eJmyHRcTSum60viriQokArAQ= -github.com/raviqqe/liche v0.0.0-20200229003944-f57a5d1c5be4/go.mod h1:MPBuzBAJcp9B/3xrqfgR+ieBgpMzDqTeieaRP3ESJhk= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -1210,14 +1193,9 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.9.1-0.20200228200348-695f713fcf59/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= -github.com/valyala/fasthttp v1.53.0 h1:lW/+SUkOxCx2vlIu0iaImv4JLrVRnbbkpCoaawvA4zc= -github.com/valyala/fasthttp v1.53.0/go.mod h1:6dt4/8olwq9QARP/TDuPmWyWcl4byhpvTJ4AAtcz+QM= 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/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= @@ -1290,8 +1268,6 @@ golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1360,8 +1336,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/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-20190930134127-c5a3c61f89f3/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-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1409,8 +1383,6 @@ golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1558,19 +1530,14 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 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/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1584,8 +1551,6 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 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/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From b7ae5a4254db00ecc9f0c36fc4e4fd4935e8ec9f Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Thu, 9 May 2024 14:07:43 +0800 Subject: [PATCH 13/26] remove module's legacy code --- x/bep3/legacy/v0_17/migrate.go | 57 ---- x/bep3/legacy/v0_17/migrate_test.go | 176 ---------- x/bep3/legacy/v0_17/testdata/v16-bep3.json | 212 ------------- x/bep3/legacy/v0_17/testdata/v17-bep3.json | 212 ------------- x/issuance/legacy/v0_15/types.go | 53 ---- x/issuance/legacy/v0_16/migrate.go | 48 --- x/issuance/legacy/v0_16/migrate_test.go | 177 ----------- x/pricefeed/legacy/v0_15/types.go | 46 --- x/pricefeed/legacy/v0_16/migrate.go | 134 -------- x/pricefeed/legacy/v0_16/migrate_test.go | 353 --------------------- 10 files changed, 1468 deletions(-) delete mode 100644 x/bep3/legacy/v0_17/migrate.go delete mode 100644 x/bep3/legacy/v0_17/migrate_test.go delete mode 100644 x/bep3/legacy/v0_17/testdata/v16-bep3.json delete mode 100644 x/bep3/legacy/v0_17/testdata/v17-bep3.json delete mode 100644 x/issuance/legacy/v0_15/types.go delete mode 100644 x/issuance/legacy/v0_16/migrate.go delete mode 100644 x/issuance/legacy/v0_16/migrate_test.go delete mode 100644 x/pricefeed/legacy/v0_15/types.go delete mode 100644 x/pricefeed/legacy/v0_16/migrate.go delete mode 100644 x/pricefeed/legacy/v0_16/migrate_test.go diff --git a/x/bep3/legacy/v0_17/migrate.go b/x/bep3/legacy/v0_17/migrate.go deleted file mode 100644 index 4b60523c..00000000 --- a/x/bep3/legacy/v0_17/migrate.go +++ /dev/null @@ -1,57 +0,0 @@ -package v0_16 - -import ( - "fmt" - - "github.com/0glabs/0g-chain/x/bep3/types" -) - -// resetSwapForZeroHeight updates swap expiry/close heights to work when the chain height is reset to zero. -func resetSwapForZeroHeight(swap types.AtomicSwap) types.AtomicSwap { - switch status := swap.Status; status { - case types.SWAP_STATUS_COMPLETED: - // Reset closed block to one so completed swaps are not held in long term storage too long. - swap.ClosedBlock = 1 - case types.SWAP_STATUS_OPEN: - switch dir := swap.Direction; dir { - case types.SWAP_DIRECTION_INCOMING: - // Open incoming swaps can be expired safely. They haven't been claimed yet, so the outgoing swap on bnb will just timeout. - // The chain downtime cannot be accurately predicted, so it's easier to expire than to recalculate a correct expire height. - swap.ExpireHeight = 1 - swap.Status = types.SWAP_STATUS_EXPIRED - case types.SWAP_DIRECTION_OUTGOING: - // Open outgoing swaps should be extended to allow enough time to claim after the chain launches. - // They cannot be expired as there could be an open/claimed bnb swap. - swap.ExpireHeight = 1 + 24686 // default timeout used when sending swaps from 0g - case types.SWAP_DIRECTION_UNSPECIFIED: - default: - panic(fmt.Sprintf("unknown bep3 swap direction '%s'", dir)) - } - case types.SWAP_STATUS_EXPIRED: - // Once a swap is marked expired the expire height is ignored. However reset to 1 to be sure. - swap.ExpireHeight = 1 - case types.SWAP_STATUS_UNSPECIFIED: - default: - panic(fmt.Sprintf("unknown bep3 swap status '%s'", status)) - } - - return swap -} - -func resetSwapsForZeroHeight(oldSwaps types.AtomicSwaps) types.AtomicSwaps { - newSwaps := make(types.AtomicSwaps, len(oldSwaps)) - for i, oldSwap := range oldSwaps { - swap := resetSwapForZeroHeight(oldSwap) - newSwaps[i] = swap - } - return newSwaps -} - -func Migrate(oldState types.GenesisState) *types.GenesisState { - return &types.GenesisState{ - PreviousBlockTime: oldState.PreviousBlockTime, - Params: oldState.Params, - AtomicSwaps: resetSwapsForZeroHeight(oldState.AtomicSwaps), - Supplies: oldState.Supplies, - } -} diff --git a/x/bep3/legacy/v0_17/migrate_test.go b/x/bep3/legacy/v0_17/migrate_test.go deleted file mode 100644 index e5136899..00000000 --- a/x/bep3/legacy/v0_17/migrate_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package v0_16 - -import ( - "io/ioutil" - "path/filepath" - "testing" - "time" - - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - "github.com/tendermint/tendermint/libs/bytes" - - app "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/chaincfg" - "github.com/0glabs/0g-chain/x/bep3/types" -) - -type migrateTestSuite struct { - suite.Suite - - addresses []sdk.AccAddress - v16genstate types.GenesisState - cdc codec.Codec -} - -func (s *migrateTestSuite) SetupTest() { - chaincfg.SetSDKConfig() - - s.v16genstate = types.GenesisState{ - PreviousBlockTime: time.Date(2021, 4, 8, 15, 0, 0, 0, time.UTC), - Params: types.Params{}, - Supplies: types.AssetSupplies{}, - AtomicSwaps: types.AtomicSwaps{}, - } - - config := app.MakeEncodingConfig() - s.cdc = config.Marshaler - - _, accAddresses := app.GeneratePrivKeyAddressPairs(10) - s.addresses = accAddresses -} - -func (s *migrateTestSuite) TestMigrate_JSON() { - // Migrate v16 bep3 to v17 - file := filepath.Join("testdata", "v16-bep3.json") - data, err := ioutil.ReadFile(file) - s.Require().NoError(err) - err = s.cdc.UnmarshalJSON(data, &s.v16genstate) - s.Require().NoError(err) - genstate := Migrate(s.v16genstate) - - // Compare expect v16 bep3 json with migrated json - actual := s.cdc.MustMarshalJSON(genstate) - file = filepath.Join("testdata", "v17-bep3.json") - expected, err := ioutil.ReadFile(file) - s.Require().NoError(err) - s.Require().JSONEq(string(expected), string(actual)) -} - -func (s *migrateTestSuite) TestMigrate_Swaps() { - type swap struct { - ExpireHeight uint64 - CloseBlock int64 - Status types.SwapStatus - Direction types.SwapDirection - } - testcases := []struct { - name string - oldSwap swap - newSwap swap - }{ - { - name: "incoming open swap", - oldSwap: swap{ - // expire and close not set in open swaps - Status: types.SWAP_STATUS_OPEN, - Direction: types.SWAP_DIRECTION_INCOMING, - }, - newSwap: swap{ - ExpireHeight: 1, - Status: types.SWAP_STATUS_EXPIRED, - Direction: types.SWAP_DIRECTION_INCOMING, - }, - }, - { - name: "outgoing open swap", - oldSwap: swap{ - // expire and close not set in open swaps - Status: types.SWAP_STATUS_OPEN, - Direction: types.SWAP_DIRECTION_OUTGOING, - }, - newSwap: swap{ - ExpireHeight: 24687, - Status: types.SWAP_STATUS_OPEN, - Direction: types.SWAP_DIRECTION_OUTGOING, - }, - }, - { - name: "completed swap", - oldSwap: swap{ - ExpireHeight: 1000, - CloseBlock: 900, - Status: types.SWAP_STATUS_COMPLETED, - Direction: types.SWAP_DIRECTION_INCOMING, - }, - newSwap: swap{ - ExpireHeight: 1000, - CloseBlock: 1, - Status: types.SWAP_STATUS_COMPLETED, - Direction: types.SWAP_DIRECTION_INCOMING, - }, - }, - { - name: "expired swap", - oldSwap: swap{ - ExpireHeight: 1000, - CloseBlock: 900, - Status: types.SWAP_STATUS_EXPIRED, - Direction: types.SWAP_DIRECTION_INCOMING, - }, - newSwap: swap{ - ExpireHeight: 1, - CloseBlock: 900, - Status: types.SWAP_STATUS_EXPIRED, - Direction: types.SWAP_DIRECTION_INCOMING, - }, - }, - } - - for _, tc := range testcases { - s.Run(tc.name, func() { - oldSwaps := types.AtomicSwaps{ - { - Amount: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(12))), - RandomNumberHash: bytes.HexBytes{}, - ExpireHeight: tc.oldSwap.ExpireHeight, - Timestamp: 1110, - Sender: s.addresses[0], - Recipient: s.addresses[1], - RecipientOtherChain: s.addresses[0].String(), - SenderOtherChain: s.addresses[1].String(), - ClosedBlock: tc.oldSwap.CloseBlock, - Status: tc.oldSwap.Status, - CrossChain: true, - Direction: tc.oldSwap.Direction, - }, - } - expectedSwaps := types.AtomicSwaps{ - { - Amount: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(12))), - RandomNumberHash: bytes.HexBytes{}, - ExpireHeight: tc.newSwap.ExpireHeight, - Timestamp: 1110, - Sender: s.addresses[0], - Recipient: s.addresses[1], - RecipientOtherChain: s.addresses[0].String(), - SenderOtherChain: s.addresses[1].String(), - ClosedBlock: tc.newSwap.CloseBlock, - Status: tc.newSwap.Status, - CrossChain: true, - Direction: tc.newSwap.Direction, - }, - } - s.v16genstate.AtomicSwaps = oldSwaps - genState := Migrate(s.v16genstate) - s.Require().Len(genState.AtomicSwaps, 1) - s.Equal(expectedSwaps, genState.AtomicSwaps) - }) - } -} - -func TestMigrateTestSuite(t *testing.T) { - suite.Run(t, new(migrateTestSuite)) -} diff --git a/x/bep3/legacy/v0_17/testdata/v16-bep3.json b/x/bep3/legacy/v0_17/testdata/v16-bep3.json deleted file mode 100644 index 1e040204..00000000 --- a/x/bep3/legacy/v0_17/testdata/v16-bep3.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "atomic_swaps": [ - { - "amount": [ - { - "amount": "1999955998", - "denom": "btcb" - } - ], - "closed_block": "838115", - "cross_chain": true, - "direction": "SWAP_DIRECTION_INCOMING", - "expire_height": "838627", - "random_number_hash": "6F1CF8F2E13A0C0F0A359F54E47E4E265D766B8E006D2F00BDF994ABDEF1E9E4", - "recipient": "kava1fl2hs6y9vz986g5v52pdan9ga923n9mn5cxxkw", - "recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr", - "sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc", - "sender_other_chain": "bnb19k9wuv2j7c7ck8tmc7kav0r0cnt3esmkrpf25x", - "status": "SWAP_STATUS_COMPLETED", - "timestamp": "1636034914" - }, - { - "amount": [ - { - "amount": "19000000000", - "denom": "bnb" - } - ], - "closed_block": "1712118", - "cross_chain": true, - "direction": "SWAP_DIRECTION_OUTGOING", - "expire_height": "1736797", - "random_number_hash": "280EB832A37F2265CC82F3957CE603AAD57BAD7038B876A1F28953AFA29FA1C3", - "recipient": "kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6", - "recipient_other_chain": "bnb18nsgj50zvc4uq93w4j0ltz5gaxhwv7aq4qnq0p", - "sender": "kava1zw6gg4ztvly7zf25pa33mclav3spvj3ympxxna", - "sender_other_chain": "bnb1jh7uv2rm6339yue8k4mj9406k3509kr4wt5nxn", - "status": "SWAP_STATUS_COMPLETED", - "timestamp": "1641976566" - }, - { - "amount": [ - { - "amount": "999595462080", - "denom": "busd" - } - ], - "closed_block": "787122", - "cross_chain": true, - "direction": "SWAP_DIRECTION_INCOMING", - "expire_height": "811799", - "random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83", - "recipient": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl", - "recipient_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8", - "sender": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu", - "sender_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at", - "status": "SWAP_STATUS_EXPIRED", - "timestamp": "1635694492" - }, - { - "amount": [ - { - "amount": "999595462080", - "denom": "busd" - } - ], - "closed_block": "787122", - "cross_chain": true, - "direction": "SWAP_DIRECTION_OUTGOING", - "expire_height": "811799", - "random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83", - "recipient": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu", - "recipient_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at", - "sender": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl", - "sender_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8", - "status": "SWAP_STATUS_EXPIRED", - "timestamp": "1635694492" - }, - { - "amount": [ - { - "amount": "1000000", - "denom": "btcb" - } - ], - "closed_block": "0", - "cross_chain": true, - "direction": "SWAP_DIRECTION_OUTGOING", - "expire_height": "1730589", - "random_number_hash": "A74EA1AB58D312FDF1E872D18583CACCF294E639DDA4F303939E9ADCEC081D93", - "recipient": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc", - "recipient_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6", - "sender": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5", - "sender_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr", - "status": "SWAP_STATUS_OPEN", - "timestamp": "1641934114" - }, - { - "amount": [ - { - "amount": "1000000", - "denom": "btcb" - } - ], - "closed_block": "0", - "cross_chain": true, - "direction": "SWAP_DIRECTION_INCOMING", - "expire_height": "1740000", - "random_number_hash": "39E9ADCEC081D93A74EA1A83CACCF294E639DDA4F3039B58D312FDF1E872D185", - "recipient": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5", - "recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr", - "sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc", - "sender_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6", - "status": "SWAP_STATUS_OPEN", - "timestamp": "1641934114" - } - ], - "params": { - "asset_params": [ - { - "active": true, - "coin_id": "0", - "denom": "btcb", - "deputy_address": "kava1kla4wl0ccv7u85cemvs3y987hqk0afcv7vue84", - "fixed_fee": "2", - "max_block_lock": "86400", - "max_swap_amount": "2000000000", - "min_block_lock": "24686", - "min_swap_amount": "3", - "supply_limit": { - "limit": "100000000000", - "time_based_limit": "0", - "time_limited": false, - "time_period": "0s" - } - }, - { - "active": true, - "coin_id": "144", - "denom": "xrpb", - "deputy_address": "kava14q5sawxdxtpap5x5sgzj7v4sp3ucncjlpuk3hs", - "fixed_fee": "100000", - "max_block_lock": "86400", - "max_swap_amount": "250000000000000", - "min_block_lock": "24686", - "min_swap_amount": "100001", - "supply_limit": { - "limit": "2000000000000000", - "time_based_limit": "0", - "time_limited": false, - "time_period": "0s" - } - }, - { - "active": true, - "coin_id": "714", - "denom": "bnb", - "deputy_address": "kava1agcvt07tcw0tglu0hmwdecsnuxp2yd45f3avgm", - "fixed_fee": "1000", - "max_block_lock": "86400", - "max_swap_amount": "500000000000", - "min_block_lock": "24686", - "min_swap_amount": "1001", - "supply_limit": { - "limit": "100000000000000", - "time_based_limit": "0", - "time_limited": false, - "time_period": "0s" - } - }, - { - "active": true, - "coin_id": "727", - "denom": "busd", - "deputy_address": "kava1j9je7f6s0v6k7dmgv6u5k5ru202f5ffsc7af04", - "fixed_fee": "20000", - "max_block_lock": "86400", - "max_swap_amount": "100000000000000", - "min_block_lock": "24686", - "min_swap_amount": "20001", - "supply_limit": { - "limit": "2000000000000000", - "time_based_limit": "0", - "time_limited": false, - "time_period": "0s" - } - } - ] - }, - "previous_block_time": "1970-01-01T00:00:00Z", - "supplies": [ - { - "current_supply": { - "amount": "30467559434006", - "denom": "bnb" - }, - "incoming_supply": { - "amount": "0", - "denom": "bnb" - }, - "outgoing_supply": { - "amount": "0", - "denom": "bnb" - }, - "time_elapsed": "0s", - "time_limited_current_supply": { - "amount": "0", - "denom": "bnb" - } - } - ] -} \ No newline at end of file diff --git a/x/bep3/legacy/v0_17/testdata/v17-bep3.json b/x/bep3/legacy/v0_17/testdata/v17-bep3.json deleted file mode 100644 index 3861ff92..00000000 --- a/x/bep3/legacy/v0_17/testdata/v17-bep3.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "atomic_swaps": [ - { - "amount": [ - { - "amount": "1999955998", - "denom": "btcb" - } - ], - "closed_block": "1", - "cross_chain": true, - "direction": "SWAP_DIRECTION_INCOMING", - "expire_height": "838627", - "random_number_hash": "6F1CF8F2E13A0C0F0A359F54E47E4E265D766B8E006D2F00BDF994ABDEF1E9E4", - "recipient": "kava1fl2hs6y9vz986g5v52pdan9ga923n9mn5cxxkw", - "recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr", - "sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc", - "sender_other_chain": "bnb19k9wuv2j7c7ck8tmc7kav0r0cnt3esmkrpf25x", - "status": "SWAP_STATUS_COMPLETED", - "timestamp": "1636034914" - }, - { - "amount": [ - { - "amount": "19000000000", - "denom": "bnb" - } - ], - "closed_block": "1", - "cross_chain": true, - "direction": "SWAP_DIRECTION_OUTGOING", - "expire_height": "1736797", - "random_number_hash": "280EB832A37F2265CC82F3957CE603AAD57BAD7038B876A1F28953AFA29FA1C3", - "recipient": "kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6", - "recipient_other_chain": "bnb18nsgj50zvc4uq93w4j0ltz5gaxhwv7aq4qnq0p", - "sender": "kava1zw6gg4ztvly7zf25pa33mclav3spvj3ympxxna", - "sender_other_chain": "bnb1jh7uv2rm6339yue8k4mj9406k3509kr4wt5nxn", - "status": "SWAP_STATUS_COMPLETED", - "timestamp": "1641976566" - }, - { - "amount": [ - { - "amount": "999595462080", - "denom": "busd" - } - ], - "closed_block": "787122", - "cross_chain": true, - "direction": "SWAP_DIRECTION_INCOMING", - "expire_height": "1", - "random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83", - "recipient": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl", - "recipient_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8", - "sender": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu", - "sender_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at", - "status": "SWAP_STATUS_EXPIRED", - "timestamp": "1635694492" - }, - { - "amount": [ - { - "amount": "999595462080", - "denom": "busd" - } - ], - "closed_block": "787122", - "cross_chain": true, - "direction": "SWAP_DIRECTION_OUTGOING", - "expire_height": "1", - "random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83", - "recipient": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu", - "recipient_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at", - "sender": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl", - "sender_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8", - "status": "SWAP_STATUS_EXPIRED", - "timestamp": "1635694492" - }, - { - "amount": [ - { - "amount": "1000000", - "denom": "btcb" - } - ], - "closed_block": "0", - "cross_chain": true, - "direction": "SWAP_DIRECTION_OUTGOING", - "expire_height": "24687", - "random_number_hash": "A74EA1AB58D312FDF1E872D18583CACCF294E639DDA4F303939E9ADCEC081D93", - "recipient": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc", - "recipient_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6", - "sender": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5", - "sender_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr", - "status": "SWAP_STATUS_OPEN", - "timestamp": "1641934114" - }, - { - "amount": [ - { - "amount": "1000000", - "denom": "btcb" - } - ], - "closed_block": "0", - "cross_chain": true, - "direction": "SWAP_DIRECTION_INCOMING", - "expire_height": "1", - "random_number_hash": "39E9ADCEC081D93A74EA1A83CACCF294E639DDA4F3039B58D312FDF1E872D185", - "recipient": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5", - "recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr", - "sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc", - "sender_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6", - "status": "SWAP_STATUS_EXPIRED", - "timestamp": "1641934114" - } - ], - "params": { - "asset_params": [ - { - "active": true, - "coin_id": "0", - "denom": "btcb", - "deputy_address": "kava1kla4wl0ccv7u85cemvs3y987hqk0afcv7vue84", - "fixed_fee": "2", - "max_block_lock": "86400", - "max_swap_amount": "2000000000", - "min_block_lock": "24686", - "min_swap_amount": "3", - "supply_limit": { - "limit": "100000000000", - "time_based_limit": "0", - "time_limited": false, - "time_period": "0s" - } - }, - { - "active": true, - "coin_id": "144", - "denom": "xrpb", - "deputy_address": "kava14q5sawxdxtpap5x5sgzj7v4sp3ucncjlpuk3hs", - "fixed_fee": "100000", - "max_block_lock": "86400", - "max_swap_amount": "250000000000000", - "min_block_lock": "24686", - "min_swap_amount": "100001", - "supply_limit": { - "limit": "2000000000000000", - "time_based_limit": "0", - "time_limited": false, - "time_period": "0s" - } - }, - { - "active": true, - "coin_id": "714", - "denom": "bnb", - "deputy_address": "kava1agcvt07tcw0tglu0hmwdecsnuxp2yd45f3avgm", - "fixed_fee": "1000", - "max_block_lock": "86400", - "max_swap_amount": "500000000000", - "min_block_lock": "24686", - "min_swap_amount": "1001", - "supply_limit": { - "limit": "100000000000000", - "time_based_limit": "0", - "time_limited": false, - "time_period": "0s" - } - }, - { - "active": true, - "coin_id": "727", - "denom": "busd", - "deputy_address": "kava1j9je7f6s0v6k7dmgv6u5k5ru202f5ffsc7af04", - "fixed_fee": "20000", - "max_block_lock": "86400", - "max_swap_amount": "100000000000000", - "min_block_lock": "24686", - "min_swap_amount": "20001", - "supply_limit": { - "limit": "2000000000000000", - "time_based_limit": "0", - "time_limited": false, - "time_period": "0s" - } - } - ] - }, - "previous_block_time": "1970-01-01T00:00:00Z", - "supplies": [ - { - "current_supply": { - "amount": "30467559434006", - "denom": "bnb" - }, - "incoming_supply": { - "amount": "0", - "denom": "bnb" - }, - "outgoing_supply": { - "amount": "0", - "denom": "bnb" - }, - "time_elapsed": "0s", - "time_limited_current_supply": { - "amount": "0", - "denom": "bnb" - } - } - ] -} \ No newline at end of file diff --git a/x/issuance/legacy/v0_15/types.go b/x/issuance/legacy/v0_15/types.go deleted file mode 100644 index f76a60c2..00000000 --- a/x/issuance/legacy/v0_15/types.go +++ /dev/null @@ -1,53 +0,0 @@ -package v0_15 - -import ( - "time" - - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName The name that will be used throughout the module - ModuleName = "issuance" -) - -// GenesisState is the state that must be provided at genesis for the issuance module -type GenesisState struct { - Params Params `json:"params" yaml:"params"` - Supplies AssetSupplies `json:"supplies" yaml:"supplies"` -} - -// Params governance parameters for the issuance module -type Params struct { - Assets Assets `json:"assets" yaml:"assets"` -} - -// Assets slice of Asset -type Assets []Asset - -// Asset type for assets in the issuance module -type Asset struct { - Owner sdk.AccAddress `json:"owner" yaml:"owner"` - Denom string `json:"denom" yaml:"denom"` - BlockedAddresses []sdk.AccAddress `json:"blocked_addresses" yaml:"blocked_addresses"` - Paused bool `json:"paused" yaml:"paused"` - Blockable bool `json:"blockable" yaml:"blockable"` - RateLimit RateLimit `json:"rate_limit" yaml:"rate_limit"` -} - -// RateLimit parameters for rate-limiting the supply of an issued asset -type RateLimit struct { - Active bool `json:"active" yaml:"active"` - Limit sdkmath.Int `json:"limit" yaml:"limit"` - TimePeriod time.Duration `json:"time_period" yaml:"time_period"` -} - -// AssetSupplies is a slice of AssetSupply -type AssetSupplies []AssetSupply - -// AssetSupply contains information about an asset's rate-limited supply (the total supply of the asset is tracked in the top-level supply module) -type AssetSupply struct { - CurrentSupply sdk.Coin `json:"current_supply" yaml:"current_supply"` - TimeElapsed time.Duration `json:"time_elapsed" yaml:"time_elapsed"` -} diff --git a/x/issuance/legacy/v0_16/migrate.go b/x/issuance/legacy/v0_16/migrate.go deleted file mode 100644 index 610f9da0..00000000 --- a/x/issuance/legacy/v0_16/migrate.go +++ /dev/null @@ -1,48 +0,0 @@ -package v0_16 - -import ( - v015issuance "github.com/0glabs/0g-chain/x/issuance/legacy/v0_15" - v016issuance "github.com/0glabs/0g-chain/x/issuance/types" -) - -func migrateParams(params v015issuance.Params) v016issuance.Params { - assets := make([]v016issuance.Asset, len(params.Assets)) - for i, asset := range params.Assets { - blockedAddresses := make([]string, len(asset.BlockedAddresses)) - for i, addr := range asset.BlockedAddresses { - blockedAddresses[i] = addr.String() - } - assets[i] = v016issuance.Asset{ - Owner: asset.Owner.String(), - Denom: asset.Denom, - BlockedAddresses: blockedAddresses, - Paused: asset.Paused, - Blockable: asset.Blockable, - RateLimit: v016issuance.RateLimit{ - Active: asset.RateLimit.Active, - Limit: asset.RateLimit.Limit, - TimePeriod: asset.RateLimit.TimePeriod, - }, - } - } - return v016issuance.Params{Assets: assets} -} - -func migrateSupplies(oldSupplies v015issuance.AssetSupplies) []v016issuance.AssetSupply { - supplies := make([]v016issuance.AssetSupply, len(oldSupplies)) - for i, supply := range oldSupplies { - supplies[i] = v016issuance.AssetSupply{ - CurrentSupply: supply.CurrentSupply, - TimeElapsed: supply.TimeElapsed, - } - } - return supplies -} - -// Migrate converts v0.15 issuance state and returns it in v0.16 format -func Migrate(oldState v015issuance.GenesisState) *v016issuance.GenesisState { - return &v016issuance.GenesisState{ - Params: migrateParams(oldState.Params), - Supplies: migrateSupplies(oldState.Supplies), - } -} diff --git a/x/issuance/legacy/v0_16/migrate_test.go b/x/issuance/legacy/v0_16/migrate_test.go deleted file mode 100644 index 158920a2..00000000 --- a/x/issuance/legacy/v0_16/migrate_test.go +++ /dev/null @@ -1,177 +0,0 @@ -package v0_16 - -import ( - "testing" - "time" - - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - - app "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/chaincfg" - v015issuance "github.com/0glabs/0g-chain/x/issuance/legacy/v0_15" - v016issuance "github.com/0glabs/0g-chain/x/issuance/types" -) - -type migrateTestSuite struct { - suite.Suite - - addresses []sdk.AccAddress - v15genstate v015issuance.GenesisState - cdc codec.Codec - legacyCdc *codec.LegacyAmino -} - -func (s *migrateTestSuite) SetupTest() { - chaincfg.SetSDKConfig() - - s.v15genstate = v015issuance.GenesisState{ - Params: v015issuance.Params{}, - Supplies: v015issuance.AssetSupplies{}, - } - - config := app.MakeEncodingConfig() - s.cdc = config.Marshaler - - legacyCodec := codec.NewLegacyAmino() - s.legacyCdc = legacyCodec - - _, accAddresses := app.GeneratePrivKeyAddressPairs(10) - s.addresses = accAddresses -} - -func (s *migrateTestSuite) TestMigrate_JSON() { - // Migrate v15 issuance to v16 - data := `{ - "params": { - "assets": [ - { - "blockable": true, - "blocked_addresses": null, - "denom": "hbtc", - "owner": "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8", - "paused": false, - "rate_limit": { - "active": false, - "limit": "0", - "time_period": "0" - } - } - ] - }, - "supplies": [ - { - "current_supply": { "denom": "ua0gi", "amount": "100" }, - "time_elapsed": "3600000000000" - }, - { - "current_supply": { "denom": "bnb", "amount": "300" }, - "time_elapsed": "300000000000" - } - ] - }` - err := s.legacyCdc.UnmarshalJSON([]byte(data), &s.v15genstate) - s.Require().NoError(err) - genstate := Migrate(s.v15genstate) - - // Compare expect v16 issuance json with migrated json - expected := `{ - "params": { - "assets": [ - { - "blockable": true, - "blocked_addresses": [], - "denom": "hbtc", - "owner": "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8", - "paused": false, - "rate_limit": { - "active": false, - "limit": "0", - "time_period": "0s" - } - } - ] - }, - "supplies": [ - { - "current_supply": { "denom": "ua0gi", "amount": "100" }, - "time_elapsed": "3600s" - }, - { - "current_supply": { "denom": "bnb", "amount": "300" }, - "time_elapsed": "300s" - } - ] - }` - actual := s.cdc.MustMarshalJSON(genstate) - s.Require().NoError(err) - s.Require().JSONEq(expected, string(actual)) -} - -func (s *migrateTestSuite) TestMigrate_Params() { - s.v15genstate.Params = v015issuance.Params{ - Assets: v015issuance.Assets{ - { - Owner: s.addresses[0], - Denom: "ua0gi", - BlockedAddresses: s.addresses[1:2], - Paused: true, - Blockable: true, - RateLimit: v015issuance.RateLimit{ - Active: true, - Limit: sdkmath.NewInt(10), - TimePeriod: 1 * time.Hour, - }, - }, - }, - } - expectedParams := v016issuance.Params{ - Assets: []v016issuance.Asset{ - { - Owner: s.addresses[0].String(), - Denom: "ua0gi", - BlockedAddresses: []string{s.addresses[1].String()}, - Paused: true, - Blockable: true, - RateLimit: v016issuance.RateLimit{ - Active: true, - Limit: sdkmath.NewInt(10), - TimePeriod: 1 * time.Hour, - }, - }, - }, - } - genState := Migrate(s.v15genstate) - s.Require().Equal(expectedParams, genState.Params) -} - -func (s *migrateTestSuite) TestMigrate_Supplies() { - s.v15genstate.Supplies = v015issuance.AssetSupplies{ - { - CurrentSupply: sdk.NewCoin("ua0gi", sdkmath.NewInt(100)), - TimeElapsed: time.Duration(1 * time.Hour), - }, - { - CurrentSupply: sdk.NewCoin("bnb", sdkmath.NewInt(300)), - TimeElapsed: time.Duration(5 * time.Minute), - }, - } - expected := []v016issuance.AssetSupply{ - { - CurrentSupply: sdk.NewCoin("ua0gi", sdkmath.NewInt(100)), - TimeElapsed: time.Duration(1 * time.Hour), - }, - { - CurrentSupply: sdk.NewCoin("bnb", sdkmath.NewInt(300)), - TimeElapsed: time.Duration(5 * time.Minute), - }, - } - genState := Migrate(s.v15genstate) - s.Require().Equal(expected, genState.Supplies) -} - -func TestIssuanceMigrateTestSuite(t *testing.T) { - suite.Run(t, new(migrateTestSuite)) -} diff --git a/x/pricefeed/legacy/v0_15/types.go b/x/pricefeed/legacy/v0_15/types.go deleted file mode 100644 index 0a9b6722..00000000 --- a/x/pricefeed/legacy/v0_15/types.go +++ /dev/null @@ -1,46 +0,0 @@ -package v0_15 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName The name that will be used throughout the module - ModuleName = "pricefeed" -) - -// GenesisState - pricefeed state that must be provided at genesis -type GenesisState struct { - Params Params `json:"params" yaml:"params"` - PostedPrices PostedPrices `json:"posted_prices" yaml:"posted_prices"` -} - -// Params params for pricefeed. Can be altered via governance -type Params struct { - Markets Markets `json:"markets" yaml:"markets"` // Array containing the markets supported by the pricefeed -} - -// Markets array type for oracle -type Markets []Market - -// Market an asset in the pricefeed -type Market struct { - MarketID string `json:"market_id" yaml:"market_id"` - BaseAsset string `json:"base_asset" yaml:"base_asset"` - QuoteAsset string `json:"quote_asset" yaml:"quote_asset"` - Oracles []sdk.AccAddress `json:"oracles" yaml:"oracles"` - Active bool `json:"active" yaml:"active"` -} - -// PostedPrices type for an array of PostedPrice -type PostedPrices []PostedPrice - -// PostedPrice price for market posted by a specific oracle -type PostedPrice struct { - MarketID string `json:"market_id" yaml:"market_id"` - OracleAddress sdk.AccAddress `json:"oracle_address" yaml:"oracle_address"` - Price sdk.Dec `json:"price" yaml:"price"` - Expiry time.Time `json:"expiry" yaml:"expiry"` -} diff --git a/x/pricefeed/legacy/v0_16/migrate.go b/x/pricefeed/legacy/v0_16/migrate.go deleted file mode 100644 index 6634ac19..00000000 --- a/x/pricefeed/legacy/v0_16/migrate.go +++ /dev/null @@ -1,134 +0,0 @@ -package v0_16 - -import ( - v015pricefeed "github.com/0glabs/0g-chain/x/pricefeed/legacy/v0_15" - v016pricefeed "github.com/0glabs/0g-chain/x/pricefeed/types" - "github.com/cosmos/cosmos-sdk/types" -) - -var NewIBCMarkets = []v016pricefeed.Market{ - { - MarketID: "atom:usd", - BaseAsset: "atom", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "atom:usd:30", - BaseAsset: "atom", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "akt:usd", - BaseAsset: "akt", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "akt:usd:30", - BaseAsset: "akt", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "luna:usd", - BaseAsset: "luna", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "luna:usd:30", - BaseAsset: "luna", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "osmo:usd", - BaseAsset: "osmo", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "osmo:usd:30", - BaseAsset: "osmo", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "ust:usd", - BaseAsset: "ust", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, - { - MarketID: "ust:usd:30", - BaseAsset: "ust", - QuoteAsset: "usd", - Oracles: nil, - Active: true, - }, -} - -func migrateParams(params v015pricefeed.Params) v016pricefeed.Params { - markets := make(v016pricefeed.Markets, len(params.Markets)) - for i, market := range params.Markets { - markets[i] = v016pricefeed.Market{ - MarketID: market.MarketID, - BaseAsset: market.BaseAsset, - QuoteAsset: market.QuoteAsset, - Oracles: market.Oracles, - Active: market.Active, - } - } - - markets = addIbcMarkets(markets) - - return v016pricefeed.Params{Markets: markets} -} - -func addIbcMarkets(markets v016pricefeed.Markets) v016pricefeed.Markets { - var oracles []types.AccAddress - - if len(markets) > 0 { - oracles = markets[0].Oracles - } - - for _, newMarket := range NewIBCMarkets { - // newMarket is a copy, should not affect other uses of NewIBCMarkets - newMarket.Oracles = oracles - markets = append(markets, newMarket) - } - - return markets -} - -func migratePostedPrices(oldPostedPrices v015pricefeed.PostedPrices) v016pricefeed.PostedPrices { - newPrices := make(v016pricefeed.PostedPrices, len(oldPostedPrices)) - for i, price := range oldPostedPrices { - newPrices[i] = v016pricefeed.PostedPrice{ - MarketID: price.MarketID, - OracleAddress: price.OracleAddress, - Price: price.Price, - Expiry: price.Expiry, - } - } - return newPrices -} - -// Migrate converts v0.15 pricefeed state and returns it in v0.16 format -func Migrate(oldState v015pricefeed.GenesisState) *v016pricefeed.GenesisState { - return &v016pricefeed.GenesisState{ - Params: migrateParams(oldState.Params), - PostedPrices: migratePostedPrices(oldState.PostedPrices), - } -} diff --git a/x/pricefeed/legacy/v0_16/migrate_test.go b/x/pricefeed/legacy/v0_16/migrate_test.go deleted file mode 100644 index 3d4f1507..00000000 --- a/x/pricefeed/legacy/v0_16/migrate_test.go +++ /dev/null @@ -1,353 +0,0 @@ -package v0_16 - -import ( - "testing" - "time" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - - app "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/chaincfg" - v015pricefeed "github.com/0glabs/0g-chain/x/pricefeed/legacy/v0_15" - v016pricefeed "github.com/0glabs/0g-chain/x/pricefeed/types" -) - -type migrateTestSuite struct { - suite.Suite - - addresses []sdk.AccAddress - v15genstate v015pricefeed.GenesisState - cdc codec.Codec - legacyCdc *codec.LegacyAmino -} - -func (s *migrateTestSuite) SetupTest() { - chaincfg.SetSDKConfig() - - s.v15genstate = v015pricefeed.GenesisState{ - Params: v015pricefeed.Params{}, - PostedPrices: v015pricefeed.PostedPrices{}, - } - - config := app.MakeEncodingConfig() - s.cdc = config.Marshaler - - legacyCodec := codec.NewLegacyAmino() - s.legacyCdc = legacyCodec - - _, accAddresses := app.GeneratePrivKeyAddressPairs(10) - s.addresses = accAddresses -} - -func (s *migrateTestSuite) TestMigrate_JSON() { - // Migrate v15 pricefeed to v16 - v15Params := `{ - "params": { - "markets": [ - { - "active": true, - "base_asset": "bnb", - "market_id": "bnb:usd", - "oracles": ["0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8"], - "quote_asset": "usd" - }, - { - "active": true, - "base_asset": "bnb", - "market_id": "bnb:usd:30", - "oracles": ["0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8"], - "quote_asset": "usd" - } - ] - }, - "posted_prices": [ - { - "expiry": "2022-07-20T00:00:00Z", - "market_id": "bnb:usd", - "oracle_address": "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8", - "price": "215.962650000000001782" - }, - { - "expiry": "2022-07-20T00:00:00Z", - "market_id": "bnb:usd:30", - "oracle_address": "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8", - "price": "217.962650000000001782" - } - ] - }` - - expectedV16Params := `{ - "params": { - "markets": [ - { - "market_id": "bnb:usd", - "base_asset": "bnb", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "bnb:usd:30", - "base_asset": "bnb", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "atom:usd", - "base_asset": "atom", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "atom:usd:30", - "base_asset": "atom", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "akt:usd", - "base_asset": "akt", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "akt:usd:30", - "base_asset": "akt", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "luna:usd", - "base_asset": "luna", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "luna:usd:30", - "base_asset": "luna", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "osmo:usd", - "base_asset": "osmo", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "osmo:usd:30", - "base_asset": "osmo", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "ust:usd", - "base_asset": "ust", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - }, - { - "market_id": "ust:usd:30", - "base_asset": "ust", - "quote_asset": "usd", - "oracles": [ - "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8" - ], - "active": true - } - ] - }, - "posted_prices": [ - { - "market_id": "bnb:usd", - "oracle_address": "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8", - "price": "215.962650000000001782", - "expiry": "2022-07-20T00:00:00Z" - }, - { - "market_id": "bnb:usd:30", - "oracle_address": "0g1ffv7nhd3z6sych2qpqkk03ec6hzkmufyhp5hf8", - "price": "217.962650000000001782", - "expiry": "2022-07-20T00:00:00Z" - } - ] - }` - - err := s.legacyCdc.UnmarshalJSON([]byte(v15Params), &s.v15genstate) - s.Require().NoError(err) - genstate := Migrate(s.v15genstate) - - // v16 pricefeed json should be the same as v15 but with IBC markets added - actual := s.cdc.MustMarshalJSON(genstate) - - s.Require().NoError(err) - s.Require().JSONEq(expectedV16Params, string(actual)) -} - -func (s *migrateTestSuite) TestMigrate_Params() { - s.v15genstate.Params = v015pricefeed.Params{ - Markets: v015pricefeed.Markets{ - { - MarketID: "market-1", - BaseAsset: "a0gi", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - }, - } - expectedParams := v016pricefeed.Params{ - Markets: v016pricefeed.Markets{ - { - MarketID: "market-1", - BaseAsset: "a0gi", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "atom:usd", - BaseAsset: "atom", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "atom:usd:30", - BaseAsset: "atom", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "akt:usd", - BaseAsset: "akt", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "akt:usd:30", - BaseAsset: "akt", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "luna:usd", - BaseAsset: "luna", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "luna:usd:30", - BaseAsset: "luna", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "osmo:usd", - BaseAsset: "osmo", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "osmo:usd:30", - BaseAsset: "osmo", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "ust:usd", - BaseAsset: "ust", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - { - MarketID: "ust:usd:30", - BaseAsset: "ust", - QuoteAsset: "usd", - Oracles: s.addresses, - Active: true, - }, - }, - } - genState := Migrate(s.v15genstate) - s.Require().Equal(expectedParams, genState.Params) -} - -func (s *migrateTestSuite) TestMigrate_PostedPrices() { - s.v15genstate.PostedPrices = v015pricefeed.PostedPrices{ - { - MarketID: "market-1", - OracleAddress: s.addresses[0], - Price: sdk.MustNewDecFromStr("1.2"), - Expiry: time.Date(2020, time.January, 1, 0, 0, 0, 0, time.UTC), - }, - { - MarketID: "market-2", - OracleAddress: s.addresses[1], - Price: sdk.MustNewDecFromStr("1.899"), - Expiry: time.Date(2021, time.January, 1, 0, 0, 0, 0, time.UTC), - }, - } - expected := v016pricefeed.PostedPrices{ - { - MarketID: "market-1", - OracleAddress: s.addresses[0], - Price: sdk.MustNewDecFromStr("1.2"), - Expiry: time.Date(2020, time.January, 1, 0, 0, 0, 0, time.UTC), - }, - { - MarketID: "market-2", - OracleAddress: s.addresses[1], - Price: sdk.MustNewDecFromStr("1.899"), - Expiry: time.Date(2021, time.January, 1, 0, 0, 0, 0, time.UTC), - }, - } - genState := Migrate(s.v15genstate) - s.Require().Equal(expected, genState.PostedPrices) -} - -func TestPriceFeedMigrateTestSuite(t *testing.T) { - suite.Run(t, new(migrateTestSuite)) -} From a4ed55e9f32113a74cd1c50a8798837d5cd30086 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Thu, 9 May 2024 19:35:16 +0800 Subject: [PATCH 14/26] fix unit test --- app/_simulate_tx_test.go | 6 +- app/ante/ante_test.go | 4 +- app/ante/authorized_test.go | 9 +- app/ante/authz_test.go | 7 +- app/ante/eip712_test.go | 25 +- app/ante/min_gas_filter_test.go | 3 +- app/ante/vesting_test.go | 7 +- app/test_common.go | 8 +- chaincfg/coin_helper.go | 57 +++ chaincfg/denoms.go | 37 ++ chaincfg/denoms_test.go | 80 +++ cli_test/cli_test.go | 2 +- cmd/0gchaind/root.go | 2 +- go.mod | 2 + go.sum | 4 + migrate/utils/periodic_vesting_reset_test.go | 47 +- .../zgc/evmutil/v1beta1/conversion_pair.proto | 2 +- proto/zgc/evmutil/v1beta1/tx.proto | 2 +- tests/e2e/e2e_convert_cosmos_coins_test.go | 15 +- tests/e2e/e2e_evm_contracts_test.go | 22 +- tests/e2e/e2e_min_fees_test.go | 11 +- tests/e2e/e2e_test.go | 41 +- tests/e2e/e2e_upgrade_gov_and_authz_test.go | 8 +- tests/e2e/runner/chain.go | 3 +- tests/e2e/testutil/account.go | 2 +- x/bep3/client/cli/query.go | 4 +- x/bep3/keeper/msg_server_test.go | 3 +- x/bep3/keeper/querier_test.go | 3 +- x/bep3/types/genesis_test.go | 2 +- x/bep3/types/supply_test.go | 3 +- x/committee/keeper/msg_server_test.go | 4 +- x/committee/types/committee.go | 3 +- x/council/v1/client/cli/tx.go | 6 +- x/council/v1/types/codec.go | 4 +- x/evmutil/keeper/bank_keeper.go | 183 ++++--- x/evmutil/keeper/bank_keeper_test.go | 475 +++++++++--------- x/evmutil/keeper/invariants.go | 3 +- x/evmutil/keeper/invariants_test.go | 7 +- x/evmutil/keeper/keeper.go | 12 +- x/evmutil/testutil/suite.go | 33 +- x/evmutil/types/conversion_pair.pb.go | 30 +- x/evmutil/types/conversion_pairs_test.go | 19 +- x/evmutil/types/params_test.go | 4 +- x/evmutil/types/tx.pb.go | 40 +- x/pricefeed/types/key_test.go | 7 +- x/validator-vesting/querier.go | 7 +- 46 files changed, 728 insertions(+), 530 deletions(-) create mode 100644 chaincfg/coin_helper.go create mode 100644 chaincfg/denoms.go create mode 100644 chaincfg/denoms_test.go diff --git a/app/_simulate_tx_test.go b/app/_simulate_tx_test.go index 834ee988..15c4cfec 100644 --- a/app/_simulate_tx_test.go +++ b/app/_simulate_tx_test.go @@ -8,8 +8,8 @@ import ( "net/http/httptest" "testing" - sdkmath "cosmossdk.io/math" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" @@ -62,11 +62,11 @@ func (suite *SimulateRequestTestSuite) TestSimulateRequest() { bank.MsgSend{ FromAddress: fromAddr, ToAddress: toAddr, - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e6)), }, }, Fee: auth.StdFee{ - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(5e4))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(5e4)), Gas: 1e6, }, Memo: "test memo", diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index 1109eb66..ed979248 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -66,7 +66,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) { chainID, app.NewFundedGenStateWithSameCoins( tApp.AppCodec(), - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1e9)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e9)), testAddresses, ), newBep3GenStateMulti(tApp.AppCodec(), deputy), @@ -114,7 +114,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) { banktypes.NewMsgSend( tc.address, testAddresses[0], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1_000_000)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1_000_000)), ), }, sdk.NewCoins(), // no fee diff --git a/app/ante/authorized_test.go b/app/ante/authorized_test.go index 618fbbf7..d9dd327a 100644 --- a/app/ante/authorized_test.go +++ b/app/ante/authorized_test.go @@ -12,6 +12,7 @@ import ( "github.com/0glabs/0g-chain/app" "github.com/0glabs/0g-chain/app/ante" + "github.com/0glabs/0g-chain/chaincfg" ) var _ sdk.AnteHandler = (&MockAnteHandler{}).AnteHandle @@ -45,7 +46,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_NotCheckTx(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100_000_000)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100_000_000)), ), }, sdk.NewCoins(), // no fee @@ -80,12 +81,12 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Pass(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), ), banktypes.NewMsgSend( testAddresses[2], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), ), }, sdk.NewCoins(), // no fee @@ -121,7 +122,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Reject(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), ), }, sdk.NewCoins(), // no fee diff --git a/app/ante/authz_test.go b/app/ante/authz_test.go index 16478c47..4178728c 100644 --- a/app/ante/authz_test.go +++ b/app/ante/authz_test.go @@ -16,6 +16,7 @@ import ( "github.com/0glabs/0g-chain/app" "github.com/0glabs/0g-chain/app/ante" + "github.com/0glabs/0g-chain/chaincfg" ) func newMsgGrant(granter sdk.AccAddress, grantee sdk.AccAddress, a authz.Authorization, expiration time.Time) *authz.MsgGrant { @@ -58,7 +59,7 @@ func TestAuthzLimiterDecorator(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100e6)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), ), }, checkTx: false, @@ -128,7 +129,7 @@ func TestAuthzLimiterDecorator(t *testing.T) { []sdk.Msg{banktypes.NewMsgSend( testAddresses[0], testAddresses[3], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100e6)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), )}), }, checkTx: false, @@ -161,7 +162,7 @@ func TestAuthzLimiterDecorator(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[3], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100e6)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), ), &evmtypes.MsgEthereumTx{}, }, diff --git a/app/ante/eip712_test.go b/app/ante/eip712_test.go index b117026e..0370d608 100644 --- a/app/ante/eip712_test.go +++ b/app/ante/eip712_test.go @@ -34,6 +34,7 @@ import ( "github.com/tendermint/tendermint/version" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" evmutilkeeper "github.com/0glabs/0g-chain/x/evmutil/keeper" evmutiltestutil "github.com/0glabs/0g-chain/x/evmutil/testutil" evmutiltypes "github.com/0glabs/0g-chain/x/evmutil/types" @@ -155,7 +156,7 @@ func (suite *EIP712TestSuite) SetupTest() { // Genesis states evmGs := evmtypes.NewGenesisState( evmtypes.NewParams( - "neuron", // evmDenom + chaincfg.BaseDenom, // evmDenom false, // allowedUnprotectedTxs true, // enableCreate true, // enableCall @@ -221,10 +222,10 @@ func (suite *EIP712TestSuite) SetupTest() { pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pricefeedGenState), } - // funds our test accounts with some ua0gi + // funds our test accounts with some auxiliary denom coinsGenState := app.NewFundedGenStateWithSameCoins( tApp.AppCodec(), - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1e9)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e9)), []sdk.AccAddress{suite.testAddr, suite.testAddr2}, ) @@ -306,17 +307,17 @@ func (suite *EIP712TestSuite) SetupTest() { params := evmKeeper.GetParams(suite.ctx) params.EIP712AllowedMsgs = []evmtypes.EIP712AllowedMsg{ { - MsgTypeUrl: "/0g-chain.evmutil.v1beta1.MsgConvertERC20ToCoin", + MsgTypeUrl: "/zgc.evmutil.v1beta1.MsgConvertERC20ToCoin", MsgValueTypeName: "MsgValueEVMConvertERC20ToCoin", ValueTypes: []evmtypes.EIP712MsgAttrType{ {Name: "initiator", Type: "string"}, {Name: "receiver", Type: "string"}, - {Name: "0gchain_erc20_address", Type: "string"}, + {Name: "zgchain_erc20_address", Type: "string"}, {Name: "amount", Type: "string"}, }, }, { - MsgTypeUrl: "/0g-chain.evmutil.v1beta1.MsgConvertCoinToERC20", + MsgTypeUrl: "/zgc.evmutil.v1beta1.MsgConvertCoinToERC20", MsgValueTypeName: "MsgValueEVMConvertCoinToERC20", ValueTypes: []evmtypes.EIP712MsgAttrType{ {Name: "initiator", Type: "string"}, @@ -369,7 +370,7 @@ func (suite *EIP712TestSuite) deployUSDCERC20(app app.TestApp, ctx sdk.Context) suite.tApp.FundModuleAccount( suite.ctx, evmutiltypes.ModuleName, - sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(0))), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(0)), ) contractAddr, err := suite.evmutilKeeper.DeployTestMintableERC20Contract(suite.ctx, "USDC", "USDC", uint8(18)) @@ -469,7 +470,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { errMsg: "insufficient funds", updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { bk := suite.tApp.GetBankKeeper() - gasCoins := bk.GetBalance(suite.ctx, suite.testAddr, "ua0gi") + gasCoins := bk.GetBalance(suite.ctx, suite.testAddr, chaincfg.AuxiliaryDenom) suite.tApp.GetBankKeeper().SendCoins(suite.ctx, suite.testAddr, suite.testAddr2, sdk.NewCoins(gasCoins)) return txBuilder }, @@ -481,7 +482,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { failCheckTx: true, errMsg: "invalid chain-id", updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { - gasAmt := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(20))) + gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) return suite.createTestEIP712CosmosTxBuilder( suite.testAddr, suite.testPrivKey, "kavatest_12-1", uint64(helpers.DefaultGenTxGas*10), gasAmt, msgs, ) @@ -494,7 +495,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { failCheckTx: true, errMsg: "invalid pubkey", updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { - gasAmt := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(20))) + gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) return suite.createTestEIP712CosmosTxBuilder( suite.testAddr2, suite.testPrivKey2, ChainID, uint64(helpers.DefaultGenTxGas*10), gasAmt, msgs, ) @@ -522,7 +523,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { msgs = tc.updateMsgs(msgs) } - gasAmt := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(20))) + gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) txBuilder := suite.createTestEIP712CosmosTxBuilder( suite.testAddr, suite.testPrivKey, ChainID, uint64(helpers.DefaultGenTxGas*10), gasAmt, msgs, ) @@ -596,7 +597,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() { } // deliver deposit msg - gasAmt := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(20))) + gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) txBuilder := suite.createTestEIP712CosmosTxBuilder( suite.testAddr, suite.testPrivKey, ChainID, uint64(helpers.DefaultGenTxGas*10), gasAmt, depositMsgs, ) diff --git a/app/ante/min_gas_filter_test.go b/app/ante/min_gas_filter_test.go index 6ad5f10e..f49c333b 100644 --- a/app/ante/min_gas_filter_test.go +++ b/app/ante/min_gas_filter_test.go @@ -13,6 +13,7 @@ import ( "github.com/0glabs/0g-chain/app" "github.com/0glabs/0g-chain/app/ante" + "github.com/0glabs/0g-chain/chaincfg" ) func mustParseDecCoins(value string) sdk.DecCoins { @@ -30,7 +31,7 @@ func TestEvmMinGasFilter(t *testing.T) { ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.GetEvmKeeper().SetParams(ctx, evmtypes.Params{ - EvmDenom: "neuron", + EvmDenom: chaincfg.BaseDenom, }) testCases := []struct { diff --git a/app/ante/vesting_test.go b/app/ante/vesting_test.go index 242b25dd..5e5d5789 100644 --- a/app/ante/vesting_test.go +++ b/app/ante/vesting_test.go @@ -14,6 +14,7 @@ import ( "github.com/0glabs/0g-chain/app" "github.com/0glabs/0g-chain/app/ante" + "github.com/0glabs/0g-chain/chaincfg" ) func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing.T) { @@ -33,7 +34,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing "MsgCreateVestingAccount", vesting.NewMsgCreateVestingAccount( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC).Unix(), false, ), @@ -44,7 +45,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing "MsgCreateVestingAccount", vesting.NewMsgCreatePermanentLockedAccount( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), ), true, "MsgTypeURL /cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount not supported", @@ -63,7 +64,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing "other messages not affected", banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), ), false, "", diff --git a/app/test_common.go b/app/test_common.go index ecef1271..aa51bb56 100644 --- a/app/test_common.go +++ b/app/test_common.go @@ -149,7 +149,7 @@ func GenesisStateWithSingleValidator( balances := []banktypes.Balance{ { Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(100000000000000))), + Coins: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100000000000000)), }, } @@ -212,7 +212,7 @@ func genesisStateWithValSet( } // set validators and delegations currentStakingGenesis := stakingtypes.GetGenesisStateFromAppState(app.appCodec, genesisState) - currentStakingGenesis.Params.BondDenom = "ua0gi" + currentStakingGenesis.Params.BondDenom = chaincfg.AuxiliaryDenom // TODO: stakingGenesis := stakingtypes.NewGenesisState( currentStakingGenesis.Params, @@ -232,13 +232,13 @@ func genesisStateWithValSet( for range delegations { // add delegated tokens to total supply - totalSupply = totalSupply.Add(sdk.NewCoin("ua0gi", bondAmt)) + totalSupply = totalSupply.Add(chaincfg.MakeCoinForAuxiliaryDenom(bondAmt)) } // add bonded amount to bonded pool module account balances = append(balances, banktypes.Balance{ Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin("ua0gi", bondAmt)}, + Coins: sdk.Coins{chaincfg.MakeCoinForAuxiliaryDenom(bondAmt)}, }) bankGenesis := banktypes.NewGenesisState( diff --git a/chaincfg/coin_helper.go b/chaincfg/coin_helper.go new file mode 100644 index 00000000..6f50b282 --- /dev/null +++ b/chaincfg/coin_helper.go @@ -0,0 +1,57 @@ +package chaincfg + +import ( + "fmt" + "math/big" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/shopspring/decimal" +) + +func toBigInt(amount any) *big.Int { + if amount == nil { + return big.NewInt(0) + } + var val *big.Int + switch amount.(type) { + case int: + val = big.NewInt(int64(amount.(int))) + case int32: + val = big.NewInt(int64(amount.(int32))) + case int64: + val = big.NewInt(amount.(int64)) + case string: + var ok bool + val, ok = new(big.Int).SetString(amount.(string), 0) + if !ok { + panic(fmt.Sprintf("invalid amount string: %s", amount.(string))) + } + case math.Int: + val = amount.(math.Int).BigInt() + case *big.Int: + val = amount.(*big.Int) + case float64: + val = decimal.NewFromFloat(amount.(float64)).BigInt() + default: + panic(fmt.Sprintf("invalid amount type: %T", amount)) + } + + return val +} + +func MakeCoinForStandardDenom(amount any) sdk.Coin { + return makeCoin(StandardDenom, toBigInt(amount)) +} + +func MakeCoinForAuxiliaryDenom(amount any) sdk.Coin { + return makeCoin(AuxiliaryDenom, toBigInt(amount)) +} + +func MakeCoinForBaseDenom(amount any) sdk.Coin { + return makeCoin(BaseDenom, toBigInt(amount)) +} + +func makeCoin(denom string, amount *big.Int) sdk.Coin { + return sdk.NewCoin(denom, math.NewIntFromBigInt(amount)) +} diff --git a/chaincfg/denoms.go b/chaincfg/denoms.go new file mode 100644 index 00000000..1ced4532 --- /dev/null +++ b/chaincfg/denoms.go @@ -0,0 +1,37 @@ +package chaincfg + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + StandardDenom = "a0gi" + + AuxiliaryDenom = "ua0gi" + + BaseDenom = "neuron" + + BondDenom = BaseDenom + + AuxiliaryDenomUnit = 6 + + BaseDenomUnit = 18 + + AuxiliaryDenomConversionMultiplier = 1e12 + BaseDenomConversionMultiplier = 1e18 +) + +// RegisterDenoms registers the base and auxiliary denominations to the SDK. +func RegisterDenoms() { + if err := sdk.RegisterDenom(StandardDenom, sdk.OneDec()); err != nil { + panic(err) + } + + if err := sdk.RegisterDenom(AuxiliaryDenom, sdk.NewDecWithPrec(1, AuxiliaryDenomUnit)); err != nil { + panic(err) + } + + if err := sdk.RegisterDenom(BaseDenom, sdk.NewDecWithPrec(1, BaseDenomUnit)); err != nil { + panic(err) + } +} diff --git a/chaincfg/denoms_test.go b/chaincfg/denoms_test.go new file mode 100644 index 00000000..5c0fb989 --- /dev/null +++ b/chaincfg/denoms_test.go @@ -0,0 +1,80 @@ +package chaincfg + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" +) + +func TestRegisterDenoms(t *testing.T) { + RegisterDenoms() + tests := []struct { + name string + from sdk.Coin + targetDenom string + expCoin sdk.Coin + expErr error + }{ + { + "standard to auxiliary", + MakeCoinForStandardDenom(99), + AuxiliaryDenom, + MakeCoinForAuxiliaryDenom(99 * (BaseDenomConversionMultiplier / AuxiliaryDenomConversionMultiplier)), + nil, + }, + { + "auxiliary to standard", + MakeCoinForAuxiliaryDenom(5e7), + StandardDenom, + MakeCoinForStandardDenom(50), + nil, + }, + { + "standard to base", + MakeCoinForStandardDenom(22), + BaseDenom, + MakeCoinForBaseDenom(22 * BaseDenomConversionMultiplier), + nil, + }, + { + "base to standard", + MakeCoinForBaseDenom("97000000000000000000"), + StandardDenom, + MakeCoinForStandardDenom(97), + nil, + }, + { + "auxiliary to base", + MakeCoinForAuxiliaryDenom(33), + BaseDenom, + MakeCoinForBaseDenom(33 * AuxiliaryDenomConversionMultiplier), + nil, + }, + { + "base to auxiliary", + MakeCoinForBaseDenom("770000000000000"), + AuxiliaryDenom, + MakeCoinForAuxiliaryDenom(770000000000000 / AuxiliaryDenomConversionMultiplier), + nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ret, err := sdk.ConvertCoin(tt.from, tt.targetDenom) + if tt.expErr != nil { + if err == nil { + t.Errorf("expErr is not nil, but got nil") + return + } + } else { + if err != nil { + t.Errorf("expErr is nil, but got %v", err) + return + } + } + + assert.Equal(t, tt.expCoin, ret) + }) + } +} diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index d950b541..8260fa67 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -73,7 +73,7 @@ func TestKvCLIKeysAddRecover(t *testing.T) { f.Cleanup() } -func TestKavaCLIKeysAddRecoverHDPath(t *testing.T) { +func TestZgChainCLIKeysAddRecoverHDPath(t *testing.T) { t.Parallel() f := InitFixtures(t) diff --git a/cmd/0gchaind/root.go b/cmd/0gchaind/root.go index 72cf38f4..78f2593a 100644 --- a/cmd/0gchaind/root.go +++ b/cmd/0gchaind/root.go @@ -72,7 +72,7 @@ func NewRootCmd() *cobra.Command { return err } - customAppTemplate, customAppConfig := servercfg.AppConfig("ua0gi") + customAppTemplate, customAppConfig := servercfg.AppConfig(chaincfg.AuxiliaryDenom) return server.InterceptConfigsPreRunHandler( cmd, diff --git a/go.mod b/go.mod index 3d53e2d5..a5beb433 100644 --- a/go.mod +++ b/go.mod @@ -136,6 +136,7 @@ require ( github.com/klauspost/compress v1.15.15 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -168,6 +169,7 @@ require ( github.com/rs/zerolog v1.29.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/shopspring/decimal v1.4.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect diff --git a/go.sum b/go.sum index bbbbb97a..1c53847a 100644 --- a/go.sum +++ b/go.sum @@ -865,6 +865,8 @@ github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0U github.com/linxGnu/grocksdb v1.8.0 h1:H4L/LhP7GOMf1j17oQAElHgVlbEje2h14A8Tz9cM2BE= github.com/linxGnu/grocksdb v1.8.0/go.mod h1:09CeBborffXhXdNpEcOeZrLKEnRtrZFEpFdPNI9Zjjg= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= +github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252 h1:D2VNityLQ1srKF+MSllSGQ4NwMci20llMkvVAmU2aCk= +github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252/go.mod h1:O9bIJ6BRFBmP3AKTW8cqESVbauSmifSrRB/n9zq6x9Q= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -1093,6 +1095,8 @@ github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfP github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= diff --git a/migrate/utils/periodic_vesting_reset_test.go b/migrate/utils/periodic_vesting_reset_test.go index e0a8ed28..0ec44cd8 100644 --- a/migrate/utils/periodic_vesting_reset_test.go +++ b/migrate/utils/periodic_vesting_reset_test.go @@ -5,6 +5,7 @@ import ( "time" sdkmath "cosmossdk.io/math" + "github.com/0glabs/0g-chain/chaincfg" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -41,7 +42,7 @@ func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -64,7 +65,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -97,7 +98,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -125,25 +126,25 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing } func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(4e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(4e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +30 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, } @@ -159,36 +160,36 @@ func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { expectedPeriods := []vestingtypes.Period{ { Length: 15 * 24 * 60 * 60, // 15 days - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, { Length: 15 * 24 * 60 * 60, // 15 days - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, } - assert.Equal(t, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") + assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") assert.Equal(t, newVestingStartTime.Unix(), vacc.StartTime, "expected vesting start time to be updated") assert.Equal(t, expectedEndtime, vacc.EndTime, "expected vesting end time end at last period") assert.Equal(t, expectedPeriods, vacc.VestingPeriods, "expected vesting periods to be updated") } func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(3e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(3e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, } @@ -198,35 +199,35 @@ func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testin newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) ResetPeriodicVestingAccount(vacc, newVestingStartTime) - assert.Equal(t, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") - assert.Equal(t, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") + assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") + assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") } func TestResetPeriodVestingAccount_DelegatedVesting_LessThanVested(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(3e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(3e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), }, } vacc := createVestingAccount(balance, vestingStartTime, periods) - vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6)))) + vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6)))) newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) ResetPeriodicVestingAccount(vacc, newVestingStartTime) assert.Equal(t, sdk.Coins(nil), vacc.DelegatedFree, "expected delegrated free to be unmodified") - assert.Equal(t, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") + assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") } diff --git a/proto/zgc/evmutil/v1beta1/conversion_pair.proto b/proto/zgc/evmutil/v1beta1/conversion_pair.proto index 3db7f95f..09cf2321 100644 --- a/proto/zgc/evmutil/v1beta1/conversion_pair.proto +++ b/proto/zgc/evmutil/v1beta1/conversion_pair.proto @@ -13,7 +13,7 @@ message ConversionPair { option (gogoproto.goproto_getters) = false; // ERC20 address of the token on the 0gChain EVM - bytes zgChain_erc20_address = 1 [ + bytes zgchain_erc20_address = 1 [ (gogoproto.customname) = "ZgChainERC20Address", (gogoproto.casttype) = "HexBytes" ]; diff --git a/proto/zgc/evmutil/v1beta1/tx.proto b/proto/zgc/evmutil/v1beta1/tx.proto index fc6c2257..8e2943d7 100644 --- a/proto/zgc/evmutil/v1beta1/tx.proto +++ b/proto/zgc/evmutil/v1beta1/tx.proto @@ -44,7 +44,7 @@ message MsgConvertERC20ToCoin { // 0gChain bech32 address that will receive the converted sdk.Coin. string receiver = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // EVM 0x hex address of the ERC20 contract. - string zgChain_erc20_address = 3 [(gogoproto.customname) = "ZgChainERC20Address"]; + string zgchain_erc20_address = 3 [(gogoproto.customname) = "ZgChainERC20Address"]; // ERC20 token amount to convert. string amount = 4 [ (cosmos_proto.scalar) = "cosmos.Int", diff --git a/tests/e2e/e2e_convert_cosmos_coins_test.go b/tests/e2e/e2e_convert_cosmos_coins_test.go index 9acb9309..7aee4a3c 100644 --- a/tests/e2e/e2e_convert_cosmos_coins_test.go +++ b/tests/e2e/e2e_convert_cosmos_coins_test.go @@ -12,6 +12,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/tests/e2e/testutil" "github.com/0glabs/0g-chain/tests/util" evmutiltypes "github.com/0glabs/0g-chain/x/evmutil/types" @@ -63,7 +64,7 @@ func (suite *IntegrationTestSuite) setupAccountWithCosmosCoinERC20Balance( tx := util.ZgChainMsgRequest{ Msgs: []sdk.Msg{&msg}, GasLimit: 4e5, - FeeAmount: sdk.NewCoins(a0gi(big.NewInt(400))), + FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(400)), Data: "converting sdk coin to erc20", } res := user.SignAndBroadcastZgChainTx(tx) @@ -102,7 +103,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoinsToFromERC20() { tx := util.ZgChainMsgRequest{ Msgs: []sdk.Msg{&convertToErc20Msg}, GasLimit: 2e6, - FeeAmount: sdk.NewCoins(a0gi(big.NewInt(2000))), + FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(2000)), Data: "converting sdk coin to erc20", } res := user.SignAndBroadcastZgChainTx(tx) @@ -144,7 +145,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoinsToFromERC20() { tx = util.ZgChainMsgRequest{ Msgs: []sdk.Msg{&convertFromErc20Msg}, GasLimit: 2e5, - FeeAmount: sdk.NewCoins(a0gi(big.NewInt(200))), + FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), Data: "converting erc20 to cosmos coin", } res = user.SignAndBroadcastZgChainTx(tx) @@ -183,7 +184,7 @@ func (suite *IntegrationTestSuite) TestEIP712ConvertCosmosCoinsToFromERC20() { user, suite.ZgChain, 2e6, - sdk.NewCoins(a0gi(big.NewInt(1e4))), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), []sdk.Msg{&convertToErc20Msg}, "this is a memo", ).GetTx() @@ -237,7 +238,7 @@ func (suite *IntegrationTestSuite) TestEIP712ConvertCosmosCoinsToFromERC20() { user, suite.ZgChain, 2e5, - sdk.NewCoins(a0gi(big.NewInt(200))), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), []sdk.Msg{&convertFromErc20Msg}, "", ).GetTx() @@ -331,7 +332,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoins_ERC20Magic() { "cosmo-coin-converter-complex-alice", initialAliceAmount, ) - gasMoney := sdk.NewCoins(a0gi(big.NewInt(1e5))) + gasMoney := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e5)) bob := suite.ZgChain.NewFundedAccount("cosmo-coin-converter-complex-bob", gasMoney) amount := big.NewInt(1e3) // test assumes this is half of alice's balance. @@ -412,7 +413,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoins_ERC20Magic() { convertTx := util.ZgChainMsgRequest{ Msgs: []sdk.Msg{&convertMsg}, GasLimit: 2e5, - FeeAmount: sdk.NewCoins(a0gi(big.NewInt(200))), + FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), Data: "bob converts his new erc20 to an sdk.Coin", } convertRes := bob.SignAndBroadcastZgChainTx(convertTx) diff --git a/tests/e2e/e2e_evm_contracts_test.go b/tests/e2e/e2e_evm_contracts_test.go index b6215291..1a3b8793 100644 --- a/tests/e2e/e2e_evm_contracts_test.go +++ b/tests/e2e/e2e_evm_contracts_test.go @@ -11,7 +11,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/0glabs/0g-chain/app" - + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/tests/e2e/contracts/greeter" "github.com/0glabs/0g-chain/tests/util" ) @@ -20,7 +20,7 @@ func (suite *IntegrationTestSuite) TestEthCallToGreeterContract() { // this test manipulates state of the Greeter contract which means other tests shouldn't use it. // setup funded account to interact with contract - user := suite.ZgChain.NewFundedAccount("greeter-contract-user", sdk.NewCoins(a0gi(big.NewInt(1e6)))) + user := suite.ZgChain.NewFundedAccount("greeter-contract-user", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e6))) greeterAddr := suite.ZgChain.ContractAddrs["greeter"] contract, err := greeter.NewGreeter(greeterAddr, suite.ZgChain.EvmClient) @@ -63,12 +63,12 @@ func (suite *IntegrationTestSuite) TestEthCallToErc20() { func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // create new funded account - sender := suite.ZgChain.NewFundedAccount("eip712-msgSend", sdk.NewCoins(a0gi(big.NewInt(2e4)))) + sender := suite.ZgChain.NewFundedAccount("eip712-msgSend", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(2e4))) receiver := app.RandomAddress() - // setup message for sending some a0gi to random receiver + // setup message for sending some auxiliary denom to random receiver msgs := []sdk.Msg{ - banktypes.NewMsgSend(sender.SdkAddress, receiver, sdk.NewCoins(a0gi(big.NewInt(1e3)))), + banktypes.NewMsgSend(sender.SdkAddress, receiver, sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e3))), } // create tx @@ -76,7 +76,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { sender, suite.ZgChain, 1e6, - sdk.NewCoins(a0gi(big.NewInt(1e4))), + sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), msgs, "this is a memo", ).GetTx() @@ -95,10 +95,10 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { _, err = util.WaitForSdkTxCommit(suite.ZgChain.Tx, res.TxResponse.TxHash, 6*time.Second) suite.NoError(err) - // check that the message was processed & the a0gi is transferred. + // check that the message was processed & the auxiliary denom is transferred. balRes, err := suite.ZgChain.Bank.Balance(context.Background(), &banktypes.QueryBalanceRequest{ Address: receiver.String(), - Denom: "ua0gi", + Denom: chaincfg.AuxiliaryDenom, }) suite.NoError(err) suite.Equal(sdk.NewInt(1e3), balRes.Balance.Amount) @@ -113,7 +113,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // sdkDenom := suite.DeployedErc20.CosmosDenom // // create new funded account -// depositor := suite.ZgChain.NewFundedAccount("eip712-lend-depositor", sdk.NewCoins(a0gi(big.NewInt(1e5))) +// depositor := suite.ZgChain.NewFundedAccount("eip712-lend-depositor", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e5))) // // give them erc20 balance to deposit // fundRes := suite.FundZgChainErc20Balance(depositor.EvmAddress, amount.BigInt()) // suite.NoError(fundRes.Err) @@ -143,7 +143,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // depositor, // suite.ZgChain, // 1e6, -// sdk.NewCoins(a0gi(big.NewInt(1e4)), +// sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), // msgs, // "doing the USDT Earn workflow! erc20 -> sdk.Coin -> USDX hard deposit", // ).GetTx() @@ -189,7 +189,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // withdrawAndConvertBack := util.ZgChainMsgRequest{ // Msgs: []sdk.Msg{&withdraw, &convertBack}, // GasLimit: 1e6, -// FeeAmount: sdk.NewCoins(a0gi(big.NewInt(1000)), +// FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1000)), // Data: "withdrawing from mint & converting back to erc20", // } // lastRes := depositor.SignAndBroadcastZgChainTx(withdrawAndConvertBack) diff --git a/tests/e2e/e2e_min_fees_test.go b/tests/e2e/e2e_min_fees_test.go index 8516f2ba..1a44bebe 100644 --- a/tests/e2e/e2e_min_fees_test.go +++ b/tests/e2e/e2e_min_fees_test.go @@ -13,6 +13,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/tests/util" ) @@ -23,10 +24,10 @@ func (suite *IntegrationTestSuite) TestEthGasPriceReturnsMinFee() { minGasPrices, err := getMinFeeFromAppToml(util.ZgChainHomePath()) suite.NoError(err) - // evm uses neuron, get neuron min fee - evmMinGas := minGasPrices.AmountOf("neuron").TruncateInt().BigInt() + // evm uses base denom, get base denom min fee + evmMinGas := minGasPrices.AmountOf(chaincfg.BaseDenom).TruncateInt().BigInt() - // returns eth_gasPrice, units in a0gi + // returns eth_gasPrice, units in auxiliary denom gasPrice, err := suite.ZgChain.EvmClient.SuggestGasPrice(context.Background()) suite.NoError(err) @@ -37,13 +38,13 @@ func (suite *IntegrationTestSuite) TestEvmRespectsMinFee() { suite.SkipIfKvtoolDisabled() // setup sender & receiver - sender := suite.ZgChain.NewFundedAccount("evm-min-fee-test-sender", sdk.NewCoins(a0gi(big.NewInt(1e3)))) + sender := suite.ZgChain.NewFundedAccount("evm-min-fee-test-sender", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e3))) randoReceiver := util.SdkToEvmAddress(app.RandomAddress()) // get min gas price for evm (from app.toml) minFees, err := getMinFeeFromAppToml(util.ZgChainHomePath()) suite.NoError(err) - minGasPrice := minFees.AmountOf("neuron").TruncateInt() + minGasPrice := minFees.AmountOf(chaincfg.BaseDenom).TruncateInt() // attempt tx with less than min gas price (min fee - 1) tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt() diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 553d1912..da977e26 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -19,18 +19,15 @@ import ( emtypes "github.com/evmos/ethermint/types" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/tests/e2e/testutil" "github.com/0glabs/0g-chain/tests/util" ) var ( - minEvmGasPrice = big.NewInt(1e10) // neuron + minEvmGasPrice = big.NewInt(1e10) // base denom ) -func a0gi(amt *big.Int) sdk.Coin { - return sdk.NewCoin("ua0gi", sdkmath.NewIntFromBigInt(amt)) -} - type IntegrationTestSuite struct { testutil.E2eTestSuite } @@ -57,7 +54,7 @@ func (suite *IntegrationTestSuite) TestChainID() { // example test that funds a new account & queries its balance func (suite *IntegrationTestSuite) TestFundedAccount() { - funds := a0gi(big.NewInt(1e3)) + funds := chaincfg.MakeCoinForAuxiliaryDenom(1e3) acc := suite.ZgChain.NewFundedAccount("example-acc", sdk.NewCoins(funds)) // check that the sdk & evm signers are for the same account @@ -66,21 +63,21 @@ func (suite *IntegrationTestSuite) TestFundedAccount() { // check balance via SDK query res, err := suite.ZgChain.Bank.Balance(context.Background(), banktypes.NewQueryBalanceRequest( - acc.SdkAddress, "ua0gi", + acc.SdkAddress, chaincfg.AuxiliaryDenom, )) suite.NoError(err) suite.Equal(funds, *res.Balance) // check balance via EVM query - neuronBal, err := suite.ZgChain.EvmClient.BalanceAt(context.Background(), acc.EvmAddress, nil) + baseDenomBal, err := suite.ZgChain.EvmClient.BalanceAt(context.Background(), acc.EvmAddress, nil) suite.NoError(err) - suite.Equal(funds.Amount.MulRaw(1e12).BigInt(), neuronBal) + suite.Equal(funds.Amount.MulRaw(1e12).BigInt(), baseDenomBal) } // example test that signs & broadcasts an EVM tx func (suite *IntegrationTestSuite) TestTransferOverEVM() { // fund an account that can perform the transfer - initialFunds := a0gi(big.NewInt(1e6)) // 1 A0GI + initialFunds := chaincfg.MakeCoinForAuxiliaryDenom(1e6) // 1 (auxiliary denom) acc := suite.ZgChain.NewFundedAccount("evm-test-transfer", sdk.NewCoins(initialFunds)) // get a rando account to send 0gchain to @@ -92,10 +89,10 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() { suite.NoError(err) suite.Equal(uint64(0), nonce) // sanity check. the account should have no prior txs - // transfer a0gi over EVM - a0giToTransfer := big.NewInt(1e17) // .1 A0GI; neuron has 18 decimals. + // transfer auxiliary denom over EVM + AuxiliaryDenomToTransfer := big.NewInt(1e17) // .1 (auxiliary denom); base denom has 18 decimals. req := util.EvmTxRequest{ - Tx: ethtypes.NewTransaction(nonce, to, a0giToTransfer, 1e5, minEvmGasPrice, nil), + Tx: ethtypes.NewTransaction(nonce, to, AuxiliaryDenomToTransfer, 1e5, minEvmGasPrice, nil), Data: "any ol' data to track this through the system", } res := acc.SignAndBroadcastEvmTx(req) @@ -103,31 +100,31 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() { suite.Equal(ethtypes.ReceiptStatusSuccessful, res.Receipt.Status) // evm txs refund unused gas. so to know the expected balance we need to know how much gas was used. - a0giUsedForGas := sdkmath.NewIntFromBigInt(minEvmGasPrice). + AuxiliaryDenomUsedForGas := sdkmath.NewIntFromBigInt(minEvmGasPrice). Mul(sdkmath.NewIntFromUint64(res.Receipt.GasUsed)). - QuoRaw(1e12) // convert neuron to a0gi + QuoRaw(1e12) // convert base denom to auxiliary denom - // expect (9 - gas used) A0GI remaining in account. + // expect (9 - gas used) (auxiliary denom) remaining in account. balance := suite.ZgChain.QuerySdkForBalances(acc.SdkAddress) - suite.Equal(sdkmath.NewInt(9e5).Sub(a0giUsedForGas), balance.AmountOf("ua0gi")) + suite.Equal(sdkmath.NewInt(9e5).Sub(AuxiliaryDenomUsedForGas), balance.AmountOf(chaincfg.AuxiliaryDenom)) } -// TestIbcTransfer transfers A0GI from the primary 0g-chain (suite.ZgChain) to the ibc chain (suite.Ibc). +// TestIbcTransfer transfers (auxiliary denom) from the primary 0g-chain (suite.ZgChain) to the ibc chain (suite.Ibc). // Note that because the IBC chain also runs 0g-chain's binary, this tests both the sending & receiving. func (suite *IntegrationTestSuite) TestIbcTransfer() { suite.SkipIfIbcDisabled() // ARRANGE // setup 0g-chain account - funds := a0gi(big.NewInt(1e5)) // .1 A0GI + funds := chaincfg.MakeCoinForAuxiliaryDenom(1e5) // .1 (auxiliary denom) zgChainAcc := suite.ZgChain.NewFundedAccount("ibc-transfer-0g-side", sdk.NewCoins(funds)) // setup ibc account ibcAcc := suite.Ibc.NewFundedAccount("ibc-transfer-ibc-side", sdk.NewCoins()) gasLimit := int64(2e5) - fee := a0gi(big.NewInt(200)) + fee := chaincfg.MakeCoinForAuxiliaryDenom(200) - fundsToSend := a0gi(big.NewInt(5e4)) // .005 A0GI + fundsToSend := chaincfg.MakeCoinForAuxiliaryDenom(5e4) // .005 (auxiliary denom) transferMsg := ibctypes.NewMsgTransfer( testutil.IbcPort, testutil.IbcChannel, @@ -157,7 +154,7 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() { // the balance should be deducted from 0g-chain account suite.Eventually(func() bool { balance := suite.ZgChain.QuerySdkForBalances(zgChainAcc.SdkAddress) - return balance.AmountOf("ua0gi").Equal(expectedSrcBalance.Amount) + return balance.AmountOf(chaincfg.AuxiliaryDenom).Equal(expectedSrcBalance.Amount) }, 10*time.Second, 1*time.Second) // expect the balance to be transferred to the ibc chain! diff --git a/tests/e2e/e2e_upgrade_gov_and_authz_test.go b/tests/e2e/e2e_upgrade_gov_and_authz_test.go index 251b1955..5ee3081e 100644 --- a/tests/e2e/e2e_upgrade_gov_and_authz_test.go +++ b/tests/e2e/e2e_upgrade_gov_and_authz_test.go @@ -3,7 +3,6 @@ package e2e_test import ( "context" "fmt" - "math/big" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,6 +11,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/tests/e2e/testutil" "github.com/0glabs/0g-chain/tests/util" ) @@ -101,13 +101,13 @@ func (suite *IntegrationTestSuite) TestModuleAccountGovTransfers() { name: "transfer from community to kavadist for incentive rewards", sender: communityAcc, receiver: zgChainDistAcc, - amount: a0gi(big.NewInt(100)), + amount: chaincfg.MakeCoinForAuxiliaryDenom(100), }, { name: "transfer from kavadist to community", sender: zgChainDistAcc, receiver: communityAcc, - amount: a0gi(big.NewInt(50)), + amount: chaincfg.MakeCoinForAuxiliaryDenom(50), }, } @@ -153,7 +153,7 @@ func (suite *IntegrationTestSuite) submitAndPassProposal(msgs []sdk.Msg) int64 { suite.NoError(err) gasLimit := 1e6 - fee := sdk.NewCoin("neuron", sdk.NewInt(1e15)) + fee := chaincfg.MakeCoinForBaseDenom(1e15) req := util.ZgChainMsgRequest{ Msgs: []sdk.Msg{proposalMsg}, diff --git a/tests/e2e/runner/chain.go b/tests/e2e/runner/chain.go index 2a0c899f..6f4b0029 100644 --- a/tests/e2e/runner/chain.go +++ b/tests/e2e/runner/chain.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" + "github.com/0glabs/0g-chain/chaincfg" "github.com/ethereum/go-ethereum/ethclient" rpchttpclient "github.com/tendermint/tendermint/rpc/client/http" "google.golang.org/grpc" @@ -81,7 +82,7 @@ var ( EvmRpcUrl: "http://localhost:8545", ChainId: "0gchainlocalnet_8888-1", - StakingDenom: "ua0gi", + StakingDenom: chaincfg.AuxiliaryDenom, } kvtoolIbcChain = ChainDetails{ RpcUrl: "http://localhost:26658", diff --git a/tests/e2e/testutil/account.go b/tests/e2e/testutil/account.go index 95025afd..9fc8fe83 100644 --- a/tests/e2e/testutil/account.go +++ b/tests/e2e/testutil/account.go @@ -262,7 +262,7 @@ func (a *SigningAccount) BankSend(to sdk.AccAddress, amount sdk.Coins) util.ZgCh util.ZgChainMsgRequest{ Msgs: []sdk.Msg{banktypes.NewMsgSend(a.SdkAddress, to, amount)}, GasLimit: 2e5, // 200,000 gas - FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(200))), // assume min gas price of .001a0gi + FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(200))), // assume min gas price of .001 auxiliary denom Data: fmt.Sprintf("sending %s to %s", amount, to), }, ) diff --git a/x/bep3/client/cli/query.go b/x/bep3/client/cli/query.go index 98bd924b..6641ab6c 100644 --- a/x/bep3/client/cli/query.go +++ b/x/bep3/client/cli/query.go @@ -106,7 +106,7 @@ func QueryCalcSwapIDCmd(queryRoute string) *cobra.Command { return &cobra.Command{ Use: "calc-swapid [random-number-hash] [sender] [sender-other-chain]", Short: "calculate swap ID for the given random number hash, sender, and sender other chain", - Example: "bep3 calc-swapid 0677bd8a303dd981810f34d8e5cc6507f13b391899b84d3c1be6c6045a17d747 kava1l0xsq2z7gqd7yly0g40y5836g0appumark77ny bnb1ud3q90r98l3mhd87kswv3h8cgrymzeljct8qn7", + Example: "bep3 calc-swapid 0677bd8a303dd981810f34d8e5cc6507f13b391899b84d3c1be6c6045a17d747 0g1l0xsq2z7gqd7yly0g40y5836g0appumark77ny bnb1ud3q90r98l3mhd87kswv3h8cgrymzeljct8qn7", Args: cobra.MinimumNArgs(3), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -220,7 +220,7 @@ func QueryGetAtomicSwapsCmd(queryRoute string) *cobra.Command { Short: "query atomic swaps with optional filters", Long: strings.TrimSpace(`Query for all paginated atomic swaps that match optional filters: Example: -$ kvcli q bep3 swaps --involve=kava1l0xsq2z7gqd7yly0g40y5836g0appumark77ny +$ kvcli q bep3 swaps --involve=0g1l0xsq2z7gqd7yly0g40y5836g0appumark77ny $ kvcli q bep3 swaps --expiration=280 $ kvcli q bep3 swaps --status=(Open|Completed|Expired) $ kvcli q bep3 swaps --direction=(Incoming|Outgoing) diff --git a/x/bep3/keeper/msg_server_test.go b/x/bep3/keeper/msg_server_test.go index 02e216f0..df2fb485 100644 --- a/x/bep3/keeper/msg_server_test.go +++ b/x/bep3/keeper/msg_server_test.go @@ -12,6 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/bep3" "github.com/0glabs/0g-chain/x/bep3/keeper" "github.com/0glabs/0g-chain/x/bep3/types" @@ -35,7 +36,7 @@ func (suite *MsgServerTestSuite) SetupTest() { // Set up genesis state and initialize _, addrs := app.GeneratePrivKeyAddressPairs(3) - coins := sdk.NewCoins(c("bnb", 10000000000), c("a0gi", 10000)) + coins := sdk.NewCoins(c("bnb", 10000000000), c(chaincfg.AuxiliaryDenom, 10000)) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) tApp.InitializeFromGenesisStates(authGS, NewBep3GenStateMulti(cdc, addrs[0])) diff --git a/x/bep3/keeper/querier_test.go b/x/bep3/keeper/querier_test.go index bd03935c..240ebcd3 100644 --- a/x/bep3/keeper/querier_test.go +++ b/x/bep3/keeper/querier_test.go @@ -16,6 +16,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/bep3/keeper" "github.com/0glabs/0g-chain/x/bep3/types" ) @@ -41,7 +42,7 @@ func (suite *QuerierTestSuite) SetupTest() { // Set up auth GenesisState _, addrs := app.GeneratePrivKeyAddressPairs(11) - coins := sdk.NewCoins(c("bnb", 10000000000), c("a0gi", 10000)) + coins := sdk.NewCoins(c("bnb", 10000000000), c(chaincfg.AuxiliaryDenom, 10000)) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) tApp.InitializeFromGenesisStates( diff --git a/x/bep3/types/genesis_test.go b/x/bep3/types/genesis_test.go index eecbde98..de63e0bb 100644 --- a/x/bep3/types/genesis_test.go +++ b/x/bep3/types/genesis_test.go @@ -20,7 +20,7 @@ type GenesisTestSuite struct { } func (suite *GenesisTestSuite) SetupTest() { - coin := sdk.NewCoin("a0gi", sdk.OneInt()) + coin := chaincfg.MakeCoinForAuxiliaryDenom(1) suite.swaps = atomicSwaps(10) supply := types.NewAssetSupply(coin, coin, coin, coin, time.Duration(0)) diff --git a/x/bep3/types/supply_test.go b/x/bep3/types/supply_test.go index 35bd5e9f..b88e5960 100644 --- a/x/bep3/types/supply_test.go +++ b/x/bep3/types/supply_test.go @@ -5,12 +5,13 @@ import ( "time" sdkmath "cosmossdk.io/math" + "github.com/0glabs/0g-chain/chaincfg" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" ) func TestAssetSupplyValidate(t *testing.T) { - coin := sdk.NewCoin("a0gi", sdk.OneInt()) + coin := chaincfg.MakeCoinForAuxiliaryDenom(1) invalidCoin := sdk.Coin{Denom: "Invalid Denom", Amount: sdkmath.NewInt(-1)} testCases := []struct { msg string diff --git a/x/committee/keeper/msg_server_test.go b/x/committee/keeper/msg_server_test.go index 4a05238d..655b441d 100644 --- a/x/committee/keeper/msg_server_test.go +++ b/x/committee/keeper/msg_server_test.go @@ -6,12 +6,12 @@ import ( "github.com/stretchr/testify/suite" - sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/committee/keeper" "github.com/0glabs/0g-chain/x/committee/types" ) @@ -61,7 +61,7 @@ func (suite *MsgServerTestSuite) SetupTest() { []types.Proposal{}, []types.Vote{}, ) - suite.communityPoolAmt = sdk.NewCoins(sdk.NewCoin("neuron", sdkmath.NewInt(1000000000000000))) + suite.communityPoolAmt = sdk.NewCoins(chaincfg.MakeCoinForBaseDenom(1000000000000000)) suite.app.InitializeFromGenesisStates( app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(testGenesis)}, // TODO: not used? diff --git a/x/committee/types/committee.go b/x/committee/types/committee.go index 23812343..0dc30f91 100644 --- a/x/committee/types/committee.go +++ b/x/committee/types/committee.go @@ -4,6 +4,7 @@ import ( fmt "fmt" "time" + "github.com/0glabs/0g-chain/chaincfg" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -18,7 +19,7 @@ const ( BaseCommitteeType = "0g/BaseCommittee" MemberCommitteeType = "0g/MemberCommittee" // Committee is composed of member addresses that vote to enact proposals within their permissions TokenCommitteeType = "0g/TokenCommittee" // Committee is composed of token holders with voting power determined by total token balance - BondDenom = "neuron" + BondDenom = chaincfg.BondDenom ) // Marshal needed for protobuf compatibility. diff --git a/x/council/v1/client/cli/tx.go b/x/council/v1/client/cli/tx.go index 31f12d0e..a81cbe2d 100644 --- a/x/council/v1/client/cli/tx.go +++ b/x/council/v1/client/cli/tx.go @@ -171,10 +171,10 @@ func NewVoteCmd() *cobra.Command { tokens = val.GetTokens() } } - // the denom of token is neuron, need to convert to A0GI - a0gi := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)) + // the denom of token is base denom, need to convert to A0GI + a0giTokenCnt := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)) // 1_000 0AGI token / vote - numBallots := a0gi.Quo(sdk.NewInt(1_000)).Uint64() + numBallots := a0giTokenCnt.Quo(sdk.NewInt(1_000)).Uint64() ballots := make([]*types.Ballot, numBallots) for i := range ballots { ballotID := uint64(i) diff --git a/x/council/v1/types/codec.go b/x/council/v1/types/codec.go index fd2b1071..7a2c2031 100644 --- a/x/council/v1/types/codec.go +++ b/x/council/v1/types/codec.go @@ -21,8 +21,8 @@ var ( const ( // Amino names - registerName = "evmos/council/MsgRegister" - voteName = "evmos/council/MsgVote" + registerName = "0g/council/MsgRegister" + voteName = "0g/council/MsgVote" ) // NOTE: This is required for the GetSignBytes function diff --git a/x/evmutil/keeper/bank_keeper.go b/x/evmutil/keeper/bank_keeper.go index b176c6d1..40f7d4e8 100644 --- a/x/evmutil/keeper/bank_keeper.go +++ b/x/evmutil/keeper/bank_keeper.go @@ -9,64 +9,57 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/evmutil/types" ) -const ( - // EvmDenom is the gas denom used by the evm - EvmDenom = "neuron" - - // CosmosDenom is the gas denom used by the 0g-chain app - CosmosDenom = "ua0gi" -) - -// ConversionMultiplier is the conversion multiplier between neuron and ua0gi -var ConversionMultiplier = sdkmath.NewInt(1_000_000_000_000) +// ConversionMultiplier is the conversion multiplier between base denom and auxiliary denom +var ConversionMultiplier = sdkmath.NewInt(chaincfg.AuxiliaryDenomConversionMultiplier) var _ evmtypes.BankKeeper = EvmBankKeeper{} // EvmBankKeeper is a BankKeeper wrapper for the x/evm module to allow the use -// of the 18 decimal neuron coin on the evm. -// x/evm consumes gas and send coins by minting and burning neuron coins in its module +// of the 18 decimal base denom coin on the evm. +// x/evm consumes gas and send coins by minting and burning base denom coins in its module // account and then sending the funds to the target account. -// This keeper uses both the a0gi coin and a separate neuron balance to manage the +// This keeper uses both the auxiliary denom coin and a separate base denom balance to manage the // extra percision needed by the evm. type EvmBankKeeper struct { - neuronKeeper Keeper - bk types.BankKeeper - ak types.AccountKeeper + baseDenomKeeper Keeper + bk types.BankKeeper + ak types.AccountKeeper } -func NewEvmBankKeeper(neuronKeeper Keeper, bk types.BankKeeper, ak types.AccountKeeper) EvmBankKeeper { +func NewEvmBankKeeper(baseKeeper Keeper, bk types.BankKeeper, ak types.AccountKeeper) EvmBankKeeper { return EvmBankKeeper{ - neuronKeeper: neuronKeeper, - bk: bk, - ak: ak, + baseDenomKeeper: baseKeeper, + bk: bk, + ak: ak, } } -// GetBalance returns the total **spendable** balance of neuron for a given account by address. +// GetBalance returns the total **spendable** balance of base denom for a given account by address. func (k EvmBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin { - if denom != EvmDenom { - panic(fmt.Errorf("only evm denom %s is supported by EvmBankKeeper", EvmDenom)) + if denom != chaincfg.BaseDenom { + panic(fmt.Errorf("only evm denom %s is supported by EvmBankKeeper", chaincfg.BaseDenom)) } spendableCoins := k.bk.SpendableCoins(ctx, addr) - cosmosDenomFromBank := spendableCoins.AmountOf(CosmosDenom) - evmDenomFromBank := spendableCoins.AmountOf(EvmDenom) - evmDenomFromEvmBank := k.neuronKeeper.GetBalance(ctx, addr) + auxiliaryDenomFromBank := spendableCoins.AmountOf(chaincfg.AuxiliaryDenom) + baseDenomFromBank := spendableCoins.AmountOf(chaincfg.BaseDenom) + baseDenomFromEvmBank := k.baseDenomKeeper.GetBalance(ctx, addr) var total sdkmath.Int - if cosmosDenomFromBank.IsPositive() { - total = cosmosDenomFromBank.Mul(ConversionMultiplier).Add(evmDenomFromBank).Add(evmDenomFromEvmBank) + if auxiliaryDenomFromBank.IsPositive() { + total = auxiliaryDenomFromBank.Mul(ConversionMultiplier).Add(baseDenomFromBank).Add(baseDenomFromEvmBank) } else { - total = evmDenomFromBank.Add(evmDenomFromEvmBank) + total = baseDenomFromBank.Add(baseDenomFromEvmBank) } - return sdk.NewCoin(EvmDenom, total) + return sdk.NewCoin(chaincfg.BaseDenom, total) } -// SendCoins transfers neuron coins from a AccAddress to an AccAddress. +// SendCoins transfers base denom coins from a AccAddress to an AccAddress. func (k EvmBankKeeper) SendCoins(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, amt sdk.Coins) error { // SendCoins method is not used by the evm module, but is required by the // evmtypes.BankKeeper interface. This must be updated if the evm module @@ -74,148 +67,148 @@ func (k EvmBankKeeper) SendCoins(ctx sdk.Context, senderAddr sdk.AccAddress, rec panic("not implemented") } -// SendCoinsFromModuleToAccount transfers neuron coins from a ModuleAccount to an AccAddress. +// SendCoinsFromModuleToAccount transfers base denom coins from a ModuleAccount to an AccAddress. // It will panic if the module account does not exist. An error is returned if the recipient // address is black-listed or if sending the tokens fails. func (k EvmBankKeeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error { - ua0gi, neuron, err := SplitNeuronCoins(amt) + auxiliaryDenomCoin, baseDemonCnt, err := SplitBaseDenomCoins(amt) if err != nil { return err } - if ua0gi.Amount.IsPositive() { - if err := k.bk.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, sdk.NewCoins(ua0gi)); err != nil { + if auxiliaryDenomCoin.Amount.IsPositive() { + if err := k.bk.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { return err } } senderAddr := k.GetModuleAddress(senderModule) - if err := k.ConvertOneUa0giToNeuronIfNeeded(ctx, senderAddr, neuron); err != nil { + if err := k.ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(ctx, senderAddr, baseDemonCnt); err != nil { return err } - if err := k.neuronKeeper.SendBalance(ctx, senderAddr, recipientAddr, neuron); err != nil { + if err := k.baseDenomKeeper.SendBalance(ctx, senderAddr, recipientAddr, baseDemonCnt); err != nil { return err } - return k.ConvertNeuronToUa0gi(ctx, recipientAddr) + return k.ConvertBaseDenomToAuxiliaryDenom(ctx, recipientAddr) } -// SendCoinsFromAccountToModule transfers neuron coins from an AccAddress to a ModuleAccount. +// SendCoinsFromAccountToModule transfers base denom coins from an AccAddress to a ModuleAccount. // It will panic if the module account does not exist. func (k EvmBankKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { - ua0gi, neuronNeeded, err := SplitNeuronCoins(amt) + auxiliaryDenomCoin, baseDenomCnt, err := SplitBaseDenomCoins(amt) if err != nil { return err } - if ua0gi.IsPositive() { - if err := k.bk.SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, sdk.NewCoins(ua0gi)); err != nil { + if auxiliaryDenomCoin.IsPositive() { + if err := k.bk.SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { return err } } - if err := k.ConvertOneUa0giToNeuronIfNeeded(ctx, senderAddr, neuronNeeded); err != nil { + if err := k.ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(ctx, senderAddr, baseDenomCnt); err != nil { return err } recipientAddr := k.GetModuleAddress(recipientModule) - if err := k.neuronKeeper.SendBalance(ctx, senderAddr, recipientAddr, neuronNeeded); err != nil { + if err := k.baseDenomKeeper.SendBalance(ctx, senderAddr, recipientAddr, baseDenomCnt); err != nil { return err } - return k.ConvertNeuronToUa0gi(ctx, recipientAddr) + return k.ConvertBaseDenomToAuxiliaryDenom(ctx, recipientAddr) } -// MintCoins mints neuron coins by minting the equivalent a0gi coins and any remaining neuron coins. +// MintCoins mints base denom coins by minting the equivalent auxiliary denom coins and any remaining base denom coins. // It will panic if the module account does not exist or is unauthorized. func (k EvmBankKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { - ua0gi, neuron, err := SplitNeuronCoins(amt) + auxiliaryDenomCoin, baseDemonCnt, err := SplitBaseDenomCoins(amt) if err != nil { return err } - if ua0gi.IsPositive() { - if err := k.bk.MintCoins(ctx, moduleName, sdk.NewCoins(ua0gi)); err != nil { + if auxiliaryDenomCoin.IsPositive() { + if err := k.bk.MintCoins(ctx, moduleName, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { return err } } recipientAddr := k.GetModuleAddress(moduleName) - if err := k.neuronKeeper.AddBalance(ctx, recipientAddr, neuron); err != nil { + if err := k.baseDenomKeeper.AddBalance(ctx, recipientAddr, baseDemonCnt); err != nil { return err } - return k.ConvertNeuronToUa0gi(ctx, recipientAddr) + return k.ConvertBaseDenomToAuxiliaryDenom(ctx, recipientAddr) } -// BurnCoins burns neuron coins by burning the equivalent a0gi coins and any remaining neuron coins. +// BurnCoins burns base denom coins by burning the equivalent auxiliary denom coins and any remaining base denom coins. // It will panic if the module account does not exist or is unauthorized. func (k EvmBankKeeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { - ua0gi, neuron, err := SplitNeuronCoins(amt) + auxiliaryDenomCoin, baseDemonCnt, err := SplitBaseDenomCoins(amt) if err != nil { return err } - if ua0gi.IsPositive() { - if err := k.bk.BurnCoins(ctx, moduleName, sdk.NewCoins(ua0gi)); err != nil { + if auxiliaryDenomCoin.IsPositive() { + if err := k.bk.BurnCoins(ctx, moduleName, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { return err } } moduleAddr := k.GetModuleAddress(moduleName) - if err := k.ConvertOneUa0giToNeuronIfNeeded(ctx, moduleAddr, neuron); err != nil { + if err := k.ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(ctx, moduleAddr, baseDemonCnt); err != nil { return err } - return k.neuronKeeper.RemoveBalance(ctx, moduleAddr, neuron) + return k.baseDenomKeeper.RemoveBalance(ctx, moduleAddr, baseDemonCnt) } -// ConvertOneUa0giToNeuronIfNeeded converts 1 a0gi to neuron for an address if -// its neuron balance is smaller than the neuronNeeded amount. -func (k EvmBankKeeper) ConvertOneUa0giToNeuronIfNeeded(ctx sdk.Context, addr sdk.AccAddress, neuronNeeded sdkmath.Int) error { - neuronBal := k.neuronKeeper.GetBalance(ctx, addr) - if neuronBal.GTE(neuronNeeded) { +// ConvertOneauxiliaryDenomToBaseDenomIfNeeded converts 1 auxiliary denom to base denom for an address if +// its base denom balance is smaller than the baseDenomCnt amount. +func (k EvmBankKeeper) ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(ctx sdk.Context, addr sdk.AccAddress, baseDenomCnt sdkmath.Int) error { + baseDenomBal := k.baseDenomKeeper.GetBalance(ctx, addr) + if baseDenomBal.GTE(baseDenomCnt) { return nil } - ua0giToStore := sdk.NewCoins(sdk.NewCoin(CosmosDenom, sdk.OneInt())) - if err := k.bk.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, ua0giToStore); err != nil { + auxiliaryDenomToStore := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdk.OneInt())) + if err := k.bk.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, auxiliaryDenomToStore); err != nil { return err } - // add 1a0gi equivalent of neuron to addr - neuronToReceive := ConversionMultiplier - if err := k.neuronKeeper.AddBalance(ctx, addr, neuronToReceive); err != nil { + // add 1 auxiliary denom equivalent of base denom to addr + baseDenomToReceive := ConversionMultiplier + if err := k.baseDenomKeeper.AddBalance(ctx, addr, baseDenomToReceive); err != nil { return err } return nil } -// ConvertNeuronToA0gi converts all available neuron to a0gi for a given AccAddress. -func (k EvmBankKeeper) ConvertNeuronToUa0gi(ctx sdk.Context, addr sdk.AccAddress) error { - totalNeuron := k.neuronKeeper.GetBalance(ctx, addr) - ua0gi, _, err := SplitNeuronCoins(sdk.NewCoins(sdk.NewCoin(EvmDenom, totalNeuron))) +// ConvertBaseDenomToauxiliaryDenom converts all available base denom to auxiliary denom for a given AccAddress. +func (k EvmBankKeeper) ConvertBaseDenomToAuxiliaryDenom(ctx sdk.Context, addr sdk.AccAddress) error { + totalBaseDenom := k.baseDenomKeeper.GetBalance(ctx, addr) + auxiliaryDenomCoin, _, err := SplitBaseDenomCoins(sdk.NewCoins(sdk.NewCoin(chaincfg.BaseDenom, totalBaseDenom))) if err != nil { return err } - // do nothing if account does not have enough neuron for a single a0gi - ua0giToReceive := ua0gi.Amount - if !ua0giToReceive.IsPositive() { + // do nothing if account does not have enough base denom for a single auxiliary denom + auxiliaryDenomToReceive := auxiliaryDenomCoin.Amount + if !auxiliaryDenomToReceive.IsPositive() { return nil } - // remove neuron used for converting to ua0gi - neuronToBurn := ua0giToReceive.Mul(ConversionMultiplier) - finalBal := totalNeuron.Sub(neuronToBurn) - if err := k.neuronKeeper.SetBalance(ctx, addr, finalBal); err != nil { + // remove base denom used for converting to auxiliary denom + baseDenomToBurn := auxiliaryDenomToReceive.Mul(ConversionMultiplier) + finalBal := totalBaseDenom.Sub(baseDenomToBurn) + if err := k.baseDenomKeeper.SetBalance(ctx, addr, finalBal); err != nil { return err } fromAddr := k.GetModuleAddress(types.ModuleName) - if err := k.bk.SendCoins(ctx, fromAddr, addr, sdk.NewCoins(ua0gi)); err != nil { + if err := k.bk.SendCoins(ctx, fromAddr, addr, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { return err } @@ -230,35 +223,35 @@ func (k EvmBankKeeper) GetModuleAddress(moduleName string) sdk.AccAddress { return addr } -// SplitNeuronCoins splits neuron coins to the equivalent a0gi coins and any remaining neuron balance. -// An error will be returned if the coins are not valid or if the coins are not the neuron denom. -func SplitNeuronCoins(coins sdk.Coins) (sdk.Coin, sdkmath.Int, error) { - neuron := sdk.ZeroInt() - ua0gi := sdk.NewCoin(CosmosDenom, sdk.ZeroInt()) +// SplitBaseDenomCoins splits base denom coins to the equivalent auxiliary denom coins and any remaining base denom balance. +// An error will be returned if the coins are not valid or if the coins are not the base denom. +func SplitBaseDenomCoins(coins sdk.Coins) (sdk.Coin, sdkmath.Int, error) { + baseDemonCnt := sdk.ZeroInt() + auxiliaryDenomAmt := sdk.NewCoin(chaincfg.AuxiliaryDenom, sdk.ZeroInt()) if len(coins) == 0 { - return ua0gi, neuron, nil + return auxiliaryDenomAmt, baseDemonCnt, nil } if err := ValidateEvmCoins(coins); err != nil { - return ua0gi, neuron, err + return auxiliaryDenomAmt, baseDemonCnt, err } // note: we should always have len(coins) == 1 here since coins cannot have dup denoms after we validate. coin := coins[0] remainingBalance := coin.Amount.Mod(ConversionMultiplier) if remainingBalance.IsPositive() { - neuron = remainingBalance + baseDemonCnt = remainingBalance } - ua0giAmount := coin.Amount.Quo(ConversionMultiplier) - if ua0giAmount.IsPositive() { - ua0gi = sdk.NewCoin(CosmosDenom, ua0giAmount) + auxiliaryDenomAmount := coin.Amount.Quo(ConversionMultiplier) + if auxiliaryDenomAmount.IsPositive() { + auxiliaryDenomAmt = sdk.NewCoin(chaincfg.AuxiliaryDenom, auxiliaryDenomAmount) } - return ua0gi, neuron, nil + return auxiliaryDenomAmt, baseDemonCnt, nil } -// ValidateEvmCoins validates the coins from evm is valid and is the EvmDenom (neuron). +// ValidateEvmCoins validates the coins from evm is valid and is the base denom. func ValidateEvmCoins(coins sdk.Coins) error { if len(coins) == 0 { return nil @@ -269,9 +262,9 @@ func ValidateEvmCoins(coins sdk.Coins) error { return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coins.String()) } - // validate that coin denom is neuron - if len(coins) != 1 || coins[0].Denom != EvmDenom { - errMsg := fmt.Sprintf("invalid evm coin denom, only %s is supported", EvmDenom) + // validate that coin denom is base denom + if len(coins) != 1 || coins[0].Denom != chaincfg.BaseDenom { + errMsg := fmt.Sprintf("invalid evm coin denom, only %s is supported", chaincfg.BaseDenom) return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, errMsg) } diff --git a/x/evmutil/keeper/bank_keeper_test.go b/x/evmutil/keeper/bank_keeper_test.go index 3014d19d..f99fb745 100644 --- a/x/evmutil/keeper/bank_keeper_test.go +++ b/x/evmutil/keeper/bank_keeper_test.go @@ -6,6 +6,7 @@ import ( "time" sdkmath "cosmossdk.io/math" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/evmutil/keeper" "github.com/0glabs/0g-chain/x/evmutil/testutil" "github.com/0glabs/0g-chain/x/evmutil/types" @@ -26,8 +27,8 @@ func (suite *evmBankKeeperTestSuite) SetupTest() { } func (suite *evmBankKeeperTestSuite) TestGetBalance_ReturnsSpendable() { - startingCoins := sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10)) - startingNeuron := sdkmath.NewInt(100) + startingCoins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10)) + startingBaseDenom := sdkmath.NewInt(100) now := tmtime.Now() endTime := now.Add(24 * time.Hour) @@ -37,24 +38,26 @@ func (suite *evmBankKeeperTestSuite) TestGetBalance_ReturnsSpendable() { err := suite.App.FundAccount(suite.Ctx, suite.Addrs[0], startingCoins) suite.Require().NoError(err) - err = suite.Keeper.SetBalance(suite.Ctx, suite.Addrs[0], startingNeuron) + err = suite.Keeper.SetBalance(suite.Ctx, suite.Addrs[0], startingBaseDenom) suite.Require().NoError(err) - coin := suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "neuron") - suite.Require().Equal(startingNeuron, coin.Amount) + coin := suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.BaseDenom) + suite.Require().Equal(startingBaseDenom, coin.Amount) ctx := suite.Ctx.WithBlockTime(now.Add(12 * time.Hour)) - coin = suite.EvmBankKeeper.GetBalance(ctx, suite.Addrs[0], "neuron") + coin = suite.EvmBankKeeper.GetBalance(ctx, suite.Addrs[0], chaincfg.BaseDenom) suite.Require().Equal(sdkmath.NewIntFromUint64(5_000_000_000_100), coin.Amount) } + func (suite *evmBankKeeperTestSuite) TestGetBalance_NotEvmDenom() { suite.Require().Panics(func() { - suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "ua0gi") + suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) }) suite.Require().Panics(func() { suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "busd") }) } + func (suite *evmBankKeeperTestSuite) TestGetBalance() { tests := []struct { name string @@ -62,41 +65,41 @@ func (suite *evmBankKeeperTestSuite) TestGetBalance() { expAmount sdkmath.Int }{ { - "ua0gi with neuron", + "auxiliary denom with base denom", sdk.NewCoins( - sdk.NewInt64Coin("neuron", 100), - sdk.NewInt64Coin("ua0gi", 10), + sdk.NewInt64Coin(chaincfg.BaseDenom, 100), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), ), - sdk.NewIntFromBigInt(makeBigIntByString("10000000000100")), + sdkmath.NewInt(10_000_000_000_100), }, { - "just neuron", + "just base denom", sdk.NewCoins( - sdk.NewInt64Coin("neuron", 100), + sdk.NewInt64Coin(chaincfg.BaseDenom, 100), sdk.NewInt64Coin("busd", 100), ), sdkmath.NewInt(100), }, { - "just ua0gi", + "just auxiliary denom", sdk.NewCoins( - sdk.NewInt64Coin("ua0gi", 10), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin("busd", 100), ), - sdk.NewIntFromBigInt(makeBigIntByString("10000000000000")), + sdkmath.NewInt(10_000_000_000_000), }, { - "no ua0gi or neuron", + "no auxiliary denom or base denom", sdk.NewCoins(), sdk.ZeroInt(), }, { - "with avaka that is more than 1 ua0gi", + "with avaka that is more than 1 auxiliary denom", sdk.NewCoins( - sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("20000000000220"))), - sdk.NewInt64Coin("ua0gi", 11), + sdk.NewInt64Coin(chaincfg.BaseDenom, 20_000_000_000_220), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 11), ), - sdk.NewIntFromBigInt(makeBigIntByString("31000000000220")), + sdkmath.NewInt(31_000_000_000_220), }, } @@ -105,15 +108,16 @@ func (suite *evmBankKeeperTestSuite) TestGetBalance() { suite.SetupTest() suite.FundAccountWithZgChain(suite.Addrs[0], tt.startingAmount) - coin := suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "neuron") + coin := suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.BaseDenom) suite.Require().Equal(tt.expAmount, coin.Amount) }) } } + func (suite *evmBankKeeperTestSuite) TestSendCoinsFromModuleToAccount() { startingModuleCoins := sdk.NewCoins( - sdk.NewInt64Coin("neuron", 200), - sdk.NewInt64Coin("ua0gi", 100), + sdk.NewInt64Coin(chaincfg.BaseDenom, 200), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100), ) tests := []struct { name string @@ -123,102 +127,102 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromModuleToAccount() { hasErr bool }{ { - "send more than 1 ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("12000000000010")))), + "send more than 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_010)), sdk.Coins{}, sdk.NewCoins( - sdk.NewInt64Coin("neuron", 10), - sdk.NewInt64Coin("ua0gi", 12), + sdk.NewInt64Coin(chaincfg.BaseDenom, 10), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 12), ), false, }, { - "send less than 1 ua0gi", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 122)), + "send less than 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 122)), sdk.Coins{}, sdk.NewCoins( - sdk.NewInt64Coin("neuron", 122), - sdk.NewInt64Coin("ua0gi", 0), + sdk.NewInt64Coin(chaincfg.BaseDenom, 122), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0), ), false, }, { - "send an exact amount of ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("98000000000000")))), + "send an exact amount of auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 98_000_000_000_000)), sdk.Coins{}, sdk.NewCoins( - sdk.NewInt64Coin("neuron", 0), - sdk.NewInt64Coin("ua0gi", 98), + sdk.NewInt64Coin(chaincfg.BaseDenom, 0o0), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 98), ), false, }, { - "send no neuron", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 0)), + "send no base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 0)), sdk.Coins{}, sdk.NewCoins( - sdk.NewInt64Coin("neuron", 0), - sdk.NewInt64Coin("ua0gi", 0), + sdk.NewInt64Coin(chaincfg.BaseDenom, 0), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0), ), false, }, { "errors if sending other coins", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 500), sdk.NewInt64Coin("busd", 1000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin("busd", 1000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "errors if not enough total neuron to cover", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("100000000001000")))), + "errors if not enough total base denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_001_000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "errors if not enough ua0gi to cover", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("200000000000000")))), + "errors if not enough auxiliary denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200_000_000_000_000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "converts receiver's neuron to ua0gi if there's enough neuron after the transfer", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("99000000000200")))), + "converts receiver's base denom to auxiliary denom if there's enough base denom after the transfer", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 99_000_000_000_200)), sdk.NewCoins( - sdk.NewInt64Coin("neuron", 999_999_999_900), - sdk.NewInt64Coin("ua0gi", 1), + sdk.NewInt64Coin(chaincfg.BaseDenom, 999_999_999_900), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1), ), sdk.NewCoins( - sdk.NewInt64Coin("neuron", 100), - sdk.NewInt64Coin("ua0gi", 101), + sdk.NewInt64Coin(chaincfg.BaseDenom, 100), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 101), ), false, }, { - "converts all of receiver's neuron to ua0gi even if somehow receiver has more than 1a0gi of neuron", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("12000000000100")))), + "converts all of receiver's base denom to auxiliary denom even if somehow receiver has more than 1 auxiliary denom of base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_100)), sdk.NewCoins( - sdk.NewInt64Coin("neuron", 5_999_999_999_990), - sdk.NewInt64Coin("ua0gi", 1), + sdk.NewInt64Coin(chaincfg.BaseDenom, 5_999_999_999_990), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1), ), sdk.NewCoins( - sdk.NewInt64Coin("neuron", 90), - sdk.NewInt64Coin("ua0gi", 19), + sdk.NewInt64Coin(chaincfg.BaseDenom, 90), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 19), ), false, }, { - "swap 1 ua0gi for neuron if module account doesn't have enough neuron", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("99000000001000")))), + "swap 1 auxiliary denom for base denom if module account doesn't have enough base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 99_000_000_001_000)), sdk.NewCoins( - sdk.NewInt64Coin("neuron", 200), - sdk.NewInt64Coin("ua0gi", 1), + sdk.NewInt64Coin(chaincfg.BaseDenom, 200), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1), ), sdk.NewCoins( - sdk.NewInt64Coin("neuron", 1200), - sdk.NewInt64Coin("ua0gi", 100), + sdk.NewInt64Coin(chaincfg.BaseDenom, 1200), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100), ), false, }, @@ -231,8 +235,8 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromModuleToAccount() { suite.FundAccountWithZgChain(suite.Addrs[0], tt.startingAccBal) suite.FundModuleAccountWithZgChain(evmtypes.ModuleName, startingModuleCoins) - // fund our module with some ua0gi to account for converting extra neuron back to ua0gi - suite.FundModuleAccountWithZgChain(types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10))) + // fund our module with some auxiliary denom to account for converting extra base denom back to auxiliary denom + suite.FundModuleAccountWithZgChain(types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10))) err := suite.EvmBankKeeper.SendCoinsFromModuleToAccount(suite.Ctx, evmtypes.ModuleName, suite.Addrs[0], tt.sendCoins) if tt.hasErr { @@ -242,23 +246,24 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromModuleToAccount() { suite.Require().NoError(err) } - // check ua0gi - a0giSender := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "ua0gi") - suite.Require().Equal(tt.expAccBal.AmountOf("ua0gi").Int64(), a0giSender.Amount.Int64()) + // check auxiliary denom + AuxiliaryDenomSender := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) + suite.Require().Equal(tt.expAccBal.AmountOf(chaincfg.AuxiliaryDenom).Int64(), AuxiliaryDenomSender.Amount.Int64()) - // check neuron - actualNeuron := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(tt.expAccBal.AmountOf("neuron").Int64(), actualNeuron.Int64()) + // check base denom + actualBaseDenom := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) + suite.Require().Equal(tt.expAccBal.AmountOf(chaincfg.BaseDenom).Int64(), actualBaseDenom.Int64()) }) } } + func (suite *evmBankKeeperTestSuite) TestSendCoinsFromAccountToModule() { startingAccCoins := sdk.NewCoins( - sdk.NewInt64Coin("neuron", 200), - sdk.NewInt64Coin("ua0gi", 100), + sdk.NewInt64Coin(chaincfg.BaseDenom, 200), + sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100), ) startingModuleCoins := sdk.NewCoins( - sdk.NewInt64Coin("neuron", 100_000_000_000), + sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_000), ) tests := []struct { name string @@ -268,36 +273,36 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromAccountToModule() { hasErr bool }{ { - "send more than 1 ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("12000000000010")))), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 190), sdk.NewInt64Coin("ua0gi", 88)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100_000_000_010), sdk.NewInt64Coin("ua0gi", 12)), + "send more than 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_010)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 190), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 88)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_010), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 12)), false, }, { - "send less than 1 ua0gi", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 122)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 78), sdk.NewInt64Coin("ua0gi", 100)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100_000_000_122), sdk.NewInt64Coin("ua0gi", 0)), + "send less than 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 122)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 78), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_122), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0)), false, }, { - "send an exact amount of ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("98000000000000")))), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 200), sdk.NewInt64Coin("ua0gi", 2)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100_000_000_000), sdk.NewInt64Coin("ua0gi", 98)), + "send an exact amount of auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 98_000_000_000_000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 2)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 98)), false, }, { - "send no neuron", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 0)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 200), sdk.NewInt64Coin("ua0gi", 100)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100_000_000_000), sdk.NewInt64Coin("ua0gi", 0)), + "send no base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 0)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0)), false, }, { "errors if sending other coins", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 500), sdk.NewInt64Coin("busd", 1000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin("busd", 1000)), sdk.Coins{}, sdk.Coins{}, true, @@ -305,39 +310,39 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromAccountToModule() { { "errors if have dup coins", sdk.Coins{ - sdk.NewInt64Coin("neuron", 12_000_000_000_000), - sdk.NewInt64Coin("neuron", 2_000_000_000_000), + sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_000), + sdk.NewInt64Coin(chaincfg.BaseDenom, 2_000_000_000_000), }, sdk.Coins{}, sdk.Coins{}, true, }, { - "errors if not enough total neuron to cover", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("100000000001000")))), + "errors if not enough total base denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_001_000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "errors if not enough ua0gi to cover", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("200000000000000")))), + "errors if not enough auxiliary denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200_000_000_000_000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "converts 1 ua0gi to neuron if not enough neuron to cover", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("99001000000000")))), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 999_000_000_200), sdk.NewInt64Coin("ua0gi", 0)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 101_000_000_000), sdk.NewInt64Coin("ua0gi", 99)), + "converts 1 auxiliary denom to base denom if not enough base denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 99_001_000_000_000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 999_000_000_200), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 101_000_000_000), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 99)), false, }, { - "converts receiver's neuron to ua0gi if there's enough neuron after the transfer", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 5_900_000_000_200)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100_000_000_000), sdk.NewInt64Coin("ua0gi", 94)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 200), sdk.NewInt64Coin("ua0gi", 6)), + "converts receiver's base denom to auxiliary denom if there's enough base denom after the transfer", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 5_900_000_000_200)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 94)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 6)), false, }, } @@ -357,66 +362,67 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromAccountToModule() { } // check sender balance - a0giSender := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "ua0gi") - suite.Require().Equal(tt.expSenderCoins.AmountOf("ua0gi").Int64(), a0giSender.Amount.Int64()) - actualNeuron := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(tt.expSenderCoins.AmountOf("neuron").Int64(), actualNeuron.Int64()) + AuxiliaryDenomSender := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) + suite.Require().Equal(tt.expSenderCoins.AmountOf(chaincfg.AuxiliaryDenom).Int64(), AuxiliaryDenomSender.Amount.Int64()) + actualBaseDenom := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) + suite.Require().Equal(tt.expSenderCoins.AmountOf(chaincfg.BaseDenom).Int64(), actualBaseDenom.Int64()) // check module balance moduleAddr := suite.AccountKeeper.GetModuleAddress(evmtypes.ModuleName) - a0giSender = suite.BankKeeper.GetBalance(suite.Ctx, moduleAddr, "ua0gi") - suite.Require().Equal(tt.expModuleCoins.AmountOf("ua0gi").Int64(), a0giSender.Amount.Int64()) - actualNeuron = suite.Keeper.GetBalance(suite.Ctx, moduleAddr) - suite.Require().Equal(tt.expModuleCoins.AmountOf("neuron").Int64(), actualNeuron.Int64()) + AuxiliaryDenomSender = suite.BankKeeper.GetBalance(suite.Ctx, moduleAddr, chaincfg.AuxiliaryDenom) + suite.Require().Equal(tt.expModuleCoins.AmountOf(chaincfg.AuxiliaryDenom).Int64(), AuxiliaryDenomSender.Amount.Int64()) + actualBaseDenom = suite.Keeper.GetBalance(suite.Ctx, moduleAddr) + suite.Require().Equal(tt.expModuleCoins.AmountOf(chaincfg.BaseDenom).Int64(), actualBaseDenom.Int64()) }) } } + func (suite *evmBankKeeperTestSuite) TestBurnCoins() { - startingA0gi := sdkmath.NewInt(100) + startingAuxiliaryDenom := sdkmath.NewInt(100) tests := []struct { - name string - burnCoins sdk.Coins - expA0gi sdkmath.Int - expNeuron sdkmath.Int - hasErr bool - neuronStart sdkmath.Int + name string + burnCoins sdk.Coins + expAuxiliaryDenom sdkmath.Int + expBaseDenom sdkmath.Int + hasErr bool + baseDenomStart sdkmath.Int }{ { - "burn more than 1 ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("12021000000002")))), + "burn more than 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_021_000_000_002)), sdkmath.NewInt(88), sdkmath.NewInt(100_000_000_000), false, - sdk.NewIntFromBigInt(makeBigIntByString("121000000002")), + sdkmath.NewInt(121_000_000_002), }, { - "burn less than 1 ua0gi", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 122)), + "burn less than 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 122)), sdkmath.NewInt(100), sdkmath.NewInt(878), false, sdkmath.NewInt(1000), }, { - "burn an exact amount of ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("98000000000000")))), + "burn an exact amount of auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 98_000_000_000_000)), sdkmath.NewInt(2), sdkmath.NewInt(10), false, sdkmath.NewInt(10), }, { - "burn no neuron", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 0)), - startingA0gi, + "burn no base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 0)), + startingAuxiliaryDenom, sdk.ZeroInt(), false, sdk.ZeroInt(), }, { "errors if burning other coins", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 500), sdk.NewInt64Coin("busd", 1000)), - startingA0gi, + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin("busd", 1000)), + startingAuxiliaryDenom, sdkmath.NewInt(100), true, sdkmath.NewInt(100), @@ -424,41 +430,41 @@ func (suite *evmBankKeeperTestSuite) TestBurnCoins() { { "errors if have dup coins", sdk.Coins{ - sdk.NewInt64Coin("neuron", 12_000_000_000_000), - sdk.NewInt64Coin("neuron", 2_000_000_000_000), + sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_000), + sdk.NewInt64Coin(chaincfg.BaseDenom, 2_000_000_000_000), }, - startingA0gi, + startingAuxiliaryDenom, sdk.ZeroInt(), true, sdk.ZeroInt(), }, { "errors if burn amount is negative", - sdk.Coins{sdk.Coin{Denom: "neuron", Amount: sdkmath.NewInt(-100)}}, - startingA0gi, + sdk.Coins{sdk.Coin{Denom: chaincfg.BaseDenom, Amount: sdkmath.NewInt(-100)}}, + startingAuxiliaryDenom, sdkmath.NewInt(50), true, sdkmath.NewInt(50), }, { - "errors if not enough neuron to cover burn", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("100999000000000")))), + "errors if not enough base denom to cover burn", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_999_000_000_000)), sdkmath.NewInt(0), sdkmath.NewInt(99_000_000_000), true, sdkmath.NewInt(99_000_000_000), }, { - "errors if not enough ua0gi to cover burn", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("200000000000000")))), + "errors if not enough auxiliary denom to cover burn", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200_000_000_000_000)), sdkmath.NewInt(100), sdk.ZeroInt(), true, sdk.ZeroInt(), }, { - "converts 1 ua0gi to neuron if not enough neuron to cover", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("12021000000002")))), + "converts 1 auxiliary denom to base denom if not enough base denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_021_000_000_002)), sdkmath.NewInt(87), sdkmath.NewInt(980_000_000_000), false, @@ -470,8 +476,8 @@ func (suite *evmBankKeeperTestSuite) TestBurnCoins() { suite.Run(tt.name, func() { suite.SetupTest() startingCoins := sdk.NewCoins( - sdk.NewCoin("ua0gi", startingA0gi), - sdk.NewCoin("neuron", tt.neuronStart), + sdk.NewCoin(chaincfg.AuxiliaryDenom, startingAuxiliaryDenom), + sdk.NewCoin(chaincfg.BaseDenom, tt.baseDenomStart), ) suite.FundModuleAccountWithZgChain(evmtypes.ModuleName, startingCoins) @@ -483,52 +489,53 @@ func (suite *evmBankKeeperTestSuite) TestBurnCoins() { suite.Require().NoError(err) } - // check ua0gi - a0giActual := suite.BankKeeper.GetBalance(suite.Ctx, suite.EvmModuleAddr, "ua0gi") - suite.Require().Equal(tt.expA0gi, a0giActual.Amount) + // check auxiliary denom + AuxiliaryDenomActual := suite.BankKeeper.GetBalance(suite.Ctx, suite.EvmModuleAddr, chaincfg.AuxiliaryDenom) + suite.Require().Equal(tt.expAuxiliaryDenom, AuxiliaryDenomActual.Amount) - // check neuron - neuronActual := suite.Keeper.GetBalance(suite.Ctx, suite.EvmModuleAddr) - suite.Require().Equal(tt.expNeuron, neuronActual) + // check base denom + baseDenomActual := suite.Keeper.GetBalance(suite.Ctx, suite.EvmModuleAddr) + suite.Require().Equal(tt.expBaseDenom, baseDenomActual) }) } } + func (suite *evmBankKeeperTestSuite) TestMintCoins() { tests := []struct { - name string - mintCoins sdk.Coins - ua0gi sdkmath.Int - neuron sdkmath.Int - hasErr bool - neuronStart sdkmath.Int + name string + mintCoins sdk.Coins + AuxiliaryDenomCnt sdkmath.Int + baseDenomCnt sdkmath.Int + hasErr bool + baseDenomStart sdkmath.Int }{ { - "mint more than 1 ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("12021000000002")))), + "mint more than 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_021_000_000_002)), sdkmath.NewInt(12), sdkmath.NewInt(21_000_000_002), false, sdk.ZeroInt(), }, { - "mint less than 1 ua0gi", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 901_000_000_001)), + "mint less than 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 901_000_000_001)), sdk.ZeroInt(), sdkmath.NewInt(901_000_000_001), false, sdk.ZeroInt(), }, { - "mint an exact amount of ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("123000000000000000")))), + "mint an exact amount of auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 123_000_000_000_000_000)), sdkmath.NewInt(123_000), sdk.ZeroInt(), false, sdk.ZeroInt(), }, { - "mint no neuron", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 0)), + "mint no base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 0)), sdk.ZeroInt(), sdk.ZeroInt(), false, @@ -536,7 +543,7 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { }, { "errors if minting other coins", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 500), sdk.NewInt64Coin("busd", 1000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin("busd", 1000)), sdk.ZeroInt(), sdkmath.NewInt(100), true, @@ -545,8 +552,8 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { { "errors if have dup coins", sdk.Coins{ - sdk.NewInt64Coin("neuron", 12_000_000_000_000), - sdk.NewInt64Coin("neuron", 2_000_000_000_000), + sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_000), + sdk.NewInt64Coin(chaincfg.BaseDenom, 2_000_000_000_000), }, sdk.ZeroInt(), sdk.ZeroInt(), @@ -555,35 +562,35 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { }, { "errors if mint amount is negative", - sdk.Coins{sdk.Coin{Denom: "neuron", Amount: sdkmath.NewInt(-100)}}, + sdk.Coins{sdk.Coin{Denom: chaincfg.BaseDenom, Amount: sdkmath.NewInt(-100)}}, sdk.ZeroInt(), sdkmath.NewInt(50), true, sdkmath.NewInt(50), }, { - "adds to existing neuron balance", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("12021000000002")))), + "adds to existing base denom balance", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_021_000_000_002)), sdkmath.NewInt(12), sdkmath.NewInt(21_000_000_102), false, sdkmath.NewInt(100), }, { - "convert neuron balance to ua0gi if it exceeds 1 ua0gi", - sdk.NewCoins(sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("10999000000000")))), + "convert base denom balance to auxiliary denom if it exceeds 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 10_999_000_000_000)), sdkmath.NewInt(12), sdkmath.NewInt(1_200_000_001), false, - sdkmath.NewIntFromBigInt(makeBigIntByString("1002200000001")), + sdkmath.NewInt(1_002_200_000_001), }, } for _, tt := range tests { suite.Run(tt.name, func() { suite.SetupTest() - suite.FundModuleAccountWithZgChain(types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10))) - suite.FundModuleAccountWithZgChain(evmtypes.ModuleName, sdk.NewCoins(sdk.NewCoin("neuron", tt.neuronStart))) + suite.FundModuleAccountWithZgChain(types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10))) + suite.FundModuleAccountWithZgChain(evmtypes.ModuleName, sdk.NewCoins(sdk.NewCoin(chaincfg.BaseDenom, tt.baseDenomStart))) err := suite.EvmBankKeeper.MintCoins(suite.Ctx, evmtypes.ModuleName, tt.mintCoins) if tt.hasErr { @@ -593,13 +600,13 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { suite.Require().NoError(err) } - // check ua0gi - a0giActual := suite.BankKeeper.GetBalance(suite.Ctx, suite.EvmModuleAddr, "ua0gi") - suite.Require().Equal(tt.ua0gi, a0giActual.Amount) + // check auxiliary denom + AuxiliaryDenomActual := suite.BankKeeper.GetBalance(suite.Ctx, suite.EvmModuleAddr, chaincfg.AuxiliaryDenom) + suite.Require().Equal(tt.AuxiliaryDenomCnt, AuxiliaryDenomActual.Amount) - // check neuron - neuronActual := suite.Keeper.GetBalance(suite.Ctx, suite.EvmModuleAddr) - suite.Require().Equal(tt.neuron, neuronActual) + // check base denom + baseDenomActual := suite.Keeper.GetBalance(suite.Ctx, suite.EvmModuleAddr) + suite.Require().Equal(tt.baseDenomCnt, baseDenomActual) }) } } @@ -612,22 +619,22 @@ func (suite *evmBankKeeperTestSuite) TestValidateEvmCoins() { }{ { "valid coins", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 500)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500)), false, }, { "dup coins", - sdk.Coins{sdk.NewInt64Coin("neuron", 500), sdk.NewInt64Coin("neuron", 500)}, + sdk.Coins{sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin(chaincfg.BaseDenom, 500)}, true, }, { "not evm coins", - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 500)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 500)), true, }, { "negative coins", - sdk.Coins{sdk.Coin{Denom: "neuron", Amount: sdkmath.NewInt(-500)}}, + sdk.Coins{sdk.Coin{Denom: chaincfg.BaseDenom, Amount: sdkmath.NewInt(-500)}}, true, }, } @@ -643,8 +650,8 @@ func (suite *evmBankKeeperTestSuite) TestValidateEvmCoins() { } } -func (suite *evmBankKeeperTestSuite) TestConvertOneA0giToNeuronIfNeeded() { - neuronNeeded := sdkmath.NewInt(200) +func (suite *evmBankKeeperTestSuite) TestConvertOneAuxiliaryDenomToBaseDenomIfNeeded() { + baseDenomNeeded := sdkmath.NewInt(200) tests := []struct { name string startingCoins sdk.Coins @@ -652,21 +659,21 @@ func (suite *evmBankKeeperTestSuite) TestConvertOneA0giToNeuronIfNeeded() { success bool }{ { - "not enough ua0gi for conversion", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100)), + "not enough auxiliary denom for conversion", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100)), false, }, { - "converts 1 ua0gi to neuron", - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10), sdk.NewInt64Coin("neuron", 100)), - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 9), sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("1000000000100")))), + "converts 1 auxiliary denom to base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 9), sdk.NewInt64Coin(chaincfg.BaseDenom, 1_000_000_000_100)), true, }, { "conversion not needed", - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10), sdk.NewInt64Coin("neuron", 200)), - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10), sdk.NewInt64Coin("neuron", 200)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 200)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 200)), true, }, } @@ -675,11 +682,11 @@ func (suite *evmBankKeeperTestSuite) TestConvertOneA0giToNeuronIfNeeded() { suite.SetupTest() suite.FundAccountWithZgChain(suite.Addrs[0], tt.startingCoins) - err := suite.EvmBankKeeper.ConvertOneUa0giToNeuronIfNeeded(suite.Ctx, suite.Addrs[0], neuronNeeded) - moduleZgChain := suite.BankKeeper.GetBalance(suite.Ctx, suite.AccountKeeper.GetModuleAddress(types.ModuleName), "ua0gi") + err := suite.EvmBankKeeper.ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(suite.Ctx, suite.Addrs[0], baseDenomNeeded) + moduleZgChain := suite.BankKeeper.GetBalance(suite.Ctx, suite.AccountKeeper.GetModuleAddress(types.ModuleName), chaincfg.AuxiliaryDenom) if tt.success { suite.Require().NoError(err) - if tt.startingCoins.AmountOf("neuron").LT(neuronNeeded) { + if tt.startingCoins.AmountOf(chaincfg.BaseDenom).LT(baseDenomNeeded) { suite.Require().Equal(sdk.OneInt(), moduleZgChain.Amount) } } else { @@ -687,52 +694,54 @@ func (suite *evmBankKeeperTestSuite) TestConvertOneA0giToNeuronIfNeeded() { suite.Require().Equal(sdk.ZeroInt(), moduleZgChain.Amount) } - neuron := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(tt.expectedCoins.AmountOf("neuron"), neuron) - ua0gi := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "ua0gi") - suite.Require().Equal(tt.expectedCoins.AmountOf("ua0gi"), ua0gi.Amount) + baseDenomCnt := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.BaseDenom), baseDenomCnt) + AuxiliaryDenomCoin := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.AuxiliaryDenom), AuxiliaryDenomCoin.Amount) }) } } -func (suite *evmBankKeeperTestSuite) TestConvertNeuronToA0gi() { + +func (suite *evmBankKeeperTestSuite) TestConvertBaseDenomToAuxiliaryDenom() { tests := []struct { name string startingCoins sdk.Coins expectedCoins sdk.Coins }{ { - "not enough ua0gi", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 100), sdk.NewInt64Coin("ua0gi", 0)), + "not enough auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0)), }, { - "converts neuron for 1 ua0gi", - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10), sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("1000000000003")))), - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 11), sdk.NewInt64Coin("neuron", 3)), + "converts base denom for 1 auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 1_000_000_000_003)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 11), sdk.NewInt64Coin(chaincfg.BaseDenom, 3)), }, { - "converts more than 1 ua0gi of neuron", - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10), sdk.NewCoin("neuron", sdk.NewIntFromBigInt(makeBigIntByString("8000000000123")))), - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 18), sdk.NewInt64Coin("neuron", 123)), + "converts more than 1 auxiliary denom of base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 8_000_000_000_123)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 18), sdk.NewInt64Coin(chaincfg.BaseDenom, 123)), }, } for _, tt := range tests { suite.Run(tt.name, func() { suite.SetupTest() - err := suite.App.FundModuleAccount(suite.Ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 10))) + err := suite.App.FundModuleAccount(suite.Ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10))) suite.Require().NoError(err) suite.FundAccountWithZgChain(suite.Addrs[0], tt.startingCoins) - err = suite.EvmBankKeeper.ConvertNeuronToUa0gi(suite.Ctx, suite.Addrs[0]) + err = suite.EvmBankKeeper.ConvertBaseDenomToAuxiliaryDenom(suite.Ctx, suite.Addrs[0]) suite.Require().NoError(err) - neuron := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(tt.expectedCoins.AmountOf("neuron"), neuron) - ua0gi := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "ua0gi") - suite.Require().Equal(tt.expectedCoins.AmountOf("ua0gi"), ua0gi.Amount) + baseDenomCnt := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.BaseDenom), baseDenomCnt) + AuxiliaryDenomCoin := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.AuxiliaryDenom), AuxiliaryDenomCoin.Amount) }) } } -func (suite *evmBankKeeperTestSuite) TestSplitNeuronCoins() { + +func (suite *evmBankKeeperTestSuite) TestSplitBaseDenomCoins() { tests := []struct { name string coins sdk.Coins @@ -741,7 +750,7 @@ func (suite *evmBankKeeperTestSuite) TestSplitNeuronCoins() { }{ { "invalid coins", - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 500)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 500)), nil, true, }, @@ -752,33 +761,33 @@ func (suite *evmBankKeeperTestSuite) TestSplitNeuronCoins() { false, }, { - "ua0gi & neuron coins", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 8_000_000_000_123)), - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 8), sdk.NewInt64Coin("neuron", 123)), + "auxiliary denom & base denom coins", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 8_000_000_000_123)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 8), sdk.NewInt64Coin(chaincfg.BaseDenom, 123)), false, }, { - "only neuron", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 10_123)), - sdk.NewCoins(sdk.NewInt64Coin("neuron", 10_123)), + "only base denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 10_123)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 10_123)), false, }, { - "only ua0gi", - sdk.NewCoins(sdk.NewInt64Coin("neuron", 5_000_000_000_000)), - sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 5)), + "only auxiliary denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 5_000_000_000_000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 5)), false, }, } for _, tt := range tests { suite.Run(tt.name, func() { - ua0gi, neuron, err := keeper.SplitNeuronCoins(tt.coins) + AuxiliaryDenomCoin, baseDenomCnt, err := keeper.SplitBaseDenomCoins(tt.coins) if tt.shouldErr { suite.Require().Error(err) } else { suite.Require().NoError(err) - suite.Require().Equal(tt.expectedCoins.AmountOf("ua0gi"), ua0gi.Amount) - suite.Require().Equal(tt.expectedCoins.AmountOf("neuron"), neuron) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.AuxiliaryDenom), AuxiliaryDenomCoin.Amount) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.BaseDenom), baseDenomCnt) } }) } diff --git a/x/evmutil/keeper/invariants.go b/x/evmutil/keeper/invariants.go index 6b3a1db0..db406093 100644 --- a/x/evmutil/keeper/invariants.go +++ b/x/evmutil/keeper/invariants.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/evmutil/types" ) @@ -50,7 +51,7 @@ func FullyBackedInvariant(bankK types.BankKeeper, k Keeper) sdk.Invariant { }) bankAddr := authtypes.NewModuleAddress(types.ModuleName) - bankBalance := bankK.GetBalance(ctx, bankAddr, CosmosDenom).Amount.Mul(ConversionMultiplier) + bankBalance := bankK.GetBalance(ctx, bankAddr, chaincfg.AuxiliaryDenom).Amount.Mul(ConversionMultiplier) broken = totalMinorBalances.GT(bankBalance) diff --git a/x/evmutil/keeper/invariants_test.go b/x/evmutil/keeper/invariants_test.go index 4756b66c..946ce177 100644 --- a/x/evmutil/keeper/invariants_test.go +++ b/x/evmutil/keeper/invariants_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/evmutil/keeper" "github.com/0glabs/0g-chain/x/evmutil/testutil" "github.com/0glabs/0g-chain/x/evmutil/types" @@ -49,7 +50,7 @@ func (suite *invariantTestSuite) SetupValidState() { suite.FundModuleAccountWithZgChain( types.ModuleName, sdk.NewCoins( - sdk.NewCoin("ua0gi", sdkmath.NewInt(2)), // ( sum of all minor balances ) / conversion multiplier + sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2)), // ( sum of all minor balances ) / conversion multiplier ), ) @@ -159,8 +160,8 @@ func (suite *invariantTestSuite) TestSmallBalances() { // increase minor balance at least above conversion multiplier suite.Keeper.AddBalance(suite.Ctx, suite.Addrs[0], keeper.ConversionMultiplier) - // add same number of a0gi to avoid breaking other invariants - amt := sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1)) + // add same number of auxiliary denom to avoid breaking other invariants + amt := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1)) suite.Require().NoError( suite.App.FundModuleAccount(suite.Ctx, types.ModuleName, amt), ) diff --git a/x/evmutil/keeper/keeper.go b/x/evmutil/keeper/keeper.go index 967021c3..7cb8ea72 100644 --- a/x/evmutil/keeper/keeper.go +++ b/x/evmutil/keeper/keeper.go @@ -115,7 +115,7 @@ func (k Keeper) SetAccount(ctx sdk.Context, account types.Account) error { return nil } -// GetBalance returns the total balance of neuron for a given account by address. +// GetBalance returns the total balance of base denom for a given account by address. func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int { account := k.GetAccount(ctx, addr) if account == nil { @@ -124,7 +124,7 @@ func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int { return account.Balance } -// SetBalance sets the total balance of neuron for a given account by address. +// SetBalance sets the total balance of base denom for a given account by address. func (k Keeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, bal sdkmath.Int) error { account := k.GetAccount(ctx, addr) if account == nil { @@ -140,10 +140,10 @@ func (k Keeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, bal sdkmath.Int return k.SetAccount(ctx, *account) } -// SendBalance transfers the neuron balance from sender addr to recipient addr. +// SendBalance transfers the base denom balance from sender addr to recipient addr. func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, amt sdkmath.Int) error { if amt.IsNegative() { - return fmt.Errorf("cannot send a negative amount of neuron: %d", amt) + return fmt.Errorf("cannot send a negative amount of base denom: %d", amt) } if amt.IsZero() { @@ -162,13 +162,13 @@ func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipien return k.SetBalance(ctx, recipientAddr, receiverBal) } -// AddBalance increments the neuron balance of an address. +// AddBalance increments the base denom balance of an address. func (k Keeper) AddBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdkmath.Int) error { bal := k.GetBalance(ctx, addr) return k.SetBalance(ctx, addr, amt.Add(bal)) } -// RemoveBalance decrements the neuron balance of an address. +// RemoveBalance decrements the base denom balance of an address. func (k Keeper) RemoveBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdkmath.Int) error { if amt.IsNegative() { return fmt.Errorf("cannot remove a negative amount from balance: %d", amt) diff --git a/x/evmutil/testutil/suite.go b/x/evmutil/testutil/suite.go index 1d2cd28d..b5d1af73 100644 --- a/x/evmutil/testutil/suite.go +++ b/x/evmutil/testutil/suite.go @@ -37,6 +37,7 @@ import ( "github.com/tendermint/tendermint/version" "github.com/0glabs/0g-chain/app" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/evmutil/keeper" "github.com/0glabs/0g-chain/x/evmutil/types" ) @@ -81,14 +82,14 @@ func (suite *Suite) SetupTest() { suite.Addrs = addrs evmGenesis := evmtypes.DefaultGenesisState() - evmGenesis.Params.EvmDenom = keeper.EvmDenom + evmGenesis.Params.EvmDenom = chaincfg.BaseDenom feemarketGenesis := feemarkettypes.DefaultGenesisState() feemarketGenesis.Params.EnableHeight = 1 feemarketGenesis.Params.NoBaseFee = false cdc := suite.App.AppCodec() - coins := sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1000_000_000_000)) + coins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1000_000_000_000_000_000)) authGS := app.NewFundedGenStateWithSameCoins(cdc, coins, []sdk.AccAddress{ sdk.AccAddress(suite.Key1.PubKey().Address()), sdk.AccAddress(suite.Key2.PubKey().Address()), @@ -185,28 +186,28 @@ func (suite *Suite) ModuleBalance(denom string) sdk.Int { } func (suite *Suite) FundAccountWithZgChain(addr sdk.AccAddress, coins sdk.Coins) { - ua0gi := coins.AmountOf("ua0gi") - if ua0gi.IsPositive() { - err := suite.App.FundAccount(suite.Ctx, addr, sdk.NewCoins(sdk.NewCoin("ua0gi", ua0gi))) + AuxiliaryDenomAmt := coins.AmountOf(chaincfg.AuxiliaryDenom) + if AuxiliaryDenomAmt.IsPositive() { + err := suite.App.FundAccount(suite.Ctx, addr, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, AuxiliaryDenomAmt))) suite.Require().NoError(err) } - neuron := coins.AmountOf("neuron") - if neuron.IsPositive() { - err := suite.Keeper.SetBalance(suite.Ctx, addr, neuron) + baseDenomAmt := coins.AmountOf(chaincfg.BaseDenom) + if baseDenomAmt.IsPositive() { + err := suite.Keeper.SetBalance(suite.Ctx, addr, baseDenomAmt) suite.Require().NoError(err) } } func (suite *Suite) FundModuleAccountWithZgChain(moduleName string, coins sdk.Coins) { - ua0gi := coins.AmountOf("ua0gi") - if ua0gi.IsPositive() { - err := suite.App.FundModuleAccount(suite.Ctx, moduleName, sdk.NewCoins(sdk.NewCoin("ua0gi", ua0gi))) + AuxiliaryDenomAmt := coins.AmountOf(chaincfg.AuxiliaryDenom) + if AuxiliaryDenomAmt.IsPositive() { + err := suite.App.FundModuleAccount(suite.Ctx, moduleName, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, AuxiliaryDenomAmt))) suite.Require().NoError(err) } - neuron := coins.AmountOf("neuron") - if neuron.IsPositive() { + baseDenomAmt := coins.AmountOf(chaincfg.BaseDenom) + if baseDenomAmt.IsPositive() { addr := suite.AccountKeeper.GetModuleAddress(moduleName) - err := suite.Keeper.SetBalance(suite.Ctx, addr, neuron) + err := suite.Keeper.SetBalance(suite.Ctx, addr, baseDenomAmt) suite.Require().NoError(err) } } @@ -217,7 +218,7 @@ func (suite *Suite) DeployERC20() types.InternalEVMAddress { suite.App.FundModuleAccount( suite.Ctx, types.ModuleName, - sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(0))), + sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(0))), ) contractAddr, err := suite.Keeper.DeployTestMintableERC20Contract(suite.Ctx, "USDC", "USDC", uint8(18)) @@ -318,7 +319,7 @@ func (suite *Suite) SendTx( // Mint the max gas to the FeeCollector to ensure balance in case of refund suite.MintFeeCollector(sdk.NewCoins( sdk.NewCoin( - "ua0gi", + chaincfg.AuxiliaryDenom, sdkmath.NewInt(baseFee.Int64()*int64(gasRes.Gas*2)), ))) diff --git a/x/evmutil/types/conversion_pair.pb.go b/x/evmutil/types/conversion_pair.pb.go index db6495d5..cd090415 100644 --- a/x/evmutil/types/conversion_pair.pb.go +++ b/x/evmutil/types/conversion_pair.pb.go @@ -28,7 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // allowed to be converted between ERC20 and sdk.Coin type ConversionPair struct { // ERC20 address of the token on the 0gChain EVM - ZgChainERC20Address HexBytes `protobuf:"bytes,1,opt,name=zgChain_erc20_address,json=zgChainErc20Address,proto3,casttype=HexBytes" json:"zgChain_erc20_address,omitempty"` + ZgChainERC20Address HexBytes `protobuf:"bytes,1,opt,name=zgchain_erc20_address,json=zgchainErc20Address,proto3,casttype=HexBytes" json:"zgchain_erc20_address,omitempty"` // Denom of the corresponding sdk.Coin Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` } @@ -134,20 +134,20 @@ var fileDescriptor_6bad9d4ffa6874ec = []byte{ 0x62, 0xd2, 0xd5, 0xa9, 0x08, 0x67, 0x2c, 0x92, 0x9e, 0x08, 0xed, 0x09, 0xf1, 0x22, 0x6d, 0x12, 0x89, 0x58, 0xa0, 0xda, 0x92, 0x53, 0xad, 0x40, 0xb5, 0x02, 0x6d, 0xd4, 0xb9, 0xe0, 0x22, 0xdb, 0xeb, 0xe9, 0x94, 0xa3, 0xed, 0x67, 0x00, 0x0f, 0xcc, 0x9d, 0xe4, 0x8e, 0x78, 0x11, 0x7a, 0x80, - 0x87, 0x4b, 0x6e, 0x8e, 0x89, 0x17, 0xda, 0x2c, 0xa2, 0x3d, 0xc3, 0x26, 0xae, 0x1b, 0x31, 0x29, - 0x55, 0xd0, 0x02, 0x9d, 0xea, 0xe0, 0x34, 0x59, 0x37, 0x6b, 0xa3, 0x1c, 0x18, 0x5a, 0x66, 0xcf, - 0xe8, 0xe7, 0xeb, 0x9f, 0x75, 0xb3, 0x72, 0xc3, 0xe6, 0x83, 0x45, 0xcc, 0xa4, 0x55, 0x2b, 0x0c, - 0xc3, 0x54, 0x50, 0x00, 0xa8, 0x0e, 0xff, 0xb9, 0x2c, 0x14, 0x81, 0xfa, 0xa7, 0x05, 0x3a, 0xff, - 0xad, 0x3c, 0x5c, 0x95, 0x5e, 0xde, 0x9b, 0x4a, 0xfb, 0x15, 0xc0, 0xe3, 0xbe, 0xef, 0x8b, 0x27, - 0xe6, 0x9a, 0x42, 0x06, 0x42, 0x9a, 0xa2, 0xd0, 0xdf, 0x8b, 0x47, 0x16, 0xa2, 0x13, 0x58, 0xa5, - 0x59, 0x6f, 0xe7, 0x0a, 0x90, 0x29, 0xf6, 0xf2, 0xee, 0x3a, 0xad, 0x10, 0x82, 0xa5, 0x90, 0x04, - 0xac, 0xb0, 0x67, 0x33, 0x3a, 0x82, 0x65, 0xb9, 0x08, 0x1c, 0xe1, 0xab, 0x7f, 0xb3, 0xb6, 0x48, - 0xa8, 0x01, 0x2b, 0x2e, 0xa3, 0x5e, 0x40, 0x7c, 0xa9, 0x96, 0x5a, 0xa0, 0xb3, 0x6f, 0xed, 0x72, - 0x7e, 0xa0, 0xc1, 0xed, 0xe6, 0x1b, 0x83, 0x8f, 0x04, 0x83, 0xcf, 0x04, 0x83, 0x55, 0x82, 0xc1, - 0x26, 0xc1, 0xe0, 0x6d, 0x8b, 0x95, 0xd5, 0x16, 0x2b, 0x5f, 0x5b, 0xac, 0x8c, 0xce, 0xb9, 0x17, - 0x8f, 0xa7, 0x8e, 0x46, 0x45, 0xa0, 0x1b, 0xdc, 0x27, 0x8e, 0xd4, 0x0d, 0x7e, 0x41, 0xd3, 0x6b, - 0xeb, 0xf3, 0xdd, 0x4f, 0xc5, 0x8b, 0x09, 0x93, 0x4e, 0x39, 0x7b, 0xed, 0xcb, 0xdf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x25, 0x71, 0x3e, 0xe1, 0xc5, 0x01, 0x00, 0x00, + 0x87, 0x4b, 0x4e, 0xc7, 0xc4, 0x0b, 0x6d, 0x16, 0xd1, 0x9e, 0x61, 0x13, 0xd7, 0x8d, 0x98, 0x94, + 0x2a, 0x68, 0x81, 0x4e, 0x75, 0x70, 0x9a, 0xac, 0x9b, 0xb5, 0x11, 0x37, 0x53, 0x60, 0x68, 0x99, + 0x3d, 0xa3, 0x9f, 0xaf, 0x7f, 0xd6, 0xcd, 0xca, 0x0d, 0x9b, 0x0f, 0x16, 0x31, 0x93, 0x56, 0xad, + 0x30, 0x0c, 0x53, 0x41, 0x01, 0xa0, 0x3a, 0xfc, 0xe7, 0xb2, 0x50, 0x04, 0xea, 0x9f, 0x16, 0xe8, + 0xfc, 0xb7, 0xf2, 0x70, 0x55, 0x7a, 0x79, 0x6f, 0x2a, 0xed, 0x57, 0x00, 0x8f, 0xfb, 0xbe, 0x2f, + 0x9e, 0x98, 0x6b, 0x0a, 0x19, 0x08, 0x69, 0x8a, 0x42, 0x7f, 0x2f, 0x1e, 0x59, 0x88, 0x4e, 0x60, + 0x95, 0x66, 0xbd, 0x9d, 0x2b, 0x40, 0xa6, 0xd8, 0xcb, 0xbb, 0xeb, 0xb4, 0x42, 0x08, 0x96, 0x42, + 0x12, 0xb0, 0xc2, 0x9e, 0xcd, 0xe8, 0x08, 0x96, 0xe5, 0x22, 0x70, 0x84, 0xaf, 0xfe, 0xcd, 0xda, + 0x22, 0xa1, 0x06, 0xac, 0xb8, 0x8c, 0x7a, 0x01, 0xf1, 0xa5, 0x5a, 0x6a, 0x81, 0xce, 0xbe, 0xb5, + 0xcb, 0xf9, 0x81, 0x06, 0xb7, 0x9b, 0x6f, 0x0c, 0x3e, 0x12, 0x0c, 0x3e, 0x13, 0x0c, 0x56, 0x09, + 0x06, 0x9b, 0x04, 0x83, 0xb7, 0x2d, 0x56, 0x56, 0x5b, 0xac, 0x7c, 0x6d, 0xb1, 0x32, 0x3a, 0xe7, + 0x5e, 0x3c, 0x9e, 0x3a, 0x1a, 0x15, 0x81, 0x6e, 0x70, 0x9f, 0x38, 0x52, 0x37, 0xf8, 0x45, 0x76, + 0x6d, 0x7d, 0xbe, 0xfb, 0xa9, 0x78, 0x31, 0x61, 0xd2, 0x29, 0x67, 0xaf, 0x7d, 0xf9, 0x1b, 0x00, + 0x00, 0xff, 0xff, 0xfa, 0x07, 0x29, 0xab, 0xc5, 0x01, 0x00, 0x00, } func (this *ConversionPair) VerboseEqual(that interface{}) error { diff --git a/x/evmutil/types/conversion_pairs_test.go b/x/evmutil/types/conversion_pairs_test.go index 0db238f5..f1f7c79b 100644 --- a/x/evmutil/types/conversion_pairs_test.go +++ b/x/evmutil/types/conversion_pairs_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/evmutil/testutil" "github.com/0glabs/0g-chain/x/evmutil/types" "github.com/stretchr/testify/require" @@ -142,7 +143,7 @@ func TestConversionPairs_Validate(t *testing.T) { ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), - "a0gi", + chaincfg.AuxiliaryDenom, ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), @@ -162,7 +163,7 @@ func TestConversionPairs_Validate(t *testing.T) { ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), - "a0gi", + chaincfg.AuxiliaryDenom, ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), @@ -183,16 +184,16 @@ func TestConversionPairs_Validate(t *testing.T) { ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), - "a0gi", + chaincfg.AuxiliaryDenom, ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), - "a0gi", + chaincfg.AuxiliaryDenom, ), ), errArgs{ expectPass: false, - contains: "found duplicate enabled conversion pair denom a0gi", + contains: "found duplicate enabled conversion pair denom " + chaincfg.AuxiliaryDenom, }, }, { @@ -208,7 +209,7 @@ func TestConversionPairs_Validate(t *testing.T) { ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), - "a0gi", + chaincfg.AuxiliaryDenom, ), ), errArgs{ @@ -240,12 +241,12 @@ func TestAllowedCosmosCoinERC20Token_Validate(t *testing.T) { }{ { name: "valid token", - token: types.NewAllowedCosmosCoinERC20Token("uatom", "0g-wrapped ATOM", "kATOM", 6), + token: types.NewAllowedCosmosCoinERC20Token("uatom", "0gChain-wrapped ATOM", "kATOM", 6), expErr: "", }, { name: "valid - highest allowed decimals", - token: types.NewAllowedCosmosCoinERC20Token("uatom", "0g-wrapped ATOM", "kATOM", 255), + token: types.NewAllowedCosmosCoinERC20Token("uatom", "0gChain-wrapped ATOM", "kATOM", 255), expErr: "", }, { @@ -280,7 +281,7 @@ func TestAllowedCosmosCoinERC20Token_Validate(t *testing.T) { }, { name: "invalid - decimals higher than uint8", - token: types.NewAllowedCosmosCoinERC20Token("uatom", "0g-wrapped ATOM", "kATOM", 256), + token: types.NewAllowedCosmosCoinERC20Token("uatom", "0gChain-wrapped ATOM", "kATOM", 256), expErr: "decimals must be less than 256", }, } diff --git a/x/evmutil/types/params_test.go b/x/evmutil/types/params_test.go index 8daabd0a..e056afdd 100644 --- a/x/evmutil/types/params_test.go +++ b/x/evmutil/types/params_test.go @@ -107,11 +107,11 @@ func (suite *ParamsTestSuite) TestParams_Validate() { invalidConversionPairs := types.NewConversionPairs( types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), - "a0gi", + chaincfg.AuxiliaryDenom, ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), - "a0gi", // duplicate denom! + chaincfg.AuxiliaryDenom, // duplicate denom! ), ) validAllowedCosmosDenoms := types.NewAllowedCosmosCoinERC20Tokens( diff --git a/x/evmutil/types/tx.pb.go b/x/evmutil/types/tx.pb.go index 5245340d..94c41e1d 100644 --- a/x/evmutil/types/tx.pb.go +++ b/x/evmutil/types/tx.pb.go @@ -139,7 +139,7 @@ type MsgConvertERC20ToCoin struct { // 0gChain bech32 address that will receive the converted sdk.Coin. Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` // EVM 0x hex address of the ERC20 contract. - ZgChainERC20Address string `protobuf:"bytes,3,opt,name=zgChain_erc20_address,json=zgChainErc20Address,proto3" json:"zgChain_erc20_address,omitempty"` + ZgChainERC20Address string `protobuf:"bytes,3,opt,name=zgchain_erc20_address,json=zgchainErc20Address,proto3" json:"zgchain_erc20_address,omitempty"` // ERC20 token amount to convert. Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` } @@ -452,7 +452,7 @@ func init() { func init() { proto.RegisterFile("zgc/evmutil/v1beta1/tx.proto", fileDescriptor_b60fa1a7a6ac0cc3) } var fileDescriptor_b60fa1a7a6ac0cc3 = []byte{ - // 563 bytes of a gzipped FileDescriptorProto + // 564 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xc1, 0x6e, 0xd3, 0x30, 0x18, 0xae, 0xb7, 0x69, 0xa2, 0xe6, 0x96, 0x6e, 0xa2, 0x0b, 0x23, 0x9d, 0x8a, 0x06, 0xd3, 0xa4, 0x26, 0x69, 0x40, 0x08, 0x21, 0x2e, 0xb4, 0x1a, 0xd2, 0x04, 0xbb, 0x84, 0x9e, 0x76, 0xa9, 0x92, @@ -471,24 +471,24 @@ var fileDescriptor_b60fa1a7a6ac0cc3 = []byte{ 0x6c, 0xdd, 0xb5, 0xd6, 0x74, 0x99, 0x2d, 0xf2, 0x93, 0x9a, 0xd4, 0x23, 0x15, 0xb6, 0x04, 0x36, 0x1b, 0xf0, 0x41, 0xa1, 0x3e, 0x1b, 0xf1, 0x21, 0xa3, 0x1c, 0x35, 0xbf, 0x2c, 0xe4, 0x1d, 0xc4, 0xb1, 0x1e, 0x8b, 0x80, 0xca, 0xfa, 0x5f, 0x0e, 0xf2, 0x3a, 0x9f, 0x5e, 0xd5, 0x59, 0x62, 0xef, - 0xd2, 0xc1, 0x1b, 0xb8, 0x3a, 0xc1, 0xdd, 0x03, 0x87, 0xd0, 0x3e, 0x0a, 0x3c, 0xcb, 0xec, 0x3b, - 0x09, 0x30, 0x36, 0x54, 0xed, 0xdc, 0x0b, 0xa7, 0x8d, 0xda, 0x7e, 0x02, 0x88, 0xa5, 0xc8, 0x3c, - 0x76, 0x4d, 0xb2, 0x76, 0x22, 0x92, 0xdc, 0x54, 0x7a, 0x59, 0x39, 0x96, 0x62, 0xf6, 0xcb, 0xd3, - 0x69, 0xa3, 0xf2, 0x73, 0xda, 0x78, 0x84, 0x89, 0x38, 0x18, 0xb9, 0xba, 0xc7, 0x7c, 0x79, 0x87, - 0xf2, 0xa7, 0xc5, 0x07, 0xef, 0x0d, 0xf1, 0x61, 0x88, 0xb8, 0xbe, 0x4b, 0xc5, 0xf9, 0x49, 0x0b, - 0x4a, 0xb9, 0xbb, 0x54, 0x14, 0x57, 0x2c, 0x57, 0x8f, 0xac, 0x62, 0x9f, 0x01, 0xbc, 0x9f, 0xaf, - 0x69, 0x94, 0x21, 0x7f, 0xf3, 0xe5, 0x75, 0xfb, 0xcf, 0xf7, 0xbb, 0x09, 0x1f, 0x96, 0x68, 0xc9, - 0x34, 0x1f, 0x83, 0x3f, 0xfb, 0x20, 0xc5, 0xbd, 0x0e, 0x98, 0x7f, 0x0b, 0xaa, 0x1f, 0xc3, 0xcd, - 0x52, 0x35, 0xa9, 0x6e, 0xeb, 0xd3, 0x12, 0x5c, 0xdc, 0xe3, 0x58, 0x11, 0x50, 0x29, 0x98, 0xb1, - 0x6d, 0xbd, 0x60, 0xc8, 0xf5, 0xc2, 0x7e, 0x57, 0xad, 0xeb, 0x63, 0xd3, 0xd3, 0x73, 0xa7, 0xe6, - 0xe7, 0x62, 0xde, 0xa9, 0x39, 0xec, 0xdc, 0x53, 0x0b, 0xfa, 0x4b, 0xf9, 0x08, 0x60, 0xfd, 0x9f, - 0xcd, 0x65, 0xce, 0xb5, 0x71, 0x85, 0xa1, 0x3e, 0xbf, 0x29, 0x23, 0x13, 0x72, 0x0c, 0xa0, 0x5a, - 0xd2, 0x31, 0xd6, 0xb5, 0x13, 0x67, 0x1c, 0xf5, 0xc5, 0xcd, 0x39, 0xa9, 0x9c, 0xce, 0xdb, 0x8b, - 0x5f, 0x1a, 0xf8, 0x1e, 0x6a, 0xe0, 0x34, 0xd4, 0xc0, 0x59, 0xa8, 0x81, 0x8b, 0x50, 0x03, 0x5f, - 0x67, 0x5a, 0xe5, 0x6c, 0xa6, 0x55, 0x7e, 0xcc, 0xb4, 0xca, 0xfe, 0x76, 0x6e, 0xf0, 0x4d, 0x7c, - 0xe8, 0xb8, 0xdc, 0x30, 0x71, 0xcb, 0x8b, 0x1e, 0x0e, 0xe3, 0x28, 0xfb, 0x54, 0xc4, 0x0f, 0x80, - 0xbb, 0x1c, 0x3f, 0xe0, 0x4f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x5d, 0x0b, 0x0a, 0x46, - 0x06, 0x00, 0x00, + 0xd2, 0xc1, 0x1b, 0xb8, 0x3a, 0xc1, 0xde, 0x81, 0x43, 0x68, 0x1f, 0x05, 0x9e, 0x65, 0xf6, 0x9d, + 0x04, 0x18, 0x1b, 0xaa, 0x76, 0xee, 0x85, 0xd3, 0x46, 0x6d, 0x1f, 0x77, 0x23, 0x40, 0x2c, 0x45, + 0xe6, 0xb1, 0x6b, 0x92, 0xb5, 0x13, 0x91, 0xe4, 0xa6, 0xd2, 0xcb, 0xca, 0xb1, 0x14, 0xb3, 0x5f, + 0x9e, 0x4e, 0x1b, 0x95, 0x9f, 0xd3, 0xc6, 0x23, 0x4c, 0xc4, 0xc1, 0xc8, 0xd5, 0x3d, 0xe6, 0xcb, + 0x3b, 0x94, 0x3f, 0x2d, 0x3e, 0x78, 0x6f, 0x88, 0x0f, 0x43, 0xc4, 0xf5, 0x5d, 0x2a, 0xce, 0x4f, + 0x5a, 0x50, 0xca, 0xdd, 0xa5, 0xa2, 0xb8, 0x62, 0xb9, 0x7a, 0x64, 0x15, 0xfb, 0x0c, 0xe0, 0xfd, + 0x7c, 0x4d, 0xa3, 0x0c, 0xf9, 0x9b, 0x2f, 0xaf, 0xdb, 0x7f, 0xbe, 0xdf, 0x4d, 0xf8, 0xb0, 0x44, + 0x4b, 0xa6, 0xf9, 0x18, 0xfc, 0xd9, 0x07, 0x29, 0xee, 0x75, 0xc0, 0xfc, 0x5b, 0x50, 0xfd, 0x18, + 0x6e, 0x96, 0xaa, 0x49, 0x75, 0x5b, 0x9f, 0x96, 0xe0, 0xe2, 0x1e, 0xc7, 0x8a, 0x80, 0x4a, 0xc1, + 0x8c, 0x6d, 0xeb, 0x05, 0x43, 0xae, 0x17, 0xf6, 0xbb, 0x6a, 0x5d, 0x1f, 0x9b, 0x9e, 0x9e, 0x3b, + 0x35, 0x3f, 0x17, 0xf3, 0x4e, 0xcd, 0x61, 0xe7, 0x9e, 0x5a, 0xd0, 0x5f, 0xca, 0x47, 0x00, 0xeb, + 0xff, 0x6c, 0x2e, 0x73, 0xae, 0x8d, 0x2b, 0x0c, 0xf5, 0xf9, 0x4d, 0x19, 0x99, 0x90, 0x63, 0x00, + 0xd5, 0x92, 0x8e, 0xb1, 0xae, 0x9d, 0x38, 0xe3, 0xa8, 0x2f, 0x6e, 0xce, 0x49, 0xe5, 0x74, 0xde, + 0x5e, 0xfc, 0xd2, 0xc0, 0xf7, 0x50, 0x03, 0xa7, 0xa1, 0x06, 0xce, 0x42, 0x0d, 0x5c, 0x84, 0x1a, + 0xf8, 0x3a, 0xd3, 0x2a, 0x67, 0x33, 0xad, 0xf2, 0x63, 0xa6, 0x55, 0xf6, 0xb7, 0x73, 0x83, 0x6f, + 0xe2, 0x43, 0xc7, 0xe5, 0x86, 0x89, 0x5b, 0xf1, 0xc3, 0x61, 0x1c, 0x65, 0x9f, 0x8a, 0xf8, 0x01, + 0x70, 0x97, 0xe3, 0x07, 0xfc, 0xc9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0xc2, 0xb2, 0xda, + 0x46, 0x06, 0x00, 0x00, } func (this *MsgConvertCoinToERC20) VerboseEqual(that interface{}) error { diff --git a/x/pricefeed/types/key_test.go b/x/pricefeed/types/key_test.go index f5eca1ba..b7cab46e 100644 --- a/x/pricefeed/types/key_test.go +++ b/x/pricefeed/types/key_test.go @@ -3,13 +3,14 @@ package types import ( "testing" + "github.com/0glabs/0g-chain/chaincfg" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" ) func TestRawPriceKey_Iteration(t *testing.T) { // An iterator key should only match price keys with the same market - iteratorKey := RawPriceIteratorKey("a0gi:usd") + iteratorKey := RawPriceIteratorKey(chaincfg.AuxiliaryDenom + ":usd") addr := sdk.AccAddress("test addr") @@ -20,12 +21,12 @@ func TestRawPriceKey_Iteration(t *testing.T) { }{ { name: "equal marketID is included in iteration", - priceKey: RawPriceKey("a0gi:usd", addr), + priceKey: RawPriceKey(chaincfg.AuxiliaryDenom+":usd", addr), expectErr: false, }, { name: "prefix overlapping marketID excluded from iteration", - priceKey: RawPriceKey("a0gi:usd:30", addr), + priceKey: RawPriceKey(chaincfg.AuxiliaryDenom+":usd:30", addr), expectErr: true, }, } diff --git a/x/validator-vesting/querier.go b/x/validator-vesting/querier.go index 92c44027..77d21abf 100644 --- a/x/validator-vesting/querier.go +++ b/x/validator-vesting/querier.go @@ -9,12 +9,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/validator-vesting/types" abci "github.com/tendermint/tendermint/abci/types" ) -const SafuFund int64 = 10000000 // 10 million A0GI +const SafuFund int64 = 10000000 // 10 million (auxiliary denom) // NewQuerier is the module level router for state queries func NewQuerier(bk types.BankKeeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { @@ -41,7 +42,7 @@ func NewQuerier(bk types.BankKeeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Qu } func queryGetTotalSupply(ctx sdk.Context, req abci.RequestQuery, bk types.BankKeeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { - totalSupply := bk.GetSupply(ctx, "ua0gi").Amount + totalSupply := bk.GetSupply(ctx, chaincfg.AuxiliaryDenom).Amount supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt64() bz, err := legacyQuerierCdc.MarshalJSON(supplyInt) if err != nil { @@ -51,7 +52,7 @@ func queryGetTotalSupply(ctx sdk.Context, req abci.RequestQuery, bk types.BankKe } func queryGetCirculatingSupply(ctx sdk.Context, req abci.RequestQuery, bk types.BankKeeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { - totalSupply := bk.GetSupply(ctx, "ua0gi").Amount + totalSupply := bk.GetSupply(ctx, chaincfg.AuxiliaryDenom).Amount supplyInt := getCirculatingSupply(ctx.BlockTime(), totalSupply) bz, err := legacyQuerierCdc.MarshalJSON(supplyInt) if err != nil { From 838a2d9ae9b041ae8e40398b27b61bd18ef7fdfa Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Fri, 10 May 2024 14:31:49 +0800 Subject: [PATCH 15/26] rename denoms --- Makefile | 2 +- app/_simulate_tx_test.go | 4 +- app/ante/ante_test.go | 4 +- app/ante/authorized_test.go | 8 +- app/ante/authz_test.go | 6 +- app/ante/eip712_test.go | 18 +- app/ante/min_gas_filter_test.go | 2 +- app/ante/vesting_test.go | 6 +- app/test_common.go | 8 +- chaincfg/coin_helper.go | 8 +- chaincfg/denoms.go | 20 +- chaincfg/denoms_test.go | 32 +- client/docs/cosmos-swagger.yml | 10 +- client/docs/ibc-go-swagger.yml | 20 +- client/docs/swagger-ui/swagger.yaml | 30 +- cmd/0gchaind/root.go | 4 +- localtestnet.sh | 2 +- migrate/utils/periodic_vesting_reset_test.go | 46 +- tests/e2e/e2e_convert_cosmos_coins_test.go | 14 +- tests/e2e/e2e_evm_contracts_test.go | 20 +- tests/e2e/e2e_min_fees_test.go | 10 +- tests/e2e/e2e_test.go | 36 +- tests/e2e/e2e_upgrade_gov_and_authz_test.go | 6 +- tests/e2e/runner/chain.go | 2 +- tests/e2e/testutil/account.go | 2 +- .../proto/cosmos/bank/v1beta1/bank.proto | 2 +- third_party/proto/cosmos/tx/v1beta1/tx.proto | 6 +- .../applications/transfer/v1/transfer.proto | 4 +- x/bep3/keeper/msg_server_test.go | 2 +- x/bep3/keeper/querier_test.go | 2 +- x/bep3/types/genesis_test.go | 2 +- x/bep3/types/supply_test.go | 2 +- x/committee/keeper/msg_server_test.go | 2 +- x/council/v1/client/cli/tx.go | 2 +- x/evmutil/keeper/bank_keeper.go | 168 +++---- x/evmutil/keeper/bank_keeper_test.go | 456 +++++++++--------- x/evmutil/keeper/invariants.go | 2 +- x/evmutil/keeper/invariants_test.go | 6 +- x/evmutil/keeper/keeper.go | 12 +- x/evmutil/testutil/suite.go | 32 +- x/evmutil/types/conversion_pairs_test.go | 12 +- x/evmutil/types/params_test.go | 4 +- x/pricefeed/types/key_test.go | 6 +- x/validator-vesting/querier.go | 6 +- 44 files changed, 524 insertions(+), 524 deletions(-) diff --git a/Makefile b/Makefile index 9f2bb393..b8b7ab88 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ print-machine-info: BUILD_DIR := build# build files BIN_DIR := $(BUILD_DIR)/bin# for binary dev dependencies BUILD_CACHE_DIR := $(BUILD_DIR)/.cache# caching for non-artifact outputs -OUT_DIR := out# for artifact intermediates and outputs +OUT_DIR := ./.build# for artifact intermediates and outputs ROOT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))# absolute path to root export PATH := $(ROOT_DIR)/$(BIN_DIR):$(PATH)# add local bin first in path diff --git a/app/_simulate_tx_test.go b/app/_simulate_tx_test.go index 15c4cfec..5957ba18 100644 --- a/app/_simulate_tx_test.go +++ b/app/_simulate_tx_test.go @@ -62,11 +62,11 @@ func (suite *SimulateRequestTestSuite) TestSimulateRequest() { bank.MsgSend{ FromAddress: fromAddr, ToAddress: toAddr, - Amount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e6)), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e6)), }, }, Fee: auth.StdFee{ - Amount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(5e4)), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(5e4)), Gas: 1e6, }, Memo: "test memo", diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index ed979248..f3891a56 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -66,7 +66,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) { chainID, app.NewFundedGenStateWithSameCoins( tApp.AppCodec(), - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e9)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e9)), testAddresses, ), newBep3GenStateMulti(tApp.AppCodec(), deputy), @@ -114,7 +114,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) { banktypes.NewMsgSend( tc.address, testAddresses[0], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1_000_000)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1_000_000)), ), }, sdk.NewCoins(), // no fee diff --git a/app/ante/authorized_test.go b/app/ante/authorized_test.go index d9dd327a..9f63c899 100644 --- a/app/ante/authorized_test.go +++ b/app/ante/authorized_test.go @@ -46,7 +46,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_NotCheckTx(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100_000_000)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100_000_000)), ), }, sdk.NewCoins(), // no fee @@ -81,12 +81,12 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Pass(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)), ), banktypes.NewMsgSend( testAddresses[2], testAddresses[1], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)), ), }, sdk.NewCoins(), // no fee @@ -122,7 +122,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Reject(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)), ), }, sdk.NewCoins(), // no fee diff --git a/app/ante/authz_test.go b/app/ante/authz_test.go index 4178728c..bbf9a392 100644 --- a/app/ante/authz_test.go +++ b/app/ante/authz_test.go @@ -59,7 +59,7 @@ func TestAuthzLimiterDecorator(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100e6)), ), }, checkTx: false, @@ -129,7 +129,7 @@ func TestAuthzLimiterDecorator(t *testing.T) { []sdk.Msg{banktypes.NewMsgSend( testAddresses[0], testAddresses[3], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100e6)), )}), }, checkTx: false, @@ -162,7 +162,7 @@ func TestAuthzLimiterDecorator(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[3], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100e6)), ), &evmtypes.MsgEthereumTx{}, }, diff --git a/app/ante/eip712_test.go b/app/ante/eip712_test.go index 0370d608..13904f60 100644 --- a/app/ante/eip712_test.go +++ b/app/ante/eip712_test.go @@ -156,7 +156,7 @@ func (suite *EIP712TestSuite) SetupTest() { // Genesis states evmGs := evmtypes.NewGenesisState( evmtypes.NewParams( - chaincfg.BaseDenom, // evmDenom + chaincfg.EvmDenom, // evmDenom false, // allowedUnprotectedTxs true, // enableCreate true, // enableCall @@ -222,10 +222,10 @@ func (suite *EIP712TestSuite) SetupTest() { pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pricefeedGenState), } - // funds our test accounts with some auxiliary denom + // funds our test accounts with some gas denom coinsGenState := app.NewFundedGenStateWithSameCoins( tApp.AppCodec(), - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e9)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e9)), []sdk.AccAddress{suite.testAddr, suite.testAddr2}, ) @@ -370,7 +370,7 @@ func (suite *EIP712TestSuite) deployUSDCERC20(app app.TestApp, ctx sdk.Context) suite.tApp.FundModuleAccount( suite.ctx, evmutiltypes.ModuleName, - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(0)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(0)), ) contractAddr, err := suite.evmutilKeeper.DeployTestMintableERC20Contract(suite.ctx, "USDC", "USDC", uint8(18)) @@ -470,7 +470,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { errMsg: "insufficient funds", updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { bk := suite.tApp.GetBankKeeper() - gasCoins := bk.GetBalance(suite.ctx, suite.testAddr, chaincfg.AuxiliaryDenom) + gasCoins := bk.GetBalance(suite.ctx, suite.testAddr, chaincfg.GasDenom) suite.tApp.GetBankKeeper().SendCoins(suite.ctx, suite.testAddr, suite.testAddr2, sdk.NewCoins(gasCoins)) return txBuilder }, @@ -482,7 +482,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { failCheckTx: true, errMsg: "invalid chain-id", updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { - gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) + gasAmt := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(20)) return suite.createTestEIP712CosmosTxBuilder( suite.testAddr, suite.testPrivKey, "kavatest_12-1", uint64(helpers.DefaultGenTxGas*10), gasAmt, msgs, ) @@ -495,7 +495,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { failCheckTx: true, errMsg: "invalid pubkey", updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { - gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) + gasAmt := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(20)) return suite.createTestEIP712CosmosTxBuilder( suite.testAddr2, suite.testPrivKey2, ChainID, uint64(helpers.DefaultGenTxGas*10), gasAmt, msgs, ) @@ -523,7 +523,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { msgs = tc.updateMsgs(msgs) } - gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) + gasAmt := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(20)) txBuilder := suite.createTestEIP712CosmosTxBuilder( suite.testAddr, suite.testPrivKey, ChainID, uint64(helpers.DefaultGenTxGas*10), gasAmt, msgs, ) @@ -597,7 +597,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() { } // deliver deposit msg - gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) + gasAmt := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(20)) txBuilder := suite.createTestEIP712CosmosTxBuilder( suite.testAddr, suite.testPrivKey, ChainID, uint64(helpers.DefaultGenTxGas*10), gasAmt, depositMsgs, ) diff --git a/app/ante/min_gas_filter_test.go b/app/ante/min_gas_filter_test.go index f49c333b..39fff013 100644 --- a/app/ante/min_gas_filter_test.go +++ b/app/ante/min_gas_filter_test.go @@ -31,7 +31,7 @@ func TestEvmMinGasFilter(t *testing.T) { ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.GetEvmKeeper().SetParams(ctx, evmtypes.Params{ - EvmDenom: chaincfg.BaseDenom, + EvmDenom: chaincfg.EvmDenom, }) testCases := []struct { diff --git a/app/ante/vesting_test.go b/app/ante/vesting_test.go index 5e5d5789..048a5563 100644 --- a/app/ante/vesting_test.go +++ b/app/ante/vesting_test.go @@ -34,7 +34,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing "MsgCreateVestingAccount", vesting.NewMsgCreateVestingAccount( testAddresses[0], testAddresses[1], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)), time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC).Unix(), false, ), @@ -45,7 +45,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing "MsgCreateVestingAccount", vesting.NewMsgCreatePermanentLockedAccount( testAddresses[0], testAddresses[1], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)), ), true, "MsgTypeURL /cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount not supported", @@ -64,7 +64,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing "other messages not affected", banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)), ), false, "", diff --git a/app/test_common.go b/app/test_common.go index aa51bb56..4eadb7c2 100644 --- a/app/test_common.go +++ b/app/test_common.go @@ -149,7 +149,7 @@ func GenesisStateWithSingleValidator( balances := []banktypes.Balance{ { Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100000000000000)), + Coins: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100000000000000)), }, } @@ -212,7 +212,7 @@ func genesisStateWithValSet( } // set validators and delegations currentStakingGenesis := stakingtypes.GetGenesisStateFromAppState(app.appCodec, genesisState) - currentStakingGenesis.Params.BondDenom = chaincfg.AuxiliaryDenom // TODO: + currentStakingGenesis.Params.BondDenom = chaincfg.GasDenom // TODO: stakingGenesis := stakingtypes.NewGenesisState( currentStakingGenesis.Params, @@ -232,13 +232,13 @@ func genesisStateWithValSet( for range delegations { // add delegated tokens to total supply - totalSupply = totalSupply.Add(chaincfg.MakeCoinForAuxiliaryDenom(bondAmt)) + totalSupply = totalSupply.Add(chaincfg.MakeCoinForGasDenom(bondAmt)) } // add bonded amount to bonded pool module account balances = append(balances, banktypes.Balance{ Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{chaincfg.MakeCoinForAuxiliaryDenom(bondAmt)}, + Coins: sdk.Coins{chaincfg.MakeCoinForGasDenom(bondAmt)}, }) bankGenesis := banktypes.NewGenesisState( diff --git a/chaincfg/coin_helper.go b/chaincfg/coin_helper.go index 6f50b282..fb525197 100644 --- a/chaincfg/coin_helper.go +++ b/chaincfg/coin_helper.go @@ -44,12 +44,12 @@ func MakeCoinForStandardDenom(amount any) sdk.Coin { return makeCoin(StandardDenom, toBigInt(amount)) } -func MakeCoinForAuxiliaryDenom(amount any) sdk.Coin { - return makeCoin(AuxiliaryDenom, toBigInt(amount)) +func MakeCoinForGasDenom(amount any) sdk.Coin { + return makeCoin(GasDenom, toBigInt(amount)) } -func MakeCoinForBaseDenom(amount any) sdk.Coin { - return makeCoin(BaseDenom, toBigInt(amount)) +func MakeCoinForEvmDenom(amount any) sdk.Coin { + return makeCoin(EvmDenom, toBigInt(amount)) } func makeCoin(denom string, amount *big.Int) sdk.Coin { diff --git a/chaincfg/denoms.go b/chaincfg/denoms.go index 1ced4532..6d251643 100644 --- a/chaincfg/denoms.go +++ b/chaincfg/denoms.go @@ -7,31 +7,31 @@ import ( const ( StandardDenom = "a0gi" - AuxiliaryDenom = "ua0gi" + GasDenom = "ua0gi" - BaseDenom = "neuron" + EvmDenom = "neuron" - BondDenom = BaseDenom + BondDenom = EvmDenom - AuxiliaryDenomUnit = 6 + GasDenomUnit = 6 - BaseDenomUnit = 18 + EvmDenomUnit = 18 - AuxiliaryDenomConversionMultiplier = 1e12 - BaseDenomConversionMultiplier = 1e18 + GasDenomConversionMultiplier = 1e12 + EvmDenomConversionMultiplier = 1e18 ) -// RegisterDenoms registers the base and auxiliary denominations to the SDK. +// RegisterDenoms registers the base and gas denominations to the SDK. func RegisterDenoms() { if err := sdk.RegisterDenom(StandardDenom, sdk.OneDec()); err != nil { panic(err) } - if err := sdk.RegisterDenom(AuxiliaryDenom, sdk.NewDecWithPrec(1, AuxiliaryDenomUnit)); err != nil { + if err := sdk.RegisterDenom(GasDenom, sdk.NewDecWithPrec(1, GasDenomUnit)); err != nil { panic(err) } - if err := sdk.RegisterDenom(BaseDenom, sdk.NewDecWithPrec(1, BaseDenomUnit)); err != nil { + if err := sdk.RegisterDenom(EvmDenom, sdk.NewDecWithPrec(1, EvmDenomUnit)); err != nil { panic(err) } } diff --git a/chaincfg/denoms_test.go b/chaincfg/denoms_test.go index 5c0fb989..9cbaa09f 100644 --- a/chaincfg/denoms_test.go +++ b/chaincfg/denoms_test.go @@ -17,15 +17,15 @@ func TestRegisterDenoms(t *testing.T) { expErr error }{ { - "standard to auxiliary", + "standard to gas", MakeCoinForStandardDenom(99), - AuxiliaryDenom, - MakeCoinForAuxiliaryDenom(99 * (BaseDenomConversionMultiplier / AuxiliaryDenomConversionMultiplier)), + GasDenom, + MakeCoinForGasDenom(99 * (EvmDenomConversionMultiplier / GasDenomConversionMultiplier)), nil, }, { - "auxiliary to standard", - MakeCoinForAuxiliaryDenom(5e7), + "gas to standard", + MakeCoinForGasDenom(5e7), StandardDenom, MakeCoinForStandardDenom(50), nil, @@ -33,29 +33,29 @@ func TestRegisterDenoms(t *testing.T) { { "standard to base", MakeCoinForStandardDenom(22), - BaseDenom, - MakeCoinForBaseDenom(22 * BaseDenomConversionMultiplier), + EvmDenom, + MakeCoinForEvmDenom(22 * EvmDenomConversionMultiplier), nil, }, { "base to standard", - MakeCoinForBaseDenom("97000000000000000000"), + MakeCoinForEvmDenom("97000000000000000000"), StandardDenom, MakeCoinForStandardDenom(97), nil, }, { - "auxiliary to base", - MakeCoinForAuxiliaryDenom(33), - BaseDenom, - MakeCoinForBaseDenom(33 * AuxiliaryDenomConversionMultiplier), + "gas to base", + MakeCoinForGasDenom(33), + EvmDenom, + MakeCoinForEvmDenom(33 * GasDenomConversionMultiplier), nil, }, { - "base to auxiliary", - MakeCoinForBaseDenom("770000000000000"), - AuxiliaryDenom, - MakeCoinForAuxiliaryDenom(770000000000000 / AuxiliaryDenomConversionMultiplier), + "base to gas", + MakeCoinForEvmDenom("770000000000000"), + GasDenom, + MakeCoinForGasDenom(770000000000000 / GasDenomConversionMultiplier), nil, }, } diff --git a/client/docs/cosmos-swagger.yml b/client/docs/cosmos-swagger.yml index 1fa424c0..dccd95c2 100644 --- a/client/docs/cosmos-swagger.yml +++ b/client/docs/cosmos-swagger.yml @@ -3121,7 +3121,7 @@ paths: base: type: string description: >- - base represents the base denom (should be the DenomUnit + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -3328,7 +3328,7 @@ paths: base: type: string description: >- - base represents the base denom (should be the DenomUnit + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35597,7 +35597,7 @@ definitions: base: type: string description: >- - base represents the base denom (should be the DenomUnit with exponent + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35764,7 +35764,7 @@ definitions: base: type: string description: >- - base represents the base denom (should be the DenomUnit with + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35920,7 +35920,7 @@ definitions: base: type: string description: >- - base represents the base denom (should be the DenomUnit with + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string diff --git a/client/docs/ibc-go-swagger.yml b/client/docs/ibc-go-swagger.yml index c750fda6..a6cabe17 100644 --- a/client/docs/ibc-go-swagger.yml +++ b/client/docs/ibc-go-swagger.yml @@ -129,9 +129,9 @@ paths: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. @@ -265,9 +265,9 @@ paths: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. @@ -13499,9 +13499,9 @@ definitions: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens and + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. @@ -13557,9 +13557,9 @@ definitions: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. @@ -13583,9 +13583,9 @@ definitions: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 803f7418..412e9e5e 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -16331,7 +16331,7 @@ paths: base: type: string description: >- - base represents the base denom (should be the DenomUnit + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -16538,7 +16538,7 @@ paths: base: type: string description: >- - base represents the base denom (should be the DenomUnit + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -39228,9 +39228,9 @@ paths: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. @@ -39364,9 +39364,9 @@ paths: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. @@ -58047,7 +58047,7 @@ definitions: base: type: string description: >- - base represents the base denom (should be the DenomUnit with exponent + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -58214,7 +58214,7 @@ definitions: base: type: string description: >- - base represents the base denom (should be the DenomUnit with + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -58370,7 +58370,7 @@ definitions: base: type: string description: >- - base represents the base denom (should be the DenomUnit with + base represents the evm denom (should be the DenomUnit with exponent = 0). display: type: string @@ -81239,9 +81239,9 @@ definitions: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens and + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. @@ -81297,9 +81297,9 @@ definitions: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. @@ -81323,9 +81323,9 @@ definitions: source of the fungible token. base_denom: type: string - description: base denomination of the relayed fungible token. + description: evm denomination of the relayed fungible token. description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens + DenomTrace contains the evm denomination for ICS20 fungible tokens and the source tracing information path. diff --git a/cmd/0gchaind/root.go b/cmd/0gchaind/root.go index 78f2593a..fab91152 100644 --- a/cmd/0gchaind/root.go +++ b/cmd/0gchaind/root.go @@ -72,7 +72,7 @@ func NewRootCmd() *cobra.Command { return err } - customAppTemplate, customAppConfig := servercfg.AppConfig(chaincfg.AuxiliaryDenom) + customAppTemplate, customAppConfig := servercfg.AppConfig(chaincfg.GasDenom) return server.InterceptConfigsPreRunHandler( cmd, @@ -123,7 +123,7 @@ func addSubCmds(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, de ac.addStartCmdFlags, ) - // add keybase, auxiliary RPC, query, and tx child commands + // add keybase, gas RPC, query, and tx child commands rootCmd.AddCommand( newQueryCmd(), newTxCmd(), diff --git a/localtestnet.sh b/localtestnet.sh index aab02408..33846044 100755 --- a/localtestnet.sh +++ b/localtestnet.sh @@ -24,7 +24,7 @@ DATA=~/.0gchain # remove any old state and config rm -rf $DATA -BINARY=0gchaind +BINARY=./.build/0gchaind # Create new data directory, overwriting any that alread existed chainID="zgchain_8888-1" diff --git a/migrate/utils/periodic_vesting_reset_test.go b/migrate/utils/periodic_vesting_reset_test.go index 0ec44cd8..5424eb93 100644 --- a/migrate/utils/periodic_vesting_reset_test.go +++ b/migrate/utils/periodic_vesting_reset_test.go @@ -42,7 +42,7 @@ func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -65,7 +65,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -98,7 +98,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -126,25 +126,25 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing } func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(4e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(4e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +30 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, } @@ -160,36 +160,36 @@ func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { expectedPeriods := []vestingtypes.Period{ { Length: 15 * 24 * 60 * 60, // 15 days - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, { Length: 15 * 24 * 60 * 60, // 15 days - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, } - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") + assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") assert.Equal(t, newVestingStartTime.Unix(), vacc.StartTime, "expected vesting start time to be updated") assert.Equal(t, expectedEndtime, vacc.EndTime, "expected vesting end time end at last period") assert.Equal(t, expectedPeriods, vacc.VestingPeriods, "expected vesting periods to be updated") } func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(3e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, } @@ -199,35 +199,35 @@ func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testin newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) ResetPeriodicVestingAccount(vacc, newVestingStartTime) - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") + assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") + assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") } func TestResetPeriodVestingAccount_DelegatedVesting_LessThanVested(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(3e6))) + balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), }, } vacc := createVestingAccount(balance, vestingStartTime, periods) - vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6)))) + vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))) newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) ResetPeriodicVestingAccount(vacc, newVestingStartTime) assert.Equal(t, sdk.Coins(nil), vacc.DelegatedFree, "expected delegrated free to be unmodified") - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") + assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") } diff --git a/tests/e2e/e2e_convert_cosmos_coins_test.go b/tests/e2e/e2e_convert_cosmos_coins_test.go index 7aee4a3c..4c52e2c9 100644 --- a/tests/e2e/e2e_convert_cosmos_coins_test.go +++ b/tests/e2e/e2e_convert_cosmos_coins_test.go @@ -64,7 +64,7 @@ func (suite *IntegrationTestSuite) setupAccountWithCosmosCoinERC20Balance( tx := util.ZgChainMsgRequest{ Msgs: []sdk.Msg{&msg}, GasLimit: 4e5, - FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(400)), + FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(400)), Data: "converting sdk coin to erc20", } res := user.SignAndBroadcastZgChainTx(tx) @@ -103,7 +103,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoinsToFromERC20() { tx := util.ZgChainMsgRequest{ Msgs: []sdk.Msg{&convertToErc20Msg}, GasLimit: 2e6, - FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(2000)), + FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(2000)), Data: "converting sdk coin to erc20", } res := user.SignAndBroadcastZgChainTx(tx) @@ -145,7 +145,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoinsToFromERC20() { tx = util.ZgChainMsgRequest{ Msgs: []sdk.Msg{&convertFromErc20Msg}, GasLimit: 2e5, - FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), + FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(200)), Data: "converting erc20 to cosmos coin", } res = user.SignAndBroadcastZgChainTx(tx) @@ -184,7 +184,7 @@ func (suite *IntegrationTestSuite) TestEIP712ConvertCosmosCoinsToFromERC20() { user, suite.ZgChain, 2e6, - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e4)), []sdk.Msg{&convertToErc20Msg}, "this is a memo", ).GetTx() @@ -238,7 +238,7 @@ func (suite *IntegrationTestSuite) TestEIP712ConvertCosmosCoinsToFromERC20() { user, suite.ZgChain, 2e5, - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(200)), []sdk.Msg{&convertFromErc20Msg}, "", ).GetTx() @@ -332,7 +332,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoins_ERC20Magic() { "cosmo-coin-converter-complex-alice", initialAliceAmount, ) - gasMoney := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e5)) + gasMoney := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e5)) bob := suite.ZgChain.NewFundedAccount("cosmo-coin-converter-complex-bob", gasMoney) amount := big.NewInt(1e3) // test assumes this is half of alice's balance. @@ -413,7 +413,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoins_ERC20Magic() { convertTx := util.ZgChainMsgRequest{ Msgs: []sdk.Msg{&convertMsg}, GasLimit: 2e5, - FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), + FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(200)), Data: "bob converts his new erc20 to an sdk.Coin", } convertRes := bob.SignAndBroadcastZgChainTx(convertTx) diff --git a/tests/e2e/e2e_evm_contracts_test.go b/tests/e2e/e2e_evm_contracts_test.go index 1a3b8793..fe41e9ce 100644 --- a/tests/e2e/e2e_evm_contracts_test.go +++ b/tests/e2e/e2e_evm_contracts_test.go @@ -20,7 +20,7 @@ func (suite *IntegrationTestSuite) TestEthCallToGreeterContract() { // this test manipulates state of the Greeter contract which means other tests shouldn't use it. // setup funded account to interact with contract - user := suite.ZgChain.NewFundedAccount("greeter-contract-user", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e6))) + user := suite.ZgChain.NewFundedAccount("greeter-contract-user", sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e6))) greeterAddr := suite.ZgChain.ContractAddrs["greeter"] contract, err := greeter.NewGreeter(greeterAddr, suite.ZgChain.EvmClient) @@ -63,12 +63,12 @@ func (suite *IntegrationTestSuite) TestEthCallToErc20() { func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // create new funded account - sender := suite.ZgChain.NewFundedAccount("eip712-msgSend", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(2e4))) + sender := suite.ZgChain.NewFundedAccount("eip712-msgSend", sdk.NewCoins(chaincfg.MakeCoinForGasDenom(2e4))) receiver := app.RandomAddress() - // setup message for sending some auxiliary denom to random receiver + // setup message for sending some gas denom to random receiver msgs := []sdk.Msg{ - banktypes.NewMsgSend(sender.SdkAddress, receiver, sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e3))), + banktypes.NewMsgSend(sender.SdkAddress, receiver, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e3))), } // create tx @@ -76,7 +76,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { sender, suite.ZgChain, 1e6, - sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), + sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e4)), msgs, "this is a memo", ).GetTx() @@ -95,10 +95,10 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { _, err = util.WaitForSdkTxCommit(suite.ZgChain.Tx, res.TxResponse.TxHash, 6*time.Second) suite.NoError(err) - // check that the message was processed & the auxiliary denom is transferred. + // check that the message was processed & the gas denom is transferred. balRes, err := suite.ZgChain.Bank.Balance(context.Background(), &banktypes.QueryBalanceRequest{ Address: receiver.String(), - Denom: chaincfg.AuxiliaryDenom, + Denom: chaincfg.GasDenom, }) suite.NoError(err) suite.Equal(sdk.NewInt(1e3), balRes.Balance.Amount) @@ -113,7 +113,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // sdkDenom := suite.DeployedErc20.CosmosDenom // // create new funded account -// depositor := suite.ZgChain.NewFundedAccount("eip712-lend-depositor", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e5))) +// depositor := suite.ZgChain.NewFundedAccount("eip712-lend-depositor", sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e5))) // // give them erc20 balance to deposit // fundRes := suite.FundZgChainErc20Balance(depositor.EvmAddress, amount.BigInt()) // suite.NoError(fundRes.Err) @@ -143,7 +143,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // depositor, // suite.ZgChain, // 1e6, -// sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), +// sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e4)), // msgs, // "doing the USDT Earn workflow! erc20 -> sdk.Coin -> USDX hard deposit", // ).GetTx() @@ -189,7 +189,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // withdrawAndConvertBack := util.ZgChainMsgRequest{ // Msgs: []sdk.Msg{&withdraw, &convertBack}, // GasLimit: 1e6, -// FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1000)), +// FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1000)), // Data: "withdrawing from mint & converting back to erc20", // } // lastRes := depositor.SignAndBroadcastZgChainTx(withdrawAndConvertBack) diff --git a/tests/e2e/e2e_min_fees_test.go b/tests/e2e/e2e_min_fees_test.go index 1a44bebe..888143a5 100644 --- a/tests/e2e/e2e_min_fees_test.go +++ b/tests/e2e/e2e_min_fees_test.go @@ -24,10 +24,10 @@ func (suite *IntegrationTestSuite) TestEthGasPriceReturnsMinFee() { minGasPrices, err := getMinFeeFromAppToml(util.ZgChainHomePath()) suite.NoError(err) - // evm uses base denom, get base denom min fee - evmMinGas := minGasPrices.AmountOf(chaincfg.BaseDenom).TruncateInt().BigInt() + // evm uses evm denom, get evm denom min fee + evmMinGas := minGasPrices.AmountOf(chaincfg.EvmDenom).TruncateInt().BigInt() - // returns eth_gasPrice, units in auxiliary denom + // returns eth_gasPrice, units in gas denom gasPrice, err := suite.ZgChain.EvmClient.SuggestGasPrice(context.Background()) suite.NoError(err) @@ -38,13 +38,13 @@ func (suite *IntegrationTestSuite) TestEvmRespectsMinFee() { suite.SkipIfKvtoolDisabled() // setup sender & receiver - sender := suite.ZgChain.NewFundedAccount("evm-min-fee-test-sender", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e3))) + sender := suite.ZgChain.NewFundedAccount("evm-min-fee-test-sender", sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e3))) randoReceiver := util.SdkToEvmAddress(app.RandomAddress()) // get min gas price for evm (from app.toml) minFees, err := getMinFeeFromAppToml(util.ZgChainHomePath()) suite.NoError(err) - minGasPrice := minFees.AmountOf(chaincfg.BaseDenom).TruncateInt() + minGasPrice := minFees.AmountOf(chaincfg.EvmDenom).TruncateInt() // attempt tx with less than min gas price (min fee - 1) tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt() diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index da977e26..be487c46 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -25,7 +25,7 @@ import ( ) var ( - minEvmGasPrice = big.NewInt(1e10) // base denom + minEvmGasPrice = big.NewInt(1e10) // evm denom ) type IntegrationTestSuite struct { @@ -54,7 +54,7 @@ func (suite *IntegrationTestSuite) TestChainID() { // example test that funds a new account & queries its balance func (suite *IntegrationTestSuite) TestFundedAccount() { - funds := chaincfg.MakeCoinForAuxiliaryDenom(1e3) + funds := chaincfg.MakeCoinForGasDenom(1e3) acc := suite.ZgChain.NewFundedAccount("example-acc", sdk.NewCoins(funds)) // check that the sdk & evm signers are for the same account @@ -63,21 +63,21 @@ func (suite *IntegrationTestSuite) TestFundedAccount() { // check balance via SDK query res, err := suite.ZgChain.Bank.Balance(context.Background(), banktypes.NewQueryBalanceRequest( - acc.SdkAddress, chaincfg.AuxiliaryDenom, + acc.SdkAddress, chaincfg.GasDenom, )) suite.NoError(err) suite.Equal(funds, *res.Balance) // check balance via EVM query - baseDenomBal, err := suite.ZgChain.EvmClient.BalanceAt(context.Background(), acc.EvmAddress, nil) + evmDenomBal, err := suite.ZgChain.EvmClient.BalanceAt(context.Background(), acc.EvmAddress, nil) suite.NoError(err) - suite.Equal(funds.Amount.MulRaw(1e12).BigInt(), baseDenomBal) + suite.Equal(funds.Amount.MulRaw(1e12).BigInt(), evmDenomBal) } // example test that signs & broadcasts an EVM tx func (suite *IntegrationTestSuite) TestTransferOverEVM() { // fund an account that can perform the transfer - initialFunds := chaincfg.MakeCoinForAuxiliaryDenom(1e6) // 1 (auxiliary denom) + initialFunds := chaincfg.MakeCoinForGasDenom(1e6) // 1 (gas denom) acc := suite.ZgChain.NewFundedAccount("evm-test-transfer", sdk.NewCoins(initialFunds)) // get a rando account to send 0gchain to @@ -89,10 +89,10 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() { suite.NoError(err) suite.Equal(uint64(0), nonce) // sanity check. the account should have no prior txs - // transfer auxiliary denom over EVM - AuxiliaryDenomToTransfer := big.NewInt(1e17) // .1 (auxiliary denom); base denom has 18 decimals. + // transfer gas denom over EVM + GasDenomToTransfer := big.NewInt(1e17) // .1 (gas denom); evm denom has 18 decimals. req := util.EvmTxRequest{ - Tx: ethtypes.NewTransaction(nonce, to, AuxiliaryDenomToTransfer, 1e5, minEvmGasPrice, nil), + Tx: ethtypes.NewTransaction(nonce, to, GasDenomToTransfer, 1e5, minEvmGasPrice, nil), Data: "any ol' data to track this through the system", } res := acc.SignAndBroadcastEvmTx(req) @@ -100,31 +100,31 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() { suite.Equal(ethtypes.ReceiptStatusSuccessful, res.Receipt.Status) // evm txs refund unused gas. so to know the expected balance we need to know how much gas was used. - AuxiliaryDenomUsedForGas := sdkmath.NewIntFromBigInt(minEvmGasPrice). + GasDenomUsedForGas := sdkmath.NewIntFromBigInt(minEvmGasPrice). Mul(sdkmath.NewIntFromUint64(res.Receipt.GasUsed)). - QuoRaw(1e12) // convert base denom to auxiliary denom + QuoRaw(1e12) // convert evm denom to gas denom - // expect (9 - gas used) (auxiliary denom) remaining in account. + // expect (9 - gas used) (gas denom) remaining in account. balance := suite.ZgChain.QuerySdkForBalances(acc.SdkAddress) - suite.Equal(sdkmath.NewInt(9e5).Sub(AuxiliaryDenomUsedForGas), balance.AmountOf(chaincfg.AuxiliaryDenom)) + suite.Equal(sdkmath.NewInt(9e5).Sub(GasDenomUsedForGas), balance.AmountOf(chaincfg.GasDenom)) } -// TestIbcTransfer transfers (auxiliary denom) from the primary 0g-chain (suite.ZgChain) to the ibc chain (suite.Ibc). +// TestIbcTransfer transfers (gas denom) from the primary 0g-chain (suite.ZgChain) to the ibc chain (suite.Ibc). // Note that because the IBC chain also runs 0g-chain's binary, this tests both the sending & receiving. func (suite *IntegrationTestSuite) TestIbcTransfer() { suite.SkipIfIbcDisabled() // ARRANGE // setup 0g-chain account - funds := chaincfg.MakeCoinForAuxiliaryDenom(1e5) // .1 (auxiliary denom) + funds := chaincfg.MakeCoinForGasDenom(1e5) // .1 (gas denom) zgChainAcc := suite.ZgChain.NewFundedAccount("ibc-transfer-0g-side", sdk.NewCoins(funds)) // setup ibc account ibcAcc := suite.Ibc.NewFundedAccount("ibc-transfer-ibc-side", sdk.NewCoins()) gasLimit := int64(2e5) - fee := chaincfg.MakeCoinForAuxiliaryDenom(200) + fee := chaincfg.MakeCoinForGasDenom(200) - fundsToSend := chaincfg.MakeCoinForAuxiliaryDenom(5e4) // .005 (auxiliary denom) + fundsToSend := chaincfg.MakeCoinForGasDenom(5e4) // .005 (gas denom) transferMsg := ibctypes.NewMsgTransfer( testutil.IbcPort, testutil.IbcChannel, @@ -154,7 +154,7 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() { // the balance should be deducted from 0g-chain account suite.Eventually(func() bool { balance := suite.ZgChain.QuerySdkForBalances(zgChainAcc.SdkAddress) - return balance.AmountOf(chaincfg.AuxiliaryDenom).Equal(expectedSrcBalance.Amount) + return balance.AmountOf(chaincfg.GasDenom).Equal(expectedSrcBalance.Amount) }, 10*time.Second, 1*time.Second) // expect the balance to be transferred to the ibc chain! diff --git a/tests/e2e/e2e_upgrade_gov_and_authz_test.go b/tests/e2e/e2e_upgrade_gov_and_authz_test.go index 5ee3081e..85d7e87c 100644 --- a/tests/e2e/e2e_upgrade_gov_and_authz_test.go +++ b/tests/e2e/e2e_upgrade_gov_and_authz_test.go @@ -101,13 +101,13 @@ func (suite *IntegrationTestSuite) TestModuleAccountGovTransfers() { name: "transfer from community to kavadist for incentive rewards", sender: communityAcc, receiver: zgChainDistAcc, - amount: chaincfg.MakeCoinForAuxiliaryDenom(100), + amount: chaincfg.MakeCoinForGasDenom(100), }, { name: "transfer from kavadist to community", sender: zgChainDistAcc, receiver: communityAcc, - amount: chaincfg.MakeCoinForAuxiliaryDenom(50), + amount: chaincfg.MakeCoinForGasDenom(50), }, } @@ -153,7 +153,7 @@ func (suite *IntegrationTestSuite) submitAndPassProposal(msgs []sdk.Msg) int64 { suite.NoError(err) gasLimit := 1e6 - fee := chaincfg.MakeCoinForBaseDenom(1e15) + fee := chaincfg.MakeCoinForEvmDenom(1e15) req := util.ZgChainMsgRequest{ Msgs: []sdk.Msg{proposalMsg}, diff --git a/tests/e2e/runner/chain.go b/tests/e2e/runner/chain.go index 6f4b0029..946248ce 100644 --- a/tests/e2e/runner/chain.go +++ b/tests/e2e/runner/chain.go @@ -82,7 +82,7 @@ var ( EvmRpcUrl: "http://localhost:8545", ChainId: "0gchainlocalnet_8888-1", - StakingDenom: chaincfg.AuxiliaryDenom, + StakingDenom: chaincfg.GasDenom, } kvtoolIbcChain = ChainDetails{ RpcUrl: "http://localhost:26658", diff --git a/tests/e2e/testutil/account.go b/tests/e2e/testutil/account.go index 9fc8fe83..7a48f078 100644 --- a/tests/e2e/testutil/account.go +++ b/tests/e2e/testutil/account.go @@ -262,7 +262,7 @@ func (a *SigningAccount) BankSend(to sdk.AccAddress, amount sdk.Coins) util.ZgCh util.ZgChainMsgRequest{ Msgs: []sdk.Msg{banktypes.NewMsgSend(a.SdkAddress, to, amount)}, GasLimit: 2e5, // 200,000 gas - FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(200))), // assume min gas price of .001 auxiliary denom + FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(200))), // assume min gas price of .001 gas denom Data: fmt.Sprintf("sending %s to %s", amount, to), }, ) diff --git a/third_party/proto/cosmos/bank/v1beta1/bank.proto b/third_party/proto/cosmos/bank/v1beta1/bank.proto index 7bc9819d..aafb57c5 100644 --- a/third_party/proto/cosmos/bank/v1beta1/bank.proto +++ b/third_party/proto/cosmos/bank/v1beta1/bank.proto @@ -82,7 +82,7 @@ message Metadata { string description = 1; // denom_units represents the list of DenomUnit's for a given coin repeated DenomUnit denom_units = 2; - // base represents the base denom (should be the DenomUnit with exponent = 0). + // base represents the evm denom (should be the DenomUnit with exponent = 0). string base = 3; // display indicates the suggested denom that should be // displayed in clients. diff --git a/third_party/proto/cosmos/tx/v1beta1/tx.proto b/third_party/proto/cosmos/tx/v1beta1/tx.proto index a71a3e11..558b1da6 100644 --- a/third_party/proto/cosmos/tx/v1beta1/tx.proto +++ b/third_party/proto/cosmos/tx/v1beta1/tx.proto @@ -234,18 +234,18 @@ message Tip { string tipper = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// AuxSignerData is the intermediary format that an auxiliary signer (e.g. a +// AuxSignerData is the intermediary format that an gas signer (e.g. a // tipper) builds and sends to the fee payer (who will build and broadcast the // actual tx). AuxSignerData is not a valid tx in itself, and will be rejected // by the node if sent directly as-is. // // Since: cosmos-sdk 0.46 message AuxSignerData { - // address is the bech32-encoded address of the auxiliary signer. If using + // address is the bech32-encoded address of the gas signer. If using // AuxSignerData across different chains, the bech32 prefix of the target // chain (where the final transaction is broadcasted) should be used. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + // sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the gas signer // signs. Note: we use the same sign doc even if we're signing with // LEGACY_AMINO_JSON. SignDocDirectAux sign_doc = 2; diff --git a/third_party/proto/ibc/applications/transfer/v1/transfer.proto b/third_party/proto/ibc/applications/transfer/v1/transfer.proto index 9c60ad65..c7ebe5bd 100644 --- a/third_party/proto/ibc/applications/transfer/v1/transfer.proto +++ b/third_party/proto/ibc/applications/transfer/v1/transfer.proto @@ -6,13 +6,13 @@ option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"; import "gogoproto/gogo.proto"; -// DenomTrace contains the base denomination for ICS20 fungible tokens and the +// DenomTrace contains the evm denomination for ICS20 fungible tokens and the // source tracing information path. message DenomTrace { // path defines the chain of port/channel identifiers used for tracing the // source of the fungible token. string path = 1; - // base denomination of the relayed fungible token. + // evm denomination of the relayed fungible token. string base_denom = 2; } diff --git a/x/bep3/keeper/msg_server_test.go b/x/bep3/keeper/msg_server_test.go index df2fb485..feff307d 100644 --- a/x/bep3/keeper/msg_server_test.go +++ b/x/bep3/keeper/msg_server_test.go @@ -36,7 +36,7 @@ func (suite *MsgServerTestSuite) SetupTest() { // Set up genesis state and initialize _, addrs := app.GeneratePrivKeyAddressPairs(3) - coins := sdk.NewCoins(c("bnb", 10000000000), c(chaincfg.AuxiliaryDenom, 10000)) + coins := sdk.NewCoins(c("bnb", 10000000000), c(chaincfg.GasDenom, 10000)) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) tApp.InitializeFromGenesisStates(authGS, NewBep3GenStateMulti(cdc, addrs[0])) diff --git a/x/bep3/keeper/querier_test.go b/x/bep3/keeper/querier_test.go index 240ebcd3..fa548ec0 100644 --- a/x/bep3/keeper/querier_test.go +++ b/x/bep3/keeper/querier_test.go @@ -42,7 +42,7 @@ func (suite *QuerierTestSuite) SetupTest() { // Set up auth GenesisState _, addrs := app.GeneratePrivKeyAddressPairs(11) - coins := sdk.NewCoins(c("bnb", 10000000000), c(chaincfg.AuxiliaryDenom, 10000)) + coins := sdk.NewCoins(c("bnb", 10000000000), c(chaincfg.GasDenom, 10000)) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) tApp.InitializeFromGenesisStates( diff --git a/x/bep3/types/genesis_test.go b/x/bep3/types/genesis_test.go index de63e0bb..447a294d 100644 --- a/x/bep3/types/genesis_test.go +++ b/x/bep3/types/genesis_test.go @@ -20,7 +20,7 @@ type GenesisTestSuite struct { } func (suite *GenesisTestSuite) SetupTest() { - coin := chaincfg.MakeCoinForAuxiliaryDenom(1) + coin := chaincfg.MakeCoinForGasDenom(1) suite.swaps = atomicSwaps(10) supply := types.NewAssetSupply(coin, coin, coin, coin, time.Duration(0)) diff --git a/x/bep3/types/supply_test.go b/x/bep3/types/supply_test.go index b88e5960..b27d2928 100644 --- a/x/bep3/types/supply_test.go +++ b/x/bep3/types/supply_test.go @@ -11,7 +11,7 @@ import ( ) func TestAssetSupplyValidate(t *testing.T) { - coin := chaincfg.MakeCoinForAuxiliaryDenom(1) + coin := chaincfg.MakeCoinForGasDenom(1) invalidCoin := sdk.Coin{Denom: "Invalid Denom", Amount: sdkmath.NewInt(-1)} testCases := []struct { msg string diff --git a/x/committee/keeper/msg_server_test.go b/x/committee/keeper/msg_server_test.go index 655b441d..82780615 100644 --- a/x/committee/keeper/msg_server_test.go +++ b/x/committee/keeper/msg_server_test.go @@ -61,7 +61,7 @@ func (suite *MsgServerTestSuite) SetupTest() { []types.Proposal{}, []types.Vote{}, ) - suite.communityPoolAmt = sdk.NewCoins(chaincfg.MakeCoinForBaseDenom(1000000000000000)) + suite.communityPoolAmt = sdk.NewCoins(chaincfg.MakeCoinForEvmDenom(1000000000000000)) suite.app.InitializeFromGenesisStates( app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(testGenesis)}, // TODO: not used? diff --git a/x/council/v1/client/cli/tx.go b/x/council/v1/client/cli/tx.go index a81cbe2d..478708f4 100644 --- a/x/council/v1/client/cli/tx.go +++ b/x/council/v1/client/cli/tx.go @@ -171,7 +171,7 @@ func NewVoteCmd() *cobra.Command { tokens = val.GetTokens() } } - // the denom of token is base denom, need to convert to A0GI + // the denom of token is evm denom, need to convert to A0GI a0giTokenCnt := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)) // 1_000 0AGI token / vote numBallots := a0giTokenCnt.Quo(sdk.NewInt(1_000)).Uint64() diff --git a/x/evmutil/keeper/bank_keeper.go b/x/evmutil/keeper/bank_keeper.go index 40f7d4e8..7ecd5d40 100644 --- a/x/evmutil/keeper/bank_keeper.go +++ b/x/evmutil/keeper/bank_keeper.go @@ -13,53 +13,53 @@ import ( "github.com/0glabs/0g-chain/x/evmutil/types" ) -// ConversionMultiplier is the conversion multiplier between base denom and auxiliary denom -var ConversionMultiplier = sdkmath.NewInt(chaincfg.AuxiliaryDenomConversionMultiplier) +// ConversionMultiplier is the conversion multiplier between evm denom and gas denom +var ConversionMultiplier = sdkmath.NewInt(chaincfg.GasDenomConversionMultiplier) var _ evmtypes.BankKeeper = EvmBankKeeper{} // EvmBankKeeper is a BankKeeper wrapper for the x/evm module to allow the use -// of the 18 decimal base denom coin on the evm. -// x/evm consumes gas and send coins by minting and burning base denom coins in its module +// of the 18 decimal evm denom coin on the evm. +// x/evm consumes gas and send coins by minting and burning evm denom coins in its module // account and then sending the funds to the target account. -// This keeper uses both the auxiliary denom coin and a separate base denom balance to manage the +// This keeper uses both the gas denom coin and a separate evm denom balance to manage the // extra percision needed by the evm. type EvmBankKeeper struct { - baseDenomKeeper Keeper - bk types.BankKeeper - ak types.AccountKeeper + evmDenomKeeper Keeper + bk types.BankKeeper + ak types.AccountKeeper } func NewEvmBankKeeper(baseKeeper Keeper, bk types.BankKeeper, ak types.AccountKeeper) EvmBankKeeper { return EvmBankKeeper{ - baseDenomKeeper: baseKeeper, - bk: bk, - ak: ak, + evmDenomKeeper: baseKeeper, + bk: bk, + ak: ak, } } -// GetBalance returns the total **spendable** balance of base denom for a given account by address. +// GetBalance returns the total **spendable** balance of evm denom for a given account by address. func (k EvmBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin { - if denom != chaincfg.BaseDenom { - panic(fmt.Errorf("only evm denom %s is supported by EvmBankKeeper", chaincfg.BaseDenom)) + if denom != chaincfg.EvmDenom { + panic(fmt.Errorf("only evm denom %s is supported by EvmBankKeeper", chaincfg.EvmDenom)) } spendableCoins := k.bk.SpendableCoins(ctx, addr) - auxiliaryDenomFromBank := spendableCoins.AmountOf(chaincfg.AuxiliaryDenom) - baseDenomFromBank := spendableCoins.AmountOf(chaincfg.BaseDenom) - baseDenomFromEvmBank := k.baseDenomKeeper.GetBalance(ctx, addr) + gasDenomFromBank := spendableCoins.AmountOf(chaincfg.GasDenom) + evmDenomFromBank := spendableCoins.AmountOf(chaincfg.EvmDenom) + evmDenomFromEvmBank := k.evmDenomKeeper.GetBalance(ctx, addr) var total sdkmath.Int - if auxiliaryDenomFromBank.IsPositive() { - total = auxiliaryDenomFromBank.Mul(ConversionMultiplier).Add(baseDenomFromBank).Add(baseDenomFromEvmBank) + if gasDenomFromBank.IsPositive() { + total = gasDenomFromBank.Mul(ConversionMultiplier).Add(evmDenomFromBank).Add(evmDenomFromEvmBank) } else { - total = baseDenomFromBank.Add(baseDenomFromEvmBank) + total = evmDenomFromBank.Add(evmDenomFromEvmBank) } - return sdk.NewCoin(chaincfg.BaseDenom, total) + return sdk.NewCoin(chaincfg.EvmDenom, total) } -// SendCoins transfers base denom coins from a AccAddress to an AccAddress. +// SendCoins transfers evm denom coins from a AccAddress to an AccAddress. func (k EvmBankKeeper) SendCoins(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, amt sdk.Coins) error { // SendCoins method is not used by the evm module, but is required by the // evmtypes.BankKeeper interface. This must be updated if the evm module @@ -67,148 +67,148 @@ func (k EvmBankKeeper) SendCoins(ctx sdk.Context, senderAddr sdk.AccAddress, rec panic("not implemented") } -// SendCoinsFromModuleToAccount transfers base denom coins from a ModuleAccount to an AccAddress. +// SendCoinsFromModuleToAccount transfers evm denom coins from a ModuleAccount to an AccAddress. // It will panic if the module account does not exist. An error is returned if the recipient // address is black-listed or if sending the tokens fails. func (k EvmBankKeeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error { - auxiliaryDenomCoin, baseDemonCnt, err := SplitBaseDenomCoins(amt) + gasDenomCoin, baseDemonCnt, err := SplitEvmDenomCoins(amt) if err != nil { return err } - if auxiliaryDenomCoin.Amount.IsPositive() { - if err := k.bk.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { + if gasDenomCoin.Amount.IsPositive() { + if err := k.bk.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, sdk.NewCoins(gasDenomCoin)); err != nil { return err } } senderAddr := k.GetModuleAddress(senderModule) - if err := k.ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(ctx, senderAddr, baseDemonCnt); err != nil { + if err := k.ConvertOneGasDenomToEvmDenomIfNeeded(ctx, senderAddr, baseDemonCnt); err != nil { return err } - if err := k.baseDenomKeeper.SendBalance(ctx, senderAddr, recipientAddr, baseDemonCnt); err != nil { + if err := k.evmDenomKeeper.SendBalance(ctx, senderAddr, recipientAddr, baseDemonCnt); err != nil { return err } - return k.ConvertBaseDenomToAuxiliaryDenom(ctx, recipientAddr) + return k.ConvertEvmDenomToGasDenom(ctx, recipientAddr) } -// SendCoinsFromAccountToModule transfers base denom coins from an AccAddress to a ModuleAccount. +// SendCoinsFromAccountToModule transfers evm denom coins from an AccAddress to a ModuleAccount. // It will panic if the module account does not exist. func (k EvmBankKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { - auxiliaryDenomCoin, baseDenomCnt, err := SplitBaseDenomCoins(amt) + gasDenomCoin, evmDenomCnt, err := SplitEvmDenomCoins(amt) if err != nil { return err } - if auxiliaryDenomCoin.IsPositive() { - if err := k.bk.SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { + if gasDenomCoin.IsPositive() { + if err := k.bk.SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, sdk.NewCoins(gasDenomCoin)); err != nil { return err } } - if err := k.ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(ctx, senderAddr, baseDenomCnt); err != nil { + if err := k.ConvertOneGasDenomToEvmDenomIfNeeded(ctx, senderAddr, evmDenomCnt); err != nil { return err } recipientAddr := k.GetModuleAddress(recipientModule) - if err := k.baseDenomKeeper.SendBalance(ctx, senderAddr, recipientAddr, baseDenomCnt); err != nil { + if err := k.evmDenomKeeper.SendBalance(ctx, senderAddr, recipientAddr, evmDenomCnt); err != nil { return err } - return k.ConvertBaseDenomToAuxiliaryDenom(ctx, recipientAddr) + return k.ConvertEvmDenomToGasDenom(ctx, recipientAddr) } -// MintCoins mints base denom coins by minting the equivalent auxiliary denom coins and any remaining base denom coins. +// MintCoins mints evm denom coins by minting the equivalent gas denom coins and any remaining evm denom coins. // It will panic if the module account does not exist or is unauthorized. func (k EvmBankKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { - auxiliaryDenomCoin, baseDemonCnt, err := SplitBaseDenomCoins(amt) + gasDenomCoin, baseDemonCnt, err := SplitEvmDenomCoins(amt) if err != nil { return err } - if auxiliaryDenomCoin.IsPositive() { - if err := k.bk.MintCoins(ctx, moduleName, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { + if gasDenomCoin.IsPositive() { + if err := k.bk.MintCoins(ctx, moduleName, sdk.NewCoins(gasDenomCoin)); err != nil { return err } } recipientAddr := k.GetModuleAddress(moduleName) - if err := k.baseDenomKeeper.AddBalance(ctx, recipientAddr, baseDemonCnt); err != nil { + if err := k.evmDenomKeeper.AddBalance(ctx, recipientAddr, baseDemonCnt); err != nil { return err } - return k.ConvertBaseDenomToAuxiliaryDenom(ctx, recipientAddr) + return k.ConvertEvmDenomToGasDenom(ctx, recipientAddr) } -// BurnCoins burns base denom coins by burning the equivalent auxiliary denom coins and any remaining base denom coins. +// BurnCoins burns evm denom coins by burning the equivalent gas denom coins and any remaining evm denom coins. // It will panic if the module account does not exist or is unauthorized. func (k EvmBankKeeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { - auxiliaryDenomCoin, baseDemonCnt, err := SplitBaseDenomCoins(amt) + gasDenomCoin, baseDemonCnt, err := SplitEvmDenomCoins(amt) if err != nil { return err } - if auxiliaryDenomCoin.IsPositive() { - if err := k.bk.BurnCoins(ctx, moduleName, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { + if gasDenomCoin.IsPositive() { + if err := k.bk.BurnCoins(ctx, moduleName, sdk.NewCoins(gasDenomCoin)); err != nil { return err } } moduleAddr := k.GetModuleAddress(moduleName) - if err := k.ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(ctx, moduleAddr, baseDemonCnt); err != nil { + if err := k.ConvertOneGasDenomToEvmDenomIfNeeded(ctx, moduleAddr, baseDemonCnt); err != nil { return err } - return k.baseDenomKeeper.RemoveBalance(ctx, moduleAddr, baseDemonCnt) + return k.evmDenomKeeper.RemoveBalance(ctx, moduleAddr, baseDemonCnt) } -// ConvertOneauxiliaryDenomToBaseDenomIfNeeded converts 1 auxiliary denom to base denom for an address if -// its base denom balance is smaller than the baseDenomCnt amount. -func (k EvmBankKeeper) ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(ctx sdk.Context, addr sdk.AccAddress, baseDenomCnt sdkmath.Int) error { - baseDenomBal := k.baseDenomKeeper.GetBalance(ctx, addr) - if baseDenomBal.GTE(baseDenomCnt) { +// ConvertOnegasDenomToEvmDenomIfNeeded converts 1 gas denom to evm denom for an address if +// its evm denom balance is smaller than the evmDenomCnt amount. +func (k EvmBankKeeper) ConvertOneGasDenomToEvmDenomIfNeeded(ctx sdk.Context, addr sdk.AccAddress, evmDenomCnt sdkmath.Int) error { + evmDenomBal := k.evmDenomKeeper.GetBalance(ctx, addr) + if evmDenomBal.GTE(evmDenomCnt) { return nil } - auxiliaryDenomToStore := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdk.OneInt())) - if err := k.bk.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, auxiliaryDenomToStore); err != nil { + gasDenomToStore := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdk.OneInt())) + if err := k.bk.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, gasDenomToStore); err != nil { return err } - // add 1 auxiliary denom equivalent of base denom to addr - baseDenomToReceive := ConversionMultiplier - if err := k.baseDenomKeeper.AddBalance(ctx, addr, baseDenomToReceive); err != nil { + // add 1 gas denom equivalent of evm denom to addr + evmDenomToReceive := ConversionMultiplier + if err := k.evmDenomKeeper.AddBalance(ctx, addr, evmDenomToReceive); err != nil { return err } return nil } -// ConvertBaseDenomToauxiliaryDenom converts all available base denom to auxiliary denom for a given AccAddress. -func (k EvmBankKeeper) ConvertBaseDenomToAuxiliaryDenom(ctx sdk.Context, addr sdk.AccAddress) error { - totalBaseDenom := k.baseDenomKeeper.GetBalance(ctx, addr) - auxiliaryDenomCoin, _, err := SplitBaseDenomCoins(sdk.NewCoins(sdk.NewCoin(chaincfg.BaseDenom, totalBaseDenom))) +// ConvertEvmDenomTogasDenom converts all available evm denom to gas denom for a given AccAddress. +func (k EvmBankKeeper) ConvertEvmDenomToGasDenom(ctx sdk.Context, addr sdk.AccAddress) error { + totalEvmDenom := k.evmDenomKeeper.GetBalance(ctx, addr) + gasDenomCoin, _, err := SplitEvmDenomCoins(sdk.NewCoins(sdk.NewCoin(chaincfg.EvmDenom, totalEvmDenom))) if err != nil { return err } - // do nothing if account does not have enough base denom for a single auxiliary denom - auxiliaryDenomToReceive := auxiliaryDenomCoin.Amount - if !auxiliaryDenomToReceive.IsPositive() { + // do nothing if account does not have enough evm denom for a single gas denom + gasDenomToReceive := gasDenomCoin.Amount + if !gasDenomToReceive.IsPositive() { return nil } - // remove base denom used for converting to auxiliary denom - baseDenomToBurn := auxiliaryDenomToReceive.Mul(ConversionMultiplier) - finalBal := totalBaseDenom.Sub(baseDenomToBurn) - if err := k.baseDenomKeeper.SetBalance(ctx, addr, finalBal); err != nil { + // remove evm denom used for converting to gas denom + evmDenomToBurn := gasDenomToReceive.Mul(ConversionMultiplier) + finalBal := totalEvmDenom.Sub(evmDenomToBurn) + if err := k.evmDenomKeeper.SetBalance(ctx, addr, finalBal); err != nil { return err } fromAddr := k.GetModuleAddress(types.ModuleName) - if err := k.bk.SendCoins(ctx, fromAddr, addr, sdk.NewCoins(auxiliaryDenomCoin)); err != nil { + if err := k.bk.SendCoins(ctx, fromAddr, addr, sdk.NewCoins(gasDenomCoin)); err != nil { return err } @@ -223,18 +223,18 @@ func (k EvmBankKeeper) GetModuleAddress(moduleName string) sdk.AccAddress { return addr } -// SplitBaseDenomCoins splits base denom coins to the equivalent auxiliary denom coins and any remaining base denom balance. -// An error will be returned if the coins are not valid or if the coins are not the base denom. -func SplitBaseDenomCoins(coins sdk.Coins) (sdk.Coin, sdkmath.Int, error) { +// SplitEvmDenomCoins splits evm denom coins to the equivalent gas denom coins and any remaining evm denom balance. +// An error will be returned if the coins are not valid or if the coins are not the evm denom. +func SplitEvmDenomCoins(coins sdk.Coins) (sdk.Coin, sdkmath.Int, error) { baseDemonCnt := sdk.ZeroInt() - auxiliaryDenomAmt := sdk.NewCoin(chaincfg.AuxiliaryDenom, sdk.ZeroInt()) + gasDenomAmt := sdk.NewCoin(chaincfg.GasDenom, sdk.ZeroInt()) if len(coins) == 0 { - return auxiliaryDenomAmt, baseDemonCnt, nil + return gasDenomAmt, baseDemonCnt, nil } if err := ValidateEvmCoins(coins); err != nil { - return auxiliaryDenomAmt, baseDemonCnt, err + return gasDenomAmt, baseDemonCnt, err } // note: we should always have len(coins) == 1 here since coins cannot have dup denoms after we validate. @@ -243,15 +243,15 @@ func SplitBaseDenomCoins(coins sdk.Coins) (sdk.Coin, sdkmath.Int, error) { if remainingBalance.IsPositive() { baseDemonCnt = remainingBalance } - auxiliaryDenomAmount := coin.Amount.Quo(ConversionMultiplier) - if auxiliaryDenomAmount.IsPositive() { - auxiliaryDenomAmt = sdk.NewCoin(chaincfg.AuxiliaryDenom, auxiliaryDenomAmount) + gasDenomAmount := coin.Amount.Quo(ConversionMultiplier) + if gasDenomAmount.IsPositive() { + gasDenomAmt = sdk.NewCoin(chaincfg.GasDenom, gasDenomAmount) } - return auxiliaryDenomAmt, baseDemonCnt, nil + return gasDenomAmt, baseDemonCnt, nil } -// ValidateEvmCoins validates the coins from evm is valid and is the base denom. +// ValidateEvmCoins validates the coins from evm is valid and is the evm denom. func ValidateEvmCoins(coins sdk.Coins) error { if len(coins) == 0 { return nil @@ -262,9 +262,9 @@ func ValidateEvmCoins(coins sdk.Coins) error { return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coins.String()) } - // validate that coin denom is base denom - if len(coins) != 1 || coins[0].Denom != chaincfg.BaseDenom { - errMsg := fmt.Sprintf("invalid evm coin denom, only %s is supported", chaincfg.BaseDenom) + // validate that coin denom is evm denom + if len(coins) != 1 || coins[0].Denom != chaincfg.EvmDenom { + errMsg := fmt.Sprintf("invalid evm coin denom, only %s is supported", chaincfg.EvmDenom) return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, errMsg) } diff --git a/x/evmutil/keeper/bank_keeper_test.go b/x/evmutil/keeper/bank_keeper_test.go index f99fb745..0143f0e7 100644 --- a/x/evmutil/keeper/bank_keeper_test.go +++ b/x/evmutil/keeper/bank_keeper_test.go @@ -27,8 +27,8 @@ func (suite *evmBankKeeperTestSuite) SetupTest() { } func (suite *evmBankKeeperTestSuite) TestGetBalance_ReturnsSpendable() { - startingCoins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10)) - startingBaseDenom := sdkmath.NewInt(100) + startingCoins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10)) + startingEvmDenom := sdkmath.NewInt(100) now := tmtime.Now() endTime := now.Add(24 * time.Hour) @@ -38,20 +38,20 @@ func (suite *evmBankKeeperTestSuite) TestGetBalance_ReturnsSpendable() { err := suite.App.FundAccount(suite.Ctx, suite.Addrs[0], startingCoins) suite.Require().NoError(err) - err = suite.Keeper.SetBalance(suite.Ctx, suite.Addrs[0], startingBaseDenom) + err = suite.Keeper.SetBalance(suite.Ctx, suite.Addrs[0], startingEvmDenom) suite.Require().NoError(err) - coin := suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.BaseDenom) - suite.Require().Equal(startingBaseDenom, coin.Amount) + coin := suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.EvmDenom) + suite.Require().Equal(startingEvmDenom, coin.Amount) ctx := suite.Ctx.WithBlockTime(now.Add(12 * time.Hour)) - coin = suite.EvmBankKeeper.GetBalance(ctx, suite.Addrs[0], chaincfg.BaseDenom) + coin = suite.EvmBankKeeper.GetBalance(ctx, suite.Addrs[0], chaincfg.EvmDenom) suite.Require().Equal(sdkmath.NewIntFromUint64(5_000_000_000_100), coin.Amount) } func (suite *evmBankKeeperTestSuite) TestGetBalance_NotEvmDenom() { suite.Require().Panics(func() { - suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) + suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.GasDenom) }) suite.Require().Panics(func() { suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], "busd") @@ -65,39 +65,39 @@ func (suite *evmBankKeeperTestSuite) TestGetBalance() { expAmount sdkmath.Int }{ { - "auxiliary denom with base denom", + "gas denom with evm denom", sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 100), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), + sdk.NewInt64Coin(chaincfg.EvmDenom, 100), + sdk.NewInt64Coin(chaincfg.GasDenom, 10), ), sdkmath.NewInt(10_000_000_000_100), }, { - "just base denom", + "just evm denom", sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 100), + sdk.NewInt64Coin(chaincfg.EvmDenom, 100), sdk.NewInt64Coin("busd", 100), ), sdkmath.NewInt(100), }, { - "just auxiliary denom", + "just gas denom", sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), + sdk.NewInt64Coin(chaincfg.GasDenom, 10), sdk.NewInt64Coin("busd", 100), ), sdkmath.NewInt(10_000_000_000_000), }, { - "no auxiliary denom or base denom", + "no gas denom or evm denom", sdk.NewCoins(), sdk.ZeroInt(), }, { - "with avaka that is more than 1 auxiliary denom", + "with avaka that is more than 1 gas denom", sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 20_000_000_000_220), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 11), + sdk.NewInt64Coin(chaincfg.EvmDenom, 20_000_000_000_220), + sdk.NewInt64Coin(chaincfg.GasDenom, 11), ), sdkmath.NewInt(31_000_000_000_220), }, @@ -108,7 +108,7 @@ func (suite *evmBankKeeperTestSuite) TestGetBalance() { suite.SetupTest() suite.FundAccountWithZgChain(suite.Addrs[0], tt.startingAmount) - coin := suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.BaseDenom) + coin := suite.EvmBankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.EvmDenom) suite.Require().Equal(tt.expAmount, coin.Amount) }) } @@ -116,8 +116,8 @@ func (suite *evmBankKeeperTestSuite) TestGetBalance() { func (suite *evmBankKeeperTestSuite) TestSendCoinsFromModuleToAccount() { startingModuleCoins := sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 200), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100), + sdk.NewInt64Coin(chaincfg.EvmDenom, 200), + sdk.NewInt64Coin(chaincfg.GasDenom, 100), ) tests := []struct { name string @@ -127,102 +127,102 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromModuleToAccount() { hasErr bool }{ { - "send more than 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_010)), + "send more than 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 12_000_000_000_010)), sdk.Coins{}, sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 10), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 12), + sdk.NewInt64Coin(chaincfg.EvmDenom, 10), + sdk.NewInt64Coin(chaincfg.GasDenom, 12), ), false, }, { - "send less than 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 122)), + "send less than 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 122)), sdk.Coins{}, sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 122), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0), + sdk.NewInt64Coin(chaincfg.EvmDenom, 122), + sdk.NewInt64Coin(chaincfg.GasDenom, 0), ), false, }, { - "send an exact amount of auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 98_000_000_000_000)), + "send an exact amount of gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 98_000_000_000_000)), sdk.Coins{}, sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 0o0), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 98), + sdk.NewInt64Coin(chaincfg.EvmDenom, 0o0), + sdk.NewInt64Coin(chaincfg.GasDenom, 98), ), false, }, { - "send no base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 0)), + "send no evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 0)), sdk.Coins{}, sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 0), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0), + sdk.NewInt64Coin(chaincfg.EvmDenom, 0), + sdk.NewInt64Coin(chaincfg.GasDenom, 0), ), false, }, { "errors if sending other coins", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin("busd", 1000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 500), sdk.NewInt64Coin("busd", 1000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "errors if not enough total base denom to cover", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_001_000)), + "errors if not enough total evm denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100_000_000_001_000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "errors if not enough auxiliary denom to cover", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200_000_000_000_000)), + "errors if not enough gas denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 200_000_000_000_000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "converts receiver's base denom to auxiliary denom if there's enough base denom after the transfer", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 99_000_000_000_200)), + "converts receiver's evm denom to gas denom if there's enough evm denom after the transfer", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 99_000_000_000_200)), sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 999_999_999_900), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1), + sdk.NewInt64Coin(chaincfg.EvmDenom, 999_999_999_900), + sdk.NewInt64Coin(chaincfg.GasDenom, 1), ), sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 100), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 101), + sdk.NewInt64Coin(chaincfg.EvmDenom, 100), + sdk.NewInt64Coin(chaincfg.GasDenom, 101), ), false, }, { - "converts all of receiver's base denom to auxiliary denom even if somehow receiver has more than 1 auxiliary denom of base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_100)), + "converts all of receiver's evm denom to gas denom even if somehow receiver has more than 1 gas denom of evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 12_000_000_000_100)), sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 5_999_999_999_990), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1), + sdk.NewInt64Coin(chaincfg.EvmDenom, 5_999_999_999_990), + sdk.NewInt64Coin(chaincfg.GasDenom, 1), ), sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 90), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 19), + sdk.NewInt64Coin(chaincfg.EvmDenom, 90), + sdk.NewInt64Coin(chaincfg.GasDenom, 19), ), false, }, { - "swap 1 auxiliary denom for base denom if module account doesn't have enough base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 99_000_000_001_000)), + "swap 1 gas denom for evm denom if module account doesn't have enough evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 99_000_000_001_000)), sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 200), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1), + sdk.NewInt64Coin(chaincfg.EvmDenom, 200), + sdk.NewInt64Coin(chaincfg.GasDenom, 1), ), sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 1200), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100), + sdk.NewInt64Coin(chaincfg.EvmDenom, 1200), + sdk.NewInt64Coin(chaincfg.GasDenom, 100), ), false, }, @@ -235,8 +235,8 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromModuleToAccount() { suite.FundAccountWithZgChain(suite.Addrs[0], tt.startingAccBal) suite.FundModuleAccountWithZgChain(evmtypes.ModuleName, startingModuleCoins) - // fund our module with some auxiliary denom to account for converting extra base denom back to auxiliary denom - suite.FundModuleAccountWithZgChain(types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10))) + // fund our module with some gas denom to account for converting extra evm denom back to gas denom + suite.FundModuleAccountWithZgChain(types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10))) err := suite.EvmBankKeeper.SendCoinsFromModuleToAccount(suite.Ctx, evmtypes.ModuleName, suite.Addrs[0], tt.sendCoins) if tt.hasErr { @@ -246,24 +246,24 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromModuleToAccount() { suite.Require().NoError(err) } - // check auxiliary denom - AuxiliaryDenomSender := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) - suite.Require().Equal(tt.expAccBal.AmountOf(chaincfg.AuxiliaryDenom).Int64(), AuxiliaryDenomSender.Amount.Int64()) + // check gas denom + GasDenomSender := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.GasDenom) + suite.Require().Equal(tt.expAccBal.AmountOf(chaincfg.GasDenom).Int64(), GasDenomSender.Amount.Int64()) - // check base denom - actualBaseDenom := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(tt.expAccBal.AmountOf(chaincfg.BaseDenom).Int64(), actualBaseDenom.Int64()) + // check evm denom + actualEvmDenom := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) + suite.Require().Equal(tt.expAccBal.AmountOf(chaincfg.EvmDenom).Int64(), actualEvmDenom.Int64()) }) } } func (suite *evmBankKeeperTestSuite) TestSendCoinsFromAccountToModule() { startingAccCoins := sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 200), - sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100), + sdk.NewInt64Coin(chaincfg.EvmDenom, 200), + sdk.NewInt64Coin(chaincfg.GasDenom, 100), ) startingModuleCoins := sdk.NewCoins( - sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_000), + sdk.NewInt64Coin(chaincfg.EvmDenom, 100_000_000_000), ) tests := []struct { name string @@ -273,36 +273,36 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromAccountToModule() { hasErr bool }{ { - "send more than 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_010)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 190), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 88)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_010), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 12)), + "send more than 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 12_000_000_000_010)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 190), sdk.NewInt64Coin(chaincfg.GasDenom, 88)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100_000_000_010), sdk.NewInt64Coin(chaincfg.GasDenom, 12)), false, }, { - "send less than 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 122)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 78), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_122), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0)), + "send less than 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 122)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 78), sdk.NewInt64Coin(chaincfg.GasDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100_000_000_122), sdk.NewInt64Coin(chaincfg.GasDenom, 0)), false, }, { - "send an exact amount of auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 98_000_000_000_000)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 2)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 98)), + "send an exact amount of gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 98_000_000_000_000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 200), sdk.NewInt64Coin(chaincfg.GasDenom, 2)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.GasDenom, 98)), false, }, { - "send no base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 0)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 100)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0)), + "send no evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 0)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 200), sdk.NewInt64Coin(chaincfg.GasDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.GasDenom, 0)), false, }, { "errors if sending other coins", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin("busd", 1000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 500), sdk.NewInt64Coin("busd", 1000)), sdk.Coins{}, sdk.Coins{}, true, @@ -310,39 +310,39 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromAccountToModule() { { "errors if have dup coins", sdk.Coins{ - sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_000), - sdk.NewInt64Coin(chaincfg.BaseDenom, 2_000_000_000_000), + sdk.NewInt64Coin(chaincfg.EvmDenom, 12_000_000_000_000), + sdk.NewInt64Coin(chaincfg.EvmDenom, 2_000_000_000_000), }, sdk.Coins{}, sdk.Coins{}, true, }, { - "errors if not enough total base denom to cover", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_001_000)), + "errors if not enough total evm denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100_000_000_001_000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "errors if not enough auxiliary denom to cover", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200_000_000_000_000)), + "errors if not enough gas denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 200_000_000_000_000)), sdk.Coins{}, sdk.Coins{}, true, }, { - "converts 1 auxiliary denom to base denom if not enough base denom to cover", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 99_001_000_000_000)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 999_000_000_200), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 101_000_000_000), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 99)), + "converts 1 gas denom to evm denom if not enough evm denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 99_001_000_000_000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 999_000_000_200), sdk.NewInt64Coin(chaincfg.GasDenom, 0)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 101_000_000_000), sdk.NewInt64Coin(chaincfg.GasDenom, 99)), false, }, { - "converts receiver's base denom to auxiliary denom if there's enough base denom after the transfer", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 5_900_000_000_200)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 94)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 6)), + "converts receiver's evm denom to gas denom if there's enough evm denom after the transfer", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 5_900_000_000_200)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100_000_000_000), sdk.NewInt64Coin(chaincfg.GasDenom, 94)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 200), sdk.NewInt64Coin(chaincfg.GasDenom, 6)), false, }, } @@ -362,67 +362,67 @@ func (suite *evmBankKeeperTestSuite) TestSendCoinsFromAccountToModule() { } // check sender balance - AuxiliaryDenomSender := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) - suite.Require().Equal(tt.expSenderCoins.AmountOf(chaincfg.AuxiliaryDenom).Int64(), AuxiliaryDenomSender.Amount.Int64()) - actualBaseDenom := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(tt.expSenderCoins.AmountOf(chaincfg.BaseDenom).Int64(), actualBaseDenom.Int64()) + GasDenomSender := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.GasDenom) + suite.Require().Equal(tt.expSenderCoins.AmountOf(chaincfg.GasDenom).Int64(), GasDenomSender.Amount.Int64()) + actualEvmDenom := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) + suite.Require().Equal(tt.expSenderCoins.AmountOf(chaincfg.EvmDenom).Int64(), actualEvmDenom.Int64()) // check module balance moduleAddr := suite.AccountKeeper.GetModuleAddress(evmtypes.ModuleName) - AuxiliaryDenomSender = suite.BankKeeper.GetBalance(suite.Ctx, moduleAddr, chaincfg.AuxiliaryDenom) - suite.Require().Equal(tt.expModuleCoins.AmountOf(chaincfg.AuxiliaryDenom).Int64(), AuxiliaryDenomSender.Amount.Int64()) - actualBaseDenom = suite.Keeper.GetBalance(suite.Ctx, moduleAddr) - suite.Require().Equal(tt.expModuleCoins.AmountOf(chaincfg.BaseDenom).Int64(), actualBaseDenom.Int64()) + GasDenomSender = suite.BankKeeper.GetBalance(suite.Ctx, moduleAddr, chaincfg.GasDenom) + suite.Require().Equal(tt.expModuleCoins.AmountOf(chaincfg.GasDenom).Int64(), GasDenomSender.Amount.Int64()) + actualEvmDenom = suite.Keeper.GetBalance(suite.Ctx, moduleAddr) + suite.Require().Equal(tt.expModuleCoins.AmountOf(chaincfg.EvmDenom).Int64(), actualEvmDenom.Int64()) }) } } func (suite *evmBankKeeperTestSuite) TestBurnCoins() { - startingAuxiliaryDenom := sdkmath.NewInt(100) + startingGasDenom := sdkmath.NewInt(100) tests := []struct { - name string - burnCoins sdk.Coins - expAuxiliaryDenom sdkmath.Int - expBaseDenom sdkmath.Int - hasErr bool - baseDenomStart sdkmath.Int + name string + burnCoins sdk.Coins + expGasDenom sdkmath.Int + expEvmDenom sdkmath.Int + hasErr bool + evmDenomStart sdkmath.Int }{ { - "burn more than 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_021_000_000_002)), + "burn more than 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 12_021_000_000_002)), sdkmath.NewInt(88), sdkmath.NewInt(100_000_000_000), false, sdkmath.NewInt(121_000_000_002), }, { - "burn less than 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 122)), + "burn less than 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 122)), sdkmath.NewInt(100), sdkmath.NewInt(878), false, sdkmath.NewInt(1000), }, { - "burn an exact amount of auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 98_000_000_000_000)), + "burn an exact amount of gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 98_000_000_000_000)), sdkmath.NewInt(2), sdkmath.NewInt(10), false, sdkmath.NewInt(10), }, { - "burn no base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 0)), - startingAuxiliaryDenom, + "burn no evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 0)), + startingGasDenom, sdk.ZeroInt(), false, sdk.ZeroInt(), }, { "errors if burning other coins", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin("busd", 1000)), - startingAuxiliaryDenom, + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 500), sdk.NewInt64Coin("busd", 1000)), + startingGasDenom, sdkmath.NewInt(100), true, sdkmath.NewInt(100), @@ -430,41 +430,41 @@ func (suite *evmBankKeeperTestSuite) TestBurnCoins() { { "errors if have dup coins", sdk.Coins{ - sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_000), - sdk.NewInt64Coin(chaincfg.BaseDenom, 2_000_000_000_000), + sdk.NewInt64Coin(chaincfg.EvmDenom, 12_000_000_000_000), + sdk.NewInt64Coin(chaincfg.EvmDenom, 2_000_000_000_000), }, - startingAuxiliaryDenom, + startingGasDenom, sdk.ZeroInt(), true, sdk.ZeroInt(), }, { "errors if burn amount is negative", - sdk.Coins{sdk.Coin{Denom: chaincfg.BaseDenom, Amount: sdkmath.NewInt(-100)}}, - startingAuxiliaryDenom, + sdk.Coins{sdk.Coin{Denom: chaincfg.EvmDenom, Amount: sdkmath.NewInt(-100)}}, + startingGasDenom, sdkmath.NewInt(50), true, sdkmath.NewInt(50), }, { - "errors if not enough base denom to cover burn", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100_999_000_000_000)), + "errors if not enough evm denom to cover burn", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100_999_000_000_000)), sdkmath.NewInt(0), sdkmath.NewInt(99_000_000_000), true, sdkmath.NewInt(99_000_000_000), }, { - "errors if not enough auxiliary denom to cover burn", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 200_000_000_000_000)), + "errors if not enough gas denom to cover burn", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 200_000_000_000_000)), sdkmath.NewInt(100), sdk.ZeroInt(), true, sdk.ZeroInt(), }, { - "converts 1 auxiliary denom to base denom if not enough base denom to cover", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_021_000_000_002)), + "converts 1 gas denom to evm denom if not enough evm denom to cover", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 12_021_000_000_002)), sdkmath.NewInt(87), sdkmath.NewInt(980_000_000_000), false, @@ -476,8 +476,8 @@ func (suite *evmBankKeeperTestSuite) TestBurnCoins() { suite.Run(tt.name, func() { suite.SetupTest() startingCoins := sdk.NewCoins( - sdk.NewCoin(chaincfg.AuxiliaryDenom, startingAuxiliaryDenom), - sdk.NewCoin(chaincfg.BaseDenom, tt.baseDenomStart), + sdk.NewCoin(chaincfg.GasDenom, startingGasDenom), + sdk.NewCoin(chaincfg.EvmDenom, tt.evmDenomStart), ) suite.FundModuleAccountWithZgChain(evmtypes.ModuleName, startingCoins) @@ -489,53 +489,53 @@ func (suite *evmBankKeeperTestSuite) TestBurnCoins() { suite.Require().NoError(err) } - // check auxiliary denom - AuxiliaryDenomActual := suite.BankKeeper.GetBalance(suite.Ctx, suite.EvmModuleAddr, chaincfg.AuxiliaryDenom) - suite.Require().Equal(tt.expAuxiliaryDenom, AuxiliaryDenomActual.Amount) + // check gas denom + GasDenomActual := suite.BankKeeper.GetBalance(suite.Ctx, suite.EvmModuleAddr, chaincfg.GasDenom) + suite.Require().Equal(tt.expGasDenom, GasDenomActual.Amount) - // check base denom - baseDenomActual := suite.Keeper.GetBalance(suite.Ctx, suite.EvmModuleAddr) - suite.Require().Equal(tt.expBaseDenom, baseDenomActual) + // check evm denom + evmDenomActual := suite.Keeper.GetBalance(suite.Ctx, suite.EvmModuleAddr) + suite.Require().Equal(tt.expEvmDenom, evmDenomActual) }) } } func (suite *evmBankKeeperTestSuite) TestMintCoins() { tests := []struct { - name string - mintCoins sdk.Coins - AuxiliaryDenomCnt sdkmath.Int - baseDenomCnt sdkmath.Int - hasErr bool - baseDenomStart sdkmath.Int + name string + mintCoins sdk.Coins + GasDenomCnt sdkmath.Int + evmDenomCnt sdkmath.Int + hasErr bool + evmDenomStart sdkmath.Int }{ { - "mint more than 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_021_000_000_002)), + "mint more than 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 12_021_000_000_002)), sdkmath.NewInt(12), sdkmath.NewInt(21_000_000_002), false, sdk.ZeroInt(), }, { - "mint less than 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 901_000_000_001)), + "mint less than 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 901_000_000_001)), sdk.ZeroInt(), sdkmath.NewInt(901_000_000_001), false, sdk.ZeroInt(), }, { - "mint an exact amount of auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 123_000_000_000_000_000)), + "mint an exact amount of gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 123_000_000_000_000_000)), sdkmath.NewInt(123_000), sdk.ZeroInt(), false, sdk.ZeroInt(), }, { - "mint no base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 0)), + "mint no evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 0)), sdk.ZeroInt(), sdk.ZeroInt(), false, @@ -543,7 +543,7 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { }, { "errors if minting other coins", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin("busd", 1000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 500), sdk.NewInt64Coin("busd", 1000)), sdk.ZeroInt(), sdkmath.NewInt(100), true, @@ -552,8 +552,8 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { { "errors if have dup coins", sdk.Coins{ - sdk.NewInt64Coin(chaincfg.BaseDenom, 12_000_000_000_000), - sdk.NewInt64Coin(chaincfg.BaseDenom, 2_000_000_000_000), + sdk.NewInt64Coin(chaincfg.EvmDenom, 12_000_000_000_000), + sdk.NewInt64Coin(chaincfg.EvmDenom, 2_000_000_000_000), }, sdk.ZeroInt(), sdk.ZeroInt(), @@ -562,23 +562,23 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { }, { "errors if mint amount is negative", - sdk.Coins{sdk.Coin{Denom: chaincfg.BaseDenom, Amount: sdkmath.NewInt(-100)}}, + sdk.Coins{sdk.Coin{Denom: chaincfg.EvmDenom, Amount: sdkmath.NewInt(-100)}}, sdk.ZeroInt(), sdkmath.NewInt(50), true, sdkmath.NewInt(50), }, { - "adds to existing base denom balance", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 12_021_000_000_002)), + "adds to existing evm denom balance", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 12_021_000_000_002)), sdkmath.NewInt(12), sdkmath.NewInt(21_000_000_102), false, sdkmath.NewInt(100), }, { - "convert base denom balance to auxiliary denom if it exceeds 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 10_999_000_000_000)), + "convert evm denom balance to gas denom if it exceeds 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 10_999_000_000_000)), sdkmath.NewInt(12), sdkmath.NewInt(1_200_000_001), false, @@ -589,8 +589,8 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { for _, tt := range tests { suite.Run(tt.name, func() { suite.SetupTest() - suite.FundModuleAccountWithZgChain(types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10))) - suite.FundModuleAccountWithZgChain(evmtypes.ModuleName, sdk.NewCoins(sdk.NewCoin(chaincfg.BaseDenom, tt.baseDenomStart))) + suite.FundModuleAccountWithZgChain(types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10))) + suite.FundModuleAccountWithZgChain(evmtypes.ModuleName, sdk.NewCoins(sdk.NewCoin(chaincfg.EvmDenom, tt.evmDenomStart))) err := suite.EvmBankKeeper.MintCoins(suite.Ctx, evmtypes.ModuleName, tt.mintCoins) if tt.hasErr { @@ -600,13 +600,13 @@ func (suite *evmBankKeeperTestSuite) TestMintCoins() { suite.Require().NoError(err) } - // check auxiliary denom - AuxiliaryDenomActual := suite.BankKeeper.GetBalance(suite.Ctx, suite.EvmModuleAddr, chaincfg.AuxiliaryDenom) - suite.Require().Equal(tt.AuxiliaryDenomCnt, AuxiliaryDenomActual.Amount) + // check gas denom + GasDenomActual := suite.BankKeeper.GetBalance(suite.Ctx, suite.EvmModuleAddr, chaincfg.GasDenom) + suite.Require().Equal(tt.GasDenomCnt, GasDenomActual.Amount) - // check base denom - baseDenomActual := suite.Keeper.GetBalance(suite.Ctx, suite.EvmModuleAddr) - suite.Require().Equal(tt.baseDenomCnt, baseDenomActual) + // check evm denom + evmDenomActual := suite.Keeper.GetBalance(suite.Ctx, suite.EvmModuleAddr) + suite.Require().Equal(tt.evmDenomCnt, evmDenomActual) }) } } @@ -619,22 +619,22 @@ func (suite *evmBankKeeperTestSuite) TestValidateEvmCoins() { }{ { "valid coins", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 500)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 500)), false, }, { "dup coins", - sdk.Coins{sdk.NewInt64Coin(chaincfg.BaseDenom, 500), sdk.NewInt64Coin(chaincfg.BaseDenom, 500)}, + sdk.Coins{sdk.NewInt64Coin(chaincfg.EvmDenom, 500), sdk.NewInt64Coin(chaincfg.EvmDenom, 500)}, true, }, { "not evm coins", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 500)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 500)), true, }, { "negative coins", - sdk.Coins{sdk.Coin{Denom: chaincfg.BaseDenom, Amount: sdkmath.NewInt(-500)}}, + sdk.Coins{sdk.Coin{Denom: chaincfg.EvmDenom, Amount: sdkmath.NewInt(-500)}}, true, }, } @@ -650,8 +650,8 @@ func (suite *evmBankKeeperTestSuite) TestValidateEvmCoins() { } } -func (suite *evmBankKeeperTestSuite) TestConvertOneAuxiliaryDenomToBaseDenomIfNeeded() { - baseDenomNeeded := sdkmath.NewInt(200) +func (suite *evmBankKeeperTestSuite) TestConvertOneGasDenomToEvmDenomIfNeeded() { + evmDenomNeeded := sdkmath.NewInt(200) tests := []struct { name string startingCoins sdk.Coins @@ -659,21 +659,21 @@ func (suite *evmBankKeeperTestSuite) TestConvertOneAuxiliaryDenomToBaseDenomIfNe success bool }{ { - "not enough auxiliary denom for conversion", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100)), + "not enough gas denom for conversion", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100)), false, }, { - "converts 1 auxiliary denom to base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 100)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 9), sdk.NewInt64Coin(chaincfg.BaseDenom, 1_000_000_000_100)), + "converts 1 gas denom to evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10), sdk.NewInt64Coin(chaincfg.EvmDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 9), sdk.NewInt64Coin(chaincfg.EvmDenom, 1_000_000_000_100)), true, }, { "conversion not needed", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 200)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 200)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10), sdk.NewInt64Coin(chaincfg.EvmDenom, 200)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10), sdk.NewInt64Coin(chaincfg.EvmDenom, 200)), true, }, } @@ -682,11 +682,11 @@ func (suite *evmBankKeeperTestSuite) TestConvertOneAuxiliaryDenomToBaseDenomIfNe suite.SetupTest() suite.FundAccountWithZgChain(suite.Addrs[0], tt.startingCoins) - err := suite.EvmBankKeeper.ConvertOneAuxiliaryDenomToBaseDenomIfNeeded(suite.Ctx, suite.Addrs[0], baseDenomNeeded) - moduleZgChain := suite.BankKeeper.GetBalance(suite.Ctx, suite.AccountKeeper.GetModuleAddress(types.ModuleName), chaincfg.AuxiliaryDenom) + err := suite.EvmBankKeeper.ConvertOneGasDenomToEvmDenomIfNeeded(suite.Ctx, suite.Addrs[0], evmDenomNeeded) + moduleZgChain := suite.BankKeeper.GetBalance(suite.Ctx, suite.AccountKeeper.GetModuleAddress(types.ModuleName), chaincfg.GasDenom) if tt.success { suite.Require().NoError(err) - if tt.startingCoins.AmountOf(chaincfg.BaseDenom).LT(baseDenomNeeded) { + if tt.startingCoins.AmountOf(chaincfg.EvmDenom).LT(evmDenomNeeded) { suite.Require().Equal(sdk.OneInt(), moduleZgChain.Amount) } } else { @@ -694,54 +694,54 @@ func (suite *evmBankKeeperTestSuite) TestConvertOneAuxiliaryDenomToBaseDenomIfNe suite.Require().Equal(sdk.ZeroInt(), moduleZgChain.Amount) } - baseDenomCnt := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.BaseDenom), baseDenomCnt) - AuxiliaryDenomCoin := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) - suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.AuxiliaryDenom), AuxiliaryDenomCoin.Amount) + evmDenomCnt := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.EvmDenom), evmDenomCnt) + GasDenomCoin := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.GasDenom) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.GasDenom), GasDenomCoin.Amount) }) } } -func (suite *evmBankKeeperTestSuite) TestConvertBaseDenomToAuxiliaryDenom() { +func (suite *evmBankKeeperTestSuite) TestConvertEvmDenomToGasDenom() { tests := []struct { name string startingCoins sdk.Coins expectedCoins sdk.Coins }{ { - "not enough auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 100), sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 0)), + "not enough gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 100), sdk.NewInt64Coin(chaincfg.GasDenom, 0)), }, { - "converts base denom for 1 auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 1_000_000_000_003)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 11), sdk.NewInt64Coin(chaincfg.BaseDenom, 3)), + "converts evm denom for 1 gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10), sdk.NewInt64Coin(chaincfg.EvmDenom, 1_000_000_000_003)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 11), sdk.NewInt64Coin(chaincfg.EvmDenom, 3)), }, { - "converts more than 1 auxiliary denom of base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10), sdk.NewInt64Coin(chaincfg.BaseDenom, 8_000_000_000_123)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 18), sdk.NewInt64Coin(chaincfg.BaseDenom, 123)), + "converts more than 1 gas denom of evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10), sdk.NewInt64Coin(chaincfg.EvmDenom, 8_000_000_000_123)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 18), sdk.NewInt64Coin(chaincfg.EvmDenom, 123)), }, } for _, tt := range tests { suite.Run(tt.name, func() { suite.SetupTest() - err := suite.App.FundModuleAccount(suite.Ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 10))) + err := suite.App.FundModuleAccount(suite.Ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 10))) suite.Require().NoError(err) suite.FundAccountWithZgChain(suite.Addrs[0], tt.startingCoins) - err = suite.EvmBankKeeper.ConvertBaseDenomToAuxiliaryDenom(suite.Ctx, suite.Addrs[0]) + err = suite.EvmBankKeeper.ConvertEvmDenomToGasDenom(suite.Ctx, suite.Addrs[0]) suite.Require().NoError(err) - baseDenomCnt := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.BaseDenom), baseDenomCnt) - AuxiliaryDenomCoin := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.AuxiliaryDenom) - suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.AuxiliaryDenom), AuxiliaryDenomCoin.Amount) + evmDenomCnt := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.EvmDenom), evmDenomCnt) + GasDenomCoin := suite.BankKeeper.GetBalance(suite.Ctx, suite.Addrs[0], chaincfg.GasDenom) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.GasDenom), GasDenomCoin.Amount) }) } } -func (suite *evmBankKeeperTestSuite) TestSplitBaseDenomCoins() { +func (suite *evmBankKeeperTestSuite) TestSplitEvmDenomCoins() { tests := []struct { name string coins sdk.Coins @@ -750,7 +750,7 @@ func (suite *evmBankKeeperTestSuite) TestSplitBaseDenomCoins() { }{ { "invalid coins", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 500)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 500)), nil, true, }, @@ -761,33 +761,33 @@ func (suite *evmBankKeeperTestSuite) TestSplitBaseDenomCoins() { false, }, { - "auxiliary denom & base denom coins", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 8_000_000_000_123)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 8), sdk.NewInt64Coin(chaincfg.BaseDenom, 123)), + "gas denom & evm denom coins", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 8_000_000_000_123)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 8), sdk.NewInt64Coin(chaincfg.EvmDenom, 123)), false, }, { - "only base denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 10_123)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 10_123)), + "only evm denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 10_123)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 10_123)), false, }, { - "only auxiliary denom", - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.BaseDenom, 5_000_000_000_000)), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 5)), + "only gas denom", + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.EvmDenom, 5_000_000_000_000)), + sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 5)), false, }, } for _, tt := range tests { suite.Run(tt.name, func() { - AuxiliaryDenomCoin, baseDenomCnt, err := keeper.SplitBaseDenomCoins(tt.coins) + GasDenomCoin, evmDenomCnt, err := keeper.SplitEvmDenomCoins(tt.coins) if tt.shouldErr { suite.Require().Error(err) } else { suite.Require().NoError(err) - suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.AuxiliaryDenom), AuxiliaryDenomCoin.Amount) - suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.BaseDenom), baseDenomCnt) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.GasDenom), GasDenomCoin.Amount) + suite.Require().Equal(tt.expectedCoins.AmountOf(chaincfg.EvmDenom), evmDenomCnt) } }) } diff --git a/x/evmutil/keeper/invariants.go b/x/evmutil/keeper/invariants.go index db406093..afbfbbf5 100644 --- a/x/evmutil/keeper/invariants.go +++ b/x/evmutil/keeper/invariants.go @@ -51,7 +51,7 @@ func FullyBackedInvariant(bankK types.BankKeeper, k Keeper) sdk.Invariant { }) bankAddr := authtypes.NewModuleAddress(types.ModuleName) - bankBalance := bankK.GetBalance(ctx, bankAddr, chaincfg.AuxiliaryDenom).Amount.Mul(ConversionMultiplier) + bankBalance := bankK.GetBalance(ctx, bankAddr, chaincfg.GasDenom).Amount.Mul(ConversionMultiplier) broken = totalMinorBalances.GT(bankBalance) diff --git a/x/evmutil/keeper/invariants_test.go b/x/evmutil/keeper/invariants_test.go index 946ce177..79fc4474 100644 --- a/x/evmutil/keeper/invariants_test.go +++ b/x/evmutil/keeper/invariants_test.go @@ -50,7 +50,7 @@ func (suite *invariantTestSuite) SetupValidState() { suite.FundModuleAccountWithZgChain( types.ModuleName, sdk.NewCoins( - sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2)), // ( sum of all minor balances ) / conversion multiplier + sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2)), // ( sum of all minor balances ) / conversion multiplier ), ) @@ -160,8 +160,8 @@ func (suite *invariantTestSuite) TestSmallBalances() { // increase minor balance at least above conversion multiplier suite.Keeper.AddBalance(suite.Ctx, suite.Addrs[0], keeper.ConversionMultiplier) - // add same number of auxiliary denom to avoid breaking other invariants - amt := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1)) + // add same number of gas denom to avoid breaking other invariants + amt := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 1)) suite.Require().NoError( suite.App.FundModuleAccount(suite.Ctx, types.ModuleName, amt), ) diff --git a/x/evmutil/keeper/keeper.go b/x/evmutil/keeper/keeper.go index 7cb8ea72..4c671071 100644 --- a/x/evmutil/keeper/keeper.go +++ b/x/evmutil/keeper/keeper.go @@ -115,7 +115,7 @@ func (k Keeper) SetAccount(ctx sdk.Context, account types.Account) error { return nil } -// GetBalance returns the total balance of base denom for a given account by address. +// GetBalance returns the total balance of evm denom for a given account by address. func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int { account := k.GetAccount(ctx, addr) if account == nil { @@ -124,7 +124,7 @@ func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int { return account.Balance } -// SetBalance sets the total balance of base denom for a given account by address. +// SetBalance sets the total balance of evm denom for a given account by address. func (k Keeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, bal sdkmath.Int) error { account := k.GetAccount(ctx, addr) if account == nil { @@ -140,10 +140,10 @@ func (k Keeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, bal sdkmath.Int return k.SetAccount(ctx, *account) } -// SendBalance transfers the base denom balance from sender addr to recipient addr. +// SendBalance transfers the evm denom balance from sender addr to recipient addr. func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, amt sdkmath.Int) error { if amt.IsNegative() { - return fmt.Errorf("cannot send a negative amount of base denom: %d", amt) + return fmt.Errorf("cannot send a negative amount of evm denom: %d", amt) } if amt.IsZero() { @@ -162,13 +162,13 @@ func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipien return k.SetBalance(ctx, recipientAddr, receiverBal) } -// AddBalance increments the base denom balance of an address. +// AddBalance increments the evm denom balance of an address. func (k Keeper) AddBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdkmath.Int) error { bal := k.GetBalance(ctx, addr) return k.SetBalance(ctx, addr, amt.Add(bal)) } -// RemoveBalance decrements the base denom balance of an address. +// RemoveBalance decrements the evm denom balance of an address. func (k Keeper) RemoveBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdkmath.Int) error { if amt.IsNegative() { return fmt.Errorf("cannot remove a negative amount from balance: %d", amt) diff --git a/x/evmutil/testutil/suite.go b/x/evmutil/testutil/suite.go index b5d1af73..2c9f8ae2 100644 --- a/x/evmutil/testutil/suite.go +++ b/x/evmutil/testutil/suite.go @@ -82,14 +82,14 @@ func (suite *Suite) SetupTest() { suite.Addrs = addrs evmGenesis := evmtypes.DefaultGenesisState() - evmGenesis.Params.EvmDenom = chaincfg.BaseDenom + evmGenesis.Params.EvmDenom = chaincfg.EvmDenom feemarketGenesis := feemarkettypes.DefaultGenesisState() feemarketGenesis.Params.EnableHeight = 1 feemarketGenesis.Params.NoBaseFee = false cdc := suite.App.AppCodec() - coins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1000_000_000_000_000_000)) + coins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 1000_000_000_000_000_000)) authGS := app.NewFundedGenStateWithSameCoins(cdc, coins, []sdk.AccAddress{ sdk.AccAddress(suite.Key1.PubKey().Address()), sdk.AccAddress(suite.Key2.PubKey().Address()), @@ -186,28 +186,28 @@ func (suite *Suite) ModuleBalance(denom string) sdk.Int { } func (suite *Suite) FundAccountWithZgChain(addr sdk.AccAddress, coins sdk.Coins) { - AuxiliaryDenomAmt := coins.AmountOf(chaincfg.AuxiliaryDenom) - if AuxiliaryDenomAmt.IsPositive() { - err := suite.App.FundAccount(suite.Ctx, addr, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, AuxiliaryDenomAmt))) + GasDenomAmt := coins.AmountOf(chaincfg.GasDenom) + if GasDenomAmt.IsPositive() { + err := suite.App.FundAccount(suite.Ctx, addr, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, GasDenomAmt))) suite.Require().NoError(err) } - baseDenomAmt := coins.AmountOf(chaincfg.BaseDenom) - if baseDenomAmt.IsPositive() { - err := suite.Keeper.SetBalance(suite.Ctx, addr, baseDenomAmt) + evmDenomAmt := coins.AmountOf(chaincfg.EvmDenom) + if evmDenomAmt.IsPositive() { + err := suite.Keeper.SetBalance(suite.Ctx, addr, evmDenomAmt) suite.Require().NoError(err) } } func (suite *Suite) FundModuleAccountWithZgChain(moduleName string, coins sdk.Coins) { - AuxiliaryDenomAmt := coins.AmountOf(chaincfg.AuxiliaryDenom) - if AuxiliaryDenomAmt.IsPositive() { - err := suite.App.FundModuleAccount(suite.Ctx, moduleName, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, AuxiliaryDenomAmt))) + GasDenomAmt := coins.AmountOf(chaincfg.GasDenom) + if GasDenomAmt.IsPositive() { + err := suite.App.FundModuleAccount(suite.Ctx, moduleName, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, GasDenomAmt))) suite.Require().NoError(err) } - baseDenomAmt := coins.AmountOf(chaincfg.BaseDenom) - if baseDenomAmt.IsPositive() { + evmDenomAmt := coins.AmountOf(chaincfg.EvmDenom) + if evmDenomAmt.IsPositive() { addr := suite.AccountKeeper.GetModuleAddress(moduleName) - err := suite.Keeper.SetBalance(suite.Ctx, addr, baseDenomAmt) + err := suite.Keeper.SetBalance(suite.Ctx, addr, evmDenomAmt) suite.Require().NoError(err) } } @@ -218,7 +218,7 @@ func (suite *Suite) DeployERC20() types.InternalEVMAddress { suite.App.FundModuleAccount( suite.Ctx, types.ModuleName, - sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(0))), + sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(0))), ) contractAddr, err := suite.Keeper.DeployTestMintableERC20Contract(suite.Ctx, "USDC", "USDC", uint8(18)) @@ -319,7 +319,7 @@ func (suite *Suite) SendTx( // Mint the max gas to the FeeCollector to ensure balance in case of refund suite.MintFeeCollector(sdk.NewCoins( sdk.NewCoin( - chaincfg.AuxiliaryDenom, + chaincfg.GasDenom, sdkmath.NewInt(baseFee.Int64()*int64(gasRes.Gas*2)), ))) diff --git a/x/evmutil/types/conversion_pairs_test.go b/x/evmutil/types/conversion_pairs_test.go index f1f7c79b..0a60e889 100644 --- a/x/evmutil/types/conversion_pairs_test.go +++ b/x/evmutil/types/conversion_pairs_test.go @@ -143,7 +143,7 @@ func TestConversionPairs_Validate(t *testing.T) { ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), - chaincfg.AuxiliaryDenom, + chaincfg.GasDenom, ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), @@ -163,7 +163,7 @@ func TestConversionPairs_Validate(t *testing.T) { ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), - chaincfg.AuxiliaryDenom, + chaincfg.GasDenom, ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), @@ -184,16 +184,16 @@ func TestConversionPairs_Validate(t *testing.T) { ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), - chaincfg.AuxiliaryDenom, + chaincfg.GasDenom, ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), - chaincfg.AuxiliaryDenom, + chaincfg.GasDenom, ), ), errArgs{ expectPass: false, - contains: "found duplicate enabled conversion pair denom " + chaincfg.AuxiliaryDenom, + contains: "found duplicate enabled conversion pair denom " + chaincfg.GasDenom, }, }, { @@ -209,7 +209,7 @@ func TestConversionPairs_Validate(t *testing.T) { ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), - chaincfg.AuxiliaryDenom, + chaincfg.GasDenom, ), ), errArgs{ diff --git a/x/evmutil/types/params_test.go b/x/evmutil/types/params_test.go index e056afdd..9daa04e1 100644 --- a/x/evmutil/types/params_test.go +++ b/x/evmutil/types/params_test.go @@ -107,11 +107,11 @@ func (suite *ParamsTestSuite) TestParams_Validate() { invalidConversionPairs := types.NewConversionPairs( types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), - chaincfg.AuxiliaryDenom, + chaincfg.GasDenom, ), types.NewConversionPair( testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), - chaincfg.AuxiliaryDenom, // duplicate denom! + chaincfg.GasDenom, // duplicate denom! ), ) validAllowedCosmosDenoms := types.NewAllowedCosmosCoinERC20Tokens( diff --git a/x/pricefeed/types/key_test.go b/x/pricefeed/types/key_test.go index b7cab46e..ef537900 100644 --- a/x/pricefeed/types/key_test.go +++ b/x/pricefeed/types/key_test.go @@ -10,7 +10,7 @@ import ( func TestRawPriceKey_Iteration(t *testing.T) { // An iterator key should only match price keys with the same market - iteratorKey := RawPriceIteratorKey(chaincfg.AuxiliaryDenom + ":usd") + iteratorKey := RawPriceIteratorKey(chaincfg.GasDenom + ":usd") addr := sdk.AccAddress("test addr") @@ -21,12 +21,12 @@ func TestRawPriceKey_Iteration(t *testing.T) { }{ { name: "equal marketID is included in iteration", - priceKey: RawPriceKey(chaincfg.AuxiliaryDenom+":usd", addr), + priceKey: RawPriceKey(chaincfg.GasDenom+":usd", addr), expectErr: false, }, { name: "prefix overlapping marketID excluded from iteration", - priceKey: RawPriceKey(chaincfg.AuxiliaryDenom+":usd:30", addr), + priceKey: RawPriceKey(chaincfg.GasDenom+":usd:30", addr), expectErr: true, }, } diff --git a/x/validator-vesting/querier.go b/x/validator-vesting/querier.go index 77d21abf..4c77f95b 100644 --- a/x/validator-vesting/querier.go +++ b/x/validator-vesting/querier.go @@ -15,7 +15,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" ) -const SafuFund int64 = 10000000 // 10 million (auxiliary denom) +const SafuFund int64 = 10000000 // 10 million (gas denom) // NewQuerier is the module level router for state queries func NewQuerier(bk types.BankKeeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { @@ -42,7 +42,7 @@ func NewQuerier(bk types.BankKeeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Qu } func queryGetTotalSupply(ctx sdk.Context, req abci.RequestQuery, bk types.BankKeeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { - totalSupply := bk.GetSupply(ctx, chaincfg.AuxiliaryDenom).Amount + totalSupply := bk.GetSupply(ctx, chaincfg.GasDenom).Amount supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt64() bz, err := legacyQuerierCdc.MarshalJSON(supplyInt) if err != nil { @@ -52,7 +52,7 @@ func queryGetTotalSupply(ctx sdk.Context, req abci.RequestQuery, bk types.BankKe } func queryGetCirculatingSupply(ctx sdk.Context, req abci.RequestQuery, bk types.BankKeeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { - totalSupply := bk.GetSupply(ctx, chaincfg.AuxiliaryDenom).Amount + totalSupply := bk.GetSupply(ctx, chaincfg.GasDenom).Amount supplyInt := getCirculatingSupply(ctx.BlockTime(), totalSupply) bz, err := legacyQuerierCdc.MarshalJSON(supplyInt) if err != nil { From 578897f69f0a60b50ab6477a187c5b62b00bc020 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Fri, 10 May 2024 09:58:33 +0800 Subject: [PATCH 16/26] remove the EthSecp256k1 from cosmos --- cmd/0gchaind/root.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/0gchaind/root.go b/cmd/0gchaind/root.go index fab91152..d4e3f5a0 100644 --- a/cmd/0gchaind/root.go +++ b/cmd/0gchaind/root.go @@ -31,8 +31,8 @@ import ( func customKeyringOptions() keyring.Option { return func(options *keyring.Options) { - options.SupportedAlgos = append(hd.SupportedAlgorithms, vrf.VrfAlgo) - options.SupportedAlgosLedger = append(hd.SupportedAlgorithmsLedger, vrf.VrfAlgo) + options.SupportedAlgos = append(options.SupportedAlgos, vrf.VrfAlgo, hd.EthSecp256k1) + options.SupportedAlgosLedger = append(options.SupportedAlgosLedger, vrf.VrfAlgo, hd.EthSecp256k1) } } From 8bdba3d46d4cc0f345fd8b31bdaa9d09bf27d8d4 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:47:44 +0800 Subject: [PATCH 17/26] merge testnet/v0.1.x --- client/keys.go | 7 +++++++ go.mod | 12 +++++++----- go.sum | 33 ++++++++++++++++++++------------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/client/keys.go b/client/keys.go index bbcc318d..4bbecba8 100644 --- a/client/keys.go +++ b/client/keys.go @@ -52,6 +52,13 @@ The pass backend requires GnuPG: https://gnupg.org/ addCmd := keys.AddKeyCommand() addCmd.Flags().Bool(ethFlag, false, "use default evm coin-type (60) and key signing algorithm (\"eth_secp256k1\")") + algoFlag := addCmd.Flag(flags.FlagKeyAlgorithm) + algoFlag.DefValue = string(hd.EthSecp256k1Type) + err := algoFlag.Value.Set(string(hd.EthSecp256k1Type)) + if err != nil { + panic(err) + } + addCmd.RunE = runAddCmd cmd.AddCommand( diff --git a/go.mod b/go.mod index a5beb433..fc270fec 100644 --- a/go.mod +++ b/go.mod @@ -42,6 +42,7 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.2 // indirect cloud.google.com/go/storage v1.30.1 // indirect + cosmossdk.io/log v1.3.1 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -104,7 +105,7 @@ require ( github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v1.12.1 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/google/uuid v1.3.0 // indirect @@ -140,7 +141,7 @@ require ( github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect @@ -166,7 +167,7 @@ require ( github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.29.0 // indirect + github.com/rs/zerolog v1.32.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/shopspring/decimal v1.4.0 // indirect @@ -190,7 +191,7 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect @@ -212,7 +213,8 @@ replace ( // Use rocksdb 7.9.2 github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1 // Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support - github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.46.11-kava.3 + // github.com/cosmos/cosmos-sdk => github.com/0glabs/cosmos-sdk v0.46.11-kava.3 + github.com/cosmos/cosmos-sdk => github.com/0glabs/cosmos-sdk v0.46.11-0glabs.4 // See https://github.com/cosmos/cosmos-sdk/pull/13093 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 // Use go-ethereum fork with precompiles diff --git a/go.sum b/go.sum index 1c53847a..a90135cb 100644 --- a/go.sum +++ b/go.sum @@ -193,6 +193,8 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4 h1:/jnzJ9zFsL7qkV8LCQ1JH3dYHh2EsKZ3k8Mr6AqqiOA= cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -202,6 +204,8 @@ git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFN git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= github.com/0glabs/ethermint v0.21.0-0g.v2.0.1 h1:loFnZAEZ8tboo3JO3+AE+1gJcUm6hkYuwcn+ZHBhjxE= github.com/0glabs/ethermint v0.21.0-0g.v2.0.1/go.mod h1:peUmQT71k9BOBgoWoIRWRrM/O01mffVjIH0RLnoaFuI= +github.com/0glabs/cosmos-sdk v0.46.11-0glabs.4 h1:NYKYgJIilexHR8VE1EAl7Tv2wMQGPwdzKiLV2DnIAwg= +github.com/0glabs/cosmos-sdk v0.46.11-0glabs.4/go.mod h1:jwgWoeAWxqMF5pZUZ4N+G4rD3q6oOLulq3/dGCFLEX4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= @@ -376,7 +380,7 @@ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc 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/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= @@ -623,8 +627,9 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -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-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -817,8 +822,6 @@ github.com/kava-labs/cometbft v0.34.27-kava.0 h1:FUEGRkF3xtrJH+h9A5G4eA2skf7QaNo github.com/kava-labs/cometbft v0.34.27-kava.0/go.mod h1:BcCbhKv7ieM0KEddnYXvQZR+pZykTKReJJYf7YC7qhw= github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1 h1:EZnZAkZ+dqK+1OM4AK+e6wYH8a5xuyg4yFTR4Ez3AXk= github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1/go.mod h1:mI/4J4IxRzPrXvMiwefrt0fucGwaQ5Hm9IKS7HnoJeI= -github.com/kava-labs/cosmos-sdk v0.46.11-kava.3 h1:TOhyyW/xHso/9uIOgYdsrOWDIhXi6foORWZxVRe/wS0= -github.com/kava-labs/cosmos-sdk v0.46.11-kava.3/go.mod h1:bSUUbmVwWkv1ZNVTWrQHa/i+73xIUvYYPsCvl5doiCs= github.com/kava-labs/tm-db v0.6.7-kava.4 h1:M2RibOKmbi+k2OhAFry8z9+RJF0CYuDETB7/PrSdoro= github.com/kava-labs/tm-db v0.6.7-kava.4/go.mod h1:70tpLhNfwCP64nAlq+bU+rOiVfWr3Nnju1D1nhGDGKs= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -881,7 +884,6 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -891,8 +893,9 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y 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-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1076,9 +1079,9 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w= -github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1513,7 +1516,6 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/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-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1534,8 +1536,10 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 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= @@ -1916,6 +1920,9 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C 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= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 217d4cb048bd36086b16d917e04d6ffa1198dc10 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:50:45 +0800 Subject: [PATCH 18/26] tidy --- go.mod | 3 +-- go.sum | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index fc270fec..b15e5c7a 100644 --- a/go.mod +++ b/go.mod @@ -22,6 +22,7 @@ require ( github.com/linxGnu/grocksdb v1.8.0 github.com/pelletier/go-toml/v2 v2.0.6 github.com/prometheus/client_golang v1.14.0 + github.com/shopspring/decimal v1.4.0 github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.6.1 github.com/spf13/viper v1.15.0 @@ -137,7 +138,6 @@ require ( github.com/klauspost/compress v1.15.15 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -170,7 +170,6 @@ require ( github.com/rs/zerolog v1.32.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/shopspring/decimal v1.4.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect diff --git a/go.sum b/go.sum index a90135cb..96dfdfd0 100644 --- a/go.sum +++ b/go.sum @@ -202,10 +202,10 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmG filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= -github.com/0glabs/ethermint v0.21.0-0g.v2.0.1 h1:loFnZAEZ8tboo3JO3+AE+1gJcUm6hkYuwcn+ZHBhjxE= -github.com/0glabs/ethermint v0.21.0-0g.v2.0.1/go.mod h1:peUmQT71k9BOBgoWoIRWRrM/O01mffVjIH0RLnoaFuI= github.com/0glabs/cosmos-sdk v0.46.11-0glabs.4 h1:NYKYgJIilexHR8VE1EAl7Tv2wMQGPwdzKiLV2DnIAwg= github.com/0glabs/cosmos-sdk v0.46.11-0glabs.4/go.mod h1:jwgWoeAWxqMF5pZUZ4N+G4rD3q6oOLulq3/dGCFLEX4= +github.com/0glabs/ethermint v0.21.0-0g.v2.0.1 h1:loFnZAEZ8tboo3JO3+AE+1gJcUm6hkYuwcn+ZHBhjxE= +github.com/0glabs/ethermint v0.21.0-0g.v2.0.1/go.mod h1:peUmQT71k9BOBgoWoIRWRrM/O01mffVjIH0RLnoaFuI= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= @@ -868,8 +868,6 @@ github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0U github.com/linxGnu/grocksdb v1.8.0 h1:H4L/LhP7GOMf1j17oQAElHgVlbEje2h14A8Tz9cM2BE= github.com/linxGnu/grocksdb v1.8.0/go.mod h1:09CeBborffXhXdNpEcOeZrLKEnRtrZFEpFdPNI9Zjjg= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= -github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252 h1:D2VNityLQ1srKF+MSllSGQ4NwMci20llMkvVAmU2aCk= -github.com/lukehoban/go-outline v0.0.0-20161011150102-e78556874252/go.mod h1:O9bIJ6BRFBmP3AKTW8cqESVbauSmifSrRB/n9zq6x9Q= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -1920,8 +1918,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C 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= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 9216f3dfc9b3a2e2d94d1932f9fd9efa8092fbe2 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:35:36 +0800 Subject: [PATCH 19/26] fix: localtestnet.sh --- localtestnet.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/localtestnet.sh b/localtestnet.sh index 33846044..189ec3b2 100755 --- a/localtestnet.sh +++ b/localtestnet.sh @@ -24,7 +24,9 @@ DATA=~/.0gchain # remove any old state and config rm -rf $DATA -BINARY=./.build/0gchaind +OS_FAMILY=$(uname -s) +NATIVE_GO_OS=$(echo $OS_FAMILY | tr '[:upper:]' '[:lower:]') +BINARY=./out/$NATIVE_GO_OS/0gchaind # Create new data directory, overwriting any that alread existed chainID="zgchain_8888-1" From 4762d5acda9eede7f03d901b1336ad04da1be62c Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Fri, 7 Jun 2024 15:47:56 +0800 Subject: [PATCH 20/26] refactor: delegator --- proto/zgc/dasigners/v1/genesis.proto | 7 +- x/dasigners/v1/keeper/abci.go | 11 +-- x/dasigners/v1/keeper/keeper.go | 43 +++++++++++ x/dasigners/v1/keeper/msg_server.go | 13 ++-- x/dasigners/v1/types/errors.go | 1 + x/dasigners/v1/types/genesis.go | 9 ++- x/dasigners/v1/types/genesis.pb.go | 107 ++++++++++++++++++--------- x/dasigners/v1/types/interfaces.go | 1 + 8 files changed, 138 insertions(+), 54 deletions(-) diff --git a/proto/zgc/dasigners/v1/genesis.proto b/proto/zgc/dasigners/v1/genesis.proto index 909c9464..9fead935 100644 --- a/proto/zgc/dasigners/v1/genesis.proto +++ b/proto/zgc/dasigners/v1/genesis.proto @@ -11,9 +11,10 @@ option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; message Params { string tokens_per_vote = 1; - uint64 max_quorums = 2; - uint64 epoch_blocks = 3; - uint64 encoded_slices = 4; + uint64 max_votes_per_signer = 2; + uint64 max_quorums = 3; + uint64 epoch_blocks = 4; + uint64 encoded_slices = 5; } // GenesisState defines the dasigners module's genesis state. diff --git a/x/dasigners/v1/keeper/abci.go b/x/dasigners/v1/keeper/abci.go index d80a80d6..d180dbf8 100644 --- a/x/dasigners/v1/keeper/abci.go +++ b/x/dasigners/v1/keeper/abci.go @@ -2,6 +2,7 @@ package keeper import ( "bytes" + "math/big" "sort" "github.com/0glabs/0g-chain/x/dasigners/v1/types" @@ -45,16 +46,16 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { } for _, registration := range registrations { // get validator - valAddr, err := sdk.ValAddressFromHex(registration.account) + accAddr, err := sdk.AccAddressFromHexUnsafe(registration.account) if err != nil { k.Logger(ctx).Error("[BeginBlock] invalid account") continue } - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - continue + bonded := k.GetDelegatorBonded(ctx, accAddr) + num := bonded.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(tokensPerVote).Abs().BigInt() + if num.Cmp(big.NewInt(int64(params.MaxVotesPerSigner))) > 0 { + num = big.NewInt(int64(params.MaxVotesPerSigner)) } - num := validator.Tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(tokensPerVote).Abs().BigInt() content := registration.content ballotNum := num.Int64() for j := 0; j < int(ballotNum); j += 1 { diff --git a/x/dasigners/v1/keeper/keeper.go b/x/dasigners/v1/keeper/keeper.go index 6d4de856..b24a8cb4 100644 --- a/x/dasigners/v1/keeper/keeper.go +++ b/x/dasigners/v1/keeper/keeper.go @@ -2,11 +2,15 @@ package keeper import ( "encoding/hex" + "fmt" + "math/big" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/tendermint/tendermint/libs/log" "github.com/0glabs/0g-chain/x/dasigners/v1/types" @@ -196,3 +200,42 @@ func (k Keeper) SetRegistration(ctx sdk.Context, epoch uint64, account string, s store.Set(key, signature) return nil } + +func (k Keeper) GetDelegatorBonded(ctx sdk.Context, delegator sdk.AccAddress) math.Int { + bonded := sdk.ZeroDec() + + cnt := 0 + k.stakingKeeper.IterateDelegatorDelegations(ctx, delegator, func(delegation stakingtypes.Delegation) bool { + validatorAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) // shouldn't happen + } + validator, found := k.stakingKeeper.GetValidator(ctx, validatorAddr) + if found { + shares := delegation.Shares + tokens := validator.TokensFromSharesTruncated(shares) + bonded = bonded.Add(tokens) + } + cnt += 1 + return cnt > 10 + }) + return bonded.RoundInt() +} + +func (k Keeper) CheckDelegations(ctx sdk.Context, account string) error { + accAddr, err := sdk.AccAddressFromHexUnsafe(account) + if err != nil { + return err + } + bonded := k.GetDelegatorBonded(ctx, accAddr) + fmt.Printf("delegation: %v\n", bonded) + params := k.GetParams(ctx) + tokensPerVote, ok := sdk.NewIntFromString(params.TokensPerVote) + if !ok { + panic("failed to load params tokens_per_vote") + } + if bonded.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(tokensPerVote).Abs().BigInt().Cmp(big.NewInt(0)) <= 0 { + return types.ErrInsufficientBonded + } + return nil +} diff --git a/x/dasigners/v1/keeper/msg_server.go b/x/dasigners/v1/keeper/msg_server.go index 0c76fc28..b0a1382a 100644 --- a/x/dasigners/v1/keeper/msg_server.go +++ b/x/dasigners/v1/keeper/msg_server.go @@ -6,7 +6,6 @@ import ( "github.com/0glabs/0g-chain/crypto/bn254util" "github.com/0glabs/0g-chain/x/dasigners/v1/types" sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ethereum/go-ethereum/common" etherminttypes "github.com/evmos/ethermint/types" ) @@ -16,15 +15,11 @@ var _ types.MsgServer = &Keeper{} func (k Keeper) RegisterSigner(goCtx context.Context, msg *types.MsgRegisterSigner) (*types.MsgRegisterSignerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // validate sender - valAddr, err := sdk.ValAddressFromHex(msg.Signer.Account) + err := k.CheckDelegations(ctx, msg.Signer.Account) if err != nil { return nil, err } - _, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - return nil, stakingtypes.ErrNoValidatorFound - } - _, found, err = k.GetSigner(ctx, msg.Signer.Account) + _, found, err := k.GetSigner(ctx, msg.Signer.Account) if err != nil { return nil, err } @@ -66,6 +61,10 @@ func (k Keeper) UpdateSocket(goCtx context.Context, msg *types.MsgUpdateSocket) func (k Keeper) RegisterNextEpoch(goCtx context.Context, msg *types.MsgRegisterNextEpoch) (*types.MsgRegisterNextEpochResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // get signer + err := k.CheckDelegations(ctx, msg.Account) + if err != nil { + return nil, err + } signer, found, err := k.GetSigner(ctx, msg.Account) if err != nil { return nil, err diff --git a/x/dasigners/v1/types/errors.go b/x/dasigners/v1/types/errors.go index e5c916e8..0fdcb2b5 100644 --- a/x/dasigners/v1/types/errors.go +++ b/x/dasigners/v1/types/errors.go @@ -10,4 +10,5 @@ var ( ErrQuorumNotFound = errorsmod.Register(ModuleName, 5, "quorum for epoch not found") ErrQuorumIdOutOfBound = errorsmod.Register(ModuleName, 6, "quorum id out of bound") ErrQuorumBitmapLengthMismatch = errorsmod.Register(ModuleName, 7, "quorum bitmap length mismatch") + ErrInsufficientBonded = errorsmod.Register(ModuleName, 8, "insufficient bonded amount") ) diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index b8a8d35a..7fd78cd2 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -15,10 +15,11 @@ func NewGenesisState(params Params, epoch uint64, signers []*Signer, quorumsByEp // DefaultGenesisState returns the default genesis state for the module. func DefaultGenesisState() *GenesisState { return NewGenesisState(Params{ - TokensPerVote: "100", - MaxQuorums: 100, - EpochBlocks: 1000, - EncodedSlices: 3072, + TokensPerVote: "100", + MaxVotesPerSigner: 100, + MaxQuorums: 100, + EpochBlocks: 1000, + EncodedSlices: 3072, }, 0, make([]*Signer, 0), []*Quorums{{ Quorums: make([]*Quorum, 0), }}) diff --git a/x/dasigners/v1/types/genesis.pb.go b/x/dasigners/v1/types/genesis.pb.go index 6ffcb48b..336ef927 100644 --- a/x/dasigners/v1/types/genesis.pb.go +++ b/x/dasigners/v1/types/genesis.pb.go @@ -27,10 +27,11 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Params struct { - TokensPerVote string `protobuf:"bytes,1,opt,name=tokens_per_vote,json=tokensPerVote,proto3" json:"tokens_per_vote,omitempty"` - MaxQuorums uint64 `protobuf:"varint,2,opt,name=max_quorums,json=maxQuorums,proto3" json:"max_quorums,omitempty"` - EpochBlocks uint64 `protobuf:"varint,3,opt,name=epoch_blocks,json=epochBlocks,proto3" json:"epoch_blocks,omitempty"` - EncodedSlices uint64 `protobuf:"varint,4,opt,name=encoded_slices,json=encodedSlices,proto3" json:"encoded_slices,omitempty"` + TokensPerVote string `protobuf:"bytes,1,opt,name=tokens_per_vote,json=tokensPerVote,proto3" json:"tokens_per_vote,omitempty"` + MaxVotesPerSigner uint64 `protobuf:"varint,2,opt,name=max_votes_per_signer,json=maxVotesPerSigner,proto3" json:"max_votes_per_signer,omitempty"` + MaxQuorums uint64 `protobuf:"varint,3,opt,name=max_quorums,json=maxQuorums,proto3" json:"max_quorums,omitempty"` + EpochBlocks uint64 `protobuf:"varint,4,opt,name=epoch_blocks,json=epochBlocks,proto3" json:"epoch_blocks,omitempty"` + EncodedSlices uint64 `protobuf:"varint,5,opt,name=encoded_slices,json=encodedSlices,proto3" json:"encoded_slices,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -73,6 +74,13 @@ func (m *Params) GetTokensPerVote() string { return "" } +func (m *Params) GetMaxVotesPerSigner() uint64 { + if m != nil { + return m.MaxVotesPerSigner + } + return 0 +} + func (m *Params) GetMaxQuorums() uint64 { if m != nil { return m.MaxQuorums @@ -175,33 +183,35 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/genesis.proto", fileDescriptor_896efa766aaca3be) } var fileDescriptor_896efa766aaca3be = []byte{ - // 416 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x6e, 0x13, 0x31, - 0x10, 0x86, 0xb3, 0x24, 0x0a, 0xc2, 0x69, 0x4b, 0xb5, 0xe2, 0xb0, 0xe9, 0x61, 0x13, 0x2a, 0x81, - 0x7a, 0x61, 0xdd, 0x16, 0x89, 0x07, 0x08, 0x42, 0x88, 0x0b, 0x2a, 0x1b, 0x89, 0x03, 0x17, 0xcb, - 0xeb, 0x0c, 0xce, 0xaa, 0xf1, 0xce, 0xb2, 0xf6, 0x46, 0x49, 0x9f, 0x82, 0x3b, 0x2f, 0xd4, 0x63, - 0x8f, 0x9c, 0x10, 0xda, 0xbc, 0x08, 0x62, 0x6c, 0xa8, 0x68, 0xb9, 0xd9, 0xdf, 0xff, 0xcf, 0xe8, - 0xf7, 0x6f, 0x96, 0x5e, 0x69, 0xc5, 0x17, 0xd2, 0x96, 0xba, 0x82, 0xc6, 0xf2, 0xf5, 0x19, 0xd7, - 0x50, 0x81, 0x2d, 0x6d, 0x56, 0x37, 0xe8, 0x30, 0x3e, 0xbc, 0xd2, 0x2a, 0xfb, 0xab, 0x67, 0xeb, - 0xb3, 0xa3, 0xb1, 0x42, 0x6b, 0xd0, 0x0a, 0xd2, 0xb9, 0xbf, 0x78, 0xf3, 0xd1, 0x13, 0x8d, 0x1a, - 0x3d, 0xff, 0x7d, 0x0a, 0x74, 0xac, 0x11, 0xf5, 0x0a, 0x38, 0xdd, 0x8a, 0xf6, 0x33, 0x97, 0xd5, - 0x36, 0x48, 0x93, 0xbb, 0x92, 0x2b, 0x0d, 0x58, 0x27, 0x4d, 0x1d, 0x0c, 0xd3, 0x7b, 0xf1, 0x6e, - 0xb3, 0x90, 0xe3, 0xf8, 0x5b, 0xc4, 0x86, 0x17, 0xb2, 0x91, 0xc6, 0xc6, 0xcf, 0xd9, 0x63, 0x87, - 0x97, 0x50, 0x59, 0x51, 0x43, 0x23, 0xd6, 0xe8, 0x20, 0x89, 0xa6, 0xd1, 0xc9, 0xa3, 0x7c, 0xdf, - 0xe3, 0x0b, 0x68, 0x3e, 0xa2, 0x83, 0x78, 0xc2, 0x46, 0x46, 0x6e, 0xc4, 0x97, 0x16, 0x9b, 0xd6, - 0xd8, 0xe4, 0xc1, 0x34, 0x3a, 0x19, 0xe4, 0xcc, 0xc8, 0xcd, 0x07, 0x4f, 0xe2, 0xa7, 0x6c, 0x0f, - 0x6a, 0x54, 0x4b, 0x51, 0xac, 0x50, 0x5d, 0xda, 0xa4, 0x4f, 0x8e, 0x11, 0xb1, 0x19, 0xa1, 0xf8, - 0x19, 0x3b, 0x80, 0x4a, 0xe1, 0x02, 0x16, 0xc2, 0xae, 0x4a, 0x05, 0x36, 0x19, 0x90, 0x69, 0x3f, - 0xd0, 0x39, 0xc1, 0xe3, 0x2e, 0x62, 0x7b, 0x6f, 0x7d, 0xa1, 0x73, 0x27, 0x1d, 0xc4, 0xaf, 0xd8, - 0xb0, 0xa6, 0xb4, 0x14, 0x6d, 0x74, 0x9e, 0x64, 0x77, 0x0b, 0xce, 0xfc, 0x6b, 0x66, 0x83, 0xeb, - 0x1f, 0x93, 0x5e, 0x1e, 0xdc, 0xb7, 0x91, 0xaa, 0xd6, 0x14, 0xd0, 0x84, 0xd0, 0x3e, 0xd2, 0x7b, - 0x42, 0xf1, 0x39, 0x7b, 0x18, 0xb6, 0x24, 0xfd, 0x69, 0xff, 0xff, 0xbb, 0xe7, 0x74, 0xcc, 0xff, - 0x18, 0xe3, 0xd7, 0xec, 0x30, 0xd4, 0x20, 0x8a, 0xad, 0xa0, 0x6d, 0xc9, 0x80, 0x86, 0xc7, 0xf7, - 0x87, 0x43, 0x3d, 0xf9, 0x41, 0x18, 0x99, 0x6d, 0xdf, 0x50, 0x23, 0xef, 0xae, 0xbb, 0x34, 0xba, - 0xe9, 0xd2, 0xe8, 0x67, 0x97, 0x46, 0x5f, 0x77, 0x69, 0xef, 0x66, 0x97, 0xf6, 0xbe, 0xef, 0xd2, - 0xde, 0x27, 0xae, 0x4b, 0xb7, 0x6c, 0x8b, 0x4c, 0xa1, 0xe1, 0xa7, 0x7a, 0x25, 0x0b, 0xcb, 0x4f, - 0xf5, 0x0b, 0xb5, 0x94, 0x65, 0xc5, 0x37, 0xff, 0xfe, 0xab, 0xdb, 0xd6, 0x60, 0x8b, 0x21, 0x7d, - 0xea, 0xcb, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x28, 0xe1, 0x73, 0x5d, 0x97, 0x02, 0x00, 0x00, + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x6e, 0x13, 0x31, + 0x10, 0x40, 0xb3, 0x24, 0x04, 0xe1, 0xb4, 0xa5, 0x58, 0x3d, 0x38, 0x3d, 0x6c, 0x42, 0x25, 0x50, + 0x2f, 0xac, 0xdb, 0x22, 0xf1, 0x01, 0x41, 0x08, 0x71, 0x41, 0x65, 0x23, 0x71, 0xe0, 0xb2, 0xf2, + 0x3a, 0xc6, 0x59, 0x35, 0xde, 0x59, 0xd6, 0xde, 0x28, 0xe9, 0x57, 0xf0, 0x59, 0x3d, 0x70, 0xe8, + 0x91, 0x13, 0x42, 0xc9, 0x8f, 0xa0, 0x1d, 0x9b, 0x56, 0xb4, 0xbd, 0xd9, 0x6f, 0xde, 0x8c, 0x66, + 0xc6, 0x26, 0xf1, 0xa5, 0x96, 0x7c, 0x26, 0x6c, 0xa1, 0x4b, 0x55, 0x5b, 0xbe, 0x3c, 0xe5, 0x5a, + 0x95, 0xca, 0x16, 0x36, 0xa9, 0x6a, 0x70, 0x40, 0xf7, 0x2f, 0xb5, 0x4c, 0x6e, 0xe2, 0xc9, 0xf2, + 0xf4, 0x70, 0x28, 0xc1, 0x1a, 0xb0, 0x19, 0xc6, 0xb9, 0xbf, 0x78, 0xf9, 0xf0, 0x40, 0x83, 0x06, + 0xcf, 0xdb, 0x53, 0xa0, 0x43, 0x0d, 0xa0, 0x17, 0x8a, 0xe3, 0x2d, 0x6f, 0xbe, 0x71, 0x51, 0xae, + 0x43, 0x68, 0x74, 0x37, 0xe4, 0x0a, 0xa3, 0xac, 0x13, 0xa6, 0x0a, 0xc2, 0xf8, 0x5e, 0x7b, 0xb7, + 0xbd, 0xa0, 0x71, 0xf4, 0x33, 0x22, 0xfd, 0x73, 0x51, 0x0b, 0x63, 0xe9, 0x2b, 0xf2, 0xcc, 0xc1, + 0x85, 0x2a, 0x6d, 0x56, 0xa9, 0x3a, 0x5b, 0x82, 0x53, 0x2c, 0x1a, 0x47, 0xc7, 0x4f, 0xd3, 0x5d, + 0x8f, 0xcf, 0x55, 0xfd, 0x05, 0x9c, 0xa2, 0x9c, 0x1c, 0x18, 0xb1, 0x42, 0xc1, 0xab, 0xbe, 0x22, + 0x7b, 0x34, 0x8e, 0x8e, 0x7b, 0xe9, 0x73, 0x23, 0x56, 0xad, 0xd6, 0xea, 0x53, 0x0c, 0xd0, 0x11, + 0x19, 0xb4, 0x09, 0xdf, 0x1b, 0xa8, 0x1b, 0x63, 0x59, 0x17, 0x3d, 0x62, 0xc4, 0xea, 0xb3, 0x27, + 0xf4, 0x05, 0xd9, 0x51, 0x15, 0xc8, 0x79, 0x96, 0x2f, 0x40, 0x5e, 0x58, 0xd6, 0x43, 0x63, 0x80, + 0x6c, 0x82, 0x88, 0xbe, 0x24, 0x7b, 0xaa, 0x94, 0x30, 0x53, 0xb3, 0xcc, 0x2e, 0x0a, 0xa9, 0x2c, + 0x7b, 0x8c, 0xd2, 0x6e, 0xa0, 0x53, 0x84, 0x47, 0x9b, 0x88, 0xec, 0x7c, 0xf0, 0x2f, 0x30, 0x75, + 0xc2, 0x29, 0xfa, 0x96, 0xf4, 0x2b, 0x1c, 0x0f, 0x67, 0x19, 0x9c, 0xb1, 0xe4, 0xee, 0x8b, 0x24, + 0x7e, 0xfc, 0x49, 0xef, 0xea, 0xf7, 0xa8, 0x93, 0x06, 0xfb, 0xb6, 0xa5, 0xb2, 0x31, 0xf9, 0xcd, + 0x70, 0xbe, 0xa5, 0x4f, 0x88, 0xe8, 0x19, 0x79, 0x12, 0xaa, 0xb0, 0xee, 0xb8, 0xfb, 0x70, 0x6d, + 0xbf, 0x81, 0xf4, 0x9f, 0x48, 0xdf, 0x91, 0xfd, 0xb0, 0x86, 0x2c, 0x5f, 0x67, 0x58, 0x8d, 0xf5, + 0x30, 0x79, 0x78, 0x3f, 0x39, 0xac, 0x27, 0xdd, 0x0b, 0x29, 0x93, 0xf5, 0x7b, 0xdc, 0xc8, 0xc7, + 0xab, 0x4d, 0x1c, 0x5d, 0x6f, 0xe2, 0xe8, 0xcf, 0x26, 0x8e, 0x7e, 0x6c, 0xe3, 0xce, 0xf5, 0x36, + 0xee, 0xfc, 0xda, 0xc6, 0x9d, 0xaf, 0x5c, 0x17, 0x6e, 0xde, 0xe4, 0x89, 0x04, 0xc3, 0x4f, 0xf4, + 0x42, 0xe4, 0x96, 0x9f, 0xe8, 0xd7, 0x72, 0x2e, 0x8a, 0x92, 0xaf, 0xfe, 0xff, 0x08, 0x6e, 0x5d, + 0x29, 0x9b, 0xf7, 0xf1, 0x17, 0xbc, 0xf9, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x79, 0x90, 0xf6, 0x00, + 0xc8, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -227,16 +237,21 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.EncodedSlices != 0 { i = encodeVarintGenesis(dAtA, i, uint64(m.EncodedSlices)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x28 } if m.EpochBlocks != 0 { i = encodeVarintGenesis(dAtA, i, uint64(m.EpochBlocks)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 } if m.MaxQuorums != 0 { i = encodeVarintGenesis(dAtA, i, uint64(m.MaxQuorums)) i-- + dAtA[i] = 0x18 + } + if m.MaxVotesPerSigner != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.MaxVotesPerSigner)) + i-- dAtA[i] = 0x10 } if len(m.TokensPerVote) > 0 { @@ -336,6 +351,9 @@ func (m *Params) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + if m.MaxVotesPerSigner != 0 { + n += 1 + sovGenesis(uint64(m.MaxVotesPerSigner)) + } if m.MaxQuorums != 0 { n += 1 + sovGenesis(uint64(m.MaxQuorums)) } @@ -442,6 +460,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { m.TokensPerVote = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxVotesPerSigner", wireType) + } + m.MaxVotesPerSigner = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxVotesPerSigner |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MaxQuorums", wireType) } @@ -460,7 +497,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EpochBlocks", wireType) } @@ -479,7 +516,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 4: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EncodedSlices", wireType) } diff --git a/x/dasigners/v1/types/interfaces.go b/x/dasigners/v1/types/interfaces.go index e7409261..c9456fdd 100644 --- a/x/dasigners/v1/types/interfaces.go +++ b/x/dasigners/v1/types/interfaces.go @@ -7,4 +7,5 @@ import ( type StakingKeeper interface { GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) + IterateDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(delegation stakingtypes.Delegation) (stop bool)) } From ff01dec9802b4b11154ac8420d6bf6f77bbc0345 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:20:30 +0800 Subject: [PATCH 21/26] fix: decimals --- proto/zgc/dasigners/v1/genesis.proto | 2 +- x/dasigners/v1/keeper/abci.go | 10 +-- x/dasigners/v1/keeper/keeper.go | 12 ++-- x/dasigners/v1/types/genesis.go | 11 ++-- x/dasigners/v1/types/genesis.pb.go | 94 ++++++++++++---------------- 5 files changed, 57 insertions(+), 72 deletions(-) diff --git a/proto/zgc/dasigners/v1/genesis.proto b/proto/zgc/dasigners/v1/genesis.proto index 9fead935..c08d0d92 100644 --- a/proto/zgc/dasigners/v1/genesis.proto +++ b/proto/zgc/dasigners/v1/genesis.proto @@ -10,7 +10,7 @@ import "zgc/dasigners/v1/dasigners.proto"; option go_package = "github.com/0glabs/0g-chain/x/dasigners/v1/types"; message Params { - string tokens_per_vote = 1; + uint64 tokens_per_vote = 1; uint64 max_votes_per_signer = 2; uint64 max_quorums = 3; uint64 epoch_blocks = 4; diff --git a/x/dasigners/v1/keeper/abci.go b/x/dasigners/v1/keeper/abci.go index d180dbf8..81df3c3d 100644 --- a/x/dasigners/v1/keeper/abci.go +++ b/x/dasigners/v1/keeper/abci.go @@ -2,6 +2,7 @@ package keeper import ( "bytes" + "fmt" "math/big" "sort" @@ -40,10 +41,7 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { return false }) ballots := []Ballot{} - tokensPerVote, ok := sdk.NewIntFromString(params.TokensPerVote) - if !ok { - panic("failed to load params tokens_per_vote") - } + tokensPerVote := sdk.NewIntFromUint64(params.TokensPerVote) for _, registration := range registrations { // get validator accAddr, err := sdk.AccAddressFromHexUnsafe(registration.account) @@ -52,10 +50,12 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { continue } bonded := k.GetDelegatorBonded(ctx, accAddr) - num := bonded.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(tokensPerVote).Abs().BigInt() + num := bonded.Quo(BondedConversionRate).Quo(tokensPerVote).Abs().BigInt() + fmt.Printf("ballots num: %v\n", num) if num.Cmp(big.NewInt(int64(params.MaxVotesPerSigner))) > 0 { num = big.NewInt(int64(params.MaxVotesPerSigner)) } + fmt.Printf("ballots num limited: %v\n", num) content := registration.content ballotNum := num.Int64() for j := 0; j < int(ballotNum); j += 1 { diff --git a/x/dasigners/v1/keeper/keeper.go b/x/dasigners/v1/keeper/keeper.go index b24a8cb4..8dd900f6 100644 --- a/x/dasigners/v1/keeper/keeper.go +++ b/x/dasigners/v1/keeper/keeper.go @@ -13,9 +13,12 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/tendermint/tendermint/libs/log" + "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/dasigners/v1/types" ) +var BondedConversionRate = math.NewIntFromBigInt(big.NewInt(0).Exp(big.NewInt(10), big.NewInt(chaincfg.GasDenomUnit), nil)) + type Keeper struct { storeKey storetypes.StoreKey cdc codec.BinaryCodec @@ -228,13 +231,10 @@ func (k Keeper) CheckDelegations(ctx sdk.Context, account string) error { return err } bonded := k.GetDelegatorBonded(ctx, accAddr) - fmt.Printf("delegation: %v\n", bonded) params := k.GetParams(ctx) - tokensPerVote, ok := sdk.NewIntFromString(params.TokensPerVote) - if !ok { - panic("failed to load params tokens_per_vote") - } - if bonded.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(tokensPerVote).Abs().BigInt().Cmp(big.NewInt(0)) <= 0 { + tokensPerVote := sdk.NewIntFromUint64(params.TokensPerVote) + fmt.Printf("account: %v, bonded: %v, conversion rate: %v, ticket: %v\n", account, bonded, BondedConversionRate, bonded.Quo(BondedConversionRate).Quo(tokensPerVote)) + if bonded.Quo(BondedConversionRate).Quo(tokensPerVote).Abs().BigInt().Cmp(big.NewInt(0)) <= 0 { return types.ErrInsufficientBonded } return nil diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index 7fd78cd2..686adac3 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -15,11 +15,12 @@ func NewGenesisState(params Params, epoch uint64, signers []*Signer, quorumsByEp // DefaultGenesisState returns the default genesis state for the module. func DefaultGenesisState() *GenesisState { return NewGenesisState(Params{ - TokensPerVote: "100", - MaxVotesPerSigner: 100, - MaxQuorums: 100, - EpochBlocks: 1000, - EncodedSlices: 3072, + TokensPerVote: 10, + MaxVotesPerSigner: 1024, + MaxQuorums: 10, + // EpochBlocks: 5760, + EpochBlocks: 20, + EncodedSlices: 3072, }, 0, make([]*Signer, 0), []*Quorums{{ Quorums: make([]*Quorum, 0), }}) diff --git a/x/dasigners/v1/types/genesis.pb.go b/x/dasigners/v1/types/genesis.pb.go index 336ef927..a8440a5e 100644 --- a/x/dasigners/v1/types/genesis.pb.go +++ b/x/dasigners/v1/types/genesis.pb.go @@ -27,7 +27,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Params struct { - TokensPerVote string `protobuf:"bytes,1,opt,name=tokens_per_vote,json=tokensPerVote,proto3" json:"tokens_per_vote,omitempty"` + TokensPerVote uint64 `protobuf:"varint,1,opt,name=tokens_per_vote,json=tokensPerVote,proto3" json:"tokens_per_vote,omitempty"` MaxVotesPerSigner uint64 `protobuf:"varint,2,opt,name=max_votes_per_signer,json=maxVotesPerSigner,proto3" json:"max_votes_per_signer,omitempty"` MaxQuorums uint64 `protobuf:"varint,3,opt,name=max_quorums,json=maxQuorums,proto3" json:"max_quorums,omitempty"` EpochBlocks uint64 `protobuf:"varint,4,opt,name=epoch_blocks,json=epochBlocks,proto3" json:"epoch_blocks,omitempty"` @@ -67,11 +67,11 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetTokensPerVote() string { +func (m *Params) GetTokensPerVote() uint64 { if m != nil { return m.TokensPerVote } - return "" + return 0 } func (m *Params) GetMaxVotesPerSigner() uint64 { @@ -183,35 +183,35 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/genesis.proto", fileDescriptor_896efa766aaca3be) } var fileDescriptor_896efa766aaca3be = []byte{ - // 436 bytes of a gzipped FileDescriptorProto + // 433 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x6e, 0x13, 0x31, - 0x10, 0x40, 0xb3, 0x24, 0x04, 0xe1, 0xb4, 0xa5, 0x58, 0x3d, 0x38, 0x3d, 0x6c, 0x42, 0x25, 0x50, - 0x2f, 0xac, 0xdb, 0x22, 0xf1, 0x01, 0x41, 0x08, 0x71, 0x41, 0x65, 0x23, 0x71, 0xe0, 0xb2, 0xf2, - 0x3a, 0xc6, 0x59, 0x35, 0xde, 0x59, 0xd6, 0xde, 0x28, 0xe9, 0x57, 0xf0, 0x59, 0x3d, 0x70, 0xe8, - 0x91, 0x13, 0x42, 0xc9, 0x8f, 0xa0, 0x1d, 0x9b, 0x56, 0xb4, 0xbd, 0xd9, 0x6f, 0xde, 0x8c, 0x66, - 0xc6, 0x26, 0xf1, 0xa5, 0x96, 0x7c, 0x26, 0x6c, 0xa1, 0x4b, 0x55, 0x5b, 0xbe, 0x3c, 0xe5, 0x5a, - 0x95, 0xca, 0x16, 0x36, 0xa9, 0x6a, 0x70, 0x40, 0xf7, 0x2f, 0xb5, 0x4c, 0x6e, 0xe2, 0xc9, 0xf2, - 0xf4, 0x70, 0x28, 0xc1, 0x1a, 0xb0, 0x19, 0xc6, 0xb9, 0xbf, 0x78, 0xf9, 0xf0, 0x40, 0x83, 0x06, - 0xcf, 0xdb, 0x53, 0xa0, 0x43, 0x0d, 0xa0, 0x17, 0x8a, 0xe3, 0x2d, 0x6f, 0xbe, 0x71, 0x51, 0xae, - 0x43, 0x68, 0x74, 0x37, 0xe4, 0x0a, 0xa3, 0xac, 0x13, 0xa6, 0x0a, 0xc2, 0xf8, 0x5e, 0x7b, 0xb7, - 0xbd, 0xa0, 0x71, 0xf4, 0x33, 0x22, 0xfd, 0x73, 0x51, 0x0b, 0x63, 0xe9, 0x2b, 0xf2, 0xcc, 0xc1, - 0x85, 0x2a, 0x6d, 0x56, 0xa9, 0x3a, 0x5b, 0x82, 0x53, 0x2c, 0x1a, 0x47, 0xc7, 0x4f, 0xd3, 0x5d, - 0x8f, 0xcf, 0x55, 0xfd, 0x05, 0x9c, 0xa2, 0x9c, 0x1c, 0x18, 0xb1, 0x42, 0xc1, 0xab, 0xbe, 0x22, - 0x7b, 0x34, 0x8e, 0x8e, 0x7b, 0xe9, 0x73, 0x23, 0x56, 0xad, 0xd6, 0xea, 0x53, 0x0c, 0xd0, 0x11, - 0x19, 0xb4, 0x09, 0xdf, 0x1b, 0xa8, 0x1b, 0x63, 0x59, 0x17, 0x3d, 0x62, 0xc4, 0xea, 0xb3, 0x27, - 0xf4, 0x05, 0xd9, 0x51, 0x15, 0xc8, 0x79, 0x96, 0x2f, 0x40, 0x5e, 0x58, 0xd6, 0x43, 0x63, 0x80, - 0x6c, 0x82, 0x88, 0xbe, 0x24, 0x7b, 0xaa, 0x94, 0x30, 0x53, 0xb3, 0xcc, 0x2e, 0x0a, 0xa9, 0x2c, - 0x7b, 0x8c, 0xd2, 0x6e, 0xa0, 0x53, 0x84, 0x47, 0x9b, 0x88, 0xec, 0x7c, 0xf0, 0x2f, 0x30, 0x75, - 0xc2, 0x29, 0xfa, 0x96, 0xf4, 0x2b, 0x1c, 0x0f, 0x67, 0x19, 0x9c, 0xb1, 0xe4, 0xee, 0x8b, 0x24, - 0x7e, 0xfc, 0x49, 0xef, 0xea, 0xf7, 0xa8, 0x93, 0x06, 0xfb, 0xb6, 0xa5, 0xb2, 0x31, 0xf9, 0xcd, - 0x70, 0xbe, 0xa5, 0x4f, 0x88, 0xe8, 0x19, 0x79, 0x12, 0xaa, 0xb0, 0xee, 0xb8, 0xfb, 0x70, 0x6d, - 0xbf, 0x81, 0xf4, 0x9f, 0x48, 0xdf, 0x91, 0xfd, 0xb0, 0x86, 0x2c, 0x5f, 0x67, 0x58, 0x8d, 0xf5, - 0x30, 0x79, 0x78, 0x3f, 0x39, 0xac, 0x27, 0xdd, 0x0b, 0x29, 0x93, 0xf5, 0x7b, 0xdc, 0xc8, 0xc7, - 0xab, 0x4d, 0x1c, 0x5d, 0x6f, 0xe2, 0xe8, 0xcf, 0x26, 0x8e, 0x7e, 0x6c, 0xe3, 0xce, 0xf5, 0x36, - 0xee, 0xfc, 0xda, 0xc6, 0x9d, 0xaf, 0x5c, 0x17, 0x6e, 0xde, 0xe4, 0x89, 0x04, 0xc3, 0x4f, 0xf4, - 0x42, 0xe4, 0x96, 0x9f, 0xe8, 0xd7, 0x72, 0x2e, 0x8a, 0x92, 0xaf, 0xfe, 0xff, 0x08, 0x6e, 0x5d, - 0x29, 0x9b, 0xf7, 0xf1, 0x17, 0xbc, 0xf9, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x79, 0x90, 0xf6, 0x00, - 0xc8, 0x02, 0x00, 0x00, + 0x10, 0x86, 0xb3, 0x24, 0x04, 0xc9, 0x29, 0xa5, 0x58, 0x3d, 0x6c, 0x7a, 0xd8, 0x84, 0x4a, 0x20, + 0x2e, 0xac, 0xdb, 0x22, 0xf1, 0x00, 0x41, 0x08, 0x71, 0x41, 0x25, 0x91, 0x38, 0x70, 0x59, 0x79, + 0x9d, 0xc1, 0x59, 0x35, 0xde, 0x59, 0xd6, 0xde, 0x28, 0xe9, 0x53, 0xf0, 0x58, 0x3d, 0x70, 0xe8, + 0x91, 0x13, 0x42, 0xc9, 0x8b, 0xa0, 0x1d, 0x9b, 0x56, 0xb4, 0xdc, 0xec, 0xff, 0xff, 0x66, 0xf4, + 0xcf, 0xd8, 0x2c, 0xb9, 0xd4, 0x4a, 0xcc, 0xa5, 0x2d, 0x74, 0x09, 0xb5, 0x15, 0xab, 0x53, 0xa1, + 0xa1, 0x04, 0x5b, 0xd8, 0xb4, 0xaa, 0xd1, 0x21, 0x3f, 0xb8, 0xd4, 0x2a, 0xbd, 0xf1, 0xd3, 0xd5, + 0xe9, 0xd1, 0x50, 0xa1, 0x35, 0x68, 0x33, 0xf2, 0x85, 0xbf, 0x78, 0xf8, 0xe8, 0x50, 0xa3, 0x46, + 0xaf, 0xb7, 0xa7, 0xa0, 0x0e, 0x35, 0xa2, 0x5e, 0x82, 0xa0, 0x5b, 0xde, 0x7c, 0x15, 0xb2, 0xdc, + 0x04, 0x6b, 0x74, 0xd7, 0x72, 0x85, 0x01, 0xeb, 0xa4, 0xa9, 0x02, 0x30, 0xbe, 0x17, 0xef, 0x36, + 0x0b, 0x11, 0xc7, 0x3f, 0x22, 0xd6, 0x3f, 0x97, 0xb5, 0x34, 0x96, 0xbf, 0x60, 0x4f, 0x1c, 0x5e, + 0x40, 0x69, 0xb3, 0x0a, 0xea, 0x6c, 0x85, 0x0e, 0xe2, 0x68, 0x1c, 0xbd, 0xec, 0x4d, 0x1f, 0x7b, + 0xf9, 0x1c, 0xea, 0xcf, 0xe8, 0x80, 0x0b, 0x76, 0x68, 0xe4, 0x9a, 0x00, 0x8f, 0xfa, 0x8e, 0xf1, + 0x03, 0x82, 0x9f, 0x1a, 0xb9, 0x6e, 0xb1, 0x16, 0x9f, 0x91, 0xc1, 0x47, 0x6c, 0xd0, 0x16, 0x7c, + 0x6b, 0xb0, 0x6e, 0x8c, 0x8d, 0xbb, 0xc4, 0x31, 0x23, 0xd7, 0x9f, 0xbc, 0xc2, 0x9f, 0xb1, 0x3d, + 0xa8, 0x50, 0x2d, 0xb2, 0x7c, 0x89, 0xea, 0xc2, 0xc6, 0x3d, 0x22, 0x06, 0xa4, 0x4d, 0x48, 0xe2, + 0xcf, 0xd9, 0x3e, 0x94, 0x0a, 0xe7, 0x30, 0xcf, 0xec, 0xb2, 0x50, 0x60, 0xe3, 0x87, 0x3e, 0x5b, + 0x50, 0x67, 0x24, 0x1e, 0x6f, 0x23, 0xb6, 0xf7, 0xde, 0xbf, 0xc0, 0xcc, 0x49, 0x07, 0xfc, 0x0d, + 0xeb, 0x57, 0x34, 0x1e, 0xcd, 0x32, 0x38, 0x8b, 0xd3, 0xbb, 0x2f, 0x92, 0xfa, 0xf1, 0x27, 0xbd, + 0xab, 0x5f, 0xa3, 0xce, 0x34, 0xd0, 0xb7, 0x91, 0xca, 0xc6, 0xe4, 0x37, 0xc3, 0xf9, 0x48, 0x1f, + 0x49, 0xe2, 0x67, 0xec, 0x51, 0xe8, 0x12, 0x77, 0xc7, 0xdd, 0xff, 0xf7, 0xf6, 0x1b, 0x98, 0xfe, + 0x05, 0xf9, 0x5b, 0x76, 0x10, 0xd6, 0x90, 0xe5, 0x9b, 0x8c, 0xba, 0xc5, 0x3d, 0x2a, 0x1e, 0xde, + 0x2f, 0x0e, 0xeb, 0x99, 0xee, 0x87, 0x92, 0xc9, 0xe6, 0x1d, 0x6d, 0xe4, 0xc3, 0xd5, 0x36, 0x89, + 0xae, 0xb7, 0x49, 0xf4, 0x7b, 0x9b, 0x44, 0xdf, 0x77, 0x49, 0xe7, 0x7a, 0x97, 0x74, 0x7e, 0xee, + 0x92, 0xce, 0x17, 0xa1, 0x0b, 0xb7, 0x68, 0xf2, 0x54, 0xa1, 0x11, 0x27, 0x7a, 0x29, 0x73, 0x2b, + 0x4e, 0xf4, 0x2b, 0xb5, 0x90, 0x45, 0x29, 0xd6, 0xff, 0x7e, 0x04, 0xb7, 0xa9, 0xc0, 0xe6, 0x7d, + 0xfa, 0x05, 0xaf, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xff, 0xe5, 0x90, 0xe2, 0xc8, 0x02, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -254,12 +254,10 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if len(m.TokensPerVote) > 0 { - i -= len(m.TokensPerVote) - copy(dAtA[i:], m.TokensPerVote) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.TokensPerVote))) + if m.TokensPerVote != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.TokensPerVote)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -347,9 +345,8 @@ func (m *Params) Size() (n int) { } var l int _ = l - l = len(m.TokensPerVote) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) + if m.TokensPerVote != 0 { + n += 1 + sovGenesis(uint64(m.TokensPerVote)) } if m.MaxVotesPerSigner != 0 { n += 1 + sovGenesis(uint64(m.MaxVotesPerSigner)) @@ -428,10 +425,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TokensPerVote", wireType) } - var stringLen uint64 + m.TokensPerVote = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -441,24 +438,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TokensPerVote |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TokensPerVote = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MaxVotesPerSigner", wireType) From 429946d0f274d1ec0cfc787d15a00cb5fe32c2d0 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:21:53 +0800 Subject: [PATCH 22/26] chore: remove tmp output --- x/dasigners/v1/keeper/abci.go | 3 --- x/dasigners/v1/keeper/keeper.go | 2 -- 2 files changed, 5 deletions(-) diff --git a/x/dasigners/v1/keeper/abci.go b/x/dasigners/v1/keeper/abci.go index 81df3c3d..e3a77d6e 100644 --- a/x/dasigners/v1/keeper/abci.go +++ b/x/dasigners/v1/keeper/abci.go @@ -2,7 +2,6 @@ package keeper import ( "bytes" - "fmt" "math/big" "sort" @@ -51,11 +50,9 @@ func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { } bonded := k.GetDelegatorBonded(ctx, accAddr) num := bonded.Quo(BondedConversionRate).Quo(tokensPerVote).Abs().BigInt() - fmt.Printf("ballots num: %v\n", num) if num.Cmp(big.NewInt(int64(params.MaxVotesPerSigner))) > 0 { num = big.NewInt(int64(params.MaxVotesPerSigner)) } - fmt.Printf("ballots num limited: %v\n", num) content := registration.content ballotNum := num.Int64() for j := 0; j < int(ballotNum); j += 1 { diff --git a/x/dasigners/v1/keeper/keeper.go b/x/dasigners/v1/keeper/keeper.go index 8dd900f6..530b84c9 100644 --- a/x/dasigners/v1/keeper/keeper.go +++ b/x/dasigners/v1/keeper/keeper.go @@ -2,7 +2,6 @@ package keeper import ( "encoding/hex" - "fmt" "math/big" "cosmossdk.io/math" @@ -233,7 +232,6 @@ func (k Keeper) CheckDelegations(ctx sdk.Context, account string) error { bonded := k.GetDelegatorBonded(ctx, accAddr) params := k.GetParams(ctx) tokensPerVote := sdk.NewIntFromUint64(params.TokensPerVote) - fmt.Printf("account: %v, bonded: %v, conversion rate: %v, ticket: %v\n", account, bonded, BondedConversionRate, bonded.Quo(BondedConversionRate).Quo(tokensPerVote)) if bonded.Quo(BondedConversionRate).Quo(tokensPerVote).Abs().BigInt().Cmp(big.NewInt(0)) <= 0 { return types.ErrInsufficientBonded } From 141796f158dfb1abe2c9580dbf8026d42e17ac10 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Wed, 12 Jun 2024 01:36:29 +0800 Subject: [PATCH 23/26] use chaincfg.MakeCoinForGasDenom --- migrate/utils/periodic_vesting_reset_test.go | 46 ++++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/migrate/utils/periodic_vesting_reset_test.go b/migrate/utils/periodic_vesting_reset_test.go index 5424eb93..b7cde17f 100644 --- a/migrate/utils/periodic_vesting_reset_test.go +++ b/migrate/utils/periodic_vesting_reset_test.go @@ -42,7 +42,7 @@ func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -65,7 +65,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -98,7 +98,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -126,25 +126,25 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing } func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(4e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(4e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +30 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, } @@ -160,36 +160,36 @@ func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { expectedPeriods := []vestingtypes.Period{ { Length: 15 * 24 * 60 * 60, // 15 days - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, { Length: 15 * 24 * 60 * 60, // 15 days - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, } - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") + assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") assert.Equal(t, newVestingStartTime.Unix(), vacc.StartTime, "expected vesting start time to be updated") assert.Equal(t, expectedEndtime, vacc.EndTime, "expected vesting end time end at last period") assert.Equal(t, expectedPeriods, vacc.VestingPeriods, "expected vesting periods to be updated") } func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(3e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, } @@ -199,35 +199,35 @@ func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testin newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) ResetPeriodicVestingAccount(vacc, newVestingStartTime) - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") + assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") + assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") } func TestResetPeriodVestingAccount_DelegatedVesting_LessThanVested(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(3e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, } vacc := createVestingAccount(balance, vestingStartTime, periods) - vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))) + vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6)))) newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) ResetPeriodicVestingAccount(vacc, newVestingStartTime) assert.Equal(t, sdk.Coins(nil), vacc.DelegatedFree, "expected delegrated free to be unmodified") - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") + assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") } From d2acd8bf7953778985dba81e767028169f2578d1 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Wed, 12 Jun 2024 01:47:42 +0800 Subject: [PATCH 24/26] recover "rename denoms" in 3 files --- client/docs/cosmos-swagger.yml | 10 +++++----- client/docs/ibc-go-swagger.yml | 20 +++++++++---------- client/docs/swagger-ui/swagger.yaml | 30 ++++++++++++++--------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/client/docs/cosmos-swagger.yml b/client/docs/cosmos-swagger.yml index dccd95c2..1fa424c0 100644 --- a/client/docs/cosmos-swagger.yml +++ b/client/docs/cosmos-swagger.yml @@ -3121,7 +3121,7 @@ paths: base: type: string description: >- - base represents the evm denom (should be the DenomUnit + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -3328,7 +3328,7 @@ paths: base: type: string description: >- - base represents the evm denom (should be the DenomUnit + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35597,7 +35597,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with exponent + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35764,7 +35764,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35920,7 +35920,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string diff --git a/client/docs/ibc-go-swagger.yml b/client/docs/ibc-go-swagger.yml index a6cabe17..c750fda6 100644 --- a/client/docs/ibc-go-swagger.yml +++ b/client/docs/ibc-go-swagger.yml @@ -129,9 +129,9 @@ paths: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -265,9 +265,9 @@ paths: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -13499,9 +13499,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens and + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -13557,9 +13557,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -13583,9 +13583,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 412e9e5e..803f7418 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -16331,7 +16331,7 @@ paths: base: type: string description: >- - base represents the evm denom (should be the DenomUnit + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -16538,7 +16538,7 @@ paths: base: type: string description: >- - base represents the evm denom (should be the DenomUnit + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -39228,9 +39228,9 @@ paths: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -39364,9 +39364,9 @@ paths: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -58047,7 +58047,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with exponent + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -58214,7 +58214,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -58370,7 +58370,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -81239,9 +81239,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens and + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -81297,9 +81297,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -81323,9 +81323,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. From b8ed70c775b8a30ed5ccbae5a8e4d3ba07ccdb42 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Wed, 12 Jun 2024 02:00:16 +0800 Subject: [PATCH 25/26] keep the EthSecp256k1 from cosmos for compatible --- cmd/0gchaind/root.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/0gchaind/root.go b/cmd/0gchaind/root.go index d4e3f5a0..fab91152 100644 --- a/cmd/0gchaind/root.go +++ b/cmd/0gchaind/root.go @@ -31,8 +31,8 @@ import ( func customKeyringOptions() keyring.Option { return func(options *keyring.Options) { - options.SupportedAlgos = append(options.SupportedAlgos, vrf.VrfAlgo, hd.EthSecp256k1) - options.SupportedAlgosLedger = append(options.SupportedAlgosLedger, vrf.VrfAlgo, hd.EthSecp256k1) + options.SupportedAlgos = append(hd.SupportedAlgorithms, vrf.VrfAlgo) + options.SupportedAlgosLedger = append(hd.SupportedAlgorithmsLedger, vrf.VrfAlgo) } } From 344f8b05652c1522c1a2cb91d209a57cc4ddcf3a Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:27:48 +0800 Subject: [PATCH 26/26] feat: getQuorumRow --- precompiles/dasigners/IDASigners.abi | 29 ++ precompiles/dasigners/contract.go | 33 +- precompiles/dasigners/dasigners.go | 4 + precompiles/dasigners/query.go | 12 + precompiles/dasigners/types.go | 12 + proto/zgc/dasigners/v1/query.proto | 13 + x/dasigners/v1/keeper/grpc_query.go | 16 + x/dasigners/v1/types/errors.go | 1 + x/dasigners/v1/types/genesis.go | 5 +- x/dasigners/v1/types/query.pb.go | 497 ++++++++++++++++++++++++--- x/dasigners/v1/types/query.pb.gw.go | 83 +++++ 11 files changed, 656 insertions(+), 49 deletions(-) diff --git a/precompiles/dasigners/IDASigners.abi b/precompiles/dasigners/IDASigners.abi index 31e55dc4..a718bb42 100644 --- a/precompiles/dasigners/IDASigners.abi +++ b/precompiles/dasigners/IDASigners.abi @@ -155,6 +155,35 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_quorumId", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "_rowIndex", + "type": "uint32" + } + ], + "name": "getQuorumRow", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/precompiles/dasigners/contract.go b/precompiles/dasigners/contract.go index 74116646..b5315608 100644 --- a/precompiles/dasigners/contract.go +++ b/precompiles/dasigners/contract.go @@ -30,7 +30,7 @@ var ( // DASignersMetaData contains all meta data concerning the DASigners contract. var DASignersMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_quorumBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"}],\"name\":\"getQuorum\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_account\",\"type\":\"address[]\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"isSigner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"quorumCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"registeredEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_quorumBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"}],\"name\":\"getQuorum\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_quorumId\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"_rowIndex\",\"type\":\"uint32\"}],\"name\":\"getQuorumRow\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_account\",\"type\":\"address[]\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"isSigner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"quorumCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"registeredEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // DASignersABI is the input ABI used to generate the binding from. @@ -291,6 +291,37 @@ func (_DASigners *DASignersCallerSession) GetQuorum(_epoch *big.Int, _quorumId * return _DASigners.Contract.GetQuorum(&_DASigners.CallOpts, _epoch, _quorumId) } +// GetQuorumRow is a free data retrieval call binding the contract method 0xfa6fcba6. +// +// Solidity: function getQuorumRow(uint256 _epoch, uint256 _quorumId, uint32 _rowIndex) view returns(address) +func (_DASigners *DASignersCaller) GetQuorumRow(opts *bind.CallOpts, _epoch *big.Int, _quorumId *big.Int, _rowIndex uint32) (common.Address, error) { + var out []interface{} + err := _DASigners.contract.Call(opts, &out, "getQuorumRow", _epoch, _quorumId, _rowIndex) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetQuorumRow is a free data retrieval call binding the contract method 0xfa6fcba6. +// +// Solidity: function getQuorumRow(uint256 _epoch, uint256 _quorumId, uint32 _rowIndex) view returns(address) +func (_DASigners *DASignersSession) GetQuorumRow(_epoch *big.Int, _quorumId *big.Int, _rowIndex uint32) (common.Address, error) { + return _DASigners.Contract.GetQuorumRow(&_DASigners.CallOpts, _epoch, _quorumId, _rowIndex) +} + +// GetQuorumRow is a free data retrieval call binding the contract method 0xfa6fcba6. +// +// Solidity: function getQuorumRow(uint256 _epoch, uint256 _quorumId, uint32 _rowIndex) view returns(address) +func (_DASigners *DASignersCallerSession) GetQuorumRow(_epoch *big.Int, _quorumId *big.Int, _rowIndex uint32) (common.Address, error) { + return _DASigners.Contract.GetQuorumRow(&_DASigners.CallOpts, _epoch, _quorumId, _rowIndex) +} + // GetSigner is a free data retrieval call binding the contract method 0xd1f5e5f8. // // Solidity: function getSigner(address[] _account) view returns((address,string,(uint256,uint256),(uint256[2],uint256[2]))[]) diff --git a/precompiles/dasigners/dasigners.go b/precompiles/dasigners/dasigners.go index 6a553e5c..53cef1f5 100644 --- a/precompiles/dasigners/dasigners.go +++ b/precompiles/dasigners/dasigners.go @@ -22,6 +22,7 @@ const ( DASignersFunctionQuorumCount = "quorumCount" DASignersFunctionGetSigner = "getSigner" DASignersFunctionGetQuorum = "getQuorum" + DASignersFunctionGetQuorumRow = "getQuorumRow" DASignersFunctionRegisterSigner = "registerSigner" DASignersFunctionUpdateSocket = "updateSocket" DASignersFunctionRegisterNextEpoch = "registerNextEpoch" @@ -35,6 +36,7 @@ var RequiredGasBasic = map[string]uint64{ DASignersFunctionQuorumCount: 1000, DASignersFunctionGetSigner: 100000, DASignersFunctionGetQuorum: 100000, + DASignersFunctionGetQuorumRow: 10000, DASignersFunctionRegisterSigner: 100000, DASignersFunctionUpdateSocket: 50000, DASignersFunctionRegisterNextEpoch: 100000, @@ -123,6 +125,8 @@ func (d *DASignersPrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly b bz, err = d.GetSigner(ctx, evm, method, args) case DASignersFunctionGetQuorum: bz, err = d.GetQuorum(ctx, evm, method, args) + case DASignersFunctionGetQuorumRow: + bz, err = d.GetQuorumRow(ctx, evm, method, args) case DASignersFunctionGetAggPkG1: bz, err = d.GetAggPkG1(ctx, evm, method, args) case DASignersFunctionIsSigner: diff --git a/precompiles/dasigners/query.go b/precompiles/dasigners/query.go index 001af214..8d21e4b9 100644 --- a/precompiles/dasigners/query.go +++ b/precompiles/dasigners/query.go @@ -88,6 +88,18 @@ func (d *DASignersPrecompile) GetQuorum(ctx sdk.Context, _ *vm.EVM, method *abi. return method.Outputs.Pack(signers) } +func (d *DASignersPrecompile) GetQuorumRow(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { + req, err := NewQueryEpochQuorumRowRequest(args) + if err != nil { + return nil, err + } + response, err := d.dasignersKeeper.EpochQuorumRow(sdk.WrapSDKContext(ctx), req) + if err != nil { + return nil, err + } + return method.Outputs.Pack(common.HexToAddress(response.Signer)) +} + func (d *DASignersPrecompile) GetAggPkG1(ctx sdk.Context, _ *vm.EVM, method *abi.Method, args []interface{}) ([]byte, error) { req, err := NewQueryAggregatePubkeyG1Request(args) if err != nil { diff --git a/precompiles/dasigners/types.go b/precompiles/dasigners/types.go index 689ed256..86b668f2 100644 --- a/precompiles/dasigners/types.go +++ b/precompiles/dasigners/types.go @@ -98,6 +98,18 @@ func NewQueryEpochQuorumRequest(args []interface{}) (*dasignerstypes.QueryEpochQ }, nil } +func NewQueryEpochQuorumRowRequest(args []interface{}) (*dasignerstypes.QueryEpochQuorumRowRequest, error) { + if len(args) != 3 { + return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 3, len(args)) + } + + return &dasignerstypes.QueryEpochQuorumRowRequest{ + EpochNumber: args[0].(*big.Int).Uint64(), + QuorumId: args[1].(*big.Int).Uint64(), + RowIndex: args[2].(uint32), + }, nil +} + func NewQueryAggregatePubkeyG1Request(args []interface{}) (*dasignerstypes.QueryAggregatePubkeyG1Request, error) { if len(args) != 3 { return nil, fmt.Errorf(precopmiles_common.ErrInvalidNumberOfArgs, 3, len(args)) diff --git a/proto/zgc/dasigners/v1/query.proto b/proto/zgc/dasigners/v1/query.proto index 2ab36c4c..c9091370 100644 --- a/proto/zgc/dasigners/v1/query.proto +++ b/proto/zgc/dasigners/v1/query.proto @@ -22,6 +22,9 @@ service Query { rpc EpochQuorum(QueryEpochQuorumRequest) returns (QueryEpochQuorumResponse) { option (google.api.http).get = "/0g/dasigners/v1/epoch-quorum"; } + rpc EpochQuorumRow(QueryEpochQuorumRowRequest) returns (QueryEpochQuorumRowResponse) { + option (google.api.http).get = "/0g/dasigners/v1/epoch-quorum-row"; + } rpc AggregatePubkeyG1(QueryAggregatePubkeyG1Request) returns (QueryAggregatePubkeyG1Response) { option (google.api.http).get = "/0g/dasigners/v1/aggregate-pubkey-g1"; } @@ -61,6 +64,16 @@ message QueryEpochQuorumResponse { Quorum quorum = 1; } +message QueryEpochQuorumRowRequest { + uint64 epoch_number = 1; + uint64 quorum_id = 2; + uint32 row_index = 3; +} + +message QueryEpochQuorumRowResponse { + string signer = 1; +} + message QueryAggregatePubkeyG1Request { uint64 epoch_number = 1; uint64 quorum_id = 2; diff --git a/x/dasigners/v1/keeper/grpc_query.go b/x/dasigners/v1/keeper/grpc_query.go index cd0fedfe..ddc64093 100644 --- a/x/dasigners/v1/keeper/grpc_query.go +++ b/x/dasigners/v1/keeper/grpc_query.go @@ -67,6 +67,22 @@ func (k Keeper) EpochQuorum(c context.Context, request *types.QueryEpochQuorumRe return &types.QueryEpochQuorumResponse{Quorum: quorums.Quorums[request.QuorumId]}, nil } +func (k Keeper) EpochQuorumRow(c context.Context, request *types.QueryEpochQuorumRowRequest) (*types.QueryEpochQuorumRowResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + quorums, found := k.GetEpochQuorums(ctx, request.EpochNumber) + if !found { + return nil, types.ErrQuorumNotFound + } + if len(quorums.Quorums) <= int(request.QuorumId) { + return nil, types.ErrQuorumIdOutOfBound + } + signers := quorums.Quorums[request.QuorumId].Signers + if len(signers) <= int(request.RowIndex) { + return nil, types.ErrRowIndexOutOfBound + } + return &types.QueryEpochQuorumRowResponse{Signer: signers[request.RowIndex]}, nil +} + func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggregatePubkeyG1Request) (*types.QueryAggregatePubkeyG1Response, error) { ctx := sdk.UnwrapSDKContext(c) quorums, found := k.GetEpochQuorums(ctx, request.EpochNumber) diff --git a/x/dasigners/v1/types/errors.go b/x/dasigners/v1/types/errors.go index 0fdcb2b5..0a421941 100644 --- a/x/dasigners/v1/types/errors.go +++ b/x/dasigners/v1/types/errors.go @@ -11,4 +11,5 @@ var ( ErrQuorumIdOutOfBound = errorsmod.Register(ModuleName, 6, "quorum id out of bound") ErrQuorumBitmapLengthMismatch = errorsmod.Register(ModuleName, 7, "quorum bitmap length mismatch") ErrInsufficientBonded = errorsmod.Register(ModuleName, 8, "insufficient bonded amount") + ErrRowIndexOutOfBound = errorsmod.Register(ModuleName, 9, "row index out of bound") ) diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index 686adac3..0515758d 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -18,9 +18,8 @@ func DefaultGenesisState() *GenesisState { TokensPerVote: 10, MaxVotesPerSigner: 1024, MaxQuorums: 10, - // EpochBlocks: 5760, - EpochBlocks: 20, - EncodedSlices: 3072, + EpochBlocks: 5760, + EncodedSlices: 3072, }, 0, make([]*Signer, 0), []*Quorums{{ Quorums: make([]*Quorum, 0), }}) diff --git a/x/dasigners/v1/types/query.pb.go b/x/dasigners/v1/types/query.pb.go index 84f44e35..bce3b2c4 100644 --- a/x/dasigners/v1/types/query.pb.go +++ b/x/dasigners/v1/types/query.pb.go @@ -328,6 +328,82 @@ func (m *QueryEpochQuorumResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEpochQuorumResponse proto.InternalMessageInfo +type QueryEpochQuorumRowRequest struct { + EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + QuorumId uint64 `protobuf:"varint,2,opt,name=quorum_id,json=quorumId,proto3" json:"quorum_id,omitempty"` + RowIndex uint32 `protobuf:"varint,3,opt,name=row_index,json=rowIndex,proto3" json:"row_index,omitempty"` +} + +func (m *QueryEpochQuorumRowRequest) Reset() { *m = QueryEpochQuorumRowRequest{} } +func (m *QueryEpochQuorumRowRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEpochQuorumRowRequest) ProtoMessage() {} +func (*QueryEpochQuorumRowRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{8} +} +func (m *QueryEpochQuorumRowRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEpochQuorumRowRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEpochQuorumRowRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryEpochQuorumRowRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochQuorumRowRequest.Merge(m, src) +} +func (m *QueryEpochQuorumRowRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEpochQuorumRowRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochQuorumRowRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEpochQuorumRowRequest proto.InternalMessageInfo + +type QueryEpochQuorumRowResponse struct { + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *QueryEpochQuorumRowResponse) Reset() { *m = QueryEpochQuorumRowResponse{} } +func (m *QueryEpochQuorumRowResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEpochQuorumRowResponse) ProtoMessage() {} +func (*QueryEpochQuorumRowResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_991a610b84b5964c, []int{9} +} +func (m *QueryEpochQuorumRowResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEpochQuorumRowResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEpochQuorumRowResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryEpochQuorumRowResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochQuorumRowResponse.Merge(m, src) +} +func (m *QueryEpochQuorumRowResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEpochQuorumRowResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochQuorumRowResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEpochQuorumRowResponse proto.InternalMessageInfo + type QueryAggregatePubkeyG1Request struct { EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` QuorumId uint64 `protobuf:"varint,2,opt,name=quorum_id,json=quorumId,proto3" json:"quorum_id,omitempty"` @@ -338,7 +414,7 @@ func (m *QueryAggregatePubkeyG1Request) Reset() { *m = QueryAggregatePub func (m *QueryAggregatePubkeyG1Request) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePubkeyG1Request) ProtoMessage() {} func (*QueryAggregatePubkeyG1Request) Descriptor() ([]byte, []int) { - return fileDescriptor_991a610b84b5964c, []int{8} + return fileDescriptor_991a610b84b5964c, []int{10} } func (m *QueryAggregatePubkeyG1Request) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -377,7 +453,7 @@ func (m *QueryAggregatePubkeyG1Response) Reset() { *m = QueryAggregatePu func (m *QueryAggregatePubkeyG1Response) String() string { return proto.CompactTextString(m) } func (*QueryAggregatePubkeyG1Response) ProtoMessage() {} func (*QueryAggregatePubkeyG1Response) Descriptor() ([]byte, []int) { - return fileDescriptor_991a610b84b5964c, []int{9} + return fileDescriptor_991a610b84b5964c, []int{11} } func (m *QueryAggregatePubkeyG1Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -415,6 +491,8 @@ func init() { proto.RegisterType((*QueryQuorumCountResponse)(nil), "zgc.dasigners.v1.QueryQuorumCountResponse") proto.RegisterType((*QueryEpochQuorumRequest)(nil), "zgc.dasigners.v1.QueryEpochQuorumRequest") proto.RegisterType((*QueryEpochQuorumResponse)(nil), "zgc.dasigners.v1.QueryEpochQuorumResponse") + proto.RegisterType((*QueryEpochQuorumRowRequest)(nil), "zgc.dasigners.v1.QueryEpochQuorumRowRequest") + proto.RegisterType((*QueryEpochQuorumRowResponse)(nil), "zgc.dasigners.v1.QueryEpochQuorumRowResponse") proto.RegisterType((*QueryAggregatePubkeyG1Request)(nil), "zgc.dasigners.v1.QueryAggregatePubkeyG1Request") proto.RegisterType((*QueryAggregatePubkeyG1Response)(nil), "zgc.dasigners.v1.QueryAggregatePubkeyG1Response") } @@ -422,49 +500,54 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/query.proto", fileDescriptor_991a610b84b5964c) } var fileDescriptor_991a610b84b5964c = []byte{ - // 658 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x4f, 0xd4, 0x4e, - 0x18, 0xde, 0xf2, 0x2f, 0x30, 0xf0, 0x4b, 0x60, 0x20, 0xa1, 0xdb, 0x1f, 0x94, 0xb5, 0x82, 0x41, - 0xe3, 0x76, 0xba, 0x78, 0xd5, 0x83, 0x18, 0x43, 0x4c, 0xd4, 0x48, 0x3d, 0xe9, 0x65, 0x33, 0x2d, - 0xe3, 0x6c, 0x23, 0xed, 0x74, 0xb7, 0x53, 0x02, 0x1c, 0x8d, 0x37, 0x2f, 0x26, 0x7e, 0x05, 0x3f, - 0x0c, 0x47, 0x12, 0x2f, 0x1e, 0x15, 0xfc, 0x20, 0x66, 0x67, 0xa6, 0xdb, 0x2d, 0xdd, 0x2e, 0x7b, - 0xf0, 0x36, 0xf3, 0xbe, 0xef, 0xf3, 0x3e, 0xcf, 0x3c, 0x3c, 0x74, 0xc1, 0xc6, 0x39, 0xf5, 0xd1, - 0x11, 0x4e, 0x02, 0x1a, 0x91, 0x5e, 0x82, 0x4e, 0x5a, 0xa8, 0x9b, 0x92, 0xde, 0x99, 0x1d, 0xf7, - 0x18, 0x67, 0x70, 0xf9, 0x9c, 0xfa, 0xf6, 0xa0, 0x6b, 0x9f, 0xb4, 0x8c, 0xba, 0xcf, 0x92, 0x90, - 0x25, 0x6d, 0xd1, 0x47, 0xf2, 0x22, 0x87, 0x8d, 0x35, 0xca, 0x28, 0x93, 0xf5, 0xfe, 0x49, 0x55, - 0x37, 0x28, 0x63, 0xf4, 0x98, 0x20, 0x1c, 0x07, 0x08, 0x47, 0x11, 0xe3, 0x98, 0x07, 0x2c, 0xca, - 0x30, 0x75, 0xd5, 0x15, 0x37, 0x2f, 0xfd, 0x80, 0x70, 0xa4, 0xb8, 0x8d, 0xad, 0x9b, 0x2d, 0x1e, - 0x84, 0x24, 0xe1, 0x38, 0x8c, 0xd5, 0x40, 0xa3, 0x24, 0x3d, 0x57, 0x2a, 0x26, 0x2c, 0x07, 0xc0, - 0xc3, 0xfe, 0x6b, 0xde, 0x8a, 0xaa, 0x4b, 0xba, 0x29, 0x49, 0x38, 0x34, 0xc0, 0x3c, 0xf6, 0x7d, - 0x96, 0x46, 0x3c, 0xd1, 0xb5, 0xc6, 0xf4, 0xee, 0x82, 0x3b, 0xb8, 0x5b, 0x07, 0x60, 0xb5, 0x80, - 0x48, 0x62, 0x16, 0x25, 0x04, 0x3a, 0x60, 0x4e, 0x6e, 0x16, 0x80, 0xc5, 0x3d, 0xdd, 0xbe, 0x69, - 0x8c, 0xad, 0x10, 0x6a, 0xce, 0xaa, 0x83, 0x75, 0xb1, 0xe8, 0x79, 0xcc, 0xfc, 0xce, 0xeb, 0x34, - 0xf4, 0x06, 0xfc, 0xd6, 0x13, 0xa0, 0x97, 0x5b, 0x8a, 0xe8, 0x0e, 0x58, 0x22, 0xfd, 0x72, 0x3b, - 0x12, 0x75, 0x5d, 0x6b, 0x68, 0xbb, 0x33, 0xee, 0x22, 0xc9, 0x47, 0xad, 0xc7, 0x6a, 0xf3, 0x61, - 0xca, 0x7a, 0x69, 0xf8, 0xac, 0xaf, 0x3b, 0x7b, 0xd9, 0x04, 0xe8, 0x8c, 0xbc, 0x80, 0xce, 0xc9, - 0xbb, 0xa2, 0xdc, 0x16, 0x6e, 0x64, 0xf0, 0x6e, 0x3e, 0x6a, 0xbd, 0x1b, 0x7e, 0x96, 0xdc, 0x31, - 0x39, 0x39, 0xfc, 0x1f, 0x2c, 0x28, 0x82, 0xe0, 0x48, 0x9f, 0x12, 0xfd, 0x79, 0x59, 0x78, 0x71, - 0x64, 0xbd, 0x1c, 0xb6, 0x25, 0x5b, 0x9d, 0xfb, 0x2f, 0xe7, 0xc4, 0xd6, 0x91, 0xfe, 0x2b, 0x84, - 0x9a, 0xb3, 0x3e, 0x6b, 0x60, 0x53, 0xac, 0x7b, 0x4a, 0x69, 0x8f, 0x50, 0xcc, 0xc9, 0x9b, 0xd4, - 0xfb, 0x48, 0xce, 0x0e, 0x5a, 0xff, 0x48, 0x2f, 0xbc, 0x0b, 0xfe, 0x53, 0x4d, 0x2f, 0xe0, 0x21, - 0x8e, 0xf5, 0xe9, 0x86, 0xb6, 0xbb, 0xe4, 0x2a, 0x0b, 0xf7, 0x45, 0xcd, 0x3a, 0x05, 0x66, 0x95, - 0x0a, 0xf5, 0x34, 0x1b, 0xac, 0xe2, 0xac, 0xd9, 0x8e, 0x45, 0xb7, 0x4d, 0x5b, 0x42, 0xcd, 0x92, - 0xbb, 0x82, 0x6f, 0xe2, 0xe0, 0x1a, 0x98, 0xe5, 0x8c, 0xe3, 0x63, 0xa5, 0x47, 0x5e, 0xe0, 0x32, - 0x98, 0xee, 0x04, 0x5c, 0x48, 0x98, 0x71, 0xfb, 0xc7, 0xbd, 0xcb, 0x59, 0x30, 0x2b, 0xa8, 0xe1, - 0x17, 0x0d, 0x2c, 0x0e, 0x65, 0x0d, 0xde, 0x1f, 0x65, 0xde, 0xc8, 0xa8, 0x1a, 0x0f, 0x26, 0x19, - 0x95, 0x0f, 0xb1, 0x76, 0x3e, 0xfd, 0xf8, 0xf3, 0x6d, 0x6a, 0x0b, 0x6e, 0x22, 0x87, 0x16, 0xff, - 0x2d, 0x85, 0xa5, 0x4d, 0x69, 0xb3, 0x50, 0x33, 0x14, 0xbe, 0x4a, 0x35, 0xe5, 0x78, 0x57, 0xaa, - 0x19, 0x91, 0xe5, 0x31, 0x6a, 0xe4, 0xdf, 0xa7, 0x29, 0x22, 0x9e, 0x7b, 0x23, 0x77, 0x8c, 0xf7, - 0xa6, 0x90, 0xf7, 0xf1, 0xde, 0x14, 0xf3, 0x7b, 0xab, 0x37, 0x52, 0x13, 0xfc, 0xae, 0x81, 0x95, - 0x52, 0x52, 0x20, 0xaa, 0x20, 0xaa, 0x4a, 0xb6, 0xe1, 0x4c, 0x0e, 0x50, 0xfa, 0x1e, 0x0a, 0x7d, - 0xf7, 0xe0, 0x76, 0x49, 0xdf, 0x20, 0x80, 0x4d, 0x99, 0xcd, 0x26, 0x6d, 0xc1, 0x13, 0x30, 0x27, - 0xbf, 0x76, 0x70, 0xbb, 0x82, 0xa9, 0xf0, 0xc1, 0x35, 0x76, 0x6e, 0x99, 0x52, 0x22, 0xb6, 0x84, - 0x88, 0x3a, 0x5c, 0x2f, 0x89, 0x90, 0xc7, 0xfd, 0x57, 0x17, 0xbf, 0xcd, 0xda, 0xc5, 0x95, 0xa9, - 0x5d, 0x5e, 0x99, 0xda, 0xaf, 0x2b, 0x53, 0xfb, 0x7a, 0x6d, 0xd6, 0x2e, 0xaf, 0xcd, 0xda, 0xcf, - 0x6b, 0xb3, 0xf6, 0x1e, 0xd1, 0x80, 0x77, 0x52, 0xcf, 0xf6, 0x59, 0x88, 0x1c, 0x7a, 0x8c, 0xbd, - 0x04, 0x39, 0xb4, 0xe9, 0x77, 0x70, 0x10, 0xa1, 0xd3, 0xe2, 0x3e, 0x7e, 0x16, 0x93, 0xc4, 0x9b, - 0x13, 0x3f, 0x12, 0x8f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x8c, 0xd5, 0xcf, 0x03, 0x07, - 0x00, 0x00, + // 737 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xcb, 0x4e, 0xdb, 0x4a, + 0x18, 0xc7, 0x63, 0x2e, 0x11, 0x0c, 0x70, 0x04, 0x03, 0x3a, 0x24, 0x06, 0x4c, 0x30, 0x70, 0x14, + 0x8e, 0x48, 0x9c, 0x50, 0x75, 0xd7, 0x2e, 0x4a, 0x55, 0x21, 0xa4, 0xb6, 0x2a, 0xee, 0xaa, 0xdd, + 0x44, 0x63, 0x67, 0x3a, 0xb1, 0x8a, 0x3d, 0x8e, 0x3d, 0x26, 0x84, 0x65, 0xd5, 0x5d, 0x37, 0x95, + 0xba, 0xe9, 0x03, 0xf4, 0x61, 0x58, 0x22, 0x75, 0xd3, 0x65, 0x0b, 0xdd, 0xf5, 0x25, 0x2a, 0xcf, + 0x4c, 0x2e, 0xc6, 0x49, 0xc8, 0x82, 0x9d, 0xe7, 0xbb, 0xfe, 0xbe, 0xcf, 0xf3, 0xb7, 0xc1, 0xfa, + 0x05, 0xb1, 0x8d, 0x3a, 0x0a, 0x1d, 0xe2, 0xe1, 0x20, 0x34, 0xce, 0xaa, 0x46, 0x33, 0xc2, 0x41, + 0xbb, 0xec, 0x07, 0x94, 0x51, 0xb8, 0x78, 0x41, 0xec, 0x72, 0xd7, 0x5b, 0x3e, 0xab, 0xaa, 0x79, + 0x9b, 0x86, 0x2e, 0x0d, 0x6b, 0xdc, 0x6f, 0x88, 0x83, 0x08, 0x56, 0x57, 0x08, 0x25, 0x54, 0xd8, + 0xe3, 0x27, 0x69, 0x5d, 0x27, 0x94, 0x92, 0x53, 0x6c, 0x20, 0xdf, 0x31, 0x90, 0xe7, 0x51, 0x86, + 0x98, 0x43, 0xbd, 0x4e, 0x4e, 0x5e, 0x7a, 0xf9, 0xc9, 0x8a, 0xde, 0x19, 0xc8, 0x93, 0xbd, 0xd5, + 0xcd, 0xdb, 0x2e, 0xe6, 0xb8, 0x38, 0x64, 0xc8, 0xf5, 0x65, 0x40, 0x21, 0x85, 0xde, 0x23, 0xe5, + 0x11, 0x7a, 0x05, 0xc0, 0x93, 0x78, 0x9a, 0xd7, 0xdc, 0x6a, 0xe2, 0x66, 0x84, 0x43, 0x06, 0x55, + 0x30, 0x83, 0x6c, 0x9b, 0x46, 0x1e, 0x0b, 0x73, 0x4a, 0x61, 0xb2, 0x38, 0x6b, 0x76, 0xcf, 0xfa, + 0x11, 0x58, 0x4e, 0x64, 0x84, 0x3e, 0xf5, 0x42, 0x0c, 0x2b, 0x20, 0x2b, 0x2a, 0xf3, 0x84, 0xb9, + 0x83, 0x5c, 0xf9, 0xf6, 0x62, 0xca, 0x32, 0x43, 0xc6, 0xe9, 0x79, 0xb0, 0xca, 0x0b, 0x3d, 0xf3, + 0xa9, 0xdd, 0x78, 0x19, 0xb9, 0x56, 0xb7, 0xbf, 0xfe, 0x18, 0xe4, 0xd2, 0x2e, 0xd9, 0x68, 0x0b, + 0xcc, 0xe3, 0xd8, 0x5c, 0xf3, 0xb8, 0x3d, 0xa7, 0x14, 0x94, 0xe2, 0x94, 0x39, 0x87, 0x7b, 0xa1, + 0xfa, 0x23, 0x59, 0xf9, 0x24, 0xa2, 0x41, 0xe4, 0x3e, 0x8d, 0xb9, 0x3b, 0x93, 0x8d, 0x91, 0xdd, + 0x69, 0x9e, 0xc8, 0xee, 0x35, 0x6f, 0x72, 0x73, 0x8d, 0x6f, 0xa3, 0x93, 0xde, 0xec, 0x85, 0xea, + 0x6f, 0xfa, 0xc7, 0x12, 0x35, 0xc6, 0x6f, 0x0e, 0xd7, 0xc0, 0xac, 0x6c, 0xe0, 0xd4, 0x73, 0x13, + 0xdc, 0x3f, 0x23, 0x0c, 0xc7, 0x75, 0xfd, 0x79, 0xff, 0x5a, 0x3a, 0xa5, 0x7b, 0xfb, 0x17, 0x71, + 0xbc, 0xea, 0xc0, 0xfd, 0xcb, 0x0c, 0x19, 0xa7, 0xb7, 0x81, 0x9a, 0xaa, 0x46, 0x5b, 0xf7, 0xc4, + 0x1a, 0x3b, 0x03, 0xda, 0xaa, 0x39, 0x5e, 0x1d, 0x9f, 0xe7, 0x26, 0x0b, 0x4a, 0x71, 0xc1, 0x9c, + 0x09, 0x68, 0xeb, 0x38, 0x3e, 0xeb, 0x0f, 0xc1, 0xda, 0xc0, 0xd6, 0x72, 0x96, 0x7f, 0xfb, 0xee, + 0x92, 0x52, 0x9c, 0xed, 0xde, 0x98, 0x8f, 0x0a, 0xd8, 0xe0, 0x79, 0x4f, 0x08, 0x09, 0x30, 0x41, + 0x0c, 0xbf, 0x8a, 0xac, 0xf7, 0xb8, 0x7d, 0x54, 0xbd, 0x2f, 0xea, 0x6d, 0xb0, 0x20, 0x9d, 0x96, + 0xc3, 0x5c, 0xe4, 0x73, 0xf2, 0x79, 0x53, 0xbe, 0xf4, 0x43, 0x6e, 0xd3, 0xcf, 0x81, 0x36, 0x8c, + 0x42, 0x0e, 0x50, 0x06, 0xcb, 0xa8, 0xe3, 0xac, 0xf9, 0xdc, 0x5b, 0x23, 0x55, 0x4e, 0x33, 0x6f, + 0x2e, 0xa1, 0xdb, 0x79, 0x70, 0x05, 0x4c, 0x33, 0xca, 0xd0, 0xa9, 0xe4, 0x11, 0x07, 0xb8, 0x08, + 0x26, 0x1b, 0x0e, 0xe3, 0x08, 0x53, 0x66, 0xfc, 0x78, 0xf0, 0x27, 0x0b, 0xa6, 0x79, 0x6b, 0xf8, + 0x49, 0x01, 0x73, 0x7d, 0xea, 0x80, 0x7b, 0x83, 0x5e, 0xf7, 0x40, 0x71, 0xa9, 0xff, 0x8f, 0x13, + 0x2a, 0x06, 0xd1, 0x77, 0x3f, 0x7c, 0xff, 0xfd, 0x65, 0x62, 0x13, 0x6e, 0x18, 0x15, 0x92, 0xfc, + 0x90, 0xf0, 0x95, 0x96, 0xc4, 0x9a, 0x39, 0x4d, 0x9f, 0x5c, 0x86, 0xd2, 0xa4, 0x05, 0x39, 0x94, + 0x66, 0x80, 0xfa, 0x46, 0xd0, 0x88, 0xf7, 0x53, 0xe2, 0xa2, 0xec, 0xed, 0x46, 0xd4, 0x18, 0xbd, + 0x9b, 0x84, 0x42, 0x47, 0xef, 0x26, 0xa9, 0xb8, 0x3b, 0x77, 0x23, 0x98, 0xe0, 0x57, 0x05, 0xfc, + 0x93, 0xbc, 0xe7, 0x70, 0x7f, 0x8c, 0x2e, 0x5d, 0x25, 0xaa, 0xa5, 0x31, 0xa3, 0x25, 0xd6, 0x1e, + 0xc7, 0xda, 0x86, 0x5b, 0x23, 0xb1, 0x4a, 0x01, 0x6d, 0xc1, 0x6f, 0x0a, 0x58, 0x4a, 0x5d, 0x62, + 0x68, 0x0c, 0xe9, 0x37, 0x4c, 0x74, 0x6a, 0x65, 0xfc, 0x04, 0xc9, 0xb8, 0xcf, 0x19, 0xff, 0x83, + 0x3b, 0x29, 0xc6, 0xae, 0x36, 0x4a, 0x42, 0x36, 0x25, 0x52, 0x85, 0x67, 0x20, 0x2b, 0x7e, 0x1d, + 0x70, 0x67, 0x48, 0xa7, 0xc4, 0xdf, 0x4b, 0xdd, 0xbd, 0x23, 0x4a, 0x42, 0x6c, 0x72, 0x88, 0x3c, + 0x5c, 0x4d, 0x41, 0x88, 0xc7, 0xc3, 0x17, 0x97, 0xbf, 0xb4, 0xcc, 0xe5, 0xb5, 0xa6, 0x5c, 0x5d, + 0x6b, 0xca, 0xcf, 0x6b, 0x4d, 0xf9, 0x7c, 0xa3, 0x65, 0xae, 0x6e, 0xb4, 0xcc, 0x8f, 0x1b, 0x2d, + 0xf3, 0xd6, 0x20, 0x0e, 0x6b, 0x44, 0x56, 0xd9, 0xa6, 0xae, 0x51, 0x21, 0xa7, 0xc8, 0x0a, 0x8d, + 0x0a, 0x29, 0xd9, 0x0d, 0xe4, 0x78, 0xc6, 0x79, 0xb2, 0x1e, 0x6b, 0xfb, 0x38, 0xb4, 0xb2, 0xfc, + 0x8f, 0xfb, 0xe0, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x50, 0x33, 0x8a, 0x50, 0x08, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -482,6 +565,7 @@ type QueryClient interface { EpochNumber(ctx context.Context, in *QueryEpochNumberRequest, opts ...grpc.CallOption) (*QueryEpochNumberResponse, error) QuorumCount(ctx context.Context, in *QueryQuorumCountRequest, opts ...grpc.CallOption) (*QueryQuorumCountResponse, error) EpochQuorum(ctx context.Context, in *QueryEpochQuorumRequest, opts ...grpc.CallOption) (*QueryEpochQuorumResponse, error) + EpochQuorumRow(ctx context.Context, in *QueryEpochQuorumRowRequest, opts ...grpc.CallOption) (*QueryEpochQuorumRowResponse, error) AggregatePubkeyG1(ctx context.Context, in *QueryAggregatePubkeyG1Request, opts ...grpc.CallOption) (*QueryAggregatePubkeyG1Response, error) Signer(ctx context.Context, in *QuerySignerRequest, opts ...grpc.CallOption) (*QuerySignerResponse, error) } @@ -521,6 +605,15 @@ func (c *queryClient) EpochQuorum(ctx context.Context, in *QueryEpochQuorumReque return out, nil } +func (c *queryClient) EpochQuorumRow(ctx context.Context, in *QueryEpochQuorumRowRequest, opts ...grpc.CallOption) (*QueryEpochQuorumRowResponse, error) { + out := new(QueryEpochQuorumRowResponse) + err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/EpochQuorumRow", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) AggregatePubkeyG1(ctx context.Context, in *QueryAggregatePubkeyG1Request, opts ...grpc.CallOption) (*QueryAggregatePubkeyG1Response, error) { out := new(QueryAggregatePubkeyG1Response) err := c.cc.Invoke(ctx, "/zgc.dasigners.v1.Query/AggregatePubkeyG1", in, out, opts...) @@ -544,6 +637,7 @@ type QueryServer interface { EpochNumber(context.Context, *QueryEpochNumberRequest) (*QueryEpochNumberResponse, error) QuorumCount(context.Context, *QueryQuorumCountRequest) (*QueryQuorumCountResponse, error) EpochQuorum(context.Context, *QueryEpochQuorumRequest) (*QueryEpochQuorumResponse, error) + EpochQuorumRow(context.Context, *QueryEpochQuorumRowRequest) (*QueryEpochQuorumRowResponse, error) AggregatePubkeyG1(context.Context, *QueryAggregatePubkeyG1Request) (*QueryAggregatePubkeyG1Response, error) Signer(context.Context, *QuerySignerRequest) (*QuerySignerResponse, error) } @@ -561,6 +655,9 @@ func (*UnimplementedQueryServer) QuorumCount(ctx context.Context, req *QueryQuor func (*UnimplementedQueryServer) EpochQuorum(ctx context.Context, req *QueryEpochQuorumRequest) (*QueryEpochQuorumResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EpochQuorum not implemented") } +func (*UnimplementedQueryServer) EpochQuorumRow(ctx context.Context, req *QueryEpochQuorumRowRequest) (*QueryEpochQuorumRowResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EpochQuorumRow not implemented") +} func (*UnimplementedQueryServer) AggregatePubkeyG1(ctx context.Context, req *QueryAggregatePubkeyG1Request) (*QueryAggregatePubkeyG1Response, error) { return nil, status.Errorf(codes.Unimplemented, "method AggregatePubkeyG1 not implemented") } @@ -626,6 +723,24 @@ func _Query_EpochQuorum_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_EpochQuorumRow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEpochQuorumRowRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EpochQuorumRow(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.dasigners.v1.Query/EpochQuorumRow", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EpochQuorumRow(ctx, req.(*QueryEpochQuorumRowRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_AggregatePubkeyG1_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryAggregatePubkeyG1Request) if err := dec(in); err != nil { @@ -678,6 +793,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "EpochQuorum", Handler: _Query_EpochQuorum_Handler, }, + { + MethodName: "EpochQuorumRow", + Handler: _Query_EpochQuorumRow_Handler, + }, { MethodName: "AggregatePubkeyG1", Handler: _Query_AggregatePubkeyG1_Handler, @@ -935,6 +1054,74 @@ func (m *QueryEpochQuorumResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryEpochQuorumRowRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEpochQuorumRowRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEpochQuorumRowRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RowIndex != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.RowIndex)) + i-- + dAtA[i] = 0x18 + } + if m.QuorumId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.QuorumId)) + i-- + dAtA[i] = 0x10 + } + if m.EpochNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EpochNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEpochQuorumRowResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEpochQuorumRowResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEpochQuorumRowResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *QueryAggregatePubkeyG1Request) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1129,6 +1316,37 @@ func (m *QueryEpochQuorumResponse) Size() (n int) { return n } +func (m *QueryEpochQuorumRowRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNumber != 0 { + n += 1 + sovQuery(uint64(m.EpochNumber)) + } + if m.QuorumId != 0 { + n += 1 + sovQuery(uint64(m.QuorumId)) + } + if m.RowIndex != 0 { + n += 1 + sovQuery(uint64(m.RowIndex)) + } + return n +} + +func (m *QueryEpochQuorumRowResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryAggregatePubkeyG1Request) Size() (n int) { if m == nil { return 0 @@ -1770,6 +1988,195 @@ func (m *QueryEpochQuorumResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryEpochQuorumRowRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEpochQuorumRowRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEpochQuorumRowRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumber", wireType) + } + m.EpochNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QuorumId", wireType) + } + m.QuorumId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QuorumId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowIndex", wireType) + } + m.RowIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowIndex |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEpochQuorumRowResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEpochQuorumRowResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEpochQuorumRowResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryAggregatePubkeyG1Request) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/dasigners/v1/types/query.pb.gw.go b/x/dasigners/v1/types/query.pb.gw.go index c4e13717..45045cd1 100644 --- a/x/dasigners/v1/types/query.pb.gw.go +++ b/x/dasigners/v1/types/query.pb.gw.go @@ -123,6 +123,42 @@ func local_request_Query_EpochQuorum_0(ctx context.Context, marshaler runtime.Ma } +var ( + filter_Query_EpochQuorumRow_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_EpochQuorumRow_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochQuorumRowRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochQuorumRow_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EpochQuorumRow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EpochQuorumRow_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochQuorumRowRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochQuorumRow_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EpochQuorumRow(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_AggregatePubkeyG1_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -270,6 +306,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_EpochQuorumRow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_EpochQuorumRow_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EpochQuorumRow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_AggregatePubkeyG1_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -417,6 +476,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_EpochQuorumRow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EpochQuorumRow_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EpochQuorumRow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_AggregatePubkeyG1_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -467,6 +546,8 @@ var ( pattern_Query_EpochQuorum_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-quorum"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_EpochQuorumRow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-quorum-row"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_AggregatePubkeyG1_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "aggregate-pubkey-g1"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Signer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "signer"}, "", runtime.AssumeColonVerbOpt(false))) @@ -479,6 +560,8 @@ var ( forward_Query_EpochQuorum_0 = runtime.ForwardResponseMessage + forward_Query_EpochQuorumRow_0 = runtime.ForwardResponseMessage + forward_Query_AggregatePubkeyG1_0 = runtime.ForwardResponseMessage forward_Query_Signer_0 = runtime.ForwardResponseMessage