From 875aed0c9a80ab4f2558d8a60a30fceab8bee170 Mon Sep 17 00:00:00 2001 From: Elad Gildnur <6321801+shleikes@users.noreply.github.com> Date: Sun, 26 May 2024 17:36:02 +0300 Subject: [PATCH 01/16] fix: PRT-1205: Support null ID in jsonrpc (#1445) * Handle "null" value for jsonrpc ID field * Add a case in cache tests for null id * IdFromRawMessage func to check for nil value * Small fixes for the protocol_test * Add integration test for null ID in jsonrpc and tendermintrpc * Revert "IdFromRawMessage func to check for nil value" This reverts commit 909c95d115c693a5f94b2952f0b545e0a1c1aa07. * Small lint fix * CR Fix: Add more test case and clean the code --- ecosystem/cache/cache_test.go | 81 +++++++++--- .../tendermintRPCMessage.go | 2 + protocol/integration/protocol_test.go | 117 +++++++++++++++++- 3 files changed, 183 insertions(+), 17 deletions(-) diff --git a/ecosystem/cache/cache_test.go b/ecosystem/cache/cache_test.go index 0500c4344d..6c1620038f 100644 --- a/ecosystem/cache/cache_test.go +++ b/ecosystem/cache/cache_test.go @@ -444,12 +444,15 @@ func TestCacheSetGetLatestWhenAdvancingLatest(t *testing.T) { func TestCacheSetGetJsonRPCWithID(t *testing.T) { t.Parallel() tests := []struct { - name string - valid bool - delay time.Duration - finalized bool - hash []byte + name string + valid bool + delay time.Duration + finalized bool + hash []byte + nullIdInGet bool + nullIdInSet bool }{ + // No null ID {name: "Finalized No Hash", valid: true, delay: time.Millisecond, finalized: true, hash: nil}, {name: "Finalized After delay No Hash", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: true, hash: nil}, {name: "NonFinalized No Hash", valid: true, delay: time.Millisecond, finalized: false, hash: nil}, @@ -458,6 +461,50 @@ func TestCacheSetGetJsonRPCWithID(t *testing.T) { {name: "Finalized After delay With Hash", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: true, hash: []byte{1, 2, 3}}, {name: "NonFinalized With Hash", valid: true, delay: time.Millisecond, finalized: false, hash: []byte{1, 2, 3}}, {name: "NonFinalized After delay With Hash", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: false, hash: []byte{1, 2, 3}}, + + // Null ID in get and set + {name: "Finalized No Hash, with null id in get and set", valid: true, delay: time.Millisecond, finalized: true, hash: nil, nullIdInGet: true, nullIdInSet: true}, + {name: "Finalized After delay No Hash, with null id in get and set", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: true, hash: nil, nullIdInGet: true, nullIdInSet: true}, + {name: "NonFinalized No Hash, with null id in get and set", valid: true, delay: time.Millisecond, finalized: false, hash: nil, nullIdInGet: true, nullIdInSet: true}, + {name: "NonFinalized After delay No Hash", valid: false, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: false, hash: nil, nullIdInGet: true, nullIdInSet: true}, + {name: "Finalized With Hash, with null id in get and set", valid: true, delay: time.Millisecond, finalized: true, hash: []byte{1, 2, 3}, nullIdInGet: true, nullIdInSet: true}, + {name: "Finalized After delay With Hash, with null id in get and set", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: true, hash: []byte{1, 2, 3}, nullIdInGet: true, nullIdInSet: true}, + {name: "NonFinalized With Hash, with null id in get and set", valid: true, delay: time.Millisecond, finalized: false, hash: []byte{1, 2, 3}, nullIdInGet: true, nullIdInSet: true}, + {name: "NonFinalized After delay With Hash, with null id in get and set", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: false, hash: []byte{1, 2, 3}, nullIdInGet: true, nullIdInSet: true}, + + // Null ID only in get + {name: "Finalized No Hash, with null id only in get", valid: true, delay: time.Millisecond, finalized: true, hash: nil, nullIdInGet: true}, + {name: "Finalized After delay No Hash, with null id only in get", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: true, hash: nil, nullIdInGet: true}, + {name: "NonFinalized No Hash, with null id only in get", valid: true, delay: time.Millisecond, finalized: false, hash: nil, nullIdInGet: true}, + {name: "NonFinalized After delay No Hash", valid: false, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: false, hash: nil, nullIdInGet: true}, + {name: "Finalized With Hash, with null id only in get", valid: true, delay: time.Millisecond, finalized: true, hash: []byte{1, 2, 3}, nullIdInGet: true}, + {name: "Finalized After delay With Hash, with null id only in get", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: true, hash: []byte{1, 2, 3}, nullIdInGet: true}, + {name: "NonFinalized With Hash, with null id only in get", valid: true, delay: time.Millisecond, finalized: false, hash: []byte{1, 2, 3}, nullIdInGet: true}, + {name: "NonFinalized After delay With Hash, with null id only in get", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: false, hash: []byte{1, 2, 3}, nullIdInGet: true}, + + // Null ID only in set + {name: "Finalized No Hash, with null id only in set", valid: true, delay: time.Millisecond, finalized: true, hash: nil, nullIdInSet: true}, + {name: "Finalized After delay No Hash, with null id only in set", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: true, hash: nil, nullIdInSet: true}, + {name: "NonFinalized No Hash, with null id only in set", valid: true, delay: time.Millisecond, finalized: false, hash: nil, nullIdInSet: true}, + {name: "NonFinalized After delay No Hash only in set", valid: false, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: false, hash: nil, nullIdInSet: true}, + {name: "Finalized With Hash, with null id only in set", valid: true, delay: time.Millisecond, finalized: true, hash: []byte{1, 2, 3}, nullIdInSet: true}, + {name: "Finalized After delay With Hash, with null id only in set", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: true, hash: []byte{1, 2, 3}, nullIdInSet: true}, + {name: "NonFinalized With Hash, with null id only in set", valid: true, delay: time.Millisecond, finalized: false, hash: []byte{1, 2, 3}, nullIdInSet: true}, + {name: "NonFinalized After delay With Hash, with null id only in set", valid: true, delay: cache.DefaultExpirationForNonFinalized + time.Millisecond, finalized: false, hash: []byte{1, 2, 3}, nullIdInSet: true}, + } + + formatIDInJson := func(idNum int64, nullId bool) []byte { + if nullId { + return []byte(`{"jsonrpc":"2.0","method":"status","params":[],"id":null}`) + } + return []byte(fmt.Sprintf(`{"jsonrpc":"2.0","method":"status","params":[],"id":%d}`, idNum)) + } + + formatIDInJsonResponse := func(idNum int64, nullId bool) []byte { + if nullId { + return []byte(`{"jsonrpc":"2.0","result":0x12345,"id":null}`) + } + return []byte(fmt.Sprintf(`{"jsonrpc":"2.0","result":0x12345,"id":%d}`, idNum)) } for _, tt := range tests { @@ -465,17 +512,12 @@ func TestCacheSetGetJsonRPCWithID(t *testing.T) { ctx, cacheServer := initTest() id := rand.Int63() - formatIDInJson := func(idNum int64) []byte { - return []byte(fmt.Sprintf(`{"jsonrpc":"2.0","method":"status","params":[],"id":%d}`, idNum)) - } - formatIDInJsonResponse := func(idNum int64) []byte { - return []byte(fmt.Sprintf(`{"jsonrpc":"2.0","result":0x12345,"id":%d}`, idNum)) - } - request := getRequest(1230, formatIDInJson(id), spectypes.APIInterfaceJsonRPC) // &pairingtypes.RelayRequest{ + request := getRequest(1230, formatIDInJson(id, tt.nullIdInSet), spectypes.APIInterfaceJsonRPC) // &pairingtypes.RelayRequest{ response := &pairingtypes.RelayReply{ - Data: formatIDInJsonResponse(id), // response has the old id when cached + Data: formatIDInJsonResponse(id, tt.nullIdInSet), // response has the old id when cached } + messageSet := pairingtypes.RelayCacheSet{ RequestHash: HashRequest(t, request, StubChainID), BlockHash: tt.hash, @@ -492,9 +534,9 @@ func TestCacheSetGetJsonRPCWithID(t *testing.T) { time.Sleep(tt.delay) // now to get it - changedID := id + 1 // now we change the ID: - request.Data = formatIDInJson(changedID) + changedID := id + 1 + request.Data = formatIDInJson(changedID, tt.nullIdInGet) hash, outputFormatter := HashRequestFormatter(t, request, StubChainID) messageGet := pairingtypes.RelayCacheGet{ RequestHash: hash, @@ -503,13 +545,20 @@ func TestCacheSetGetJsonRPCWithID(t *testing.T) { Finalized: tt.finalized, RequestedBlock: request.RequestBlock, } + cacheReply, err := cacheServer.GetRelay(ctx, &messageGet) if tt.valid { cacheReply.Reply.Data = outputFormatter(cacheReply.Reply.Data) require.NoError(t, err) + result := gjson.GetBytes(cacheReply.GetReply().Data, format.IDFieldName) extractedID := result.Raw - require.Equal(t, strconv.FormatInt(changedID, 10), extractedID) + + if tt.nullIdInGet { + require.Equal(t, "null", extractedID) + } else { + require.Equal(t, strconv.FormatInt(changedID, 10), extractedID) + } } else { require.Error(t, err) } diff --git a/protocol/chainlib/chainproxy/rpcInterfaceMessages/tendermintRPCMessage.go b/protocol/chainlib/chainproxy/rpcInterfaceMessages/tendermintRPCMessage.go index 0e6f3d6b59..efa93c30bf 100644 --- a/protocol/chainlib/chainproxy/rpcInterfaceMessages/tendermintRPCMessage.go +++ b/protocol/chainlib/chainproxy/rpcInterfaceMessages/tendermintRPCMessage.go @@ -104,6 +104,8 @@ func IdFromRawMessage(rawID json.RawMessage) (jsonrpcId, error) { case float64: // json.Unmarshal uses float64 for all numbers return JSONRPCIntID(int(id)), nil + case nil: + return jsonrpcId(nil), nil default: typ := reflect.TypeOf(id) return nil, utils.LavaFormatError("failed to unmarshal id not a string or float", err, []utils.Attribute{{Key: "id", Value: string(rawID)}, {Key: "id type", Value: typ}}...) diff --git a/protocol/integration/protocol_test.go b/protocol/integration/protocol_test.go index 0b12b6f22e..02dcf6b2c0 100644 --- a/protocol/integration/protocol_test.go +++ b/protocol/integration/protocol_test.go @@ -1,6 +1,7 @@ package integration_test import ( + "bytes" "context" "encoding/json" "fmt" @@ -11,6 +12,7 @@ import ( "time" "github.com/lavanet/lava/protocol/chainlib" + "github.com/lavanet/lava/protocol/chainlib/chainproxy/rpcInterfaceMessages" "github.com/lavanet/lava/protocol/chaintracker" "github.com/lavanet/lava/protocol/common" "github.com/lavanet/lava/protocol/lavaprotocol" @@ -189,6 +191,7 @@ func createRpcProvider(t *testing.T, ctx context.Context, consumerAddress string w.WriteHeader(status) fmt.Fprint(w, string(data)) }) + chainParser, chainRouter, chainFetcher, _, endpoint, err := chainlib.CreateChainLibMocks(ctx, specId, apiInterface, serverHandler, "../../", addons) require.NoError(t, err) require.NotNil(t, chainParser) @@ -240,7 +243,8 @@ func createRpcProvider(t *testing.T, ctx context.Context, consumerAddress string ConsistencyCallback: nil, Pmetrics: nil, } - mockChainFetcher := NewMockChainFetcher(1000, 10, nil) + + mockChainFetcher := NewMockChainFetcher(1000, int64(blocksToSaveChainTracker), nil) chainTracker, err := chaintracker.NewChainTracker(ctx, mockChainFetcher, chainTrackerConfig) require.NoError(t, err) reliabilityManager := reliabilitymanager.NewReliabilityManager(chainTracker, &mockProviderStateTracker, account.Addr.String(), chainRouter, chainParser) @@ -550,3 +554,114 @@ func TestConsumerProviderTx(t *testing.T) { }) } } + +func TestConsumerProviderJsonRpcWithNullID(t *testing.T) { + playbook := []struct { + name string + specId string + method string + expected string + apiInterface string + }{ + { + name: "jsonrpc", + specId: "ETH1", + method: "eth_blockNumber", + expected: `{"jsonrpc":"2.0","id":null,"result":{}}`, + apiInterface: spectypes.APIInterfaceJsonRPC, + }, + { + name: "tendermintrpc", + specId: "LAV1", + method: "status", + expected: `{"jsonrpc":"2.0","result":{}}`, + apiInterface: spectypes.APIInterfaceTendermintRPC, + }, + } + for _, play := range playbook { + t.Run(play.name, func(t *testing.T) { + ctx := context.Background() + // can be any spec and api interface + specId := play.specId + apiInterface := play.apiInterface + epoch := uint64(100) + requiredResponses := 1 + lavaChainID := "lava" + numProviders := 5 + + consumerListenAddress := addressGen.GetAddress() + pairingList := map[uint64]*lavasession.ConsumerSessionsWithProvider{} + type providerData struct { + account sigs.Account + endpoint *lavasession.RPCProviderEndpoint + server *rpcprovider.RPCProviderServer + replySetter *ReplySetter + mockChainFetcher *MockChainFetcher + } + providers := []providerData{} + + for i := 0; i < numProviders; i++ { + // providerListenAddress := "localhost:111" + strconv.Itoa(i) + account := sigs.GenerateDeterministicFloatingKey(randomizer) + providerDataI := providerData{account: account} + providers = append(providers, providerDataI) + } + consumerAccount := sigs.GenerateDeterministicFloatingKey(randomizer) + for i := 0; i < numProviders; i++ { + ctx := context.Background() + providerDataI := providers[i] + listenAddress := addressGen.GetAddress() + providers[i].server, providers[i].endpoint, providers[i].replySetter, providers[i].mockChainFetcher = createRpcProvider(t, ctx, consumerAccount.Addr.String(), specId, apiInterface, listenAddress, providerDataI.account, lavaChainID, []string(nil)) + providers[i].replySetter.replyDataBuf = []byte(fmt.Sprintf(`{"result": %d}`, i+1)) + } + for i := 0; i < numProviders; i++ { + pairingList[uint64(i)] = &lavasession.ConsumerSessionsWithProvider{ + PublicLavaAddress: providers[i].account.Addr.String(), + Endpoints: []*lavasession.Endpoint{ + { + NetworkAddress: providers[i].endpoint.NetworkAddress.Address, + Enabled: true, + Geolocation: 1, + }, + }, + Sessions: map[int64]*lavasession.SingleConsumerSession{}, + MaxComputeUnits: 10000, + UsedComputeUnits: 0, + PairingEpoch: epoch, + } + } + rpcconsumerServer := createRpcConsumer(t, ctx, specId, apiInterface, consumerAccount, consumerListenAddress, epoch, pairingList, requiredResponses, lavaChainID) + require.NotNil(t, rpcconsumerServer) + + for i := 0; i < numProviders; i++ { + handler := func(req []byte, header http.Header) (data []byte, status int) { + var jsonRpcMessage rpcInterfaceMessages.JsonrpcMessage + err := json.Unmarshal(req, &jsonRpcMessage) + require.NoError(t, err) + + response := fmt.Sprintf(`{"jsonrpc":"2.0","result": {}, "id": %v}`, string(jsonRpcMessage.ID)) + return []byte(response), http.StatusOK + } + providers[i].replySetter.handler = handler + } + + client := http.Client{Timeout: 500 * time.Millisecond} + jsonMsg := fmt.Sprintf(`{"jsonrpc":"2.0","method":"%v","params": [], "id":null}`, play.method) + msgBuffer := bytes.NewBuffer([]byte(jsonMsg)) + req, err := http.NewRequest(http.MethodPost, "http://"+consumerListenAddress, msgBuffer) + require.NoError(t, err) + req.Header.Set("Content-Type", "application/json") + + resp, err := client.Do(req) + require.NoError(t, err) + + bodyBytes, err := io.ReadAll(resp.Body) + require.NoError(t, err) + require.Equal(t, http.StatusOK, resp.StatusCode, string(bodyBytes)) + + resp.Body.Close() + + require.Equal(t, play.expected, string(bodyBytes)) + }) + } +} From c0a44cac1e78167e4a1a75b0c59f50c0af116ca3 Mon Sep 17 00:00:00 2001 From: oren-lava <111131399+oren-lava@users.noreply.github.com> Date: Mon, 27 May 2024 15:56:11 +0300 Subject: [PATCH 02/16] feat: CNS-955: add provider description and spec identity (#1433) * CNS-955: add description to stake entry * CNS-955: add description details flag * CNS-955: fix unit tests * CNS-955: stake entry migrator * CNS-955: add spec identity field * CNS-955: add staking proto to SDK protoc script * CNS-955: more sdk script fixes * CNS-955: even more fixes * cns-955: change migrator and bring back moniker field * CNS-955: validate description * CNS-955: PR fixes * CNS-955: small fix --------- Co-authored-by: Yaroms <103432884+Yaroms@users.noreply.github.com> --- .../lava-sdk/scripts/protoc_grpc_relay.sh | 9 + .../lava/epochstorage/stake_entry.proto | 3 + proto/lavanet/lava/pairing/tx.proto | 5 +- proto/lavanet/lava/spec/spec.proto | 1 + testutil/common/common.go | 7 +- testutil/common/tester.go | 32 +- x/dualstaking/keeper/delegate.go | 3 +- x/epochstorage/keeper/migrations.go | 65 +- x/epochstorage/module.go | 8 +- .../types/migrations/v6/endpoint.pb.go | 522 ++++++++ .../types/migrations/v6/stake_entry.pb.go | 1106 +++++++++++++++++ .../types/migrations/v6/stake_storage.pb.go | 438 +++++++ x/epochstorage/types/stake_entry.pb.go | 151 ++- x/pairing/client/cli/tx_modify_provider.go | 45 +- x/pairing/client/cli/tx_stake_provider.go | 87 +- x/pairing/keeper/grpc_query_provider.go | 1 + x/pairing/keeper/grpc_query_providers.go | 3 + x/pairing/keeper/helpers_test.go | 23 +- x/pairing/keeper/msg_server_stake_provider.go | 7 +- .../keeper/msg_server_stake_provider_test.go | 103 +- x/pairing/keeper/pairing_test.go | 19 +- x/pairing/keeper/staking.go | 23 +- x/pairing/keeper/unstaking.go | 6 +- x/pairing/types/errors.go | 3 +- x/pairing/types/message_stake_provider.go | 9 +- .../types/message_stake_provider_test.go | 12 +- x/pairing/types/tx.pb.go | 229 ++-- x/pairing/types/types.go | 5 +- x/spec/types/spec.go | 5 + x/spec/types/spec.pb.go | 147 ++- x/subscription/keeper/subscription_test.go | 4 +- 31 files changed, 2696 insertions(+), 385 deletions(-) create mode 100644 x/epochstorage/types/migrations/v6/endpoint.pb.go create mode 100644 x/epochstorage/types/migrations/v6/stake_entry.pb.go create mode 100644 x/epochstorage/types/migrations/v6/stake_storage.pb.go diff --git a/ecosystem/lava-sdk/scripts/protoc_grpc_relay.sh b/ecosystem/lava-sdk/scripts/protoc_grpc_relay.sh index 7889230274..b188943dad 100755 --- a/ecosystem/lava-sdk/scripts/protoc_grpc_relay.sh +++ b/ecosystem/lava-sdk/scripts/protoc_grpc_relay.sh @@ -53,12 +53,21 @@ protoc \ "$COSMOS_PROTO_DIR/gogoproto/gogo.proto" \ "$COSMOS_PROTO_DIR/google/protobuf/descriptor.proto" \ "$COSMOS_PROTO_DIR/google/protobuf/wrappers.proto" \ + "$COSMOS_PROTO_DIR/google/protobuf/timestamp.proto" \ "$COSMOS_PROTO_DIR/google/api/annotations.proto" \ "$COSMOS_PROTO_DIR/google/api/http.proto" \ "$COSMOS_PROTO_DIR/cosmos/base/query/v1beta1/pagination.proto" \ "$COSMOS_PROTO_DIR/cosmos/base/v1beta1/coin.proto" \ "$COSMOS_PROTO_DIR/cosmos_proto/cosmos.proto" \ "$COSMOS_PROTO_DIR/amino/amino.proto" \ + "$COSMOS_PROTO_DIR/cosmos/staking/v1beta1/staking.proto" \ + "$COSMOS_PROTO_DIR/tendermint/types/types.proto" \ + "$COSMOS_PROTO_DIR/tendermint/abci/types.proto" \ + "$COSMOS_PROTO_DIR/tendermint/crypto/proof.proto" \ + "$COSMOS_PROTO_DIR/tendermint/version/types.proto" \ + "$COSMOS_PROTO_DIR/tendermint/types/validator.proto" \ + "$COSMOS_PROTO_DIR/tendermint/crypto/keys.proto" \ + "$COSMOS_PROTO_DIR/tendermint/types/params.proto" \ # mv ./src/proto/test ./src/pairing/. # rm -rf ./src/proto diff --git a/proto/lavanet/lava/epochstorage/stake_entry.proto b/proto/lavanet/lava/epochstorage/stake_entry.proto index cbb4877023..cdc5797873 100644 --- a/proto/lavanet/lava/epochstorage/stake_entry.proto +++ b/proto/lavanet/lava/epochstorage/stake_entry.proto @@ -5,6 +5,8 @@ option go_package = "github.com/lavanet/lava/x/epochstorage/types"; import "lavanet/lava/epochstorage/endpoint.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/staking/v1beta1/staking.proto"; +import "amino/amino.proto"; message StakeEntry { reserved 7; @@ -21,6 +23,7 @@ message StakeEntry { uint64 last_change = 12; BlockReport block_report = 13; string vault = 14; + cosmos.staking.v1beta1.Description description = 15 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // BlockReport holds the most up-to-date info regarding blocks of the provider diff --git a/proto/lavanet/lava/pairing/tx.proto b/proto/lavanet/lava/pairing/tx.proto index b047684579..b4c92efb5e 100644 --- a/proto/lavanet/lava/pairing/tx.proto +++ b/proto/lavanet/lava/pairing/tx.proto @@ -6,6 +6,8 @@ import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "lavanet/lava/epochstorage/endpoint.proto"; import "lavanet/lava/pairing/relay.proto"; +import "cosmos/staking/v1beta1/staking.proto"; +import "amino/amino.proto"; option go_package = "github.com/lavanet/lava/x/pairing/types"; @@ -25,11 +27,12 @@ message MsgStakeProvider { cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; repeated lavanet.lava.epochstorage.Endpoint endpoints = 4 [(gogoproto.nullable) = false]; int32 geolocation = 5; - string moniker = 6; + reserved 6; cosmos.base.v1beta1.Coin delegate_limit = 7 [(gogoproto.nullable) = false]; uint64 delegate_commission = 8; // delegation commission (precentage 0-100) string validator = 9; string address = 10; + cosmos.staking.v1beta1.Description description = 11 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } message MsgStakeProviderResponse { diff --git a/proto/lavanet/lava/spec/spec.proto b/proto/lavanet/lava/spec/spec.proto index 1fb9a53402..5607691dd0 100644 --- a/proto/lavanet/lava/spec/spec.proto +++ b/proto/lavanet/lava/spec/spec.proto @@ -37,4 +37,5 @@ message Spec { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" ]; uint64 shares = 19; + string identity = 20; } diff --git a/testutil/common/common.go b/testutil/common/common.go index b7be360f7a..b84f0c9ee7 100644 --- a/testutil/common/common.go +++ b/testutil/common/common.go @@ -5,6 +5,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" testkeeper "github.com/lavanet/lava/testutil/keeper" "github.com/lavanet/lava/utils/sigs" conflicttypes "github.com/lavanet/lava/x/conflict/types" @@ -29,7 +30,7 @@ func StakeAccount(t *testing.T, ctx context.Context, keepers testkeeper.Keepers, for _, collection := range spec.ApiCollections { endpoints = append(endpoints, epochstoragetypes.Endpoint{IPPORT: "123", ApiInterfaces: []string{collection.CollectionData.ApiInterface}, Geolocation: 1}) } - _, err := servers.PairingServer.StakeProvider(ctx, &types.MsgStakeProvider{Creator: acc.Addr.String(), Address: acc.Addr.String(), ChainID: spec.Index, Amount: sdk.NewCoin(keepers.StakingKeeper.BondDenom(sdk.UnwrapSDKContext(ctx)), sdk.NewInt(stake)), Geolocation: 1, Endpoints: endpoints, Moniker: "prov", DelegateLimit: sdk.NewCoin(keepers.StakingKeeper.BondDenom(sdk.UnwrapSDKContext(ctx)), sdk.ZeroInt()), DelegateCommission: 100, Validator: sdk.ValAddress(validator.Addr).String()}) + _, err := servers.PairingServer.StakeProvider(ctx, &types.MsgStakeProvider{Creator: acc.Addr.String(), Address: acc.Addr.String(), ChainID: spec.Index, Amount: sdk.NewCoin(keepers.StakingKeeper.BondDenom(sdk.UnwrapSDKContext(ctx)), sdk.NewInt(stake)), Geolocation: 1, Endpoints: endpoints, DelegateLimit: sdk.NewCoin(keepers.StakingKeeper.BondDenom(sdk.UnwrapSDKContext(ctx)), sdk.ZeroInt()), DelegateCommission: 100, Validator: sdk.ValAddress(validator.Addr).String(), Description: MockDescription()}) require.NoError(t, err) } @@ -37,6 +38,10 @@ func BuySubscription(ctx context.Context, keepers testkeeper.Keepers, servers te servers.SubscriptionServer.Buy(ctx, &subscriptiontypes.MsgBuy{Creator: acc.Addr.String(), Consumer: acc.Addr.String(), Index: plan, Duration: 1}) } +func MockDescription() stakingtypes.Description { + return stakingtypes.NewDescription("prov", "iden", "web", "sec", "details") +} + func BuildRelayRequest(ctx context.Context, provider string, contentHash []byte, cuSum uint64, spec string, qos *types.QualityOfServiceReport) *types.RelaySession { return BuildRelayRequestWithBadge(ctx, provider, contentHash, uint64(1), cuSum, spec, qos, nil) } diff --git a/testutil/common/tester.go b/testutil/common/tester.go index 1d9a383895..a3901c0970 100644 --- a/testutil/common/tester.go +++ b/testutil/common/tester.go @@ -156,7 +156,8 @@ func (ts *Tester) AccountsMap() map[string]sigs.Account { } func (ts *Tester) StakeProvider(vault string, provider string, spec spectypes.Spec, amount int64) error { - return ts.StakeProviderExtra(vault, provider, spec, amount, nil, 0, "prov") + d := MockDescription() + return ts.StakeProviderExtra(vault, provider, spec, amount, nil, 0, d.Moniker, d.Identity, d.Website, d.SecurityContact, d.Details) } func (ts *Tester) StakeProviderExtra( @@ -167,6 +168,10 @@ func (ts *Tester) StakeProviderExtra( endpoints []epochstoragetypes.Endpoint, geoloc int32, moniker string, + identity string, + website string, + securityContact string, + descriptionDetails string, ) error { // if geoloc left zero, use default 1 if geoloc == 0 { @@ -192,7 +197,8 @@ func (ts *Tester) StakeProviderExtra( } stake := sdk.NewCoin(ts.TokenDenom(), sdk.NewInt(amount)) - _, err := ts.TxPairingStakeProvider(vault, provider, spec.Index, stake, endpoints, geoloc, moniker) + description := stakingtypes.NewDescription(moniker, identity, website, securityContact, descriptionDetails) + _, err := ts.TxPairingStakeProvider(vault, provider, spec.Index, stake, endpoints, geoloc, description) return err } @@ -566,7 +572,7 @@ func (ts *Tester) TxPairingStakeProvider( amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geoloc int32, - moniker string, + description stakingtypes.Description, ) (*pairingtypes.MsgStakeProviderResponse, error) { val, _ := ts.GetAccount(VALIDATOR, 0) msg := &pairingtypes.MsgStakeProvider{ @@ -576,10 +582,10 @@ func (ts *Tester) TxPairingStakeProvider( Amount: amount, Geolocation: geoloc, Endpoints: endpoints, - Moniker: moniker, DelegateLimit: sdk.NewCoin(ts.Keepers.StakingKeeper.BondDenom(ts.Ctx), sdk.ZeroInt()), DelegateCommission: 100, Address: provider, + Description: description, } return ts.Servers.PairingServer.StakeProvider(ts.GoCtx, msg) } @@ -592,9 +598,13 @@ func (ts *Tester) TxPairingStakeProviderFull( amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geoloc int32, - moniker string, commission uint64, delegateLimit uint64, + moniker string, + identity string, + website string, + securityContact string, + descriptionDetails string, ) (*pairingtypes.MsgStakeProviderResponse, error) { val, _ := ts.GetAccount(VALIDATOR, 0) // if geoloc left zero, use default 1 @@ -620,6 +630,8 @@ func (ts *Tester) TxPairingStakeProviderFull( } } + description := stakingtypes.NewDescription(moniker, identity, website, securityContact, descriptionDetails) + msg := &pairingtypes.MsgStakeProvider{ Creator: vault, Validator: sdk.ValAddress(val.Addr).String(), @@ -627,10 +639,10 @@ func (ts *Tester) TxPairingStakeProviderFull( Amount: amount, Geolocation: geoloc, Endpoints: endpoints, - Moniker: moniker, DelegateLimit: sdk.NewCoin(ts.Keepers.StakingKeeper.BondDenom(ts.Ctx), sdk.NewIntFromUint64(delegateLimit)), DelegateCommission: commission, Address: provider, + Description: description, } return ts.Servers.PairingServer.StakeProvider(ts.GoCtx, msg) } @@ -1160,7 +1172,13 @@ func (ts *Tester) SetupForTests(getToTopMostPath string, specId string, validato start = len(ts.Accounts(PROVIDER)) for i := 0; i < providers; i++ { acc, provider := ts.AddAccount(PROVIDER, start+i, balance) - err := ts.StakeProviderExtra(acc.GetVaultAddr(), provider, spec, spec.MinStakeProvider.Amount.Int64(), nil, 1, "prov"+strconv.Itoa(start+i)) + d := MockDescription() + moniker := d.Moniker + strconv.Itoa(start+i) + identity := d.Identity + strconv.Itoa(start+i) + website := d.Website + strconv.Itoa(start+i) + securityContact := d.SecurityContact + strconv.Itoa(start+i) + details := d.Details + strconv.Itoa(start+i) + err := ts.StakeProviderExtra(acc.GetVaultAddr(), provider, spec, spec.MinStakeProvider.Amount.Int64(), nil, 1, moniker, identity, website, securityContact, details) if err != nil { return err } diff --git a/x/dualstaking/keeper/delegate.go b/x/dualstaking/keeper/delegate.go index dfb7c47fdd..58a521c3f5 100644 --- a/x/dualstaking/keeper/delegate.go +++ b/x/dualstaking/keeper/delegate.go @@ -208,7 +208,8 @@ func (k Keeper) modifyStakeEntryDelegation(ctx sdk.Context, delegator, provider, "provider_vault": stakeEntry.Vault, "provider_provider": stakeEntry.Address, "chain_id": stakeEntry.Chain, - "moniker": stakeEntry.Moniker, + "moniker": stakeEntry.Description.Moniker, + "description": stakeEntry.Description.String(), "stake": stakeEntry.Stake.String(), "effective_stake": stakeEntry.EffectiveStake().String() + stakeEntry.Stake.Denom, } diff --git a/x/epochstorage/keeper/migrations.go b/x/epochstorage/keeper/migrations.go index 7301aa0baa..3a6180fcaa 100644 --- a/x/epochstorage/keeper/migrations.go +++ b/x/epochstorage/keeper/migrations.go @@ -9,7 +9,7 @@ import ( "github.com/lavanet/lava/x/epochstorage/types" v3 "github.com/lavanet/lava/x/epochstorage/types/migrations/v3" v4 "github.com/lavanet/lava/x/epochstorage/types/migrations/v4" - v5 "github.com/lavanet/lava/x/epochstorage/types/migrations/v5" + v6 "github.com/lavanet/lava/x/epochstorage/types/migrations/v6" ) type Migrator struct { @@ -141,57 +141,38 @@ func (m Migrator) Migrate5to6(ctx sdk.Context) error { defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var stakeStorageV5 v5.StakeStorage - m.keeper.cdc.MustUnmarshal(iterator.Value(), &stakeStorageV5) + var stakeStorageV6 v6.StakeStorage + m.keeper.cdc.MustUnmarshal(iterator.Value(), &stakeStorageV6) - stakeStorageV6 := types.StakeStorage{ - Index: stakeStorageV5.Index, - EpochBlockHash: stakeStorageV5.EpochBlockHash, + for i := range stakeStorageV6.StakeEntries { + stakeStorageV6.StakeEntries[i].Vault = stakeStorageV6.StakeEntries[i].Address } - var stakeEntriesV6 []types.StakeEntry - for _, stakeEntryV5 := range stakeStorageV5.StakeEntries { - stakeEntryV6 := types.StakeEntry{ - Stake: stakeEntryV5.Stake, - Address: stakeEntryV5.Address, - Vault: stakeEntryV5.Address, - StakeAppliedBlock: stakeEntryV5.StakeAppliedBlock, - Chain: stakeEntryV5.Chain, - Moniker: stakeEntryV5.Moniker, - Geolocation: stakeEntryV5.Geolocation, - DelegateTotal: stakeEntryV5.DelegateTotal, - DelegateLimit: stakeEntryV5.DelegateLimit, - DelegateCommission: stakeEntryV5.DelegateCommission, - LastChange: stakeEntryV5.LastChange, - } + store.Set(iterator.Key(), m.keeper.cdc.MustMarshal(&stakeStorageV6)) + } - blockReport := stakeEntryV5.BlockReport - stakeEntryV6.BlockReport = &types.BlockReport{ - Epoch: blockReport.Epoch, - LatestBlock: blockReport.LatestBlock, - } + return nil +} - var endpointsV6 []types.Endpoint - for _, endpointV5 := range stakeEntryV5.Endpoints { - endpointV6 := types.Endpoint{ - IPPORT: endpointV5.IPPORT, - Addons: endpointV5.Addons, - ApiInterfaces: endpointV5.ApiInterfaces, - Extensions: endpointV5.Extensions, - Geolocation: endpointV5.Geolocation, - } +// Migrate6to7 goes over all existing stake entries and populates the new description field with current moniker +func (m Migrator) Migrate6to7(ctx sdk.Context) error { + utils.LavaFormatDebug("migrate: epochstorage to include detailed description") - endpointsV6 = append(endpointsV6, endpointV6) - } + store := prefix.NewStore(ctx.KVStore(m.keeper.storeKey), types.KeyPrefix(types.StakeStorageKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) - stakeEntryV6.Endpoints = endpointsV6 + defer iterator.Close() - stakeEntriesV6 = append(stakeEntriesV6, stakeEntryV6) + for ; iterator.Valid(); iterator.Next() { + var stakeStorageV7 types.StakeStorage + m.keeper.cdc.MustUnmarshal(iterator.Value(), &stakeStorageV7) + + for i := range stakeStorageV7.StakeEntries { + stakeStorageV7.StakeEntries[i].Description.Moniker = stakeStorageV7.StakeEntries[i].Moniker + stakeStorageV7.StakeEntries[i].Moniker = "" } - stakeStorageV6.StakeEntries = stakeEntriesV6 - store.Delete(iterator.Key()) - store.Set(iterator.Key(), m.keeper.cdc.MustMarshal(&stakeStorageV6)) + store.Set(iterator.Key(), m.keeper.cdc.MustMarshal(&stakeStorageV7)) } return nil diff --git a/x/epochstorage/module.go b/x/epochstorage/module.go index 4825dde692..a4c15775f9 100644 --- a/x/epochstorage/module.go +++ b/x/epochstorage/module.go @@ -150,6 +150,12 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // panic:ok: at start up, migration cannot proceed anyhow panic(fmt.Errorf("%s: failed to register migration to v6: %w", types.ModuleName, err)) } + + // register v6 -> v7 migration + if err := cfg.RegisterMigration(types.ModuleName, 6, migrator.Migrate5to6); err != nil { + // panic:ok: at start up, migration cannot proceed anyhow + panic(fmt.Errorf("%s: failed to register migration to v7: %w", types.ModuleName, err)) + } } // RegisterInvariants registers the capability module's invariants. @@ -174,7 +180,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 6 } +func (AppModule) ConsensusVersion() uint64 { return 7 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/x/epochstorage/types/migrations/v6/endpoint.pb.go b/x/epochstorage/types/migrations/v6/endpoint.pb.go new file mode 100644 index 0000000000..576ee1e357 --- /dev/null +++ b/x/epochstorage/types/migrations/v6/endpoint.pb.go @@ -0,0 +1,522 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lavanet/lava/epochstorage/endpoint.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + 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 Endpoint struct { + IPPORT string `protobuf:"bytes,1,opt,name=iPPORT,proto3" json:"iPPORT,omitempty"` + Geolocation int32 `protobuf:"varint,3,opt,name=geolocation,proto3" json:"geolocation,omitempty"` + Addons []string `protobuf:"bytes,4,rep,name=addons,proto3" json:"addons,omitempty"` + ApiInterfaces []string `protobuf:"bytes,5,rep,name=api_interfaces,json=apiInterfaces,proto3" json:"api_interfaces,omitempty"` + Extensions []string `protobuf:"bytes,6,rep,name=extensions,proto3" json:"extensions,omitempty"` +} + +func (m *Endpoint) Reset() { *m = Endpoint{} } +func (m *Endpoint) String() string { return proto.CompactTextString(m) } +func (*Endpoint) ProtoMessage() {} +func (*Endpoint) Descriptor() ([]byte, []int) { + return fileDescriptor_acb18a6b0d300ae9, []int{0} +} +func (m *Endpoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Endpoint.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 *Endpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_Endpoint.Merge(m, src) +} +func (m *Endpoint) XXX_Size() int { + return m.Size() +} +func (m *Endpoint) XXX_DiscardUnknown() { + xxx_messageInfo_Endpoint.DiscardUnknown(m) +} + +var xxx_messageInfo_Endpoint proto.InternalMessageInfo + +func (m *Endpoint) GetIPPORT() string { + if m != nil { + return m.IPPORT + } + return "" +} + +func (m *Endpoint) GetGeolocation() int32 { + if m != nil { + return m.Geolocation + } + return 0 +} + +func (m *Endpoint) GetAddons() []string { + if m != nil { + return m.Addons + } + return nil +} + +func (m *Endpoint) GetApiInterfaces() []string { + if m != nil { + return m.ApiInterfaces + } + return nil +} + +func (m *Endpoint) GetExtensions() []string { + if m != nil { + return m.Extensions + } + return nil +} + +func init() { + proto.RegisterType((*Endpoint)(nil), "lavanet.lava.epochstorage.EndpointV6") +} + +func init() { + proto.RegisterFile("lavanet/lava/epochstorage/endpoint.proto", fileDescriptor_acb18a6b0d300ae9) +} + +var fileDescriptor_acb18a6b0d300ae9 = []byte{ + // 250 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xc8, 0x49, 0x2c, 0x4b, + 0xcc, 0x4b, 0x2d, 0xd1, 0x07, 0xd1, 0xfa, 0xa9, 0x05, 0xf9, 0xc9, 0x19, 0xc5, 0x25, 0xf9, 0x45, + 0x89, 0xe9, 0xa9, 0xfa, 0xa9, 0x79, 0x29, 0x05, 0xf9, 0x99, 0x79, 0x25, 0x7a, 0x05, 0x45, 0xf9, + 0x25, 0xf9, 0x42, 0x92, 0x50, 0x95, 0x7a, 0x20, 0x5a, 0x0f, 0x59, 0xa5, 0xd2, 0x4a, 0x46, 0x2e, + 0x0e, 0x57, 0xa8, 0x6a, 0x21, 0x31, 0x2e, 0xb6, 0xcc, 0x80, 0x00, 0xff, 0xa0, 0x10, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0xce, 0x20, 0x28, 0x4f, 0x48, 0x81, 0x8b, 0x3b, 0x3d, 0x35, 0x3f, 0x27, 0x3f, + 0x39, 0xb1, 0x24, 0x33, 0x3f, 0x4f, 0x82, 0x59, 0x81, 0x51, 0x83, 0x35, 0x08, 0x59, 0x08, 0xa4, + 0x33, 0x31, 0x25, 0x25, 0x3f, 0xaf, 0x58, 0x82, 0x45, 0x81, 0x19, 0xa4, 0x13, 0xc2, 0x13, 0x52, + 0xe5, 0xe2, 0x4b, 0x2c, 0xc8, 0x8c, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0x4a, 0x4b, 0x4c, 0x4e, 0x2d, + 0x96, 0x60, 0x05, 0xcb, 0xf3, 0x26, 0x16, 0x64, 0x7a, 0xc2, 0x05, 0x85, 0xe4, 0xb8, 0xb8, 0x52, + 0x2b, 0x4a, 0x52, 0xf3, 0x8a, 0x33, 0x41, 0x46, 0xb0, 0x81, 0x95, 0x20, 0x89, 0x78, 0xb1, 0x70, + 0x30, 0x09, 0x30, 0x3b, 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, + 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, + 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x4a, 0xa8, 0x54, 0xa0, + 0x86, 0x4b, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x54, 0x8c, 0x01, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xf3, 0xac, 0x09, 0xa5, 0x41, 0x01, 0x00, 0x00, +} + +func (m *Endpoint) 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 *Endpoint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Extensions) > 0 { + for iNdEx := len(m.Extensions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Extensions[iNdEx]) + copy(dAtA[i:], m.Extensions[iNdEx]) + i = encodeVarintEndpoint(dAtA, i, uint64(len(m.Extensions[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if len(m.ApiInterfaces) > 0 { + for iNdEx := len(m.ApiInterfaces) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ApiInterfaces[iNdEx]) + copy(dAtA[i:], m.ApiInterfaces[iNdEx]) + i = encodeVarintEndpoint(dAtA, i, uint64(len(m.ApiInterfaces[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if len(m.Addons) > 0 { + for iNdEx := len(m.Addons) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addons[iNdEx]) + copy(dAtA[i:], m.Addons[iNdEx]) + i = encodeVarintEndpoint(dAtA, i, uint64(len(m.Addons[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if m.Geolocation != 0 { + i = encodeVarintEndpoint(dAtA, i, uint64(m.Geolocation)) + i-- + dAtA[i] = 0x18 + } + if len(m.IPPORT) > 0 { + i -= len(m.IPPORT) + copy(dAtA[i:], m.IPPORT) + i = encodeVarintEndpoint(dAtA, i, uint64(len(m.IPPORT))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEndpoint(dAtA []byte, offset int, v uint64) int { + offset -= sovEndpoint(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Endpoint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.IPPORT) + if l > 0 { + n += 1 + l + sovEndpoint(uint64(l)) + } + if m.Geolocation != 0 { + n += 1 + sovEndpoint(uint64(m.Geolocation)) + } + if len(m.Addons) > 0 { + for _, s := range m.Addons { + l = len(s) + n += 1 + l + sovEndpoint(uint64(l)) + } + } + if len(m.ApiInterfaces) > 0 { + for _, s := range m.ApiInterfaces { + l = len(s) + n += 1 + l + sovEndpoint(uint64(l)) + } + } + if len(m.Extensions) > 0 { + for _, s := range m.Extensions { + l = len(s) + n += 1 + l + sovEndpoint(uint64(l)) + } + } + return n +} + +func sovEndpoint(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEndpoint(x uint64) (n int) { + return sovEndpoint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Endpoint) 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 ErrIntOverflowEndpoint + } + 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: Endpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IPPORT", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + 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 ErrInvalidLengthEndpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEndpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IPPORT = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Geolocation", wireType) + } + m.Geolocation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Geolocation |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addons", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + 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 ErrInvalidLengthEndpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEndpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addons = append(m.Addons, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApiInterfaces", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + 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 ErrInvalidLengthEndpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEndpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ApiInterfaces = append(m.ApiInterfaces, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extensions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + 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 ErrInvalidLengthEndpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEndpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Extensions = append(m.Extensions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEndpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEndpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEndpoint(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, ErrIntOverflowEndpoint + } + 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, ErrIntOverflowEndpoint + } + 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, ErrIntOverflowEndpoint + } + 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, ErrInvalidLengthEndpoint + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEndpoint + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEndpoint + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEndpoint = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEndpoint = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEndpoint = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/epochstorage/types/migrations/v6/stake_entry.pb.go b/x/epochstorage/types/migrations/v6/stake_entry.pb.go new file mode 100644 index 0000000000..1e807c5351 --- /dev/null +++ b/x/epochstorage/types/migrations/v6/stake_entry.pb.go @@ -0,0 +1,1106 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lavanet/lava/epochstorage/stake_entry.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + 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 StakeEntry struct { + Stake types.Coin `protobuf:"bytes,1,opt,name=stake,proto3" json:"stake"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + StakeAppliedBlock uint64 `protobuf:"varint,3,opt,name=stake_applied_block,json=stakeAppliedBlock,proto3" json:"stake_applied_block,omitempty"` + Endpoints []Endpoint `protobuf:"bytes,4,rep,name=endpoints,proto3" json:"endpoints"` + Geolocation int32 `protobuf:"varint,5,opt,name=geolocation,proto3" json:"geolocation,omitempty"` + Chain string `protobuf:"bytes,6,opt,name=chain,proto3" json:"chain,omitempty"` + Moniker string `protobuf:"bytes,8,opt,name=moniker,proto3" json:"moniker,omitempty"` + DelegateTotal types.Coin `protobuf:"bytes,9,opt,name=delegate_total,json=delegateTotal,proto3" json:"delegate_total"` + DelegateLimit types.Coin `protobuf:"bytes,10,opt,name=delegate_limit,json=delegateLimit,proto3" json:"delegate_limit"` + DelegateCommission uint64 `protobuf:"varint,11,opt,name=delegate_commission,json=delegateCommission,proto3" json:"delegate_commission,omitempty"` + LastChange uint64 `protobuf:"varint,12,opt,name=last_change,json=lastChange,proto3" json:"last_change,omitempty"` + BlockReport *BlockReport `protobuf:"bytes,13,opt,name=block_report,json=blockReport,proto3" json:"block_report,omitempty"` + Vault string `protobuf:"bytes,14,opt,name=vault,proto3" json:"vault,omitempty"` +} + +func (m *StakeEntry) Reset() { *m = StakeEntry{} } +func (m *StakeEntry) String() string { return proto.CompactTextString(m) } +func (*StakeEntry) ProtoMessage() {} +func (*StakeEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_df6302d6b53c056e, []int{0} +} +func (m *StakeEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StakeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StakeEntry.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 *StakeEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakeEntry.Merge(m, src) +} +func (m *StakeEntry) XXX_Size() int { + return m.Size() +} +func (m *StakeEntry) XXX_DiscardUnknown() { + xxx_messageInfo_StakeEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_StakeEntry proto.InternalMessageInfo + +func (m *StakeEntry) GetStake() types.Coin { + if m != nil { + return m.Stake + } + return types.Coin{} +} + +func (m *StakeEntry) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *StakeEntry) GetStakeAppliedBlock() uint64 { + if m != nil { + return m.StakeAppliedBlock + } + return 0 +} + +func (m *StakeEntry) GetEndpoints() []Endpoint { + if m != nil { + return m.Endpoints + } + return nil +} + +func (m *StakeEntry) GetGeolocation() int32 { + if m != nil { + return m.Geolocation + } + return 0 +} + +func (m *StakeEntry) GetChain() string { + if m != nil { + return m.Chain + } + return "" +} + +func (m *StakeEntry) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *StakeEntry) GetDelegateTotal() types.Coin { + if m != nil { + return m.DelegateTotal + } + return types.Coin{} +} + +func (m *StakeEntry) GetDelegateLimit() types.Coin { + if m != nil { + return m.DelegateLimit + } + return types.Coin{} +} + +func (m *StakeEntry) GetDelegateCommission() uint64 { + if m != nil { + return m.DelegateCommission + } + return 0 +} + +func (m *StakeEntry) GetLastChange() uint64 { + if m != nil { + return m.LastChange + } + return 0 +} + +func (m *StakeEntry) GetBlockReport() *BlockReport { + if m != nil { + return m.BlockReport + } + return nil +} + +func (m *StakeEntry) GetVault() string { + if m != nil { + return m.Vault + } + return "" +} + +// BlockReport holds the most up-to-date info regarding blocks of the provider +// It is set in the relay payment TX logic +// used by the consumer to calculate the provider's sync score +type BlockReport struct { + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + LatestBlock uint64 `protobuf:"varint,2,opt,name=latest_block,json=latestBlock,proto3" json:"latest_block,omitempty"` +} + +func (m *BlockReport) Reset() { *m = BlockReport{} } +func (m *BlockReport) String() string { return proto.CompactTextString(m) } +func (*BlockReport) ProtoMessage() {} +func (*BlockReport) Descriptor() ([]byte, []int) { + return fileDescriptor_df6302d6b53c056e, []int{1} +} +func (m *BlockReport) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockReport.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 *BlockReport) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockReport.Merge(m, src) +} +func (m *BlockReport) XXX_Size() int { + return m.Size() +} +func (m *BlockReport) XXX_DiscardUnknown() { + xxx_messageInfo_BlockReport.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockReport proto.InternalMessageInfo + +func (m *BlockReport) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *BlockReport) GetLatestBlock() uint64 { + if m != nil { + return m.LatestBlock + } + return 0 +} + +func init() { + proto.RegisterType((*StakeEntry)(nil), "lavanet.lava.epochstorage.StakeEntryV6") + proto.RegisterType((*BlockReport)(nil), "lavanet.lava.epochstorage.BlockReportV6") +} + +func init() { + proto.RegisterFile("lavanet/lava/epochstorage/stake_entry.proto", fileDescriptor_df6302d6b53c056e) +} + +var fileDescriptor_df6302d6b53c056e = []byte{ + // 510 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x41, 0x6e, 0xdb, 0x3a, + 0x10, 0xb5, 0x12, 0x39, 0xb1, 0x29, 0x27, 0xf8, 0x9f, 0xc9, 0x82, 0xc9, 0x42, 0x51, 0x53, 0xa0, + 0x10, 0xd0, 0x82, 0x42, 0x52, 0xf4, 0x00, 0xb5, 0x11, 0x17, 0x2d, 0xba, 0x52, 0xbb, 0xea, 0xc6, + 0xa0, 0x24, 0x42, 0x26, 0x2c, 0x71, 0x04, 0x91, 0x31, 0x9a, 0x5b, 0xf4, 0x58, 0x59, 0x66, 0xd9, + 0x55, 0x51, 0xd8, 0x27, 0xe8, 0x0d, 0x0a, 0x92, 0x72, 0x12, 0x2f, 0x52, 0xb4, 0x2b, 0x72, 0xe6, + 0xbd, 0x37, 0x98, 0x79, 0xe4, 0xa0, 0x97, 0x15, 0x5b, 0x32, 0xc9, 0x75, 0x62, 0xce, 0x84, 0x37, + 0x90, 0xcf, 0x95, 0x86, 0x96, 0x95, 0x3c, 0x51, 0x9a, 0x2d, 0xf8, 0x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0xd8, 0xfb, 0xf2, 0xaa, 0x14, 0x7a, 0x7e, 0x9d, 0xd1, 0x1c, + 0xea, 0x64, 0x6b, 0x81, 0xbe, 0x6e, 0xaf, 0x90, 0xbe, 0x69, 0xb8, 0xca, 0xf6, 0xec, 0x2a, 0xbc, + 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x25, 0xca, 0x07, 0xb4, 0x03, 0x00, 0x00, +} + +func (m *StakeEntry) 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 *StakeEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StakeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Vault) > 0 { + i -= len(m.Vault) + copy(dAtA[i:], m.Vault) + i = encodeVarintStakeEntry(dAtA, i, uint64(len(m.Vault))) + i-- + dAtA[i] = 0x72 + } + if m.BlockReport != nil { + { + size, err := m.BlockReport.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } + if m.LastChange != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.LastChange)) + i-- + dAtA[i] = 0x60 + } + if m.DelegateCommission != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.DelegateCommission)) + i-- + dAtA[i] = 0x58 + } + { + size, err := m.DelegateLimit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + { + size, err := m.DelegateTotal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintStakeEntry(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x42 + } + if len(m.Chain) > 0 { + i -= len(m.Chain) + copy(dAtA[i:], m.Chain) + i = encodeVarintStakeEntry(dAtA, i, uint64(len(m.Chain))) + i-- + dAtA[i] = 0x32 + } + if m.Geolocation != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.Geolocation)) + i-- + dAtA[i] = 0x28 + } + if len(m.Endpoints) > 0 { + for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.StakeAppliedBlock != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.StakeAppliedBlock)) + i-- + dAtA[i] = 0x18 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintStakeEntry(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Stake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BlockReport) 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 *BlockReport) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestBlock != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.LatestBlock)) + i-- + dAtA[i] = 0x10 + } + if m.Epoch != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintStakeEntry(dAtA []byte, offset int, v uint64) int { + offset -= sovStakeEntry(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StakeEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Stake.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + l = len(m.Address) + if l > 0 { + n += 1 + l + sovStakeEntry(uint64(l)) + } + if m.StakeAppliedBlock != 0 { + n += 1 + sovStakeEntry(uint64(m.StakeAppliedBlock)) + } + if len(m.Endpoints) > 0 { + for _, e := range m.Endpoints { + l = e.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + } + } + if m.Geolocation != 0 { + n += 1 + sovStakeEntry(uint64(m.Geolocation)) + } + l = len(m.Chain) + if l > 0 { + n += 1 + l + sovStakeEntry(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovStakeEntry(uint64(l)) + } + l = m.DelegateTotal.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + l = m.DelegateLimit.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + if m.DelegateCommission != 0 { + n += 1 + sovStakeEntry(uint64(m.DelegateCommission)) + } + if m.LastChange != 0 { + n += 1 + sovStakeEntry(uint64(m.LastChange)) + } + if m.BlockReport != nil { + l = m.BlockReport.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + } + l = len(m.Vault) + if l > 0 { + n += 1 + l + sovStakeEntry(uint64(l)) + } + return n +} + +func (m *BlockReport) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovStakeEntry(uint64(m.Epoch)) + } + if m.LatestBlock != 0 { + n += 1 + sovStakeEntry(uint64(m.LatestBlock)) + } + return n +} + +func sovStakeEntry(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStakeEntry(x uint64) (n int) { + return sovStakeEntry(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StakeEntry) 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 ErrIntOverflowStakeEntry + } + 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: StakeEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StakeEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Stake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + 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 ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StakeAppliedBlock", wireType) + } + m.StakeAppliedBlock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StakeAppliedBlock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoints = append(m.Endpoints, Endpoint{}) + if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Geolocation", wireType) + } + m.Geolocation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Geolocation |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + 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 ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Chain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + 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 ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegateTotal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DelegateTotal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegateLimit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DelegateLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegateCommission", wireType) + } + m.DelegateCommission = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DelegateCommission |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastChange", wireType) + } + m.LastChange = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastChange |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockReport", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BlockReport == nil { + m.BlockReport = &BlockReport{} + } + if err := m.BlockReport.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vault", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + 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 ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Vault = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStakeEntry(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakeEntry + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockReport) 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 ErrIntOverflowStakeEntry + } + 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: BlockReport: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockReport: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestBlock", wireType) + } + m.LatestBlock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestBlock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStakeEntry(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakeEntry + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStakeEntry(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, ErrIntOverflowStakeEntry + } + 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, ErrIntOverflowStakeEntry + } + 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, ErrIntOverflowStakeEntry + } + 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, ErrInvalidLengthStakeEntry + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStakeEntry + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStakeEntry + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStakeEntry = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStakeEntry = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStakeEntry = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/epochstorage/types/migrations/v6/stake_storage.pb.go b/x/epochstorage/types/migrations/v6/stake_storage.pb.go new file mode 100644 index 0000000000..3e68d424ab --- /dev/null +++ b/x/epochstorage/types/migrations/v6/stake_storage.pb.go @@ -0,0 +1,438 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lavanet/lava/epochstorage/stake_storage.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + 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 StakeStorage struct { + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + StakeEntries []StakeEntry `protobuf:"bytes,2,rep,name=stakeEntries,proto3" json:"stakeEntries"` + EpochBlockHash []byte `protobuf:"bytes,3,opt,name=epochBlockHash,proto3" json:"epochBlockHash,omitempty"` +} + +func (m *StakeStorage) Reset() { *m = StakeStorage{} } +func (m *StakeStorage) String() string { return proto.CompactTextString(m) } +func (*StakeStorage) ProtoMessage() {} +func (*StakeStorage) Descriptor() ([]byte, []int) { + return fileDescriptor_be7b78aecc265fd4, []int{0} +} +func (m *StakeStorage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StakeStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StakeStorage.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 *StakeStorage) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakeStorage.Merge(m, src) +} +func (m *StakeStorage) XXX_Size() int { + return m.Size() +} +func (m *StakeStorage) XXX_DiscardUnknown() { + xxx_messageInfo_StakeStorage.DiscardUnknown(m) +} + +var xxx_messageInfo_StakeStorage proto.InternalMessageInfo + +func (m *StakeStorage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *StakeStorage) GetStakeEntries() []StakeEntry { + if m != nil { + return m.StakeEntries + } + return nil +} + +func (m *StakeStorage) GetEpochBlockHash() []byte { + if m != nil { + return m.EpochBlockHash + } + return nil +} + +func init() { + proto.RegisterType((*StakeStorage)(nil), "lavanet.lava.epochstorage.StakeStorageV6") +} + +func init() { + proto.RegisterFile("lavanet/lava/epochstorage/stake_storage.proto", fileDescriptor_be7b78aecc265fd4) +} + +var fileDescriptor_be7b78aecc265fd4 = []byte{ + // 246 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcd, 0x49, 0x2c, 0x4b, + 0xcc, 0x4b, 0x2d, 0xd1, 0x07, 0xd1, 0xfa, 0xa9, 0x05, 0x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, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x94, 0x70, 0xa8, 0x40, 0x0d, 0x89, 0x92, 0xca, + 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x77, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x64, 0x2d, + 0xbc, 0x7a, 0x7d, 0x01, 0x00, 0x00, +} + +func (m *StakeStorage) 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 *StakeStorage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StakeStorage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EpochBlockHash) > 0 { + i -= len(m.EpochBlockHash) + copy(dAtA[i:], m.EpochBlockHash) + i = encodeVarintStakeStorage(dAtA, i, uint64(len(m.EpochBlockHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.StakeEntries) > 0 { + for iNdEx := len(m.StakeEntries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StakeEntries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeStorage(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintStakeStorage(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintStakeStorage(dAtA []byte, offset int, v uint64) int { + offset -= sovStakeStorage(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StakeStorage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Index) + if l > 0 { + n += 1 + l + sovStakeStorage(uint64(l)) + } + if len(m.StakeEntries) > 0 { + for _, e := range m.StakeEntries { + l = e.Size() + n += 1 + l + sovStakeStorage(uint64(l)) + } + } + l = len(m.EpochBlockHash) + if l > 0 { + n += 1 + l + sovStakeStorage(uint64(l)) + } + return n +} + +func sovStakeStorage(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStakeStorage(x uint64) (n int) { + return sovStakeStorage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StakeStorage) 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 ErrIntOverflowStakeStorage + } + 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: StakeStorage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StakeStorage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeStorage + } + 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 ErrInvalidLengthStakeStorage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakeEntries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeStorage + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StakeEntries = append(m.StakeEntries, StakeEntry{}) + if err := m.StakeEntries[len(m.StakeEntries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochBlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStakeStorage + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthStakeStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EpochBlockHash = append(m.EpochBlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.EpochBlockHash == nil { + m.EpochBlockHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStakeStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakeStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStakeStorage(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, ErrIntOverflowStakeStorage + } + 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, ErrIntOverflowStakeStorage + } + 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, ErrIntOverflowStakeStorage + } + 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, ErrInvalidLengthStakeStorage + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStakeStorage + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStakeStorage + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStakeStorage = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStakeStorage = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStakeStorage = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/epochstorage/types/stake_entry.pb.go b/x/epochstorage/types/stake_entry.pb.go index 8e8965bb5a..ce15076cf5 100644 --- a/x/epochstorage/types/stake_entry.pb.go +++ b/x/epochstorage/types/stake_entry.pb.go @@ -6,6 +6,8 @@ package types import ( fmt "fmt" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + types1 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -25,19 +27,20 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type StakeEntry struct { - Stake types.Coin `protobuf:"bytes,1,opt,name=stake,proto3" json:"stake"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - StakeAppliedBlock uint64 `protobuf:"varint,3,opt,name=stake_applied_block,json=stakeAppliedBlock,proto3" json:"stake_applied_block,omitempty"` - Endpoints []Endpoint `protobuf:"bytes,4,rep,name=endpoints,proto3" json:"endpoints"` - Geolocation int32 `protobuf:"varint,5,opt,name=geolocation,proto3" json:"geolocation,omitempty"` - Chain string `protobuf:"bytes,6,opt,name=chain,proto3" json:"chain,omitempty"` - Moniker string `protobuf:"bytes,8,opt,name=moniker,proto3" json:"moniker,omitempty"` - DelegateTotal types.Coin `protobuf:"bytes,9,opt,name=delegate_total,json=delegateTotal,proto3" json:"delegate_total"` - DelegateLimit types.Coin `protobuf:"bytes,10,opt,name=delegate_limit,json=delegateLimit,proto3" json:"delegate_limit"` - DelegateCommission uint64 `protobuf:"varint,11,opt,name=delegate_commission,json=delegateCommission,proto3" json:"delegate_commission,omitempty"` - LastChange uint64 `protobuf:"varint,12,opt,name=last_change,json=lastChange,proto3" json:"last_change,omitempty"` - BlockReport *BlockReport `protobuf:"bytes,13,opt,name=block_report,json=blockReport,proto3" json:"block_report,omitempty"` - Vault string `protobuf:"bytes,14,opt,name=vault,proto3" json:"vault,omitempty"` + Stake types.Coin `protobuf:"bytes,1,opt,name=stake,proto3" json:"stake"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + StakeAppliedBlock uint64 `protobuf:"varint,3,opt,name=stake_applied_block,json=stakeAppliedBlock,proto3" json:"stake_applied_block,omitempty"` + Endpoints []Endpoint `protobuf:"bytes,4,rep,name=endpoints,proto3" json:"endpoints"` + Geolocation int32 `protobuf:"varint,5,opt,name=geolocation,proto3" json:"geolocation,omitempty"` + Chain string `protobuf:"bytes,6,opt,name=chain,proto3" json:"chain,omitempty"` + Moniker string `protobuf:"bytes,8,opt,name=moniker,proto3" json:"moniker,omitempty"` + DelegateTotal types.Coin `protobuf:"bytes,9,opt,name=delegate_total,json=delegateTotal,proto3" json:"delegate_total"` + DelegateLimit types.Coin `protobuf:"bytes,10,opt,name=delegate_limit,json=delegateLimit,proto3" json:"delegate_limit"` + DelegateCommission uint64 `protobuf:"varint,11,opt,name=delegate_commission,json=delegateCommission,proto3" json:"delegate_commission,omitempty"` + LastChange uint64 `protobuf:"varint,12,opt,name=last_change,json=lastChange,proto3" json:"last_change,omitempty"` + BlockReport *BlockReport `protobuf:"bytes,13,opt,name=block_report,json=blockReport,proto3" json:"block_report,omitempty"` + Vault string `protobuf:"bytes,14,opt,name=vault,proto3" json:"vault,omitempty"` + Description types1.Description `protobuf:"bytes,15,opt,name=description,proto3" json:"description"` } func (m *StakeEntry) Reset() { *m = StakeEntry{} } @@ -164,6 +167,13 @@ func (m *StakeEntry) GetVault() string { return "" } +func (m *StakeEntry) GetDescription() types1.Description { + if m != nil { + return m.Description + } + return types1.Description{} +} + // BlockReport holds the most up-to-date info regarding blocks of the provider // It is set in the relay payment TX logic // used by the consumer to calculate the provider's sync score @@ -229,39 +239,43 @@ func init() { } var fileDescriptor_df6302d6b53c056e = []byte{ - // 510 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x41, 0x6e, 0xdb, 0x3a, - 0x10, 0xb5, 0x12, 0x39, 0xb1, 0x29, 0x27, 0xf8, 0x9f, 0xc9, 0x82, 0xc9, 0x42, 0x51, 0x53, 0xa0, - 0x10, 0xd0, 0x82, 0x42, 0x52, 0xf4, 0x00, 0xb5, 0x11, 0x17, 0x2d, 0xba, 0x52, 0xbb, 0xea, 0xc6, - 0xa0, 0x24, 0x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f0, - 0x07, 0xfb, 0xff, 0x0d, 0xce, 0xa7, 0x28, 0x18, 0x6f, 0x53, 0x6d, 0x4d, 0xfb, 0xe7, 0xfc, 0xd4, - 0x05, 0xf8, 0x19, 0x1a, 0x55, 0x4c, 0x73, 0xa5, 0xbb, 0x1f, 0xb3, 0x63, 0xc1, 0xc0, 0xe5, 0xac, - 0x7c, 0x3c, 0xbd, 0x5d, 0x85, 0xde, 0xdd, 0x2a, 0xf4, 0x7e, 0xae, 0x42, 0xef, 0xdb, 0x3a, 0xec, - 0xdd, 0xad, 0xc3, 0xde, 0xf7, 0x75, 0xd8, 0xfb, 0xf2, 0xaa, 0x14, 0x7a, 0x7e, 0x9d, 0xd1, 0x1c, - 0xea, 0x64, 0x6b, 0x81, 0xbe, 0x6e, 0xaf, 0x90, 0xbe, 0x69, 0xb8, 0xca, 0xf6, 0xec, 0x2a, 0xbc, - 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x25, 0xca, 0x07, 0xb4, 0x03, 0x00, 0x00, + // 572 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0xdb, 0xa4, 0x4d, 0xc6, 0x69, 0xbf, 0xaf, 0xd3, 0x2e, 0xa6, 0x5d, 0xb8, 0xa6, 0x45, + 0xc8, 0x02, 0x64, 0xab, 0x45, 0x3c, 0x00, 0x09, 0x0d, 0x02, 0xb1, 0x40, 0x86, 0x15, 0x9b, 0x68, + 0x6c, 0x8f, 0x9c, 0x51, 0xec, 0x19, 0xcb, 0x33, 0x8d, 0xe8, 0x5b, 0xf0, 0x18, 0x2c, 0x79, 0x07, + 0x36, 0x5d, 0x76, 0xc9, 0x0a, 0xa1, 0x64, 0xc1, 0x6b, 0xa0, 0xf9, 0x71, 0x7e, 0x16, 0x45, 0xb0, + 0xb1, 0xe7, 0xde, 0x7b, 0xee, 0x99, 0x7b, 0xce, 0xcc, 0x80, 0x27, 0x05, 0x9e, 0x61, 0x46, 0x64, + 0xa4, 0xfe, 0x11, 0xa9, 0x78, 0x3a, 0x11, 0x92, 0xd7, 0x38, 0x27, 0x91, 0x90, 0x78, 0x4a, 0xc6, + 0x84, 0xc9, 0xfa, 0x26, 0xac, 0x6a, 0x2e, 0x39, 0x3c, 0xb6, 0xe0, 0x50, 0xfd, 0xc3, 0x75, 0xf0, + 0x49, 0x70, 0x3f, 0x0f, 0x61, 0x59, 0xc5, 0x29, 0x93, 0x86, 0xe4, 0xe4, 0x28, 0xe7, 0x39, 0xd7, + 0xcb, 0x48, 0xad, 0x6c, 0xd6, 0x4b, 0xb9, 0x28, 0xb9, 0x88, 0x12, 0x2c, 0x48, 0x34, 0xbb, 0x48, + 0x88, 0xc4, 0x17, 0x51, 0xca, 0x29, 0xb3, 0xf5, 0x87, 0xb6, 0xae, 0x86, 0xa2, 0x2c, 0x5f, 0x42, + 0x6c, 0x6c, 0x51, 0x07, 0xb8, 0xa4, 0x8c, 0x47, 0xfa, 0x6b, 0x52, 0x67, 0xdf, 0x3a, 0x00, 0xbc, + 0x57, 0x4a, 0xae, 0x94, 0x10, 0xf8, 0x1c, 0x74, 0xb4, 0x2e, 0xe4, 0xf8, 0x4e, 0xe0, 0x5e, 0x1e, + 0x87, 0x86, 0x37, 0x54, 0xfb, 0x86, 0x96, 0x34, 0x1c, 0x72, 0xca, 0x06, 0xed, 0xdb, 0x1f, 0xa7, + 0xad, 0xd8, 0xa0, 0x21, 0x02, 0xbb, 0x38, 0xcb, 0x6a, 0x22, 0x04, 0xda, 0xf2, 0x9d, 0xa0, 0x17, + 0x37, 0x21, 0x0c, 0xc1, 0xa1, 0x31, 0x0a, 0x57, 0x55, 0x41, 0x49, 0x36, 0x4e, 0x0a, 0x9e, 0x4e, + 0xd1, 0xb6, 0xef, 0x04, 0xed, 0xf8, 0x40, 0x97, 0x5e, 0x98, 0xca, 0x40, 0x15, 0xe0, 0x2b, 0xd0, + 0x6b, 0x0c, 0x11, 0xa8, 0xed, 0x6f, 0x07, 0xee, 0xe5, 0x79, 0x78, 0xaf, 0xaf, 0xe1, 0x95, 0xc5, + 0xda, 0x71, 0x56, 0xbd, 0xd0, 0x07, 0x6e, 0x4e, 0x78, 0xc1, 0x53, 0x2c, 0x29, 0x67, 0xa8, 0xe3, + 0x3b, 0x41, 0x27, 0x5e, 0x4f, 0xc1, 0x23, 0xd0, 0x49, 0x27, 0x98, 0x32, 0xb4, 0xa3, 0x47, 0x36, + 0x81, 0x92, 0x52, 0x72, 0x46, 0xa7, 0xa4, 0x46, 0x5d, 0x23, 0xc5, 0x86, 0x70, 0x04, 0xf6, 0x33, + 0x52, 0x90, 0x1c, 0x4b, 0x32, 0x96, 0x5c, 0xe2, 0x02, 0xf5, 0xfe, 0xce, 0xa4, 0xbd, 0xa6, 0xed, + 0x83, 0xea, 0xda, 0xe0, 0x29, 0x68, 0x49, 0x25, 0x02, 0xff, 0xc8, 0xf3, 0x56, 0x75, 0xc1, 0x08, + 0x1c, 0x2e, 0x79, 0x52, 0x5e, 0x96, 0x54, 0x08, 0xa5, 0xd4, 0xd5, 0xd6, 0xc2, 0xa6, 0x34, 0x5c, + 0x56, 0xe0, 0x29, 0x70, 0x0b, 0x2c, 0xe4, 0x38, 0x9d, 0x60, 0x96, 0x13, 0xd4, 0xd7, 0x40, 0xa0, + 0x52, 0x43, 0x9d, 0x81, 0xaf, 0x41, 0x5f, 0x1f, 0xcf, 0xb8, 0x26, 0x15, 0xaf, 0x25, 0xda, 0xd3, + 0x73, 0x3d, 0xfa, 0x83, 0xff, 0xfa, 0xd0, 0x62, 0x8d, 0x8e, 0xdd, 0x64, 0x15, 0x28, 0x73, 0x67, + 0xf8, 0xba, 0x90, 0x68, 0xdf, 0x98, 0xab, 0x03, 0xf8, 0x0e, 0xb8, 0x19, 0x11, 0x69, 0x4d, 0x2b, + 0x7d, 0x28, 0xff, 0x69, 0xfe, 0xf3, 0x46, 0x77, 0x73, 0x59, 0x1b, 0xe9, 0x2f, 0x57, 0xd0, 0x41, + 0x4f, 0x39, 0xf0, 0xe5, 0xd7, 0xd7, 0xc7, 0x4e, 0xbc, 0x4e, 0xf1, 0xa6, 0xdd, 0xdd, 0xfd, 0xbf, + 0x7b, 0x36, 0x02, 0xee, 0x60, 0x73, 0x73, 0x3d, 0xa5, 0xbe, 0xc5, 0xed, 0xd8, 0x04, 0xf0, 0x01, + 0xe8, 0x17, 0x58, 0x12, 0x21, 0xed, 0x1d, 0xdc, 0xd2, 0x45, 0xd7, 0xe4, 0x74, 0xfb, 0x60, 0x74, + 0x3b, 0xf7, 0x9c, 0xbb, 0xb9, 0xe7, 0xfc, 0x9c, 0x7b, 0xce, 0xe7, 0x85, 0xd7, 0xba, 0x5b, 0x78, + 0xad, 0xef, 0x0b, 0xaf, 0xf5, 0xf1, 0x69, 0x4e, 0xe5, 0xe4, 0x3a, 0x09, 0x53, 0x5e, 0x46, 0x1b, + 0x6f, 0xf9, 0xd3, 0xe6, 0x6b, 0x96, 0x37, 0x15, 0x11, 0xc9, 0x8e, 0x7e, 0x5c, 0xcf, 0x7e, 0x07, + 0x00, 0x00, 0xff, 0xff, 0xe9, 0x92, 0xff, 0xb6, 0x3f, 0x04, 0x00, 0x00, } func (m *StakeEntry) Marshal() (dAtA []byte, err error) { @@ -284,6 +298,16 @@ func (m *StakeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7a if len(m.Vault) > 0 { i -= len(m.Vault) copy(dAtA[i:], m.Vault) @@ -485,6 +509,8 @@ func (m *StakeEntry) Size() (n int) { if l > 0 { n += 1 + l + sovStakeEntry(uint64(l)) } + l = m.Description.Size() + n += 1 + l + sovStakeEntry(uint64(l)) return n } @@ -911,6 +937,39 @@ func (m *StakeEntry) Unmarshal(dAtA []byte) error { } m.Vault = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStakeEntry(dAtA[iNdEx:]) diff --git a/x/pairing/client/cli/tx_modify_provider.go b/x/pairing/client/cli/tx_modify_provider.go index 4b4f224047..4f74fa05aa 100644 --- a/x/pairing/client/cli/tx_modify_provider.go +++ b/x/pairing/client/cli/tx_modify_provider.go @@ -149,7 +149,7 @@ func CmdModifyProvider() *cobra.Command { return err } if moniker != "" { - providerEntry.Moniker = moniker + providerEntry.Description.Moniker = moniker } if cmd.Flags().Changed(types.FlagCommission) { @@ -180,6 +180,43 @@ func CmdModifyProvider() *cobra.Command { validator = getValidator(clientCtx, clientCtx.GetFromAddress().String()) } + identity, err := cmd.Flags().GetString(types.FlagIdentity) + if err != nil { + return err + } + if identity != "" { + providerEntry.Description.Identity = identity + } + + website, err := cmd.Flags().GetString(types.FlagWebsite) + if err != nil { + return err + } + if website != "" { + providerEntry.Description.Website = website + } + + securityContact, err := cmd.Flags().GetString(types.FlagSecurityContact) + if err != nil { + return err + } + if securityContact != "" { + providerEntry.Description.SecurityContact = securityContact + } + + descriptionDetails, err := cmd.Flags().GetString(types.FlagDescriptionDetails) + if err != nil { + return err + } + if descriptionDetails != "" { + providerEntry.Description.Details = descriptionDetails + } + + description, err := providerEntry.Description.EnsureLength() + if err != nil { + return err + } + // modify fields msg := types.NewMsgStakeProvider( clientCtx.GetFromAddress().String(), @@ -188,10 +225,10 @@ func CmdModifyProvider() *cobra.Command { providerEntry.Stake, providerEntry.Endpoints, providerEntry.Geolocation, - providerEntry.Moniker, providerEntry.DelegateLimit, providerEntry.DelegateCommission, providerEntry.Address, + description, ) if msg.DelegateLimit.Denom != commontypes.TokenDenom { @@ -211,6 +248,10 @@ func CmdModifyProvider() *cobra.Command { cmd.Flags().Var(&geolocationVar, GeolocationFlag, `modify the provider's geolocation int32 or string value "EU,US"`) cmd.Flags().Uint64(types.FlagCommission, 50, "The provider's commission from the delegators (default 50)") cmd.Flags().String(types.FlagDelegationLimit, "0ulava", "The provider's total delegation limit from delegators (default 0)") + cmd.Flags().String(types.FlagIdentity, "", "The provider's identity") + cmd.Flags().String(types.FlagWebsite, "", "The provider's website") + cmd.Flags().String(types.FlagSecurityContact, "", "The provider's security contact info") + cmd.Flags().String(types.FlagDescriptionDetails, "", "The provider's description details") flags.AddTxFlagsToCmd(cmd) return cmd diff --git a/x/pairing/client/cli/tx_stake_provider.go b/x/pairing/client/cli/tx_stake_provider.go index 839a49b339..d44a5c62af 100644 --- a/x/pairing/client/cli/tx_stake_provider.go +++ b/x/pairing/client/cli/tx_stake_provider.go @@ -115,6 +115,28 @@ func CmdStakeProvider() *cobra.Command { validator := args[4] + identity, err := cmd.Flags().GetString(types.FlagIdentity) + if err != nil { + return err + } + + website, err := cmd.Flags().GetString(types.FlagWebsite) + if err != nil { + return err + } + + securityContact, err := cmd.Flags().GetString(types.FlagSecurityContact) + if err != nil { + return err + } + + descriptionDetails, err := cmd.Flags().GetString(types.FlagDescriptionDetails) + if err != nil { + return err + } + + description := stakingtypes.NewDescription(moniker, identity, website, securityContact, descriptionDetails) + msg := types.NewMsgStakeProvider( clientCtx.GetFromAddress().String(), validator, @@ -122,10 +144,10 @@ func CmdStakeProvider() *cobra.Command { argAmount, argEndpoints, argGeolocation, - moniker, delegationLimit, commission, provider, + description, ) if err := msg.ValidateBasic(); err != nil { @@ -143,6 +165,10 @@ func CmdStakeProvider() *cobra.Command { cmd.Flags().Uint64(types.FlagCommission, 50, "The provider's commission from the delegators (default 50)") cmd.Flags().String(types.FlagDelegationLimit, "0ulava", "The provider's total delegation limit from delegators (default 0)") cmd.Flags().String(types.FlagProvider, "", "The provider's operational address (address used to operate the provider process, default is vault address)") + cmd.Flags().String(types.FlagIdentity, "", "The provider's identity") + cmd.Flags().String(types.FlagWebsite, "", "The provider's website") + cmd.Flags().String(types.FlagSecurityContact, "", "The provider's security contact info") + cmd.Flags().String(types.FlagDescriptionDetails, "", "The provider's description details") cmd.Flags().Bool(types.FlagGrantFeeAuth, false, "Let the provider use the vault address' funds for gas fees") cmd.MarkFlagRequired(types.FlagMoniker) cmd.MarkFlagRequired(types.FlagDelegationLimit) @@ -222,34 +248,55 @@ func CmdBulkStakeProvider() *cobra.Command { return nil, err } - provider := clientCtx.GetFromAddress().String() - if providerFromFlag != "" { - provider, err = utils.ParseCLIAddress(clientCtx, providerFromFlag) - if err != nil { - return nil, err - } + identity, err := cmd.Flags().GetString(types.FlagIdentity) + if err != nil { + return nil, err } - grantProviderGasFeesAuthFlagUsed, err := cmd.Flags().GetBool(types.FlagGrantFeeAuth) + website, err := cmd.Flags().GetString(types.FlagWebsite) if err != nil { return nil, err } - var feeGrantMsg *feegrant.MsgGrantAllowance - if grantProviderGasFeesAuthFlagUsed { - feeGrantMsg, err = CreateGrantFeeMsg(clientCtx.GetFromAddress().String(), provider) - if err != nil { - return nil, err - } + + securityContact, err := cmd.Flags().GetString(types.FlagSecurityContact) + if err != nil { + return nil, err } - if feeGrantMsg != nil { - msgs = append(msgs, feeGrantMsg) + descriptionDetails, err := cmd.Flags().GetString(types.FlagDescriptionDetails) + if err != nil { + return nil, err } + description := stakingtypes.NewDescription(moniker, identity, website, securityContact, descriptionDetails) + for _, chainID := range chainIDs { if chainID == "" { continue } + provider := clientCtx.GetFromAddress().String() + if providerFromFlag != "" { + provider, err = utils.ParseCLIAddress(clientCtx, providerFromFlag) + if err != nil { + return nil, err + } + } + + grantProviderGasFeesAuthFlagUsed, err := cmd.Flags().GetBool(types.FlagGrantFeeAuth) + if err != nil { + return nil, err + } + var feeGrantMsg *feegrant.MsgGrantAllowance + if grantProviderGasFeesAuthFlagUsed { + feeGrantMsg, err = CreateGrantFeeMsg(clientCtx.GetFromAddress().String(), provider) + if err != nil { + return nil, err + } + } + + if feeGrantMsg != nil { + msgs = append(msgs, feeGrantMsg) + } msg := types.NewMsgStakeProvider( clientCtx.GetFromAddress().String(), @@ -258,10 +305,10 @@ func CmdBulkStakeProvider() *cobra.Command { argAmount, allEndpoints, argGeolocation, - moniker, delegationLimit, commission, provider, + description, ) if msg.DelegateLimit.Denom != commontypes.TokenDenom { @@ -293,7 +340,11 @@ func CmdBulkStakeProvider() *cobra.Command { cmd.Flags().String(types.FlagMoniker, "", "The provider's moniker (non-unique name)") cmd.Flags().Uint64(types.FlagCommission, 50, "The provider's commission from the delegators (default 50)") cmd.Flags().String(types.FlagDelegationLimit, "0ulava", "The provider's total delegation limit from delegators (default 0)") - cmd.Flags().String(types.FlagProvider, "", "The provider's operational address (addresses that are used to operate the provider process. default is provider address)") + cmd.Flags().String(types.FlagProvider, "", "The provider's operational addresses (addresses that are used to operate the provider process. default is vault address)") + cmd.Flags().String(types.FlagIdentity, "", "The provider's identity") + cmd.Flags().String(types.FlagWebsite, "", "The provider's website") + cmd.Flags().String(types.FlagSecurityContact, "", "The provider's security contact info") + cmd.Flags().String(types.FlagDescriptionDetails, "", "The provider's description details") cmd.Flags().Bool(types.FlagGrantFeeAuth, false, "Let the provider use the vault address' funds for gas fees") cmd.MarkFlagRequired(types.FlagMoniker) cmd.MarkFlagRequired(types.FlagDelegationLimit) diff --git a/x/pairing/keeper/grpc_query_provider.go b/x/pairing/keeper/grpc_query_provider.go index af8a0f65a1..eb8c1cc7fa 100644 --- a/x/pairing/keeper/grpc_query_provider.go +++ b/x/pairing/keeper/grpc_query_provider.go @@ -28,6 +28,7 @@ func (k Keeper) Provider(goCtx context.Context, req *types.QueryProviderRequest) if !found { continue } + stakeEntry.Moniker = stakeEntry.Description.Moniker stakeEntries = append(stakeEntries, stakeEntry) } diff --git a/x/pairing/keeper/grpc_query_providers.go b/x/pairing/keeper/grpc_query_providers.go index 7c63b50450..8e645706f0 100644 --- a/x/pairing/keeper/grpc_query_providers.go +++ b/x/pairing/keeper/grpc_query_providers.go @@ -23,6 +23,9 @@ func (k Keeper) Providers(goCtx context.Context, req *types.QueryProvidersReques } stakeEntries := stakeStorage.GetStakeEntries() + for i := range stakeEntries { + stakeEntries[i].Moniker = stakeEntries[i].Description.Moniker + } if !req.ShowFrozen { stakeEntriesNoFrozen := []epochstoragetypes.StakeEntry{} diff --git a/x/pairing/keeper/helpers_test.go b/x/pairing/keeper/helpers_test.go index 3c0be1727d..585e494b18 100644 --- a/x/pairing/keeper/helpers_test.go +++ b/x/pairing/keeper/helpers_test.go @@ -72,35 +72,42 @@ func (ts *tester) addValidators(count int) { // addProvider: with default endpoints, geolocation, moniker func (ts *tester) addProvider(count int) error { - return ts.addProviderExtra(count, nil, 0, "prov") // default: endpoints, geolocation, moniker + d := common.MockDescription() + return ts.addProviderExtra(count, nil, 0, d.Moniker, d.Identity, d.Website, d.SecurityContact, d.Details) // default: endpoints, geolocation, moniker } // addProviderGelocation: with geolocation, and default endpoints, moniker func (ts *tester) addProviderGeolocation(count int, geolocation int32) error { - return ts.addProviderExtra(count, nil, geolocation, "prov") + d := common.MockDescription() + return ts.addProviderExtra(count, nil, geolocation, d.Moniker, d.Identity, d.Website, d.SecurityContact, d.Details) } // addProviderEndpoints: with endpoints, and default geolocation, moniker func (ts *tester) addProviderEndpoints(count int, endpoints []epochstoragetypes.Endpoint) error { - return ts.addProviderExtra(count, endpoints, 0, "prov") + d := common.MockDescription() + return ts.addProviderExtra(count, endpoints, 0, d.Moniker, d.Identity, d.Website, d.SecurityContact, d.Details) } -// addProviderMoniker: with moniker, and default endpoints, geolocation -func (ts *tester) addProviderMoniker(count int, moniker string) error { - return ts.addProviderExtra(count, nil, 0, moniker) +// addProviderDescription: with description, and default endpoints, geolocation +func (ts *tester) addProviderDescription(count int, moniker string, identity string, website string, securityContact string, descriptionDetails string) error { + return ts.addProviderExtra(count, nil, 0, moniker, identity, website, securityContact, descriptionDetails) } -// addProviderExtra: with mock endpoints, and preset geolocation, moniker +// addProviderExtra: with mock endpoints, and preset geolocation, description details func (ts *tester) addProviderExtra( count int, endpoints []epochstoragetypes.Endpoint, geoloc int32, moniker string, + identity string, + website string, + securityContact string, + descriptionDetails string, ) error { start := len(ts.Accounts(common.PROVIDER)) for i := 0; i < count; i++ { acc, addr := ts.AddAccount(common.PROVIDER, start+i, testBalance) - err := ts.StakeProviderExtra(acc.GetVaultAddr(), addr, ts.spec, testStake, endpoints, geoloc, moniker) + err := ts.StakeProviderExtra(acc.GetVaultAddr(), addr, ts.spec, testStake, endpoints, geoloc, moniker, identity, website, securityContact, descriptionDetails) if err != nil { return err } diff --git a/x/pairing/keeper/msg_server_stake_provider.go b/x/pairing/keeper/msg_server_stake_provider.go index 38db89ccfd..7ced508a60 100644 --- a/x/pairing/keeper/msg_server_stake_provider.go +++ b/x/pairing/keeper/msg_server_stake_provider.go @@ -23,8 +23,13 @@ func (k msgServer) StakeProvider(goCtx context.Context, msg *types.MsgStakeProvi return &types.MsgStakeProviderResponse{}, err } + description, err := msg.Description.EnsureLength() + if err != nil { + return &types.MsgStakeProviderResponse{}, err + } + // stakes a new provider entry - err := k.Keeper.StakeNewEntry(ctx, msg.Validator, msg.Creator, msg.ChainID, msg.Amount, msg.Endpoints, msg.Geolocation, msg.Moniker, msg.DelegateLimit, msg.DelegateCommission, msg.Address) + err = k.Keeper.StakeNewEntry(ctx, msg.Validator, msg.Creator, msg.ChainID, msg.Amount, msg.Endpoints, msg.Geolocation, msg.DelegateLimit, msg.DelegateCommission, msg.Address, description) return &types.MsgStakeProviderResponse{}, err } diff --git a/x/pairing/keeper/msg_server_stake_provider_test.go b/x/pairing/keeper/msg_server_stake_provider_test.go index bfccd45dc7..5562e43c78 100644 --- a/x/pairing/keeper/msg_server_stake_provider_test.go +++ b/x/pairing/keeper/msg_server_stake_provider_test.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/lavanet/lava/testutil/common" epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" "github.com/lavanet/lava/x/pairing/client/cli" @@ -14,53 +15,12 @@ import ( "github.com/stretchr/testify/require" ) -// Test that the optional moniker argument in StakeProvider doesn't break anything -func TestStakeProviderWithMoniker(t *testing.T) { - ts := newTester(t) - - tests := []struct { - name string - moniker string - validStake bool - validMoniker bool - }{ - {"NormalMoniker", "exampleMoniker", true, true}, - {"WeirdCharsMoniker", "ビッグファームへようこそ", true, true}, - {"OversizedMoniker", "aReallyReallyReallyReallyReallyReallyReallyLongMoniker", false, false}, // too long - } - - for it, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - ts.AdvanceEpoch() - - // Note: using the same "ts" means each provider added gets a new index ("it") - err := ts.addProviderMoniker(1, tt.moniker) - require.Equal(t, tt.validStake, err == nil, err) - _, provider := ts.GetAccount(common.PROVIDER, it) - - ts.AdvanceEpoch() - - // Get the stake entry and check the provider is staked - stakeEntry, foundProvider := ts.Keepers.Epochstorage.GetStakeEntryByAddressCurrent(ts.Ctx, ts.spec.Index, provider) - require.Equal(t, tt.validStake, foundProvider) - - // Check the assigned moniker - if tt.validMoniker { - require.Equal(t, tt.moniker, stakeEntry.Moniker) - } else { - require.NotEqual(t, tt.moniker, stakeEntry.Moniker) - } - }) - } -} - -func TestModifyStakeProviderWithMoniker(t *testing.T) { +func TestModifyStakeProviderWithDescription(t *testing.T) { ts := newTester(t) ts.AdvanceEpoch() - moniker := "exampleMoniker" - err := ts.addProviderMoniker(1, moniker) + err := ts.addProvider(1) require.NoError(t, err) ts.AdvanceEpoch() @@ -69,19 +29,18 @@ func TestModifyStakeProviderWithMoniker(t *testing.T) { // Get the stake entry and check the provider is staked stakeEntry, foundProvider := ts.Keepers.Epochstorage.GetStakeEntryByAddressCurrent(ts.Ctx, ts.spec.Index, providerAddr) require.True(t, foundProvider) - require.Equal(t, moniker, stakeEntry.Moniker) + require.True(t, stakeEntry.Description.Equal(common.MockDescription())) - // modify moniker - moniker = "anotherExampleMoniker" - err = ts.StakeProviderExtra(providerAcct.GetVaultAddr(), providerAddr, ts.spec, testStake, nil, 0, moniker) + // modify description + dNew := stakingtypes.NewDescription("bla", "blan", "bal", "lala", "asdasd") + err = ts.StakeProviderExtra(providerAcct.GetVaultAddr(), providerAddr, ts.spec, testStake, nil, 0, dNew.Moniker, dNew.Identity, dNew.Website, dNew.SecurityContact, dNew.Details) require.NoError(t, err) ts.AdvanceEpoch() // Get the stake entry and check the provider is staked stakeEntry, foundProvider = ts.Keepers.Epochstorage.GetStakeEntryByAddressCurrent(ts.Ctx, ts.spec.Index, providerAddr) require.True(t, foundProvider) - - require.Equal(t, moniker, stakeEntry.Moniker) + require.True(t, stakeEntry.Description.Equal(dNew)) } func TestCmdStakeProviderGeoConfigAndEnum(t *testing.T) { @@ -248,7 +207,7 @@ func TestCmdStakeProviderGeoConfigAndEnum(t *testing.T) { endpoints[i].ApiInterfaces = []string{"stub"} endpoints[i].Addons = []string{} } - _, err = ts.TxPairingStakeProvider(provider, acc.GetVaultAddr(), ts.spec.Index, ts.spec.MinStakeProvider, endpoints, geo, "prov") + _, err = ts.TxPairingStakeProvider(provider, acc.GetVaultAddr(), ts.spec.Index, ts.spec.MinStakeProvider, endpoints, geo, common.MockDescription()) require.NoError(t, err) } else { require.Error(t, err) @@ -698,7 +657,7 @@ func TestStakeEndpoints(t *testing.T) { for _, play := range playbook { t.Run(play.name, func(t *testing.T) { - _, err := ts.TxPairingStakeProvider(providerAddr, providerAcc.GetVaultAddr(), ts.spec.Index, amount, play.endpoints, play.geolocation, "prov") + _, err := ts.TxPairingStakeProvider(providerAddr, providerAcc.GetVaultAddr(), ts.spec.Index, amount, play.endpoints, play.geolocation, common.MockDescription()) if play.success { require.NoError(t, err) @@ -755,7 +714,7 @@ func TestStakeProviderLimits(t *testing.T) { for it, tt := range testCases { t.Run(tt.name, func(t *testing.T) { providerAcct, addr := ts.AddAccount(common.PROVIDER, it+1, tt.stake) - err := ts.StakeProviderExtra(providerAcct.GetVaultAddr(), addr, ts.spec, tt.stake, nil, 0, "") + err := ts.StakeProviderExtra(providerAcct.GetVaultAddr(), addr, ts.spec, tt.stake, nil, 0, "", "", "", "", "") if !tt.isStaked { require.Error(t, err) return @@ -782,7 +741,7 @@ func TestUnfreezeWithDelegations(t *testing.T) { // stake minSelfDelegation+1 -> provider staked but frozen providerAcc, provider := ts.AddAccount(common.PROVIDER, 1, minSelfDelegation.Amount.Int64()+1) - err := ts.StakeProviderExtra(providerAcc.GetVaultAddr(), provider, ts.spec, minSelfDelegation.Amount.Int64()+1, nil, 0, "") + err := ts.StakeProviderExtra(providerAcc.GetVaultAddr(), provider, ts.spec, minSelfDelegation.Amount.Int64()+1, nil, 0, "", "", "", "", "") require.NoError(t, err) stakeEntry, found := ts.Keepers.Epochstorage.GetStakeEntryByAddressCurrent(ts.Ctx, ts.spec.Index, provider) require.True(t, found) @@ -831,14 +790,14 @@ func TestCommisionChange(t *testing.T) { ts.AdvanceEpoch() _, provider := ts.AddAccount(common.PROVIDER, 1, ts.spec.MinStakeProvider.Amount.Int64()) - _, err := ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, "", 50, 100) + _, err := ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, 50, 100, "", "", "", "", "") require.NoError(t, err) // there are no delegations, can change as much as we want - _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, "", 55, 120) + _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, 55, 120, "", "", "", "", "") require.NoError(t, err) - _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, "", 60, 140) + _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, 60, 140, "", "", "", "", "") require.NoError(t, err) // add delegator and delegate to provider @@ -849,20 +808,20 @@ func TestCommisionChange(t *testing.T) { ts.AdvanceBlock(time.Hour * 25) // advance time to allow changes // now changes are limited - _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, "", 61, 139) + _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, 61, 139, "", "", "", "", "") require.NoError(t, err) - _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, "", 62, 138) + _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, 62, 138, "", "", "", "", "") require.Error(t, err) ts.AdvanceBlock(time.Hour * 25) - _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, "", 62, 138) + _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, 62, 138, "", "", "", "", "") require.NoError(t, err) ts.AdvanceBlock(time.Hour * 25) - _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, "", 68, 100) + _, err = ts.TxPairingStakeProviderFull(provider, provider, ts.spec.Index, ts.spec.MinStakeProvider, nil, 0, 68, 100, "", "", "", "", "") require.Error(t, err) } @@ -904,7 +863,7 @@ func TestVaultProviderNewStakeEntry(t *testing.T) { t.Run(tt.name, func(t *testing.T) { vaultBefore := ts.GetBalance(tt.vault) providerBefore := ts.GetBalance(tt.provider) - err := ts.StakeProviderExtra(tt.vault.String(), tt.provider.String(), tt.spec, testStake, []epochstoragetypes.Endpoint{{Geolocation: 1}}, 1, "test") + err := ts.StakeProviderExtra(tt.vault.String(), tt.provider.String(), tt.spec, testStake, []epochstoragetypes.Endpoint{{Geolocation: 1}}, 1, "", "", "", "", "") vaultAfter := ts.GetBalance(tt.vault) providerAfter := ts.GetBalance(tt.provider) @@ -964,7 +923,7 @@ func TestVaultProviderExistingStakeEntry(t *testing.T) { ts := newTester(t) p1Acc, _ := ts.AddAccount(common.PROVIDER, 0, testBalance) - err := ts.StakeProviderExtra(p1Acc.GetVaultAddr(), p1Acc.Addr.String(), ts.spec, testStake, []epochstoragetypes.Endpoint{{Geolocation: 1}}, 1, "test") + err := ts.StakeProviderExtra(p1Acc.GetVaultAddr(), p1Acc.Addr.String(), ts.spec, testStake, []epochstoragetypes.Endpoint{{Geolocation: 1}}, 1, "", "", "", "", "") require.NoError(t, err) tests := []struct { @@ -983,7 +942,7 @@ func TestVaultProviderExistingStakeEntry(t *testing.T) { beforeVault := ts.GetBalance(tt.vault) beforeProvider := ts.GetBalance(tt.provider) fundsToStake := testStake + (100 * int64(i+1)) // funds to stake. needs to change each iteration for the checks below - err := ts.StakeProviderExtra(tt.vault.String(), tt.provider.String(), tt.spec, fundsToStake, []epochstoragetypes.Endpoint{{Geolocation: 1}}, 1, "test") + err := ts.StakeProviderExtra(tt.vault.String(), tt.provider.String(), tt.spec, fundsToStake, []epochstoragetypes.Endpoint{{Geolocation: 1}}, 1, "", "", "", "", "") afterVault := ts.GetBalance(tt.vault) afterProvider := ts.GetBalance(tt.provider) @@ -1055,7 +1014,7 @@ func TestVaultProviderModifyStakeEntry(t *testing.T) { const ( STAKE = iota + 1 ENDPOINTS_GEOLOCATION - MONIKER + DESCRIPTION DELEGATE_LIMIT DELEGATE_COMMISSION PROVIDER @@ -1070,7 +1029,7 @@ func TestVaultProviderModifyStakeEntry(t *testing.T) { // vault can change anything {"stake change vault", vault, STAKE, true}, {"endpoints_geo change vault", vault, ENDPOINTS_GEOLOCATION, true}, - {"moniker change vault", vault, MONIKER, true}, + {"description change vault", vault, DESCRIPTION, true}, {"delegate total change vault", vault, DELEGATE_LIMIT, true}, {"delegate commission change vault", vault, DELEGATE_COMMISSION, true}, {"provider change vault", vault, PROVIDER, true}, @@ -1078,7 +1037,7 @@ func TestVaultProviderModifyStakeEntry(t *testing.T) { // provider can't change stake/delegation related properties {"stake change provider", provider, STAKE, false}, {"endpoints_geo change provider", provider, ENDPOINTS_GEOLOCATION, true}, - {"moniker change provider", provider, MONIKER, true}, + {"description change provider", provider, DESCRIPTION, true}, {"delegate total change provider", provider, DELEGATE_LIMIT, false}, {"delegate commission change provider", provider, DELEGATE_COMMISSION, false}, {"provider change provider", provider, PROVIDER, true}, @@ -1093,10 +1052,10 @@ func TestVaultProviderModifyStakeEntry(t *testing.T) { Amount: stakeEntry.Stake, Geolocation: stakeEntry.Geolocation, Endpoints: stakeEntry.Endpoints, - Moniker: stakeEntry.Moniker, DelegateLimit: stakeEntry.DelegateLimit, DelegateCommission: stakeEntry.DelegateCommission, Address: stakeEntry.Address, + Description: stakeEntry.Description, } switch tt.stakeChange { @@ -1105,8 +1064,8 @@ func TestVaultProviderModifyStakeEntry(t *testing.T) { case ENDPOINTS_GEOLOCATION: msg.Endpoints = []epochstoragetypes.Endpoint{{Geolocation: 2}} msg.Geolocation = 2 - case MONIKER: - msg.Moniker = "test2" + case DESCRIPTION: + msg.Description = stakingtypes.NewDescription("bla", "bla", "", "", "") case DELEGATE_LIMIT: msg.DelegateLimit = msg.DelegateLimit.AddAmount(math.NewInt(100)) case DELEGATE_COMMISSION: @@ -1122,9 +1081,13 @@ func TestVaultProviderModifyStakeEntry(t *testing.T) { msg.Amount, msg.Endpoints, msg.Geolocation, - msg.Moniker, msg.DelegateCommission, msg.DelegateLimit.Amount.Uint64(), + msg.Description.Moniker, + msg.Description.Identity, + msg.Description.Website, + msg.Description.SecurityContact, + msg.Description.Details, ) if tt.valid { require.NoError(t, err) diff --git a/x/pairing/keeper/pairing_test.go b/x/pairing/keeper/pairing_test.go index 94356aa7d5..94339ffca4 100644 --- a/x/pairing/keeper/pairing_test.go +++ b/x/pairing/keeper/pairing_test.go @@ -2460,6 +2460,7 @@ func TestMaxEndpointPerGeolocationLimit(t *testing.T) { // try staking with 2*MAX_ENDPOINTS_AMOUNT_PER_GEO+1 endpoint in USE, should fail acc, addr := ts.AddAccount(common.PROVIDER, 0, testStake) + d := common.MockDescription() err := ts.StakeProviderExtra( acc.GetVaultAddr(), addr, @@ -2467,7 +2468,11 @@ func TestMaxEndpointPerGeolocationLimit(t *testing.T) { testStake/2, endpoints[:(2*types.MAX_ENDPOINTS_AMOUNT_PER_GEO)+1], geolocations[0], - "dummy_provider", + d.Moniker, + d.Identity, + d.Website, + d.SecurityContact, + d.Details, ) require.Error(t, err) @@ -2480,7 +2485,11 @@ func TestMaxEndpointPerGeolocationLimit(t *testing.T) { testStake/2, validEndpointsArray, geolocations[0]+geolocations[1], - "dummy_provider", + d.Moniker, + d.Identity, + d.Website, + d.SecurityContact, + d.Details, ) require.NoError(t, err) @@ -2493,7 +2502,11 @@ func TestMaxEndpointPerGeolocationLimit(t *testing.T) { testStake/2, endpoints[:(2*types.MAX_ENDPOINTS_AMOUNT_PER_GEO)+1], geolocations[0], - "dummy_provider", + d.Moniker, + d.Identity, + d.Website, + d.SecurityContact, + d.Details, ) require.Error(t, err) } diff --git a/x/pairing/keeper/staking.go b/x/pairing/keeper/staking.go index 85327b2c88..8a350f6f1d 100644 --- a/x/pairing/keeper/staking.go +++ b/x/pairing/keeper/staking.go @@ -6,6 +6,7 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/lavanet/lava/utils" epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" "github.com/lavanet/lava/x/pairing/types" @@ -18,7 +19,7 @@ const ( CHANGE_WINDOW = time.Hour * 24 ) -func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID string, amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geolocation int32, moniker string, delegationLimit sdk.Coin, delegationCommission uint64, provider string) error { +func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID string, amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geolocation int32, delegationLimit sdk.Coin, delegationCommission uint64, provider string, description stakingtypes.Description) error { logger := k.Logger(ctx) specChainID := chainID @@ -68,7 +69,7 @@ func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID strin return utils.LavaFormatWarning("stake provider failed", fmt.Errorf("number of endpoint for geolocation exceeded limit"), utils.LogAttr("creator", creator), utils.LogAttr("chain_id", chainID), - utils.LogAttr("moniker", moniker), + utils.LogAttr("description", description.String()), utils.LogAttr("geolocation", geolocation), utils.LogAttr("max_endpoints_allowed", types.MAX_ENDPOINTS_AMOUNT_PER_GEO), ) @@ -77,10 +78,6 @@ func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID strin // new staking takes effect from the next block stakeAppliedBlock := uint64(ctx.BlockHeight()) + 1 - if len(moniker) > 50 { - moniker = moniker[:50] - } - existingEntry, entryExists := k.epochStorageKeeper.GetStakeEntryByAddressCurrent(ctx, chainID, creator) if entryExists { // modify the entry (check who's modifying - vault/provider) @@ -104,6 +101,7 @@ func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID strin utils.LogAttr("creator", creator), utils.LogAttr("vault", existingEntry.Vault), utils.LogAttr("provider", provider), + utils.LogAttr("description", description.String()), utils.LogAttr("current_delegation_limit", existingEntry.DelegateLimit), utils.LogAttr("req_delegation_limit", delegationLimit), utils.LogAttr("current_delegation_commission", existingEntry.DelegateCommission), @@ -118,6 +116,7 @@ func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID strin utils.LogAttr("creator", creator), utils.LogAttr("provider", existingEntry.Address), utils.LogAttr("vault", existingEntry.Vault), + utils.LogAttr("description", description.String()), ) } } @@ -127,14 +126,15 @@ func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID strin {Key: "provider", Value: senderAddr.String()}, {Key: "stakeAppliedBlock", Value: stakeAppliedBlock}, {Key: "stake", Value: amount}, + utils.LogAttr("description", description.String()), } - details = append(details, utils.Attribute{Key: "moniker", Value: moniker}) + details = append(details, utils.Attribute{Key: "moniker", Value: description.Moniker}) // if the provider has no delegations then we dont limit the changes if !existingEntry.DelegateTotal.IsZero() { // if there was a change in the last 24h than we dont allow changes if ctx.BlockTime().UTC().Unix()-int64(existingEntry.LastChange) < int64(CHANGE_WINDOW.Seconds()) { - if delegationCommission != existingEntry.DelegateCommission || existingEntry.DelegateLimit != delegationLimit { + if delegationCommission != existingEntry.DelegateCommission || !existingEntry.DelegateLimit.IsEqual(delegationLimit) { return utils.LavaFormatWarning(fmt.Sprintf("stake entry commmision or delegate limit can only be changes once in %s", CHANGE_WINDOW), nil, utils.LogAttr("last_change_time", existingEntry.LastChange)) } @@ -161,7 +161,7 @@ func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID strin // we dont change stakeAppliedBlocks and chain once they are set, if they need to change, unstake first existingEntry.Geolocation = geolocation existingEntry.Endpoints = endpointsVerified - existingEntry.Moniker = moniker + existingEntry.Description = description existingEntry.DelegateCommission = delegationCommission existingEntry.DelegateLimit = delegationLimit existingEntry.LastChange = uint64(ctx.BlockTime().UTC().Unix()) @@ -255,7 +255,7 @@ func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID strin Endpoints: endpointsVerified, Geolocation: geolocation, Chain: chainID, - Moniker: moniker, + Description: description, DelegateTotal: sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), delegateTotal), DelegateLimit: delegationLimit, DelegateCommission: delegationCommission, @@ -272,8 +272,7 @@ func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID strin ) } - details = append(details, utils.Attribute{Key: "moniker", Value: moniker}) - + details = append(details, utils.Attribute{Key: "moniker", Value: description.Moniker}) detailsMap := map[string]string{} for _, atr := range details { detailsMap[atr.Key] = fmt.Sprint(atr.Value) diff --git a/x/pairing/keeper/unstaking.go b/x/pairing/keeper/unstaking.go index 3a39ac4069..03cf72fde9 100644 --- a/x/pairing/keeper/unstaking.go +++ b/x/pairing/keeper/unstaking.go @@ -69,7 +69,8 @@ func (k Keeper) UnstakeEntry(ctx sdk.Context, validator, chainID, creator, unsta "address": existingEntry.GetAddress(), "chainID": existingEntry.GetChain(), "geolocation": strconv.FormatInt(int64(existingEntry.GetGeolocation()), 10), - "moniker": existingEntry.GetMoniker(), + "moniker": existingEntry.Description.Moniker, + "description": existingEntry.Description.String(), "stake": existingEntry.GetStake().Amount.String(), } utils.LogLavaEvent(ctx, logger, types.ProviderUnstakeEventName, details, unstakeDescription) @@ -135,7 +136,8 @@ func (k Keeper) UnstakeEntryForce(ctx sdk.Context, chainID, provider, unstakeDes "address": existingEntry.GetAddress(), "chainID": existingEntry.GetChain(), "geolocation": strconv.FormatInt(int64(existingEntry.GetGeolocation()), 10), - "moniker": existingEntry.GetMoniker(), + "description": existingEntry.Description.String(), + "moniker": existingEntry.Description.Moniker, "stake": existingEntry.GetStake().Amount.String(), } utils.LogLavaEvent(ctx, k.Logger(ctx), types.ProviderUnstakeEventName, details, unstakeDescription) diff --git a/x/pairing/types/errors.go b/x/pairing/types/errors.go index 92459a4d40..2a4e391e94 100644 --- a/x/pairing/types/errors.go +++ b/x/pairing/types/errors.go @@ -15,8 +15,7 @@ var ( NotEnoughBlocksToCalculateAverageBlockTimeError = sdkerrors.New("NotEnoughBlocksToCalculateAverageBlockTimeError Error", 688, "There isn't enough blocks in the previous epoch to calculate average block time") FreezeReasonTooLongError = sdkerrors.New("FreezeReasonTooLongError Error", 689, "The freeze reason is too long. Keep the freeze reason less than 50 characters") FreezeStakeEntryNotFoundError = sdkerrors.New("FreezeStakeEntryNotFoundError Error", 690, "Can't get stake entry to freeze") - MonikerTooLongError = sdkerrors.New("MonikerTooLongError Error", 691, "The provider's moniker is too long. Keep it less than 50 characters") - MonikerEmptyError = sdkerrors.New("MonikerEmptyError Error", 692, "The provider's moniker cannot be empty") + InvalidDescriptionError = sdkerrors.New("InvalidDescriptionError Error", 691, "The provider's description is invalid") GeolocationNotMatchWithEndpointsError = sdkerrors.New("GeolocationNotMatchWithEndpointsError Error", 693, "The combination of the endpoints' geolocation does not match to the provider's geolocation") DelegateCommissionOOBError = sdkerrors.New("DelegateCommissionOOBError Error", 694, "Delegation commission out of bound [0,100]") DelegateLimitError = sdkerrors.New("DelegateLimitError Error", 695, "Delegation limit coin is invalid") diff --git a/x/pairing/types/message_stake_provider.go b/x/pairing/types/message_stake_provider.go index 5ed4389b04..6989909f14 100644 --- a/x/pairing/types/message_stake_provider.go +++ b/x/pairing/types/message_stake_provider.go @@ -4,6 +4,7 @@ import ( sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" legacyerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" ) @@ -11,7 +12,7 @@ const TypeMsgStakeProvider = "stake_provider" var _ sdk.Msg = &MsgStakeProvider{} -func NewMsgStakeProvider(creator, validator, chainID string, amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geolocation int32, moniker string, delegateLimit sdk.Coin, delegateCommission uint64, provider string) *MsgStakeProvider { +func NewMsgStakeProvider(creator, validator, chainID string, amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geolocation int32, delegateLimit sdk.Coin, delegateCommission uint64, provider string, description stakingtypes.Description) *MsgStakeProvider { return &MsgStakeProvider{ Creator: creator, Validator: validator, @@ -19,10 +20,10 @@ func NewMsgStakeProvider(creator, validator, chainID string, amount sdk.Coin, en Amount: amount, Endpoints: endpoints, Geolocation: geolocation, - Moniker: moniker, DelegateLimit: delegateLimit, DelegateCommission: delegateCommission, Address: provider, + Description: description, } } @@ -60,8 +61,8 @@ func (msg *MsgStakeProvider) ValidateBasic() error { return sdkerrors.Wrapf(legacyerrors.ErrInvalidAddress, "invalid provider address (%s)", err) } - if len(msg.Moniker) > MAX_LEN_MONIKER { - return sdkerrors.Wrapf(MonikerTooLongError, "invalid moniker (%s)", msg.Moniker) + if _, err := msg.Description.EnsureLength(); err != nil { + return sdkerrors.Wrapf(InvalidDescriptionError, "error: %s", err.Error()) } if msg.DelegateCommission > 100 { diff --git a/x/pairing/types/message_stake_provider_test.go b/x/pairing/types/message_stake_provider_test.go index 689eb39b36..11524c8365 100644 --- a/x/pairing/types/message_stake_provider_test.go +++ b/x/pairing/types/message_stake_provider_test.go @@ -6,12 +6,14 @@ import ( "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/types" legacyerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" commontypes "github.com/lavanet/lava/common/types" "github.com/lavanet/lava/testutil/sample" "github.com/stretchr/testify/require" ) func TestMsgStakeProvider_ValidateBasic(t *testing.T) { + d := stakingtypes.NewDescription("dummy", "", "", "", "") tests := []struct { name string msg MsgStakeProvider @@ -21,7 +23,7 @@ func TestMsgStakeProvider_ValidateBasic(t *testing.T) { name: "invalid address", msg: MsgStakeProvider{ Creator: "invalid_address", - Moniker: "dummyMoniker", + Description: d, DelegateLimit: types.NewCoin(commontypes.TokenDenom, types.ZeroInt()), DelegateCommission: 100, Validator: sample.ValAddress(), @@ -34,7 +36,7 @@ func TestMsgStakeProvider_ValidateBasic(t *testing.T) { name: "invalid provider address", msg: MsgStakeProvider{ Creator: sample.AccAddress(), - Moniker: "dummyMoniker", + Description: d, DelegateLimit: types.NewCoin(commontypes.TokenDenom, types.ZeroInt()), DelegateCommission: 100, Validator: sample.ValAddress(), @@ -47,7 +49,7 @@ func TestMsgStakeProvider_ValidateBasic(t *testing.T) { name: "invalid validator address", msg: MsgStakeProvider{ Creator: sample.AccAddress(), - Moniker: "dummyMoniker", + Description: d, DelegateLimit: types.NewCoin(commontypes.TokenDenom, types.ZeroInt()), DelegateCommission: 100, Validator: "invalid_address", @@ -60,7 +62,7 @@ func TestMsgStakeProvider_ValidateBasic(t *testing.T) { name: "invalid amount", msg: MsgStakeProvider{ Creator: sample.AccAddress(), - Moniker: "dummyMoniker", + Description: d, DelegateLimit: types.NewCoin(commontypes.TokenDenom, types.ZeroInt()), DelegateCommission: 100, Validator: sample.ValAddress(), @@ -72,7 +74,7 @@ func TestMsgStakeProvider_ValidateBasic(t *testing.T) { name: "valid address", msg: MsgStakeProvider{ Creator: sample.AccAddress(), - Moniker: "dummyMoniker", + Description: d, DelegateLimit: types.NewCoin(commontypes.TokenDenom, types.ZeroInt()), DelegateCommission: 100, Validator: sample.ValAddress(), diff --git a/x/pairing/types/tx.pb.go b/x/pairing/types/tx.pb.go index 2068da35db..b97d9e5549 100644 --- a/x/pairing/types/tx.pb.go +++ b/x/pairing/types/tx.pb.go @@ -7,6 +7,8 @@ import ( context "context" fmt "fmt" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + types2 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -31,16 +33,16 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgStakeProvider struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ChainID string `protobuf:"bytes,2,opt,name=chainID,proto3" json:"chainID,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` - Endpoints []types1.Endpoint `protobuf:"bytes,4,rep,name=endpoints,proto3" json:"endpoints"` - Geolocation int32 `protobuf:"varint,5,opt,name=geolocation,proto3" json:"geolocation,omitempty"` - Moniker string `protobuf:"bytes,6,opt,name=moniker,proto3" json:"moniker,omitempty"` - DelegateLimit types.Coin `protobuf:"bytes,7,opt,name=delegate_limit,json=delegateLimit,proto3" json:"delegate_limit"` - DelegateCommission uint64 `protobuf:"varint,8,opt,name=delegate_commission,json=delegateCommission,proto3" json:"delegate_commission,omitempty"` - Validator string `protobuf:"bytes,9,opt,name=validator,proto3" json:"validator,omitempty"` - Address string `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ChainID string `protobuf:"bytes,2,opt,name=chainID,proto3" json:"chainID,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + Endpoints []types1.Endpoint `protobuf:"bytes,4,rep,name=endpoints,proto3" json:"endpoints"` + Geolocation int32 `protobuf:"varint,5,opt,name=geolocation,proto3" json:"geolocation,omitempty"` + DelegateLimit types.Coin `protobuf:"bytes,7,opt,name=delegate_limit,json=delegateLimit,proto3" json:"delegate_limit"` + DelegateCommission uint64 `protobuf:"varint,8,opt,name=delegate_commission,json=delegateCommission,proto3" json:"delegate_commission,omitempty"` + Validator string `protobuf:"bytes,9,opt,name=validator,proto3" json:"validator,omitempty"` + Address string `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty"` + Description types2.Description `protobuf:"bytes,11,opt,name=description,proto3" json:"description"` } func (m *MsgStakeProvider) Reset() { *m = MsgStakeProvider{} } @@ -111,13 +113,6 @@ func (m *MsgStakeProvider) GetGeolocation() int32 { return 0 } -func (m *MsgStakeProvider) GetMoniker() string { - if m != nil { - return m.Moniker - } - return "" -} - func (m *MsgStakeProvider) GetDelegateLimit() types.Coin { if m != nil { return m.DelegateLimit @@ -146,6 +141,13 @@ func (m *MsgStakeProvider) GetAddress() string { return "" } +func (m *MsgStakeProvider) GetDescription() types2.Description { + if m != nil { + return m.Description + } + return types2.Description{} +} + type MsgStakeProviderResponse struct { } @@ -643,57 +645,60 @@ func init() { func init() { proto.RegisterFile("lavanet/lava/pairing/tx.proto", fileDescriptor_07b85a84d2198a91) } var fileDescriptor_07b85a84d2198a91 = []byte{ - // 785 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x8f, 0x37, 0x6e, 0x9a, 0xbc, 0xec, 0xf6, 0xcf, 0x6c, 0xc5, 0x7a, 0xbd, 0xbb, 0x21, 0x18, - 0x41, 0x82, 0x04, 0x36, 0x2d, 0x07, 0x24, 0x6e, 0xa4, 0x50, 0x54, 0x68, 0x44, 0xe5, 0x8a, 0x03, - 0x5c, 0xa2, 0x89, 0x3d, 0x75, 0xa7, 0xb5, 0x3d, 0x96, 0x67, 0x1a, 0xb5, 0x7c, 0x0a, 0xbe, 0x02, - 0x1f, 0x82, 0xef, 0xd0, 0x63, 0x8f, 0x9c, 0x10, 0x6a, 0xbf, 0x03, 0x67, 0xe4, 0xf1, 0xd8, 0x8d, - 0x9d, 0xb4, 0x8a, 0x04, 0xa7, 0xf8, 0xcd, 0xfb, 0xbd, 0xf7, 0x7e, 0xef, 0xbd, 0xdf, 0x64, 0xe0, - 0x5d, 0x88, 0x67, 0x38, 0x26, 0xc2, 0xc9, 0x7e, 0x9d, 0x04, 0xd3, 0x94, 0xc6, 0x81, 0x23, 0xae, - 0xec, 0x24, 0x65, 0x82, 0xa1, 0x1d, 0xe5, 0xb6, 0xb3, 0x5f, 0x5b, 0xb9, 0xcd, 0x9e, 0xc7, 0x78, - 0xc4, 0xb8, 0x33, 0xc5, 0x9c, 0x38, 0xb3, 0xdd, 0x29, 0x11, 0x78, 0xd7, 0xf1, 0x18, 0x8d, 0xf3, - 0x28, 0x73, 0x27, 0x60, 0x01, 0x93, 0x9f, 0x4e, 0xf6, 0xa5, 0x4e, 0x87, 0x95, 0x52, 0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0xf0, 0xb2, 0xcc, 0xe3, 0xb1, 0x28, 0xa2, 0x9c, 0x67, 0x5c, 0xda, 0x7d, - 0x6d, 0xa8, 0xbb, 0xa8, 0x70, 0xed, 0x97, 0x1e, 0xf4, 0x16, 0x3a, 0x33, 0x1c, 0x52, 0x5f, 0x0e, - 0xbb, 0x23, 0x49, 0x3d, 0x1c, 0x64, 0x84, 0xb1, 0xef, 0xa7, 0x84, 0x73, 0x03, 0x72, 0xc2, 0xca, - 0xb4, 0x4c, 0x30, 0xea, 0x6b, 0x73, 0x09, 0x4f, 0x58, 0xcc, 0x89, 0x75, 0x0a, 0x68, 0xcc, 0x83, - 0x9f, 0x62, 0xfe, 0x9f, 0x97, 0x5a, 0x61, 0xd7, 0xac, 0xb1, 0xb3, 0xde, 0x82, 0xb9, 0x58, 0xa7, - 0x64, 0xf1, 0x8f, 0x06, 0x9b, 0x63, 0x1e, 0xb8, 0x99, 0xd8, 0x8e, 0xf1, 0x75, 0x44, 0x62, 0xf1, - 0x04, 0x87, 0xaf, 0xa0, 0x25, 0x65, 0xc9, 0x8d, 0x67, 0x52, 0x02, 0x96, 0xbd, 0xec, 0xc2, 0xd8, - 0x32, 0xdb, 0x09, 0x91, 0xb3, 0x73, 0x55, 0x04, 0xfa, 0x14, 0xb6, 0x7d, 0xc2, 0xbd, 0x94, 0x26, - 0xd9, 0x96, 0x4f, 0x44, 0x86, 0x34, 0x74, 0x99, 0x7f, 0xd1, 0x81, 0x7e, 0x86, 0x9d, 0x10, 0x0b, - 0xc2, 0xc5, 0x64, 0x1a, 0x32, 0xef, 0x62, 0x92, 0x92, 0x84, 0xa5, 0x82, 0x1b, 0x6b, 0xb2, 0xee, - 0x60, 0x79, 0xdd, 0x23, 0x19, 0x31, 0xca, 0x02, 0x5c, 0x89, 0x77, 0x51, 0x58, 0x3f, 0xe2, 0xdf, - 0xeb, 0xed, 0xe6, 0x96, 0x6e, 0xfd, 0x08, 0xdb, 0x0b, 0x70, 0xf4, 0x0a, 0x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, 0x20, 0x8d, 0x4f, 0x9e, 0x98, 0x4b, 0x15, 0x6a, 0xee, 0xae, 0x0c, 0x2d, 0x2a, - 0x8e, 0xbe, 0xbe, 0xb9, 0xeb, 0x69, 0xb7, 0x77, 0x3d, 0xed, 0xef, 0xbb, 0x9e, 0xf6, 0xdb, 0x7d, - 0xaf, 0x71, 0x7b, 0xdf, 0x6b, 0xfc, 0x79, 0xdf, 0x6b, 0xfc, 0x32, 0x08, 0xa8, 0x38, 0xbb, 0x9c, - 0xda, 0x1e, 0x8b, 0x9c, 0xca, 0xf3, 0x79, 0xf5, 0xf0, 0xaa, 0x5f, 0x27, 0x84, 0x4f, 0x5b, 0xf2, - 0x05, 0xfd, 0xe2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xea, 0xe4, 0x2b, 0xfa, 0x07, 0x00, - 0x00, + // 836 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x73, 0xdb, 0x44, + 0x14, 0xb7, 0x6a, 0xc5, 0x7f, 0x9e, 0xdb, 0xc4, 0xde, 0x66, 0xa8, 0xaa, 0xb6, 0xc6, 0xa8, 0x80, + 0x0d, 0x03, 0x12, 0x09, 0x07, 0x66, 0xb8, 0xe1, 0x96, 0x32, 0x2d, 0xf5, 0x90, 0x51, 0x86, 0x03, + 0x5c, 0x3c, 0x6b, 0x69, 0xab, 0x6c, 0x23, 0x69, 0x35, 0xda, 0xad, 0xa7, 0xe1, 0x53, 0xf0, 0x15, + 0xb8, 0x71, 0xe4, 0x63, 0xe4, 0x98, 0x23, 0x27, 0x86, 0x49, 0x0e, 0x7c, 0x00, 0x66, 0x38, 0x33, + 0x5a, 0xaf, 0x64, 0x4b, 0x76, 0x32, 0x9e, 0x81, 0x4b, 0xa4, 0xf7, 0xde, 0xef, 0xbd, 0xf7, 0xdb, + 0xdf, 0x7b, 0x1b, 0x19, 0x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, 0xaf, 0xf3, 0xdc, + 0x71, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -940,6 +945,16 @@ func (m *MsgStakeProvider) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) @@ -969,13 +984,6 @@ func (m *MsgStakeProvider) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x3a - if len(m.Moniker) > 0 { - i -= len(m.Moniker) - copy(dAtA[i:], m.Moniker) - i = encodeVarintTx(dAtA, i, uint64(len(m.Moniker))) - i-- - dAtA[i] = 0x32 - } if m.Geolocation != 0 { i = encodeVarintTx(dAtA, i, uint64(m.Geolocation)) i-- @@ -1412,10 +1420,6 @@ func (m *MsgStakeProvider) Size() (n int) { if m.Geolocation != 0 { n += 1 + sovTx(uint64(m.Geolocation)) } - l = len(m.Moniker) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = m.DelegateLimit.Size() n += 1 + l + sovTx(uint64(l)) if m.DelegateCommission != 0 { @@ -1429,6 +1433,8 @@ func (m *MsgStakeProvider) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -1773,38 +1779,6 @@ func (m *MsgStakeProvider) Unmarshal(dAtA []byte) error { break } } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Moniker", 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.Moniker = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DelegateLimit", wireType) @@ -1921,6 +1895,39 @@ func (m *MsgStakeProvider) Unmarshal(dAtA []byte) error { } m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", 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 err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/pairing/types/types.go b/x/pairing/types/types.go index 2906278ea4..02daaccdf2 100644 --- a/x/pairing/types/types.go +++ b/x/pairing/types/types.go @@ -25,8 +25,11 @@ const ( FlagCommission = "delegate-commission" FlagDelegationLimit = "delegate-limit" FlagProvider = "provider" + FlagIdentity = "identity" + FlagWebsite = "website" + FlagSecurityContact = "security-contact" + FlagDescriptionDetails = "description-details" FlagGrantFeeAuth = "grant-provider-gas-fees-auth" - MAX_LEN_MONIKER = 50 MAX_ENDPOINTS_AMOUNT_PER_GEO = 5 // max number of endpoints per geolocation for provider stake entry ) diff --git a/x/spec/types/spec.go b/x/spec/types/spec.go index c178f88042..50089e2442 100644 --- a/x/spec/types/spec.go +++ b/x/spec/types/spec.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" commontypes "github.com/lavanet/lava/common/types" "github.com/lavanet/lava/utils" ) @@ -39,6 +40,10 @@ func (spec Spec) ValidateSpec(maxCU uint64) (map[string]string, error) { return details, fmt.Errorf("spec index can be letters and numbers only %s", spec.Index) } + if len(spec.Identity) > stakingtypes.MaxIdentityLength { + return details, fmt.Errorf("spec identity should not be longer than %d. Identity: %s", stakingtypes.MaxIdentityLength, spec.Index) + } + for _, char := range spec.Name { if !unicode.IsLower(char) && char != ' ' { return details, fmt.Errorf("spec name must contain lowercase characters only") diff --git a/x/spec/types/spec.pb.go b/x/spec/types/spec.pb.go index acb9b83da0..ab47f378b6 100644 --- a/x/spec/types/spec.pb.go +++ b/x/spec/types/spec.pb.go @@ -68,6 +68,7 @@ type Spec struct { Contributor []string `protobuf:"bytes,17,rep,name=contributor,proto3" json:"contributor,omitempty"` ContributorPercentage *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,18,opt,name=contributor_percentage,json=contributorPercentage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"contributor_percentage,omitempty"` Shares uint64 `protobuf:"varint,19,opt,name=shares,proto3" json:"shares,omitempty"` + Identity string `protobuf:"bytes,20,opt,name=identity,proto3" json:"identity,omitempty"` } func (m *Spec) Reset() { *m = Spec{} } @@ -215,6 +216,13 @@ func (m *Spec) GetShares() uint64 { return 0 } +func (m *Spec) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + func init() { proto.RegisterEnum("lavanet.lava.spec.Spec_ProvidersTypes", Spec_ProvidersTypes_name, Spec_ProvidersTypes_value) proto.RegisterType((*Spec)(nil), "lavanet.lava.spec.Spec") @@ -223,51 +231,52 @@ func init() { func init() { proto.RegisterFile("lavanet/lava/spec/spec.proto", fileDescriptor_789140b95c48dfce) } var fileDescriptor_789140b95c48dfce = []byte{ - // 702 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x54, 0xcf, 0x4e, 0xfb, 0x36, - 0x1c, 0x6f, 0xd6, 0xfc, 0xda, 0xe2, 0xee, 0x57, 0x82, 0x07, 0xc8, 0x20, 0x16, 0x32, 0x34, 0xa1, - 0x6c, 0xda, 0x12, 0x01, 0x97, 0xdd, 0x26, 0x0a, 0xab, 0x06, 0xda, 0x34, 0x16, 0xd8, 0x65, 0x97, - 0xc8, 0x71, 0x4c, 0x6b, 0x91, 0xd8, 0x59, 0x6c, 0x3a, 0xba, 0xa7, 0xd8, 0x63, 0xec, 0x21, 0xf6, - 0x00, 0x1c, 0x39, 0x4e, 0x3b, 0xa0, 0xa9, 0xbc, 0xc8, 0x64, 0x27, 0x61, 0xa9, 0xd8, 0xa5, 0xf6, - 0xd7, 0x9f, 0x3f, 0xdf, 0x6f, 0xdd, 0x4f, 0x0d, 0xf6, 0x32, 0x3c, 0xc7, 0x9c, 0xaa, 0x50, 0xaf, - 0xa1, 0x2c, 0x28, 0x31, 0x1f, 0x41, 0x51, 0x0a, 0x25, 0xe0, 0x46, 0x8d, 0x06, 0x7a, 0x0d, 0x34, - 0xb0, 0xbb, 0x39, 0x15, 0x53, 0x61, 0xd0, 0x50, 0xef, 0x2a, 0xe2, 0xee, 0xe1, 0x5b, 0x1b, 0x5c, - 0xb0, 0x98, 0x88, 0x2c, 0xa3, 0x44, 0x31, 0xc1, 0x6b, 0x9e, 0x4b, 0x84, 0xcc, 0x85, 0x0c, 0x13, - 0x2c, 0x69, 0x38, 0x3f, 0x4a, 0xa8, 0xc2, 0x47, 0x21, 0x11, 0xac, 0xc6, 0x0f, 0xfe, 0xec, 0x03, - 0xfb, 0xba, 0xa0, 0x04, 0x6e, 0x82, 0x77, 0x8c, 0xa7, 0xf4, 0x01, 0x59, 0x9e, 0xe5, 0xaf, 0x45, - 0x55, 0x01, 0x21, 0xb0,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, - 0xed, 0x23, 0x88, 0xc1, 0x76, 0xab, 0x8c, 0x0b, 0x5a, 0x12, 0xca, 0x15, 0x9e, 0x52, 0x04, 0x75, - 0xfe, 0xc7, 0x9f, 0xff, 0xfd, 0xbc, 0x7f, 0x38, 0x65, 0x6a, 0x76, 0x9f, 0x04, 0x44, 0xe4, 0x61, - 0xfd, 0xdf, 0xaa, 0x96, 0x2f, 0x65, 0x7a, 0x17, 0x9a, 0xcb, 0x08, 0xce, 0x29, 0x89, 0xb6, 0x5a, - 0x4e, 0x57, 0xaf, 0x46, 0x70, 0x1b, 0xf4, 0xe4, 0x0c, 0x97, 0x54, 0xa2, 0x8f, 0xcc, 0x6f, 0x55, - 0x57, 0x07, 0x9f, 0x81, 0xd1, 0xea, 0x1d, 0xc1, 0x21, 0xe8, 0xa7, 0x0b, 0x8e, 0x73, 0x46, 0x9c, - 0x0e, 0x04, 0xa0, 0x27, 0x15, 0x56, 0x8c, 0x38, 0xd6, 0xa5, 0x3d, 0xe8, 0x3a, 0xf6, 0xa5, 0x3d, - 0x78, 0xef, 0x8c, 0xc6, 0xe3, 0x3f, 0x96, 0xae, 0xf5, 0xb8, 0x74, 0xad, 0xa7, 0xa5, 0x6b, 0xfd, - 0xb3, 0x74, 0xad, 0xdf, 0x5f, 0xdc, 0xce, 0xd3, 0x8b, 0xdb, 0xf9, 0xeb, 0xc5, 0xed, 0xfc, 0xfc, - 0x69, 0x6b, 0xd6, 0x95, 0xf7, 0xe2, 0xa1, 0x7a, 0x31, 0xcc, 0xb4, 0x49, 0xcf, 0xbc, 0x04, 0x27, - 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x67, 0xe7, 0xdf, 0x36, 0x9a, 0x04, 0x00, 0x00, + // 715 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x54, 0xdf, 0x6e, 0xeb, 0x34, + 0x18, 0x6f, 0x68, 0x4e, 0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fe, 0x8c, 0xa9, 0xf9, 0x6d, 0x12, 0x10, 0x91, 0x87, 0xf5, + 0xdd, 0xaa, 0x86, 0xaf, 0x65, 0x7a, 0x13, 0x9a, 0xc3, 0x08, 0x4e, 0x29, 0x89, 0xde, 0xb7, 0x9c, + 0x2e, 0x5e, 0x8c, 0xe0, 0x16, 0xe8, 0xc9, 0x39, 0x2e, 0xa9, 0x44, 0x9f, 0x98, 0xff, 0xaa, 0xae, + 0xe0, 0x0e, 0x18, 0xb0, 0x94, 0x72, 0xc5, 0xd4, 0x12, 0x8d, 0xcd, 0x65, 0x7b, 0xa9, 0xf7, 0xbe, + 0x00, 0xa3, 0xf5, 0xf3, 0x83, 0x43, 0xd0, 0x4f, 0x97, 0x1c, 0xe7, 0x8c, 0x38, 0x1d, 0x08, 0x40, + 0x4f, 0x2a, 0xac, 0x18, 0x71, 0xac, 0x73, 0x7b, 0xd0, 0x75, 0xec, 0x73, 0x7b, 0xf0, 0xd6, 0x19, + 0x4d, 0x26, 0x7f, 0xad, 0x5c, 0xeb, 0x7e, 0xe5, 0x5a, 0x0f, 0x2b, 0xd7, 0xfa, 0x67, 0xe5, 0x5a, + 0x7f, 0x3e, 0xbb, 0x9d, 0x87, 0x67, 0xb7, 0xf3, 0xf8, 0xec, 0x76, 0x7e, 0xfd, 0xbc, 0xb5, 0x8f, + 0xb5, 0xb7, 0xe4, 0xae, 0x7a, 0x4d, 0xcc, 0x4e, 0x92, 0x9e, 0x79, 0x25, 0x8e, 0xfe, 0x0d, 0x00, + 0x00, 0xff, 0xff, 0x7b, 0x69, 0x42, 0xa7, 0xb6, 0x04, 0x00, 0x00, } func (this *Spec) Equal(that interface{}) bool { @@ -359,6 +368,9 @@ func (this *Spec) Equal(that interface{}) bool { if this.Shares != that1.Shares { return false } + if this.Identity != that1.Identity { + return false + } return true } func (m *Spec) Marshal() (dAtA []byte, err error) { @@ -381,6 +393,15 @@ func (m *Spec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintSpec(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa2 + } if m.Shares != 0 { i = encodeVarintSpec(dAtA, i, uint64(m.Shares)) i-- @@ -599,6 +620,10 @@ func (m *Spec) Size() (n int) { if m.Shares != 0 { n += 2 + sovSpec(uint64(m.Shares)) } + l = len(m.Identity) + if l > 0 { + n += 2 + l + sovSpec(uint64(l)) + } return n } @@ -1060,6 +1085,38 @@ func (m *Spec) Unmarshal(dAtA []byte) error { break } } + case 20: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSpec + } + 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 ErrInvalidLengthSpec + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSpec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSpec(dAtA[iNdEx:]) diff --git a/x/subscription/keeper/subscription_test.go b/x/subscription/keeper/subscription_test.go index b6e5bd22f8..b2b324e1ce 100644 --- a/x/subscription/keeper/subscription_test.go +++ b/x/subscription/keeper/subscription_test.go @@ -1454,7 +1454,7 @@ func TestSubscriptionCuExhaustAndUpgrade(t *testing.T) { ts.TxCreateValidator(validationAcc, math.NewInt(testBalance)) acc, provider := ts.AddAccount(common.PROVIDER, 0, testBalance) - err := ts.StakeProviderExtra(acc.GetVaultAddr(), provider, spec, testStake, nil, 0, "provider") + err := ts.StakeProviderExtra(acc.GetVaultAddr(), provider, spec, testStake, nil, 0, "provider", "", "", "", "") require.NoError(t, err) // Trigger changes @@ -2604,7 +2604,7 @@ func TestUpgradedSubscriptionCredit(t *testing.T) { validationAcc, _ := ts.AddAccount(common.VALIDATOR, 0, testBalance) ts.TxCreateValidator(validationAcc, math.NewInt(testBalance)) acc, provider := ts.AddAccount(common.PROVIDER, 0, testBalance) - err = ts.StakeProviderExtra(acc.GetVaultAddr(), provider, spec, testStake, nil, 0, "provider") + err = ts.StakeProviderExtra(acc.GetVaultAddr(), provider, spec, testStake, nil, 0, "provider", "", "", "", "") require.NoError(t, err) ts.AdvanceEpoch(10 * time.Minute) // Trigger changes From 5dafc702450711ffd5111baf942a1eb51e683480 Mon Sep 17 00:00:00 2001 From: Yaroms <103432884+Yaroms@users.noreply.github.com> Date: Wed, 29 May 2024 19:49:25 +0300 Subject: [PATCH 03/16] add upgrade handler (#1451) Co-authored-by: Yaroms --- app/app.go | 1 + app/upgrades/empty_upgrades.go | 6 ++++++ x/protocol/module.go | 6 +++++- x/protocol/types/params.go | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index 1bacc28d1c..2c62158528 100644 --- a/app/app.go +++ b/app/app.go @@ -194,6 +194,7 @@ var Upgrades = []upgrades.Upgrade{ upgrades.Upgrade_1_1_0, upgrades.Upgrade_1_2_0, upgrades.Upgrade_2_0_0, + upgrades.Upgrade_2_1_0, } // this line is used by starport scaffolding # stargate/wasm/app/enabledProposals diff --git a/app/upgrades/empty_upgrades.go b/app/upgrades/empty_upgrades.go index 975730535c..c3caa7734b 100644 --- a/app/upgrades/empty_upgrades.go +++ b/app/upgrades/empty_upgrades.go @@ -244,3 +244,9 @@ var Upgrade_2_0_0 = Upgrade{ Added: []string{packetforwardtypes.StoreKey}, }, } + +var Upgrade_2_1_0 = Upgrade{ + UpgradeName: "v2.1.0", + CreateUpgradeHandler: defaultUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/x/protocol/module.go b/x/protocol/module.go index 65e2318711..8945f395f5 100644 --- a/x/protocol/module.go +++ b/x/protocol/module.go @@ -206,10 +206,14 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // panic:ok: at start up, migration cannot proceed anyhow panic(fmt.Errorf("%s: failed to register migration to v17: %w", types.ModuleName, err)) } + if err := cfg.RegisterMigration(types.ModuleName, 17, migrator.MigrateVersion); err != nil { + // panic:ok: at start up, migration cannot proceed anyhow + panic(fmt.Errorf("%s: failed to register migration to v18: %w", types.ModuleName, err)) + } } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 17 } +func (AppModule) ConsensusVersion() uint64 { return 18 } // RegisterInvariants registers the capability module's invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} diff --git a/x/protocol/types/params.go b/x/protocol/types/params.go index 373b441f12..2f1d183ebe 100644 --- a/x/protocol/types/params.go +++ b/x/protocol/types/params.go @@ -12,7 +12,7 @@ import ( var _ paramtypes.ParamSet = (*Params)(nil) const ( - TARGET_VERSION = "2.0.3" + TARGET_VERSION = "2.1.0" MIN_VERSION = "1.2.3" ) From ca1d93d134e765269089972e658707e04db47601 Mon Sep 17 00:00:00 2001 From: BabyScope <163932585+BabyScope@users.noreply.github.com> Date: Fri, 31 May 2024 09:15:34 +0200 Subject: [PATCH 04/16] fix archive latest distance testnet (#1460) --- cookbook/specs/spec_add_axelar.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cookbook/specs/spec_add_axelar.json b/cookbook/specs/spec_add_axelar.json index 5601225e6a..efe2a590ea 100644 --- a/cookbook/specs/spec_add_axelar.json +++ b/cookbook/specs/spec_add_axelar.json @@ -2464,6 +2464,15 @@ "expected_value": "axelar-testnet-lisbon-3" } ] + }, + { + "name": "pruning", + "values": [ + { + "extension": "archive", + "expected_value": "690489" + } + ] } ] } From c0a6a5c9b7d6e0c5e45c69a1989485468bf7e756 Mon Sep 17 00:00:00 2001 From: Yaroms <103432884+Yaroms@users.noreply.github.com> Date: Fri, 31 May 2024 10:16:37 +0300 Subject: [PATCH 05/16] fix migrator and create upgrade handler (#1454) Co-authored-by: Yarom Swisa --- app/app.go | 1 + app/upgrades/empty_upgrades.go | 6 ++++++ x/epochstorage/module.go | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 2c62158528..20a7f0940c 100644 --- a/app/app.go +++ b/app/app.go @@ -195,6 +195,7 @@ var Upgrades = []upgrades.Upgrade{ upgrades.Upgrade_1_2_0, upgrades.Upgrade_2_0_0, upgrades.Upgrade_2_1_0, + upgrades.Upgrade_2_1_1, } // this line is used by starport scaffolding # stargate/wasm/app/enabledProposals diff --git a/app/upgrades/empty_upgrades.go b/app/upgrades/empty_upgrades.go index c3caa7734b..37af2ceaf6 100644 --- a/app/upgrades/empty_upgrades.go +++ b/app/upgrades/empty_upgrades.go @@ -250,3 +250,9 @@ var Upgrade_2_1_0 = Upgrade{ CreateUpgradeHandler: defaultUpgradeHandler, StoreUpgrades: store.StoreUpgrades{}, } + +var Upgrade_2_1_1 = Upgrade{ + UpgradeName: "v2.1.1", + CreateUpgradeHandler: defaultUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/x/epochstorage/module.go b/x/epochstorage/module.go index a4c15775f9..79dfdf4a45 100644 --- a/x/epochstorage/module.go +++ b/x/epochstorage/module.go @@ -152,7 +152,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { } // register v6 -> v7 migration - if err := cfg.RegisterMigration(types.ModuleName, 6, migrator.Migrate5to6); err != nil { + if err := cfg.RegisterMigration(types.ModuleName, 6, migrator.Migrate6to7); err != nil { // panic:ok: at start up, migration cannot proceed anyhow panic(fmt.Errorf("%s: failed to register migration to v7: %w", types.ModuleName, err)) } From 604af556b2e1eb979e213030f8b623add6a9aef0 Mon Sep 17 00:00:00 2001 From: oren-lava <111131399+oren-lava@users.noreply.github.com> Date: Fri, 31 May 2024 10:16:59 +0300 Subject: [PATCH 06/16] fix: CNS-972: enhanced the unit test for iprpc subscriptions (#1455) * CNS-972: enhanced the unit test for iprpc subscriptions * CNS-972: fix lint --- x/rewards/keeper/helpers_test.go | 49 ++++++++++++++ x/rewards/keeper/iprpc_test.go | 111 +++++++++++++++++-------------- 2 files changed, 111 insertions(+), 49 deletions(-) diff --git a/x/rewards/keeper/helpers_test.go b/x/rewards/keeper/helpers_test.go index 8ab23dd586..6ccd1b8b81 100644 --- a/x/rewards/keeper/helpers_test.go +++ b/x/rewards/keeper/helpers_test.go @@ -12,7 +12,9 @@ import ( commontypes "github.com/lavanet/lava/common/types" "github.com/lavanet/lava/testutil/common" testkeeper "github.com/lavanet/lava/testutil/keeper" + "github.com/lavanet/lava/utils/sigs" planstypes "github.com/lavanet/lava/x/plans/types" + "github.com/lavanet/lava/x/projects/types" rewardstypes "github.com/lavanet/lava/x/rewards/types" spectypes "github.com/lavanet/lava/x/spec/types" "github.com/stretchr/testify/require" @@ -138,6 +140,53 @@ func (ts *tester) setupForIprpcTests(fundIprpcPool bool) { } } +// getConsumersForIprpcSubTest is a helper function specifically for the TestIprpcEligibleSubscriptions unit test +// this function returns two consumer addresses to test depending on the input mode: +// +// SUB_OWNERS = 0 +// DEVELOPERS_ADMIN_PROJECT = 1 +// DEVELOPERS_REGULAR_PROJECT = 2 +// +// this function assumes that ts.setupForIprpcTests ran before it +func (ts *tester) getConsumersForIprpcSubTest(mode int) (sigs.Account, sigs.Account) { + switch mode { + case 0: + sub1Acc, _ := ts.GetAccount(common.CONSUMER, 0) + sub2Acc, _ := ts.GetAccount(common.CONSUMER, 1) + return sub1Acc, sub2Acc + case 1: + sub1Acc, _ := ts.GetAccount(common.CONSUMER, 0) + sub2Acc, _ := ts.GetAccount(common.CONSUMER, 1) + adminDev1, _ := ts.AddAccount(common.CONSUMER, 2, testBalance*10000) + adminDev2, _ := ts.AddAccount(common.CONSUMER, 3, testBalance*10000) + res1, err := ts.QueryProjectDeveloper(sub1Acc.Addr.String()) + require.NoError(ts.T, err) + res2, err := ts.QueryProjectDeveloper(sub2Acc.Addr.String()) + require.NoError(ts.T, err) + err = ts.TxProjectAddKeys(res1.Project.Index, sub1Acc.Addr.String(), types.ProjectDeveloperKey(adminDev1.Addr.String())) + require.NoError(ts.T, err) + err = ts.TxProjectAddKeys(res2.Project.Index, sub2Acc.Addr.String(), types.ProjectDeveloperKey(adminDev2.Addr.String())) + require.NoError(ts.T, err) + return adminDev1, adminDev2 + case 2: + sub1Acc, _ := ts.GetAccount(common.CONSUMER, 0) + sub2Acc, _ := ts.GetAccount(common.CONSUMER, 1) + dev1, _ := ts.AddAccount(common.CONSUMER, 2, testBalance*10000) + dev2, _ := ts.AddAccount(common.CONSUMER, 3, testBalance*10000) + err := ts.TxSubscriptionAddProject(sub1Acc.Addr.String(), types.ProjectData{ + Name: "test1", Enabled: true, ProjectKeys: []types.ProjectKey{{Key: dev1.Addr.String(), Kinds: 2}}, + }) + require.NoError(ts.T, err) + err = ts.TxSubscriptionAddProject(sub2Acc.Addr.String(), types.ProjectData{ + Name: "test2", Enabled: true, ProjectKeys: []types.ProjectKey{{Key: dev2.Addr.String(), Kinds: 2}}, + }) + require.NoError(ts.T, err) + return dev1, dev2 + } + + return sigs.Account{}, sigs.Account{} +} + // deductParticipationFees calculates the validators and community participation // fees and returns the providers reward after deducting them func (ts *tester) DeductParticipationFees(reward math.Int) (updatedReward math.Int, valParticipation math.Int, communityParticipation math.Int) { diff --git a/x/rewards/keeper/iprpc_test.go b/x/rewards/keeper/iprpc_test.go index 19f7efceb7..fd94755a6b 100644 --- a/x/rewards/keeper/iprpc_test.go +++ b/x/rewards/keeper/iprpc_test.go @@ -539,65 +539,78 @@ func TestIprpcMinCost(t *testing.T) { // 1. p1 provides service for both consumers, p2 provides service for c1 -> IPRPC reward should divide equally between p1 and p2 // 2. both providers provide service for c2 -> No IPRPC rewards should be given func TestIprpcEligibleSubscriptions(t *testing.T) { - ts := newTester(t, true) - ts.setupForIprpcTests(true) // setup creates consumers and providers and funds IPRPC pool for mock2 spec + // do the test for the following consumers: + // 1. subscription owners + // 2. developers in the admin project + // 3. developers in a regular project that belongs to the subscriptions + const ( + SUB_OWNERS = 0 + DEVELOPERS_ADMIN_PROJECT = 1 + DEVELOPERS_REGULAR_PROJECT = 2 + ) + modes := []int{SUB_OWNERS, DEVELOPERS_ADMIN_PROJECT, DEVELOPERS_REGULAR_PROJECT} - c1Acc, c1 := ts.GetAccount(common.CONSUMER, 0) - c2Acc, _ := ts.GetAccount(common.CONSUMER, 1) - _, p1 := ts.GetAccount(common.PROVIDER, 0) - _, p2 := ts.GetAccount(common.PROVIDER, 1) + for _, mode := range modes { + ts := newTester(t, true) + ts.setupForIprpcTests(true) // setup creates consumers and providers and funds IPRPC pool for mock2 spec - // p1 provides service for both consumers, p2 provides service for c1 - msg := ts.SendRelay(p1, c1Acc, []string{mockSpec2}, 100) - _, err := ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) - require.NoError(t, err) + // add developers to the admin project of the subscription and add an additional project with developers + c1Acc, c2Acc := ts.getConsumersForIprpcSubTest(mode) - msg = ts.SendRelay(p1, c2Acc, []string{mockSpec2}, 100) - _, err = ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) - require.NoError(t, err) + // p1 provides service for both consumers, p2 provides service for c1 + _, p1 := ts.GetAccount(common.PROVIDER, 0) + _, p2 := ts.GetAccount(common.PROVIDER, 1) + msg := ts.SendRelay(p1, c1Acc, []string{mockSpec2}, 100) + _, err := ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) + require.NoError(t, err) - msg = ts.SendRelay(p2, c1Acc, []string{mockSpec2}, 100) - _, err = ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) - require.NoError(t, err) + msg = ts.SendRelay(p1, c2Acc, []string{mockSpec2}, 100) + _, err = ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) + require.NoError(t, err) - // check expected reward for each provider, it should be equal (the service for c1 was equal) - res1, err := ts.QueryRewardsIprpcProviderRewardEstimation(p1) - require.NoError(t, err) - res2, err := ts.QueryRewardsIprpcProviderRewardEstimation(p2) - require.NoError(t, err) - require.True(t, res1.SpecFunds[0].Fund.IsEqual(res2.SpecFunds[0].Fund)) - require.True(t, iprpcFunds.Sub(minIprpcCost).QuoInt(sdk.NewInt(2)).IsEqual(res1.SpecFunds[0].Fund)) + msg = ts.SendRelay(p2, c1Acc, []string{mockSpec2}, 100) + _, err = ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) + require.NoError(t, err) - // fund the pool again (advance month to apply) - _, err = ts.TxRewardsFundIprpc(c1, mockSpec2, 1, sdk.NewCoins(minIprpcCost.AddAmount(sdk.NewInt(10)))) - require.NoError(ts.T, err) - ts.AdvanceMonths(1).AdvanceEpoch() + // check expected reward for each provider, it should be equal (the service for c1 was equal) + res1, err := ts.QueryRewardsIprpcProviderRewardEstimation(p1) + require.NoError(t, err) + res2, err := ts.QueryRewardsIprpcProviderRewardEstimation(p2) + require.NoError(t, err) + require.True(t, res1.SpecFunds[0].Fund.IsEqual(res2.SpecFunds[0].Fund)) + require.True(t, iprpcFunds.Sub(minIprpcCost).QuoInt(sdk.NewInt(2)).IsEqual(res1.SpecFunds[0].Fund)) - // provide service only for c2 - msg = ts.SendRelay(p1, c2Acc, []string{mockSpec2}, 100) - _, err = ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) - require.NoError(t, err) + // fund the pool again (advance month to apply) + _, err = ts.TxRewardsFundIprpc(c1Acc.Addr.String(), mockSpec2, 1, sdk.NewCoins(minIprpcCost.AddAmount(sdk.NewInt(10)))) + require.NoError(ts.T, err) + ts.AdvanceMonths(1).AdvanceEpoch() - msg = ts.SendRelay(p2, c2Acc, []string{mockSpec2}, 100) - _, err = ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) - require.NoError(t, err) + // provide service only for c2 + msg = ts.SendRelay(p1, c2Acc, []string{mockSpec2}, 100) + _, err = ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) + require.NoError(t, err) - // check none of the providers should get rewards - res1, err = ts.QueryRewardsIprpcProviderRewardEstimation(p1) - require.NoError(t, err) - res2, err = ts.QueryRewardsIprpcProviderRewardEstimation(p2) - require.NoError(t, err) - require.Len(t, res1.SpecFunds, 0) - require.Len(t, res2.SpecFunds, 0) + msg = ts.SendRelay(p2, c2Acc, []string{mockSpec2}, 100) + _, err = ts.TxPairingRelayPayment(msg.Creator, msg.Relays...) + require.NoError(t, err) - // advance another month and see there are still no rewards - ts.AdvanceMonths(1).AdvanceEpoch() - res1, err = ts.QueryRewardsIprpcProviderRewardEstimation(p1) - require.NoError(t, err) - res2, err = ts.QueryRewardsIprpcProviderRewardEstimation(p2) - require.NoError(t, err) - require.Len(t, res1.SpecFunds, 0) - require.Len(t, res2.SpecFunds, 0) + // check none of the providers should get rewards + res1, err = ts.QueryRewardsIprpcProviderRewardEstimation(p1) + require.NoError(t, err) + res2, err = ts.QueryRewardsIprpcProviderRewardEstimation(p2) + require.NoError(t, err) + require.Len(t, res1.SpecFunds, 0) + require.Len(t, res2.SpecFunds, 0) + + // advance another month and see there are still no rewards + ts.AdvanceMonths(1).AdvanceEpoch() + res1, err = ts.QueryRewardsIprpcProviderRewardEstimation(p1) + require.NoError(t, err) + res2, err = ts.QueryRewardsIprpcProviderRewardEstimation(p2) + require.NoError(t, err) + require.Len(t, res1.SpecFunds, 0) + require.Len(t, res2.SpecFunds, 0) + } } // TestMultipleIprpcSpec checks that rewards are distributed correctly when multiple specs are configured in the IPRPC pool From d7d730818805ddb0c9040d450e1e737684c18254 Mon Sep 17 00:00:00 2001 From: Omer <100387053+omerlavanet@users.noreply.github.com> Date: Fri, 31 May 2024 10:19:20 +0300 Subject: [PATCH 07/16] feat: added placeholder for parsers (#1449) * added placeholder for parsers * lint --- proto/lavanet/lava/spec/api_collection.proto | 17 + x/spec/keeper/spec_test.go | 205 +++++++ x/spec/types/api_collection.pb.go | 604 ++++++++++++++++--- x/spec/types/spec.go | 18 +- x/spec/types/types.go | 20 + 5 files changed, 764 insertions(+), 100 deletions(-) diff --git a/proto/lavanet/lava/spec/api_collection.proto b/proto/lavanet/lava/spec/api_collection.proto index e945f61691..f4de8869ba 100644 --- a/proto/lavanet/lava/spec/api_collection.proto +++ b/proto/lavanet/lava/spec/api_collection.proto @@ -75,6 +75,7 @@ message Api { SpecCategory category = 6 [(gogoproto.nullable) = false]; BlockParser block_parsing = 7 [(gogoproto.nullable) = false]; uint64 timeout_ms = 8; + repeated GenericParser parsers = 9 [(gogoproto.nullable) = false]; } message ParseDirective { @@ -91,6 +92,12 @@ message BlockParser { string encoding =4; // used to parse byte responses: base64,hex,bech32 } +message GenericParser { + string parse_path = 1; + string value = 2; + PARSER_TYPE parse_type = 3; +} + enum EXTENSION { NONE = 0; ARCHIVE =1; @@ -106,6 +113,16 @@ enum FUNCTION_TAG { GET_EARLIEST_BLOCK = 6; } +enum PARSER_TYPE { + NO_PARSER = 0; + BLOCK_LATEST = 1; + BLOCK_EARLIEST = 2; + RESULT = 3; + EXTENSION_ARG = 4; + IDENTIFIER = 5; + DEFAULT_VALUE = 6; +} + enum PARSER_FUNC{ EMPTY = 0; PARSE_BY_ARG = 1; //means parameters are ordered and flat expected arguments are: [param index] (example: PARAMS: [<#BlockNum>,"banana"]) args: 0 diff --git a/x/spec/keeper/spec_test.go b/x/spec/keeper/spec_test.go index 9a69f6d662..bea37bf393 100644 --- a/x/spec/keeper/spec_test.go +++ b/x/spec/keeper/spec_test.go @@ -7,6 +7,7 @@ import ( "strconv" "testing" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/lavanet/lava/testutil/common" keepertest "github.com/lavanet/lava/testutil/keeper" @@ -56,6 +57,7 @@ func prepareMockApis(count int, apiDiff string) []*types.Api { BlockParsing: types.BlockParser{ DefaultValue: apiDiff, }, + ComputeUnits: 20, } api.Enabled = true @@ -67,6 +69,7 @@ func prepareMockApis(count int, apiDiff string) []*types.Api { BlockParsing: types.BlockParser{ DefaultValue: apiDiff, }, + ComputeUnits: 10, } mockApis[i+count/2] = api } @@ -888,3 +891,205 @@ func removeSetFromSet(set1, set2 []string) []string { return resultSet } + +func TestParsers(t *testing.T) { + parserBook := []struct { + parsers []types.GenericParser + name string + shouldErr bool + }{ + { + parsers: []types.GenericParser{ + { + ParsePath: "1", + Value: "", + ParseType: types.PARSER_TYPE_NO_PARSER, + }, + }, + name: "invalid parsers type", + shouldErr: true, + }, + { + parsers: []types.GenericParser{ + { + ParsePath: "", + Value: "", + ParseType: types.PARSER_TYPE_BLOCK_LATEST, + }, + }, + name: "invalid parsers path", + shouldErr: true, + }, + { + parsers: []types.GenericParser{ + { + ParsePath: "0", + Value: "", + ParseType: types.PARSER_TYPE_BLOCK_LATEST, + }, + }, + name: "valid block parser", + shouldErr: false, + }, + { + parsers: []types.GenericParser{ + { + ParsePath: "0", + Value: "", + ParseType: types.PARSER_TYPE_BLOCK_LATEST, + }, + { + ParsePath: "1", + Value: "", + ParseType: types.PARSER_TYPE_BLOCK_LATEST, + }, + }, + name: "valid multiple block parser", + shouldErr: false, + }, + { + parsers: []types.GenericParser{ + { + ParsePath: "0", + Value: "", + ParseType: types.PARSER_TYPE_BLOCK_LATEST, + }, + { + ParsePath: "1", + Value: "", + ParseType: types.PARSER_TYPE_NO_PARSER, + }, + }, + name: "invalid type multiple block parser", + shouldErr: true, + }, + { + parsers: []types.GenericParser{ + { + ParsePath: "0", + Value: "", + ParseType: types.PARSER_TYPE_BLOCK_LATEST, + }, + { + ParsePath: "", + Value: "", + ParseType: types.PARSER_TYPE_BLOCK_LATEST, + }, + }, + name: "invalid type multiple block parser", + shouldErr: true, + }, + } + for _, parsers := range parserBook { + t.Run(parsers.name, func(t *testing.T) { + ts := newTester(t) + + apiCollection := createApiCollection(5, []int{1, 2, 3}, 0, "jsonrpc", "POST", "", nil, "") + api := apiCollection.Apis[0] + api.Parsers = parsers.parsers + tt := struct { + desc string + name string + imports []string + apisCollections []*types.ApiCollection + resultApiCollections int + result []int + totalApis int + ok bool + }{ + desc: "", + name: "test", + imports: []string{}, + apisCollections: []*types.ApiCollection{apiCollection}, + } + sp := types.Spec{ + Index: tt.name, + Name: tt.name, + Enabled: true, + ReliabilityThreshold: 0xffffff, + DataReliabilityEnabled: false, + BlockDistanceForFinalizedData: 0, + BlocksInFinalizationProof: 1, + AverageBlockTime: 10, + AllowedBlockLagForQosSync: 1, + BlockLastUpdated: 0, + MinStakeProvider: sdk.Coin{ + Denom: "ulava", + Amount: math.NewInt(5000000), + }, + ApiCollections: tt.apisCollections, + Shares: 1, + Identity: "", + } + fullspec, err := ts.expandSpec(sp) + require.NoError(t, err) + _, err = fullspec.ValidateSpec(10000) + if parsers.shouldErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.True(t, len(fullspec.ApiCollections[0].Apis[0].Parsers) > 0) + } + ts.setSpec(sp) + }) + } +} + +func TestSpecParsing(t *testing.T) { + specJSON := ` + { + "proposal": { + "title": "Add Specs: Lava", + "description": "Adding new specification support for relaying Lava data on Lava", + "specs": [ + { + "index": "test", + "name": "test", + "enabled": true, + "reliability_threshold": 16777215, + "data_reliability_enabled": false, + "block_distance_for_finalized_data": 0, + "blocks_in_finalization_proof": 1, + "average_block_time": 10, + "allowed_block_lag_for_qos_sync": 1, + "block_last_updated": 0, + "min_stake_provider": { + "denom": "ulava", + "amount": "5000000" + }, + "api_collections": [ + { + "apis": [ + { + "name": "APIName", + "compute_units": 10, + "parsers": [ + { + "parse_path": "0", + "value": "", + "parse_type": "BLOCK_LATEST" + } + ] + } + ] + } + ], + "shares": 1, + "identity": "" + } + ] + } + }` + + var proposal utils.SpecAddProposalJSON + err := json.Unmarshal([]byte(specJSON), &proposal) + require.NoError(t, err) + ts := newTester(t) + for _, spec := range proposal.Proposal.Specs { + fullspec, err := ts.expandSpec(spec) + require.NoError(t, err) + _, err = fullspec.ValidateSpec(10000) + require.NoError(t, err) + ts.setSpec(spec) + } +} diff --git a/x/spec/types/api_collection.pb.go b/x/spec/types/api_collection.pb.go index 5932e10f93..699c53c289 100644 --- a/x/spec/types/api_collection.pb.go +++ b/x/spec/types/api_collection.pb.go @@ -88,6 +88,46 @@ func (FUNCTION_TAG) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c9f7567a181f534f, []int{1} } +type PARSER_TYPE int32 + +const ( + PARSER_TYPE_NO_PARSER PARSER_TYPE = 0 + PARSER_TYPE_BLOCK_LATEST PARSER_TYPE = 1 + PARSER_TYPE_BLOCK_EARLIEST PARSER_TYPE = 2 + PARSER_TYPE_RESULT PARSER_TYPE = 3 + PARSER_TYPE_EXTENSION_ARG PARSER_TYPE = 4 + PARSER_TYPE_IDENTIFIER PARSER_TYPE = 5 + PARSER_TYPE_DEFAULT_VALUE PARSER_TYPE = 6 +) + +var PARSER_TYPE_name = map[int32]string{ + 0: "NO_PARSER", + 1: "BLOCK_LATEST", + 2: "BLOCK_EARLIEST", + 3: "RESULT", + 4: "EXTENSION_ARG", + 5: "IDENTIFIER", + 6: "DEFAULT_VALUE", +} + +var PARSER_TYPE_value = map[string]int32{ + "NO_PARSER": 0, + "BLOCK_LATEST": 1, + "BLOCK_EARLIEST": 2, + "RESULT": 3, + "EXTENSION_ARG": 4, + "IDENTIFIER": 5, + "DEFAULT_VALUE": 6, +} + +func (x PARSER_TYPE) String() string { + return proto.EnumName(PARSER_TYPE_name, int32(x)) +} + +func (PARSER_TYPE) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c9f7567a181f534f, []int{2} +} + type PARSER_FUNC int32 const ( @@ -123,7 +163,7 @@ func (x PARSER_FUNC) String() string { } func (PARSER_FUNC) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_c9f7567a181f534f, []int{2} + return fileDescriptor_c9f7567a181f534f, []int{3} } type ParseValue_VerificationSeverity int32 @@ -643,13 +683,14 @@ func (m *Header) GetFunctionTag() FUNCTION_TAG { } type Api struct { - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - ComputeUnits uint64 `protobuf:"varint,3,opt,name=compute_units,json=computeUnits,proto3" json:"compute_units,omitempty"` - ExtraComputeUnits uint64 `protobuf:"varint,4,opt,name=extra_compute_units,json=extraComputeUnits,proto3" json:"extra_compute_units,omitempty"` - Category SpecCategory `protobuf:"bytes,6,opt,name=category,proto3" json:"category"` - BlockParsing BlockParser `protobuf:"bytes,7,opt,name=block_parsing,json=blockParsing,proto3" json:"block_parsing"` - TimeoutMs uint64 `protobuf:"varint,8,opt,name=timeout_ms,json=timeoutMs,proto3" json:"timeout_ms,omitempty"` + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + ComputeUnits uint64 `protobuf:"varint,3,opt,name=compute_units,json=computeUnits,proto3" json:"compute_units,omitempty"` + ExtraComputeUnits uint64 `protobuf:"varint,4,opt,name=extra_compute_units,json=extraComputeUnits,proto3" json:"extra_compute_units,omitempty"` + Category SpecCategory `protobuf:"bytes,6,opt,name=category,proto3" json:"category"` + BlockParsing BlockParser `protobuf:"bytes,7,opt,name=block_parsing,json=blockParsing,proto3" json:"block_parsing"` + TimeoutMs uint64 `protobuf:"varint,8,opt,name=timeout_ms,json=timeoutMs,proto3" json:"timeout_ms,omitempty"` + Parsers []GenericParser `protobuf:"bytes,9,rep,name=parsers,proto3" json:"parsers"` } func (m *Api) Reset() { *m = Api{} } @@ -734,6 +775,13 @@ func (m *Api) GetTimeoutMs() uint64 { return 0 } +func (m *Api) GetParsers() []GenericParser { + if m != nil { + return m.Parsers + } + return nil +} + type ParseDirective struct { FunctionTag FUNCTION_TAG `protobuf:"varint,1,opt,name=function_tag,json=functionTag,proto3,enum=lavanet.lava.spec.FUNCTION_TAG" json:"function_tag,omitempty"` FunctionTemplate string `protobuf:"bytes,2,opt,name=function_template,json=functionTemplate,proto3" json:"function_template,omitempty"` @@ -870,6 +918,66 @@ func (m *BlockParser) GetEncoding() string { return "" } +type GenericParser struct { + ParsePath string `protobuf:"bytes,1,opt,name=parse_path,json=parsePath,proto3" json:"parse_path,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + ParseType PARSER_TYPE `protobuf:"varint,3,opt,name=parse_type,json=parseType,proto3,enum=lavanet.lava.spec.PARSER_TYPE" json:"parse_type,omitempty"` +} + +func (m *GenericParser) Reset() { *m = GenericParser{} } +func (m *GenericParser) String() string { return proto.CompactTextString(m) } +func (*GenericParser) ProtoMessage() {} +func (*GenericParser) Descriptor() ([]byte, []int) { + return fileDescriptor_c9f7567a181f534f, []int{10} +} +func (m *GenericParser) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenericParser) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenericParser.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 *GenericParser) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenericParser.Merge(m, src) +} +func (m *GenericParser) XXX_Size() int { + return m.Size() +} +func (m *GenericParser) XXX_DiscardUnknown() { + xxx_messageInfo_GenericParser.DiscardUnknown(m) +} + +var xxx_messageInfo_GenericParser proto.InternalMessageInfo + +func (m *GenericParser) GetParsePath() string { + if m != nil { + return m.ParsePath + } + return "" +} + +func (m *GenericParser) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *GenericParser) GetParseType() PARSER_TYPE { + if m != nil { + return m.ParseType + } + return PARSER_TYPE_NO_PARSER +} + type SpecCategory struct { Deterministic bool `protobuf:"varint,1,opt,name=deterministic,proto3" json:"deterministic,omitempty"` Local bool `protobuf:"varint,2,opt,name=local,proto3" json:"local,omitempty"` @@ -882,7 +990,7 @@ func (m *SpecCategory) Reset() { *m = SpecCategory{} } func (m *SpecCategory) String() string { return proto.CompactTextString(m) } func (*SpecCategory) ProtoMessage() {} func (*SpecCategory) Descriptor() ([]byte, []int) { - return fileDescriptor_c9f7567a181f534f, []int{10} + return fileDescriptor_c9f7567a181f534f, []int{11} } func (m *SpecCategory) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -949,6 +1057,7 @@ func (m *SpecCategory) GetHangingApi() bool { func init() { proto.RegisterEnum("lavanet.lava.spec.EXTENSION", EXTENSION_name, EXTENSION_value) proto.RegisterEnum("lavanet.lava.spec.FUNCTION_TAG", FUNCTION_TAG_name, FUNCTION_TAG_value) + proto.RegisterEnum("lavanet.lava.spec.PARSER_TYPE", PARSER_TYPE_name, PARSER_TYPE_value) proto.RegisterEnum("lavanet.lava.spec.PARSER_FUNC", PARSER_FUNC_name, PARSER_FUNC_value) proto.RegisterEnum("lavanet.lava.spec.ParseValue_VerificationSeverity", ParseValue_VerificationSeverity_name, ParseValue_VerificationSeverity_value) proto.RegisterEnum("lavanet.lava.spec.Header_HeaderType", Header_HeaderType_name, Header_HeaderType_value) @@ -962,6 +1071,7 @@ func init() { proto.RegisterType((*Api)(nil), "lavanet.lava.spec.Api") proto.RegisterType((*ParseDirective)(nil), "lavanet.lava.spec.ParseDirective") proto.RegisterType((*BlockParser)(nil), "lavanet.lava.spec.BlockParser") + proto.RegisterType((*GenericParser)(nil), "lavanet.lava.spec.GenericParser") proto.RegisterType((*SpecCategory)(nil), "lavanet.lava.spec.SpecCategory") } @@ -970,96 +1080,105 @@ func init() { } var fileDescriptor_c9f7567a181f534f = []byte{ - // 1424 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x4f, 0x6f, 0xdb, 0xc6, - 0x12, 0x37, 0x25, 0x5a, 0x96, 0x46, 0x7f, 0xcc, 0x6c, 0xfc, 0xf2, 0x94, 0x3c, 0x47, 0xf2, 0x63, - 0xf2, 0x5e, 0x0d, 0x07, 0xb5, 0x51, 0x07, 0x05, 0x8a, 0xa0, 0x40, 0x41, 0x49, 0x74, 0xa2, 0x44, - 0x96, 0x8c,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c6, 0xf0, 0x19, 0x96, 0x1c, 0xf4, 0x10, 0x96, - 0x4e, 0x29, 0x19, 0xd0, 0x20, 0xac, 0xaa, 0x92, 0x7e, 0x7b, 0x0e, 0xfd, 0x89, 0x64, 0xe0, 0x09, - 0x13, 0x75, 0x40, 0x63, 0xee, 0x29, 0x0d, 0x18, 0x27, 0xae, 0x4d, 0x2d, 0xf9, 0xb0, 0x45, 0x19, - 0xfd, 0xcf, 0x39, 0xe3, 0xe5, 0x99, 0x50, 0x43, 0xa4, 0xd0, 0x01, 0xcd, 0x27, 0x41, 0x48, 0xad, - 0x01, 0x0b, 0x04, 0xef, 0x8c, 0x86, 0xd5, 0xdc, 0x3b, 0xd5, 0xf6, 0x04, 0xb5, 0x35, 0x61, 0xe2, - 0x65, 0x3f, 0x65, 0x87, 0xe8, 0x73, 0x00, 0x7a, 0xce, 0xa9, 0x1b, 0x32, 0xcf, 0x0d, 0xab, 0x4b, - 0x52, 0x67, 0x75, 0x8e, 0x8e, 0x39, 0x21, 0xe1, 0x19, 0x3e, 0x32, 0xa1, 0x7c, 0x46, 0x03, 0x76, - 0xc2, 0x6c, 0xc2, 0xa5, 0x40, 0x5e, 0x0a, 0xd4, 0xe7, 0x08, 0x1c, 0xce, 0xf0, 0x70, 0x3a, 0x4a, - 0xff, 0x06, 0x0a, 0x53, 0x7d, 0x84, 0x40, 0x75, 0xc9, 0x88, 0xca, 0xbe, 0x17, 0xb0, 0xfc, 0x8f, - 0x1e, 0x80, 0x1a, 0x44, 0x0e, 0xad, 0x66, 0x65, 0xa7, 0xff, 0x3d, 0x47, 0x1e, 0x47, 0x0e, 0xc5, - 0x92, 0x84, 0xee, 0x41, 0xd9, 0x8e, 0xac, 0x51, 0xe4, 0x70, 0xe6, 0x3b, 0x8c, 0x06, 0x55, 0x75, - 0x4d, 0x59, 0x57, 0x71, 0xc9, 0x8e, 0x76, 0xa7, 0xd8, 0x53, 0x35, 0x9f, 0xd1, 0xb2, 0xfa, 0x2a, - 0xa8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0x42, 0xea, 0x0e, - 0xb4, 0x05, 0x54, 0x01, 0x90, 0x66, 0x40, 0x7d, 0xe7, 0x42, 0x53, 0xa6, 0xee, 0x63, 0x8f, 0x9f, - 0x6a, 0x19, 0xb4, 0x0c, 0x45, 0x69, 0xb2, 0xa1, 0xeb, 0x05, 0x54, 0xcb, 0xea, 0xbf, 0x64, 0x20, - 0x6b, 0xf8, 0xec, 0x3d, 0x2f, 0x95, 0x49, 0x01, 0x32, 0x33, 0x05, 0x10, 0x6b, 0xc4, 0x1b, 0xf9, - 0x11, 0xa7, 0x56, 0xe4, 0x32, 0x1e, 0x26, 0x93, 0x5f, 0x4a, 0xc0, 0x03, 0x81, 0xa1, 0x4d, 0xb8, - 0x49, 0xcf, 0x79, 0x40, 0xac, 0x34, 0x35, 0xde, 0x38, 0x37, 0xa4, 0xab, 0x39, 0xcb, 0x37, 0x20, - 0x6f, 0x13, 0x4e, 0x87, 0x5e, 0x70, 0x51, 0xcd, 0xc9, 0x35, 0x31, 0xaf, 0x2e, 0xfb, 0x3e, 0xb5, - 0x9b, 0x09, 0x2d, 0x79, 0x69, 0x4d, 0xc3, 0x50, 0x1b, 0xca, 0x72, 0x3d, 0x59, 0x62, 0x79, 0x30, - 0x77, 0x58, 0x5d, 0x92, 0x3a, 0xb5, 0x39, 0x3a, 0x0d, 0xc1, 0x93, 0x97, 0x2e, 0x48, 0x64, 0x4a, - 0xc7, 0x13, 0x88, 0xb9, 0x43, 0x74, 0x17, 0x80, 0xb3, 0x11, 0xf5, 0x22, 0x6e, 0x8d, 0xc4, 0xee, - 0x16, 0x49, 0x17, 0x12, 0x64, 0x37, 0xd4, 0xff, 0x50, 0xa0, 0x92, 0xde, 0x58, 0x6f, 0xf5, 0x56, - 0xf9, 0xf0, 0xde, 0xa2, 0x07, 0x70, 0xe3, 0x4a, 0x83, 0x8e, 0x7c, 0xb1, 0x4a, 0x92, 0xca, 0x6b, - 0x53, 0x5e, 0x82, 0xa3, 0x67, 0x50, 0x09, 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xeb, 0xa8, 0xd5, 0xc3, 0x56, 0x0f, 0xb7, 0x4c, 0x6c, 0xb6, 0x34, 0x55, - 0x94, 0xaa, 0x65, 0xee, 0x18, 0x07, 0x9d, 0xbe, 0x96, 0x6b, 0x34, 0x7e, 0xb8, 0xac, 0x29, 0x2f, - 0x2e, 0x6b, 0xca, 0xcb, 0xcb, 0x9a, 0xf2, 0xdb, 0x65, 0x4d, 0xf9, 0xee, 0x55, 0x6d, 0xe1, 0xe5, - 0xab, 0xda, 0xc2, 0xaf, 0xaf, 0x6a, 0x0b, 0x5f, 0xdf, 0x1f, 0x32, 0x7e, 0x1a, 0x1d, 0x6f, 0xda, - 0xde, 0x68, 0x2b, 0xf5, 0xa9, 0x7e, 0x1e, 0x7f, 0xac, 0x8b, 0x57, 0x47, 0x78, 0x9c, 0x93, 0xdf, - 0xde, 0x0f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x49, 0x68, 0xe8, 0x57, 0xce, 0x0b, 0x00, 0x00, + // 1559 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x57, 0x4f, 0x6f, 0xdb, 0xc8, + 0x15, 0x37, 0x25, 0x4a, 0x96, 0x9e, 0xfe, 0x98, 0x9e, 0xb8, 0xa9, 0x36, 0xf5, 0x4a, 0x2e, 0x37, + 0x6d, 0x0d, 0x2f, 0x6a, 0xa3, 0x0e, 0x0a, 0x14, 0x8b, 0x16, 0x2d, 0x25, 0xd1, 0x5e, 0x25, 0xb2, + 0x64, 0x8c, 0x68, 0xb7, 0xee, 0x85, 0x18, 0x53, 0x63, 0x79, 0xb0, 0x14, 0x49, 0x90, 0x43, 0xd7, + 0x3e, 0x6f, 0x3f, 0x40, 0x3f, 0x43, 0x4f, 0x05, 0x0a, 0x14, 0xe8, 0xb7, 0xc8, 0x31, 0xc7, 0x9e, + 0x8c, 0xc2, 0x39, 0x14, 0xcd, 0x31, 0x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x05, 0xa2, 0x07, 0x64, + 0x34, 0x25, 0x9c, 0xc1, 0x44, 0x4a, 0x22, 0x4e, 0x38, 0xbd, 0x88, 0x5d, 0x99, 0x92, 0x1a, 0x9e, + 0xaf, 0x51, 0x0b, 0x2a, 0x97, 0xc4, 0x9b, 0x30, 0x6f, 0x22, 0xfe, 0x4b, 0x6b, 0x14, 0xa4, 0x3b, + 0xa4, 0x90, 0x11, 0xb0, 0x1d, 0x1d, 0xca, 0xe6, 0xef, 0x2c, 0x73, 0x30, 0xea, 0x0d, 0x07, 0xe2, + 0x31, 0x1a, 0x0c, 0x07, 0x66, 0xf2, 0x18, 0x19, 0xb8, 0xf3, 0x75, 0xef, 0xd4, 0xd4, 0x94, 0x9d, + 0x3f, 0x2b, 0x50, 0x5d, 0xec, 0x5d, 0x54, 0x85, 0x52, 0xb7, 0x37, 0x32, 0xda, 0x7d, 0xb3, 0xab, + 0xad, 0x20, 0x0d, 0xaa, 0x87, 0xa6, 0x65, 0xb7, 0xfb, 0xc3, 0xce, 0xab, 0xc1, 0xc9, 0x91, 0xa6, + 0xa0, 0x0d, 0xd0, 0xe6, 0x88, 0xdd, 0x3e, 0xb3, 0x05, 0x9a, 0x43, 0xcf, 0xe0, 0xe9, 0xc8, 0xb4, + 0xec, 0xbe, 0x61, 0x99, 0x23, 0xcb, 0xee, 0x0d, 0xec, 0x23, 0xd3, 0x32, 0xba, 0x86, 0x65, 0x68, + 0x79, 0xf4, 0x14, 0x50, 0xd6, 0xd6, 0x1e, 0x76, 0xcf, 0x34, 0x55, 0x68, 0x9f, 0x9a, 0xb8, 0x77, + 0xd0, 0xeb, 0x18, 0x62, 0x77, 0xad, 0x20, 0x98, 0x42, 0xdb, 0x34, 0x70, 0xbf, 0x27, 0xb8, 0x72, + 0x13, 0xad, 0xb8, 0xf3, 0x47, 0x05, 0x2a, 0x0b, 0x15, 0x11, 0x33, 0x74, 0x30, 0xb4, 0x13, 0x24, + 0x09, 0x32, 0x09, 0x27, 0xd9, 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, 0x00, 0x00, 0xff, 0xff, 0x17, + 0x19, 0xc0, 0x60, 0x1d, 0x0d, 0x00, 0x00, } func (this *ApiCollection) Equal(that interface{}) bool { @@ -1362,6 +1481,14 @@ func (this *Api) Equal(that interface{}) bool { if this.TimeoutMs != that1.TimeoutMs { return false } + if len(this.Parsers) != len(that1.Parsers) { + return false + } + for i := range this.Parsers { + if !this.Parsers[i].Equal(&that1.Parsers[i]) { + return false + } + } return true } func (this *ParseDirective) Equal(that interface{}) bool { @@ -1435,6 +1562,36 @@ func (this *BlockParser) Equal(that interface{}) bool { } return true } +func (this *GenericParser) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GenericParser) + if !ok { + that2, ok := that.(GenericParser) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ParsePath != that1.ParsePath { + return false + } + if this.Value != that1.Value { + return false + } + if this.ParseType != that1.ParseType { + return false + } + return true +} func (this *SpecCategory) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1887,6 +2044,20 @@ func (m *Api) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Parsers) > 0 { + for iNdEx := len(m.Parsers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Parsers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintApiCollection(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } if m.TimeoutMs != 0 { i = encodeVarintApiCollection(dAtA, i, uint64(m.TimeoutMs)) i-- @@ -2045,6 +2216,48 @@ func (m *BlockParser) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GenericParser) 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 *GenericParser) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenericParser) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ParseType != 0 { + i = encodeVarintApiCollection(dAtA, i, uint64(m.ParseType)) + i-- + dAtA[i] = 0x18 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintApiCollection(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.ParsePath) > 0 { + i -= len(m.ParsePath) + copy(dAtA[i:], m.ParsePath) + i = encodeVarintApiCollection(dAtA, i, uint64(len(m.ParsePath))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *SpecCategory) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2322,6 +2535,12 @@ func (m *Api) Size() (n int) { if m.TimeoutMs != 0 { n += 1 + sovApiCollection(uint64(m.TimeoutMs)) } + if len(m.Parsers) > 0 { + for _, e := range m.Parsers { + l = e.Size() + n += 1 + l + sovApiCollection(uint64(l)) + } + } return n } @@ -2373,6 +2592,26 @@ func (m *BlockParser) Size() (n int) { return n } +func (m *GenericParser) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ParsePath) + if l > 0 { + n += 1 + l + sovApiCollection(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovApiCollection(uint64(l)) + } + if m.ParseType != 0 { + n += 1 + sovApiCollection(uint64(m.ParseType)) + } + return n +} + func (m *SpecCategory) Size() (n int) { if m == nil { return 0 @@ -3722,6 +3961,40 @@ func (m *Api) Unmarshal(dAtA []byte) error { break } } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Parsers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApiCollection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthApiCollection + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthApiCollection + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Parsers = append(m.Parsers, GenericParser{}) + if err := m.Parsers[len(m.Parsers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipApiCollection(dAtA[iNdEx:]) @@ -4074,6 +4347,139 @@ func (m *BlockParser) Unmarshal(dAtA []byte) error { } return nil } +func (m *GenericParser) 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 ErrIntOverflowApiCollection + } + 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: GenericParser: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenericParser: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParsePath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApiCollection + } + 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 ErrInvalidLengthApiCollection + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApiCollection + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParsePath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApiCollection + } + 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 ErrInvalidLengthApiCollection + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApiCollection + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParseType", wireType) + } + m.ParseType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApiCollection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParseType |= PARSER_TYPE(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipApiCollection(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthApiCollection + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *SpecCategory) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/spec/types/spec.go b/x/spec/types/spec.go index 50089e2442..41103114ce 100644 --- a/x/spec/types/spec.go +++ b/x/spec/types/spec.go @@ -18,6 +18,7 @@ const ( minCU = 1 ContributorPrecision = 100000 // Can't be 0! maxContributorsPercentageStr = "0.8" + maxParsersPerApi = 100 ) func (spec Spec) ValidateSpec(maxCU uint64) (map[string]string, error) { @@ -78,7 +79,7 @@ func (spec Spec) ValidateSpec(maxCU uint64) (map[string]string, error) { return details, fmt.Errorf("AllowedBlockLagForQosSync can't be zero") } - if spec.MinStakeProvider.Amount.IsZero() { + if !spec.MinStakeProvider.IsValid() || !spec.MinStakeProvider.IsPositive() { return details, fmt.Errorf("MinStakeProvider can't be zero") } @@ -130,6 +131,21 @@ func (spec Spec) ValidateSpec(maxCU uint64) (map[string]string, error) { details["api"] = api.Name return details, fmt.Errorf("api name includes a space character %s", api.Name) } + parsers := api.GetParsers() + if len(parsers) > 0 { + for idx, parser := range parsers { + if parser.ParsePath == "" || parser.ParseType == PARSER_TYPE_NO_PARSER { + details["parser_index"] = strconv.Itoa(idx) + details["api"] = api.Name + return details, fmt.Errorf("invalid parser in api %s index %d", api.Name, idx) + } + } + } + + if len(parsers) > maxParsersPerApi { + details["api"] = api.Name + return details, fmt.Errorf("invalid api %s too many parsers %d", api.Name, len(parsers)) + } } currentHeaders := map[string]struct{}{} for _, header := range apiCollection.Headers { diff --git a/x/spec/types/types.go b/x/spec/types/types.go index 8ad3bc4df1..cff4b416c1 100644 --- a/x/spec/types/types.go +++ b/x/spec/types/types.go @@ -57,6 +57,26 @@ func (s *PARSER_FUNC) UnmarshalJSON(b []byte) error { return nil } +// allows unmarshaling generic parser type +func (s PARSER_TYPE) MarshalJSON() ([]byte, error) { + buffer := bytes.NewBufferString(`"`) + buffer.WriteString(PARSER_TYPE_name[int32(s)]) + buffer.WriteString(`"`) + return buffer.Bytes(), nil +} + +// UnmarshalJSON unmashals a quoted json string to the enum value +func (s *PARSER_TYPE) UnmarshalJSON(b []byte) error { + var j string + err := json.Unmarshal(b, &j) + if err != nil { + return err + } + // Note that if the string cannot be found then it will be set to the zero value, 'NO_PARSER' in this case. + *s = PARSER_TYPE(PARSER_TYPE_value[j]) + return nil +} + // allows unmarshaling parser func func (s FUNCTION_TAG) MarshalJSON() ([]byte, error) { buffer := bytes.NewBufferString(`"`) From b2ffd3b8fb0ea0e8ae862c5ba9c68078c86f2380 Mon Sep 17 00:00:00 2001 From: BabyScope <163932585+BabyScope@users.noreply.github.com> Date: Fri, 31 May 2024 09:33:43 +0200 Subject: [PATCH 08/16] feat: ethereaum beacon chain (#1441) * feat: ethereum beaon chain * feat: ethereum beacon chain * fix: deleted 0 at parse_directive * fix: changes some typos * fix: post verifications not working * fix: rest post optimalization * fix: deterministic * fix typos --------- Co-authored-by: Yaroms <103432884+Yaroms@users.noreply.github.com> --- cookbook/specs/spec_add_beacon.json | 1366 +++++++++++++++++++++++++++ 1 file changed, 1366 insertions(+) create mode 100644 cookbook/specs/spec_add_beacon.json diff --git a/cookbook/specs/spec_add_beacon.json b/cookbook/specs/spec_add_beacon.json new file mode 100644 index 0000000000..ceaf011786 --- /dev/null +++ b/cookbook/specs/spec_add_beacon.json @@ -0,0 +1,1366 @@ +{ + "proposal": { + "title": "Add Specs: BEACON", + "description": "Adding new specification support for relaying Beacon Chain data on Lava", + "specs": [ + { + "index": "ETHBEACON", + "name": "ethereum beacon mainnet", + "enabled": true, + "reliability_threshold": 268435455, + "data_reliability_enabled": true, + "block_distance_for_finalized_data": 0, + "blocks_in_finalization_proof": 1, + "average_block_time": 6000, + "allowed_block_lag_for_qos_sync": 2, + "shares": 1, + "min_stake_provider": { + "denom": "ulava", + "amount": "47500000000" + }, + "api_collections": [ + { + "enabled": true, + "collection_data": { + "api_interface": "rest", + "internal_path": "", + "type": "GET", + "add_on": "" + }, + "apis": [ + { + "name": "/eth/v1/beacon/genesis", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/root", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/fork", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/finality_checkpoints", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/validators", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/validators/{validator_id}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/validator_balances", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/committees", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/sync_committees", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/states/{state_id}/rando", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/headers", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/headers/{block_id}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v2/beacon/blocks/{block_id}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/blocks/{block_id}/root", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/blocks/{block_id}/attestations", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/blob_sidecars/{block_id}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/deposit_snapshot", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/rewards/blocks/{block_id}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/blinded_blocks/{block_id}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/light_client/bootstrap/{block_root}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/light_client/updates", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/light_client/finality_update", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/light_client/optimistic_update", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/attestations", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/attester_slashings", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/proposer_slashings", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/voluntary_exits", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/bls_to_execution_changes", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/builder/states/{state_id}/expected_withdrawals", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/config/fork_schedule", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/config/spec", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/config/deposit_contract", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/events", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/duties/proposer/{epoch}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v3/validator/blocks/{slot}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/attestation_data", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/aggregate_attestation", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/sync_committee_contribution", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/node/identity", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/node/peers", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/node/peers/{peer_id}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/node/peer_count", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/node/version", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/node/syncing", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/node/health", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + } + ], + "headers": [], + "inheritance_apis": [], + "parse_directives": [ + { + "function_template": "/eth/v1/beacon/headers/head", + "function_tag": "GET_BLOCKNUM", + "result_parsing": { + "parser_arg": [ + "0", + "data", + "header", + "message", + "slot" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "/eth/v1/beacon/headers/head" + }, + { + "function_template": "/eth/v1/beacon/headers/%d", + "function_tag": "GET_BLOCK_BY_NUM", + "result_parsing": { + "parser_arg": [ + "0", + "data", + "header", + "message", + "slot" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "/eth/v1/beacon/headers/{block_id}" + } + + ], + "verifications": [ + { + "name": "genesis", + "parse_directive": { + "function_template": "/eth/v1/beacon/genesis", + "function_tag": "VERIFICATION", + "result_parsing": { + "parser_arg": [ + "0", + "data", + "genesis_fork_version" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "/eth/v1/beacon/genesis" + }, + "values": [ + { + "expected_value": "0x00000000" + } + ] + }, + { + "name": "pruning", + "parse_directive": { + "function_tag": "GET_BLOCK_BY_NUM" + } + } + ], + "extensions": [ + { + "name": "archive", + "cu_multiplier": 5, + "rule": { + "block": 7140 + } + } + ] + }, + { + "enabled": true, + "collection_data": { + "api_interface": "rest", + "internal_path": "", + "type": "POST", + "add_on": "" + }, + "apis": [ + { + "name": "/eth/v1/beacon/blocks", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/blinded_blocks", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/attestations", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/attester_slashings", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/proposer_slashings", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/sync_committees", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/beacon/pool/voluntary_exits", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/duties/attester/{epoch}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/duties/sync/{epoch}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/aggregate_and_proofs", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/beacon_committee_subscriptions", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/sync_committee_subscriptions", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/beacon_committee_selections", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/sync_committee_selections", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/contribution_and_proofs", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/prepare_beacon_proposer", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/register_validator", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/validator/liveness/{epoch}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + } + ], + "headers": [], + "inheritance_apis": [], + "parse_directives": [], + "verifications": [], + "extensions": [ + { + "name": "archive", + "cu_multiplier": 5, + "rule": { + "block": 7140 + } + } + ] + }, + { + "enabled": true, + "collection_data": { + "api_interface": "rest", + "internal_path": "", + "type": "GET", + "add_on": "debug" + }, + "apis": [ + { + "name": "/eth/v2/debug/beacon/states/{state_id}", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 200, + "enabled": true, + "category": { + "deterministic": false, + "local": true, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v2/debug/beacon/heads", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 200, + "enabled": true, + "category": { + "deterministic": false, + "local": true, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/eth/v1/debug/fork_choice", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 200, + "enabled": true, + "category": { + "deterministic": false, + "local": true, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + } + ], + "verifications": [ + { + "name": "enabled", + "parse_directive": { + "function_template": "/eth/v2/debug/beacon/states/genesis", + "function_tag": "VERIFICATION", + "result_parsing": { + "parser_arg": [ + "0", + "data", + "slot" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "/eth/v2/debug/beacon/states/{state_id}" + }, + "values": [ + { + "expected_value": "0" + } + ] + } + ], + "extensions": [ + { + "name": "archive", + "cu_multiplier": 5, + "rule": { + "block": 7140 + } + } + ] + } + ] + } + ] + }, + "deposit": "10000000ulava" +} \ No newline at end of file From 3c937116fc7cd6322cb0b5a005645761cc9e8dff Mon Sep 17 00:00:00 2001 From: Yaroms <103432884+Yaroms@users.noreply.github.com> Date: Fri, 31 May 2024 10:52:18 +0300 Subject: [PATCH 09/16] feat: CNS-957-provider-jail (#1443) * add provider jail * fix existing tests * add jail to readme * reset jail counter after 24H * pr changes * lint * fix bug * update readme * prepare for testing * add unitest * fix bugs and unitest * we have a big test for all jailed events * change proto name * fix unitest * fix readme * pr changes --------- Co-authored-by: Yarom Swisa Co-authored-by: Yaroms --- .../lava/epochstorage/stake_entry.proto | 2 + testutil/keeper/keepers_init.go | 18 +- x/dualstaking/keeper/delegate.go | 2 +- x/epochstorage/types/stake_entry.go | 4 + x/epochstorage/types/stake_entry.pb.go | 150 +++++++++++---- x/pairing/README.md | 10 +- x/pairing/keeper/epoch_cu.go | 6 + x/pairing/keeper/msg_server_unfreeze.go | 25 ++- x/pairing/keeper/unresponsive_provider.go | 92 +++++---- .../keeper/unresponsive_provider_test.go | 181 +++++++++++++++--- x/pairing/types/errors.go | 1 + x/pairing/types/expected_keepers.go | 1 + x/pairing/types/types.go | 13 +- 13 files changed, 385 insertions(+), 120 deletions(-) diff --git a/proto/lavanet/lava/epochstorage/stake_entry.proto b/proto/lavanet/lava/epochstorage/stake_entry.proto index cdc5797873..5a337698ce 100644 --- a/proto/lavanet/lava/epochstorage/stake_entry.proto +++ b/proto/lavanet/lava/epochstorage/stake_entry.proto @@ -24,6 +24,8 @@ message StakeEntry { BlockReport block_report = 13; string vault = 14; cosmos.staking.v1beta1.Description description = 15 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + uint64 jails = 16; + int64 jail_end_time = 17; } // BlockReport holds the most up-to-date info regarding blocks of the provider diff --git a/testutil/keeper/keepers_init.go b/testutil/keeper/keepers_init.go index e364ca4a6d..984c93689e 100644 --- a/testutil/keeper/keepers_init.go +++ b/testutil/keeper/keepers_init.go @@ -453,16 +453,9 @@ func AdvanceToBlock(ctx context.Context, ks *Keepers, block uint64, customBlockT return ctx } - if len(customBlockTime) > 0 { - for uint64(unwrapedCtx.BlockHeight()) < block { - ctx = AdvanceBlock(ctx, ks, customBlockTime...) - unwrapedCtx = sdk.UnwrapSDKContext(ctx) - } - } else { - for uint64(unwrapedCtx.BlockHeight()) < block { - ctx = AdvanceBlock(ctx, ks) - unwrapedCtx = sdk.UnwrapSDKContext(ctx) - } + for uint64(unwrapedCtx.BlockHeight()) < block { + ctx = AdvanceBlock(ctx, ks, customBlockTime...) + unwrapedCtx = sdk.UnwrapSDKContext(ctx) } return ctx @@ -476,10 +469,7 @@ func AdvanceEpoch(ctx context.Context, ks *Keepers, customBlockTime ...time.Dura if err != nil { panic(err) } - if len(customBlockTime) > 0 { - return AdvanceToBlock(ctx, ks, nextEpochBlockNum, customBlockTime...) - } - return AdvanceToBlock(ctx, ks, nextEpochBlockNum) + return AdvanceToBlock(ctx, ks, nextEpochBlockNum, customBlockTime...) } // Make sure you save the new context diff --git a/x/dualstaking/keeper/delegate.go b/x/dualstaking/keeper/delegate.go index 58a521c3f5..965c5a1272 100644 --- a/x/dualstaking/keeper/delegate.go +++ b/x/dualstaking/keeper/delegate.go @@ -231,7 +231,7 @@ func (k Keeper) modifyStakeEntryDelegation(ctx sdk.Context, delegator, provider, details["min_spec_stake"] = k.specKeeper.GetMinStake(ctx, chainID).String() utils.LogLavaEvent(ctx, k.Logger(ctx), types.FreezeFromUnbond, details, "freezing provider due to stake below min spec stake") stakeEntry.Freeze() - } else if delegator == stakeEntry.Vault && stakeEntry.IsFrozen() { + } else if delegator == stakeEntry.Vault && stakeEntry.IsFrozen() && !stakeEntry.IsJailed(ctx.BlockTime().UTC().Unix()) { stakeEntry.UnFreeze(k.epochstorageKeeper.GetCurrentNextEpoch(ctx) + 1) } diff --git a/x/epochstorage/types/stake_entry.go b/x/epochstorage/types/stake_entry.go index 4fda988dae..dad926835c 100644 --- a/x/epochstorage/types/stake_entry.go +++ b/x/epochstorage/types/stake_entry.go @@ -33,6 +33,10 @@ func (stakeEntry *StakeEntry) IsFrozen() bool { return stakeEntry.StakeAppliedBlock == FROZEN_BLOCK } +func (stakeEntry *StakeEntry) IsJailed(time int64) bool { + return stakeEntry.JailEndTime > time +} + func (stakeEntry *StakeEntry) IsAddressVaultAndNotProvider(address string) bool { return address != stakeEntry.Address && address == stakeEntry.Vault } diff --git a/x/epochstorage/types/stake_entry.pb.go b/x/epochstorage/types/stake_entry.pb.go index ce15076cf5..1eb9867989 100644 --- a/x/epochstorage/types/stake_entry.pb.go +++ b/x/epochstorage/types/stake_entry.pb.go @@ -41,6 +41,8 @@ type StakeEntry struct { BlockReport *BlockReport `protobuf:"bytes,13,opt,name=block_report,json=blockReport,proto3" json:"block_report,omitempty"` Vault string `protobuf:"bytes,14,opt,name=vault,proto3" json:"vault,omitempty"` Description types1.Description `protobuf:"bytes,15,opt,name=description,proto3" json:"description"` + Jails uint64 `protobuf:"varint,16,opt,name=jails,proto3" json:"jails,omitempty"` + JailEndTime int64 `protobuf:"varint,17,opt,name=jail_end_time,json=jailEndTime,proto3" json:"jail_end_time,omitempty"` } func (m *StakeEntry) Reset() { *m = StakeEntry{} } @@ -174,6 +176,20 @@ func (m *StakeEntry) GetDescription() types1.Description { return types1.Description{} } +func (m *StakeEntry) GetJails() uint64 { + if m != nil { + return m.Jails + } + return 0 +} + +func (m *StakeEntry) GetJailEndTime() int64 { + if m != nil { + return m.JailEndTime + } + return 0 +} + // BlockReport holds the most up-to-date info regarding blocks of the provider // It is set in the relay payment TX logic // used by the consumer to calculate the provider's sync score @@ -239,43 +255,45 @@ func init() { } var fileDescriptor_df6302d6b53c056e = []byte{ - // 572 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8d, 0xdb, 0xa4, 0x4d, 0xc6, 0x69, 0xbf, 0xaf, 0xd3, 0x2e, 0xa6, 0x5d, 0xb8, 0xa6, 0x45, - 0xc8, 0x02, 0x64, 0xab, 0x45, 0x3c, 0x00, 0x09, 0x0d, 0x02, 0xb1, 0x40, 0x86, 0x15, 0x9b, 0x68, - 0x6c, 0x8f, 0x9c, 0x51, 0xec, 0x19, 0xcb, 0x33, 0x8d, 0xe8, 0x5b, 0xf0, 0x18, 0x2c, 0x79, 0x07, - 0x36, 0x5d, 0x76, 0xc9, 0x0a, 0xa1, 0x64, 0xc1, 0x6b, 0xa0, 0xf9, 0x71, 0x7e, 0x16, 0x45, 0xb0, - 0xb1, 0xe7, 0xde, 0x7b, 0xee, 0x99, 0x7b, 0xce, 0xcc, 0x80, 0x27, 0x05, 0x9e, 0x61, 0x46, 0x64, - 0xa4, 0xfe, 0x11, 0xa9, 0x78, 0x3a, 0x11, 0x92, 0xd7, 0x38, 0x27, 0x91, 0x90, 0x78, 0x4a, 0xc6, - 0x84, 0xc9, 0xfa, 0x26, 0xac, 0x6a, 0x2e, 0x39, 0x3c, 0xb6, 0xe0, 0x50, 0xfd, 0xc3, 0x75, 0xf0, - 0x49, 0x70, 0x3f, 0x0f, 0x61, 0x59, 0xc5, 0x29, 0x93, 0x86, 0xe4, 0xe4, 0x28, 0xe7, 0x39, 0xd7, - 0xcb, 0x48, 0xad, 0x6c, 0xd6, 0x4b, 0xb9, 0x28, 0xb9, 0x88, 0x12, 0x2c, 0x48, 0x34, 0xbb, 0x48, - 0x88, 0xc4, 0x17, 0x51, 0xca, 0x29, 0xb3, 0xf5, 0x87, 0xb6, 0xae, 0x86, 0xa2, 0x2c, 0x5f, 0x42, - 0x6c, 0x6c, 0x51, 0x07, 0xb8, 0xa4, 0x8c, 0x47, 0xfa, 0x6b, 0x52, 0x67, 0xdf, 0x3a, 0x00, 0xbc, - 0x57, 0x4a, 0xae, 0x94, 0x10, 0xf8, 0x1c, 0x74, 0xb4, 0x2e, 0xe4, 0xf8, 0x4e, 0xe0, 0x5e, 0x1e, - 0x87, 0x86, 0x37, 0x54, 0xfb, 0x86, 0x96, 0x34, 0x1c, 0x72, 0xca, 0x06, 0xed, 0xdb, 0x1f, 0xa7, - 0xad, 0xd8, 0xa0, 0x21, 0x02, 0xbb, 0x38, 0xcb, 0x6a, 0x22, 0x04, 0xda, 0xf2, 0x9d, 0xa0, 0x17, - 0x37, 0x21, 0x0c, 0xc1, 0xa1, 0x31, 0x0a, 0x57, 0x55, 0x41, 0x49, 0x36, 0x4e, 0x0a, 0x9e, 0x4e, - 0xd1, 0xb6, 0xef, 0x04, 0xed, 0xf8, 0x40, 0x97, 0x5e, 0x98, 0xca, 0x40, 0x15, 0xe0, 0x2b, 0xd0, - 0x6b, 0x0c, 0x11, 0xa8, 0xed, 0x6f, 0x07, 0xee, 0xe5, 0x79, 0x78, 0xaf, 0xaf, 0xe1, 0x95, 0xc5, - 0xda, 0x71, 0x56, 0xbd, 0xd0, 0x07, 0x6e, 0x4e, 0x78, 0xc1, 0x53, 0x2c, 0x29, 0x67, 0xa8, 0xe3, - 0x3b, 0x41, 0x27, 0x5e, 0x4f, 0xc1, 0x23, 0xd0, 0x49, 0x27, 0x98, 0x32, 0xb4, 0xa3, 0x47, 0x36, - 0x81, 0x92, 0x52, 0x72, 0x46, 0xa7, 0xa4, 0x46, 0x5d, 0x23, 0xc5, 0x86, 0x70, 0x04, 0xf6, 0x33, - 0x52, 0x90, 0x1c, 0x4b, 0x32, 0x96, 0x5c, 0xe2, 0x02, 0xf5, 0xfe, 0xce, 0xa4, 0xbd, 0xa6, 0xed, - 0x83, 0xea, 0xda, 0xe0, 0x29, 0x68, 0x49, 0x25, 0x02, 0xff, 0xc8,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0xf9, 0xd3, 0xe6, 0x6b, 0x96, 0x37, 0x15, 0x11, 0xc9, 0x8e, 0x7e, 0x5c, 0xcf, 0x7e, 0x07, - 0x00, 0x00, 0xff, 0xff, 0xe9, 0x92, 0xff, 0xb6, 0x3f, 0x04, 0x00, 0x00, + // 607 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x6e, 0xd3, 0x30, + 0x18, 0x6f, 0xb6, 0x76, 0x5b, 0x9d, 0x6d, 0x6c, 0xde, 0x0e, 0xde, 0x0e, 0x59, 0xe8, 0x10, 0x8a, + 0x00, 0x25, 0xda, 0x10, 0x0f, 0x40, 0x4b, 0x8b, 0x40, 0x1c, 0x50, 0xd8, 0x89, 0x4b, 0xe4, 0x24, + 0x56, 0x6a, 0x9a, 0xd8, 0x51, 0xec, 0x55, 0xec, 0x2d, 0x78, 0x0c, 0x8e, 0x3c, 0xc6, 0x8e, 0x3b, + 0x72, 0x42, 0xa8, 0x3d, 0xf0, 0x14, 0x48, 0xc8, 0x76, 0xd2, 0x3f, 0x87, 0x21, 0xb8, 0x34, 0xfe, + 0xbe, 0xef, 0xf7, 0xfd, 0xfc, 0xfd, 0x7e, 0x76, 0x0d, 0x9e, 0xe6, 0x78, 0x8a, 0x19, 0x91, 0x81, + 0xfa, 0x06, 0xa4, 0xe4, 0xc9, 0x58, 0x48, 0x5e, 0xe1, 0x8c, 0x04, 0x42, 0xe2, 0x09, 0x89, 0x08, + 0x93, 0xd5, 0x8d, 0x5f, 0x56, 0x5c, 0x72, 0x78, 0x52, 0x83, 0x7d, 0xf5, 0xf5, 0x57, 0xc1, 0xa7, + 0xde, 0xfd, 0x3c, 0x84, 0xa5, 0x25, 0xa7, 0x4c, 0x1a, 0x92, 0xd3, 0xe3, 0x8c, 0x67, 0x5c, 0x2f, + 0x03, 0xb5, 0xaa, 0xb3, 0x4e, 0xc2, 0x45, 0xc1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0xbb, 0xbf, 0x3e, 0xb6, 0xd6, 0xa7, 0xef, 0x7f, 0x3b, 0x34, 0x01, + 0x7c, 0x08, 0x76, 0x73, 0x2c, 0x89, 0x90, 0xf5, 0xed, 0xdd, 0xd0, 0x45, 0xdb, 0xe4, 0x74, 0x7b, + 0x7f, 0x74, 0x3b, 0x73, 0xac, 0xbb, 0x99, 0x63, 0xfd, 0x9c, 0x39, 0xd6, 0x97, 0xb9, 0xd3, 0xba, + 0x9b, 0x3b, 0xad, 0xef, 0x73, 0xa7, 0xf5, 0xf1, 0x59, 0x46, 0xe5, 0xf8, 0x3a, 0xf6, 0x13, 0x5e, + 0x04, 0x6b, 0xaf, 0xc0, 0xe7, 0xf5, 0x77, 0x40, 0xde, 0x94, 0x44, 0xc4, 0x5b, 0xfa, 0x6f, 0xf9, + 0xfc, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x42, 0x11, 0xd6, 0x4d, 0x79, 0x04, 0x00, 0x00, } func (m *StakeEntry) Marshal() (dAtA []byte, err error) { @@ -298,6 +316,20 @@ func (m *StakeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.JailEndTime != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.JailEndTime)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.Jails != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.Jails)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } { size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -511,6 +543,12 @@ func (m *StakeEntry) Size() (n int) { } l = m.Description.Size() n += 1 + l + sovStakeEntry(uint64(l)) + if m.Jails != 0 { + n += 2 + sovStakeEntry(uint64(m.Jails)) + } + if m.JailEndTime != 0 { + n += 2 + sovStakeEntry(uint64(m.JailEndTime)) + } return n } @@ -970,6 +1008,44 @@ func (m *StakeEntry) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jails", wireType) + } + m.Jails = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Jails |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field JailEndTime", wireType) + } + m.JailEndTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.JailEndTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipStakeEntry(dAtA[iNdEx:]) diff --git a/x/pairing/README.md b/x/pairing/README.md index 0dfbc72fa5..d884d67091 100644 --- a/x/pairing/README.md +++ b/x/pairing/README.md @@ -63,6 +63,8 @@ type StakeEntry struct { DelegateTotal types.Coin // total delegation to the provider (without self delegation) DelegateLimit types.Coin // delegation total limit DelegateCommission uint64 // commission from delegation rewards + Jails uint64 // number of times the provider has been jailed + JailTime int64 // the end of the jail time, after which the provider can return to service } ``` @@ -207,12 +209,18 @@ Pairing verification is used by the provider to determine whether to offer servi #### Unresponsiveness -Providers can get punished for being unresponsive to consumer requests. If a provider wishes to stop getting paired with consumers for any reason to avoid getting punished, it can freeze itself. Currently, the punishment for being unresponsive is freezing. In the future, providers will be jailed for this kind of behaviour. +Providers can get punished for being unresponsive to consumer requests. If a provider wishes to stop getting paired with consumers for any reason to avoid getting punished, it can freeze itself. Currently, the punishment for being unresponsive is jailing. When a consumer is getting paired with a provider, it sends requests for service. If provider A is unresponsive after a few tries, the consumer switches to another provider from its pairing list, provider B, and send requests to it. When communicatting with provider B, the consumer appends the address of provider A to its request, thus adding the current request's CU to provider A's "complainers CU" counter. Every epoch start, the amount of complainers CU is compared with the amount of serviced CU of each provider across a few epochs back. If the complainers CU is higher, the provider is considered unresponsive and gets punished. The number of epochs back is determined by the recommendedEpochNumToCollectPayment parameter +#### Jail + +If a provider is down and users report it, the provider will be jailed. +The first 2 instances of jailing are temporary, lasting 1 hour each, and will be automatically removed. +After 2 consecutive jailings, the provider will be jailed for 24 hours and set to a 'frozen' state. To resume activity, the provider must send an 'unfreeze' transaction after the jail time has ended. + #### Static Providers Static providers are Lava chain providers that offer services to any consumer without relying on pairing. This feature allows new consumers to communicate with the Lava chain without a centralized provider. For example, when a new consumer wants to start using Lava, it needs to obtain its pairing list from a Lava node. However, since it initially does not have a list of providers to communicate with, it can use the static providers list to obtain its initial pairing list. diff --git a/x/pairing/keeper/epoch_cu.go b/x/pairing/keeper/epoch_cu.go index 8951a4d626..c9b9135e2c 100644 --- a/x/pairing/keeper/epoch_cu.go +++ b/x/pairing/keeper/epoch_cu.go @@ -158,6 +158,12 @@ func (k Keeper) GetProviderEpochComplainerCu(ctx sdk.Context, epoch uint64, prov return val, true } +// RemoveProviderEpochComplainerCu deletes a ProviderEpochComplainerCu in the store +func (k Keeper) RemoveProviderEpochComplainerCu(ctx sdk.Context, epoch uint64, provider string, chainID string) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ProviderEpochComplainerCuKeyPrefix()) + store.Delete(types.ProviderEpochCuKey(epoch, provider, chainID)) +} + // RemoveProviderEpochComplainerCu removes a ProviderEpochCu from the store func (k Keeper) RemoveAllProviderEpochComplainerCu(ctx sdk.Context, epoch uint64) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ProviderEpochComplainerCuKeyPrefix()) diff --git a/x/pairing/keeper/msg_server_unfreeze.go b/x/pairing/keeper/msg_server_unfreeze.go index 2296394238..3cd2da1061 100644 --- a/x/pairing/keeper/msg_server_unfreeze.go +++ b/x/pairing/keeper/msg_server_unfreeze.go @@ -20,6 +20,11 @@ func (k msgServer) UnfreezeProvider(goCtx context.Context, msg *types.MsgUnfreez return nil, utils.LavaFormatWarning("Unfreeze_cant_get_stake_entry", types.FreezeStakeEntryNotFoundError, []utils.Attribute{{Key: "chainID", Value: chainId}, {Key: "providerAddress", Value: msg.GetCreator()}}...) } + // the provider is not frozen (active or jailed), continue to other chainIDs + if !stakeEntry.IsFrozen() { + continue + } + minStake := k.Keeper.specKeeper.GetMinStake(ctx, chainId) if stakeEntry.EffectiveStake().LT(minStake.Amount) { return nil, utils.LavaFormatWarning("Unfreeze_insufficient_stake", types.UnFreezeInsufficientStakeError, @@ -31,13 +36,21 @@ func (k msgServer) UnfreezeProvider(goCtx context.Context, msg *types.MsgUnfreez }...) } - if stakeEntry.StakeAppliedBlock > unfreezeBlock { - // unfreeze the provider by making the StakeAppliedBlock the current block. This will let the provider be added to the pairing list in the next epoch, when current entries becomes the front of epochStorage - stakeEntry.UnFreeze(unfreezeBlock) - k.epochStorageKeeper.ModifyStakeEntryCurrent(ctx, chainId, stakeEntry) - unfrozen_chains = append(unfrozen_chains, chainId) + if stakeEntry.IsJailed(ctx.BlockTime().UTC().Unix()) { + return nil, utils.LavaFormatWarning("Unfreeze_jailed_provider", types.UnFreezeJailedStakeError, + []utils.Attribute{ + {Key: "chainID", Value: chainId}, + {Key: "providerAddress", Value: msg.GetCreator()}, + {Key: "jailEnd", Value: stakeEntry.JailEndTime}, + }...) } - // else case does not throw an error because we don't want to fail unfreezing other chains + + // unfreeze the provider by making the StakeAppliedBlock the current block. This will let the provider be added to the pairing list in the next epoch, when current entries becomes the front of epochStorage + stakeEntry.UnFreeze(unfreezeBlock) + stakeEntry.JailEndTime = 0 + stakeEntry.Jails = 0 + k.epochStorageKeeper.ModifyStakeEntryCurrent(ctx, chainId, stakeEntry) + unfrozen_chains = append(unfrozen_chains, chainId) } utils.LogLavaEvent(ctx, ctx.Logger(), "unfreeze_provider", map[string]string{"providerAddress": msg.GetCreator(), "chainIDs": strings.Join(unfrozen_chains, ",")}, "Provider Unfreeze") return &types.MsgUnfreezeProviderResponse{}, nil diff --git a/x/pairing/keeper/unresponsive_provider.go b/x/pairing/keeper/unresponsive_provider.go index b0ca9f6448..1025a4529a 100644 --- a/x/pairing/keeper/unresponsive_provider.go +++ b/x/pairing/keeper/unresponsive_provider.go @@ -5,6 +5,7 @@ import ( "math" "strconv" "strings" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/lavanet/lava/utils" @@ -12,7 +13,12 @@ import ( "github.com/lavanet/lava/x/pairing/types" ) -const THRESHOLD_FACTOR = 4 +const ( + THRESHOLD_FACTOR = 4 + SOFT_JAILS = 2 + SOFT_JAIL_TIME = 1 * time.Hour / time.Second + HARD_JAIL_TIME = 24 * time.Hour / time.Second +) // PunishUnresponsiveProviders punished unresponsive providers (current punishment: freeze) func (k Keeper) PunishUnresponsiveProviders(ctx sdk.Context, epochsNumToCheckCUForUnresponsiveProvider, epochsNumToCheckCUForComplainers uint64) { @@ -78,15 +84,15 @@ func (k Keeper) PunishUnresponsiveProviders(ctx sdk.Context, epochsNumToCheckCUF // check all supported providers from all geolocations prior to making decisions existingProviders := map[string]uint64{} - stakeAppliedBlockProviders := map[string]uint64{} + stakeEntries := map[string]epochstoragetypes.StakeEntry{} for _, providerStakeStorage := range providerStakeStorageList { providerStakeEntriesForChain := providerStakeStorage.GetStakeEntries() // count providers per geolocation for _, providerStakeEntry := range providerStakeEntriesForChain { if !providerStakeEntry.IsFrozen() { existingProviders[providerStakeEntry.GetChain()]++ - stakeAppliedBlockProviders[ProviderChainID(providerStakeEntry.Address, providerStakeEntry.Chain)] = providerStakeEntry.StakeAppliedBlock } + stakeEntries[ProviderChainID(providerStakeEntry.Address, providerStakeEntry.Chain)] = providerStakeEntry } } @@ -96,9 +102,14 @@ func (k Keeper) PunishUnresponsiveProviders(ctx sdk.Context, epochsNumToCheckCUF pecsDetailed := k.GetAllProviderEpochComplainerCuStore(ctx) complainedProviders := map[string]map[uint64]types.ProviderEpochComplainerCu{} // map[provider chainID]map[epoch]ProviderEpochComplainerCu for _, pec := range pecsDetailed { - if minHistoryBlock < stakeAppliedBlockProviders[pec.Provider] { - // this staked provider has too short history (either since staking - // or since it was last unfrozen) - do not consider for jailing + entry, ok := stakeEntries[ProviderChainID(pec.Provider, pec.ChainId)] + if ok { + if minHistoryBlock < entry.StakeAppliedBlock && entry.Jails == 0 { + // this staked provider has too short history (either since staking + // or since it was last unfrozen) - do not consider for jailing + continue + } + } else { continue } @@ -135,7 +146,12 @@ func (k Keeper) PunishUnresponsiveProviders(ctx sdk.Context, epochsNumToCheckCUF // providerPaymentStorageKeyList is not empty -> provider should be punished if len(epochs) != 0 && existingProviders[chainID] > minProviders { - err = k.punishUnresponsiveProvider(ctx, epochs, provider, chainID, complaintCU, servicedCU, complainedProviders[key]) + entry, ok := stakeEntries[key] + if !ok { + utils.LavaFormatError("Jail_cant_get_stake_entry", types.FreezeStakeEntryNotFoundError, []utils.Attribute{{Key: "chainID", Value: chainID}, {Key: "providerAddress", Value: provider}}...) + continue + } + err = k.punishUnresponsiveProvider(ctx, epochs, entry, complaintCU, servicedCU) existingProviders[chainID]-- if err != nil { utils.LavaFormatError("unstake unresponsive providers failed to punish provider", err, @@ -226,40 +242,50 @@ func (k Keeper) getCurrentProviderStakeStorageList(ctx sdk.Context) []epochstora } // Function that punishes providers. Current punishment is freeze -func (k Keeper) punishUnresponsiveProvider(ctx sdk.Context, epochs []uint64, provider, chainID string, complaintCU uint64, servicedCU uint64, providerEpochCuMap map[uint64]types.ProviderEpochComplainerCu) error { - // freeze the unresponsive provider - err := k.FreezeProvider(ctx, provider, []string{chainID}, "unresponsiveness") - if err != nil { - utils.LavaFormatError("unable to freeze provider entry due to unresponsiveness", err, - utils.Attribute{Key: "provider", Value: provider}, - utils.Attribute{Key: "chainID", Value: chainID}, - ) +func (k Keeper) punishUnresponsiveProvider(ctx sdk.Context, epochs []uint64, stakeEntry epochstoragetypes.StakeEntry, complaintCU uint64, servicedCU uint64) error { + // if last jail was more than 24H ago, reset the jails counter + if !stakeEntry.IsJailed(ctx.BlockTime().UTC().Unix() - int64(HARD_JAIL_TIME)) { + stakeEntry.Jails = 0 } - utils.LogLavaEvent(ctx, k.Logger(ctx), types.ProviderJailedEventName, - map[string]string{ - "provider_address": provider, - "chain_id": chainID, - "complaint_cu": strconv.FormatUint(complaintCU, 10), - "serviced_cu": strconv.FormatUint(servicedCU, 10), - }, - "Unresponsive provider was freezed due to unresponsiveness") + stakeEntry.Jails++ + + details := map[string]string{ + "provider_address": stakeEntry.Address, + "chain_id": stakeEntry.Chain, + "complaint_cu": strconv.FormatUint(complaintCU, 10), + "serviced_cu": strconv.FormatUint(servicedCU, 10), + } + + if stakeEntry.Jails > SOFT_JAILS { + stakeEntry.Freeze() + stakeEntry.JailEndTime = ctx.BlockTime().UTC().Unix() + int64(HARD_JAIL_TIME) + + details["duration"] = HARD_JAIL_TIME.String() + details["end"] = strconv.FormatInt(stakeEntry.JailEndTime, 10) + utils.LogLavaEvent(ctx, k.Logger(ctx), types.ProviderFreezeJailedEventName, details, + "Unresponsive provider was jailed due to unresponsiveness") + } else { + stakeEntry.JailEndTime = ctx.BlockTime().UTC().Unix() + int64(SOFT_JAIL_TIME) + epochduration := k.downtimeKeeper.GetParams(ctx).EpochDuration / time.Second + epochblocks := k.epochStorageKeeper.EpochBlocksRaw(ctx) + stakeEntry.StakeAppliedBlock = uint64(ctx.BlockHeight()) + uint64(SOFT_JAIL_TIME/epochduration)*epochblocks + + details["duration"] = SOFT_JAIL_TIME.String() + details["end"] = strconv.FormatInt(stakeEntry.JailEndTime, 10) + utils.LogLavaEvent(ctx, k.Logger(ctx), types.ProviderTemporaryJailedEventName, details, + "Unresponsive provider was jailed due to unresponsiveness") + } + k.epochStorageKeeper.ModifyStakeEntryCurrent(ctx, stakeEntry.Chain, stakeEntry) // reset the provider's complainer CU (so he won't get punished for the same complaints twice) - k.resetComplainersCU(ctx, epochs, provider, chainID, providerEpochCuMap) + k.resetComplainersCU(ctx, epochs, stakeEntry.Address, stakeEntry.Chain) return nil } // resetComplainersCU resets the complainers CU for a specific provider and chain -func (k Keeper) resetComplainersCU(ctx sdk.Context, epochs []uint64, provider string, chainID string, providerEpochCuMap map[uint64]types.ProviderEpochComplainerCu) { +func (k Keeper) resetComplainersCU(ctx sdk.Context, epochs []uint64, provider string, chainID string) { for _, epoch := range epochs { - pec, ok := providerEpochCuMap[epoch] - if !ok { - continue - } - - // reset the complainer CU - pec.ComplainersCu = 0 - k.SetProviderEpochComplainerCu(ctx, epoch, provider, chainID, pec) + k.RemoveProviderEpochComplainerCu(ctx, epoch, provider, chainID) } } diff --git a/x/pairing/keeper/unresponsive_provider_test.go b/x/pairing/keeper/unresponsive_provider_test.go index 92c2c1f2a9..b57189b739 100644 --- a/x/pairing/keeper/unresponsive_provider_test.go +++ b/x/pairing/keeper/unresponsive_provider_test.go @@ -2,33 +2,35 @@ package keeper_test import ( "testing" + "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/lavanet/lava/testutil/common" "github.com/lavanet/lava/utils/lavaslices" "github.com/lavanet/lava/utils/rand" "github.com/lavanet/lava/utils/sigs" - epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" + "github.com/lavanet/lava/x/pairing/keeper" "github.com/lavanet/lava/x/pairing/types" "github.com/stretchr/testify/require" ) -func (ts *tester) checkProviderFreeze(provider string, shouldFreeze bool) { +func (ts *tester) checkProviderJailed(provider string, shouldFreeze bool) { stakeEntry, stakeStorageFound := ts.Keepers.Epochstorage.GetStakeEntryByAddressCurrent(ts.Ctx, ts.spec.Name, provider) require.True(ts.T, stakeStorageFound) + require.Equal(ts.T, shouldFreeze, stakeEntry.IsJailed(ts.Ctx.BlockTime().UTC().Unix())) if shouldFreeze { - require.Equal(ts.T, uint64(epochstoragetypes.FROZEN_BLOCK), stakeEntry.StakeAppliedBlock) - } else { - require.NotEqual(ts.T, uint64(epochstoragetypes.FROZEN_BLOCK), stakeEntry.StakeAppliedBlock) + jailDelta := keeper.SOFT_JAIL_TIME + if stakeEntry.Jails > keeper.SOFT_JAILS { + jailDelta = keeper.HARD_JAIL_TIME + } + require.InDelta(ts.T, stakeEntry.JailEndTime, ts.BlockTime().UTC().Unix(), float64(jailDelta)) } } func (ts *tester) checkComplainerReset(provider string, epoch uint64) { // validate the complainers CU field in the unresponsive provider's providerPaymentStorage // was reset after being punished (use the epoch from the relay - when it got reported) - pec, found := ts.Keepers.Pairing.GetProviderEpochComplainerCu(ts.Ctx, epoch, provider, ts.spec.Name) - require.Equal(ts.T, true, found) - require.Equal(ts.T, uint64(0), pec.ComplainersCu) + _, found := ts.Keepers.Pairing.GetProviderEpochComplainerCu(ts.Ctx, epoch, provider, ts.spec.Name) + require.Equal(ts.T, false, found) } func (ts *tester) checkProviderStaked(provider string) { @@ -119,10 +121,10 @@ func TestUnresponsivenessStressTest(t *testing.T) { largerConst = recommendedEpochNumToCollectPayment } - ts.AdvanceEpochs(largerConst) + ts.AdvanceEpochs(largerConst, time.Nanosecond) for i := 0; i < unresponsiveCount; i++ { - ts.checkProviderFreeze(providers[i].Addr.String(), true) + ts.checkProviderJailed(providers[i].Addr.String(), true) ts.checkComplainerReset(providers[i].Addr.String(), relayEpoch) } @@ -185,9 +187,9 @@ func TestFreezingProviderForUnresponsiveness(t *testing.T) { largerConst = recommendedEpochNumToCollectPayment } - ts.AdvanceEpochs(largerConst) + ts.AdvanceEpochs(largerConst, time.Second) - ts.checkProviderFreeze(provider1, true) + ts.checkProviderJailed(provider1, true) ts.checkComplainerReset(provider1, relayEpoch) ts.checkProviderStaked(provider0) } @@ -242,12 +244,12 @@ func TestFreezingProviderForUnresponsivenessContinueComplainingAfterFreeze(t *te largerConst = recommendedEpochNumToCollectPayment } - ts.AdvanceEpochs(largerConst) + ts.AdvanceEpochs(largerConst, time.Second) - ts.checkProviderFreeze(provider1, true) + ts.checkProviderJailed(provider1, true) ts.checkComplainerReset(provider1, relayEpoch) - ts.AdvanceEpochs(2) + ts.AdvanceEpochs(2, time.Second) // create more relay requests for provider0 that contain complaints about provider1 for clientIndex := 0; clientIndex < clientsCount; clientIndex++ { @@ -266,7 +268,7 @@ func TestFreezingProviderForUnresponsivenessContinueComplainingAfterFreeze(t *te } // test the provider is still frozen - ts.checkProviderFreeze(provider1, true) + ts.checkProviderJailed(provider1, true) } func TestNotFreezingProviderForUnresponsivenessWithMinProviders(t *testing.T) { @@ -303,14 +305,13 @@ func TestNotFreezingProviderForUnresponsivenessWithMinProviders(t *testing.T) { } // advance enough epochs so we can check punishment due to unresponsiveness // (if the epoch is too early, there's no punishment) - ts.AdvanceEpochs(largerConst + recommendedEpochNumToCollectPayment) + ts.AdvanceEpochs(largerConst+recommendedEpochNumToCollectPayment, time.Nanosecond) // find two providers in the pairing pairing, err := ts.QueryPairingGetPairing(ts.spec.Name, clients[0].Addr.String()) require.NoError(t, err) provider0Provider := pairing.Providers[0].Address provider1Provider := pairing.Providers[1].Address - provider0Vault := sdk.MustAccAddressFromBech32(pairing.Providers[0].Vault) // create unresponsive data that includes provider1 being unresponsive unresponsiveProvidersData := []*types.ReportedProvider{{Address: provider1Provider}} @@ -330,7 +331,7 @@ func TestNotFreezingProviderForUnresponsivenessWithMinProviders(t *testing.T) { Relays: lavaslices.Slice(relaySession), } - ts.payAndVerifyBalance(relayPaymentMessage, clients[clientIndex].Addr, provider0Vault, true, true, 100) + ts.relayPaymentWithoutPay(relayPaymentMessage, true) } // advance enough epochs so the unresponsive provider will be punished @@ -338,9 +339,145 @@ func TestNotFreezingProviderForUnresponsivenessWithMinProviders(t *testing.T) { largerConst = recommendedEpochNumToCollectPayment } - ts.AdvanceEpochs(largerConst) + ts.AdvanceEpochs(largerConst, time.Nanosecond) // test the unresponsive provider1 hasn't froze - ts.checkProviderFreeze(provider1Provider, play.shouldBeFrozen) + ts.checkProviderJailed(provider1Provider, play.shouldBeFrozen) + } +} + +// Test to measure the time the check for unresponsiveness every epoch start takes +func TestJailProviderForUnresponsiveness(t *testing.T) { + // setup test for unresponsiveness + clientsCount := 1 + providersCount := 10 + + ts := newTester(t) + ts.setupForPayments(providersCount, clientsCount, providersCount-1) // set providers-to-pair + + clients := ts.Accounts(common.CONSUMER) + + recommendedEpochNumToCollectPayment := ts.Keepers.Pairing.RecommendedEpochNumToCollectPayment(ts.Ctx) + + largerConst := types.EPOCHS_NUM_TO_CHECK_CU_FOR_UNRESPONSIVE_PROVIDER + if largerConst < types.EPOCHS_NUM_TO_CHECK_FOR_COMPLAINERS { + largerConst = types.EPOCHS_NUM_TO_CHECK_FOR_COMPLAINERS + } + + // advance enough epochs so we can check punishment due to unresponsiveness + // (if the epoch is too early, there's no punishment) + ts.AdvanceEpochs(largerConst + recommendedEpochNumToCollectPayment) + + // advance enough epochs so the unresponsive provider will be punished + if largerConst < recommendedEpochNumToCollectPayment { + largerConst = recommendedEpochNumToCollectPayment + } + + // find two providers in the pairing + pairing, err := ts.QueryPairingGetPairing(ts.spec.Name, clients[0].Addr.String()) + require.NoError(t, err) + provider0 := pairing.Providers[0].Address + provider1 := pairing.Providers[1].Address + + jailProvider := func() { + found := false + // make sure our provider is in the pairing + for !found { + ts.AdvanceEpoch(0) + pairing1, err := ts.QueryPairingVerifyPairing(ts.spec.Name, clients[0].Addr.String(), provider0, ts.BlockHeight()) + require.NoError(t, err) + + pairing2, err := ts.QueryPairingVerifyPairing(ts.spec.Name, clients[0].Addr.String(), provider1, ts.BlockHeight()) + require.NoError(t, err) + found = pairing1.Valid && pairing2.Valid + } + + // create relay requests for provider0 that contain complaints about provider1 + unresponsiveProvidersData := []*types.ReportedProvider{{Address: provider1}} + relayEpoch := ts.BlockHeight() + cuSum := ts.spec.ApiCollections[0].Apis[0].ComputeUnits * 10 + + relaySession := ts.newRelaySession(provider0, 0, cuSum, relayEpoch, 0) + relaySession.UnresponsiveProviders = unresponsiveProvidersData + sig, err := sigs.Sign(clients[0].SK, *relaySession) + relaySession.Sig = sig + require.NoError(t, err) + relayPaymentMessage := types.MsgRelayPayment{ + Creator: provider0, + Relays: lavaslices.Slice(relaySession), + } + ts.relayPaymentWithoutPay(relayPaymentMessage, true) + + ts.AdvanceEpochs(recommendedEpochNumToCollectPayment+1, 0) + ts.checkProviderJailed(provider1, true) + ts.checkComplainerReset(provider1, relayEpoch) + ts.checkProviderStaked(provider0) + + res, err := ts.QueryPairingVerifyPairing(ts.spec.Name, clients[0].Addr.String(), provider1, ts.BlockHeight()) + require.NoError(t, err) + require.False(t, res.Valid) } + + // jail first time + jailProvider() + // try to unfreeze with increase of self delegation + _, err = ts.TxDualstakingDelegate(provider1, provider1, ts.spec.Index, common.NewCoin(ts.TokenDenom(), 1)) + require.Nil(t, err) + + _, err = ts.TxPairingUnfreezeProvider(provider1, ts.spec.Index) + require.Nil(t, err) + + ts.checkProviderJailed(provider1, true) + + // advance epoch and one hour to leave jail + ts.AdvanceBlock(time.Hour) + ts.AdvanceEpoch(0) + ts.checkProviderJailed(provider1, false) + + // jail second time + jailProvider() + _, err = ts.TxPairingUnfreezeProvider(provider1, ts.spec.Index) + require.Nil(t, err) + + ts.checkProviderJailed(provider1, true) + + // advance epoch and one hour to leave jail + ts.AdvanceBlock(time.Hour) + ts.AdvanceEpoch(0) + ts.checkProviderJailed(provider1, false) + + // jail third time + jailProvider() + // try to unfreeze with increase of self delegation + _, err = ts.TxDualstakingDelegate(provider1, provider1, ts.spec.Index, common.NewCoin(ts.TokenDenom(), 1)) + require.Nil(t, err) + + _, err = ts.TxPairingUnfreezeProvider(provider1, ts.spec.Index) + require.NotNil(t, err) + + // advance epoch and one hour to try leave jail + ts.AdvanceBlock(time.Hour) + ts.AdvanceEpoch(0) + ts.checkProviderJailed(provider1, true) + + // advance epoch and 24 hour to try leave jail + ts.AdvanceBlock(24 * time.Hour) + ts.AdvanceEpoch(0) + ts.checkProviderJailed(provider1, false) + + _, err = ts.TxPairingUnfreezeProvider(provider1, ts.spec.Index) + require.Nil(t, err) + ts.AdvanceEpochs(largerConst + recommendedEpochNumToCollectPayment) + + // jail first time again + jailProvider() + _, err = ts.TxPairingUnfreezeProvider(provider1, ts.spec.Index) + require.Nil(t, err) + + ts.checkProviderJailed(provider1, true) + + // advance epoch and one hour to leave jail + ts.AdvanceBlock(time.Hour) + ts.AdvanceEpoch(0) + ts.checkProviderJailed(provider1, false) } diff --git a/x/pairing/types/errors.go b/x/pairing/types/errors.go index 2a4e391e94..1ee681dcc2 100644 --- a/x/pairing/types/errors.go +++ b/x/pairing/types/errors.go @@ -23,4 +23,5 @@ var ( UnFreezeInsufficientStakeError = sdkerrors.New("UnFreezeInsufficientStakeError Error", 697, "Could not unfreeze provider due to insufficient stake. Stake must be above minimum stake to unfreeze") InvalidCreatorAddressError = sdkerrors.New("InvalidCreatorAddressError Error", 698, "The creator address is invalid") AmountCoinError = sdkerrors.New("AmountCoinError Error", 699, "Amount limit coin is invalid") + UnFreezeJailedStakeError = sdkerrors.New("UnFreezeJailedStakeError Error", 700, "Could not unfreeze provider due to being jailed") ) diff --git a/x/pairing/types/expected_keepers.go b/x/pairing/types/expected_keepers.go index 601a85248f..562feb1b2b 100644 --- a/x/pairing/types/expected_keepers.go +++ b/x/pairing/types/expected_keepers.go @@ -58,6 +58,7 @@ type EpochstorageKeeper interface { AddFixationRegistry(fixationKey string, getParamFunction func(sdk.Context) any) GetDeletedEpochs(ctx sdk.Context) []uint64 EpochBlocks(ctx sdk.Context, block uint64) (res uint64, err error) + EpochBlocksRaw(ctx sdk.Context) (res uint64) GetUnstakeHoldBlocks(ctx sdk.Context, chainID string) uint64 } diff --git a/x/pairing/types/types.go b/x/pairing/types/types.go index 02daaccdf2..38cff91711 100644 --- a/x/pairing/types/types.go +++ b/x/pairing/types/types.go @@ -5,12 +5,13 @@ const ( ProviderStakeUpdateEventName = "stake_update_provider" ProviderUnstakeEventName = "provider_unstake_commit" - RelayPaymentEventName = "relay_payment" - ProviderJailedEventName = "provider_jailed" - ProviderReportedEventName = "provider_reported" - LatestBlocksReportEventName = "provider_latest_block_report" - RejectedCuEventName = "rejected_cu" - UnstakeProposalEventName = "unstake_gov_proposal" + RelayPaymentEventName = "relay_payment" + ProviderTemporaryJailedEventName = "provider_temporary_jailed" + ProviderFreezeJailedEventName = "provider_jailed" + ProviderReportedEventName = "provider_reported" + LatestBlocksReportEventName = "provider_latest_block_report" + RejectedCuEventName = "rejected_cu" + UnstakeProposalEventName = "unstake_gov_proposal" ) // unstake description strings From 64fa141bebfd50ac4801f16e9907fa295b44e753 Mon Sep 17 00:00:00 2001 From: Amit Zafran Date: Sun, 2 Jun 2024 13:54:36 +0300 Subject: [PATCH 10/16] feat: Lava Docker support (#1458) * update GA * names * dockerfiles * GA * build args * release and push * m a p * s * push: true * red * name * contents: read * x * upload logs * old dockerfile * ports --------- Co-authored-by: amitz --- .dockerignore | 4 + .github/workflows/lava.yml | 104 ++++++++++++++++---------- .github/workflows/release.yml | 137 +++++++++++----------------------- Dockerfile | 2 +- cmd/lavad/Dockerfile | 58 ++++++++++++++ cmd/lavap/Dockerfile | 58 ++++++++++++++ 6 files changed, 227 insertions(+), 136 deletions(-) create mode 100644 cmd/lavad/Dockerfile create mode 100644 cmd/lavap/Dockerfile diff --git a/.dockerignore b/.dockerignore index 146e253a30..89aa2ce572 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,5 +17,9 @@ ecosystem/**/package-lock.json .idea/ .vscode/ .storage/ +.vscode/ +go.work +go.work.sum +*.md Dockerfile \ No newline at end of file diff --git a/.github/workflows/lava.yml b/.github/workflows/lava.yml index 18089a6afa..df8d75ff69 100644 --- a/.github/workflows/lava.yml +++ b/.github/workflows/lava.yml @@ -21,11 +21,6 @@ jobs: with: go-version-file: go.mod cache-dependency-path: go.sum - # Setup Paths - - name: home - run: pwd && ls -l - - name: ls usr - run: ls -l /home/runner/work/lava/lava - name: cp lava run: cp -r ~/work/lava/lava ~/go/lava - name: export PATH @@ -34,14 +29,6 @@ jobs: run: export GOPATH=$GOPATH:$(go env GOPATH):/go:/go/lava:/usr/local:`pwd` - name: export LAVA run: export LAVA=/home/runner/work/lava/lava - - name: go env - run: go env - - name: pwd - run: pwd - - name: tree - run: tree - - name: ls -l - run: ls -l ###################################################### ### Run Consensus unitests @@ -51,18 +38,7 @@ jobs: go install github.com/jstemmer/go-junit-report/v2@latest go test -v ./utils/... | go-junit-report -iocopy -set-exit-code -out utils-report.xml go test -v ./common/... | go-junit-report -iocopy -set-exit-code -out common-report.xml - go test -v ./x/pairing/... | go-junit-report -iocopy -set-exit-code -out pairing-report.xml - go test -v ./x/epochstorage/... | go-junit-report -iocopy -set-exit-code -out epochstorage-report.xml - go test -v ./x/spec/... | go-junit-report -iocopy -set-exit-code -out spec-report.xml - go test -v ./x/conflict/... | go-junit-report -iocopy -set-exit-code -out conflict-report.xml - go test -v ./x/plans/... | go-junit-report -iocopy -set-exit-code -out plans-report.xml - go test -v ./x/projects/... | go-junit-report -iocopy -set-exit-code -out projects-report.xml - go test -v ./x/subscription/... | go-junit-report -iocopy -set-exit-code -out subscription-report.xml - go test -v ./x/dualstaking/... | go-junit-report -iocopy -set-exit-code -out dualstaking-report.xml - go test -v ./x/fixationstore/... | go-junit-report -iocopy -set-exit-code -out fixationstore-report.xml - go test -v ./x/timerstore/... | go-junit-report -iocopy -set-exit-code -out timerstore-report.xml - go test -v ./x/downtime/... | go-junit-report -iocopy -set-exit-code -out downtime-report.xml - go test -v ./x/rewards/... | go-junit-report -iocopy -set-exit-code -out rewards-report.xml + go test -v ./x/... | go-junit-report -iocopy -set-exit-code -out x-report.xml - name: Upload Test Results if: always() @@ -79,12 +55,6 @@ jobs: with: go-version-file: go.mod cache-dependency-path: go.sum - - # Setup Paths - - name: home - run: pwd && ls -l - - name: ls usr - run: ls -l /home/runner/work/lava/lava - name: cp lava run: cp -r ~/work/lava/lava ~/go/lava - name: export GOPATH @@ -93,14 +63,6 @@ jobs: run: export PATH=$PATH:/go:/go/bin:$(go env GOPATH)/bin:/usr/local:`pwd`:/home/runner/work/lava/lava/:$GOPATH/bin - name: export LAVA run: export LAVA=/home/runner/work/lava/lava - - name: go env - run: go env - - name: pwd - run: pwd - - name: tree - run: tree - - name: ls -l - run: ls -l ###################################################### ### Run protocol unitests @@ -217,6 +179,13 @@ jobs: if: always() continue-on-error: true run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*" + + - name: Upload Protocol E2E Logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: Protocol E2E Logs + path: "testutil/e2e/protocolLogs/*" test-sdk-e2e: runs-on: ubuntu-latest @@ -327,6 +296,13 @@ jobs: if: always() continue-on-error: true run: grep "" testutil/e2e/sdkLogs/01_sdkTest* --include="*errors*" + + - name: Upload SDK E2E Logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: SDK E2E Logs + path: "testutil/e2e/sdkLogs/*" test-payment-e2e: runs-on: ubuntu-latest @@ -382,6 +358,13 @@ jobs: if: always() continue-on-error: true run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*" + + - name: Upload Payment E2E Logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: Payment E2E Logs + path: "testutil/e2e/protocolLogs/*" report-tests-results: runs-on: ubuntu-latest @@ -396,7 +379,48 @@ jobs: uses: EnricoMi/publish-unit-test-result-action@v2 with: files: "artifacts/**/*.xml" - + + build_docker: + permissions: + contents: read + packages: write + needs: [test-consensus, test-protocol] + runs-on: ubuntu-latest + strategy: + matrix: + binary: [lavap, lavad] + env: + REGISTRY: ghcr.io + IMAGE_NAME: "lavanet/lava/${{ matrix.binary }}" + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: cmd/${{ matrix.binary }}/Dockerfile + build-args: | + GIT_VERSION="${{ steps.meta.outputs.version }}" + GIT_COMMIT="${{ github.sha }}" + push: true + build_and_package: name: ${{ matrix.binary }}-${{ matrix.targetos }}-${{ matrix.arch }} needs: [test-consensus, test-protocol] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8068ef0597..b6aaec846d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,8 +26,8 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event.inputs.release_tag != '' && github.event.inputs.release_tag || github.ref_name }} - + ref: ${{ github.event.inputs.release_tag != '' && github.event.inputs.release_tag || github.ref_name }} + - name: Fetch all tags run: | git fetch --force --tags @@ -38,6 +38,7 @@ jobs: go-version-file: go.mod cache-dependency-path: go.sum + - name: Run GoReleaser id: releaser uses: goreleaser/goreleaser-action@v5 @@ -46,96 +47,42 @@ jobs: args: release --clean --timeout 90m env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: Check for existing assests - # id: existing_asset - # run: | - # if [ "${{ github.event.release.assets[0].name }}" = "lavad" ]; then - # echo "URL=${{ github.event.release.assets[0].id }}" >> $GITHUB_OUTPUT - # echo "URL=${{ github.event.release.assets[0].url }}" >> $GITHUB_OUTPUT - # echo "CHECK=true" >> $GITHUB_OUTPUT - # else - # echo "CHECK=false" >> $GITHUB_OUTPUT - # fi - - # - name: Upload build to release - # run: | - # upload_binary () { - # echo "Uploading binary to: $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavad/g')" - # curl \ - # -X POST \ - # -H "Accept: application/vnd.github+json" \ - # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - # -H "Content-Type: $(file -b --mime-type build/lavad)" \ - # --data-binary @build/lavad \ - # $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavad-${{ github.event.release.tag_name }}-linux-amd64/g') - - # curl \ - # -X POST \ - # -H "Accept: application/vnd.github+json" \ - # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - # -H "Content-Type: $(file -b --mime-type build/lavap)" \ - # --data-binary @build/lavap \ - # $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavap-${{ github.event.release.tag_name }}-linux-amd64/g') - - # curl \ - # -X POST \ - # -H "Accept: application/vnd.github+json" \ - # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - # -H "Content-Type: $(file -b --mime-type build/lavavisor)" \ - # --data-binary @build/lavavisor \ - # $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavavisor-${{ github.event.release.tag_name }}-linux-amd64/g') - # } - - # delete_binary(){ - # echo "Deleting existing binary" - # curl \ - # -X DELETE \ - # -H "Accept: application/vnd.github+json" \ - # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - # ${{ steps.existing_asset.outputs.URL }} - # } - - # if ${{ steps.existing_asset.outputs.CHECK }}; then - # delete_binary - # upload_binary - # else - # upload_binary - # fi - - # - name: Check for existing Checksum - # id: existing_checksum - # run: | - # #Get Checksum of new build - # export CHECKSUM=$(sha256sum build/lavad | cut -d " " -f1) - - # #Get the existing body - # existing_body=$(curl \ - # -H "Accept: application/vnd.github+json" \ - # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - # -H "Content-Type: $(file -b --mime-type build/lavad)" \ - # ${{ github.event.release.url }} | jq '.body') - - # if [[ $existing_body == *"$CHECKSUM"* ]]; then - # echo "CHECK=true" >> $GITHUB_OUTPUT - # echo "Checksum hasn't changed." - # else - # echo "CHECK=false" >> $GITHUB_OUTPUT - # cat <> /tmp/body - # $(echo $existing_body | sed '$s/.$//')\r\nChecksum $CHECKSUM" - # EOF - # echo -E "NEW_BODY=$(cat /tmp/body)" >> $GITHUB_OUTPUT - # fi - - # - name: Append Binary Checksum - # uses: actions/github-script@v6 - # if: ${{ steps.existing_checksum.outputs.CHECK }} == 'false' - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # script: | - # const { data } = await github.rest.repos.updateRelease({ - # owner: context.repo.owner, - # repo: context.repo.repo, - # release_id: context.payload.release.id, - # body: ${{ steps.existing_checksum.outputs.NEW_BODY }} - # }); \ No newline at end of file + + release_docker: + permissions: + packages: write + runs-on: ubuntu-latest + strategy: + matrix: + binary: [lavap, lavad] + env: + REGISTRY: ghcr.io + IMAGE_NAME: "lavanet/lava/${{ matrix.binary }}" + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: cmd/${{ matrix.binary }}/Dockerfile + build-args: | + GIT_VERSION="${{ steps.meta.outputs.version }}" + GIT_COMMIT="${{ github.sha }}" + push: true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index edc101d1f1..99f1350bb5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -194,4 +194,4 @@ EXPOSE 26656 # tendermint rpc EXPOSE 26657 -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/cmd/lavad/Dockerfile b/cmd/lavad/Dockerfile new file mode 100644 index 0000000000..39efa9dbcd --- /dev/null +++ b/cmd/lavad/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1 + +ARG GO_VERSION="1.20" +ARG BUILD_TAGS="netgo,ledger,muslc" + +FROM golang:${GO_VERSION}-alpine3.18 as builder + +RUN apk add --no-cache \ + ca-certificates \ + build-base \ + linux-headers \ + binutils-gold + +WORKDIR /lava + +COPY go.mod go.sum ./ + +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + go mod download + +COPY . . + +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + GOWORK=off go build \ + -mod=readonly \ + -tags "netgo,ledger,muslc" \ + -ldflags \ + "-X github.com/cosmos/cosmos-sdk/version.Name="lava" \ + -X github.com/cosmos/cosmos-sdk/version.AppName="lavad" \ + -X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \ + -X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \ + -X github.com/cosmos/cosmos-sdk/version.BuildTags=${BUILD_TAGS} \ + -w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \ + -trimpath \ + -o /lava/build/lavad \ + /lava/cmd/lavad/main.go + +FROM gcr.io/distroless/static-debian12 + +COPY --from=builder /lava/build/lavad /bin/lavad + +ENV HOME /lava +WORKDIR $HOME + +# lava api +EXPOSE 1317 +# rosetta +EXPOSE 8080 +# grpc +EXPOSE 9090 +# tendermint p2p +EXPOSE 26656 +# tendermint rpc +EXPOSE 26657 + +ENTRYPOINT ["lavad"] \ No newline at end of file diff --git a/cmd/lavap/Dockerfile b/cmd/lavap/Dockerfile new file mode 100644 index 0000000000..2df889dd10 --- /dev/null +++ b/cmd/lavap/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1 + +ARG GO_VERSION="1.20" +ARG BUILD_TAGS="netgo,ledger,muslc" + +FROM golang:${GO_VERSION}-alpine3.18 as builder + +RUN apk add --no-cache \ + ca-certificates \ + build-base \ + linux-headers \ + binutils-gold + +WORKDIR /lava + +COPY go.mod go.sum ./ + +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + go mod download + +COPY . . + +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + GOWORK=off go build \ + -mod=readonly \ + -tags "netgo,ledger,muslc" \ + -ldflags \ + "-X github.com/cosmos/cosmos-sdk/version.Name="lava" \ + -X github.com/cosmos/cosmos-sdk/version.AppName="lavap" \ + -X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \ + -X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \ + -X github.com/cosmos/cosmos-sdk/version.BuildTags=${BUILD_TAGS} \ + -w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \ + -trimpath \ + -o /lava/build/lavap \ + /lava/cmd/lavap/main.go + +FROM gcr.io/distroless/static-debian12 + +COPY --from=builder /lava/build/lavap /bin/lavap + +ENV HOME /lava +WORKDIR $HOME + +# lava api +EXPOSE 1317 +# rosetta +EXPOSE 8080 +# grpc +EXPOSE 9090 +# tendermint p2p +EXPOSE 26656 +# tendermint rpc +EXPOSE 26657 + +ENTRYPOINT ["lavap"] \ No newline at end of file From 9deb00a3ef225e9412614e1d4f6afd9d9f4a06e8 Mon Sep 17 00:00:00 2001 From: Amit Zafran Date: Sun, 2 Jun 2024 21:03:38 +0300 Subject: [PATCH 11/16] fix: docker tag support (#1465) * update GA * names * dockerfiles * GA * build args * release and push * m a p * s * push: true * red * name * contents: read * x * upload logs * old dockerfile * ports * ref --------- Co-authored-by: amitz --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6aaec846d..aaaa474d2a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,6 +61,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.inputs.release_tag != '' && github.event.inputs.release_tag || github.ref_name }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx From 9264d7a575005bacff150f317c7e4e93967a9a36 Mon Sep 17 00:00:00 2001 From: Yaroms <103432884+Yaroms@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:38:17 +0300 Subject: [PATCH 12/16] feat: refactor tendermint and ethermint specs usage (#1463) * remove tendermint to a different spec use in namada use ethermint in evmos * change spec names * fix e2e * add tendermint spec to cli commands * fix tests --------- Co-authored-by: Yarom Swisa --- cookbook/plans/gateway-full.json | 296 ++++++++ cookbook/plans/gateway.json | 264 +------ .../{spec_add_agoric.json => agoric.json} | 0 .../specs/{spec_add_aptos.json => aptos.json} | 0 .../{spec_add_arbitrum.json => arbitrum.json} | 0 ...spec_add_avalanche.json => avalanche.json} | 0 .../{spec_add_axelar.json => axelar.json} | 0 .../specs/{spec_add_base.json => base.json} | 0 .../{spec_add_beacon.json => beacon.json} | 0 .../specs/{spec_add_bera.json => bera.json} | 0 .../specs/{spec_add_blast.json => blast.json} | 0 .../specs/{spec_add_bsc.json => bsc.json} | 0 .../specs/{spec_add_canto.json => canto.json} | 0 .../{spec_add_celestia.json => celestia.json} | 0 .../specs/{spec_add_celo.json => celo.json} | 0 ...spec_add_cosmoshub.json => cosmoshub.json} | 0 ...spec_add_cosmossdk.json => cosmossdk.json} | 675 +---------------- ...dd_cosmossdk_45.json => cosmossdk_45.json} | 0 ...osmossdk_full.json => cosmossdk_full.json} | 0 ...ec_add_cosmoswasm.json => cosmoswasm.json} | 0 .../{spec_add_ethereum.json => ethereum.json} | 0 ...spec_add_ethermint.json => ethermint.json} | 0 .../specs/{spec_add_evmos.json => evmos.json} | 271 +------ .../{spec_add_fantom.json => fantom.json} | 0 .../specs/{spec_add_fuse.json => fuse.json} | 0 .../specs/{spec_add_fvm.json => fvm.json} | 0 .../specs/{spec_add_ibc.json => ibc.json} | 0 .../specs/{spec_add_juno.json => juno.json} | 0 .../specs/{spec_add_koii.json => koii.json} | 0 .../specs/{spec_add_lava.json => lava.json} | 0 ..._manta_pacific.json => manta_pacific.json} | 0 .../{spec_add_mantle.json => mantle.json} | 0 .../{spec_add_moralis.json => moralis.json} | 0 .../{spec_add_namada.json => namada.json} | 29 +- .../specs/{spec_add_near.json => near.json} | 0 .../{spec_add_optimism.json => optimism.json} | 0 .../{spec_add_osmosis.json => osmosis.json} | 0 .../{spec_add_polygon.json => polygon.json} | 0 .../{spec_add_scroll.json => scroll.json} | 0 .../{spec_add_secret.json => secret.json} | 0 .../specs/{spec_add_side.json => side.json} | 0 .../{spec_add_solana.json => solana.json} | 0 ..._add_sqdsubgraph.json => sqdsubgraph.json} | 0 .../{spec_add_stargaze.json => stargaze.json} | 0 .../{spec_add_starknet.json => starknet.json} | 0 .../specs/{spec_add_sui.json => sui.json} | 0 cookbook/specs/tendermint.json | 697 ++++++++++++++++++ .../specs/{spec_add_union.json => union.json} | 0 .../{spec_add_zksync.json => zksync.json} | 0 docs/Events.md | 2 +- scripts/automation_scripts/ReadMe.md | 4 +- .../disable_and_validate_grpc_spec_api.py | 8 +- scripts/automation_scripts/grpc_scaffolder.py | 8 +- .../automation_scripts/grpc_spec_builder.py | 14 +- .../remove_type_from_grpc_spec_api.py | 8 +- scripts/cli_test.sh | 2 +- scripts/init_chain_commands.sh | 5 +- scripts/init_e2e.sh | 2 +- scripts/init_payment_e2e.sh | 2 +- scripts/jail_provider_test.sh | 4 +- scripts/pre_setups/init_aptos_only_test.sh | 2 +- scripts/pre_setups/init_arbitrum_only_test.sh | 2 +- scripts/pre_setups/init_avalanch_only.sh | 2 +- .../pre_setups/init_axelar_only_with_node.sh | 2 +- scripts/pre_setups/init_canto_only_test.sh | 2 +- scripts/pre_setups/init_eth_archive_mix.sh | 2 +- scripts/pre_setups/init_evmos_only_test.sh | 2 +- .../pre_setups/init_evmos_only_with_node.sh | 2 +- scripts/pre_setups/init_fvm_only_test.sh | 2 +- scripts/pre_setups/init_lava_only_test.sh | 2 +- scripts/pre_setups/init_lava_only_test_5.sh | 2 +- .../init_lava_only_test_with_badge.sh | 2 +- .../pre_setups/init_lava_only_with_node.sh | 2 +- ...nit_lava_only_with_node_three_providers.sh | 2 +- .../init_lava_only_with_node_with_cache.sh | 2 +- ...it_lava_only_with_node_with_relayserver.sh | 2 +- scripts/pre_setups/init_moralis_only.sh | 2 +- .../pre_setups/init_near_only_with_node.sh | 2 +- scripts/pre_setups/init_osmosis_only.sh | 2 +- scripts/pre_setups/init_solana_only.sh | 2 +- scripts/pre_setups/init_sqdsubgraph_only.sh | 2 +- .../init_starknet_addons_only_with_node.sh | 2 +- .../pre_setups/setup_lavavisor_dev_test.sh | 2 +- scripts/test_spec_full.sh | 4 +- scripts/updateSpecsCu.py | 10 +- testutil/e2e/paymentE2E.go | 2 +- testutil/e2e/protocolE2E.go | 8 +- testutil/e2e/sdkE2E.go | 2 +- testutil/keeper/spec.go | 2 +- x/spec/keeper/spec_test.go | 4 +- 90 files changed, 1067 insertions(+), 1302 deletions(-) create mode 100644 cookbook/plans/gateway-full.json rename cookbook/specs/{spec_add_agoric.json => agoric.json} (100%) rename cookbook/specs/{spec_add_aptos.json => aptos.json} (100%) rename cookbook/specs/{spec_add_arbitrum.json => arbitrum.json} (100%) rename cookbook/specs/{spec_add_avalanche.json => avalanche.json} (100%) rename cookbook/specs/{spec_add_axelar.json => axelar.json} (100%) rename cookbook/specs/{spec_add_base.json => base.json} (100%) rename cookbook/specs/{spec_add_beacon.json => beacon.json} (100%) rename cookbook/specs/{spec_add_bera.json => bera.json} (100%) rename cookbook/specs/{spec_add_blast.json => blast.json} (100%) rename cookbook/specs/{spec_add_bsc.json => bsc.json} (100%) rename cookbook/specs/{spec_add_canto.json => canto.json} (100%) rename cookbook/specs/{spec_add_celestia.json => celestia.json} (100%) rename cookbook/specs/{spec_add_celo.json => celo.json} (100%) rename cookbook/specs/{spec_add_cosmoshub.json => cosmoshub.json} (100%) rename cookbook/specs/{spec_add_cosmossdk.json => cosmossdk.json} (87%) rename cookbook/specs/{spec_add_cosmossdk_45.json => cosmossdk_45.json} (100%) rename cookbook/specs/{spec_add_cosmossdk_full.json => cosmossdk_full.json} (100%) rename cookbook/specs/{spec_add_cosmoswasm.json => cosmoswasm.json} (100%) rename cookbook/specs/{spec_add_ethereum.json => ethereum.json} (100%) rename cookbook/specs/{spec_add_ethermint.json => ethermint.json} (100%) rename cookbook/specs/{spec_add_evmos.json => evmos.json} (85%) rename cookbook/specs/{spec_add_fantom.json => fantom.json} (100%) rename cookbook/specs/{spec_add_fuse.json => fuse.json} (100%) rename cookbook/specs/{spec_add_fvm.json => fvm.json} (100%) rename cookbook/specs/{spec_add_ibc.json => ibc.json} (100%) rename cookbook/specs/{spec_add_juno.json => juno.json} (100%) rename cookbook/specs/{spec_add_koii.json => koii.json} (100%) rename cookbook/specs/{spec_add_lava.json => lava.json} (100%) rename cookbook/specs/{spec_add_manta_pacific.json => manta_pacific.json} (100%) rename cookbook/specs/{spec_add_mantle.json => mantle.json} (100%) rename cookbook/specs/{spec_add_moralis.json => moralis.json} (100%) rename cookbook/specs/{spec_add_namada.json => namada.json} (73%) rename cookbook/specs/{spec_add_near.json => near.json} (100%) rename cookbook/specs/{spec_add_optimism.json => optimism.json} (100%) rename cookbook/specs/{spec_add_osmosis.json => osmosis.json} (100%) rename cookbook/specs/{spec_add_polygon.json => polygon.json} (100%) rename cookbook/specs/{spec_add_scroll.json => scroll.json} (100%) rename cookbook/specs/{spec_add_secret.json => secret.json} (100%) rename cookbook/specs/{spec_add_side.json => side.json} (100%) rename cookbook/specs/{spec_add_solana.json => solana.json} (100%) rename cookbook/specs/{spec_add_sqdsubgraph.json => sqdsubgraph.json} (100%) rename cookbook/specs/{spec_add_stargaze.json => stargaze.json} (100%) rename cookbook/specs/{spec_add_starknet.json => starknet.json} (100%) rename cookbook/specs/{spec_add_sui.json => sui.json} (100%) create mode 100644 cookbook/specs/tendermint.json rename cookbook/specs/{spec_add_union.json => union.json} (100%) rename cookbook/specs/{spec_add_zksync.json => zksync.json} (100%) diff --git a/cookbook/plans/gateway-full.json b/cookbook/plans/gateway-full.json new file mode 100644 index 0000000000..988e6f0778 --- /dev/null +++ b/cookbook/plans/gateway-full.json @@ -0,0 +1,296 @@ +{ + "proposal": { + "title": "Add plan proposal: Gateway", + "description": "A proposal for a new plan for a lava gateway", + "plans": [ + { + "index": "gateway", + "description": "Plan for the Lava gateway", + "type": "rpc", + "price": { + "denom": "ulava", + "amount": "1000000000" + }, + "allowed_buyers": [ + "lava@1x07x0krj7h00jejrcp35kvlc8tpa44dza76dw8" + ], + "annual_discount_percentage": 0, + "allow_overuse": false, + "overuse_rate": 0, + "projects": 50, + "plan_policy": { + "geolocation_profile": "GL", + "total_cu_limit": 9223372036854775807, + "epoch_cu_limit": 9223372036854775807, + "max_providers_to_pair": 24, + "selected_providers": [], + "selected_providers_mode": "ALLOWED", + "chain_policies": [ + { + "apis": [], + "chain_id": "NEAR", + "requirements": [ + { + "collection": { + "add_on": "", + "api_interface": "jsonrpc", + "internal_path": "", + "type": "POST" + }, + "extensions": [ + "archive" + ], + "mixed": true + } + ] + }, + { + "apis": [], + "chain_id": "STRK", + "requirements": [ + { + "collection": { + "add_on": "trace", + "api_interface": "jsonrpc", + "internal_path": "", + "type": "POST" + }, + "extensions": [], + "mixed": true + } + ] + }, + { + "apis": [], + "chain_id": "ETH1", + "requirements": [ + { + "collection": { + "add_on": "", + "api_interface": "jsonrpc", + "internal_path": "", + "type": "POST" + }, + "extensions": [ + "archive" + ], + "mixed": true + } + ] + }, + { + "apis": [], + "chain_id": "EVMOS", + "requirements": [ + { + "collection": { + "add_on": "", + "api_interface": "jsonrpc", + "internal_path": "", + "type": "POST" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "rest", + "internal_path": "", + "type": "GET" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "grpc", + "internal_path": "", + "type": "" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "tendermintrpc", + "internal_path": "", + "type": "" + }, + "extensions": [ + "archive" + ], + "mixed": true + } + ] + }, + { + "apis": [], + "chain_id": "AXELAR", + "requirements": [ + { + "collection": { + "add_on": "", + "api_interface": "rest", + "internal_path": "", + "type": "GET" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "tendermintrpc", + "internal_path": "", + "type": "" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "grpc", + "internal_path": "", + "type": "" + }, + "extensions": [ + "archive" + ], + "mixed": true + } + ] + }, + { + "apis": [], + "chain_id": "OSMOSIS", + "requirements": [ + { + "collection": { + "add_on": "", + "api_interface": "rest", + "internal_path": "", + "type": "GET" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "tendermintrpc", + "internal_path": "", + "type": "" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "grpc", + "internal_path": "", + "type": "" + }, + "extensions": [ + "archive" + ], + "mixed": true + } + ] + }, + { + "apis": [], + "chain_id": "COSMOSHUB", + "requirements": [ + { + "collection": { + "add_on": "", + "api_interface": "rest", + "internal_path": "", + "type": "GET" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "tendermintrpc", + "internal_path": "", + "type": "" + }, + "extensions": [ + "archive" + ], + "mixed": true + }, + { + "collection": { + "add_on": "", + "api_interface": "grpc", + "internal_path": "", + "type": "" + }, + "extensions": [ + "archive" + ], + "mixed": true + } + ] + }, + { + "apis": [], + "chain_id": "SQDSUBGRAPH", + "requirements": [ + { + "collection": { + "api_interface": "rest", + "internal_path": "", + "type": "POST", + "add_on": "compound-v3" + }, + "mixed": true + }, + { + "collection": { + "api_interface": "rest", + "internal_path": "", + "type": "POST", + "add_on": "aave-v3" + }, + "mixed": true + } + ] + }, + { + "apis": [], + "chain_id": "*", + "requirements": [] + } + ] + } + } + ] + }, + "deposit": "10000000ulava" +} \ No newline at end of file diff --git a/cookbook/plans/gateway.json b/cookbook/plans/gateway.json index 988e6f0778..915b90d4d4 100644 --- a/cookbook/plans/gateway.json +++ b/cookbook/plans/gateway.json @@ -25,269 +25,7 @@ "max_providers_to_pair": 24, "selected_providers": [], "selected_providers_mode": "ALLOWED", - "chain_policies": [ - { - "apis": [], - "chain_id": "NEAR", - "requirements": [ - { - "collection": { - "add_on": "", - "api_interface": "jsonrpc", - "internal_path": "", - "type": "POST" - }, - "extensions": [ - "archive" - ], - "mixed": true - } - ] - }, - { - "apis": [], - "chain_id": "STRK", - "requirements": [ - { - "collection": { - "add_on": "trace", - "api_interface": "jsonrpc", - "internal_path": "", - "type": "POST" - }, - "extensions": [], - "mixed": true - } - ] - }, - { - "apis": [], - "chain_id": "ETH1", - "requirements": [ - { - "collection": { - "add_on": "", - "api_interface": "jsonrpc", - "internal_path": "", - "type": "POST" - }, - "extensions": [ - "archive" - ], - "mixed": true - } - ] - }, - { - "apis": [], - "chain_id": "EVMOS", - "requirements": [ - { - "collection": { - "add_on": "", - "api_interface": "jsonrpc", - "internal_path": "", - "type": "POST" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "rest", - "internal_path": "", - "type": "GET" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "grpc", - "internal_path": "", - "type": "" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "tendermintrpc", - "internal_path": "", - "type": "" - }, - "extensions": [ - "archive" - ], - "mixed": true - } - ] - }, - { - "apis": [], - "chain_id": "AXELAR", - "requirements": [ - { - "collection": { - "add_on": "", - "api_interface": "rest", - "internal_path": "", - "type": "GET" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "tendermintrpc", - "internal_path": "", - "type": "" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "grpc", - "internal_path": "", - "type": "" - }, - "extensions": [ - "archive" - ], - "mixed": true - } - ] - }, - { - "apis": [], - "chain_id": "OSMOSIS", - "requirements": [ - { - "collection": { - "add_on": "", - "api_interface": "rest", - "internal_path": "", - "type": "GET" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "tendermintrpc", - "internal_path": "", - "type": "" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "grpc", - "internal_path": "", - "type": "" - }, - "extensions": [ - "archive" - ], - "mixed": true - } - ] - }, - { - "apis": [], - "chain_id": "COSMOSHUB", - "requirements": [ - { - "collection": { - "add_on": "", - "api_interface": "rest", - "internal_path": "", - "type": "GET" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "tendermintrpc", - "internal_path": "", - "type": "" - }, - "extensions": [ - "archive" - ], - "mixed": true - }, - { - "collection": { - "add_on": "", - "api_interface": "grpc", - "internal_path": "", - "type": "" - }, - "extensions": [ - "archive" - ], - "mixed": true - } - ] - }, - { - "apis": [], - "chain_id": "SQDSUBGRAPH", - "requirements": [ - { - "collection": { - "api_interface": "rest", - "internal_path": "", - "type": "POST", - "add_on": "compound-v3" - }, - "mixed": true - }, - { - "collection": { - "api_interface": "rest", - "internal_path": "", - "type": "POST", - "add_on": "aave-v3" - }, - "mixed": true - } - ] - }, - { - "apis": [], - "chain_id": "*", - "requirements": [] - } - ] + "chain_policies": [] } } ] diff --git a/cookbook/specs/spec_add_agoric.json b/cookbook/specs/agoric.json similarity index 100% rename from cookbook/specs/spec_add_agoric.json rename to cookbook/specs/agoric.json diff --git a/cookbook/specs/spec_add_aptos.json b/cookbook/specs/aptos.json similarity index 100% rename from cookbook/specs/spec_add_aptos.json rename to cookbook/specs/aptos.json diff --git a/cookbook/specs/spec_add_arbitrum.json b/cookbook/specs/arbitrum.json similarity index 100% rename from cookbook/specs/spec_add_arbitrum.json rename to cookbook/specs/arbitrum.json diff --git a/cookbook/specs/spec_add_avalanche.json b/cookbook/specs/avalanche.json similarity index 100% rename from cookbook/specs/spec_add_avalanche.json rename to cookbook/specs/avalanche.json diff --git a/cookbook/specs/spec_add_axelar.json b/cookbook/specs/axelar.json similarity index 100% rename from cookbook/specs/spec_add_axelar.json rename to cookbook/specs/axelar.json diff --git a/cookbook/specs/spec_add_base.json b/cookbook/specs/base.json similarity index 100% rename from cookbook/specs/spec_add_base.json rename to cookbook/specs/base.json diff --git a/cookbook/specs/spec_add_beacon.json b/cookbook/specs/beacon.json similarity index 100% rename from cookbook/specs/spec_add_beacon.json rename to cookbook/specs/beacon.json diff --git a/cookbook/specs/spec_add_bera.json b/cookbook/specs/bera.json similarity index 100% rename from cookbook/specs/spec_add_bera.json rename to cookbook/specs/bera.json diff --git a/cookbook/specs/spec_add_blast.json b/cookbook/specs/blast.json similarity index 100% rename from cookbook/specs/spec_add_blast.json rename to cookbook/specs/blast.json diff --git a/cookbook/specs/spec_add_bsc.json b/cookbook/specs/bsc.json similarity index 100% rename from cookbook/specs/spec_add_bsc.json rename to cookbook/specs/bsc.json diff --git a/cookbook/specs/spec_add_canto.json b/cookbook/specs/canto.json similarity index 100% rename from cookbook/specs/spec_add_canto.json rename to cookbook/specs/canto.json diff --git a/cookbook/specs/spec_add_celestia.json b/cookbook/specs/celestia.json similarity index 100% rename from cookbook/specs/spec_add_celestia.json rename to cookbook/specs/celestia.json diff --git a/cookbook/specs/spec_add_celo.json b/cookbook/specs/celo.json similarity index 100% rename from cookbook/specs/spec_add_celo.json rename to cookbook/specs/celo.json diff --git a/cookbook/specs/spec_add_cosmoshub.json b/cookbook/specs/cosmoshub.json similarity index 100% rename from cookbook/specs/spec_add_cosmoshub.json rename to cookbook/specs/cosmoshub.json diff --git a/cookbook/specs/spec_add_cosmossdk.json b/cookbook/specs/cosmossdk.json similarity index 87% rename from cookbook/specs/spec_add_cosmossdk.json rename to cookbook/specs/cosmossdk.json index cada7f7a6a..3b75cf2e3c 100644 --- a/cookbook/specs/spec_add_cosmossdk.json +++ b/cookbook/specs/cosmossdk.json @@ -8,7 +8,8 @@ "name": "cosmos sdk", "enabled": false, "imports": [ - "IBC" + "IBC", + "TENDERMINT" ], "reliability_threshold": 268435455, "data_reliability_enabled": true, @@ -4792,678 +4793,6 @@ } } ] - }, - { - "enabled": true, - "collection_data": { - "api_interface": "tendermintrpc", - "internal_path": "", - "type": "", - "add_on": "" - }, - "apis": [ - { - "name": "dump_consensus_state", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "abci_info", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "abci_query", - "block_parsing": { - "parser_arg": [ - "height", - "=", - "2" - ], - "parser_func": "PARSE_DICTIONARY_OR_ORDERED", - "default_value": "latest" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "block", - "block_parsing": { - "parser_arg": [ - "height", - "=", - "0" - ], - "parser_func": "PARSE_DICTIONARY_OR_ORDERED", - "default_value": "latest" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "block_by_hash", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "block_results", - "block_parsing": { - "parser_arg": [ - "height", - "=", - "0" - ], - "parser_func": "PARSE_DICTIONARY_OR_ORDERED", - "default_value": "latest" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "block_search", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "blockchain", - "block_parsing": { - "parser_arg": [ - "maxHeight", - "=", - "1" - ], - "parser_func": "PARSE_DICTIONARY_OR_ORDERED", - "default_value": "latest" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "broadcast_evidence", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 1 - }, - "extra_compute_units": 0 - }, - { - "name": "broadcast_tx_async", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": false, - "subscription": false, - "stateful": 1 - }, - "extra_compute_units": 0 - }, - { - "name": "broadcast_tx_commit", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": false, - "subscription": false, - "stateful": 1, - "hanging_api": true - }, - "extra_compute_units": 0 - }, - { - "name": "broadcast_tx_sync", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": false, - "subscription": false, - "stateful": 1, - "hanging_api": true - }, - "extra_compute_units": 0 - }, - { - "name": "check_tx", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "commit", - "block_parsing": { - "parser_arg": [ - "height", - "=", - "0" - ], - "parser_func": "PARSE_DICTIONARY_OR_ORDERED", - "default_value": "latest" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "consensus_params", - "block_parsing": { - "parser_arg": [ - "height", - "=", - "0" - ], - "parser_func": "PARSE_DICTIONARY_OR_ORDERED", - "default_value": "latest" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "consensus_state", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "genesis", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "genesis_chunked", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "health", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "net_info", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "num_unconfirmed_txs", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "status", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "subscribe", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": true, - "subscription": true, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "tx", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "tx_search", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "unconfirmed_txs", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "unsubscribe", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": true, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "unsubscribe_all", - "block_parsing": { - "parser_arg": [ - "" - ], - "parser_func": "EMPTY" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": false, - "local": true, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "validators", - "block_parsing": { - "parser_arg": [ - "height", - "=", - "0" - ], - "parser_func": "PARSE_DICTIONARY_OR_ORDERED", - "default_value": "latest" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - } - ], - "headers": [], - "inheritance_apis": [], - "parse_directives": [ - { - "function_tag": "GET_BLOCKNUM", - "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"status\",\"params\":[],\"id\":1}", - "result_parsing": { - "parser_arg": [ - "0", - "sync_info", - "latest_block_height" - ], - "parser_func": "PARSE_CANONICAL" - }, - "api_name": "status" - }, - { - "function_template": "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block\",\"params\":[\"%d\"]}", - "function_tag": "GET_BLOCK_BY_NUM", - "result_parsing": { - "parser_arg": [ - "0", - "block_id", - "hash" - ], - "parser_func": "PARSE_CANONICAL", - "encoding": "hex" - }, - "api_name": "block" - }, - { - "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"status\",\"params\":[],\"id\":1}", - "function_tag": "GET_EARLIEST_BLOCK", - "result_parsing": { - "parser_arg": [ - "0", - "sync_info", - "earliest_block_height" - ], - "parser_func": "PARSE_CANONICAL", - "encoding": "base64" - }, - "api_name": "earliest_block" - } - ], - "verifications": [ - { - "name": "minimum-gas-price", - "parse_directive": { - "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"abci_query\",\"params\":{\"path\":\"/cosmos.base.node.v1beta1.Service/Config\", \"height\":\"0\", \"data\":\"\",\"proof\":\"true\"},\"id\":1}", - "function_tag": "VERIFICATION", - "result_parsing": { - "parser_arg": [ - "0", - "response", - "value" - ], - "parser_func": "PARSE_CANONICAL" - }, - "api_name": "abci_query" - } - }, - { - "name": "chain-id", - "parse_directive": { - "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"status\",\"params\":[],\"id\":1}", - "function_tag": "VERIFICATION", - "result_parsing": { - "parser_arg": [ - "0", - "node_info", - "network" - ], - "parser_func": "PARSE_CANONICAL" - }, - "api_name": "status" - } - }, - { - "name": "pruning", - "parse_directive": { - "function_tag": "GET_EARLIEST_BLOCK" - } - }, - { - "name": "tx-indexing", - "parse_directive": { - "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"status\",\"params\":[],\"id\":1}", - "function_tag": "VERIFICATION", - "result_parsing": { - "parser_arg": [ - "0", - "node_info", - "other", - "tx_index" - ], - "parser_func": "PARSE_CANONICAL" - }, - "api_name": "status" - }, - "values": [ - { - "expected_value": "on" - } - ] - } - ], - "extensions": [ - { - "name": "archive", - "cu_multiplier": 5, - "rule": { - "block": 50000 - } - } - ] } ] } diff --git a/cookbook/specs/spec_add_cosmossdk_45.json b/cookbook/specs/cosmossdk_45.json similarity index 100% rename from cookbook/specs/spec_add_cosmossdk_45.json rename to cookbook/specs/cosmossdk_45.json diff --git a/cookbook/specs/spec_add_cosmossdk_full.json b/cookbook/specs/cosmossdk_full.json similarity index 100% rename from cookbook/specs/spec_add_cosmossdk_full.json rename to cookbook/specs/cosmossdk_full.json diff --git a/cookbook/specs/spec_add_cosmoswasm.json b/cookbook/specs/cosmoswasm.json similarity index 100% rename from cookbook/specs/spec_add_cosmoswasm.json rename to cookbook/specs/cosmoswasm.json diff --git a/cookbook/specs/spec_add_ethereum.json b/cookbook/specs/ethereum.json similarity index 100% rename from cookbook/specs/spec_add_ethereum.json rename to cookbook/specs/ethereum.json diff --git a/cookbook/specs/spec_add_ethermint.json b/cookbook/specs/ethermint.json similarity index 100% rename from cookbook/specs/spec_add_ethermint.json rename to cookbook/specs/ethermint.json diff --git a/cookbook/specs/spec_add_evmos.json b/cookbook/specs/evmos.json similarity index 85% rename from cookbook/specs/spec_add_evmos.json rename to cookbook/specs/evmos.json index 086355c007..938be9bcba 100644 --- a/cookbook/specs/spec_add_evmos.json +++ b/cookbook/specs/evmos.json @@ -9,6 +9,7 @@ "enabled": true, "imports": [ "COSMOSSDK", + "ETHERMINT", "ETH1" ], "reliability_threshold": 268435455, @@ -892,276 +893,6 @@ "add_on": "" }, "apis": [ - { - "name": "ethermint.evm.v1.Query/Account", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/Balance", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/BaseFee", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/Code", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/CosmosAccount", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/EstimateGas", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/EthCall", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/Params", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/Storage", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/TraceBlock", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/TraceTx", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.evm.v1.Query/ValidatorAccount", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.feemarket.v1.Query/BaseFee", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.feemarket.v1.Query/BlockGas", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, - { - "name": "ethermint.feemarket.v1.Query/Params", - "block_parsing": { - "parser_arg": [ - "latest" - ], - "parser_func": "DEFAULT" - }, - "compute_units": 10, - "enabled": true, - "category": { - "deterministic": true, - "local": false, - "subscription": false, - "stateful": 0 - }, - "extra_compute_units": 0 - }, { "name": "evmos.claims.v1.Query/ClaimsRecord", "block_parsing": { diff --git a/cookbook/specs/spec_add_fantom.json b/cookbook/specs/fantom.json similarity index 100% rename from cookbook/specs/spec_add_fantom.json rename to cookbook/specs/fantom.json diff --git a/cookbook/specs/spec_add_fuse.json b/cookbook/specs/fuse.json similarity index 100% rename from cookbook/specs/spec_add_fuse.json rename to cookbook/specs/fuse.json diff --git a/cookbook/specs/spec_add_fvm.json b/cookbook/specs/fvm.json similarity index 100% rename from cookbook/specs/spec_add_fvm.json rename to cookbook/specs/fvm.json diff --git a/cookbook/specs/spec_add_ibc.json b/cookbook/specs/ibc.json similarity index 100% rename from cookbook/specs/spec_add_ibc.json rename to cookbook/specs/ibc.json diff --git a/cookbook/specs/spec_add_juno.json b/cookbook/specs/juno.json similarity index 100% rename from cookbook/specs/spec_add_juno.json rename to cookbook/specs/juno.json diff --git a/cookbook/specs/spec_add_koii.json b/cookbook/specs/koii.json similarity index 100% rename from cookbook/specs/spec_add_koii.json rename to cookbook/specs/koii.json diff --git a/cookbook/specs/spec_add_lava.json b/cookbook/specs/lava.json similarity index 100% rename from cookbook/specs/spec_add_lava.json rename to cookbook/specs/lava.json diff --git a/cookbook/specs/spec_add_manta_pacific.json b/cookbook/specs/manta_pacific.json similarity index 100% rename from cookbook/specs/spec_add_manta_pacific.json rename to cookbook/specs/manta_pacific.json diff --git a/cookbook/specs/spec_add_mantle.json b/cookbook/specs/mantle.json similarity index 100% rename from cookbook/specs/spec_add_mantle.json rename to cookbook/specs/mantle.json diff --git a/cookbook/specs/spec_add_moralis.json b/cookbook/specs/moralis.json similarity index 100% rename from cookbook/specs/spec_add_moralis.json rename to cookbook/specs/moralis.json diff --git a/cookbook/specs/spec_add_namada.json b/cookbook/specs/namada.json similarity index 73% rename from cookbook/specs/spec_add_namada.json rename to cookbook/specs/namada.json index c3283d1661..391b107b24 100644 --- a/cookbook/specs/spec_add_namada.json +++ b/cookbook/specs/namada.json @@ -9,7 +9,7 @@ "name": "namada se testnet", "enabled": true, "imports": [ - "COSMOSSDK" + "TENDERMINT" ], "reliability_threshold": 268435455, "data_reliability_enabled": false, @@ -66,33 +66,6 @@ } } ] - }, - { - "enabled": false, - "collection_data": { - "api_interface": "rest", - "internal_path": "", - "type": "GET", - "add_on": "" - } - }, - { - "enabled": false, - "collection_data": { - "api_interface": "rest", - "internal_path": "", - "type": "POST", - "add_on": "" - } - }, - { - "enabled": false, - "collection_data": { - "api_interface": "grpc", - "internal_path": "", - "type": "", - "add_on": "" - } } ] } diff --git a/cookbook/specs/spec_add_near.json b/cookbook/specs/near.json similarity index 100% rename from cookbook/specs/spec_add_near.json rename to cookbook/specs/near.json diff --git a/cookbook/specs/spec_add_optimism.json b/cookbook/specs/optimism.json similarity index 100% rename from cookbook/specs/spec_add_optimism.json rename to cookbook/specs/optimism.json diff --git a/cookbook/specs/spec_add_osmosis.json b/cookbook/specs/osmosis.json similarity index 100% rename from cookbook/specs/spec_add_osmosis.json rename to cookbook/specs/osmosis.json diff --git a/cookbook/specs/spec_add_polygon.json b/cookbook/specs/polygon.json similarity index 100% rename from cookbook/specs/spec_add_polygon.json rename to cookbook/specs/polygon.json diff --git a/cookbook/specs/spec_add_scroll.json b/cookbook/specs/scroll.json similarity index 100% rename from cookbook/specs/spec_add_scroll.json rename to cookbook/specs/scroll.json diff --git a/cookbook/specs/spec_add_secret.json b/cookbook/specs/secret.json similarity index 100% rename from cookbook/specs/spec_add_secret.json rename to cookbook/specs/secret.json diff --git a/cookbook/specs/spec_add_side.json b/cookbook/specs/side.json similarity index 100% rename from cookbook/specs/spec_add_side.json rename to cookbook/specs/side.json diff --git a/cookbook/specs/spec_add_solana.json b/cookbook/specs/solana.json similarity index 100% rename from cookbook/specs/spec_add_solana.json rename to cookbook/specs/solana.json diff --git a/cookbook/specs/spec_add_sqdsubgraph.json b/cookbook/specs/sqdsubgraph.json similarity index 100% rename from cookbook/specs/spec_add_sqdsubgraph.json rename to cookbook/specs/sqdsubgraph.json diff --git a/cookbook/specs/spec_add_stargaze.json b/cookbook/specs/stargaze.json similarity index 100% rename from cookbook/specs/spec_add_stargaze.json rename to cookbook/specs/stargaze.json diff --git a/cookbook/specs/spec_add_starknet.json b/cookbook/specs/starknet.json similarity index 100% rename from cookbook/specs/spec_add_starknet.json rename to cookbook/specs/starknet.json diff --git a/cookbook/specs/spec_add_sui.json b/cookbook/specs/sui.json similarity index 100% rename from cookbook/specs/spec_add_sui.json rename to cookbook/specs/sui.json diff --git a/cookbook/specs/tendermint.json b/cookbook/specs/tendermint.json new file mode 100644 index 0000000000..3886cb9828 --- /dev/null +++ b/cookbook/specs/tendermint.json @@ -0,0 +1,697 @@ +{ + "proposal": { + "title": "Add Specs: tendermint", + "description": "Adding default tendermint specification", + "specs": [ + { + "index": "TENDERMINT", + "name": "tendermint", + "enabled": false, + "imports": [], + "reliability_threshold": 268435455, + "data_reliability_enabled": true, + "block_distance_for_finalized_data": 0, + "blocks_in_finalization_proof": 1, + "average_block_time": 6500, + "allowed_block_lag_for_qos_sync": 2, + "shares": 1, + "min_stake_provider": { + "denom": "ulava", + "amount": "47500000000" + }, + "api_collections": [ + { + "enabled": true, + "collection_data": { + "api_interface": "tendermintrpc", + "internal_path": "", + "type": "", + "add_on": "" + }, + "apis": [ + { + "name": "dump_consensus_state", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "abci_info", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "abci_query", + "block_parsing": { + "parser_arg": [ + "height", + "=", + "2" + ], + "parser_func": "PARSE_DICTIONARY_OR_ORDERED", + "default_value": "latest" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "block", + "block_parsing": { + "parser_arg": [ + "height", + "=", + "0" + ], + "parser_func": "PARSE_DICTIONARY_OR_ORDERED", + "default_value": "latest" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "block_by_hash", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "block_results", + "block_parsing": { + "parser_arg": [ + "height", + "=", + "0" + ], + "parser_func": "PARSE_DICTIONARY_OR_ORDERED", + "default_value": "latest" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "block_search", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "blockchain", + "block_parsing": { + "parser_arg": [ + "maxHeight", + "=", + "1" + ], + "parser_func": "PARSE_DICTIONARY_OR_ORDERED", + "default_value": "latest" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "broadcast_evidence", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "broadcast_tx_async", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1 + }, + "extra_compute_units": 0 + }, + { + "name": "broadcast_tx_commit", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1, + "hanging_api": true + }, + "extra_compute_units": 0 + }, + { + "name": "broadcast_tx_sync", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 1, + "hanging_api": true + }, + "extra_compute_units": 0 + }, + { + "name": "check_tx", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "commit", + "block_parsing": { + "parser_arg": [ + "height", + "=", + "0" + ], + "parser_func": "PARSE_DICTIONARY_OR_ORDERED", + "default_value": "latest" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "consensus_params", + "block_parsing": { + "parser_arg": [ + "height", + "=", + "0" + ], + "parser_func": "PARSE_DICTIONARY_OR_ORDERED", + "default_value": "latest" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "consensus_state", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "genesis", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "genesis_chunked", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "health", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "net_info", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "num_unconfirmed_txs", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "status", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "subscribe", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": true, + "subscription": true, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "tx", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "tx_search", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "unconfirmed_txs", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "unsubscribe", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": true, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "unsubscribe_all", + "block_parsing": { + "parser_arg": [ + "" + ], + "parser_func": "EMPTY" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": false, + "local": true, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "validators", + "block_parsing": { + "parser_arg": [ + "height", + "=", + "0" + ], + "parser_func": "PARSE_DICTIONARY_OR_ORDERED", + "default_value": "latest" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + } + ], + "headers": [], + "inheritance_apis": [], + "parse_directives": [ + { + "function_tag": "GET_BLOCKNUM", + "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"status\",\"params\":[],\"id\":1}", + "result_parsing": { + "parser_arg": [ + "0", + "sync_info", + "latest_block_height" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "status" + }, + { + "function_template": "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block\",\"params\":[\"%d\"]}", + "function_tag": "GET_BLOCK_BY_NUM", + "result_parsing": { + "parser_arg": [ + "0", + "block_id", + "hash" + ], + "parser_func": "PARSE_CANONICAL", + "encoding": "hex" + }, + "api_name": "block" + }, + { + "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"status\",\"params\":[],\"id\":1}", + "function_tag": "GET_EARLIEST_BLOCK", + "result_parsing": { + "parser_arg": [ + "0", + "sync_info", + "earliest_block_height" + ], + "parser_func": "PARSE_CANONICAL", + "encoding": "base64" + }, + "api_name": "earliest_block" + } + ], + "verifications": [ + { + "name": "minimum-gas-price", + "parse_directive": { + "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"abci_query\",\"params\":{\"path\":\"/cosmos.base.node.v1beta1.Service/Config\", \"height\":\"0\", \"data\":\"\",\"proof\":\"true\"},\"id\":1}", + "function_tag": "VERIFICATION", + "result_parsing": { + "parser_arg": [ + "0", + "response", + "value" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "abci_query" + } + }, + { + "name": "chain-id", + "parse_directive": { + "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"status\",\"params\":[],\"id\":1}", + "function_tag": "VERIFICATION", + "result_parsing": { + "parser_arg": [ + "0", + "node_info", + "network" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "status" + } + }, + { + "name": "pruning", + "parse_directive": { + "function_tag": "GET_EARLIEST_BLOCK" + } + }, + { + "name": "tx-indexing", + "parse_directive": { + "function_template": "{\"jsonrpc\":\"2.0\",\"method\":\"status\",\"params\":[],\"id\":1}", + "function_tag": "VERIFICATION", + "result_parsing": { + "parser_arg": [ + "0", + "node_info", + "other", + "tx_index" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "status" + }, + "values": [ + { + "expected_value": "on" + } + ] + } + ], + "extensions": [ + { + "name": "archive", + "cu_multiplier": 5 + } + ] + } + ] + } + ] + }, + "deposit": "10000000ulava" +} \ No newline at end of file diff --git a/cookbook/specs/spec_add_union.json b/cookbook/specs/union.json similarity index 100% rename from cookbook/specs/spec_add_union.json rename to cookbook/specs/union.json diff --git a/cookbook/specs/spec_add_zksync.json b/cookbook/specs/zksync.json similarity index 100% rename from cookbook/specs/spec_add_zksync.json rename to cookbook/specs/zksync.json diff --git a/docs/Events.md b/docs/Events.md index ba9af5ec96..861f26f496 100644 --- a/docs/Events.md +++ b/docs/Events.md @@ -60,7 +60,7 @@ Servicer | ERR_unstake_servicer_spec | Tx | sent when the spec specified on uns Servicer | ERR_unstake_servicer_storage | Tx | sent when there is a problem with the storage fdor handling the request | error | the storage that had the problem Servicer | ERR_unstake_servicer_entry | Tx | sent when the entry for unstaking wasn't found meaning servicer wasn't staked | servicer | the address of the servicer | spec | the spec of the servicer Gov | ERR_param_change | Tx | sent when a param change proposal passed but had an error | param | the param to change | value | the new value | error | the error that was triggered -Spec | ERR_spec_add_dup | Tx | sent when a proposal tried to add an existing spec | spec | the name of the spec | status | the status of the spec | chainID | the index of the spec +Spec | ERR_dup | Tx | sent when a proposal tried to add an existing spec | spec | the name of the spec | status | the status of the spec | chainID | the index of the spec Spec | ERR_spec_modify_missing | Tx | sent when a proposal tried to modify a spec but wasn't found | spec | the name of the spec | status | the status of the spec | chainID | the index of the spec User | ERR_user_unstaking_credit | NewBlock | sent upon an error in crediting a user after unstake deadline was reached | error | the error that occured | spec | the spec name | user | unstaking user address | stake | the stake that needs to be credited User | ERR_user_unstaking_deadline | NewBlock | sent upon an invalid callback schedule for next unstaking commit | minDeadline | the next callback block | height | the current block | unstakingCount | the amount of unstaking users | deletedIndexes | the amount of users credited this callback diff --git a/scripts/automation_scripts/ReadMe.md b/scripts/automation_scripts/ReadMe.md index f9c0af5fe1..0effcfd86f 100644 --- a/scripts/automation_scripts/ReadMe.md +++ b/scripts/automation_scripts/ReadMe.md @@ -10,7 +10,7 @@ It uses the grpc descriptors of the endpoint you provide in order to cross valid * Set the following parameters before use, for example: ``` grpc_server = "juno-node-1.lavapro.xyz:9090" -spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/spec_add_juno.json" +spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/juno.json" ``` Launch the script @@ -34,7 +34,7 @@ Used for Scaffolding grpc interface. * Set the following parameters before use, for example: ``` grpc_server = "juno-node-1.lavapro.xyz:9090" -spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/spec_add_juno.json" +spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/juno.json" chain = "Juno" result_dir = "/home/user/go/src/lava/scripts/automation_scripts/automation_results/grpcClientProtobufs" ``` diff --git a/scripts/automation_scripts/disable_and_validate_grpc_spec_api.py b/scripts/automation_scripts/disable_and_validate_grpc_spec_api.py index 3d36733482..8a31107b6a 100755 --- a/scripts/automation_scripts/disable_and_validate_grpc_spec_api.py +++ b/scripts/automation_scripts/disable_and_validate_grpc_spec_api.py @@ -1,10 +1,10 @@ import json input_files = [ - "/home/user/go/src/lava/cookbook/specs/spec_add_cosmoshub.json", - "/home/user/go/src/lava/cookbook/specs/spec_add_juno.json", - "/home/user/go/src/lava/cookbook/specs/spec_add_lava.json", - "/home/user/go/src/lava/cookbook/specs/spec_add_osmosis.json", + "/home/user/go/src/lava/cookbook/specs/cosmoshub.json", + "/home/user/go/src/lava/cookbook/specs/juno.json", + "/home/user/go/src/lava/cookbook/specs/lava.json", + "/home/user/go/src/lava/cookbook/specs/osmosis.json", ] for f in input_files: diff --git a/scripts/automation_scripts/grpc_scaffolder.py b/scripts/automation_scripts/grpc_scaffolder.py index ce9df71329..7cac1522ab 100755 --- a/scripts/automation_scripts/grpc_scaffolder.py +++ b/scripts/automation_scripts/grpc_scaffolder.py @@ -3,22 +3,22 @@ # Lava: # grpc_server = "public-rpc.lavanet.xyz:9090" -# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/spec_add_lava.json" +# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/lava.json" # chain = "Lava" # Osmosis: # grpc_server = "prod-pnet-osmosisnode-1.lavapro.xyz:9090" -# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/spec_add_osmosis.json" +# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/osmosis.json" # chain = "Osmosis" # Cosmos # grpc_server = "gaia-node-1.lavapro.xyz:9090" -# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/spec_add_cosmoshub.json" +# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/cosmoshub.json" # chain = "Cosmos" # JUNO grpc_server = "juno-node-1.lavapro.xyz:9090" -spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/spec_add_juno.json" +spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/juno.json" chain = "Juno" diff --git a/scripts/automation_scripts/grpc_spec_builder.py b/scripts/automation_scripts/grpc_spec_builder.py index d48717fec9..74d072f776 100755 --- a/scripts/automation_scripts/grpc_spec_builder.py +++ b/scripts/automation_scripts/grpc_spec_builder.py @@ -13,35 +13,35 @@ # Lava: # grpc_server = "public-rpc.lavanet.xyz:9090" -# spec_file_name = "spec_add_lava.json" +# spec_file_name = "lava.json" # chainId = "JUN1" # Osmosis: # grpc_server = "grpc.osmosis.zone:9090" -# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/spec_add_osmosis.json" +# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/osmosis.json" # Cosmos # grpc_server = "gaia-node-1.lavapro.xyz:9090" -# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/spec_add_cosmoshub.json" +# spec_current_file_path = "/home/user/go/src/lava/cookbook/specs/cosmoshub.json" # Juno # grpc_server = "juno-node-1.lavapro.xyz:9090" -# spec_file_name = "spec_add_juno.json" +# spec_file_name = "juno.json" # chainId = "JUN1" # Evmos # grpc_server = "evmos-node-1.lavapro.xyz:9090" -# spec_file_name = "spec_add_evmos.json" +# spec_file_name = "evmos.json" # chainId = "EVMOS" # Axelar grpc_server = "grpc-axelar.stakerun.com:9090" -spec_file_name = "spec_add_axelar.json" +spec_file_name = "axelar.json" chainId = "AXELAR" # Canto # grpc_server = "canto-grpc.polkachu.com:15590" -# spec_file_name = "spec_add_canto.json" +# spec_file_name = "canto.json" # chainId = "CANTO" # diff --git a/scripts/automation_scripts/remove_type_from_grpc_spec_api.py b/scripts/automation_scripts/remove_type_from_grpc_spec_api.py index ac732b08ff..f22c8c1afa 100755 --- a/scripts/automation_scripts/remove_type_from_grpc_spec_api.py +++ b/scripts/automation_scripts/remove_type_from_grpc_spec_api.py @@ -1,10 +1,10 @@ import json input_files = [ - "/home/user/go/src/lava/cookbook/specs/spec_add_cosmoshub.json", - "/home/user/go/src/lava/cookbook/specs/spec_add_juno.json", - "/home/user/go/src/lava/cookbook/specs/spec_add_lava.json", - "/home/user/go/src/lava/cookbook/specs/spec_add_osmosis.json", + "/home/user/go/src/lava/cookbook/specs/cosmoshub.json", + "/home/user/go/src/lava/cookbook/specs/juno.json", + "/home/user/go/src/lava/cookbook/specs/lava.json", + "/home/user/go/src/lava/cookbook/specs/osmosis.json", ] for f in input_files: diff --git a/scripts/cli_test.sh b/scripts/cli_test.sh index 9f8aeeae3a..b17c205478 100755 --- a/scripts/cli_test.sh +++ b/scripts/cli_test.sh @@ -58,7 +58,7 @@ trace lavad q downtimequery params >/dev/null trace lavad q downtimequery downtime 10 >/dev/null echo "Proposing specs" -(trace lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json,./cookbook/specs/spec_add_near.json $txoptions) >/dev/null +(trace lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json,./cookbook/specs/near.json $txoptions) >/dev/null wait_count_blocks 2 >/dev/null (lavad tx gov vote $(latest_vote) yes $txoptions) >/dev/null wait_count_blocks 2 >/dev/null diff --git a/scripts/init_chain_commands.sh b/scripts/init_chain_commands.sh index 39a0388281..391e834e86 100755 --- a/scripts/init_chain_commands.sh +++ b/scripts/init_chain_commands.sh @@ -9,8 +9,9 @@ screen -wipe GASPRICE="0.000000001ulava" echo; echo "#### Sending proposal for specs ####" -# ,./cookbook/specs/spec_add_mantle.json -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json,./cookbook/specs/spec_add_near.json,./cookbook/specs/spec_add_sqdsubgraph.json,./cookbook/specs/spec_add_agoric.json,./cookbook/specs/spec_add_koii.json,./cookbook/specs/spec_add_stargaze.json,./cookbook/specs/spec_add_blast.json,./cookbook/specs/spec_add_secret.json,./cookbook/specs/spec_add_celestia.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE +cd ./cookbook/specs/ +lavad tx gov submit-legacy-proposal spec-add ./ibc.json,./tendermint.json,./cosmoswasm.json,./cosmossdk.json,./cosmossdk_45.json,./cosmossdk_full.json,./ethermint.json,./ethereum.json,./cosmoshub.json,./lava.json,./osmosis.json,./fantom.json,./celo.json,./optimism.json,./arbitrum.json,./starknet.json,./aptos.json,./juno.json,./polygon.json,./evmos.json,./base.json,./canto.json,./sui.json,./solana.json,./bsc.json,./axelar.json,./avalanche.json,./fvm.json,./near.json,./sqdsubgraph.json,./agoric.json,./koii.json,./stargaze.json,./blast.json,./secret.json,./celestia.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE +cd ../../ echo; echo "#### Waiting 2 blocks ####" wait_count_blocks 2 diff --git a/scripts/init_e2e.sh b/scripts/init_e2e.sh index 353bb65926..903af2e220 100755 --- a/scripts/init_e2e.sh +++ b/scripts/init_e2e.sh @@ -9,7 +9,7 @@ GASPRICE="0.000000001ulava" # Specs proposal echo ---- Specs proposal ---- -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_lava.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ethereum.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/ibc.json,./cookbook/specs/tendermint.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/lava.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE sleep 6 # need to sleep because plan policies need the specs when setting chain policies verifications diff --git a/scripts/init_payment_e2e.sh b/scripts/init_payment_e2e.sh index 15c16574b8..ac87e4baa1 100755 --- a/scripts/init_payment_e2e.sh +++ b/scripts/init_payment_e2e.sh @@ -8,7 +8,7 @@ source $__dir/useful_commands.sh GASPRICE="0.000000001ulava" # Specs proposal -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_lava.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/cosmoswasm.json,./cookbook/specs/ibc.json,./cookbook/specs/tendermint.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/lava.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE wait_next_block lavad tx gov deposit 1 100ulava -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE wait_next_block diff --git a/scripts/jail_provider_test.sh b/scripts/jail_provider_test.sh index b43e34634f..6e3bdea1c3 100755 --- a/scripts/jail_provider_test.sh +++ b/scripts/jail_provider_test.sh @@ -11,8 +11,8 @@ killall screen screen -wipe GASPRICE="0.000000001ulava" -# ,./cookbook/specs/spec_add_mantle.json -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_lava.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +# ,./cookbook/specs/mantle.json +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/lava.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_count_blocks 2 echo "submitted first proposal" echo "latest vote2: $(latest_vote)" diff --git a/scripts/pre_setups/init_aptos_only_test.sh b/scripts/pre_setups/init_aptos_only_test.sh index 2d71bb47ae..646571d93e 100755 --- a/scripts/pre_setups/init_aptos_only_test.sh +++ b/scripts/pre_setups/init_aptos_only_test.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE wait_next_block diff --git a/scripts/pre_setups/init_arbitrum_only_test.sh b/scripts/pre_setups/init_arbitrum_only_test.sh index 83dcb02a21..0e44110161 100755 --- a/scripts/pre_setups/init_arbitrum_only_test.sh +++ b/scripts/pre_setups/init_arbitrum_only_test.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE wait_next_block diff --git a/scripts/pre_setups/init_avalanch_only.sh b/scripts/pre_setups/init_avalanch_only.sh index 05bd5864d9..b73b4b7249 100755 --- a/scripts/pre_setups/init_avalanch_only.sh +++ b/scripts/pre_setups/init_avalanch_only.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE lavad tx gov submit-legacy-proposal plans-add ./cookbook/plans/test_plans/default.json -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_axelar_only_with_node.sh b/scripts/pre_setups/init_axelar_only_with_node.sh index 95102fd56d..da05fb8df9 100755 --- a/scripts/pre_setups/init_axelar_only_with_node.sh +++ b/scripts/pre_setups/init_axelar_only_with_node.sh @@ -21,7 +21,7 @@ sleep 5 wait_for_lava_node_to_start GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_canto_only_test.sh b/scripts/pre_setups/init_canto_only_test.sh index 19c90d90fd..5017d3e533 100755 --- a/scripts/pre_setups/init_canto_only_test.sh +++ b/scripts/pre_setups/init_canto_only_test.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE sleep 4 diff --git a/scripts/pre_setups/init_eth_archive_mix.sh b/scripts/pre_setups/init_eth_archive_mix.sh index 5079168fc7..8588d6c3cc 100755 --- a/scripts/pre_setups/init_eth_archive_mix.sh +++ b/scripts/pre_setups/init_eth_archive_mix.sh @@ -12,7 +12,7 @@ screen -wipe GASPRICE="0.000000001ulava" if [ $# -eq 0 ]; then - lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & + lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_evmos_only_test.sh b/scripts/pre_setups/init_evmos_only_test.sh index 59253c044f..31d1f9993b 100755 --- a/scripts/pre_setups/init_evmos_only_test.sh +++ b/scripts/pre_setups/init_evmos_only_test.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE sleep 4 diff --git a/scripts/pre_setups/init_evmos_only_with_node.sh b/scripts/pre_setups/init_evmos_only_with_node.sh index de6301393f..30aa980f0c 100755 --- a/scripts/pre_setups/init_evmos_only_with_node.sh +++ b/scripts/pre_setups/init_evmos_only_with_node.sh @@ -21,7 +21,7 @@ sleep 3 wait_for_lava_node_to_start GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_fvm_only_test.sh b/scripts/pre_setups/init_fvm_only_test.sh index 6d2dcb8d68..efc0ab114d 100755 --- a/scripts/pre_setups/init_fvm_only_test.sh +++ b/scripts/pre_setups/init_fvm_only_test.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE sleep 4 diff --git a/scripts/pre_setups/init_lava_only_test.sh b/scripts/pre_setups/init_lava_only_test.sh index 118f0d2f9b..cd4a081ad2 100755 --- a/scripts/pre_setups/init_lava_only_test.sh +++ b/scripts/pre_setups/init_lava_only_test.sh @@ -20,7 +20,7 @@ echo "[Lavavisor Setup] sleeping 20 seconds for node to finish setup (if its not sleep 20 GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_lava_only_test_5.sh b/scripts/pre_setups/init_lava_only_test_5.sh index 79c3374989..b4a91a42b7 100755 --- a/scripts/pre_setups/init_lava_only_test_5.sh +++ b/scripts/pre_setups/init_lava_only_test_5.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_lava_only_test_with_badge.sh b/scripts/pre_setups/init_lava_only_test_with_badge.sh index 506bc4557d..2430b61f7f 100755 --- a/scripts/pre_setups/init_lava_only_test_with_badge.sh +++ b/scripts/pre_setups/init_lava_only_test_with_badge.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_lava_only_with_node.sh b/scripts/pre_setups/init_lava_only_with_node.sh index 227a6298a0..8450d39cdc 100755 --- a/scripts/pre_setups/init_lava_only_with_node.sh +++ b/scripts/pre_setups/init_lava_only_with_node.sh @@ -21,7 +21,7 @@ sleep 5 wait_for_lava_node_to_start GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_lava_only_with_node_three_providers.sh b/scripts/pre_setups/init_lava_only_with_node_three_providers.sh index 8f43ada981..cfb49250f3 100755 --- a/scripts/pre_setups/init_lava_only_with_node_three_providers.sh +++ b/scripts/pre_setups/init_lava_only_with_node_three_providers.sh @@ -21,7 +21,7 @@ sleep 5 wait_for_lava_node_to_start GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_lava_only_with_node_with_cache.sh b/scripts/pre_setups/init_lava_only_with_node_with_cache.sh index 4e6de63d33..41e22d0ed1 100755 --- a/scripts/pre_setups/init_lava_only_with_node_with_cache.sh +++ b/scripts/pre_setups/init_lava_only_with_node_with_cache.sh @@ -21,7 +21,7 @@ sleep 5 wait_for_lava_node_to_start GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_lava_only_with_node_with_relayserver.sh b/scripts/pre_setups/init_lava_only_with_node_with_relayserver.sh index d87ba38bca..f0d4d52cfc 100755 --- a/scripts/pre_setups/init_lava_only_with_node_with_relayserver.sh +++ b/scripts/pre_setups/init_lava_only_with_node_with_relayserver.sh @@ -20,7 +20,7 @@ echo "[Test Setup] sleeping 20 seconds for node to finish setup (if its not enou sleep 20 GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_moralis_only.sh b/scripts/pre_setups/init_moralis_only.sh index a5601c9774..41d3b4675a 100755 --- a/scripts/pre_setups/init_moralis_only.sh +++ b/scripts/pre_setups/init_moralis_only.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_moralis.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/moralis.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_near_only_with_node.sh b/scripts/pre_setups/init_near_only_with_node.sh index c5e9f79747..a17d1f18a4 100755 --- a/scripts/pre_setups/init_near_only_with_node.sh +++ b/scripts/pre_setups/init_near_only_with_node.sh @@ -21,7 +21,7 @@ sleep 5 wait_for_lava_node_to_start GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_near.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/near.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_osmosis_only.sh b/scripts/pre_setups/init_osmosis_only.sh index 202d0ebaee..8b84c8ca5d 100755 --- a/scripts/pre_setups/init_osmosis_only.sh +++ b/scripts/pre_setups/init_osmosis_only.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE lavad tx gov submit-legacy-proposal plans-add ./cookbook/plans/test_plans/default.json -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_solana_only.sh b/scripts/pre_setups/init_solana_only.sh index 1a6846442c..af167fa52f 100755 --- a/scripts/pre_setups/init_solana_only.sh +++ b/scripts/pre_setups/init_solana_only.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE lavad tx gov submit-legacy-proposal plans-add ./cookbook/plans/test_plans/default.json -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_sqdsubgraph_only.sh b/scripts/pre_setups/init_sqdsubgraph_only.sh index 7d6c9de7cb..c608ca4190 100755 --- a/scripts/pre_setups/init_sqdsubgraph_only.sh +++ b/scripts/pre_setups/init_sqdsubgraph_only.sh @@ -10,7 +10,7 @@ rm $LOGS_DIR/*.log killall screen screen -wipe GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_sqdsubgraph.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/sqdsubgraph.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/init_starknet_addons_only_with_node.sh b/scripts/pre_setups/init_starknet_addons_only_with_node.sh index a2b44bf3bc..a87daeccbc 100755 --- a/scripts/pre_setups/init_starknet_addons_only_with_node.sh +++ b/scripts/pre_setups/init_starknet_addons_only_with_node.sh @@ -21,7 +21,7 @@ sleep 3 wait_for_lava_node_to_start GASPRICE="0.000000001ulava" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/pre_setups/setup_lavavisor_dev_test.sh b/scripts/pre_setups/setup_lavavisor_dev_test.sh index 014bca5050..0b86c6abe3 100755 --- a/scripts/pre_setups/setup_lavavisor_dev_test.sh +++ b/scripts/pre_setups/setup_lavavisor_dev_test.sh @@ -31,7 +31,7 @@ lavavisor create-service provider ./config/provider_examples/lava_example.yml -- echo "[Lavavisor Setup] finished creating service files for lavavisor" echo "[Lavavisor Setup] submitting spec proposal" -lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_45.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices 0.000000001ulava & +lavad tx gov submit-legacy-proposal spec-add ./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_45.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices 0.000000001ulava & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices 0.000000001ulava; diff --git a/scripts/test_spec_full.sh b/scripts/test_spec_full.sh index b06291769b..a90c76608e 100755 --- a/scripts/test_spec_full.sh +++ b/scripts/test_spec_full.sh @@ -2,7 +2,7 @@ # call this bash with this format: # test_spec_full [SPEC_file_path] {[api_interface] [service-url] ...} [--install] # example: -# test_spec_full cookbook/specs/spec_add_lava.json rest 127.0.0.1:1317 tendermintrpc 127.0.0.1:26657 +# test_spec_full cookbook/specs/lava.json rest 127.0.0.1:1317 tendermintrpc 127.0.0.1:26657 __dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $__dir/useful_commands.sh @@ -68,7 +68,7 @@ if [ "$dry" = false ]; then GASPRICE="0.000000001ulava" # add all existing specs so inheritance works - lavad tx gov submit-legacy-proposal spec-add ${__dir}/../cookbook/specs/spec_add_ibc.json,${__dir}/../cookbook/specs/spec_add_cosmoswasm.json,${__dir}/../cookbook/specs/spec_add_cosmossdk.json,${__dir}/../cookbook/specs/spec_add_cosmossdk_45.json,${__dir}/../cookbook/specs/spec_add_cosmossdk_full.json,${__dir}/../cookbook/specs/spec_add_ethereum.json,${__dir}/../cookbook/specs/spec_add_cosmoshub.json,${__dir}/../cookbook/specs/spec_add_lava.json,${__dir}/../cookbook/specs/spec_add_osmosis.json,${__dir}/../cookbook/specs/spec_add_fantom.json,${__dir}/../cookbook/specs/spec_add_celo.json,${__dir}/../cookbook/specs/spec_add_optimism.json,${__dir}/../cookbook/specs/spec_add_arbitrum.json,${__dir}/../cookbook/specs/spec_add_starknet.json,${__dir}/../cookbook/specs/spec_add_aptos.json,${__dir}/../cookbook/specs/spec_add_juno.json,${__dir}/../cookbook/specs/spec_add_polygon.json,${__dir}/../cookbook/specs/spec_add_evmos.json,${__dir}/../cookbook/specs/spec_add_base.json,${__dir}/../cookbook/specs/spec_add_canto.json,${__dir}/../cookbook/specs/spec_add_sui.json,${__dir}/../cookbook/specs/spec_add_solana.json,${__dir}/../cookbook/specs/spec_add_bsc.json,${__dir}/../cookbook/specs/spec_add_axelar.json,${__dir}/../cookbook/specs/spec_add_avalanche.json,${__dir}/../cookbook/specs/spec_add_fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & + lavad tx gov submit-legacy-proposal spec-add ${__dir}/../cookbook/specs/ibc.json,${__dir}/../cookbook/specs/cosmoswasm.json,${__dir}/../cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,${__dir}/../cookbook/specs/cosmossdk_45.json,${__dir}/../cookbook/specs/cosmossdk_full.json,${__dir}/../cookbook/specs/ethereum.json,${__dir}/../cookbook/specs/cosmoshub.json,${__dir}/../cookbook/specs/lava.json,${__dir}/../cookbook/specs/osmosis.json,${__dir}/../cookbook/specs/fantom.json,${__dir}/../cookbook/specs/celo.json,${__dir}/../cookbook/specs/optimism.json,${__dir}/../cookbook/specs/arbitrum.json,${__dir}/../cookbook/specs/starknet.json,${__dir}/../cookbook/specs/aptos.json,${__dir}/../cookbook/specs/juno.json,${__dir}/../cookbook/specs/polygon.json,${__dir}/../cookbook/specs/evmos.json,${__dir}/../cookbook/specs/base.json,${__dir}/../cookbook/specs/canto.json,${__dir}/../cookbook/specs/sui.json,${__dir}/../cookbook/specs/solana.json,${__dir}/../cookbook/specs/bsc.json,${__dir}/../cookbook/specs/axelar.json,${__dir}/../cookbook/specs/avalanche.json,${__dir}/../cookbook/specs/fvm.json --lava-dev-test -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE & wait_next_block wait_next_block lavad tx gov vote 1 yes -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE diff --git a/scripts/updateSpecsCu.py b/scripts/updateSpecsCu.py index 347a6216f9..9c707e46ed 100755 --- a/scripts/updateSpecsCu.py +++ b/scripts/updateSpecsCu.py @@ -30,9 +30,9 @@ def get_spec_ids(line): spec_ids = [spec_id.strip().split()[0] for spec_id in line.split(",")] return spec_ids -# Use this func only if spec_add_ethereum.json is present in your folder +# Use this func only if ethereum.json is present in your folder def find_non_eth_apis(apis): - with open("spec_add_ethereum.json", "r") as f_json: + with open("ethereum.json", "r") as f_json: json_data = json.load(f_json) for eth_api in json_data["proposal"]["specs"][0]["apis"]: if eth_api["name"] in apis: @@ -44,10 +44,10 @@ def find_non_eth_apis(apis): # get a folder path from the CLI. Save all the files that start with "spec_add" in a list folder_path = sys.argv[1] -spec_add_files = [] +files = [] for filename in os.listdir(folder_path): if filename.startswith("spec_add"): - spec_add_files.append(filename) + files.append(filename) csv_data = [] @@ -71,7 +71,7 @@ def find_non_eth_apis(apis): print("### updateSpecsCu.py started! ###") print("#################################\n") -for spec_file in spec_add_files: +for spec_file in files: csv_apis_of_spec_without_apis = [] api_changed_counter = 0 diff --git a/testutil/e2e/paymentE2E.go b/testutil/e2e/paymentE2E.go index 5fe22baf99..8a8ad2c10a 100644 --- a/testutil/e2e/paymentE2E.go +++ b/testutil/e2e/paymentE2E.go @@ -321,7 +321,7 @@ func runPaymentE2E(timeout time.Duration) { // - produce 1 staked client (for LAV1) // - produce 1 subscription (for LAV1) - lt.checkStakeLava(1, 5, 1, 2, checkedPlansE2E, []string{"LAV1"}, []string{"user1"}, "Staking Lava OK") + lt.checkStakeLava(1, 6, 1, 2, checkedPlansE2E, []string{"LAV1"}, []string{"user1"}, "Staking Lava OK") // get balance of providers right after stake for payment check later providers, err := lt.getProvidersAddresses() diff --git a/testutil/e2e/protocolE2E.go b/testutil/e2e/protocolE2E.go index d4cb80b0b9..1d4b551c4b 100644 --- a/testutil/e2e/protocolE2E.go +++ b/testutil/e2e/protocolE2E.go @@ -641,10 +641,10 @@ func (lt *lavaTest) lavaOverLava(ctx context.Context) { lt.execCommand(ctx, "startJSONRPCConsumer", "07_lavaOverLava", command, true) // scripts/init_e2e.sh will: - // - produce 5 specs: ETH1, HOL1, SEP1, IBC, COSMOSSDK, LAV1 (via spec_add_{ethereum,cosmoshub,lava}) + // - produce 5 specs: ETH1, HOL1, SEP1, IBC,TENDERMINT , COSMOSSDK, LAV1 (via {ethereum,cosmoshub,lava}) // - produce 2 plans: "DefaultPlan", "EmergencyModePlan" - lt.checkStakeLava(2, 8, 4, 5, checkedPlansE2E, checkedSpecsE2ELOL, checkedSubscriptionsLOL, "Lava Over Lava Test OK") + lt.checkStakeLava(2, 9, 4, 5, checkedPlansE2E, checkedSpecsE2ELOL, checkedSubscriptionsLOL, "Lava Over Lava Test OK") } func (lt *lavaTest) checkRESTConsumer(rpcURL string, timeout time.Duration) { @@ -1218,13 +1218,13 @@ func runProtocolE2E(timeout time.Duration) { lt.stakeLava(ctx) // scripts/init_e2e.sh will: - // - produce 4 specs: ETH1, HOL1, SEP1, IBC, COSMOSSDK, LAV1 (via spec_add_{ethereum,cosmoshub,lava}) + // - produce 4 specs: ETH1, HOL1, SEP1, IBC, TENDERMINT ,COSMOSSDK, LAV1 (via {ethereum,cosmoshub,lava}) // - produce 2 plans: "DefaultPlan", "EmergencyModePlan" // - produce 5 staked providers (for each of ETH1, LAV1) // - produce 1 staked client (for each of ETH1, LAV1) // - produce 1 subscription (for both ETH1, LAV1) - lt.checkStakeLava(2, 8, 4, 5, checkedPlansE2E, checkedSpecsE2E, checkedSubscriptions, "Staking Lava OK") + lt.checkStakeLava(2, 9, 4, 5, checkedPlansE2E, checkedSpecsE2E, checkedSubscriptions, "Staking Lava OK") utils.LavaFormatInfo("RUNNING TESTS") diff --git a/testutil/e2e/sdkE2E.go b/testutil/e2e/sdkE2E.go index e894750bf0..e3921cc4d2 100644 --- a/testutil/e2e/sdkE2E.go +++ b/testutil/e2e/sdkE2E.go @@ -124,7 +124,7 @@ func runSDKE2E(timeout time.Duration) { utils.LavaFormatInfo("Staking Lava") lt.stakeLava(ctx) - lt.checkStakeLava(2, 8, 4, 5, checkedPlansE2E, checkedSpecsE2E, checkedSubscriptions, "Staking Lava OK") + lt.checkStakeLava(2, 9, 4, 5, checkedPlansE2E, checkedSpecsE2E, checkedSubscriptions, "Staking Lava OK") utils.LavaFormatInfo("RUNNING TESTS") diff --git a/testutil/keeper/spec.go b/testutil/keeper/spec.go index d6c828cc59..6a0acc7e67 100644 --- a/testutil/keeper/spec.go +++ b/testutil/keeper/spec.go @@ -77,7 +77,7 @@ func GetASpec(specIndex, getToTopMostPath string, ctxArg *sdk.Context, keeper *k } else { ctx = *ctxArg } - proposalFile := "./cookbook/specs/spec_add_ibc.json,./cookbook/specs/spec_add_cosmoswasm.json,./cookbook/specs/spec_add_cosmossdk.json,./cookbook/specs/spec_add_cosmossdk_full.json,./cookbook/specs/spec_add_ethereum.json,./cookbook/specs/spec_add_cosmoshub.json,./cookbook/specs/spec_add_lava.json,./cookbook/specs/spec_add_osmosis.json,./cookbook/specs/spec_add_fantom.json,./cookbook/specs/spec_add_celo.json,./cookbook/specs/spec_add_optimism.json,./cookbook/specs/spec_add_arbitrum.json,./cookbook/specs/spec_add_starknet.json,./cookbook/specs/spec_add_aptos.json,./cookbook/specs/spec_add_juno.json,./cookbook/specs/spec_add_polygon.json,./cookbook/specs/spec_add_evmos.json,./cookbook/specs/spec_add_base.json,./cookbook/specs/spec_add_canto.json,./cookbook/specs/spec_add_sui.json,./cookbook/specs/spec_add_solana.json,./cookbook/specs/spec_add_bsc.json,./cookbook/specs/spec_add_axelar.json,./cookbook/specs/spec_add_avalanche.json,./cookbook/specs/spec_add_fvm.json" + proposalFile := "./cookbook/specs/ibc.json,./cookbook/specs/cosmoswasm.json,./cookbook/specs/tendermint.json,./cookbook/specs/cosmossdk.json,./cookbook/specs/cosmossdk_full.json,./cookbook/specs/ethereum.json,./cookbook/specs/cosmoshub.json,./cookbook/specs/lava.json,./cookbook/specs/osmosis.json,./cookbook/specs/fantom.json,./cookbook/specs/celo.json,./cookbook/specs/optimism.json,./cookbook/specs/arbitrum.json,./cookbook/specs/starknet.json,./cookbook/specs/aptos.json,./cookbook/specs/juno.json,./cookbook/specs/polygon.json,./cookbook/specs/evmos.json,./cookbook/specs/base.json,./cookbook/specs/canto.json,./cookbook/specs/sui.json,./cookbook/specs/solana.json,./cookbook/specs/bsc.json,./cookbook/specs/axelar.json,./cookbook/specs/avalanche.json,./cookbook/specs/fvm.json" for _, fileName := range strings.Split(proposalFile, ",") { proposal := utils.SpecAddProposalJSON{} diff --git a/x/spec/keeper/spec_test.go b/x/spec/keeper/spec_test.go index bea37bf393..fb98cd866c 100644 --- a/x/spec/keeper/spec_test.go +++ b/x/spec/keeper/spec_test.go @@ -811,7 +811,7 @@ func TestCookbookSpecs(t *testing.T) { getToTopMostPath := "../../.././cookbook/specs/" // base specs needs to be proposed first - baseSpecs := []string{"spec_add_ibc.json", "spec_add_cosmoswasm.json", "spec_add_cosmossdk.json", "spec_add_cosmossdk_45.json", "spec_add_cosmossdk_full.json", "spec_add_ethereum.json", "spec_add_solana.json"} + baseSpecs := []string{"ibc.json", "tendermint.json", "ethermint.json", "cosmoswasm.json", "cosmossdk.json", "cosmossdk_45.json", "cosmossdk_full.json", "ethereum.json", "solana.json"} Specs, err := getAllFilesInDirectory(getToTopMostPath) require.NoError(t, err) @@ -850,7 +850,7 @@ func TestCookbookSpecs(t *testing.T) { require.Greater(t, len(verifications), 0, fullspec.Index) } _, err = fullspec.ValidateSpec(10000000) - require.NoError(t, err) + require.NoError(t, err, sp.Name) } } } From 897e768cf09761ad6b5c348490b565a925edabcb Mon Sep 17 00:00:00 2001 From: Amit Zafran Date: Mon, 3 Jun 2024 14:20:36 +0300 Subject: [PATCH 13/16] continue-on-error: true (#1468) Co-authored-by: Amit Zafran --- .github/workflows/lava.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lava.yml b/.github/workflows/lava.yml index df8d75ff69..2300704a09 100644 --- a/.github/workflows/lava.yml +++ b/.github/workflows/lava.yml @@ -382,7 +382,7 @@ jobs: build_docker: permissions: - contents: read + contents: write packages: write needs: [test-consensus, test-protocol] runs-on: ubuntu-latest @@ -412,6 +412,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push uses: docker/build-push-action@v5 + continue-on-error: true with: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 11c2b008d708ab7e639a9987f510546a37d9d7be Mon Sep 17 00:00:00 2001 From: oren-lava <111131399+oren-lava@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:09:28 +0300 Subject: [PATCH 14/16] fix: CNS-973: added pruning verification to EVMOS (#1456) * CNS-973: added pruning verification to EVMOS * CNS-973: small fix --- cookbook/specs/evmos.json | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cookbook/specs/evmos.json b/cookbook/specs/evmos.json index 938be9bcba..0ea24db338 100644 --- a/cookbook/specs/evmos.json +++ b/cookbook/specs/evmos.json @@ -870,6 +870,10 @@ "values": [ { "latest_distance": 10000 + }, + { + "extension": "archive", + "latest_distance": 1000000 } ] } @@ -1460,6 +1464,10 @@ "values": [ { "latest_distance": 10000 + }, + { + "extension": "archive", + "latest_distance": 1000000 } ] } @@ -1550,13 +1558,16 @@ }, { "name": "pruning", + "parse_directive": { + "function_tag": "GET_BLOCK_BY_NUM" + }, "values": [ { - "expected_value": "" + "latest_distance": 10000 }, { "extension": "archive", - "expected_value": "" + "latest_distance": 1000000 } ] } From 740e64786cf5f04824259be4664bcbe7f05bf14a Mon Sep 17 00:00:00 2001 From: BabyScope <163932585+BabyScope@users.noreply.github.com> Date: Mon, 3 Jun 2024 14:16:04 +0200 Subject: [PATCH 15/16] fix: near archive testnet (#1461) * fix: archive param change near testnet * fix: change name * fix: inheritance from main deleted --------- Co-authored-by: Omer <100387053+omerlavanet@users.noreply.github.com> Co-authored-by: Yaroms <103432884+Yaroms@users.noreply.github.com> --- cookbook/specs/near.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cookbook/specs/near.json b/cookbook/specs/near.json index 6c7d50a57a..17fa2acb6a 100644 --- a/cookbook/specs/near.json +++ b/cookbook/specs/near.json @@ -489,6 +489,15 @@ "expected_value": "testnet" } ] + }, + { + "name": "pruning", + "values": [ + { + "extension": "archive", + "expected_value": "42376888" + } + ] } ] } From 64df2bfc7190d56d92988a32312f6bea4ed80763 Mon Sep 17 00:00:00 2001 From: Ran Mishael <106548467+ranlavanet@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:54:38 +0200 Subject: [PATCH 16/16] feat: PRT - adding useful headers (#1453) * adding headers to help debug problems more efficiently * adding hash for provider url * adding consumer code to debug relays and print the provider node hash * fix test * fix lint * using generic addresses. --- .../policy_all_chains_with_extension.yml | 20 +++++++ protocol/chainlib/chainproxy/connector.go | 32 ++++++++--- .../chainlib/chainproxy/connector_test.go | 54 +++++++++++++++---- protocol/chainlib/common.go | 12 +++-- protocol/chainlib/grpc.go | 11 ++-- protocol/chainlib/jsonRPC.go | 8 ++- protocol/chainlib/rest.go | 8 +-- protocol/chainlib/tendermintRPC.go | 10 +++- protocol/rpcconsumer/rpcconsumer_server.go | 2 + protocol/rpcprovider/rpcprovider_server.go | 5 ++ 10 files changed, 128 insertions(+), 34 deletions(-) diff --git a/cookbook/projects/policy_all_chains_with_extension.yml b/cookbook/projects/policy_all_chains_with_extension.yml index 874ff63ee3..2a45dde89b 100644 --- a/cookbook/projects/policy_all_chains_with_extension.yml +++ b/cookbook/projects/policy_all_chains_with_extension.yml @@ -56,4 +56,24 @@ Policy: extensions: - "archive" mixed: true + - chain_id: COSMOSHUB + requirements: + - collection: + api_interface: "rest" + type: "GET" + extensions: + - "archive" + mixed: true + - collection: + api_interface: "grpc" + type: "" + extensions: + - "archive" + mixed: true + - collection: + api_interface: "tendermintrpc" + type: "" + extensions: + - "archive" + mixed: true - chain_id: "*" # allows all other chains without specifying \ No newline at end of file diff --git a/protocol/chainlib/chainproxy/connector.go b/protocol/chainlib/chainproxy/connector.go index d5aeba9690..d8be6de67a 100644 --- a/protocol/chainlib/chainproxy/connector.go +++ b/protocol/chainlib/chainproxy/connector.go @@ -9,6 +9,7 @@ import ( "context" "crypto/tls" "crypto/x509" + "encoding/hex" "errors" "log" "os" @@ -20,6 +21,7 @@ import ( "github.com/lavanet/lava/protocol/chainlib/chainproxy/rpcclient" "github.com/lavanet/lava/protocol/common" "github.com/lavanet/lava/utils" + "github.com/lavanet/lava/utils/sigs" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" @@ -36,17 +38,30 @@ const ( var NumberOfParallelConnections uint = 10 type Connector struct { - lock sync.RWMutex - freeClients []*rpcclient.Client - usedClients int64 - nodeUrl common.NodeUrl + lock sync.RWMutex + freeClients []*rpcclient.Client + usedClients int64 + nodeUrl common.NodeUrl + hashedNodeUrl string +} + +func HashURL(url string) string { + // Convert the URL string to bytes + urlBytes := []byte(url) + + // Hash the URL using the HashMsg function + hashedBytes := sigs.HashMsg(urlBytes) + + // Encode the hashed bytes to a hex string for easier sharing + return hex.EncodeToString(hashedBytes) } func NewConnector(ctx context.Context, nConns uint, nodeUrl common.NodeUrl) (*Connector, error) { NumberOfParallelConnections = nConns // set number of parallel connections requested by user (or default.) connector := &Connector{ - freeClients: make([]*rpcclient.Client, 0, nConns), - nodeUrl: nodeUrl, + freeClients: make([]*rpcclient.Client, 0, nConns), + nodeUrl: nodeUrl, + hashedNodeUrl: HashURL(nodeUrl.Url), } rpcClient, err := connector.createConnection(ctx, nodeUrl, connector.numberOfFreeClients()) @@ -179,6 +194,11 @@ func (connector *Connector) increaseNumberOfClients(ctx context.Context, numberO utils.LavaFormatDebug("Failed increasing number of clients") } +// getting hashed url from connection. this is never changed. so its not locked. +func (connector *Connector) GetUrlHash() string { + return connector.hashedNodeUrl +} + func (connector *Connector) GetRpc(ctx context.Context, block bool) (*rpcclient.Client, error) { connector.lock.Lock() defer connector.lock.Unlock() diff --git a/protocol/chainlib/chainproxy/connector_test.go b/protocol/chainlib/chainproxy/connector_test.go index f6e5494654..36d60c36eb 100644 --- a/protocol/chainlib/chainproxy/connector_test.go +++ b/protocol/chainlib/chainproxy/connector_test.go @@ -2,28 +2,32 @@ package chainproxy import ( "context" + "fmt" "log" "net" "net/http" "net/rpc" + "os" "testing" "time" "github.com/lavanet/lava/protocol/chainlib/chainproxy/rpcclient" "github.com/lavanet/lava/protocol/common" + "github.com/lavanet/lava/utils" pb_pkg "github.com/lavanet/lava/x/spec/types" "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) -const ( - listenerAddress = "localhost:1234" - port = "1234" - listenerAddressTcp = "http://localhost:1234" - numberOfClients = 5 +var ( + listenerAddress = "localhost:0" + listenerAddressGrpc = "localhost:0" + listenerAddressTcp = "" ) +const numberOfClients = 5 + type Args struct{} type TimeServer int64 @@ -35,7 +39,8 @@ func (t *TimeServer) GiveServerTime(args *Args, reply *int64) error { } func createGRPCServer(t *testing.T) *grpc.Server { - lis, err := net.Listen("tcp", listenerAddress) + lis, err := net.Listen("tcp", listenerAddressGrpc) + listenerAddressGrpc = lis.Addr().String() require.NoError(t, err) s := grpc.NewServer() go s.Serve(lis) // serve in a different thread @@ -55,7 +60,8 @@ func (is *implementedLavanetLavaSpec) ShowChainInfo(ctx context.Context, req *pb } func createGRPCServerWithRegisteredProto(t *testing.T) *grpc.Server { - lis, err := net.Listen("tcp", listenerAddress) + lis, err := net.Listen("tcp", listenerAddressGrpc) + listenerAddressGrpc = lis.Addr().String() require.NoError(t, err) s := grpc.NewServer() lavanetlavaspec := &implementedLavanetLavaSpec{} @@ -76,6 +82,8 @@ func createRPCServer() net.Listener { if err != nil { log.Fatal("Listener error: ", err) } + listenerAddress = listener.Addr().String() + listenerAddressTcp = "http://" + listenerAddress // Serve accepts incoming HTTP connections on the listener l, creating // a new service goroutine for each. The service goroutines read requests // and then call handler to reply to them @@ -85,8 +93,6 @@ func createRPCServer() net.Listener { } func TestConnector(t *testing.T) { - listener := createRPCServer() // create a grpcServer so we can connect to its endpoint and validate everything works. - defer listener.Close() ctx := context.Background() conn, err := NewConnector(ctx, numberOfClients, common.NodeUrl{Url: listenerAddressTcp}) require.NoError(t, err) @@ -115,7 +121,7 @@ func TestConnectorGrpc(t *testing.T) { server := createGRPCServer(t) // create a grpcServer so we can connect to its endpoint and validate everything works. defer server.Stop() ctx := context.Background() - conn, err := NewGRPCConnector(ctx, numberOfClients, common.NodeUrl{Url: listenerAddress}) + conn, err := NewGRPCConnector(ctx, numberOfClients, common.NodeUrl{Url: listenerAddressGrpc}) require.NoError(t, err) for { // wait for the routine to finish connecting if len(conn.freeClients) == numberOfClients { @@ -142,7 +148,7 @@ func TestConnectorGrpcAndInvoke(t *testing.T) { server := createGRPCServerWithRegisteredProto(t) // create a grpcServer so we can connect to its endpoint and validate everything works. defer server.Stop() ctx := context.Background() - conn, err := NewGRPCConnector(ctx, numberOfClients, common.NodeUrl{Url: listenerAddress}) + conn, err := NewGRPCConnector(ctx, numberOfClients, common.NodeUrl{Url: listenerAddressGrpc}) require.NoError(t, err) for { // wait for the routine to finish connecting if len(conn.freeClients) == numberOfClients { @@ -167,3 +173,29 @@ func TestConnectorGrpcAndInvoke(t *testing.T) { } require.Equal(t, int(conn.usedClients), 0) // checking we dont have clients used } + +func TestHashing(t *testing.T) { + ctx := context.Background() + conn, _ := NewConnector(ctx, numberOfClients, common.NodeUrl{Url: listenerAddressTcp}) + fmt.Println(conn.hashedNodeUrl) + require.Equal(t, conn.hashedNodeUrl, HashURL(listenerAddressTcp)) +} + +func TestMain(m *testing.M) { + listener := createRPCServer() + for { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + _, err := rpcclient.DialContext(ctx, listenerAddressTcp) + if err != nil { + utils.LavaFormatDebug("waiting for grpc server to launch") + continue + } + cancel() + break + } + + // Start running tests. + code := m.Run() + listener.Close() + os.Exit(code) +} diff --git a/protocol/chainlib/common.go b/protocol/chainlib/common.go index 8adb1089a7..2728ec9319 100644 --- a/protocol/chainlib/common.go +++ b/protocol/chainlib/common.go @@ -23,11 +23,12 @@ import ( ) const ( - ContextUserValueKeyDappID = "dappID" - RetryListeningInterval = 10 // seconds - debug = false - refererMatchString = "refererMatch" - relayMsgLogMaxChars = 200 + ContextUserValueKeyDappID = "dappID" + RetryListeningInterval = 10 // seconds + debug = false + refererMatchString = "refererMatch" + relayMsgLogMaxChars = 200 + RPCProviderNodeAddressHash = "Lava-Provider-Node-Address-Hash" ) var InvalidResponses = []string{"null", "", "nil", "undefined"} @@ -86,6 +87,7 @@ type BaseChainProxy struct { averageBlockTime time.Duration NodeUrl common.NodeUrl ChainID string + HashedNodeUrl string } // returns the node url and chain id for that proxy. diff --git a/protocol/chainlib/grpc.go b/protocol/chainlib/grpc.go index a1ee0200e5..168b160133 100644 --- a/protocol/chainlib/grpc.go +++ b/protocol/chainlib/grpc.go @@ -404,7 +404,7 @@ func NewGrpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint lav func newGrpcChainProxy(ctx context.Context, averageBlockTime time.Duration, parser ChainParser, conn grpcConnectorInterface, rpcProviderEndpoint lavasession.RPCProviderEndpoint) (ChainProxy, error) { cp := &GrpcChainProxy{ - BaseChainProxy: BaseChainProxy{averageBlockTime: averageBlockTime, ErrorHandler: &GRPCErrorHandler{}, ChainID: rpcProviderEndpoint.ChainID}, + BaseChainProxy: BaseChainProxy{averageBlockTime: averageBlockTime, ErrorHandler: &GRPCErrorHandler{}, ChainID: rpcProviderEndpoint.ChainID, HashedNodeUrl: chainproxy.HashURL(rpcProviderEndpoint.NodeUrls[0].Url)}, descriptorsCache: &grpcDescriptorCache{}, } cp.conn = conn @@ -440,6 +440,9 @@ func (cp *GrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, } defer cp.conn.ReturnRpc(conn) + // appending hashed url + grpc.SetTrailer(ctx, metadata.Pairs(RPCProviderNodeAddressHash, cp.BaseChainProxy.HashedNodeUrl)) + rpcInputMessage := chainMessage.GetRPCMessage() nodeMessage, ok := rpcInputMessage.(*rpcInterfaceMessages.GrpcMessage) if !ok { @@ -546,8 +549,7 @@ func (cp *GrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, return nil, "", nil, handlingError } // set status code for user header - trailer := metadata.Pairs(common.StatusCodeMetadataKey, strconv.Itoa(int(statusCode))) - grpc.SetTrailer(ctx, trailer) // we ignore this error here since this code can be triggered not from grpc + grpc.SetTrailer(ctx, metadata.Pairs(common.StatusCodeMetadataKey, strconv.Itoa(int(statusCode)))) // we ignore this error here since this code can be triggered not from grpc reply := &RelayReplyWrapper{ StatusCode: int(statusCode), RelayReply: &pairingtypes.RelayReply{ @@ -565,8 +567,7 @@ func (cp *GrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, } // set response status code validResponseStatus := http.StatusOK - trailer := metadata.Pairs(common.StatusCodeMetadataKey, strconv.Itoa(validResponseStatus)) - grpc.SetTrailer(ctx, trailer) // we ignore this error here since this code can be triggered not from grpc + grpc.SetTrailer(ctx, metadata.Pairs(common.StatusCodeMetadataKey, strconv.Itoa(validResponseStatus))) // we ignore this error here since this code can be triggered not from grpc // create reply wrapper reply := &RelayReplyWrapper{ StatusCode: validResponseStatus, // status code is used only for rest at the moment diff --git a/protocol/chainlib/jsonRPC.go b/protocol/chainlib/jsonRPC.go index 9eccc7536b..50d107606f 100644 --- a/protocol/chainlib/jsonRPC.go +++ b/protocol/chainlib/jsonRPC.go @@ -9,6 +9,8 @@ import ( "time" "github.com/goccy/go-json" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" "github.com/gofiber/fiber/v2" "github.com/gofiber/websocket/v2" @@ -646,8 +648,6 @@ func (cp *JrpcChainProxy) sendBatchMessage(ctx context.Context, nodeMessage *rpc } func (cp *JrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *RelayReplyWrapper, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error) { - // Get node - rpcInputMessage := chainMessage.GetRPCMessage() nodeMessage, ok := rpcInputMessage.(*rpcInterfaceMessages.JsonrpcMessage) if !ok { @@ -668,6 +668,10 @@ func (cp *JrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, return nil, "", nil, err } defer cp.conn[internalPath].ReturnRpc(rpc) + + // appending hashed url + grpc.SetTrailer(ctx, metadata.Pairs(RPCProviderNodeAddressHash, cp.conn[internalPath].GetUrlHash())) + // Call our node var rpcMessage *rpcclient.JsonrpcMessage var replyMessage *rpcInterfaceMessages.JsonrpcMessage diff --git a/protocol/chainlib/rest.go b/protocol/chainlib/rest.go index 17f0512f4d..c275825635 100644 --- a/protocol/chainlib/rest.go +++ b/protocol/chainlib/rest.go @@ -451,7 +451,7 @@ func NewRestChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint lav nodeUrl := rpcProviderEndpoint.NodeUrls[0] nodeUrl.Url = strings.TrimSuffix(rpcProviderEndpoint.NodeUrls[0].Url, "/") rcp := &RestChainProxy{ - BaseChainProxy: BaseChainProxy{averageBlockTime: averageBlockTime, NodeUrl: rpcProviderEndpoint.NodeUrls[0], ErrorHandler: &RestErrorHandler{}, ChainID: rpcProviderEndpoint.ChainID}, + BaseChainProxy: BaseChainProxy{averageBlockTime: averageBlockTime, NodeUrl: rpcProviderEndpoint.NodeUrls[0], HashedNodeUrl: chainproxy.HashURL(nodeUrl.Url), ErrorHandler: &RestErrorHandler{}, ChainID: rpcProviderEndpoint.ChainID}, } return rcp, nil } @@ -467,6 +467,9 @@ func (rcp *RestChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, } httpClient := rcp.httpClient + // appending hashed url + grpc.SetTrailer(ctx, metadata.Pairs(RPCProviderNodeAddressHash, rcp.BaseChainProxy.HashedNodeUrl)) + rpcInputMessage := chainMessage.GetRPCMessage() nodeMessage, ok := rpcInputMessage.(*rpcInterfaceMessages.RestMessage) if !ok { @@ -513,8 +516,7 @@ func (rcp *RestChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, res, err := httpClient.Do(req) if res != nil { // resp can be non nil on error - trailer := metadata.Pairs(common.StatusCodeMetadataKey, strconv.Itoa(res.StatusCode)) - grpc.SetTrailer(ctx, trailer) // we ignore this error here since this code can be triggered not from grpc + grpc.SetTrailer(ctx, metadata.Pairs(common.StatusCodeMetadataKey, strconv.Itoa(res.StatusCode))) // we ignore this error here since this code can be triggered not from grpc } if err != nil { // Validate if the error is related to the provider connection to the node or it is a valid error diff --git a/protocol/chainlib/tendermintRPC.go b/protocol/chainlib/tendermintRPC.go index 0fb92fff57..3b47839dcf 100644 --- a/protocol/chainlib/tendermintRPC.go +++ b/protocol/chainlib/tendermintRPC.go @@ -676,6 +676,9 @@ func (cp *tendermintRpcChainProxy) SendURI(ctx context.Context, nodeMessage *rpc } httpClient := cp.httpClient + // appending hashed url + grpc.SetTrailer(ctx, metadata.Pairs(RPCProviderNodeAddressHash, cp.httpConnector.GetUrlHash())) + // construct the url by concatenating the node url with the path variable url := cp.httpNodeUrl.Url + "/" + nodeMessage.Path @@ -708,8 +711,7 @@ func (cp *tendermintRpcChainProxy) SendURI(ctx context.Context, nodeMessage *rpc res, err := httpClient.Do(req) if res != nil { // resp can be non nil on error - trailer := metadata.Pairs(common.StatusCodeMetadataKey, strconv.Itoa(res.StatusCode)) - grpc.SetTrailer(ctx, trailer) // we ignore this error here since this code can be triggered not from grpc + grpc.SetTrailer(ctx, metadata.Pairs(common.StatusCodeMetadataKey, strconv.Itoa(res.StatusCode))) // we ignore this error here since this code can be triggered not from grpc } if err != nil { return nil, "", nil, err @@ -759,6 +761,8 @@ func (cp *tendermintRpcChainProxy) SendRPC(ctx context.Context, nodeMessage *rpc } // return the rpc connection to the websocket pool after the function completes defer cp.conn[internalPath].ReturnRpc(rpc) + // appending hashed url + grpc.SetTrailer(ctx, metadata.Pairs(RPCProviderNodeAddressHash, cp.conn[internalPath].GetUrlHash())) } else { rpc, err = cp.httpConnector.GetRpc(ctx, true) if err != nil { @@ -766,6 +770,8 @@ func (cp *tendermintRpcChainProxy) SendRPC(ctx context.Context, nodeMessage *rpc } // return the rpc connection to the http pool after the function completes defer cp.httpConnector.ReturnRpc(rpc) + // appending hashed url + grpc.SetTrailer(ctx, metadata.Pairs(RPCProviderNodeAddressHash, cp.httpConnector.GetUrlHash())) } // create variables for the rpc message and reply message diff --git a/protocol/rpcconsumer/rpcconsumer_server.go b/protocol/rpcconsumer/rpcconsumer_server.go index 74d931a85a..925bd3cfcc 100644 --- a/protocol/rpcconsumer/rpcconsumer_server.go +++ b/protocol/rpcconsumer/rpcconsumer_server.go @@ -769,6 +769,7 @@ func (rpccs *RPCConsumerServer) relayInner(ctx context.Context, singleConsumerSe } relayLatency = time.Since(relaySentTime) if rpccs.debugRelays { + providerNodeHashes := trailer.Get(chainlib.RPCProviderNodeAddressHash) attributes := []utils.Attribute{ utils.LogAttr("GUID", ctx), utils.LogAttr("addon", relayRequest.RelayData.Addon), @@ -785,6 +786,7 @@ func (rpccs *RPCConsumerServer) relayInner(ctx context.Context, singleConsumerSe utils.LogAttr("replyErred", err != nil), utils.LogAttr("replyLatestBlock", reply.GetLatestBlock()), utils.LogAttr("method", chainMessage.GetApi().Name), + utils.LogAttr("providerNodeHashes", providerNodeHashes), } internalPath := chainMessage.GetApiCollection().CollectionData.InternalPath if internalPath != "" { diff --git a/protocol/rpcprovider/rpcprovider_server.go b/protocol/rpcprovider/rpcprovider_server.go index 201a1d2ece..b635518405 100644 --- a/protocol/rpcprovider/rpcprovider_server.go +++ b/protocol/rpcprovider/rpcprovider_server.go @@ -43,6 +43,10 @@ const ( var RPCProviderStickinessHeaderName = "X-Node-Sticky" +const ( + RPCProviderAddressHeader = "Lava-Provider-Address" +) + type RPCProviderServer struct { cache *performance.Cache chainRouter chainlib.ChainRouter @@ -761,6 +765,7 @@ func (rpcps *RPCProviderServer) TryRelay(ctx context.Context, request *pairingty } // add stickiness header chainMsg.AppendHeader([]pairingtypes.Metadata{{Name: RPCProviderStickinessHeaderName, Value: common.GetUniqueToken(consumerAddr.String(), common.GetTokenFromGrpcContext(ctx))}}) + chainMsg.AppendHeader([]pairingtypes.Metadata{{Name: RPCProviderAddressHeader, Value: rpcps.providerAddress.String()}}) if debugConsistency { utils.LavaFormatDebug("adding stickiness header", utils.LogAttr("tokenFromContext", common.GetTokenFromGrpcContext(ctx)), utils.LogAttr("unique_token", common.GetUniqueToken(consumerAddr.String(), common.GetIpFromGrpcContext(ctx)))) }