diff --git a/Makefile b/Makefile index 9068130fbd..efbaa6f243 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,9 @@ go.sum: go.mod build_cli: CGO_LDFLAGS=$(CGO_LDFLAGS) go build -o secretcli -mod=readonly $(GCFLAGS) -tags "$(filter-out sgx, $(GO_TAGS)) secretcli" -ldflags '$(LD_FLAGS)' ./cmd/secretd +build-nosgx: + go build -o secretd-nosgx -mod=readonly $(GCFLAGS) -tags "$(filter-out sgx, $(GO_TAGS)) nosgx" -ldflags '$(LD_FLAGS)' ./cmd/secretd + build_local_no_rust: cp go-cosmwasm/target/$(BUILD_PROFILE)/libgo_cosmwasm.so go-cosmwasm/api CGO_LDFLAGS=$(CGO_LDFLAGS) go build -mod=readonly $(GCFLAGS) -tags "$(GO_TAGS)" -ldflags '$(LD_FLAGS)' ./cmd/secretd diff --git a/app/app.go b/app/app.go index d2ff3a58fa..6331bb802e 100644 --- a/app/app.go +++ b/app/app.go @@ -3,10 +3,8 @@ package app import ( "bytes" "encoding/base64" - "fmt" "io" "net/http" - "os" "path/filepath" "syscall" diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 10c6976c4f..3a3510c7fe 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -550,6 +550,17 @@ func (ak *SecretAppKeepers) InitCustomKeepers( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) ak.ComputeKeeper = &computeKeeper + + // Provide registered StoreKey instances so ApplyCrossModuleOps + // resolves names to the exact pointers CacheMultiStore expects. + { + sk := make(map[string]storetypes.StoreKey, len(ak.keys)) + for name, key := range ak.keys { + sk[name] = key + } + ak.ComputeKeeper.SetStoreKeys(sk) + } + wasmHooks.ContractKeeper = ak.ComputeKeeper // Compute receive: Switch -> Fee -> Packet Forward -> WASM Hooks diff --git a/app/upgrades/v1.23.3/upgrade.go b/app/upgrades/v1.23.3/upgrade.go new file mode 100644 index 0000000000..6313cb9a33 --- /dev/null +++ b/app/upgrades/v1.23.3/upgrade.go @@ -0,0 +1,39 @@ +package v1_23_2 + +import ( + "context" + "fmt" + "os" + + "cosmossdk.io/log" + store "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/scrtlabs/SecretNetwork/app/keepers" + "github.com/scrtlabs/SecretNetwork/app/upgrades" +) + +const upgradeName = "v1.23.3" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: upgradeName, + CreateUpgradeHandler: createUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} + +func createUpgradeHandler(mm *module.Manager, _ *keepers.SecretAppKeepers, configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + logger := log.NewLogger(os.Stderr) + logger.Info(` _ _ _____ _____ _____ _____ ______ `) + logger.Info(`| | | | __ \ / ____| __ \ /\ | __ \| ____|`) + logger.Info(`| | | | |__) | | __| |__) | / \ | | | | |__ `) + logger.Info(`| | | | ___/| | |_ | _ / / /\ \ | | | | __| `) + logger.Info(`| |__| | | | |__| | | \ \ / ____ \| |__| | |____ `) + logger.Info(` \____/|_| \_____|_| \_\/_/ \_\_____/|______|`) + + logger.Info(fmt.Sprintf("Running module migrations for %s...", upgradeName)) + + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/cmd/secretd/root.go b/cmd/secretd/root.go index 1a55d4c328..c6f83a356f 100644 --- a/cmd/secretd/root.go +++ b/cmd/secretd/root.go @@ -341,10 +341,16 @@ func newApp_internal(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts panic(err) } + // Get compute config and set environment variable for recorder + computeConfig := compute.GetConfig(appOpts) + if computeConfig.StoreSGXData { + os.Setenv("SECRET_STORE_SGX_DATA", "true") + } + res := app.NewSecretNetworkApp(logger, db, traceStore, true, bootstrap, appOpts, - compute.GetConfig(appOpts), + computeConfig, baseapp.SetPruning(pruningOpts), baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), diff --git a/go-cosmwasm/api/callbacks.go b/go-cosmwasm/api/callbacks.go index db5a7cb139..75420d52aa 100644 --- a/go-cosmwasm/api/callbacks.go +++ b/go-cosmwasm/api/callbacks.go @@ -1,5 +1,5 @@ -//go:build !secretcli -// +build !secretcli +//go:build !secretcli && !nosgx +// +build !secretcli,!nosgx package api @@ -84,6 +84,14 @@ type Gas = uint64 // https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34 type GasMeter interface { GasConsumed() Gas + ConsumeGas(amount Gas, descriptor string) +} + +// OriginalGasMeter is an interface for gas meters that wrap another meter +// This allows us to access the underlying meter for accurate callback gas measurement +type OriginalGasMeter interface { + GasMeter + OriginalMeter() GasMeter } /****** DB ********/ diff --git a/go-cosmwasm/api/callbacks_cgo.go b/go-cosmwasm/api/callbacks_cgo.go index b208d21d35..72ada69e05 100644 --- a/go-cosmwasm/api/callbacks_cgo.go +++ b/go-cosmwasm/api/callbacks_cgo.go @@ -1,5 +1,5 @@ -//go:build !secretcli -// +build !secretcli +//go:build !secretcli && !nosgx +// +build !secretcli,!nosgx package api diff --git a/go-cosmwasm/api/callbacks_mock.go b/go-cosmwasm/api/callbacks_mock.go index 5380f08f3e..26afe50234 100644 --- a/go-cosmwasm/api/callbacks_mock.go +++ b/go-cosmwasm/api/callbacks_mock.go @@ -92,6 +92,7 @@ type Gas = uint64 // // https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34 type GasMeter interface { GasConsumed() Gas + ConsumeGas(amount Gas, descriptor string) } // /****** DB ********/ diff --git a/go-cosmwasm/api/callbacks_nosgx.go b/go-cosmwasm/api/callbacks_nosgx.go new file mode 100644 index 0000000000..0ea39d8891 --- /dev/null +++ b/go-cosmwasm/api/callbacks_nosgx.go @@ -0,0 +1,34 @@ +//go:build !secretcli && nosgx + +package api + +import ( + dbm "github.com/cosmos/cosmos-db" +) + +const GasMultiplier = 1000 + +type Gas = uint64 + +type GasMeter interface { + GasConsumed() Gas + ConsumeGas(amount Gas, descriptor string) +} + +type KVStore interface { + Get(key []byte) []byte + Set(key, value []byte) + Delete(key []byte) + Iterator(start, end []byte) dbm.Iterator + ReverseIterator(start, end []byte) dbm.Iterator +} + +type ( + HumanAddress func([]byte) (string, uint64, error) + CanonicalAddress func(string) ([]byte, uint64, error) +) + +type GoAPI struct { + HumanAddress HumanAddress + CanonicalAddress CanonicalAddress +} diff --git a/go-cosmwasm/api/ecall_client.go b/go-cosmwasm/api/ecall_client.go new file mode 100644 index 0000000000..bc1c46a34b --- /dev/null +++ b/go-cosmwasm/api/ecall_client.go @@ -0,0 +1,689 @@ +//go:build !secretcli +// +build !secretcli + +package api + +import ( + "context" + "encoding/json" + "fmt" + "math/rand" + "os" + "path/filepath" + "sync" + "time" + + "github.com/gogo/protobuf/proto" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/status" +) + +// EcallClient fetches ecall records from remote SGX nodes via gRPC +// It maintains connections to multiple nodes and selects randomly for load distribution +type EcallClient struct { + mu sync.RWMutex + nodes []*nodeConn // Pool of node connections + timeout time.Duration + rng *rand.Rand +} + +// nodeConn represents a connection to a single SGX node +type nodeConn struct { + addr string + conn *grpc.ClientConn + mu sync.Mutex + failed bool // Mark node as failed to avoid repeated connection attempts +} + +// sgxNodesConfig represents the JSON configuration file format +type sgxNodesConfig struct { + Nodes []string `json:"nodes"` // List of gRPC addresses (host:port) +} + +// EcallRecordData represents the ecall record for a block +type EcallRecordData struct { + Height int64 + RandomSeed []byte + ValidatorSetEvidence []byte +} + +// Proto message types (matching secret.compute.v1beta1.Query*) +// Defined locally to avoid import cycles + +// QueryEcallRecordRequest matches QueryEcallRecordRequest proto +type QueryEcallRecordRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryEcallRecordRequest) Reset() { *m = QueryEcallRecordRequest{} } +func (m *QueryEcallRecordRequest) String() string { return fmt.Sprintf("{Height:%d}", m.Height) } +func (m *QueryEcallRecordRequest) ProtoMessage() {} + +// QueryEcallRecordResponse matches QueryEcallRecordResponse proto +type QueryEcallRecordResponse struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + RandomSeed []byte `protobuf:"bytes,2,opt,name=random_seed,json=randomSeed,proto3" json:"random_seed,omitempty"` + ValidatorSetEvidence []byte `protobuf:"bytes,3,opt,name=validator_set_evidence,json=validatorSetEvidence,proto3" json:"validator_set_evidence,omitempty"` +} + +func (m *QueryEcallRecordResponse) Reset() { *m = QueryEcallRecordResponse{} } +func (m *QueryEcallRecordResponse) String() string { return fmt.Sprintf("{Height:%d}", m.Height) } +func (m *QueryEcallRecordResponse) ProtoMessage() {} + +// QueryEncryptedSeedRequest matches QueryEncryptedSeedRequest proto +type QueryEncryptedSeedRequest struct { + CertHash string `protobuf:"bytes,1,opt,name=cert_hash,json=certHash,proto3" json:"cert_hash,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryEncryptedSeedRequest) Reset() { *m = QueryEncryptedSeedRequest{} } +func (m *QueryEncryptedSeedRequest) String() string { + return fmt.Sprintf("{CertHash:%s,Height:%d}", m.CertHash, m.Height) +} +func (m *QueryEncryptedSeedRequest) ProtoMessage() {} + +// QueryEncryptedSeedResponse matches QueryEncryptedSeedResponse proto +type QueryEncryptedSeedResponse struct { + EncryptedSeed []byte `protobuf:"bytes,1,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` +} + +func (m *QueryEncryptedSeedResponse) Reset() { *m = QueryEncryptedSeedResponse{} } +func (m *QueryEncryptedSeedResponse) String() string { + return fmt.Sprintf("{len:%d}", len(m.EncryptedSeed)) +} +func (m *QueryEncryptedSeedResponse) ProtoMessage() {} + +// QueryNetworkPubkeyRequest matches QueryNetworkPubkeyRequest proto +type QueryNetworkPubkeyRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + ISeed uint32 `protobuf:"varint,2,opt,name=i_seed,json=iSeed,proto3" json:"i_seed,omitempty"` +} + +func (m *QueryNetworkPubkeyRequest) Reset() { *m = QueryNetworkPubkeyRequest{} } +func (m *QueryNetworkPubkeyRequest) String() string { + return fmt.Sprintf("{Height:%d,ISeed:%d}", m.Height, m.ISeed) +} +func (m *QueryNetworkPubkeyRequest) ProtoMessage() {} + +// QueryNetworkPubkeyResponse matches QueryNetworkPubkeyResponse proto +type QueryNetworkPubkeyResponse struct { + NodePubkey []byte `protobuf:"bytes,1,opt,name=node_pubkey,json=nodePubkey,proto3" json:"node_pubkey,omitempty"` + IoPubkey []byte `protobuf:"bytes,2,opt,name=io_pubkey,json=ioPubkey,proto3" json:"io_pubkey,omitempty"` +} + +func (m *QueryNetworkPubkeyResponse) Reset() { *m = QueryNetworkPubkeyResponse{} } +func (m *QueryNetworkPubkeyResponse) String() string { + return fmt.Sprintf("{len(node):%d,len(io):%d}", len(m.NodePubkey), len(m.IoPubkey)) +} +func (m *QueryNetworkPubkeyResponse) ProtoMessage() {} + +// StorageOpProto matches the proto definition for storage operation +type StorageOpProto struct { + IsDelete bool `protobuf:"varint,1,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *StorageOpProto) Reset() { *m = StorageOpProto{} } +func (m *StorageOpProto) String() string { return fmt.Sprintf("{IsDelete:%v}", m.IsDelete) } +func (m *StorageOpProto) ProtoMessage() {} + +// CrossModuleOpProto matches the proto definition for cross-module storage operation +type CrossModuleOpProto struct { + StoreKey string `protobuf:"bytes,1,opt,name=store_key,json=storeKey,proto3" json:"store_key,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + IsDelete bool `protobuf:"varint,4,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` +} + +func (m *CrossModuleOpProto) Reset() { *m = CrossModuleOpProto{} } +func (m *CrossModuleOpProto) String() string { return fmt.Sprintf("{StoreKey:%s}", m.StoreKey) } +func (m *CrossModuleOpProto) ProtoMessage() {} + +// QueryBlockTracesRequest matches QueryBlockTracesRequest proto +type QueryBlockTracesRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryBlockTracesRequest) Reset() { *m = QueryBlockTracesRequest{} } +func (m *QueryBlockTracesRequest) String() string { return fmt.Sprintf("{Height:%d}", m.Height) } +func (m *QueryBlockTracesRequest) ProtoMessage() {} + +// ExecutionTraceProto matches the proto definition +type ExecutionTraceProto struct { + Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + Ops []*StorageOpProto `protobuf:"bytes,2,rep,name=ops,proto3" json:"ops,omitempty"` + Result []byte `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` + GasUsed uint64 `protobuf:"varint,4,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + CallbackGas uint64 `protobuf:"varint,7,opt,name=callback_gas,json=callbackGas,proto3" json:"callback_gas,omitempty"` + HasError bool `protobuf:"varint,5,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + ErrorMsg string `protobuf:"bytes,6,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` + CrossOps []*CrossModuleOpProto `protobuf:"bytes,8,rep,name=cross_ops,json=crossOps,proto3" json:"cross_ops,omitempty"` +} + +func (m *ExecutionTraceProto) Reset() { *m = ExecutionTraceProto{} } +func (m *ExecutionTraceProto) String() string { return fmt.Sprintf("{Index:%d}", m.Index) } +func (m *ExecutionTraceProto) ProtoMessage() {} + +// QueryBlockTracesResponse matches QueryBlockTracesResponse proto +type QueryBlockTracesResponse struct { + Traces []*ExecutionTraceProto `protobuf:"bytes,1,rep,name=traces,proto3" json:"traces,omitempty"` +} + +func (m *QueryBlockTracesResponse) Reset() { *m = QueryBlockTracesResponse{} } +func (m *QueryBlockTracesResponse) String() string { + return fmt.Sprintf("{NumTraces:%d}", len(m.Traces)) +} +func (m *QueryBlockTracesResponse) ProtoMessage() {} + +// QueryAnalyzeCodeRequest matches QueryAnalyzeCodeRequest proto +type QueryAnalyzeCodeRequest struct { + CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` +} + +func (m *QueryAnalyzeCodeRequest) Reset() { *m = QueryAnalyzeCodeRequest{} } +func (m *QueryAnalyzeCodeRequest) String() string { return fmt.Sprintf("{CodeHash:%x}", m.CodeHash) } +func (m *QueryAnalyzeCodeRequest) ProtoMessage() {} + +// QueryAnalyzeCodeResponse matches QueryAnalyzeCodeResponse proto +type QueryAnalyzeCodeResponse struct { + HasIBCEntryPoints bool `protobuf:"varint,1,opt,name=has_ibc_entry_points,json=hasIbcEntryPoints,proto3" json:"has_ibc_entry_points,omitempty"` + RequiredFeatures string `protobuf:"bytes,2,opt,name=required_features,json=requiredFeatures,proto3" json:"required_features,omitempty"` +} + +func (m *QueryAnalyzeCodeResponse) Reset() { *m = QueryAnalyzeCodeResponse{} } +func (m *QueryAnalyzeCodeResponse) String() string { + return fmt.Sprintf("{HasIBC:%v}", m.HasIBCEntryPoints) +} +func (m *QueryAnalyzeCodeResponse) ProtoMessage() {} + +// QueryMachineIDProofRequest matches QueryMachineIDProofRequest proto +type QueryMachineIDProofRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + MachineId string `protobuf:"bytes,2,opt,name=machine_id,json=machineId,proto3" json:"machine_id,omitempty"` +} + +func (m *QueryMachineIDProofRequest) Reset() { *m = QueryMachineIDProofRequest{} } +func (m *QueryMachineIDProofRequest) String() string { + return fmt.Sprintf("{Height:%d,MachineId:%s}", m.Height, m.MachineId) +} +func (m *QueryMachineIDProofRequest) ProtoMessage() {} + +// QueryMachineIDProofResponse matches QueryMachineIDProofResponse proto +type QueryMachineIDProofResponse struct { + Proof []byte `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (m *QueryMachineIDProofResponse) Reset() { *m = QueryMachineIDProofResponse{} } +func (m *QueryMachineIDProofResponse) String() string { return fmt.Sprintf("{len:%d}", len(m.Proof)) } +func (m *QueryMachineIDProofResponse) ProtoMessage() {} + +// CreateResultDataProto matches the proto definition for a Create (MsgStoreCode) result +type CreateResultDataProto struct { + WasmHash []byte `protobuf:"bytes,1,opt,name=wasm_hash,json=wasmHash,proto3" json:"wasm_hash,omitempty"` + CodeHash []byte `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` + HasError bool `protobuf:"varint,3,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + ErrorMsg string `protobuf:"bytes,4,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` +} + +func (m *CreateResultDataProto) Reset() { *m = CreateResultDataProto{} } +func (m *CreateResultDataProto) String() string { return fmt.Sprintf("{WasmHash:%x}", m.WasmHash) } +func (m *CreateResultDataProto) ProtoMessage() {} + +// QueryBlockCreateResultsRequest matches QueryBlockCreateResultsRequest proto +type QueryBlockCreateResultsRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryBlockCreateResultsRequest) Reset() { *m = QueryBlockCreateResultsRequest{} } +func (m *QueryBlockCreateResultsRequest) String() string { return fmt.Sprintf("{Height:%d}", m.Height) } +func (m *QueryBlockCreateResultsRequest) ProtoMessage() {} + +// QueryBlockCreateResultsResponse matches QueryBlockCreateResultsResponse proto +type QueryBlockCreateResultsResponse struct { + Results []*CreateResultDataProto `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (m *QueryBlockCreateResultsResponse) Reset() { *m = QueryBlockCreateResultsResponse{} } +func (m *QueryBlockCreateResultsResponse) String() string { + return fmt.Sprintf("{NumResults:%d}", len(m.Results)) +} +func (m *QueryBlockCreateResultsResponse) ProtoMessage() {} + +const ( + methodEcallRecord = "/secret.compute.v1beta1.Query/EcallRecord" + methodEncryptedSeed = "/secret.compute.v1beta1.Query/EncryptedSeed" + methodBlockTraces = "/secret.compute.v1beta1.Query/BlockTraces" + methodAnalyzeCode = "/secret.compute.v1beta1.Query/AnalyzeCode" + methodMachineIDProof = "/secret.compute.v1beta1.Query/MachineIDProof" + methodBlockCreateResults = "/secret.compute.v1beta1.Query/BlockCreateResults" + methodNetworkPubkey = "/secret.compute.v1beta1.Query/NetworkPubkey" +) + +var ( + globalClient *EcallClient + clientOnce sync.Once +) + +// Ensure our types implement proto.Message +var ( + _ proto.Message = (*QueryEcallRecordRequest)(nil) + _ proto.Message = (*QueryEcallRecordResponse)(nil) + _ proto.Message = (*QueryEncryptedSeedRequest)(nil) + _ proto.Message = (*QueryEncryptedSeedResponse)(nil) + _ proto.Message = (*StorageOpProto)(nil) + _ proto.Message = (*CrossModuleOpProto)(nil) + _ proto.Message = (*QueryBlockTracesRequest)(nil) + _ proto.Message = (*QueryBlockTracesResponse)(nil) + _ proto.Message = (*ExecutionTraceProto)(nil) + _ proto.Message = (*QueryAnalyzeCodeRequest)(nil) + _ proto.Message = (*QueryAnalyzeCodeResponse)(nil) + _ proto.Message = (*CreateResultDataProto)(nil) + _ proto.Message = (*QueryBlockCreateResultsRequest)(nil) + _ proto.Message = (*QueryBlockCreateResultsResponse)(nil) + _ proto.Message = (*QueryNetworkPubkeyRequest)(nil) + _ proto.Message = (*QueryNetworkPubkeyResponse)(nil) +) + +// GetEcallClient returns the global ecall client instance +func GetEcallClient() *EcallClient { + clientOnce.Do(func() { + var addrs []string + + // Try to load from JSON file first + configPath := os.Getenv("SECRET_SGX_NODES_CONFIG") + if configPath == "" { + // Default path: ~/.secretd/config/sgx_nodes.json + homeDir := os.Getenv("HOME") + secretHome := os.Getenv("SECRETD_HOME") + if secretHome != "" { + configPath = filepath.Join(secretHome, "config", "sgx_nodes.json") + } else { + configPath = filepath.Join(homeDir, ".secretd", "config", "sgx_nodes.json") + } + } + + if addrsFromFile := loadNodesFromJSON(configPath); len(addrsFromFile) > 0 { + addrs = addrsFromFile + logInfo("EcallClient", "Loaded %d nodes from config file: %s", len(addrs), configPath) + } else { + // Fallback to env var + grpcAddr := os.Getenv("SECRET_SGX_NODE_GRPC") + if grpcAddr == "" { + grpcAddr = "localhost:9090" + } + addrs = []string{grpcAddr} + logInfo("EcallClient", "Using single node from env: %s", grpcAddr) + } + + nodes := make([]*nodeConn, len(addrs)) + for i, addr := range addrs { + nodes[i] = &nodeConn{addr: addr} + } + + globalClient = &EcallClient{ + nodes: nodes, + timeout: 30 * time.Second, + rng: rand.New(rand.NewSource(time.Now().UnixNano())), + } + + logInfo("EcallClient", "Initialized with %d SGX nodes", len(addrs)) + }) + return globalClient +} + +// loadNodesFromJSON loads gRPC node addresses from a JSON configuration file +// JSON format: {"nodes": ["node1:9090", "node2:9090", "node3:9090"]} +func loadNodesFromJSON(configPath string) []string { + data, err := os.ReadFile(configPath) + if err != nil { + // File doesn't exist or can't be read - that's okay, use fallback + return nil + } + + var config sgxNodesConfig + if err := json.Unmarshal(data, &config); err != nil { + logWarn("EcallClient", "Failed to parse config file %s: %v", configPath, err) + return nil + } + + if len(config.Nodes) == 0 { + return nil + } + + // Validate and filter out empty addresses + var validAddrs []string + for _, addr := range config.Nodes { + if addr != "" { + validAddrs = append(validAddrs, addr) + } + } + + return validAddrs +} + +// getRandomNode returns a random healthy node connection +// It tries up to len(nodes) times to find a working connection +func (c *EcallClient) getRandomNode() (*grpc.ClientConn, string, error) { + c.mu.RLock() + numNodes := len(c.nodes) + if numNodes == 0 { + c.mu.RUnlock() + return nil, "", fmt.Errorf("no SGX nodes configured") + } + + // Create shuffled indices for random selection without replacement + indices := make([]int, numNodes) + for i := range indices { + indices[i] = i + } + c.rng.Shuffle(len(indices), func(i, j int) { + indices[i], indices[j] = indices[j], indices[i] + }) + c.mu.RUnlock() + + // Try each node in random order until one works + var lastErr error + for _, idx := range indices { + c.mu.RLock() + if idx >= len(c.nodes) { + c.mu.RUnlock() + continue + } + node := c.nodes[idx] + c.mu.RUnlock() + + conn, err := c.ensureConnection(node) + if err != nil { + lastErr = err + continue + } + return conn, node.addr, nil + } + + return nil, "", fmt.Errorf("all SGX nodes unavailable: %w", lastErr) +} + +// ensureConnection ensures the node has an active connection, creating one if needed +func (c *EcallClient) ensureConnection(node *nodeConn) (*grpc.ClientConn, error) { + node.mu.Lock() + defer node.mu.Unlock() + + // Already connected + if node.conn != nil { + return node.conn, nil + } + + // Try to connect (with short timeout to not block too long) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + conn, err := grpc.DialContext( + ctx, + node.addr, + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithBlock(), + ) + if err != nil { + node.failed = true + return nil, fmt.Errorf("failed to connect to %s: %w", node.addr, err) + } + + node.conn = conn + node.failed = false + return conn, nil +} + +// markNodeFailed marks a node as failed after a request error +func (c *EcallClient) markNodeFailed(addr string) { + c.mu.RLock() + defer c.mu.RUnlock() + + for _, n := range c.nodes { + if n.addr == addr { + n.mu.Lock() + n.failed = true + if n.conn != nil { + n.conn.Close() + n.conn = nil + } + n.mu.Unlock() + return + } + } +} + +// Close closes all gRPC connections +func (c *EcallClient) Close() error { + c.mu.Lock() + defer c.mu.Unlock() + + for _, n := range c.nodes { + n.mu.Lock() + if n.conn != nil { + n.conn.Close() + n.conn = nil + } + n.mu.Unlock() + } + return nil +} + +// invokeWithRetry invokes a gRPC method with automatic retry on different nodes +func (c *EcallClient) invokeWithRetry(method string, req, resp proto.Message) error { + c.mu.RLock() + maxRetries := len(c.nodes) + if maxRetries < 1 { + maxRetries = 1 + } + if maxRetries > 5 { + maxRetries = 5 // Cap retries to avoid too many attempts + } + c.mu.RUnlock() + + var lastErr error + for attempt := 0; attempt < maxRetries; attempt++ { + conn, nodeAddr, err := c.getRandomNode() + if err != nil { + lastErr = err + continue + } + + ctx, cancel := context.WithTimeout(context.Background(), c.timeout) + err = conn.Invoke(ctx, method, req, resp) + cancel() + + if err == nil { + return nil + } + + // Don't retry on non-transient gRPC errors + if st, ok := status.FromError(err); ok { + switch st.Code() { + case codes.FailedPrecondition, codes.NotFound, codes.InvalidArgument, codes.PermissionDenied: + return err // Return immediately, don't retry semantic errors + } + } + + lastErr = err + c.markNodeFailed(nodeAddr) + logWarn("EcallClient", "Request to %s failed (attempt %d/%d): %v", nodeAddr, attempt+1, maxRetries, err) + } + + return fmt.Errorf("all retry attempts failed: %w", lastErr) +} + +// FetchEcallRecord fetches a single ecall record from a random SGX node +func (c *EcallClient) FetchEcallRecord(height int64) (*EcallRecordData, error) { + req := &QueryEcallRecordRequest{Height: height} + resp := &QueryEcallRecordResponse{} + + if err := c.invokeWithRetry(methodEcallRecord, req, resp); err != nil { + return nil, fmt.Errorf("gRPC EcallRecord failed for height %d: %w", height, err) + } + + if height%1000 == 0 { + logInfo("EcallClient", "Fetched ecall record for height %d", height) + } + + return &EcallRecordData{ + Height: resp.Height, + RandomSeed: resp.RandomSeed, + ValidatorSetEvidence: resp.ValidatorSetEvidence, + }, nil +} + +// FetchEncryptedSeed fetches encrypted seed data from a random SGX node +func (c *EcallClient) FetchEncryptedSeed(height int64, certHashHex string) ([]byte, error) { + req := &QueryEncryptedSeedRequest{CertHash: certHashHex, Height: height} + resp := &QueryEncryptedSeedResponse{} + + if err := c.invokeWithRetry(methodEncryptedSeed, req, resp); err != nil { + return nil, err // Return raw error to preserve gRPC status codes + } + + logInfo("EcallClient", "Fetched encrypted seed (%d bytes) at height %d", len(resp.EncryptedSeed), height) + return resp.EncryptedSeed, nil +} + +// FetchMachineIDProof fetches a machine ID proof for a given height and machine ID from a random SGX node +func (c *EcallClient) FetchMachineIDProof(height int64, machineIDHex string) ([]byte, error) { + req := &QueryMachineIDProofRequest{Height: height, MachineId: machineIDHex} + resp := &QueryMachineIDProofResponse{} + + if err := c.invokeWithRetry(methodMachineIDProof, req, resp); err != nil { + return nil, fmt.Errorf("gRPC MachineIDProof failed for height %d: %w", height, err) + } + + logInfo("EcallClient", "Fetched machine ID proof (%d bytes) for height %d", len(resp.Proof), height) + return resp.Proof, nil +} + +// FetchBlockTraces fetches all execution traces for a block from a random SGX node +func (c *EcallClient) FetchBlockTraces(height int64) ([]*ExecutionTrace, error) { + req := &QueryBlockTracesRequest{Height: height} + resp := &QueryBlockTracesResponse{} + + if err := c.invokeWithRetry(methodBlockTraces, req, resp); err != nil { + return nil, fmt.Errorf("gRPC BlockTraces failed for height %d: %w", height, err) + } + + // Convert proto response to ExecutionTrace slice + traces := make([]*ExecutionTrace, len(resp.Traces)) + for i, t := range resp.Traces { + logDebug("EcallClient", "Proto trace callbackGas=%d (from gRPC response)", t.CallbackGas) + ops := make([]StorageOp, len(t.Ops)) + for j, op := range t.Ops { + value := op.Value + if !op.IsDelete && value == nil { + value = []byte{} + } + ops[j] = StorageOp{ + IsDelete: op.IsDelete, + Key: op.Key, + Value: value, + } + } + // Convert cross-module ops (e.g., distribution store writes from staking queries) + crossOps := make([]CrossModuleOp, len(t.CrossOps)) + for j, cop := range t.CrossOps { + crossOps[j] = CrossModuleOp{ + StoreKey: cop.StoreKey, + Key: cop.Key, + Value: cop.Value, + IsDelete: cop.IsDelete, + } + } + traces[i] = &ExecutionTrace{ + Index: t.Index, + Ops: ops, + CrossOps: crossOps, + Result: t.Result, + GasUsed: t.GasUsed, + CallbackGas: t.CallbackGas, + HasError: t.HasError, + ErrorMsg: t.ErrorMsg, + } + logDebug("EcallClient", "Converted trace callbackGas=%d crossOps=%d", traces[i].CallbackGas, len(crossOps)) + } + + if len(traces) > 0 { + for _, t := range traces { + logDebug("EcallClient", "Fetched trace: height=%d index=%d ops=%d resultLen=%d gasUsed=%d callbackGas=%d hasError=%v", + height, t.Index, len(t.Ops), len(t.Result), t.GasUsed, t.CallbackGas, t.HasError) + } + } else if height%1000 == 0 { + logInfo("EcallClient", "Fetched %d traces for block %d", len(traces), height) + } + return traces, nil +} + +// FetchAnalyzeCode fetches the AnalyzeCode result for a code hash from a random SGX node +func (c *EcallClient) FetchAnalyzeCode(codeHash []byte) (bool, string, error) { + req := &QueryAnalyzeCodeRequest{CodeHash: codeHash} + resp := &QueryAnalyzeCodeResponse{} + + if err := c.invokeWithRetry(methodAnalyzeCode, req, resp); err != nil { + return false, "", fmt.Errorf("gRPC AnalyzeCode failed for code hash %x: %w", codeHash, err) + } + + logInfo("EcallClient", "Fetched AnalyzeCode for %x: hasIBC=%v features=%s", codeHash, resp.HasIBCEntryPoints, resp.RequiredFeatures) + return resp.HasIBCEntryPoints, resp.RequiredFeatures, nil +} + +// IsConnected returns true if at least one node is connected +func (c *EcallClient) IsConnected() bool { + c.mu.RLock() + defer c.mu.RUnlock() + + for _, n := range c.nodes { + n.mu.Lock() + connected := n.conn != nil + n.mu.Unlock() + if connected { + return true + } + } + return false +} + +// FetchBlockCreateResults fetches all Create (MsgStoreCode) results for a block from a random SGX node +func (c *EcallClient) FetchBlockCreateResults(height int64) ([]*CreateResult, [][]byte, error) { + req := &QueryBlockCreateResultsRequest{Height: height} + resp := &QueryBlockCreateResultsResponse{} + + if err := c.invokeWithRetry(methodBlockCreateResults, req, resp); err != nil { + return nil, nil, fmt.Errorf("gRPC BlockCreateResults failed for height %d: %w", height, err) + } + + results := make([]*CreateResult, len(resp.Results)) + wasmHashes := make([][]byte, len(resp.Results)) + for i, r := range resp.Results { + wasmHashes[i] = r.WasmHash + results[i] = &CreateResult{ + CodeHash: r.CodeHash, + HasError: r.HasError, + ErrorMsg: r.ErrorMsg, + } + } + + if len(results) > 0 { + logInfo("EcallClient", "Fetched %d Create results for block %d", len(results), height) + } + return results, wasmHashes, nil +} + +// FetchNetworkPubkey fetches a stored network pubkey from a random SGX node +func (c *EcallClient) FetchNetworkPubkey(height int64, iSeed uint32) ([]byte, []byte, error) { + req := &QueryNetworkPubkeyRequest{Height: height, ISeed: iSeed} + resp := &QueryNetworkPubkeyResponse{} + + if err := c.invokeWithRetry(methodNetworkPubkey, req, resp); err != nil { + return nil, nil, fmt.Errorf("gRPC NetworkPubkey failed for height %d seed %d: %w", height, iSeed, err) + } + + logInfo("EcallClient", "Fetched NetworkPubkey for height %d seed %d", height, iSeed) + return resp.NodePubkey, resp.IoPubkey, nil +} diff --git a/go-cosmwasm/api/ecall_client_stub.go b/go-cosmwasm/api/ecall_client_stub.go new file mode 100644 index 0000000000..f1c9e9c8c6 --- /dev/null +++ b/go-cosmwasm/api/ecall_client_stub.go @@ -0,0 +1,29 @@ +//go:build secretcli +// +build secretcli + +package api + +// Stub implementations for secretcli builds (no SGX support) + +// EcallClient stub for secretcli +type EcallClient struct{} + +// EcallRecordData stub +type EcallRecordData struct { + Height int64 + RandomSeed []byte + ValidatorSetEvidence []byte +} + +func GetEcallClient() *EcallClient { return nil } +func (c *EcallClient) FetchEcallRecord(int64) (*EcallRecordData, error) { return nil, nil } +func (c *EcallClient) FetchEncryptedSeed(int64, string) ([]byte, error) { return nil, nil } +func (c *EcallClient) FetchBlockTraces(int64) ([]*ExecutionTrace, error) { return nil, nil } +func (c *EcallClient) FetchBlockCreateResults(int64) ([]*CreateResult, [][]byte, error) { + return nil, nil, nil +} +func (c *EcallClient) FetchNetworkPubkey(int64, uint32) ([]byte, []byte, error) { return nil, nil, nil } +func (c *EcallClient) FetchMachineIDProof(int64, string) ([]byte, error) { return nil, nil } +func (c *EcallClient) Close() error { return nil } +func (c *EcallClient) SetGrpcAddr(string) error { return nil } +func (c *EcallClient) IsConnected() bool { return false } diff --git a/go-cosmwasm/api/ecall_record.go b/go-cosmwasm/api/ecall_record.go new file mode 100644 index 0000000000..f931de10b7 --- /dev/null +++ b/go-cosmwasm/api/ecall_record.go @@ -0,0 +1,1024 @@ +//go:build !secretcli +// +build !secretcli + +package api + +import ( + "encoding/binary" + "fmt" + "os" + "path/filepath" + "strconv" + "sync" + "sync/atomic" + + dbm "github.com/cosmos/cosmos-db" + "github.com/gogo/protobuf/proto" +) + +// NodeMode determines how the node handles SGX enclave calls +type NodeMode string + +const ( + // NodeModeSGX - Run with real SGX enclave and record outputs + NodeModeSGX NodeMode = "sgx" + // NodeModeReplay - Replay recorded outputs without SGX + NodeModeReplay NodeMode = "replay" +) + +// EcallRecorder handles recording and replaying ecall data using LevelDB +type EcallRecorder struct { + mu sync.RWMutex + mode NodeMode + db dbm.DB + + // Config + retentionBlocks int64 + pruneInterval int64 + + // Block-scoped execution tracking + currentBlockHeight int64 + executionIndex int64 + + // In-memory cache for current block's traces (replay mode) + blockTracesMu sync.RWMutex + blockTraces map[int64]*ExecutionTrace // key: execution index + + // Pending cross-module ops collected during the current execution. + // Set by keeper (via SetPendingCrossModuleOps) before wasmer.Execute, + // consumed by lib.go (via GetAndClearPendingCrossModuleOps) when building the trace. + pendingCrossOpsMu sync.Mutex + pendingCrossOps []CrossModuleOp +} + +var ( + globalRecorder *EcallRecorder + recorderMu sync.Mutex +) + +// Key prefixes for different ecall types +var ( + prefixSubmitBlockSignatures = []byte{0x01} + prefixGetEncryptedSeed = []byte{0x02} + prefixExecutionTrace = []byte{0x03} // For contract execution: prefix | height | index + prefixMachineIDProof = []byte{0x04} // For MachineID approval: prefix | height | machineID + prefixCreateResult = []byte{0x05} // For Create (store code): prefix | height | sha256(wasm) + prefixGetEncryptedSeedErr = []byte{0x06} // For GetEncryptedSeed errors: prefix | certHash + prefixGetNetworkPubkey = []byte{0x07} // For GetNetworkPubkey: prefix | height | i_seed +) + +// CrossModuleOp represents a write to a module store other than the contract's +// own prefixed store. These happen as side-effects of Go querier callbacks +// (e.g. distribution's initializeDelegation during DelegationTotalRewards). +type CrossModuleOp struct { + StoreKey string // Module store key name (e.g. "distribution") + Key []byte + Value []byte // nil means delete + IsDelete bool +} + +// ExecutionTrace stores all storage operations from a contract execution +type ExecutionTrace struct { + Index int64 // Execution index within the block + Ops []StorageOp + CrossOps []CrossModuleOp // Cross-module mutations from query side-effects + Result []byte // The return value from the ecall + GasUsed uint64 // Gas reported by the enclave + CallbackGas uint64 // Total gas consumed by callbacks (store ops) during execution + HasError bool + IsOutOfGas bool // True when the enclave returned errno==2 (OutOfGas) + ErrorMsg string +} + +// DefaultRetentionBlocks is the default number of blocks to retain (~90 days at 6s blocks) +const DefaultRetentionBlocks int64 = 1296000 + +// PruneIntervalBlocks defines how often to run pruning (every 100 blocks) +const PruneIntervalBlocks int64 = 100 + +// GetRecorder returns the global ecall recorder instance +func GetRecorder() *EcallRecorder { + recorderMu.Lock() + defer recorderMu.Unlock() + + mode := NodeMode(os.Getenv("SECRET_NODE_MODE")) + if mode == "" { + mode = NodeModeSGX // Default to SGX mode + } + + // Check if storing SGX data is enabled (from config or env var) + storeSGXData := os.Getenv("SECRET_STORE_SGX_DATA") == "true" + + // Get retention settings + retentionBlocks := DefaultRetentionBlocks + if v := os.Getenv("SECRET_SGX_DATA_RETENTION_BLOCKS"); v != "" { + if parsed, err := strconv.ParseInt(v, 10, 64); err == nil && parsed > 0 { + retentionBlocks = parsed + } + } + + pruneInterval := PruneIntervalBlocks + if v := os.Getenv("SECRET_SGX_DATA_PRUNE_INTERVAL"); v != "" { + if parsed, err := strconv.ParseInt(v, 10, 64); err == nil && parsed > 0 { + pruneInterval = parsed + } + } + + // If already initialized, check if we need to upgrade the recording state + if globalRecorder != nil { + hasDB := globalRecorder.db != nil + if mode == NodeModeReplay || storeSGXData == hasDB { + // Update config dynamically if re-initialized + globalRecorder.mu.Lock() + globalRecorder.retentionBlocks = retentionBlocks + globalRecorder.pruneInterval = pruneInterval + globalRecorder.mu.Unlock() + return globalRecorder + } + // Transitioning states (tempApp didn't have flag, but real app does) + if globalRecorder.db != nil { + globalRecorder.db.Close() + } + } + + if mode == NodeModeReplay || (mode == NodeModeSGX && !storeSGXData) { + globalRecorder = &EcallRecorder{ + mode: mode, + db: nil, + retentionBlocks: retentionBlocks, + pruneInterval: pruneInterval, + blockTraces: make(map[int64]*ExecutionTrace), + } + if mode == NodeModeReplay { + logInfo("EcallRecorder", "Initialized in replay mode (no local DB, fetches from remote)") + } else { + logInfo("EcallRecorder", "Initialized in %s mode (storing disabled)", mode) + } + return globalRecorder + } + + // Get database directory from env or use default (SGX mode with storing enabled only) + dbDir := os.Getenv("SECRET_ECALL_RECORD_DIR") + if dbDir == "" { + // Default to ~/.secretd/data/ + homeDir := os.Getenv("HOME") + secretHome := os.Getenv("SECRETD_HOME") + if secretHome != "" { + dbDir = filepath.Join(secretHome, "data") + } else { + dbDir = filepath.Join(homeDir, ".secretd", "data") + } + } + + // Ensure directory exists + if err := os.MkdirAll(dbDir, 0o755); err != nil { + logWarn("EcallRecorder", "Could not create db directory: %v", err) + } + + // Open LevelDB database + db, err := dbm.NewDB("ecall_records", dbm.GoLevelDBBackend, dbDir) + if err != nil { + logError("EcallRecorder", "Error opening database: %v", err) + // Create a nil recorder that will skip recording + globalRecorder = &EcallRecorder{ + mode: mode, + db: nil, + retentionBlocks: retentionBlocks, + pruneInterval: pruneInterval, + blockTraces: make(map[int64]*ExecutionTrace), + } + return globalRecorder + } + + globalRecorder = &EcallRecorder{ + mode: mode, + db: db, + retentionBlocks: retentionBlocks, + pruneInterval: pruneInterval, + blockTraces: make(map[int64]*ExecutionTrace), + } + + if storeSGXData { + logInfo("EcallRecorder", "Initialized in %s mode with storing enabled, db dir: %s", mode, dbDir) + } else { + logInfo("EcallRecorder", "Initialized in %s mode, db dir: %s", mode, dbDir) + } + + return globalRecorder +} + +// --- Block-scoped execution tracking --- + +// StartBlock initializes tracking for a new block, resetting the execution counter +func (r *EcallRecorder) StartBlock(height int64) { + atomic.StoreInt64(&r.currentBlockHeight, height) + atomic.StoreInt64(&r.executionIndex, 0) + + // Clear previous block's traces from memory + r.blockTracesMu.Lock() + r.blockTraces = make(map[int64]*ExecutionTrace) + r.blockTracesMu.Unlock() +} + +// NextExecutionIndex returns the next execution index and increments the counter +func (r *EcallRecorder) NextExecutionIndex() int64 { + return atomic.AddInt64(&r.executionIndex, 1) +} + +// GetCurrentBlockHeight returns the current block height being processed +func (r *EcallRecorder) GetCurrentBlockHeight() int64 { + return atomic.LoadInt64(&r.currentBlockHeight) +} + +// SetBlockTraces sets all traces for the current block (used in replay mode after batch fetch) +func (r *EcallRecorder) SetBlockTraces(traces []*ExecutionTrace) { + r.blockTracesMu.Lock() + defer r.blockTracesMu.Unlock() + + r.blockTraces = make(map[int64]*ExecutionTrace) + for _, trace := range traces { + r.blockTraces[trace.Index] = trace + logDebug("SetBlockTraces", "Stored trace at index=%d", trace.Index) + } +} + +// GetTraceFromMemory retrieves a trace from the in-memory cache +func (r *EcallRecorder) GetTraceFromMemory(index int64) (*ExecutionTrace, bool) { + r.blockTracesMu.RLock() + defer r.blockTracesMu.RUnlock() + + trace, found := r.blockTraces[index] + return trace, found +} + +// SetPendingCrossModuleOps replaces the pending cross-module ops list. +// Called by the keeper to initialize the list before a WASM execution. +func (r *EcallRecorder) SetPendingCrossModuleOps(ops []CrossModuleOp) { + r.pendingCrossOpsMu.Lock() + defer r.pendingCrossOpsMu.Unlock() + r.pendingCrossOps = ops +} + +// AppendCrossModuleOp adds a single cross-module op to the pending list. +// Called by the RecordingMultiStore when a cross-module write is observed. +func (r *EcallRecorder) AppendCrossModuleOp(op CrossModuleOp) { + r.pendingCrossOpsMu.Lock() + defer r.pendingCrossOpsMu.Unlock() + r.pendingCrossOps = append(r.pendingCrossOps, op) +} + +// GetAndClearPendingCrossModuleOps returns the accumulated cross-module ops +// and clears the pending list. Called by lib.go after wasmer.Execute to +// include the ops in the execution trace. +func (r *EcallRecorder) GetAndClearPendingCrossModuleOps() []CrossModuleOp { + r.pendingCrossOpsMu.Lock() + defer r.pendingCrossOpsMu.Unlock() + ops := r.pendingCrossOps + r.pendingCrossOps = nil + return ops +} + +// Mode returns the current node mode +func (r *EcallRecorder) Mode() NodeMode { + return r.mode +} + +func (r *EcallRecorder) IsSGXMode() bool { + return r.mode == NodeModeSGX && r.db != nil +} + +// IsReplayMode returns true if running in replay mode +func (r *EcallRecorder) IsReplayMode() bool { + return r.mode == NodeModeReplay +} + +// Close closes the database +func (r *EcallRecorder) Close() error { + if r.db != nil { + return r.db.Close() + } + return nil +} + +// --- Key generation helpers --- + +// makeBlockKey creates a key for block-height indexed data +func makeBlockKey(prefix []byte, height int64) []byte { + key := make([]byte, len(prefix)+8) + copy(key, prefix) + binary.BigEndian.PutUint64(key[len(prefix):], uint64(height)) + return key +} + +// --- SubmitBlockSignatures recording --- + +// RecordSubmitBlockSignatures records the output of SubmitBlockSignatures by block height +func (r *EcallRecorder) RecordSubmitBlockSignatures(height int64, random []byte, evidence []byte) error { + if r.db == nil { + // Storing is disabled (opt-in feature) - silently skip + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + // Combine random (32 bytes) and evidence (32 bytes) into 64 bytes + value := make([]byte, 64) + copy(value[:32], random) + copy(value[32:], evidence) + + key := makeBlockKey(prefixSubmitBlockSignatures, height) + if err := r.db.Set(key, value); err != nil { + return fmt.Errorf("failed to write to db: %w", err) + } + + // Only log every 1000 blocks to reduce noise + if height%1000 == 0 { + logInfo("EcallRecorder", "Recorded SubmitBlockSignatures for height %d", height) + } + return nil +} + +// ReplaySubmitBlockSignatures retrieves recorded SubmitBlockSignatures data by block height +func (r *EcallRecorder) ReplaySubmitBlockSignatures(height int64) (random []byte, evidence []byte, found bool) { + if r.db == nil { + return nil, nil, false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeBlockKey(prefixSubmitBlockSignatures, height) + value, err := r.db.Get(key) + if err != nil || value == nil || len(value) != 64 { + return nil, nil, false + } + + random = make([]byte, 32) + evidence = make([]byte, 32) + copy(random, value[:32]) + copy(evidence, value[32:]) + + // Only log every 1000 blocks to reduce noise + if height%1000 == 0 { + logInfo("EcallRecorder", "Replayed SubmitBlockSignatures for height %d", height) + } + return random, evidence, true +} + +// --- MachineID proof recording --- + +// makeMachineIDProofKey creates a key: prefix | height (8 bytes) | machineID +func makeMachineIDProofKey(height int64, machineID []byte) []byte { + key := make([]byte, len(prefixMachineIDProof)+8+len(machineID)) + copy(key, prefixMachineIDProof) + binary.BigEndian.PutUint64(key[len(prefixMachineIDProof):], uint64(height)) + copy(key[len(prefixMachineIDProof)+8:], machineID) + return key +} + +// RecordMachineIDProof records the proof output from OnApproveMachineID +func (r *EcallRecorder) RecordMachineIDProof(height int64, machineID []byte, proof []byte) error { + if r.db == nil { + // Storing is disabled - silently skip + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + key := makeMachineIDProofKey(height, machineID) + if err := r.db.Set(key, proof); err != nil { + return fmt.Errorf("failed to write machine ID proof to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded MachineIDProof for height %d, machineID len=%d", height, len(machineID)) + return nil +} + +// ReplayMachineIDProof retrieves the recorded proof for a machine ID approval +func (r *EcallRecorder) ReplayMachineIDProof(height int64, machineID []byte) (proof []byte, found bool) { + if r.db == nil { + return nil, false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeMachineIDProofKey(height, machineID) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, false + } + + logInfo("EcallRecorder", "Replayed MachineIDProof for height %d (%d bytes)", height, len(value)) + return value, true +} + +// --- GetNetworkPubkey recording --- + +func makeNetworkPubkeyKey(height int64, iSeed uint32) []byte { + key := make([]byte, 1+8+4) + key[0] = prefixGetNetworkPubkey[0] + binary.BigEndian.PutUint64(key[1:9], uint64(height)) + binary.BigEndian.PutUint32(key[9:13], iSeed) + return key +} + +func (r *EcallRecorder) RecordGetNetworkPubkey(height int64, iSeed uint32, nodePk, ioPk []byte) error { + if r.db == nil { + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + // Pack lengths + data + value := make([]byte, 2+len(nodePk)+2+len(ioPk)) + binary.BigEndian.PutUint16(value[0:2], uint16(len(nodePk))) + copy(value[2:2+len(nodePk)], nodePk) + + offset := 2 + len(nodePk) + binary.BigEndian.PutUint16(value[offset:offset+2], uint16(len(ioPk))) + copy(value[offset+2:], ioPk) + + key := makeNetworkPubkeyKey(height, iSeed) + if err := r.db.Set(key, value); err != nil { + return fmt.Errorf("failed to write network pubkey to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded GetNetworkPubkey at height %d for i_seed %d", height, iSeed) + return nil +} + +func (r *EcallRecorder) ReplayGetNetworkPubkey(height int64, iSeed uint32) (nodePk, ioPk []byte, found bool) { + if r.db == nil { + return nil, nil, false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeNetworkPubkeyKey(height, iSeed) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, nil, false + } + + nodePkLen := binary.BigEndian.Uint16(value[0:2]) + nodePk = make([]byte, nodePkLen) + copy(nodePk, value[2:2+nodePkLen]) + + offset := 2 + nodePkLen + ioPkLen := binary.BigEndian.Uint16(value[offset : offset+2]) + ioPk = make([]byte, ioPkLen) + copy(ioPk, value[offset+2:]) + + logInfo("EcallRecorder", "Replayed GetNetworkPubkey at height %d for i_seed %d", height, iSeed) + return nodePk, ioPk, true +} + +// --- GetEncryptedSeed recording (by height + cert hash) --- + +// makeSeedKey creates a key: prefix(1) | height(8) | certHash +func makeSeedKey(height int64, certHash []byte) []byte { + key := make([]byte, 1+8+len(certHash)) + key[0] = prefixGetEncryptedSeed[0] + binary.BigEndian.PutUint64(key[1:9], uint64(height)) + copy(key[9:], certHash) + return key +} + +// makeSeedErrKey creates a key: prefix(1) | height(8) | certHash +func makeSeedErrKey(height int64, certHash []byte) []byte { + key := make([]byte, 1+8+len(certHash)) + key[0] = prefixGetEncryptedSeedErr[0] + binary.BigEndian.PutUint64(key[1:9], uint64(height)) + copy(key[9:], certHash) + return key +} + +// RecordGetEncryptedSeed records the GetEncryptedSeed ecall output (success case) +// Key format: prefix(1) | height(8) | certHash +func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, output []byte) error { + if r.db == nil { + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + key := makeSeedKey(height, certHash) + if err := r.db.Set(key, output); err != nil { + return fmt.Errorf("failed to write to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded GetEncryptedSeed success at height %d (%d bytes)", height, len(output)) + return nil +} + +// RecordGetEncryptedSeedError records a failed GetEncryptedSeed ecall with its error message +// Key format: prefix(1) | height(8) | certHash +func (r *EcallRecorder) RecordGetEncryptedSeedError(height int64, certHash []byte, errMsg string) error { + if r.db == nil { + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + key := makeSeedErrKey(height, certHash) + if err := r.db.Set(key, []byte(errMsg)); err != nil { + return fmt.Errorf("failed to write error to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded GetEncryptedSeed error at height %d: %s", height, errMsg) + return nil +} + +// ReplayGetEncryptedSeed retrieves recorded GetEncryptedSeed data for a given height +// Returns (output, "", true) on recorded success, (nil, errMsg, true) on recorded error, (nil, "", false) if not found +func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (output []byte, errMsg string, found bool) { + if r.db == nil { + return nil, "", false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + // Check for error entry first (separate key prefix) + errKey := makeSeedErrKey(height, certHash) + errVal, err := r.db.Get(errKey) + if err == nil && errVal != nil && len(errVal) > 0 { + logInfo("EcallRecorder", "Replayed GetEncryptedSeed error at height %d", height) + return nil, string(errVal), true + } + + // Check for success entry + key := makeSeedKey(height, certHash) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, "", false + } + + logInfo("EcallRecorder", "Replayed GetEncryptedSeed success at height %d (%d bytes)", height, len(value)) + return value, "", true +} + +// --- ExecutionTrace recording (for contract executions) --- + +// makeExecutionKey creates a key for height+index indexed execution traces +// Key format: prefix (1 byte) | height (8 bytes) | index (8 bytes) +func makeExecutionKey(height int64, index int64) []byte { + key := make([]byte, 1+8+8) + key[0] = prefixExecutionTrace[0] + binary.BigEndian.PutUint64(key[1:9], uint64(height)) + binary.BigEndian.PutUint64(key[9:17], uint64(index)) + return key +} + +// RecordExecutionTrace records contract execution storage ops and result +// Uses current block height and the provided execution index +func (r *EcallRecorder) RecordExecutionTrace(height int64, index int64, trace *ExecutionTrace) error { + if r.db == nil { + // Storing is disabled (opt-in feature) - silently skip + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + trace.Index = index + + logDebug("RecordExecutionTrace", "Storing trace height=%d index=%d callbackGas=%d", height, index, trace.CallbackGas) + + // Convert to protobuf and serialize + protoTrace := executionTraceToProto(trace) + data, err := proto.Marshal(protoTrace) + if err != nil { + return fmt.Errorf("failed to marshal trace: %w", err) + } + + logDebug("RecordExecutionTrace", "Serialized data length=%d", len(data)) + + key := makeExecutionKey(height, index) + if err := r.db.Set(key, data); err != nil { + return fmt.Errorf("failed to write to db: %w", err) + } + + // Verify we can read it back + readBack, err := r.db.Get(key) + if err == nil && readBack != nil { + var verifyProto ExecutionTraceProto + if err := proto.Unmarshal(readBack, &verifyProto); err == nil { + verifyTrace := protoToExecutionTrace(&verifyProto) + logDebug("RecordExecutionTrace", "Verified readback callbackGas=%d", verifyTrace.CallbackGas) + } + } + + return nil +} + +// ReplayExecutionTrace retrieves recorded execution trace by height and index +func (r *EcallRecorder) ReplayExecutionTrace(height int64, index int64) (*ExecutionTrace, bool) { + if r.db == nil { + return nil, false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeExecutionKey(height, index) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, false + } + + // Deserialize protobuf + var protoTrace ExecutionTraceProto + if err := proto.Unmarshal(value, &protoTrace); err != nil { + logError("EcallRecorder", "Failed to deserialize trace: %v", err) + return nil, false + } + + trace := protoToExecutionTrace(&protoTrace) + return trace, true +} + +// GetAllTracesForBlock retrieves all execution traces for a given block height +func (r *EcallRecorder) GetAllTracesForBlock(height int64) ([]*ExecutionTrace, error) { + if r.db == nil { + return nil, fmt.Errorf("database not initialized") + } + + r.mu.RLock() + defer r.mu.RUnlock() + + // Create range for this block: [prefix|height|0, prefix|height|maxUint64] + startKey := makeExecutionKey(height, 0) + endKey := makeExecutionKey(height+1, 0) // Next block's start is this block's end + + iter, err := r.db.Iterator(startKey, endKey) + if err != nil { + return nil, fmt.Errorf("failed to create iterator: %w", err) + } + defer iter.Close() + + var traces []*ExecutionTrace + for ; iter.Valid(); iter.Next() { + rawData := iter.Value() + logDebug("GetAllTracesForBlock", "Raw trace data length=%d", len(rawData)) + + // Deserialize protobuf + var protoTrace ExecutionTraceProto + if err := proto.Unmarshal(rawData, &protoTrace); err != nil { + logError("EcallRecorder", "Failed to deserialize trace: %v", err) + continue + } + + trace := protoToExecutionTrace(&protoTrace) + + logDebug("GetAllTracesForBlock", "Deserialized trace index=%d callbackGas=%d gasUsed=%d ops=%d", + trace.Index, trace.CallbackGas, trace.GasUsed, len(trace.Ops)) + traces = append(traces, trace) + } + + return traces, nil +} + +// executionTraceToProto converts ExecutionTrace to ExecutionTraceProto +func executionTraceToProto(trace *ExecutionTrace) *ExecutionTraceProto { + ops := make([]*StorageOpProto, len(trace.Ops)) + for i, op := range trace.Ops { + ops[i] = &StorageOpProto{ + IsDelete: op.IsDelete, + Key: op.Key, + Value: op.Value, + } + } + crossOps := make([]*CrossModuleOpProto, len(trace.CrossOps)) + for i, cop := range trace.CrossOps { + crossOps[i] = &CrossModuleOpProto{ + StoreKey: cop.StoreKey, + Key: cop.Key, + Value: cop.Value, + IsDelete: cop.IsDelete, + } + } + return &ExecutionTraceProto{ + Index: trace.Index, + Ops: ops, + Result: trace.Result, + GasUsed: trace.GasUsed, + CallbackGas: trace.CallbackGas, + HasError: trace.HasError, + ErrorMsg: trace.ErrorMsg, + CrossOps: crossOps, + } +} + +// protoToExecutionTrace converts ExecutionTraceProto to ExecutionTrace +func protoToExecutionTrace(proto *ExecutionTraceProto) *ExecutionTrace { + ops := make([]StorageOp, len(proto.Ops)) + for i, op := range proto.Ops { + ops[i] = StorageOp{ + IsDelete: op.IsDelete, + Key: op.Key, + Value: op.Value, + } + } + crossOps := make([]CrossModuleOp, len(proto.CrossOps)) + for i, cop := range proto.CrossOps { + crossOps[i] = CrossModuleOp{ + StoreKey: cop.StoreKey, + Key: cop.Key, + Value: cop.Value, + IsDelete: cop.IsDelete, + } + } + return &ExecutionTrace{ + Index: proto.Index, + Ops: ops, + CrossOps: crossOps, + Result: proto.Result, + GasUsed: proto.GasUsed, + CallbackGas: proto.CallbackGas, + HasError: proto.HasError, + ErrorMsg: proto.ErrorMsg, + } +} + +// --- Utility functions --- + +// HasRecordForHeight checks if a record exists for a given height +func (r *EcallRecorder) HasRecordForHeight(height int64) bool { + if r.db == nil { + return false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeBlockKey(prefixSubmitBlockSignatures, height) + has, err := r.db.Has(key) + return err == nil && has +} + +// GetLatestRecordedHeight returns the highest recorded block height +func (r *EcallRecorder) GetLatestRecordedHeight() int64 { + if r.db == nil { + return 0 + } + + r.mu.RLock() + defer r.mu.RUnlock() + + // Iterate backwards to find the latest height + iter, err := r.db.ReverseIterator( + prefixSubmitBlockSignatures, + append(prefixSubmitBlockSignatures, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), + ) + if err != nil { + return 0 + } + defer iter.Close() + + if iter.Valid() { + key := iter.Key() + if len(key) == 9 { // prefix (1) + height (8) + return int64(binary.BigEndian.Uint64(key[1:])) + } + } + return 0 +} + +// DeleteRecordsBeforeHeight removes records older than the given height (for pruning) +func (r *EcallRecorder) DeleteRecordsBeforeHeight(height int64) error { + if r.db == nil { + return fmt.Errorf("database not initialized") + } + + r.mu.Lock() + defer r.mu.Unlock() + + batch := r.db.NewBatch() + defer batch.Close() + + count := 0 + + // Prune all height-keyed prefixes + for _, prefix := range [][]byte{ + prefixSubmitBlockSignatures, + prefixGetEncryptedSeed, + prefixGetEncryptedSeedErr, + prefixExecutionTrace, + prefixMachineIDProof, + prefixCreateResult, + prefixGetNetworkPubkey, + } { + startKey := makeBlockKey(prefix, 0) + endKey := makeBlockKey(prefix, height) + + iter, err := r.db.Iterator(startKey, endKey) + if err != nil { + return err + } + + for ; iter.Valid(); iter.Next() { + if err := batch.Delete(iter.Key()); err != nil { + iter.Close() + return err + } + count++ + } + iter.Close() + } + + if err := batch.Write(); err != nil { + return err + } + + if count > 0 { + logInfo("EcallRecorder", "Pruned %d records before height %d", count, height) + } + return nil +} + +// PruneOldRecords runs pruning if conditions are met (every pruneInterval) +func (r *EcallRecorder) PruneOldRecords(currentHeight int64) { + // Only prune in SGX mode (non-replay) + if r.IsReplayMode() { + return + } + + r.mu.RLock() + interval := r.pruneInterval + retention := r.retentionBlocks + r.mu.RUnlock() + + // Only prune every pruneInterval + if interval <= 0 || currentHeight%interval != 0 { + return + } + + // Calculate cutoff height + cutoffHeight := currentHeight - retention + if cutoffHeight <= 0 { + return + } + + // Run pruning in background to not block block processing + go func() { + if err := r.DeleteRecordsBeforeHeight(cutoffHeight); err != nil { + logError("EcallRecorder", "Pruning error: %v", err) + } + }() +} + +// --- Create result recording --- + +// CreateResult stores the outcome of an SGX Create call +type CreateResult struct { + CodeHash []byte // The hash returned by the enclave (empty on error) + HasError bool + ErrorMsg string +} + +// makeCreateResultKey creates a key: prefix | height (8 bytes) | wasmHash (32 bytes) +func makeCreateResultKey(height int64, wasmHash []byte) []byte { + key := make([]byte, len(prefixCreateResult)+8+len(wasmHash)) + copy(key, prefixCreateResult) + binary.BigEndian.PutUint64(key[len(prefixCreateResult):], uint64(height)) + copy(key[len(prefixCreateResult)+8:], wasmHash) + return key +} + +// RecordCreateResult records the result of an SGX Create call +func (r *EcallRecorder) RecordCreateResult(height int64, wasmHash []byte, codeHash []byte, errMsg string) error { + if r.db == nil { + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + result := &CreateResult{ + CodeHash: codeHash, + HasError: errMsg != "", + ErrorMsg: errMsg, + } + + // Simple encoding: hasError (1 byte) | errMsgLen (4 bytes) | errMsg | codeHash + var value []byte + if result.HasError { + errBytes := []byte(result.ErrorMsg) + value = make([]byte, 1+4+len(errBytes)) + value[0] = 1 + binary.BigEndian.PutUint32(value[1:5], uint32(len(errBytes))) + copy(value[5:], errBytes) + } else { + value = make([]byte, 1+len(codeHash)) + value[0] = 0 + copy(value[1:], codeHash) + } + + key := makeCreateResultKey(height, wasmHash) + if err := r.db.Set(key, value); err != nil { + return fmt.Errorf("failed to write Create result to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded Create result for height %d, hasError=%v", height, result.HasError) + return nil +} + +// ReplayCreateResult retrieves the recorded Create result +func (r *EcallRecorder) ReplayCreateResult(height int64, wasmHash []byte) (codeHash []byte, errMsg string, found bool) { + if r.db == nil { + return nil, "", false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeCreateResultKey(height, wasmHash) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, "", false + } + + if len(value) < 1 { + return nil, "", false + } + + hasError := value[0] == 1 + if hasError { + if len(value) < 5 { + return nil, "", false + } + errLen := binary.BigEndian.Uint32(value[1:5]) + if len(value) < 5+int(errLen) { + return nil, "", false + } + return nil, string(value[5 : 5+errLen]), true + } + + return value[1:], "", true +} + +// GetAllCreateResultsForBlock returns all Create results recorded for a given block height +func (r *EcallRecorder) GetAllCreateResultsForBlock(height int64) ([]*CreateResult, [][]byte, error) { + if r.db == nil { + return nil, nil, nil + } + + r.mu.RLock() + defer r.mu.RUnlock() + + // Build prefix for iteration: prefix | height + iterPrefix := make([]byte, len(prefixCreateResult)+8) + copy(iterPrefix, prefixCreateResult) + binary.BigEndian.PutUint64(iterPrefix[len(prefixCreateResult):], uint64(height)) + + var results []*CreateResult + var wasmHashes [][]byte + + // Build end key: increment the last byte of the height to get next height prefix + // IMPORTANT: Must copy to avoid mutating iterPrefix via shared backing array + iterEnd := make([]byte, len(iterPrefix)) + copy(iterEnd, iterPrefix) + iterEnd[len(iterEnd)-1]++ + + iter, err := r.db.Iterator(iterPrefix, iterEnd) + if err != nil { + return nil, nil, fmt.Errorf("failed to create iterator: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key := iter.Key() + value := iter.Value() + + // Extract wasmHash from key (after prefix + height) + wasmHash := key[len(prefixCreateResult)+8:] + wasmHashCopy := make([]byte, len(wasmHash)) + copy(wasmHashCopy, wasmHash) + wasmHashes = append(wasmHashes, wasmHashCopy) + + result := &CreateResult{} + if len(value) >= 1 && value[0] == 1 { + result.HasError = true + if len(value) >= 5 { + errLen := binary.BigEndian.Uint32(value[1:5]) + if len(value) >= 5+int(errLen) { + result.ErrorMsg = string(value[5 : 5+errLen]) + } + } + } else if len(value) >= 1 { + result.CodeHash = make([]byte, len(value)-1) + copy(result.CodeHash, value[1:]) + } + results = append(results, result) + } + + return results, wasmHashes, nil +} diff --git a/go-cosmwasm/api/ecall_record_stub.go b/go-cosmwasm/api/ecall_record_stub.go new file mode 100644 index 0000000000..26f0ed4ab2 --- /dev/null +++ b/go-cosmwasm/api/ecall_record_stub.go @@ -0,0 +1,154 @@ +//go:build secretcli +// +build secretcli + +package api + +// Stub implementations for secretcli builds (no SGX support) + +type NodeMode string + +const ( + NodeModeSGX NodeMode = "sgx" + NodeModeReplay NodeMode = "replay" +) + +// StorageOp represents a single storage operation (Set or Delete) +type StorageOp struct { + Key []byte + Value []byte + IsDelete bool +} + +// CrossModuleOp represents a write to a module store other than the contract's own prefixed store. +type CrossModuleOp struct { + StoreKey string + Key []byte + Value []byte + IsDelete bool +} + +// ExecutionTrace stores all storage operations from a contract execution +type ExecutionTrace struct { + Index int64 + Ops []StorageOp + CrossOps []CrossModuleOp + Result []byte + GasUsed uint64 + CallbackGas uint64 + HasError bool + IsOutOfGas bool + ErrorMsg string +} + +// EcallRecorder stub for secretcli +type EcallRecorder struct { + mode NodeMode +} + +var globalRecorder *EcallRecorder + +// GetRecorder returns a stub recorder for secretcli builds +func GetRecorder() *EcallRecorder { + if globalRecorder == nil { + globalRecorder = &EcallRecorder{mode: NodeModeSGX} + } + return globalRecorder +} + +func (r *EcallRecorder) Mode() NodeMode { return r.mode } +func (r *EcallRecorder) IsSGXMode() bool { return r.mode == NodeModeSGX } +func (r *EcallRecorder) IsReplayMode() bool { return r.mode == NodeModeReplay } +func (r *EcallRecorder) Close() error { return nil } +func (r *EcallRecorder) PruneOldRecords(int64) {} + +func (r *EcallRecorder) RecordSubmitBlockSignatures(height int64, random []byte, evidence []byte) error { + return nil +} + +func (r *EcallRecorder) ReplaySubmitBlockSignatures(height int64) (random []byte, evidence []byte, found bool) { + return nil, nil, false +} + +func (r *EcallRecorder) HasRecordForHeight(height int64) bool { + return false +} + +func (r *EcallRecorder) GetLatestRecordedHeight() int64 { + return 0 +} + +func (r *EcallRecorder) DeleteRecordsBeforeHeight(height int64) error { + return nil +} + +func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, output []byte) error { + return nil +} + +func (r *EcallRecorder) RecordGetEncryptedSeedError(height int64, certHash []byte, errMsg string) error { + return nil +} + +func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (output []byte, errMsg string, found bool) { + return nil, "", false +} + +func (r *EcallRecorder) RecordMachineIDProof(height int64, machineID []byte, proof []byte) error { + return nil +} + +func (r *EcallRecorder) ReplayMachineIDProof(height int64, machineID []byte) (proof []byte, found bool) { + return nil, false +} + +func (r *EcallRecorder) RecordExecutionTrace(height int64, index int64, trace *ExecutionTrace) error { + return nil +} + +func (r *EcallRecorder) ReplayExecutionTrace(height int64, index int64) (*ExecutionTrace, bool) { + return nil, false +} + +func (r *EcallRecorder) GetAllTracesForBlock(height int64) ([]*ExecutionTrace, error) { + return nil, nil +} + +// Block-scoped execution tracking stubs +func (r *EcallRecorder) StartBlock(height int64) {} +func (r *EcallRecorder) NextExecutionIndex() int64 { return 0 } +func (r *EcallRecorder) GetCurrentBlockHeight() int64 { return 0 } +func (r *EcallRecorder) SetBlockTraces(traces []*ExecutionTrace) {} +func (r *EcallRecorder) GetTraceFromMemory(index int64) (*ExecutionTrace, bool) { return nil, false } + +// Cross-module ops stubs +func (r *EcallRecorder) SetPendingCrossModuleOps(ops []CrossModuleOp) {} +func (r *EcallRecorder) AppendCrossModuleOp(op CrossModuleOp) {} +func (r *EcallRecorder) GetAndClearPendingCrossModuleOps() []CrossModuleOp { return nil } + +// CreateResult stores the outcome of an SGX Create call +type CreateResult struct { + CodeHash []byte + HasError bool + ErrorMsg string +} + +// Create result recording stubs +func (r *EcallRecorder) RecordCreateResult(height int64, wasmHash []byte, codeHash []byte, errMsg string) error { + return nil +} + +func (r *EcallRecorder) ReplayCreateResult(height int64, wasmHash []byte) (codeHash []byte, errMsg string, found bool) { + return nil, "", false +} + +func (r *EcallRecorder) GetAllCreateResultsForBlock(height int64) ([]*CreateResult, [][]byte, error) { + return nil, nil, nil +} + +func (r *EcallRecorder) RecordGetNetworkPubkey(height int64, iSeed uint32, nodePk, ioPk []byte) error { + return nil +} + +func (r *EcallRecorder) ReplayGetNetworkPubkey(height int64, iSeed uint32) ([]byte, []byte, bool) { + return nil, nil, false +} diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index bd6e57c235..bdecd433a0 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -1,5 +1,5 @@ -//go:build !secretcli -// +build !secretcli +//go:build !secretcli && !nosgx +// +build !secretcli,!nosgx package api @@ -8,6 +8,8 @@ package api import "C" import ( + "crypto/sha256" + "encoding/hex" "errors" "fmt" "runtime" @@ -38,6 +40,10 @@ type Cache struct { } func HealthCheck() ([]byte, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + return []byte("replay"), nil + } errmsg := C.Buffer{} res, err := C.get_health_check(&errmsg) @@ -48,6 +54,10 @@ func HealthCheck() ([]byte, error) { } func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte /* valSet []byte, nextValSet []byte */) ([]byte, []byte, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + return nil, nil, errors.New("submit block signatures not supported on non-SGX node") + } errmsg := C.Buffer{} spidSlice := sendSlice(header) defer freeAfterSend(spidSlice) @@ -66,6 +76,11 @@ func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom [ } func SubmitValidatorSetEvidence(evidence []byte) error { + recorder := GetRecorder() + if recorder.IsReplayMode() { + logInfo("SubmitValidatorSetEvidence", "Skipped in replay mode") + return nil + } errmsg := C.Buffer{} evidenceSlice := sendSlice(evidence) defer freeAfterSend(evidenceSlice) @@ -74,6 +89,13 @@ func SubmitValidatorSetEvidence(evidence []byte) error { } func InitBootstrap() ([]byte, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, return a dummy 32-byte public key + // This function is only called during bootstrap which doesn't happen in replay + logInfo("InitBootstrap", "Skipped in replay mode") + return make([]byte, 32), nil + } errmsg := C.Buffer{} res, err := C.init_bootstrap(&errmsg) if err != nil { @@ -83,6 +105,12 @@ func InitBootstrap() ([]byte, error) { } func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, skip loading seed to enclave (no enclave) + logInfo("LoadSeedToEnclave", "Skipped in replay mode") + return true, nil + } pkSlice := sendSlice(masterKey) defer freeAfterSend(pkSlice) seedSlice := sendSlice(seed) @@ -97,6 +125,11 @@ func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { } func RotateStore(kvs []byte) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + logInfo("RotateStore", "Skipped in replay mode") + return false, errors.New("rotate store not supported on non-SGX node") + } // avoid buffer copy. We need modification in-place kvSlice := C.Buffer{ ptr: (*C.uint8_t)(unsafe.Pointer(&kvs[0])), @@ -115,6 +148,11 @@ func RotateStore(kvs []byte) (bool, error) { } func MigrationOp(op uint32) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + logInfo("MigrationOp", "Skipped in replay mode") + return true, nil // no-op success so upgrade handlers don't fail + } ret, err := C.migration_op(u32(op)) if err != nil { return false, err @@ -126,11 +164,31 @@ func MigrationOp(op uint32) (bool, error) { } func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + + if recorder.IsReplayMode() { + nodePk, ioPk, err := GetEcallClient().FetchNetworkPubkey(height, i_seed) + if err != nil { + logError("GetNetworkPubkey", "Failed to fetch on replay: %v", err) + return nil, nil + } + return nodePk, ioPk + } + res := C.get_network_pubkey(u32(i_seed)) - return receiveVector(res.buf1), receiveVector(res.buf2) + nodePk := receiveVector(res.buf1) + ioPk := receiveVector(res.buf2) + + _ = recorder.RecordGetNetworkPubkey(height, i_seed, nodePk, ioPk) + return nodePk, ioPk } func EmergencyApproveUpgrade(nodeDir string, msg string) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + return false, errors.New("emergency approve upgrade not supported on non-SGX node") + } nodeDirBuf := sendSlice([]byte(nodeDir)) defer freeAfterSend(nodeDirBuf) @@ -168,6 +226,13 @@ func ReleaseCache(cache Cache) { } func InitEnclaveRuntime(moduleCacheSize uint16) error { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, skip enclave runtime initialization (no enclave) + logInfo("InitEnclaveRuntime", "Skipped in replay mode") + return nil + } + errmsg := C.Buffer{} config := C.EnclaveRuntimeConfig{ @@ -182,6 +247,11 @@ func InitEnclaveRuntime(moduleCacheSize uint16) error { } func OnUpgradeProposalPassed(mrEnclaveHash []byte) error { + recorder := GetRecorder() + if recorder.IsReplayMode() { + logInfo("OnUpgradeProposalPassed", "Skipped in replay mode") + return nil + } msgBuf := sendSlice(mrEnclaveHash) defer freeAfterSend(msgBuf) @@ -208,6 +278,17 @@ func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) err return errors.New("onchain_approve_machine_id failed") } + recorder := GetRecorder() + if recorder.IsSGXMode() { + height := recorder.GetCurrentBlockHeight() + machineIDHex := hex.EncodeToString(machineID) + if recErr := recorder.RecordMachineIDProof(height, []byte(machineIDHex), proof[:]); recErr != nil { + logError("OnApproveMachineID", "Failed to record machine ID proof for replay: %v", recErr) + } else { + logInfo("OnApproveMachineID", "Recorded MachineIDProof for %s at height %d", machineIDHex, height) + } + } + return nil } @@ -216,10 +297,27 @@ func Create(cache Cache, wasm []byte) ([]byte, error) { defer freeAfterSend(code) errmsg := C.Buffer{} id, err := C.create(cache.ptr, code, &errmsg) + + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + if err != nil { - return nil, errorWithMessage(err, errmsg) - } - return receiveVector(id), nil + createErr := errorWithMessage(err, errmsg) + // Record the failure so non-SGX nodes can replay it + wasmHash := sha256.Sum256(wasm) + if recErr := recorder.RecordCreateResult(height, wasmHash[:], nil, createErr.Error()); recErr != nil { + logError("Create", "Failed to record Create error: %v", recErr) + } + return nil, createErr + } + + codeHash := receiveVector(id) + // Record the success + wasmHash := sha256.Sum256(wasm) + if recErr := recorder.RecordCreateResult(height, wasmHash[:], codeHash, ""); recErr != nil { + logError("Create", "Failed to record Create result: %v", recErr) + } + return codeHash, nil } func GetCode(cache Cache, code_id []byte) ([]byte, error) { @@ -247,6 +345,25 @@ func Migrate( admin []byte, adminProof []byte, ) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + if recorder.IsReplayMode() { + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + return result, gas, err + } + return nil, 0, fmt.Errorf("Migrate replay failed: trace not found for height %d index %d", height, execIndex) + } + + recording := recorder.IsSGXMode() + var recordingStore *RecordingKVStore + var storeForDB KVStore = store + if recording { + recordingStore = NewRecordingKVStore(store) + storeForDB = recordingStore + } + id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) @@ -258,7 +375,7 @@ func Migrate( counter := startContract() defer endContract(counter) - dbState := buildDBState(store, counter) + dbState := buildDBState(storeForDB, counter) db := buildDB(&dbState, gasMeter) s := sendSlice(sigInfo) @@ -274,17 +391,62 @@ func Migrate( adminProofBuffer := sendSlice(adminProof) defer freeAfterSend(adminProofBuffer) - //// This is done in order to ensure that goroutines don't - //// swap threads between recursive calls to the enclave. - //runtime.LockOSThread() - //defer runtime.UnlockOSThread() + // Capture gas before execution to measure callback gas + var gasBefore uint64 + if recording && gasMeter != nil { + gasBefore = (*gasMeter).GasConsumed() + } res, err := C.migrate(cache.ptr, id, p, m, db, a, q, u64(gasLimit), &gasUsed, &errmsg, s, adminBuffer, adminProofBuffer) - if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { - // Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0. - return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + + if !recording { + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + } + return receiveVector(res), uint64(gasUsed), nil } - return receiveVector(res), uint64(gasUsed), nil + + // Calculate callback gas consumed during execution + var callbackGas uint64 + if gasMeter != nil { + gasAfter := (*gasMeter).GasConsumed() + callbackGas = gasAfter - gasBefore + } + + // Record the execution trace + trace := &ExecutionTrace{ + Index: execIndex, + Ops: recordingStore.GetOps(), + CrossOps: recorder.GetAndClearPendingCrossModuleOps(), + GasUsed: uint64(gasUsed), + CallbackGas: callbackGas, + } + + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + trace.HasError = true + errorMsgBytes := receiveVector(errmsg) + trace.ErrorMsg = string(errorMsgBytes) + if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 { + trace.IsOutOfGas = true + } + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Migrate", "Failed to record trace: %v", recordErr) + } + if trace.IsOutOfGas { + return nil, uint64(gasUsed), types.OutOfGasError{} + } + if errorMsgBytes == nil { + return nil, uint64(gasUsed), err + } + return nil, uint64(gasUsed), fmt.Errorf("%s", string(errorMsgBytes)) + } + + trace.Result = receiveVector(res) + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Migrate", "Failed to record trace: %v", recordErr) + } + + return trace.Result, uint64(gasUsed), nil } func UpdateAdmin( @@ -301,16 +463,34 @@ func UpdateAdmin( currentAdminProof []byte, newAdmin []byte, ) ([]byte, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + if recorder.IsReplayMode() { + if result, _, err, found := replayExecution(store, gasMeter, execIndex); found { + return result, err + } + return nil, fmt.Errorf("UpdateAdmin replay failed: trace not found for height %d index %d", height, execIndex) + } + + recording := recorder.IsSGXMode() + var recordingStore *RecordingKVStore + var storeForDB KVStore = store + if recording { + recordingStore = NewRecordingKVStore(store) + storeForDB = recordingStore + } + id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) defer freeAfterSend(p) - // set up a new stack frame to handle iterators counter := startContract() defer endContract(counter) - dbState := buildDBState(store, counter) + dbState := buildDBState(storeForDB, counter) db := buildDB(&dbState, gasMeter) s := sendSlice(sigInfo) @@ -328,16 +508,61 @@ func UpdateAdmin( newAdminBuffer := sendSlice(newAdmin) defer freeAfterSend(newAdminBuffer) - //// This is done in order to ensure that goroutines don't - //// swap threads between recursive calls to the enclave. - //runtime.LockOSThread() - //defer runtime.UnlockOSThread() + var gasBefore uint64 + if recording && gasMeter != nil { + gasBefore = (*gasMeter).GasConsumed() + } res, err := C.update_admin(cache.ptr, id, p, db, a, q, u64(gasLimit), &errmsg, s, currentAdminBuffer, currentAdminProofBuffer, newAdminBuffer) - if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { - return nil, errorWithMessage(err, errmsg) + + if !recording { + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + return nil, errorWithMessage(err, errmsg) + } + return receiveVector(res), nil } - return receiveVector(res), nil + + // Calculate callback gas consumed during execution + var callbackGas uint64 + if gasMeter != nil { + gasAfter := (*gasMeter).GasConsumed() + callbackGas = gasAfter - gasBefore + } + + // Record the execution trace + trace := &ExecutionTrace{ + Index: execIndex, + Ops: recordingStore.GetOps(), + CrossOps: recorder.GetAndClearPendingCrossModuleOps(), + GasUsed: 0, // UpdateAdmin doesn't return gas used + CallbackGas: callbackGas, + } + + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + trace.HasError = true + errorMsgBytes := receiveVector(errmsg) + trace.ErrorMsg = string(errorMsgBytes) + if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 { + trace.IsOutOfGas = true + } + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("UpdateAdmin", "Failed to record trace: %v", recordErr) + } + if trace.IsOutOfGas { + return nil, types.OutOfGasError{} + } + if errorMsgBytes == nil { + return nil, err + } + return nil, fmt.Errorf("%s", string(errorMsgBytes)) + } + + trace.Result = receiveVector(res) + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("UpdateAdmin", "Failed to record trace: %v", recordErr) + } + + return trace.Result, nil } func Instantiate( @@ -353,6 +578,28 @@ func Instantiate( sigInfo []byte, admin []byte, ) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + if recorder.IsReplayMode() { + logDebug("Instantiate", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Instantiate", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Instantiate", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Instantiate replay failed: trace not found for height %d index %d", height, execIndex) + } + + recording := recorder.IsSGXMode() + var recordingStore *RecordingKVStore + var storeForDB KVStore = store + if recording { + recordingStore = NewRecordingKVStore(store) + storeForDB = recordingStore + } + id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) @@ -364,7 +611,7 @@ func Instantiate( counter := startContract() defer endContract(counter) - dbState := buildDBState(store, counter) + dbState := buildDBState(storeForDB, counter) db := buildDB(&dbState, gasMeter) s := sendSlice(sigInfo) @@ -377,17 +624,71 @@ func Instantiate( adminBuffer := sendSlice(admin) defer freeAfterSend(adminBuffer) - //// This is done in order to ensure that goroutines don't - //// swap threads between recursive calls to the enclave. - //runtime.LockOSThread() - //defer runtime.UnlockOSThread() + // Capture gas before execution to measure callback gas + var gasBefore uint64 + if recording && gasMeter != nil { + gasBefore = (*gasMeter).GasConsumed() + logDebug("Instantiate", "SGX gasBefore=%d", gasBefore) + } res, err := C.instantiate(cache.ptr, id, p, m, db, a, q, u64(gasLimit), &gasUsed, &errmsg, s, adminBuffer) - if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { - // Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0. - return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + + if !recording { + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + } + return receiveVector(res), uint64(gasUsed), nil } - return receiveVector(res), uint64(gasUsed), nil + + // Calculate callback gas consumed during execution + var callbackGas uint64 + if gasMeter != nil { + gasAfter := (*gasMeter).GasConsumed() + callbackGas = gasAfter - gasBefore + logDebug("Instantiate", "SGX gasAfter=%d callbackGas=%d (gasAfter - gasBefore)", gasAfter, callbackGas) + } else { + logWarn("Instantiate", "SGX WARNING: gasMeter is nil, cannot measure callbackGas") + } + + logDebug("Instantiate", "SGX C.instantiate returned: gasUsed=%d callbackGas=%d", gasUsed, callbackGas) + + // Record the execution trace + trace := &ExecutionTrace{ + Index: execIndex, + Ops: recordingStore.GetOps(), + CrossOps: recorder.GetAndClearPendingCrossModuleOps(), + GasUsed: uint64(gasUsed), + CallbackGas: callbackGas, + } + + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + trace.HasError = true + errorMsgBytes := receiveVector(errmsg) + trace.ErrorMsg = string(errorMsgBytes) + if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 { + trace.IsOutOfGas = true + } + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Instantiate", "Failed to record trace: %v", recordErr) + } + if trace.IsOutOfGas { + return nil, uint64(gasUsed), types.OutOfGasError{} + } + if errorMsgBytes == nil { + return nil, uint64(gasUsed), err + } + return nil, uint64(gasUsed), fmt.Errorf("%s", string(errorMsgBytes)) + } + + trace.Result = receiveVector(res) + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Instantiate", "Failed to record trace: %v", recordErr) + } else { + logDebug("Instantiate", "SGX recorded trace: height=%d index=%d ops=%d resultLen=%d gasUsed=%d callbackGas=%d", + height, execIndex, len(trace.Ops), len(trace.Result), trace.GasUsed, trace.CallbackGas) + } + + return trace.Result, uint64(gasUsed), nil } func Handle( @@ -403,6 +704,28 @@ func Handle( sigInfo []byte, handleType types.HandleType, ) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + if recorder.IsReplayMode() { + logDebug("Handle", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Handle", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Handle", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Handle replay failed: trace not found for height %d index %d", height, execIndex) + } + + recording := recorder.IsSGXMode() + var recordingStore *RecordingKVStore + var storeForDB KVStore = store + if recording { + recordingStore = NewRecordingKVStore(store) + storeForDB = recordingStore + } + id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) @@ -414,7 +737,7 @@ func Handle( counter := startContract() defer endContract(counter) - dbState := buildDBState(store, counter) + dbState := buildDBState(storeForDB, counter) db := buildDB(&dbState, gasMeter) s := sendSlice(sigInfo) defer freeAfterSend(s) @@ -423,17 +746,71 @@ func Handle( var gasUsed u64 errmsg := C.Buffer{} - //// This is done in order to ensure that goroutines don't - //// swap threads between recursive calls to the enclave. - //runtime.LockOSThread() - //defer runtime.UnlockOSThread() + // Capture gas before execution to measure callback gas + var gasBefore uint64 + if recording && gasMeter != nil { + gasBefore = (*gasMeter).GasConsumed() + logDebug("Handle", "SGX gasBefore=%d", gasBefore) + } res, err := C.handle(cache.ptr, id, p, m, db, a, q, u64(gasLimit), &gasUsed, &errmsg, s, u8(handleType)) - if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { - // Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0. - return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + + if !recording { + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + } + return receiveVector(res), uint64(gasUsed), nil } - return receiveVector(res), uint64(gasUsed), nil + + // Calculate callback gas consumed during execution + var callbackGas uint64 + if gasMeter != nil { + gasAfter := (*gasMeter).GasConsumed() + callbackGas = gasAfter - gasBefore + logDebug("Handle", "SGX gasAfter=%d callbackGas=%d (gasAfter - gasBefore)", gasAfter, callbackGas) + } else { + logWarn("Handle", "SGX WARNING: gasMeter is nil, cannot measure callbackGas") + } + + logDebug("Handle", "SGX C.handle returned: gasUsed=%d callbackGas=%d", gasUsed, callbackGas) + + // Record the execution trace + trace := &ExecutionTrace{ + Index: execIndex, + Ops: recordingStore.GetOps(), + CrossOps: recorder.GetAndClearPendingCrossModuleOps(), + GasUsed: uint64(gasUsed), + CallbackGas: callbackGas, + } + + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + trace.HasError = true + errorMsgBytes := receiveVector(errmsg) + trace.ErrorMsg = string(errorMsgBytes) + if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 { + trace.IsOutOfGas = true + } + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Handle", "Failed to record trace: %v", recordErr) + } + if trace.IsOutOfGas { + return nil, uint64(gasUsed), types.OutOfGasError{} + } + if errorMsgBytes == nil { + return nil, uint64(gasUsed), err + } + return nil, uint64(gasUsed), fmt.Errorf("%s", string(errorMsgBytes)) + } + + trace.Result = receiveVector(res) + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Handle", "Failed to record trace: %v", recordErr) + } else { + logDebug("Handle", "SGX recorded trace: height=%d index=%d ops=%d resultLen=%d gasUsed=%d callbackGas=%d", + height, execIndex, len(trace.Ops), len(trace.Result), trace.GasUsed, trace.CallbackGas) + } + + return trace.Result, uint64(gasUsed), nil } func Query( @@ -447,6 +824,10 @@ func Query( querier *Querier, gasLimit uint64, ) ([]byte, uint64, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + return nil, 0, errors.New("secret contract query not supported on non-SGX node") + } id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) @@ -498,6 +879,14 @@ func AnalyzeCode( // KeyGen Send KeyGen request to enclave func KeyGen() ([]byte, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, return a dummy 32-byte public key + // Key generation is only needed for node registration which doesn't happen in replay + logInfo("KeyGen", "Skipped in replay mode, returning dummy key") + return make([]byte, 32), nil + } + errmsg := C.Buffer{} res, err := C.key_gen(&errmsg) if err != nil { @@ -508,6 +897,12 @@ func KeyGen() ([]byte, error) { // CreateAttestationReport Send request to enclave func CreateAttestationReport(is_migration_report bool) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, skip attestation report creation (no SGX) + logInfo("CreateAttestationReport", "Skipped in replay mode") + return true, nil + } errmsg := C.Buffer{} flags := u32(0) @@ -523,17 +918,72 @@ func CreateAttestationReport(is_migration_report bool) (bool, error) { } func GetEncryptedSeed(cert []byte) ([]byte, error) { + recorder := GetRecorder() + certHash := sha256.Sum256(cert) + certHashHex := hex.EncodeToString(certHash[:]) + + logInfo("GetEncryptedSeed", "SGX called: certHashHex=%s certLen=%d replayMode=%v", + certHashHex, len(cert), recorder.IsReplayMode()) + + if recorder.IsReplayMode() { + // Try local DB first + height := recorder.GetCurrentBlockHeight() + if output, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { + if errMsg != "" { + // Replay the exact same error the SGX enclave produced + return nil, fmt.Errorf("%s", errMsg) + } + return output, nil + } + + // Fetch from remote SGX node + client := GetEcallClient() + output, err := client.FetchEncryptedSeed(height, certHashHex) + if err != nil { + return nil, fmt.Errorf("GetEncryptedSeed replay failed: %w", err) + } + + // Cache locally + if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], output); cacheErr != nil { + logError("GetEncryptedSeed", "Failed to cache: %v", cacheErr) + } + return output, nil + } + + // SGX mode: call enclave and record result errmsg := C.Buffer{} certSlice := sendSlice(cert) defer freeAfterSend(certSlice) res, err := C.get_encrypted_seed(certSlice, &errmsg) if err != nil { - return nil, errorWithMessage(err, errmsg) - } - return receiveVector(res), nil + enclaveErr := errorWithMessage(err, errmsg) + logInfo("GetEncryptedSeed", "SGX enclave FAILED for %s: %v", certHashHex, enclaveErr) + // Record the error so non-SGX nodes can replay the exact same message + height := recorder.GetCurrentBlockHeight() + if recErr := recorder.RecordGetEncryptedSeedError(height, certHash[:], enclaveErr.Error()); recErr != nil { + logError("GetEncryptedSeed", "Failed to record error: %v", recErr) + } + return nil, enclaveErr + } + + output := receiveVector(res) + height := recorder.GetCurrentBlockHeight() + logInfo("GetEncryptedSeed", "SGX enclave SUCCESS for %s (%d bytes), recording at height %d...", certHashHex, len(output), height) + if err := recorder.RecordGetEncryptedSeed(height, certHash[:], output); err != nil { + logError("GetEncryptedSeed", "Failed to record: %v", err) + } else { + logInfo("GetEncryptedSeed", "Recorded GetEncryptedSeed for %s OK", certHashHex) + } + return output, nil } func GetEncryptedGenesisSeed(pk []byte) ([]byte, error) { + // Genesis seed is only used during bootstrap of a new network. + // Non-SGX replay nodes don't need this - they sync from existing networks. + recorder := GetRecorder() + if recorder.IsReplayMode() { + return nil, errors.New("get encrypted genesis seed not supported on non-SGX node") + } errmsg := C.Buffer{} pkSlice := sendSlice(pk) defer freeAfterSend(pkSlice) diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go new file mode 100644 index 0000000000..9e19d91490 --- /dev/null +++ b/go-cosmwasm/api/lib_nosgx.go @@ -0,0 +1,433 @@ +//go:build !secretcli && nosgx + +package api + +import ( + "bytes" + "crypto/sha256" + "encoding/hex" + "errors" + "fmt" + "time" + + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types" + v1types "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types/v1" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type Cache struct{} + +func HealthCheck() ([]byte, error) { + return []byte("replay"), nil +} + +func InitBootstrap() ([]byte, error) { + return nil, nil +} + +func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte) ([]byte, []byte, error) { + return nil, nil, errors.New("submit block signatures not supported on non-SGX node") +} + +func SubmitValidatorSetEvidence(evidence []byte) error { + logInfo("SubmitValidatorSetEvidence", "Skipped in replay mode") + return nil +} + +func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { + return true, nil +} + +type Querier = types.Querier + +func MigrationOp(op uint32) (bool, error) { + logInfo("MigrationOp", "Skipped in replay mode") + return true, nil // no-op success so upgrade handlers don't fail +} + +func RotateStore(kvs []byte) (bool, error) { + return false, errors.New("RotateStore not supported on non-SGX node") +} + +func EmergencyApproveUpgrade(nodeDir string, msg string) (bool, error) { + return false, errors.New("EmergencyApproveUpgrade not supported on non-SGX node") +} + +func InitCache(dataDir string, supportedFeatures string, cacheSize uint64) (Cache, error) { + return Cache{}, nil +} + +func ReleaseCache(cache Cache) { +} + +func InitEnclaveRuntime(ModuleCacheSize uint16) error { + return nil +} + +func Create(cache Cache, wasm []byte) ([]byte, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + wasmHash := sha256.Sum256(wasm) + + // Attempt to replay recorded Create result from SGX node + if recorder.IsReplayMode() { + codeHash, errMsg, found := recorder.ReplayCreateResult(height, wasmHash[:]) + if found { + if errMsg != "" { + return nil, fmt.Errorf("%s", errMsg) + } + return codeHash, nil + } + + // Not found locally — fetch all Create results for this block from remote SGX node + client := GetEcallClient() + retryDelay := 2 * time.Second + attempt := 0 + + for { + if client != nil && client.IsConnected() { + results, wasmHashes, err := client.FetchBlockCreateResults(height) + if err == nil && len(results) > 0 { + // Match wasmHash directly from fetched results (no DB round-trip needed) + for i, fetchedHash := range wasmHashes { + if bytes.Equal(fetchedHash, wasmHash[:]) { + r := results[i] + logInfo("Create", "Matched Create result from SGX node: height=%d hasError=%v (attempt %d)", height, r.HasError, attempt+1) + if r.HasError { + return nil, fmt.Errorf("%s", r.ErrorMsg) + } + return r.CodeHash, nil + } + } + } + } + + attempt++ + if attempt%15 == 1 { // Log every ~30 seconds + logWarn("Create", "Waiting for SGX node Create result: height=%d wasmHash=%x attempt=%d", height, wasmHash[:8], attempt) + } + time.Sleep(retryDelay) + } + } + + // Non-replay mode (e.g. secretcli): no enclave available, use sha256 of wasm + return wasmHash[:], nil +} + +func GetCode(cache Cache, code_id []byte) ([]byte, error) { + return nil, errors.New("GetCode is not supported on non-SGX node") +} + +func Migrate( + cache Cache, + code_id []byte, + params []byte, + msg []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, + sigInfo []byte, + admin []byte, + adminProof []byte, +) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + logDebug("Migrate", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Migrate", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Migrate", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Migrate replay failed: trace not found for height %d index %d", height, execIndex) +} + +func UpdateAdmin( + cache Cache, + code_id []byte, + params []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, + sigInfo []byte, + currentAdmin []byte, + currentAdminProof []byte, + newAdmin []byte, +) ([]byte, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + logDebug("UpdateAdmin", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("UpdateAdmin", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, err + } + logWarn("UpdateAdmin", "REPLAY FAILED: trace not found!") + return nil, fmt.Errorf("UpdateAdmin replay failed: trace not found for height %d index %d", height, execIndex) +} + +func Instantiate( + cache Cache, + code_id []byte, + params []byte, + msg []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, + sigInfo []byte, + admin []byte, +) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + logDebug("Instantiate", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Instantiate", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Instantiate", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Instantiate replay failed: trace not found for height %d index %d", height, execIndex) +} + +func Handle( + cache Cache, + code_id []byte, + params []byte, + msg []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, + sigInfo []byte, + handleType types.HandleType, +) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + logDebug("Handle", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Handle", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Handle", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Handle replay failed: trace not found for height %d index %d", height, execIndex) +} + +func Query( + cache Cache, + code_id []byte, + params []byte, + msg []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, +) ([]byte, uint64, error) { + return nil, 0, errors.New("Query not supported on non-SGX node") +} + +func AnalyzeCode( + cache Cache, + codeHash []byte, +) (*v1types.AnalysisReport, error) { + // Fetch the AnalyzeCode result from the SGX node via gRPC. + // This is needed because non-SGX nodes don't have the enclave to analyze WASM bytecode, + // but must know whether a contract has IBC entry points to register the correct IBC port. + // This flag directly affects state (IBC port creation), so we MUST retry and fail loudly. + client := GetEcallClient() + maxRetries := 20 + retryDelay := 50 * time.Millisecond + maxDelay := 2 * time.Second + var lastErr error + + for attempt := 0; attempt < maxRetries; attempt++ { + hasIBC, features, err := client.FetchAnalyzeCode(codeHash) + if err == nil { + logDebug("AnalyzeCode", "Fetched AnalyzeCode for %s: hasIBC=%v features=%s", hex.EncodeToString(codeHash), hasIBC, features) + return &v1types.AnalysisReport{ + HasIBCEntryPoints: hasIBC, + RequiredFeatures: features, + }, nil + } + lastErr = err + if attempt < maxRetries-1 { + delay := retryDelay * time.Duration(1< maxDelay { + delay = maxDelay + } + time.Sleep(delay) + } + } + return nil, fmt.Errorf("AnalyzeCode: failed after %d retries for code hash %s: %v", maxRetries, hex.EncodeToString(codeHash), lastErr) +} + +func KeyGen() ([]byte, error) { + logInfo("KeyGen", "Skipped in replay mode, returning dummy key") + return make([]byte, 32), nil +} + +func CreateAttestationReport(is_migration_report bool) (bool, error) { + logInfo("CreateAttestationReport", "Skipped in replay mode") + return true, nil +} + +func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + + nodePk, ioPk, err := GetEcallClient().FetchNetworkPubkey(height, i_seed) + if err != nil { + logError("GetNetworkPubkey", "Failed to fetch on replay: %v", err) + return nil, nil + } + return nodePk, ioPk +} + +func GetEncryptedSeed(cert []byte) ([]byte, error) { + recorder := GetRecorder() + certHash := sha256.Sum256(cert) + certHashHex := hex.EncodeToString(certHash[:]) + + logInfo("GetEncryptedSeed", "NON-SGX called: certHashHex=%s certLen=%d dbInitialized=%v", + certHashHex, len(cert), recorder != nil && recorder.db != nil) + + height := recorder.GetCurrentBlockHeight() + + // Try local DB first + if output, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { + if errMsg != "" { + logInfo("GetEncryptedSeed", "Found CACHED ERROR in local DB for %s: %s", certHashHex, errMsg) + return nil, fmt.Errorf("%s", errMsg) + } + logInfo("GetEncryptedSeed", "Found CACHED SUCCESS in local DB for %s (%d bytes)", certHashHex, len(output)) + return output, nil + } + logInfo("GetEncryptedSeed", "NOT in local DB for %s, will fetch from SGX node via gRPC", certHashHex) + + // Fetch from remote SGX node with retries (the SGX node may still be + // processing the same block and recording the seed when we query) + client := GetEcallClient() + maxRetries := 20 + retryDelay := 50 * time.Millisecond + maxDelay := 2 * time.Second + + var lastErr error + for attempt := 0; attempt < maxRetries; attempt++ { + output, err := client.FetchEncryptedSeed(height, certHashHex) + if err == nil { + logInfo("GetEncryptedSeed", "Fetched seed from SGX node (attempt %d) for %s (%d bytes)", + attempt+1, certHashHex, len(output)) + // Cache locally + if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], output); cacheErr != nil { + logError("GetEncryptedSeed", "Failed to cache: %v", cacheErr) + } + return output, nil + } + + // Extract gRPC status for logging + grpcCode := "unknown" + grpcMsg := err.Error() + if st, ok := status.FromError(err); ok { + grpcCode = st.Code().String() + grpcMsg = st.Message() + } + + logInfo("GetEncryptedSeed", "gRPC attempt %d/%d for %s: code=%s msg=%s", + attempt+1, maxRetries, certHashHex, grpcCode, grpcMsg) + + // Check if this is a FailedPrecondition error (recorded error from SGX node) + if st, ok := status.FromError(err); ok && st.Code() == codes.FailedPrecondition { + // The SGX node recorded the enclave error - cache and replay it + enclaveErrMsg := st.Message() + logInfo("GetEncryptedSeed", "SGX node returned FailedPrecondition (enclave error) for %s: %s", + certHashHex, enclaveErrMsg) + if cacheErr := recorder.RecordGetEncryptedSeedError(height, certHash[:], enclaveErrMsg); cacheErr != nil { + logError("GetEncryptedSeed", "Failed to cache error: %v", cacheErr) + } + return nil, fmt.Errorf("%s", enclaveErrMsg) + } + + lastErr = err + + // For NotFound, the SGX node may not have recorded yet — retry + if st, ok := status.FromError(err); ok && st.Code() == codes.NotFound { + if attempt < maxRetries-1 { + time.Sleep(retryDelay) + retryDelay *= 2 + if retryDelay > maxDelay { + retryDelay = maxDelay + } + } + continue + } + + // For other errors (connection issues etc.), also retry + if attempt < maxRetries-1 { + time.Sleep(retryDelay) + retryDelay *= 2 + if retryDelay > maxDelay { + retryDelay = maxDelay + } + } + } + + logError("GetEncryptedSeed", "EXHAUSTED all %d retries for %s. lastErr: %v", maxRetries, certHashHex, lastErr) + return nil, fmt.Errorf("GetEncryptedSeed: failed after %d retries for cert hash %s: %v", maxRetries, certHashHex, lastErr) +} + +func GetEncryptedGenesisSeed(cert []byte) ([]byte, error) { + return nil, errors.New("GetEncryptedGenesisSeed not supported on non-SGX node") +} + +func OnUpgradeProposalPassed(mrEnclaveHash []byte) error { + return nil +} + +func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) error { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + + machineIDHex := fmt.Sprintf("%x", machineID) + + // During node init (height=0), keeper loads stored proofs from state. + // On SGX nodes this loads them into the enclave; on non-SGX there's + // no enclave, so just skip — the proof already lives in the KV store. + if height == 0 { + logInfo("OnApproveMachineID", "Skipping at init (height=0, no enclave on non-SGX)") + return nil + } + + // Non-SGX nodes always fetch from the SGX node via gRPC + client := GetEcallClient() + retryDelay := 2 * time.Second + attempt := 0 + + for { + data, err := client.FetchMachineIDProof(height, machineIDHex) + if err == nil && len(data) > 0 { + logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) + copy(proof[:], data) + return nil + } + + attempt++ + if attempt%15 == 1 { // Log every ~30 seconds + logWarn("OnApproveMachineID", "Waiting for SGX node proof: height=%d machineID=%s attempt=%d err=%v", height, machineIDHex, attempt, err) + } + time.Sleep(retryDelay) + } +} diff --git a/go-cosmwasm/api/link_muslc.go b/go-cosmwasm/api/link_muslc.go index b829c62d11..dc2ffe043c 100644 --- a/go-cosmwasm/api/link_muslc.go +++ b/go-cosmwasm/api/link_muslc.go @@ -1,5 +1,5 @@ -//go:build linux && muslc -// +build linux,muslc +//go:build linux && muslc && !nosgx +// +build linux,muslc,!nosgx package api diff --git a/go-cosmwasm/api/link_std.go b/go-cosmwasm/api/link_std.go index f01a64ecbd..9538b42ee7 100644 --- a/go-cosmwasm/api/link_std.go +++ b/go-cosmwasm/api/link_std.go @@ -1,5 +1,5 @@ -//go:build !secretcli && linux && !muslc && !darwin && sgx -// +build !secretcli,linux,!muslc,!darwin,sgx +//go:build !secretcli && linux && !muslc && !darwin && sgx && !nosgx +// +build !secretcli,linux,!muslc,!darwin,sgx,!nosgx package api diff --git a/go-cosmwasm/api/link_std_sw.go b/go-cosmwasm/api/link_std_sw.go index 0a60f6608f..d749c8ecf9 100644 --- a/go-cosmwasm/api/link_std_sw.go +++ b/go-cosmwasm/api/link_std_sw.go @@ -1,5 +1,5 @@ -//go:build !secretcli && linux && !muslc && !darwin && !sgx -// +build !secretcli,linux,!muslc,!darwin,!sgx +//go:build !secretcli && linux && !muslc && !darwin && !sgx && !nosgx +// +build !secretcli,linux,!muslc,!darwin,!sgx,!nosgx package api diff --git a/go-cosmwasm/api/logger.go b/go-cosmwasm/api/logger.go new file mode 100644 index 0000000000..492c793b24 --- /dev/null +++ b/go-cosmwasm/api/logger.go @@ -0,0 +1,92 @@ +package api + +import ( + "fmt" + "os" + "strings" + "sync" +) + +// LogLevel represents the logging level +type LogLevel int + +const ( + LogLevelError LogLevel = iota + LogLevelWarn + LogLevelInfo + LogLevelDebug +) + +var ( + globalLogger *logger + loggerOnce sync.Once + defaultLogLevel = LogLevelInfo + logLevelEnvVar = "LOG_LEVEL" +) + +type logger struct { + level LogLevel +} + +// getLogger returns the global logger instance +func getLogger() *logger { + loggerOnce.Do(func() { + level := parseLogLevel(os.Getenv(logLevelEnvVar)) + if level == -1 { + level = defaultLogLevel + } + globalLogger = &logger{level: level} + }) + return globalLogger +} + +// parseLogLevel parses a log level string (case-insensitive) +func parseLogLevel(s string) LogLevel { + s = strings.ToUpper(strings.TrimSpace(s)) + switch s { + case "ERROR": + return LogLevelError + case "WARN", "WARNING": + return LogLevelWarn + case "INFO": + return LogLevelInfo + case "DEBUG": + return LogLevelDebug + default: + return -1 + } +} + +// shouldLog returns true if the given level should be logged +func (l *logger) shouldLog(level LogLevel) bool { + return level <= l.level +} + +// logf formats and prints a log message if the level is enabled +func (l *logger) logf(level LogLevel, prefix, format string, args ...interface{}) { + if !l.shouldLog(level) { + return + } + msg := fmt.Sprintf(format, args...) + fmt.Printf("[%s] %s\n", prefix, msg) +} + +// Debug logs a debug message +func logDebug(prefix, format string, args ...interface{}) { + getLogger().logf(LogLevelDebug, prefix, format, args...) +} + +// Info logs an info message +func logInfo(prefix, format string, args ...interface{}) { + getLogger().logf(LogLevelInfo, prefix, format, args...) +} + +// Warn logs a warning message +func logWarn(prefix, format string, args ...interface{}) { + getLogger().logf(LogLevelWarn, prefix, format, args...) +} + +// Error logs an error message +func logError(prefix, format string, args ...interface{}) { + getLogger().logf(LogLevelError, prefix, format, args...) +} diff --git a/go-cosmwasm/api/memory.go b/go-cosmwasm/api/memory.go index 5e8be3012a..31f20a8c08 100644 --- a/go-cosmwasm/api/memory.go +++ b/go-cosmwasm/api/memory.go @@ -1,5 +1,5 @@ -//go:build !secretcli -// +build !secretcli +//go:build !secretcli && !nosgx +// +build !secretcli,!nosgx package api @@ -12,7 +12,7 @@ import "unsafe" func allocateRust(data []byte) C.Buffer { var ret C.Buffer - if data == nil { + if data == nil { // Just return a null buffer ret = C.Buffer{ ptr: u8_ptr(nil), diff --git a/go-cosmwasm/api/recording_store.go b/go-cosmwasm/api/recording_store.go new file mode 100644 index 0000000000..e9149d12e6 --- /dev/null +++ b/go-cosmwasm/api/recording_store.go @@ -0,0 +1,130 @@ +//go:build !secretcli +// +build !secretcli + +package api + +import ( + dbm "github.com/cosmos/cosmos-db" +) + +// StorageOp represents a single storage operation (Set or Delete) +type StorageOp struct { + Key []byte + Value []byte // nil for delete + IsDelete bool +} + +// RecordingKVStore wraps a KVStore and records all Set/Delete operations +type RecordingKVStore struct { + inner KVStore + ops []StorageOp +} + +// NewRecordingKVStore creates a new recording wrapper around a KVStore +func NewRecordingKVStore(inner KVStore) *RecordingKVStore { + return &RecordingKVStore{ + inner: inner, + ops: nil, + } +} + +// Get delegates to the inner store (no recording needed for state) +func (r *RecordingKVStore) Get(key []byte) []byte { + return r.inner.Get(key) +} + +// Set records the operation and delegates to the inner store +func (r *RecordingKVStore) Set(key, value []byte) { + // Copy key and value to avoid issues with reused buffers + keyCopy := make([]byte, len(key)) + copy(keyCopy, key) + valueCopy := make([]byte, len(value)) + copy(valueCopy, value) + + r.ops = append(r.ops, StorageOp{ + IsDelete: false, + Key: keyCopy, + Value: valueCopy, + }) + r.inner.Set(key, value) +} + +// Delete records the operation and delegates to the inner store +func (r *RecordingKVStore) Delete(key []byte) { + // Copy key to avoid issues with reused buffers + keyCopy := make([]byte, len(key)) + copy(keyCopy, key) + + r.ops = append(r.ops, StorageOp{ + IsDelete: true, + Key: keyCopy, + Value: nil, + }) + r.inner.Delete(key) +} + +// Iterator delegates to the inner store +func (r *RecordingKVStore) Iterator(start, end []byte) dbm.Iterator { + return r.inner.Iterator(start, end) +} + +// ReverseIterator delegates to the inner store +func (r *RecordingKVStore) ReverseIterator(start, end []byte) dbm.Iterator { + return r.inner.ReverseIterator(start, end) +} + +// GetOps returns all recorded operations +func (r *RecordingKVStore) GetOps() []StorageOp { + return r.ops +} + +// ClearOps clears recorded operations +func (r *RecordingKVStore) ClearOps() { + r.ops = nil +} + +// ReplayingKVStore applies recorded operations to a store without calling the enclave +type ReplayingKVStore struct { + inner KVStore +} + +// NewReplayingKVStore creates a store that can replay operations +func NewReplayingKVStore(inner KVStore) *ReplayingKVStore { + return &ReplayingKVStore{inner: inner} +} + +// ApplyOps applies a list of storage operations to the store +func (r *ReplayingKVStore) ApplyOps(ops []StorageOp) { + for _, op := range ops { + if op.IsDelete { + r.inner.Delete(op.Key) + } else { + r.inner.Set(op.Key, op.Value) + } + } +} + +// Get delegates to the inner store +func (r *ReplayingKVStore) Get(key []byte) []byte { + return r.inner.Get(key) +} + +// Set delegates to the inner store +func (r *ReplayingKVStore) Set(key, value []byte) { + r.inner.Set(key, value) +} + +// Delete delegates to the inner store +func (r *ReplayingKVStore) Delete(key []byte) { + r.inner.Delete(key) +} + +// Iterator delegates to the inner store +func (r *ReplayingKVStore) Iterator(start, end []byte) dbm.Iterator { + return r.inner.Iterator(start, end) +} + +// ReverseIterator delegates to the inner store +func (r *ReplayingKVStore) ReverseIterator(start, end []byte) dbm.Iterator { + return r.inner.ReverseIterator(start, end) +} diff --git a/go-cosmwasm/api/recording_store_stub.go b/go-cosmwasm/api/recording_store_stub.go new file mode 100644 index 0000000000..a41925944f --- /dev/null +++ b/go-cosmwasm/api/recording_store_stub.go @@ -0,0 +1,28 @@ +//go:build secretcli +// +build secretcli + +package api + +// Stub implementations for secretcli builds (no SGX support) + +// RecordingKVStore stub for secretcli +type RecordingKVStore struct{} + +// NewRecordingKVStore stub +func NewRecordingKVStore(inner interface{}) *RecordingKVStore { + return nil +} + +func (r *RecordingKVStore) GetOps() []StorageOp { + return nil +} + +// ReplayingKVStore stub for secretcli +type ReplayingKVStore struct{} + +// NewReplayingKVStore stub +func NewReplayingKVStore(inner interface{}) *ReplayingKVStore { + return nil +} + +func (r *ReplayingKVStore) ApplyOps(ops []StorageOp) {} diff --git a/go-cosmwasm/api/replay.go b/go-cosmwasm/api/replay.go new file mode 100644 index 0000000000..df23f54d25 --- /dev/null +++ b/go-cosmwasm/api/replay.go @@ -0,0 +1,104 @@ +//go:build !secretcli + +package api + +import ( + "fmt" + "time" + + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types" +) + +// replayExecution handles replay of a recorded execution trace. +// We trust the SGX node's trace data completely. +// +// Gas is consumed in two steps to exactly match the SGX node: +// 1. callbackGas: charged on the original SDK meter directly (callbackGas/1000 SDK gas) +// This matches the SGX node where DB callbacks charge gas on ctx.GasMeter() during C.handle. +// 2. gasUsed (compute gas): returned to the caller so the keeper's consumeGas handles it, +// adding (gasUsed/1000 + 1) SDK gas — same as on the SGX node. +// +// These must be separate divisions to avoid integer rounding differences. +func replayExecution(store KVStore, gasMeter *GasMeter, execIndex int64) ([]byte, uint64, error, bool) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + + trace, found := recorder.GetTraceFromMemory(execIndex) + if !found { + logDebug("replayExecution", "TRACE NOT FOUND in memory: height=%d index=%d, waiting for SGX node", height, execIndex) + + client := GetEcallClient() + retryDelay := 2 * time.Second + attempt := 0 + + for { + allTraces, err := client.FetchBlockTraces(height) + if err == nil { + recorder.SetBlockTraces(allTraces) + trace, found = recorder.GetTraceFromMemory(execIndex) + if found { + logInfo("replayExecution", "Fetched trace: height=%d index=%d (attempt %d)", height, execIndex, attempt+1) + break + } + } + + attempt++ + if attempt%15 == 1 { // Log every ~30 seconds (15 * 2s) + logWarn("replayExecution", "Waiting for SGX node trace: height=%d index=%d attempt=%d err=%v", height, execIndex, attempt, err) + } + time.Sleep(retryDelay) + } + + if !found { + logWarn("replayExecution", "TRACE NOT FOUND after retries: height=%d index=%d", height, execIndex) + return nil, 0, nil, false + } + } + + logDebug("replayExecution", "Found trace: height=%d index=%d ops=%d resultLen=%d gasUsed=%d callbackGas=%d hasError=%v", + height, execIndex, len(trace.Ops), len(trace.Result), trace.GasUsed, trace.CallbackGas, trace.HasError) + + // Apply recorded storage ops (trusted data from SGX node). + // The store uses an InfiniteGasMeter (set by keeper), so these + // ops do NOT charge the real gas meter. + replayer := NewReplayingKVStore(store) + replayer.ApplyOps(trace.Ops) + + // Stash cross-module ops for the keeper to apply on the real ctx.MultiStore(). + // These are mutations that query handlers made to other modules' stores + // (e.g., distribution rewards withdrawal during a staking query). + if len(trace.CrossOps) > 0 { + logDebug("replayExecution", "Stashing %d cross-module ops for keeper", len(trace.CrossOps)) + recorder.SetPendingCrossModuleOps(trace.CrossOps) + } + + // Consume exactly the CallbackGas recorded by the SGX node. + // Since the store is gas-free, we don't need to reconcile with opsGas. + // This makes the replay node's gas meter match the SGX node exactly. + // + if gasMeter != nil && trace.CallbackGas > 0 { + logDebug("replayExecution", "Consuming exact CallbackGas=%d on real gas meter", trace.CallbackGas) + func() { + defer func() { + if r := recover(); r != nil { + logDebug("replayExecution", + "Caught out-of-gas panic during CallbackGas consumption (expected for failed traces)") + } + }() + (*gasMeter).ConsumeGas(trace.CallbackGas, "replay callback gas (matching SGX trace)") + }() + } + + // Return only compute gasUsed — the keeper's consumeGas will add (gasUsed/1000)+1, + // exactly matching the SGX node's second gas consumption step. + if trace.HasError { + if trace.IsOutOfGas { + logDebug("replayExecution", "Returning OutOfGasError (gasUsed=%d)", trace.GasUsed) + return nil, trace.GasUsed, types.OutOfGasError{}, true + } + logDebug("replayExecution", "Returning error (gasUsed=%d): %s", trace.GasUsed, trace.ErrorMsg) + return nil, trace.GasUsed, fmt.Errorf("%s", trace.ErrorMsg), true + } + + return trace.Result, trace.GasUsed, nil, true +} diff --git a/go-cosmwasm/lib.go b/go-cosmwasm/lib.go index d73c50eb24..cb369ef6e7 100644 --- a/go-cosmwasm/lib.go +++ b/go-cosmwasm/lib.go @@ -45,7 +45,11 @@ func NewWasmer(dataDir string, supportedFeatures string, cacheSize uint64, modul if err != nil { return nil, err } - if initEnclave { + + // Skip enclave runtime initialization in replay mode + // Cache is still needed for storing WASM code + recorder := api.GetRecorder() + if initEnclave && !recorder.IsReplayMode() { err = api.InitEnclaveRuntime(moduleCacheSize) if err != nil { return nil, err diff --git a/go.mod b/go.mod index 97f04cda68..0dc417002f 100644 --- a/go.mod +++ b/go.mod @@ -8,8 +8,8 @@ replace ( cosmossdk.io/api => github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 cosmossdk.io/store => github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 cosmossdk.io/x/tx => github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 - github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.23-secret.0 - github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11 + github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.23-secret.1 + github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12 github.com/cosmos/iavl => github.com/scrtlabs/iavl v1.2.2-secret.0 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 diff --git a/go.sum b/go.sum index 2d0e21dccf..05d26a0c15 100644 --- a/go.sum +++ b/go.sum @@ -1609,8 +1609,8 @@ github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWR github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.9 h1:fiaT9rB7g5sr5ddNZvlwheclN9IP86eFW9WgqlEQV+w= github.com/sasha-s/go-deadlock v0.3.9/go.mod h1:KuZj51ZFmx42q/mPaYbRk0P1xcwe697zsJKE03vD4/Y= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11 h1:Yl1x19k6jIFXPDX/Rrj1p4z7EsQDVhNJt0gX1/JuJsM= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11/go.mod h1:b7GmzR/8Ic9g6Aswsm3ryLhE5dhgbKTJ6o78mhxjRO4= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12 h1:PWRZGsDaEVGkBleaoKwCcKdFejRFEV3F+P15P/ux0BQ= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12/go.mod h1:oAqAIxM6W1HXLs/Id+58e5tTdtm5OE35AFj+UsgTtGk= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 h1:9IGLySVhC2qSrxT3fZvvqwjKsnXWSSKnywQDzT8y1Gs= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 h1:TELtwBkSg0xBrs2ObFE0pVVWF6E31fPCDX2tk8OiJPo= @@ -1619,8 +1619,8 @@ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 h1:i3k5706sDHKhaCvzokB+n33/ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= github.com/scrtlabs/iavl v1.2.2-secret.0 h1:P96PL1Lf8OBSW9pMrlaRxhceZ4z9Hc7jk12g9ShWeHw= github.com/scrtlabs/iavl v1.2.2-secret.0/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/scrtlabs/tendermint v0.38.23-secret.0 h1:nPt77SkQILJR6skCIZJclcTtjnHeU6wrqzvVqg3hAps= -github.com/scrtlabs/tendermint v0.38.23-secret.0/go.mod h1:HHgYHxYnGRCJIqihEbfO+icKitZUiYOKE529pQRIEu4= +github.com/scrtlabs/tendermint v0.38.23-secret.1 h1:Fj3F3mC4P7YuRhT71OnKbVQNFl9smndqo9h3tUoJwKE= +github.com/scrtlabs/tendermint v0.38.23-secret.1/go.mod h1:HHgYHxYnGRCJIqihEbfO+icKitZUiYOKE529pQRIEu4= github.com/scrtlabs/tm-secret-enclave v1.13.1 h1:0mXcBdoWyqEGhQEdbXMjSuTi9LKKMld2BqEj0eNpoxU= github.com/scrtlabs/tm-secret-enclave v1.13.1/go.mod h1:nxZQtzzAqBNBLOEXSv4cKlUnVA4vRmHOn6ujr3kxVME= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= diff --git a/proto/secret/compute/v1beta1/query.proto b/proto/secret/compute/v1beta1/query.proto index 8a26e5c39a..ad2b334c39 100644 --- a/proto/secret/compute/v1beta1/query.proto +++ b/proto/secret/compute/v1beta1/query.proto @@ -78,6 +78,47 @@ service Query { rpc AuthorizedAdminUpdate(QueryAuthorizedAdminUpdateRequest) returns (QueryAuthorizedAdminUpdateResponse) { option (google.api.http).get = "/compute/v1beta1/authorized_admin_update/{contract_address}"; } + + // Query ecall record for a specific block height (for non-SGX node sync) + rpc EcallRecord(QueryEcallRecordRequest) returns (QueryEcallRecordResponse) { + option (google.api.http).get = "/compute/v1beta1/ecall/{height}"; + } + + // Query ecall records for a range of block heights (batch sync) + rpc EcallRecords(QueryEcallRecordsRequest) returns (QueryEcallRecordsResponse) { + option (google.api.http).get = "/compute/v1beta1/ecalls"; + } + + // Query network pubkey by block height and seed index (for non-SGX node sync) + rpc NetworkPubkey(QueryNetworkPubkeyRequest) returns (QueryNetworkPubkeyResponse) { + option (google.api.http).get = "/compute/v1beta1/network_pubkey/{height}/{i_seed}"; + } + + // Query encrypted seed by certificate hash (for non-SGX node sync) + rpc EncryptedSeed(QueryEncryptedSeedRequest) returns (QueryEncryptedSeedResponse) { + option (google.api.http).get = "/compute/v1beta1/encrypted_seed/{cert_hash}"; + } + + // Query all execution traces for a block (batch fetch for non-SGX node sync) + rpc BlockTraces(QueryBlockTracesRequest) returns (QueryBlockTracesResponse) { + option (google.api.http).get = "/compute/v1beta1/block_traces/{height}"; + } + + // Query machine ID proof for a specific block height and machine ID (for non-SGX node sync) + rpc MachineIDProof(QueryMachineIDProofRequest) returns (QueryMachineIDProofResponse) { + option (google.api.http).get = "/compute/v1beta1/machine_id_proof/{height}/{machine_id}"; + } + + // Analyze code to determine IBC entry points and required features + rpc AnalyzeCode(QueryAnalyzeCodeRequest) returns (QueryAnalyzeCodeResponse) { + option (google.api.http).get = "/compute/v1beta1/analyze_code"; + } + + // Query all Create (MsgStoreCode) results for a block (for non-SGX node sync) + rpc BlockCreateResults(QueryBlockCreateResultsRequest) returns (QueryBlockCreateResultsResponse) { + option (google.api.http).get = "/compute/v1beta1/block_create_results/{height}"; + } + } // ParamsRequest is the request type for the Query/Params RPC method. @@ -205,6 +246,7 @@ message QueryAuthorizedMigrationResponse { uint64 new_code_id = 1 [ (gogoproto.customname) = "NewCodeID" ]; } + message QueryAuthorizedAdminUpdateRequest { // Contract address to query string contract_address = 1; @@ -213,4 +255,169 @@ message QueryAuthorizedAdminUpdateRequest { message QueryAuthorizedAdminUpdateResponse { // Authorized new admin address (empty string if removing admin, or if no authorization) string new_admin = 1; +} + +// QueryEcallRecordRequest is the request type for the Query/EcallRecord RPC method +message QueryEcallRecordRequest { + // Block height to query ecall record for + int64 height = 1; +} + +// QueryEcallRecordResponse is the response type for the Query/EcallRecord RPC method +message QueryEcallRecordResponse { + // Block height + int64 height = 1; + // Random seed from SubmitBlockSignatures (32 bytes) + bytes random_seed = 2; + // Validator set evidence from SubmitBlockSignatures (32 bytes) + bytes validator_set_evidence = 3; +} + +// QueryNetworkPubkeyRequest is the request type for the Query/NetworkPubkey RPC +message QueryNetworkPubkeyRequest { + // Block height to query network pubkey for + int64 height = 1; + // Seed index + uint32 i_seed = 2; +} + +// QueryNetworkPubkeyResponse is the response type for the Query/NetworkPubkey RPC +message QueryNetworkPubkeyResponse { + bytes node_pubkey = 1; + bytes io_pubkey = 2; +} + +// QueryEcallRecordsRequest is the request type for the Query/EcallRecords RPC method +message QueryEcallRecordsRequest { + // Start block height (inclusive) + int64 start_height = 1; + // End block height (inclusive) + int64 end_height = 2; +} + +// QueryEcallRecordsResponse is the response type for the Query/EcallRecords RPC method +message QueryEcallRecordsResponse { + // List of ecall records + repeated QueryEcallRecordResponse records = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryEncryptedSeedRequest is the request type for the Query/EncryptedSeed RPC method +message QueryEncryptedSeedRequest { + // Certificate hash (hex encoded sha256 of certificate) + string cert_hash = 1; + // Block height at which the seed was recorded (required for per-height keying) + int64 height = 2; +} + +// QueryEncryptedSeedResponse is the response type for the Query/EncryptedSeed RPC method +message QueryEncryptedSeedResponse { + // Encrypted seed data + bytes encrypted_seed = 1; +} + +// StorageOp represents a single storage operation (Set or Delete) +message StorageOp { + // True if this is a delete operation, false for set + bool is_delete = 1; + // Storage key + bytes key = 2; + // Storage value (empty for delete operations) + bytes value = 3; +} + +// CrossModuleOp represents a storage operation on a different module's store +message CrossModuleOp { + // The store key identifying the module (e.g., "bank", "staking") + string store_key = 1; + // Storage key within the module's store + bytes key = 2; + // Storage value (empty for delete operations) + bytes value = 3; + // True if this is a delete operation, false for set + bool is_delete = 4; +} + +// ExecutionTraceData is a single execution trace with its index +message ExecutionTraceData { + // Execution index within the block + int64 index = 1; + // List of storage operations performed during execution + repeated StorageOp ops = 2 [ (gogoproto.nullable) = false ]; + // Return value from the contract execution + bytes result = 3; + // Gas used during execution (compute gas from WASM) + uint64 gas_used = 4; + // Gas consumed by callbacks (store operations) during execution + uint64 callback_gas = 7; + // Whether the execution resulted in an error + bool has_error = 5; + // Error message (if has_error is true) + string error_msg = 6; + // List of cross-module storage operations (e.g., bank balance changes) + repeated CrossModuleOp cross_ops = 8 [ (gogoproto.nullable) = false ]; +} + +// QueryBlockTracesRequest is the request type for the Query/BlockTraces RPC method +message QueryBlockTracesRequest { + // Block height to query traces for + int64 height = 1; +} + +// QueryBlockTracesResponse is the response type for the Query/BlockTraces RPC method +message QueryBlockTracesResponse { + // All execution traces for the block + repeated ExecutionTraceData traces = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryMachineIDProofRequest is the request type for the Query/MachineIDProof RPC method +message QueryMachineIDProofRequest { + // Block height where the machine ID was approved + int64 height = 1; + // Machine ID (hex encoded) + string machine_id = 2; +} + +// QueryMachineIDProofResponse is the response type for the Query/MachineIDProof RPC method +message QueryMachineIDProofResponse { + // Proof bytes (32 bytes) + bytes proof = 1; +} + +// QueryAnalyzeCodeRequest is the request type for the Query/AnalyzeCode RPC method +message QueryAnalyzeCodeRequest { + // Code hash (raw bytes, typically 32 bytes SHA256) + bytes code_hash = 1; +} + +// QueryAnalyzeCodeResponse is the response type for the Query/AnalyzeCode RPC method +message QueryAnalyzeCodeResponse { + // Whether the code has IBC entry points (ibc_channel_open, ibc_channel_connect, etc.) + bool has_ibc_entry_points = 1; + // Comma-separated list of required features (e.g., "staking", "stargate") + string required_features = 2; +} + +// CreateResultData stores the outcome of a single MsgStoreCode execution +message CreateResultData { + // SHA256 of the original WASM bytecode + bytes wasm_hash = 1; + // Code hash computed by the enclave (empty on error) + bytes code_hash = 2; + // Whether the enclave rejected the code + bool has_error = 3; + // Error message (if has_error is true) + string error_msg = 4; +} + +// QueryBlockCreateResultsRequest is the request type for the Query/BlockCreateResults RPC method +message QueryBlockCreateResultsRequest { + // Block height to query Create results for + int64 height = 1; +} + +// QueryBlockCreateResultsResponse is the response type for the Query/BlockCreateResults RPC method +message QueryBlockCreateResultsResponse { + // All Create results for the block + repeated CreateResultData results = 1 [ (gogoproto.nullable) = false ]; + } \ No newline at end of file diff --git a/x/compute/internal/keeper/keeper.go b/x/compute/internal/keeper/keeper.go index d224fc1394..dd77ec9b84 100644 --- a/x/compute/internal/keeper/keeper.go +++ b/x/compute/internal/keeper/keeper.go @@ -96,6 +96,16 @@ type Keeper struct { // paramSpace subspace.Subspace LastMsgManager *baseapp.LastMsgMarkerContainer authority string + // storeKeys maps store key names to the app's registered StoreKey + // instances so ApplyCrossModuleOps resolves correct pointers. + storeKeys map[string]storetypes.StoreKey +} + +// SetStoreKeys provides the keeper with the app's registered store key +// instances so ApplyCrossModuleOps can resolve string names to the exact +// pointers that CacheMultiStore expects. +func (k *Keeper) SetStoreKeys(keys map[string]storetypes.StoreKey) { + k.storeKeys = keys } func moduleLogger(ctx sdk.Context) log.Logger { @@ -730,16 +740,40 @@ func (k Keeper) Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.A // create prefixed data store // 0x03 | contractAddress (sdk.AccAddress) prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) - prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), prefixStoreKey) + recorder := api.GetRecorder() + var storeForExecution prefix.Store + if recorder.IsReplayMode() { + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas. The real gas meter is charged exactly with + // trace.CallbackGas by replayExecution instead. + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), prefixStoreKey) + } // prepare querier + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } - response, ogContractKey, adminProof, gasUsed, initError := k.wasmer.Instantiate(codeInfo.CodeHash, env, initMsg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasForContract(ctx), sigInfo, admin) + response, ogContractKey, adminProof, gasUsed, initError := k.wasmer.Instantiate(codeInfo.CodeHash, env, initMsg, storeForExecution, cosmwasmAPI, querier, ctx.GasMeter(), gasForContract(ctx), sigInfo, admin) + + // In replay mode, apply any cross-module ops stashed by replayExecution. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) if initError != nil { @@ -910,13 +944,45 @@ func (k Keeper) Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller env := types.NewEnv(ctx, caller, coins, contractAddress, contractKey, random) // prepare querier + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + // In SGX (recording) mode, wrap the querier's ctx with RecordingMultiStore + // so that cross-module writes during queries (e.g., distribution reward + // withdrawals) are captured and included in the execution trace. + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } - response, gasUsed, execErr := k.wasmer.Execute(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, handleType) + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. replayExecution will charge + // exactly trace.CallbackGas instead. + var storeForExecution prefix.Store + if recorder.IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + storeForExecution = prefixStore + } + + response, gasUsed, execErr := k.wasmer.Execute(codeInfo.CodeHash, env, msg, storeForExecution, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, handleType) + + // In replay mode, apply any cross-module ops that were stashed by replayExecution. + // These are writes to other modules' stores (e.g., distribution, staking) that + // happened during query callbacks on the SGX node. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) if execErr != nil { @@ -1467,6 +1533,9 @@ func (k *Keeper) handleContractResponse( // This is used mainly in replies in order to decrypt their data. ogSigInfo wasmTypes.SigInfo, ) ([]byte, error) { + ctx.Logger().Debug(fmt.Sprintf("[handleContractResponse] height=%d contract=%s numSubMsgs=%d numLogs=%d numEvents=%d dataLen=%d gasConsumed=%d", + ctx.BlockHeight(), contractAddr.String(), len(msgs), len(logs), len(evts), len(data), ctx.GasMeter().GasConsumed())) + events := types.ContractLogsToSdkEvents(logs, contractAddr) ctx.EventManager().EmitEvents(events) @@ -1501,6 +1570,7 @@ func gasForContract(ctx sdk.Context) uint64 { func consumeGas(ctx sdk.Context, gas uint64) { consumed := (gas / types.GasMultiplier) + 1 + ctx.Logger().Debug("Consuming compute gas", "wasmGas", gas, "sdkGas", consumed, "multiplier", types.GasMultiplier) ctx.GasMeter().ConsumeGas(consumed, "wasm contract") // throw OutOfGas error if we ran out (got exactly to zero due to better limit enforcing) if ctx.GasMeter().IsOutOfGas() { @@ -1619,6 +1689,16 @@ func (m MultipiedGasMeter) GasConsumed() storetypes.Gas { return m.originalMeter.GasConsumed() * types.GasMultiplier } +func (m MultipiedGasMeter) ConsumeGas(amount storetypes.Gas, descriptor string) { + // Divide by GasMultiplier since GasConsumed() multiplies by it + m.originalMeter.ConsumeGas(amount/types.GasMultiplier, descriptor) +} + +// OriginalMeter returns the underlying gas meter (for measuring callback gas) +func (m MultipiedGasMeter) OriginalMeter() storetypes.GasMeter { + return m.originalMeter +} + func gasMeter(ctx sdk.Context) MultipiedGasMeter { return MultipiedGasMeter{ originalMeter: ctx.GasMeter(), @@ -1672,8 +1752,14 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply v1w env := types.NewEnv(ctx, contractAddress, sdk.Coins{}, contractAddress, contractKey, random) // prepare querier + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } @@ -1685,7 +1771,27 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply v1w return nil, err } - response, gasUsed, execErr := k.wasmer.Execute(codeInfo.CodeHash, env, marshaledReply, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasForContract(ctx), ogSigInfo, wasmTypes.HandleTypeReply) + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. + var replyStoreForExecution prefix.Store + if recorder.IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + replyStoreForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + replyStoreForExecution = prefixStore + } + + response, gasUsed, execErr := k.wasmer.Execute(codeInfo.CodeHash, env, marshaledReply, replyStoreForExecution, cosmwasmAPI, querier, ctx.GasMeter(), gasForContract(ctx), ogSigInfo, wasmTypes.HandleTypeReply) + + // In replay mode, apply any cross-module ops stashed by replayExecution. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) if execErr != nil { @@ -1772,14 +1878,38 @@ func (k Keeper) UpdateContractAdmin(ctx sdk.Context, contractAddress, caller, ne } // prepare querier - // TODO: this is unnecessary, get rid of this + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } - newAdminProof, updateAdminErr := k.wasmer.UpdateAdmin(codeInfo.CodeHash, env, prefixStore, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, currentAdminAddress, contractInfo.AdminProof, newAdmin) + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. + var adminStoreForExecution prefix.Store + if recorder.IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + adminStoreForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + adminStoreForExecution = prefixStore + } + + newAdminProof, updateAdminErr := k.wasmer.UpdateAdmin(codeInfo.CodeHash, env, adminStoreForExecution, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, currentAdminAddress, contractInfo.AdminProof, newAdmin) + + // In replay mode, apply any cross-module ops stashed by replayExecution. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } if updateAdminErr != nil { return updateAdminErr @@ -1890,13 +2020,39 @@ func (k Keeper) Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller } // prepare querier + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } - response, newContractKey, newContractKeyProof, gasUsed, migrateErr := k.wasmer.Migrate(newCodeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, adminAddr, adminProof) + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. + var storeForExecution prefix.Store + if recorder.IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + storeForExecution = prefixStore + } + + response, newContractKey, newContractKeyProof, gasUsed, migrateErr := k.wasmer.Migrate(newCodeInfo.CodeHash, env, msg, storeForExecution, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, adminAddr, adminProof) + + // In replay mode, apply any cross-module ops stashed by replayExecution. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) if migrateErr != nil { diff --git a/x/compute/internal/keeper/msg_dispatcher.go b/x/compute/internal/keeper/msg_dispatcher.go index 35fd2bd4ed..48f41cbe89 100644 --- a/x/compute/internal/keeper/msg_dispatcher.go +++ b/x/compute/internal/keeper/msg_dispatcher.go @@ -195,7 +195,59 @@ func redactError(err error) (bool, error) { // that dispatched them, both on success as well as failure func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []v1wasmTypes.SubMsg, ogTx []byte, ogSigInfo wasmTypes.SigInfo) ([]byte, error) { var rsp []byte - for _, msg := range msgs { + + ctx.Logger().Info(fmt.Sprintf("[DispatchSubmessages] height=%d contract=%s numMsgs=%d gasConsumed=%d", + ctx.BlockHeight(), contractAddr.String(), len(msgs), ctx.GasMeter().GasConsumed())) + + for i, msg := range msgs { + + // Log submessage details + msgType := "unknown" + msgDetail := "" + if msg.Msg.Bank != nil { + if msg.Msg.Bank.Send != nil { + msgType = "bank/send" + msgDetail = fmt.Sprintf("to=%s coins=%v", msg.Msg.Bank.Send.ToAddress, msg.Msg.Bank.Send.Amount) + } else if msg.Msg.Bank.Burn != nil { + msgType = "bank/burn" + msgDetail = fmt.Sprintf("coins=%v", msg.Msg.Bank.Burn.Amount) + } + } else if msg.Msg.Staking != nil { + if msg.Msg.Staking.Delegate != nil { + msgType = "staking/delegate" + msgDetail = fmt.Sprintf("validator=%s amount=%v", msg.Msg.Staking.Delegate.Validator, msg.Msg.Staking.Delegate.Amount) + } else if msg.Msg.Staking.Undelegate != nil { + msgType = "staking/undelegate" + msgDetail = fmt.Sprintf("validator=%s amount=%v", msg.Msg.Staking.Undelegate.Validator, msg.Msg.Staking.Undelegate.Amount) + } else if msg.Msg.Staking.Redelegate != nil { + msgType = "staking/redelegate" + msgDetail = fmt.Sprintf("src=%s dst=%s amount=%v", msg.Msg.Staking.Redelegate.SrcValidator, msg.Msg.Staking.Redelegate.DstValidator, msg.Msg.Staking.Redelegate.Amount) + } else if msg.Msg.Staking.Withdraw != nil { + msgType = "staking/withdraw" + msgDetail = fmt.Sprintf("validator=%s recipient=%s", msg.Msg.Staking.Withdraw.Validator, msg.Msg.Staking.Withdraw.Recipient) + } + } else if msg.Msg.Wasm != nil { + if msg.Msg.Wasm.Execute != nil { + msgType = "wasm/execute" + msgDetail = fmt.Sprintf("contract=%s msgLen=%d", msg.Msg.Wasm.Execute.ContractAddr, len(msg.Msg.Wasm.Execute.Msg)) + } else if msg.Msg.Wasm.Instantiate != nil { + msgType = "wasm/instantiate" + msgDetail = fmt.Sprintf("codeID=%d label=%s", msg.Msg.Wasm.Instantiate.CodeID, msg.Msg.Wasm.Instantiate.Label) + } + } else if msg.Msg.Custom != nil { + msgType = "custom" + msgDetail = fmt.Sprintf("dataLen=%d", len(msg.Msg.Custom)) + } else if msg.Msg.Gov != nil { + msgType = "gov" + } else if msg.Msg.IBC != nil { + msgType = "ibc" + } else if msg.Msg.Distribution != nil { + msgType = "distribution" + } else if msg.Msg.Stargate != nil { + msgType = "stargate" + } + ctx.Logger().Debug(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] id=%s type=%s replyOn=%s gasLimit=%v detail=%s gasBefore=%d", + ctx.BlockHeight(), i, string(msg.ID), msgType, msg.ReplyOn, msg.GasLimit, msgDetail, ctx.GasMeter().GasConsumed())) if d.keeper.GetLastMsgMarkerContainer().GetMarker() { return nil, sdkerrors.ErrLastTx.Wrap("Cannot send messages or submessages after last tx marker was set") @@ -233,6 +285,19 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk events, data, err = d.messenger.DispatchMsg(subCtx, contractAddr, ibcPort, msg.Msg) } + // Log dispatch result + totalDataLen := 0 + for _, d := range data { + totalDataLen += len(d) + } + if err != nil { + ctx.Logger().Debug(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] FAILED: %v gasAfter=%d", + ctx.BlockHeight(), i, err, ctx.GasMeter().GasConsumed())) + } else { + ctx.Logger().Debug(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] SUCCESS: events=%d dataChunks=%d totalDataLen=%d gasAfter=%d", + ctx.BlockHeight(), i, len(events), len(data), totalDataLen, ctx.GasMeter().GasConsumed())) + } + // if it succeeds, commit state changes from submessage, and pass on events to Event Manager var filteredEvents []sdk.Event if err == nil { diff --git a/x/compute/internal/keeper/msg_server.go b/x/compute/internal/keeper/msg_server.go index e6d5355cf2..5dc53e309a 100644 --- a/x/compute/internal/keeper/msg_server.go +++ b/x/compute/internal/keeper/msg_server.go @@ -81,7 +81,7 @@ func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst }, err } -func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteContract) (*types.MsgExecuteContractResponse, error) { +func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteContract) (res *types.MsgExecuteContractResponse, err error) { ctx := sdk.UnwrapSDKContext(goCtx) ctx.EventManager().EmitEvent(sdk.NewEvent( diff --git a/x/compute/internal/keeper/querier.go b/x/compute/internal/keeper/querier.go index e3b043cac4..1a7286fcf3 100644 --- a/x/compute/internal/keeper/querier.go +++ b/x/compute/internal/keeper/querier.go @@ -3,6 +3,7 @@ package keeper import ( "context" "encoding/hex" + "fmt" "sort" "github.com/golang/protobuf/ptypes/empty" @@ -13,6 +14,7 @@ import ( storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/api" "github.com/scrtlabs/SecretNetwork/x/compute/internal/types" ) @@ -278,6 +280,312 @@ func (q GrpcQuerier) AuthorizedAdminUpdate(c context.Context, req *types.QueryAu return response, nil } +// EcallRecord returns the ecall record for a specific block height +// This is used by non-SGX nodes to sync with the network +// SECURITY: Only returns data for heights < current height (prevents non-SGX nodes from participating in consensus) +func (q GrpcQuerier) NetworkPubkey(c context.Context, req *types.QueryNetworkPubkeyRequest) (*types.QueryNetworkPubkeyResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + recorder := api.GetRecorder() + if !recorder.IsSGXMode() { + return nil, status.Error(codes.FailedPrecondition, "NetworkPubkey query is only available on SGX nodes") + } + + nodePk, ioPk, found := recorder.ReplayGetNetworkPubkey(req.Height, req.ISeed) + if !found { + return nil, status.Errorf(codes.NotFound, "No network pubkey recorded for height %d seed %d", req.Height, req.ISeed) + } + + return &types.QueryNetworkPubkeyResponse{ + NodePubkey: nodePk, + IoPubkey: ioPk, + }, nil +} + +func (q GrpcQuerier) EcallRecord(c context.Context, req *types.QueryEcallRecordRequest) (*types.QueryEcallRecordResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Height <= 0 { + return nil, status.Error(codes.InvalidArgument, "height must be positive") + } + + // SECURITY: Enforce height restriction - only allow querying heights < current height + // This prevents non-SGX nodes from getting data for the current block and participating in consensus + ctx := sdk.UnwrapSDKContext(c) + currentHeight := ctx.BlockHeight() + if req.Height >= currentHeight { + return nil, status.Errorf(codes.FailedPrecondition, "cannot query ecall record for height %d: must be less than current height %d", req.Height, currentHeight) + } + + recorder := api.GetRecorder() + random, evidence, found := recorder.ReplaySubmitBlockSignatures(req.Height) + if !found { + return nil, status.Error(codes.NotFound, "no ecall record found for the given height") + } + + return &types.QueryEcallRecordResponse{ + Height: req.Height, + RandomSeed: random, + ValidatorSetEvidence: evidence, + }, nil +} + +// EcallRecords returns ecall records for a range of block heights +// This is used by non-SGX nodes to batch sync with the network +// SECURITY: Only returns data for heights < current height (prevents non-SGX nodes from participating in consensus) +func (q GrpcQuerier) EcallRecords(c context.Context, req *types.QueryEcallRecordsRequest) (*types.QueryEcallRecordsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.StartHeight <= 0 { + return nil, status.Error(codes.InvalidArgument, "start_height must be positive") + } + + if req.EndHeight < req.StartHeight { + return nil, status.Error(codes.InvalidArgument, "end_height must be >= start_height") + } + + // Limit the range to prevent abuse (max 1000 blocks per request) + maxRange := int64(1000) + if req.EndHeight-req.StartHeight > maxRange { + return nil, status.Errorf(codes.InvalidArgument, "range too large, max %d blocks per request", maxRange) + } + + // SECURITY: Enforce height restriction - only allow querying heights < current height + // This prevents non-SGX nodes from getting data for the current block and participating in consensus + ctx := sdk.UnwrapSDKContext(c) + currentHeight := ctx.BlockHeight() + if req.EndHeight >= currentHeight { + // Clamp end height to currentHeight - 1 + req.EndHeight = currentHeight - 1 + } + if req.StartHeight >= currentHeight { + return nil, status.Errorf(codes.FailedPrecondition, "cannot query ecall records for height %d: must be less than current height %d", req.StartHeight, currentHeight) + } + + recorder := api.GetRecorder() + var records []types.QueryEcallRecordResponse + + for height := req.StartHeight; height <= req.EndHeight; height++ { + random, evidence, found := recorder.ReplaySubmitBlockSignatures(height) + if found { + records = append(records, types.QueryEcallRecordResponse{ + Height: height, + RandomSeed: random, + ValidatorSetEvidence: evidence, + }) + } + } + + return &types.QueryEcallRecordsResponse{ + Records: records, + }, nil +} + +// EncryptedSeed returns the encrypted seed for a specific certificate hash +// This is used by non-SGX nodes to sync with the network +func (q GrpcQuerier) EncryptedSeed(c context.Context, req *types.QueryEncryptedSeedRequest) (*types.QueryEncryptedSeedResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.CertHash == "" { + return nil, status.Error(codes.InvalidArgument, "cert_hash is required") + } + + fmt.Printf("[INFO] gRPC EncryptedSeed query: certHash=%s height=%d\n", req.CertHash, req.Height) + + // Decode hex string to bytes + certHash, err := hex.DecodeString(req.CertHash) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid cert_hash: must be hex encoded") + } + + recorder := api.GetRecorder() + encryptedSeed, errMsg, found := recorder.ReplayGetEncryptedSeed(req.Height, certHash) + if !found { + fmt.Printf("[INFO] gRPC EncryptedSeed: NOT FOUND in DB for certHash=%s height=%d\n", req.CertHash, req.Height) + return nil, status.Error(codes.NotFound, "no encrypted seed found for the given certificate hash") + } + if errMsg != "" { + fmt.Printf("[INFO] gRPC EncryptedSeed: found recorded ERROR for certHash=%s height=%d: %s\n", req.CertHash, req.Height, errMsg) + // Return the recorded error message so non-SGX nodes can replay the exact same error + return nil, status.Error(codes.FailedPrecondition, errMsg) + } + + fmt.Printf("[INFO] gRPC EncryptedSeed: found SUCCESS for certHash=%s height=%d seedLen=%d\n", req.CertHash, req.Height, len(encryptedSeed)) + + return &types.QueryEncryptedSeedResponse{ + EncryptedSeed: encryptedSeed, + }, nil +} + +// MachineIDProof returns the recorded proof bytes for a specific machine ID at a given height +// This is used by non-SGX nodes to replay machine ID approval ecalls +func (q GrpcQuerier) MachineIDProof(c context.Context, req *types.QueryMachineIDProofRequest) (*types.QueryMachineIDProofResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Height <= 0 { + return nil, status.Error(codes.InvalidArgument, "height must be positive") + } + + if req.MachineId == "" { + return nil, status.Error(codes.InvalidArgument, "machine_id is required") + } + + recorder := api.GetRecorder() + proof, found := recorder.ReplayMachineIDProof(req.Height, []byte(req.MachineId)) + if !found { + return nil, status.Errorf(codes.NotFound, "no machine ID proof found for height %d", req.Height) + } + + return &types.QueryMachineIDProofResponse{ + Proof: proof, + }, nil +} + +// BlockTraces returns all execution traces for a specific block height +// This is used by non-SGX nodes to batch fetch all traces for a block +// SECURITY: Only returns data for heights < current height (prevents non-SGX nodes from participating in consensus) +func (q GrpcQuerier) BlockTraces(c context.Context, req *types.QueryBlockTracesRequest) (*types.QueryBlockTracesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Height <= 0 { + return nil, status.Error(codes.InvalidArgument, "height must be positive") + } + + // SECURITY: Enforce height restriction - only allow querying heights < current height + // This prevents non-SGX nodes from getting data for the current block and participating in consensus + ctx := sdk.UnwrapSDKContext(c) + currentHeight := ctx.BlockHeight() + if req.Height >= currentHeight { + return nil, status.Errorf(codes.FailedPrecondition, "cannot query block traces for height %d: must be less than current height %d", req.Height, currentHeight) + } + + ctx.Logger().Debug("BlockTraces query received", "height", req.Height) + recorder := api.GetRecorder() + traces, err := recorder.GetAllTracesForBlock(req.Height) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get traces: %v", err) + } + + ctx.Logger().Debug("Retrieved traces from database", "count", len(traces)) + + // Convert api.ExecutionTrace to types.ExecutionTraceData + protoTraces := make([]types.ExecutionTraceData, len(traces)) + for i, trace := range traces { + ctx.Logger().Debug("Converting trace", "index", trace.Index, "callbackGas", trace.CallbackGas) + ops := make([]types.StorageOp, len(trace.Ops)) + for j, op := range trace.Ops { + ops[j] = types.StorageOp{ + IsDelete: op.IsDelete, + Key: op.Key, + Value: op.Value, + } + } + crossOps := make([]types.CrossModuleOp, len(trace.CrossOps)) + for j, cop := range trace.CrossOps { + crossOps[j] = types.CrossModuleOp{ + StoreKey: cop.StoreKey, + Key: cop.Key, + Value: cop.Value, + IsDelete: cop.IsDelete, + } + } + protoTraces[i] = types.ExecutionTraceData{ + Index: trace.Index, + Ops: ops, + Result: trace.Result, + GasUsed: trace.GasUsed, + CallbackGas: trace.CallbackGas, + HasError: trace.HasError, + ErrorMsg: trace.ErrorMsg, + CrossOps: crossOps, + } + ctx.Logger().Debug("Proto trace converted", "callbackGas", protoTraces[i].CallbackGas) + } + + firstTraceCallbackGas := uint64(0) + if len(protoTraces) > 0 { + firstTraceCallbackGas = protoTraces[0].CallbackGas + } + ctx.Logger().Debug("Returning traces", "count", len(protoTraces), "firstTraceCallbackGas", firstTraceCallbackGas) + + return &types.QueryBlockTracesResponse{ + Traces: protoTraces, + }, nil +} + +// AnalyzeCode returns the static analysis of a contract's code +// This is used by non-SGX nodes to determine IBC entry points and required features +func (q GrpcQuerier) AnalyzeCode(c context.Context, req *types.QueryAnalyzeCodeRequest) (*types.QueryAnalyzeCodeResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if len(req.CodeHash) == 0 { + return nil, status.Error(codes.InvalidArgument, "code hash is required") + } + + report, err := q.keeper.wasmer.AnalyzeCode(req.CodeHash) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to analyze code: %v", err) + } + + return &types.QueryAnalyzeCodeResponse{ + HasIbcEntryPoints: report.HasIBCEntryPoints, + RequiredFeatures: report.RequiredFeatures, + }, nil +} + +// BlockCreateResults returns all Create (MsgStoreCode) results for a block +// This is used by non-SGX nodes to fetch Create outcomes during sync +func (q GrpcQuerier) BlockCreateResults(c context.Context, req *types.QueryBlockCreateResultsRequest) (*types.QueryBlockCreateResultsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Height <= 0 { + return nil, status.Error(codes.InvalidArgument, "height must be positive") + } + + // SECURITY: Enforce height restriction - only allow querying heights < current height + ctx := sdk.UnwrapSDKContext(c) + currentHeight := ctx.BlockHeight() + if req.Height >= currentHeight { + return nil, status.Errorf(codes.FailedPrecondition, "cannot query block create results for height %d: must be less than current height %d", req.Height, currentHeight) + } + + recorder := api.GetRecorder() + results, wasmHashes, err := recorder.GetAllCreateResultsForBlock(req.Height) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get create results: %v", err) + } + + protoResults := make([]types.CreateResultData, len(results)) + for i, r := range results { + protoResults[i] = types.CreateResultData{ + WasmHash: wasmHashes[i], + CodeHash: r.CodeHash, + HasError: r.HasError, + ErrorMsg: r.ErrorMsg, + } + } + + return &types.QueryBlockCreateResultsResponse{ + Results: protoResults, + }, nil +} + func queryContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress, keeper Keeper) (*types.ContractInfoWithAddress, error) { info := keeper.GetContractInfo(ctx, contractAddress) if info == nil { diff --git a/x/compute/internal/keeper/recording_multistore.go b/x/compute/internal/keeper/recording_multistore.go new file mode 100644 index 0000000000..a7f159b1dd --- /dev/null +++ b/x/compute/internal/keeper/recording_multistore.go @@ -0,0 +1,232 @@ +package keeper + +import ( + "fmt" + "io" + + storetypes "cosmossdk.io/store/types" + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/api" +) + +// RecordingMultiStore wraps a MultiStore and intercepts GetKVStore, +// returning RecordingKVStore wrappers that record writes as CrossModuleOps +// on the EcallRecorder. +// +// All stores are recorded EXCEPT those listed in excludedKeys (typically +// the compute module's own store, which is recorded inside the enclave). +type RecordingMultiStore struct { + storetypes.MultiStore + recorder *api.EcallRecorder + excludedKeys map[string]bool // store key names to exclude from recording +} + +// NewRecordingMultiStore creates a recording wrapper around the given MultiStore. +// excludedKeys are store keys whose writes should NOT be recorded (e.g. the compute store). +func NewRecordingMultiStore( + inner storetypes.MultiStore, + recorder *api.EcallRecorder, + excludedKeys []storetypes.StoreKey, +) *RecordingMultiStore { + ek := make(map[string]bool, len(excludedKeys)) + for _, sk := range excludedKeys { + ek[sk.Name()] = true + } + return &RecordingMultiStore{ + MultiStore: inner, + recorder: recorder, + excludedKeys: ek, + } +} + +func (rms *RecordingMultiStore) GetKVStore(key storetypes.StoreKey) storetypes.KVStore { + inner := rms.MultiStore.GetKVStore(key) + if rms.excludedKeys[key.Name()] { + return inner + } + return &RecordingKVStore{ + KVStore: inner, + storeKey: key.Name(), + recorder: rms.recorder, + } +} + +func (rms *RecordingMultiStore) GetStore(key storetypes.StoreKey) storetypes.Store { + return rms.MultiStore.GetStore(key) +} + +func (rms *RecordingMultiStore) CacheMultiStore() storetypes.CacheMultiStore { + inner := rms.MultiStore.CacheMultiStore() + return &RecordingCacheMultiStore{ + MultiStore: inner, + inner: inner, + recorder: rms.recorder, + excludedKeys: rms.excludedKeys, + } +} + +func (rms *RecordingMultiStore) CacheMultiStoreWithVersion(version int64) (storetypes.CacheMultiStore, error) { + inner, err := rms.MultiStore.CacheMultiStoreWithVersion(version) + if err != nil { + return nil, err + } + return &RecordingCacheMultiStore{ + MultiStore: inner, + inner: inner, + recorder: rms.recorder, + excludedKeys: rms.excludedKeys, + }, nil +} + +// RecordingCacheMultiStore wraps a CacheMultiStore with recording, so that +// writes through branched contexts (e.g. bank module SendCoins) are captured +// by the cross-module recording. +type RecordingCacheMultiStore struct { + storetypes.MultiStore // embed MultiStore interface for read-through + inner storetypes.CacheMultiStore + recorder *api.EcallRecorder + excludedKeys map[string]bool +} + +func (rcms *RecordingCacheMultiStore) Write() { + rcms.inner.Write() +} + +func (rcms *RecordingCacheMultiStore) GetKVStore(key storetypes.StoreKey) storetypes.KVStore { + inner := rcms.inner.GetKVStore(key) + if rcms.excludedKeys[key.Name()] { + return inner + } + return &RecordingKVStore{ + KVStore: inner, + storeKey: key.Name(), + recorder: rcms.recorder, + } +} + +func (rcms *RecordingCacheMultiStore) CacheMultiStore() storetypes.CacheMultiStore { + return rcms.inner.CacheMultiStore() +} + +func (rcms *RecordingCacheMultiStore) CacheMultiStoreWithVersion(version int64) (storetypes.CacheMultiStore, error) { + return rcms.inner.CacheMultiStoreWithVersion(version) +} + +func (rms *RecordingMultiStore) CacheWrap() storetypes.CacheWrap { + return rms.MultiStore.CacheWrap() +} + +func (rms *RecordingMultiStore) CacheWrapWithTrace(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { + return rms.MultiStore.CacheWrapWithTrace(w, tc) +} + +func (rms *RecordingMultiStore) GetStoreType() storetypes.StoreType { + return rms.MultiStore.GetStoreType() +} + +func (rms *RecordingMultiStore) TracingEnabled() bool { + return rms.MultiStore.TracingEnabled() +} + +func (rms *RecordingMultiStore) SetTracer(w io.Writer) storetypes.MultiStore { + rms.MultiStore.SetTracer(w) + return rms +} + +func (rms *RecordingMultiStore) SetTracingContext(tc storetypes.TraceContext) storetypes.MultiStore { + rms.MultiStore.SetTracingContext(tc) + return rms +} + +func (rms *RecordingMultiStore) LatestVersion() int64 { + return rms.MultiStore.LatestVersion() +} + +// RecordingKVStore wraps a KVStore and records all Set/Delete operations as +// CrossModuleOps on the EcallRecorder. +type RecordingKVStore struct { + storetypes.KVStore + storeKey string + recorder *api.EcallRecorder +} + +func (rks *RecordingKVStore) Set(key, value []byte) { + rks.KVStore.Set(key, value) + rks.recorder.AppendCrossModuleOp(api.CrossModuleOp{ + StoreKey: rks.storeKey, + Key: cloneBytes(key), + Value: cloneBytes(value), + IsDelete: false, + }) +} + +func (rks *RecordingKVStore) Delete(key []byte) { + rks.KVStore.Delete(key) + rks.recorder.AppendCrossModuleOp(api.CrossModuleOp{ + StoreKey: rks.storeKey, + Key: cloneBytes(key), + IsDelete: true, + }) +} + +// Read-through methods (no recording needed) +func (rks *RecordingKVStore) Get(key []byte) []byte { + return rks.KVStore.Get(key) +} + +func (rks *RecordingKVStore) Has(key []byte) bool { + return rks.KVStore.Has(key) +} + +func (rks *RecordingKVStore) Iterator(start, end []byte) storetypes.Iterator { + return rks.KVStore.Iterator(start, end) +} + +func (rks *RecordingKVStore) ReverseIterator(start, end []byte) storetypes.Iterator { + return rks.KVStore.ReverseIterator(start, end) +} + +func (rks *RecordingKVStore) GetStoreType() storetypes.StoreType { + return rks.KVStore.GetStoreType() +} + +func (rks *RecordingKVStore) CacheWrap() storetypes.CacheWrap { + return rks.KVStore.CacheWrap() +} + +func (rks *RecordingKVStore) CacheWrapWithTrace(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { + return rks.KVStore.CacheWrapWithTrace(w, tc) +} + +// cloneBytes returns a copy of a byte slice, or nil if the input is nil. +func cloneBytes(b []byte) []byte { + if b == nil { + return nil + } + c := make([]byte, len(b)) + copy(c, b) + return c +} + +// ApplyCrossModuleOps replays recorded cross-module mutations on the real multistore. +// Called by the keeper after wasmer.Execute() in replay mode to apply mutations that +// query handlers made to other modules' stores during the SGX execution (e.g., +// distribution reward withdrawals triggered by staking queries). +// +// storeKeys maps store key names (e.g. "distribution") to the app's registered +// StoreKey instances. CacheMultiStore uses pointer identity for its internal map +// lookups, so we MUST pass the exact registered pointer — creating a new +// *KVStoreKey with the same name will silently write to an orphan store. +func ApplyCrossModuleOps(ms storetypes.MultiStore, storeKeys map[string]storetypes.StoreKey, ops []api.CrossModuleOp) { + for _, op := range ops { + sk, ok := storeKeys[op.StoreKey] + if !ok { + panic(fmt.Sprintf("ApplyCrossModuleOps: unknown store key %q in cross-module op", op.StoreKey)) + } + store := ms.GetKVStore(sk) + if op.IsDelete { + store.Delete(op.Key) + } else { + store.Set(op.Key, op.Value) + } + } +} diff --git a/x/compute/internal/keeper/relay.go b/x/compute/internal/keeper/relay.go index 21657a1ca5..7a9e929f44 100644 --- a/x/compute/internal/keeper/relay.go +++ b/x/compute/internal/keeper/relay.go @@ -6,9 +6,13 @@ import ( "time" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" sdktxsigning "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/api" wasmTypes "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types" v1types "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types/v1" @@ -50,13 +54,41 @@ func (k Keeper) ibcContractCall(ctx sdk.Context, ) // prepare querier + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } + querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, + Caller: contractAddress, } gas := gasForContract(ctx) - res, gasUsed, err := k.wasmer.Execute(codeInfo.CodeHash, env, msgBz, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, sigInfo, callType) + + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. + var storeForExecution prefix.Store + if api.GetRecorder().IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + storeForExecution = prefixStore + } + + res, gasUsed, err := k.wasmer.Execute(codeInfo.CodeHash, env, msgBz, storeForExecution, cosmwasmAPI, querier, ctx.GasMeter(), gas, sigInfo, callType) + + if api.GetRecorder().IsReplayMode() { + crossOps := api.GetRecorder().GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) return res, err diff --git a/x/compute/internal/types/query.pb.go b/x/compute/internal/types/query.pb.go index 38d1ede5f6..e1036a42b0 100644 --- a/x/compute/internal/types/query.pb.go +++ b/x/compute/internal/types/query.pb.go @@ -957,509 +957,1047 @@ func (m *QueryAuthorizedAdminUpdateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAuthorizedAdminUpdateResponse proto.InternalMessageInfo -func init() { - proto.RegisterType((*ParamsRequest)(nil), "secret.compute.v1beta1.ParamsRequest") - proto.RegisterType((*ParamsResponse)(nil), "secret.compute.v1beta1.ParamsResponse") - proto.RegisterType((*QuerySecretContractRequest)(nil), "secret.compute.v1beta1.QuerySecretContractRequest") - proto.RegisterType((*QueryByLabelRequest)(nil), "secret.compute.v1beta1.QueryByLabelRequest") - proto.RegisterType((*QueryByContractAddressRequest)(nil), "secret.compute.v1beta1.QueryByContractAddressRequest") - proto.RegisterType((*QueryByCodeIdRequest)(nil), "secret.compute.v1beta1.QueryByCodeIdRequest") - proto.RegisterType((*QuerySecretContractResponse)(nil), "secret.compute.v1beta1.QuerySecretContractResponse") - proto.RegisterType((*QueryContractInfoResponse)(nil), "secret.compute.v1beta1.QueryContractInfoResponse") - proto.RegisterType((*ContractInfoWithAddress)(nil), "secret.compute.v1beta1.ContractInfoWithAddress") - proto.RegisterType((*QueryContractsByCodeIdResponse)(nil), "secret.compute.v1beta1.QueryContractsByCodeIdResponse") - proto.RegisterType((*CodeInfoResponse)(nil), "secret.compute.v1beta1.CodeInfoResponse") - proto.RegisterType((*QueryCodeResponse)(nil), "secret.compute.v1beta1.QueryCodeResponse") - proto.RegisterType((*QueryCodesResponse)(nil), "secret.compute.v1beta1.QueryCodesResponse") - proto.RegisterType((*QueryContractAddressResponse)(nil), "secret.compute.v1beta1.QueryContractAddressResponse") - proto.RegisterType((*QueryContractLabelResponse)(nil), "secret.compute.v1beta1.QueryContractLabelResponse") - proto.RegisterType((*QueryCodeHashResponse)(nil), "secret.compute.v1beta1.QueryCodeHashResponse") - proto.RegisterType((*DecryptedAnswer)(nil), "secret.compute.v1beta1.DecryptedAnswer") - proto.RegisterType((*DecryptedAnswers)(nil), "secret.compute.v1beta1.DecryptedAnswers") - proto.RegisterType((*QueryContractHistoryRequest)(nil), "secret.compute.v1beta1.QueryContractHistoryRequest") - proto.RegisterType((*QueryContractHistoryResponse)(nil), "secret.compute.v1beta1.QueryContractHistoryResponse") - proto.RegisterType((*QueryAuthorizedMigrationRequest)(nil), "secret.compute.v1beta1.QueryAuthorizedMigrationRequest") - proto.RegisterType((*QueryAuthorizedMigrationResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedMigrationResponse") - proto.RegisterType((*QueryAuthorizedAdminUpdateRequest)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateRequest") - proto.RegisterType((*QueryAuthorizedAdminUpdateResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateResponse") +// QueryEcallRecordRequest is the request type for the Query/EcallRecord RPC method +type QueryEcallRecordRequest struct { + // Block height to query ecall record for + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` } -func init() { - proto.RegisterFile("secret/compute/v1beta1/query.proto", fileDescriptor_7735281c5fa969d4) +func (m *QueryEcallRecordRequest) Reset() { *m = QueryEcallRecordRequest{} } +func (m *QueryEcallRecordRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEcallRecordRequest) ProtoMessage() {} +func (*QueryEcallRecordRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{24} } - -var fileDescriptor_7735281c5fa969d4 = []byte{ - // 1479 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0x4b, 0x8f, 0x13, 0xc7, - 0x16, 0x9e, 0x86, 0x79, 0x30, 0x67, 0x5e, 0x50, 0x0c, 0x83, 0x31, 0x5c, 0x1b, 0xfa, 0xf2, 0x18, - 0x5e, 0x6e, 0x6c, 0xb8, 0xc0, 0x9d, 0xcb, 0x95, 0xe2, 0x19, 0x46, 0x62, 0xa2, 0x61, 0x02, 0x26, - 0x51, 0xa4, 0x88, 0xc8, 0x2a, 0x77, 0x17, 0x76, 0x0b, 0xbb, 0xdb, 0x74, 0x95, 0x99, 0x71, 0x22, - 0xb2, 0xc8, 0x2a, 0xcb, 0x48, 0x49, 0x16, 0x51, 0x36, 0x59, 0x25, 0x28, 0x8b, 0x48, 0xd9, 0x45, - 0xf9, 0x05, 0x28, 0xca, 0x02, 0x89, 0x4d, 0x56, 0x28, 0x19, 0xb2, 0x88, 0xb2, 0xcf, 0x3e, 0xea, - 0x53, 0xd5, 0x3d, 0x6d, 0xbb, 0xfd, 0x9a, 0x2c, 0xb2, 0xeb, 0xaa, 0x3a, 0x8f, 0xef, 0x7c, 0xa7, - 0xaa, 0xce, 0xa9, 0x06, 0x9d, 0x33, 0xd3, 0x63, 0xc2, 0x30, 0xdd, 0x5a, 0xbd, 0x21, 0x98, 0xf1, - 0x38, 0x5b, 0x62, 0x82, 0x66, 0x8d, 0x47, 0x0d, 0xe6, 0x35, 0x33, 0x75, 0xcf, 0x15, 0x2e, 0x59, - 0x90, 0x32, 0x19, 0x25, 0x93, 0x51, 0x32, 0xc9, 0xf9, 0xb2, 0x5b, 0x76, 0x51, 0xc4, 0xf0, 0xbf, - 0xa4, 0x74, 0xb2, 0x9b, 0x45, 0xd1, 0xac, 0x33, 0xae, 0x64, 0xfe, 0xdd, 0x45, 0xa6, 0x4e, 0x3d, - 0x5a, 0x0b, 0x84, 0x8e, 0x96, 0x5d, 0xb7, 0x5c, 0x65, 0x06, 0x8e, 0x4a, 0x8d, 0x07, 0x06, 0xab, - 0xd5, 0x85, 0xc2, 0x94, 0x3c, 0xa6, 0x16, 0x69, 0xdd, 0x36, 0xa8, 0xe3, 0xb8, 0x82, 0x0a, 0xdb, - 0x75, 0x42, 0xfb, 0xa6, 0xcb, 0x6b, 0x2e, 0x37, 0x4a, 0x94, 0x33, 0x83, 0x96, 0x4c, 0x3b, 0xf4, - 0xe0, 0x0f, 0x94, 0xd0, 0xb9, 0xa8, 0x10, 0xc6, 0x1b, 0xc1, 0x51, 0xb6, 0x1d, 0xb4, 0x28, 0x65, - 0xf5, 0x39, 0x98, 0xb9, 0x83, 0xd8, 0x0a, 0xec, 0x51, 0x83, 0x71, 0xa1, 0xbf, 0x09, 0xb3, 0xc1, - 0x04, 0xaf, 0xbb, 0x0e, 0x67, 0xe4, 0x06, 0x8c, 0x4b, 0xf8, 0x09, 0xed, 0xb8, 0xb6, 0x38, 0x95, - 0x4b, 0x65, 0xe2, 0x69, 0xcb, 0x48, 0xbd, 0xe5, 0xd1, 0x67, 0x2f, 0xd3, 0x23, 0x05, 0xa5, 0xb3, - 0x34, 0xfa, 0xfb, 0x97, 0xe9, 0x11, 0xfd, 0x5d, 0x48, 0xde, 0xf5, 0x81, 0xdc, 0x43, 0xcd, 0x15, - 0xd7, 0x11, 0x1e, 0x35, 0x85, 0xf2, 0x49, 0xce, 0xc2, 0x7e, 0x53, 0x4d, 0x15, 0xa9, 0x65, 0x79, - 0x8c, 0x4b, 0x5f, 0x93, 0x85, 0xb9, 0x60, 0x3e, 0x2f, 0xa7, 0xc9, 0x3c, 0x8c, 0x61, 0x44, 0x89, - 0x3d, 0xc7, 0xb5, 0xc5, 0xe9, 0x82, 0x1c, 0xe8, 0xe7, 0xe1, 0x20, 0x9a, 0x5f, 0x6e, 0xae, 0xd3, - 0x12, 0xab, 0x06, 0x76, 0xe7, 0x61, 0xac, 0xea, 0x8f, 0x95, 0x31, 0x39, 0xd0, 0x5f, 0x87, 0x7f, - 0x29, 0xe1, 0x95, 0x56, 0xe3, 0xc3, 0xc3, 0xd1, 0x0d, 0x98, 0x0f, 0x6d, 0x59, 0x6c, 0xcd, 0x0a, - 0x4c, 0x1c, 0x86, 0x09, 0xd3, 0xb5, 0x58, 0xd1, 0xb6, 0x50, 0x73, 0xb4, 0x30, 0x6e, 0xe2, 0xba, - 0x9e, 0x85, 0xa3, 0xb1, 0x44, 0x28, 0xae, 0x09, 0x8c, 0x5a, 0x54, 0x50, 0x54, 0x9a, 0x2e, 0xe0, - 0xb7, 0xfe, 0x85, 0x06, 0x47, 0x50, 0x27, 0x90, 0x5e, 0x73, 0x1e, 0xb8, 0xa1, 0xc6, 0x10, 0xdc, - 0xdd, 0x83, 0x99, 0x50, 0xd4, 0x76, 0x1e, 0xb8, 0xc8, 0xe1, 0x54, 0xee, 0x64, 0xb7, 0x7c, 0x46, - 0xfd, 0x2d, 0xef, 0x7b, 0xfe, 0x32, 0xad, 0xfd, 0xe1, 0x67, 0x76, 0xda, 0x8c, 0xcc, 0xeb, 0x9f, - 0x6b, 0x70, 0x38, 0x2a, 0xf8, 0xb6, 0x2d, 0x2a, 0x81, 0xc3, 0x7f, 0x1a, 0xdb, 0x07, 0x90, 0x6a, - 0x21, 0x8e, 0xef, 0xa4, 0x49, 0xb1, 0x77, 0x1f, 0x66, 0x5b, 0xdc, 0xfa, 0xf8, 0xf6, 0x2e, 0x4e, - 0xe5, 0x8c, 0x41, 0xfc, 0x46, 0x42, 0x55, 0x9b, 0x7e, 0x26, 0xea, 0x9e, 0xeb, 0x9f, 0x6a, 0xb0, - 0x1f, 0x1d, 0x46, 0x13, 0xd6, 0x6d, 0x6b, 0x90, 0x04, 0x4c, 0x98, 0x1e, 0xa3, 0xc2, 0xf5, 0x30, - 0xf8, 0xc9, 0x42, 0x30, 0x24, 0x47, 0x61, 0x12, 0x55, 0x2a, 0x94, 0x57, 0x12, 0x7b, 0x71, 0x6d, - 0x9f, 0x3f, 0x71, 0x8b, 0xf2, 0x0a, 0x59, 0x80, 0x71, 0xee, 0x36, 0x3c, 0x93, 0x25, 0x46, 0x71, - 0x45, 0x8d, 0x7c, 0x73, 0xa5, 0x86, 0x5d, 0xb5, 0x98, 0x97, 0x18, 0x93, 0xe6, 0xd4, 0x50, 0xdf, - 0x82, 0x03, 0x8a, 0x16, 0x8b, 0x85, 0xb0, 0xde, 0x50, 0x3e, 0x90, 0x7c, 0x79, 0xd0, 0x17, 0xbb, - 0x93, 0xd0, 0x1a, 0x53, 0x24, 0x01, 0x88, 0xcb, 0x5f, 0xf3, 0xb7, 0xf2, 0x26, 0xe5, 0x35, 0x75, - 0x50, 0xf1, 0x5b, 0x37, 0x81, 0x84, 0x9e, 0x77, 0x2e, 0x98, 0xdb, 0x00, 0xa1, 0xeb, 0x20, 0x01, - 0x83, 0xfb, 0x96, 0xcc, 0x4f, 0x06, 0x7e, 0xb9, 0xbe, 0x06, 0xc7, 0x5a, 0xb2, 0x1e, 0x9e, 0xee, - 0xa1, 0x4f, 0x8c, 0x9e, 0x53, 0xd7, 0x56, 0x60, 0x4a, 0xdd, 0x2e, 0xca, 0x50, 0xfc, 0xf5, 0x72, - 0x05, 0x0e, 0x85, 0x31, 0xfa, 0x09, 0x0a, 0xc5, 0x5b, 0xb2, 0xa8, 0xb5, 0x66, 0x51, 0xff, 0x4c, - 0x83, 0xb9, 0x9b, 0xcc, 0xf4, 0x9a, 0x75, 0xc1, 0xac, 0xbc, 0xc3, 0x37, 0x99, 0xe7, 0x33, 0xe8, - 0xd7, 0x16, 0x25, 0x8b, 0xdf, 0xbe, 0x4f, 0xdb, 0xa9, 0x37, 0x84, 0xda, 0x22, 0x72, 0x40, 0xd2, - 0x30, 0xe5, 0x36, 0x44, 0xbd, 0x21, 0x8a, 0x78, 0x7b, 0xc8, 0x2d, 0x02, 0x72, 0xea, 0x26, 0x15, - 0x94, 0x64, 0xe1, 0x50, 0x44, 0xa0, 0x48, 0x79, 0x91, 0x0b, 0xcf, 0x76, 0xca, 0x6a, 0xcf, 0x90, - 0x1d, 0xd1, 0x3c, 0xbf, 0x87, 0x2b, 0xea, 0xe2, 0xfe, 0x53, 0x83, 0xfd, 0x6d, 0xb8, 0x38, 0xc9, - 0xc3, 0x04, 0x95, 0x9f, 0x2a, 0x5b, 0x67, 0xba, 0x65, 0xab, 0x4d, 0xb5, 0x10, 0xe8, 0x91, 0xf5, - 0x10, 0x71, 0xd5, 0x2d, 0xf3, 0xc4, 0x1e, 0x34, 0x73, 0x2a, 0x23, 0x2b, 0x57, 0xc6, 0xaf, 0x5c, - 0x19, 0xac, 0x68, 0x81, 0x21, 0x09, 0x6a, 0xf5, 0x31, 0x73, 0x84, 0xca, 0xb8, 0x0a, 0x6f, 0xdd, - 0x2d, 0x73, 0x72, 0x02, 0xa6, 0x95, 0x35, 0xe6, 0x79, 0xae, 0xa7, 0x08, 0x50, 0x1e, 0x56, 0xfd, - 0x29, 0x72, 0x06, 0xe6, 0xea, 0x55, 0x6a, 0x3b, 0x82, 0x6d, 0x05, 0x52, 0x32, 0xf6, 0xd9, 0x70, - 0x1a, 0x05, 0x55, 0xdc, 0x1b, 0xea, 0x9e, 0x0e, 0x32, 0x7f, 0xcb, 0xe6, 0xc2, 0xf5, 0x9a, 0xc3, - 0x97, 0x08, 0x65, 0xef, 0x71, 0xdb, 0xa6, 0x0c, 0xed, 0xa9, 0xcd, 0x71, 0x07, 0x26, 0x98, 0x23, - 0x3c, 0x9b, 0x05, 0x94, 0x5e, 0xea, 0x77, 0x03, 0xe1, 0xfe, 0x92, 0x56, 0x56, 0x1d, 0xe1, 0x35, - 0x15, 0x2d, 0x81, 0x19, 0xe5, 0x77, 0x1d, 0xd2, 0xe8, 0x37, 0xdf, 0x10, 0x15, 0xd7, 0xb3, 0xdf, - 0x63, 0xd6, 0x6d, 0xbb, 0xec, 0x61, 0x07, 0xb0, 0x8b, 0x72, 0x77, 0x17, 0x8e, 0x77, 0xb7, 0xa6, - 0x22, 0xb9, 0x08, 0x53, 0x0e, 0xdb, 0x2c, 0xb6, 0xdc, 0x71, 0xcb, 0x33, 0xdb, 0x2f, 0xd3, 0x93, - 0x1b, 0x6c, 0x13, 0x4f, 0xef, 0xcd, 0xc2, 0xa4, 0xa3, 0x3e, 0x2d, 0x7d, 0x03, 0x4e, 0xb4, 0x99, - 0xcc, 0x5b, 0x35, 0xdb, 0x79, 0xab, 0x6e, 0x51, 0xc1, 0x76, 0x01, 0x31, 0x0f, 0x7a, 0x2f, 0x7b, - 0x3b, 0x67, 0xd1, 0x07, 0x49, 0xfd, 0xa5, 0xe0, 0x2c, 0x3a, 0x6c, 0x13, 0x45, 0x73, 0xdf, 0x1f, - 0x80, 0x31, 0xb4, 0x41, 0xbe, 0xd1, 0x60, 0x3a, 0x7a, 0xe3, 0x93, 0xff, 0x74, 0xcb, 0x4a, 0xcf, - 0x8e, 0x22, 0x99, 0xed, 0xa9, 0x16, 0x57, 0xd7, 0xf5, 0x4b, 0x1f, 0xbe, 0xf8, 0xed, 0x93, 0x3d, - 0xe7, 0xc8, 0x62, 0x47, 0x2f, 0xe9, 0x5f, 0x93, 0xc6, 0xfb, 0xed, 0x7c, 0x3c, 0x21, 0x5f, 0x6b, - 0x70, 0xa0, 0xa3, 0xd2, 0x91, 0x0b, 0x7d, 0x11, 0x47, 0xfa, 0x96, 0xe4, 0xd5, 0x81, 0x80, 0x76, - 0xd4, 0x51, 0xfd, 0x02, 0xa2, 0x3d, 0x4d, 0x4e, 0x76, 0xa0, 0x0d, 0x70, 0x72, 0x1f, 0x32, 0x6e, - 0x89, 0x27, 0xe4, 0x3b, 0x4d, 0xf5, 0x6b, 0xad, 0x5d, 0x10, 0xc9, 0xf5, 0xf4, 0x1e, 0xdb, 0x3b, - 0x26, 0x2f, 0x0f, 0xa5, 0xa3, 0xe0, 0x66, 0x11, 0xee, 0x79, 0x72, 0x36, 0xfe, 0x79, 0x10, 0xc7, - 0xee, 0x47, 0x1a, 0x8c, 0xfa, 0x41, 0x0f, 0x49, 0xe8, 0xd9, 0x3e, 0x84, 0xee, 0x54, 0x60, 0xfd, - 0x0c, 0x82, 0x3a, 0x41, 0xd2, 0x31, 0x1c, 0x5a, 0x2c, 0x42, 0xdf, 0x43, 0x18, 0xc3, 0x02, 0x4a, - 0x16, 0x32, 0xf2, 0xb1, 0x90, 0x09, 0x5e, 0x12, 0x99, 0x55, 0xff, 0x25, 0x91, 0x3c, 0xd7, 0xd7, - 0x69, 0x58, 0x0d, 0xf5, 0x14, 0x7a, 0x4d, 0x90, 0x85, 0x58, 0xaf, 0x9c, 0xfc, 0xa4, 0xc1, 0x91, - 0xa0, 0x94, 0x75, 0xec, 0xef, 0xdd, 0x9e, 0x87, 0x8b, 0x7d, 0x01, 0x46, 0x2b, 0xa7, 0xbe, 0x86, - 0x18, 0x57, 0x48, 0x3e, 0x16, 0x23, 0x16, 0x54, 0xa3, 0xd4, 0x2c, 0xb6, 0x27, 0x2d, 0x2e, 0x8d, - 0x4f, 0x55, 0x4b, 0x16, 0x84, 0xb3, 0x8b, 0x33, 0x32, 0x24, 0xf8, 0x6b, 0x08, 0x3e, 0x4b, 0x8c, - 0x7e, 0xe0, 0x31, 0xbb, 0x91, 0x34, 0x7f, 0xab, 0xc1, 0x2c, 0x36, 0x1c, 0xcb, 0xcd, 0xbf, 0x49, - 0x77, 0x6e, 0xa0, 0x53, 0xdd, 0xd2, 0xdc, 0xf4, 0x38, 0x22, 0xd8, 0xe6, 0xc4, 0x71, 0xfb, 0x95, - 0x06, 0xb3, 0x41, 0x3f, 0x2c, 0x1f, 0x62, 0xe4, 0x7c, 0x1f, 0xc0, 0xd1, 0xe7, 0x5a, 0xf2, 0xca, - 0x40, 0x30, 0xdb, 0xda, 0xb9, 0x1e, 0x40, 0x3b, 0xf7, 0x03, 0x42, 0x7f, 0x42, 0x7e, 0xd0, 0x60, - 0xae, 0xad, 0x10, 0x93, 0xcb, 0x03, 0x39, 0x6f, 0x6d, 0x03, 0x06, 0x44, 0xdc, 0x56, 0xeb, 0xf5, - 0x1b, 0x88, 0xf8, 0x2a, 0xb9, 0xd2, 0x1d, 0x71, 0x45, 0xaa, 0xc4, 0xb1, 0xbc, 0x05, 0xe3, 0xf2, - 0xa1, 0x4d, 0x4e, 0xf5, 0x7e, 0x88, 0x07, 0x20, 0x4f, 0xf7, 0x13, 0x53, 0xb0, 0xd2, 0x08, 0xeb, - 0x08, 0x39, 0xdc, 0xe5, 0xef, 0x05, 0xf9, 0x51, 0x83, 0x83, 0x31, 0x95, 0x9f, 0x5c, 0xeb, 0xc9, - 0x42, 0xf7, 0xce, 0x23, 0x79, 0x7d, 0x78, 0x45, 0x85, 0xf5, 0x35, 0xc4, 0xba, 0x44, 0xae, 0x77, - 0x60, 0xa5, 0xa1, 0x56, 0xb1, 0x16, 0xa8, 0xc5, 0xd1, 0xf8, 0x42, 0x83, 0x43, 0xb1, 0x3d, 0x02, - 0xf9, 0xef, 0x80, 0xa8, 0x3a, 0xfb, 0x94, 0xe4, 0xd2, 0x6e, 0x54, 0x55, 0x48, 0x2b, 0x18, 0xd2, - 0xff, 0xc9, 0xff, 0x7a, 0x85, 0x84, 0x0d, 0x4b, 0xb1, 0x81, 0x9a, 0x31, 0x51, 0x2d, 0xdf, 0x7f, - 0xf6, 0x6b, 0x6a, 0xe4, 0xe9, 0x76, 0x4a, 0x7b, 0xb6, 0x9d, 0xd2, 0x9e, 0x6f, 0xa7, 0xb4, 0x5f, - 0xb6, 0x53, 0xda, 0xc7, 0xaf, 0x52, 0x23, 0xcf, 0x5f, 0xa5, 0x46, 0x7e, 0x7e, 0x95, 0x1a, 0x79, - 0x67, 0xa9, 0x6c, 0x8b, 0x4a, 0xa3, 0xe4, 0x23, 0x34, 0xb8, 0xe9, 0x89, 0x2a, 0x2d, 0x71, 0x43, - 0x96, 0xc9, 0x0d, 0x26, 0x36, 0x5d, 0xef, 0xa1, 0xb1, 0x15, 0x22, 0xf0, 0xfb, 0x62, 0xcf, 0xa1, - 0x55, 0xf9, 0x8f, 0xab, 0x34, 0x8e, 0x75, 0xe6, 0xf2, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x37, - 0xfa, 0xf2, 0xdf, 0x5c, 0x13, 0x00, 0x00, +func (m *QueryEcallRecordRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (this *ParamsRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*ParamsRequest) - if !ok { - that2, ok := that.(ParamsRequest) - if ok { - that1 = &that2 - } else { - return false +func (m *QueryEcallRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEcallRecordRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - return true } -func (this *QuerySecretContractRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEcallRecordRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEcallRecordRequest.Merge(m, src) +} +func (m *QueryEcallRecordRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEcallRecordRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEcallRecordRequest.DiscardUnknown(m) +} - that1, ok := that.(*QuerySecretContractRequest) - if !ok { - that2, ok := that.(QuerySecretContractRequest) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - if !bytes.Equal(this.Query, that1.Query) { - return false - } - return true +var xxx_messageInfo_QueryEcallRecordRequest proto.InternalMessageInfo + +// QueryEcallRecordResponse is the response type for the Query/EcallRecord RPC method +type QueryEcallRecordResponse struct { + // Block height + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // Random seed from SubmitBlockSignatures (32 bytes) + RandomSeed []byte `protobuf:"bytes,2,opt,name=random_seed,json=randomSeed,proto3" json:"random_seed,omitempty"` + // Validator set evidence from SubmitBlockSignatures (32 bytes) + ValidatorSetEvidence []byte `protobuf:"bytes,3,opt,name=validator_set_evidence,json=validatorSetEvidence,proto3" json:"validator_set_evidence,omitempty"` } -func (this *QueryByLabelRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*QueryByLabelRequest) - if !ok { - that2, ok := that.(QueryByLabelRequest) - if ok { - that1 = &that2 - } else { - return false +func (m *QueryEcallRecordResponse) Reset() { *m = QueryEcallRecordResponse{} } +func (m *QueryEcallRecordResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEcallRecordResponse) ProtoMessage() {} +func (*QueryEcallRecordResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{25} +} +func (m *QueryEcallRecordResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEcallRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEcallRecordResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Label != that1.Label { - return false - } - return true } -func (this *QueryByContractAddressRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEcallRecordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEcallRecordResponse.Merge(m, src) +} +func (m *QueryEcallRecordResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEcallRecordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEcallRecordResponse.DiscardUnknown(m) +} - that1, ok := that.(*QueryByContractAddressRequest) - if !ok { - that2, ok := that.(QueryByContractAddressRequest) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEcallRecordResponse proto.InternalMessageInfo + +// QueryNetworkPubkeyRequest is the request type for the Query/NetworkPubkey RPC +type QueryNetworkPubkeyRequest struct { + // Block height to query network pubkey for + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // Seed index + ISeed uint32 `protobuf:"varint,2,opt,name=i_seed,json=iSeed,proto3" json:"i_seed,omitempty"` +} + +func (m *QueryNetworkPubkeyRequest) Reset() { *m = QueryNetworkPubkeyRequest{} } +func (m *QueryNetworkPubkeyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryNetworkPubkeyRequest) ProtoMessage() {} +func (*QueryNetworkPubkeyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{26} +} +func (m *QueryNetworkPubkeyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNetworkPubkeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNetworkPubkeyRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - return true } -func (this *QueryByCodeIdRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryNetworkPubkeyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNetworkPubkeyRequest.Merge(m, src) +} +func (m *QueryNetworkPubkeyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryNetworkPubkeyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNetworkPubkeyRequest.DiscardUnknown(m) +} - that1, ok := that.(*QueryByCodeIdRequest) - if !ok { - that2, ok := that.(QueryByCodeIdRequest) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryNetworkPubkeyRequest proto.InternalMessageInfo + +// QueryNetworkPubkeyResponse is the response type for the Query/NetworkPubkey RPC +type QueryNetworkPubkeyResponse struct { + NodePubkey []byte `protobuf:"bytes,1,opt,name=node_pubkey,json=nodePubkey,proto3" json:"node_pubkey,omitempty"` + IoPubkey []byte `protobuf:"bytes,2,opt,name=io_pubkey,json=ioPubkey,proto3" json:"io_pubkey,omitempty"` +} + +func (m *QueryNetworkPubkeyResponse) Reset() { *m = QueryNetworkPubkeyResponse{} } +func (m *QueryNetworkPubkeyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryNetworkPubkeyResponse) ProtoMessage() {} +func (*QueryNetworkPubkeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{27} +} +func (m *QueryNetworkPubkeyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNetworkPubkeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNetworkPubkeyResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.CodeId != that1.CodeId { - return false - } - return true } -func (this *QuerySecretContractResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryNetworkPubkeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNetworkPubkeyResponse.Merge(m, src) +} +func (m *QueryNetworkPubkeyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryNetworkPubkeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNetworkPubkeyResponse.DiscardUnknown(m) +} - that1, ok := that.(*QuerySecretContractResponse) - if !ok { - that2, ok := that.(QuerySecretContractResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryNetworkPubkeyResponse proto.InternalMessageInfo + +// QueryEcallRecordsRequest is the request type for the Query/EcallRecords RPC method +type QueryEcallRecordsRequest struct { + // Start block height (inclusive) + StartHeight int64 `protobuf:"varint,1,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + // End block height (inclusive) + EndHeight int64 `protobuf:"varint,2,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` +} + +func (m *QueryEcallRecordsRequest) Reset() { *m = QueryEcallRecordsRequest{} } +func (m *QueryEcallRecordsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEcallRecordsRequest) ProtoMessage() {} +func (*QueryEcallRecordsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{28} +} +func (m *QueryEcallRecordsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEcallRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEcallRecordsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Data, that1.Data) { - return false - } - return true } -func (this *QueryContractInfoResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEcallRecordsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEcallRecordsRequest.Merge(m, src) +} +func (m *QueryEcallRecordsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEcallRecordsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEcallRecordsRequest.DiscardUnknown(m) +} - that1, ok := that.(*QueryContractInfoResponse) - if !ok { - that2, ok := that.(QueryContractInfoResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEcallRecordsRequest proto.InternalMessageInfo + +// QueryEcallRecordsResponse is the response type for the Query/EcallRecords RPC method +type QueryEcallRecordsResponse struct { + // List of ecall records + Records []QueryEcallRecordResponse `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` +} + +func (m *QueryEcallRecordsResponse) Reset() { *m = QueryEcallRecordsResponse{} } +func (m *QueryEcallRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEcallRecordsResponse) ProtoMessage() {} +func (*QueryEcallRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{29} +} +func (m *QueryEcallRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEcallRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEcallRecordsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - if !this.ContractInfo.Equal(that1.ContractInfo) { - return false - } - return true } -func (this *ContractInfoWithAddress) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEcallRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEcallRecordsResponse.Merge(m, src) +} +func (m *QueryEcallRecordsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEcallRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEcallRecordsResponse.DiscardUnknown(m) +} - that1, ok := that.(*ContractInfoWithAddress) - if !ok { - that2, ok := that.(ContractInfoWithAddress) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - if !this.ContractInfo.Equal(that1.ContractInfo) { - return false - } - return true +var xxx_messageInfo_QueryEcallRecordsResponse proto.InternalMessageInfo + +// QueryEncryptedSeedRequest is the request type for the Query/EncryptedSeed RPC method +type QueryEncryptedSeedRequest struct { + // Certificate hash (hex encoded sha256 of certificate) + CertHash string `protobuf:"bytes,1,opt,name=cert_hash,json=certHash,proto3" json:"cert_hash,omitempty"` + // Block height at which the seed was recorded (required for per-height keying) + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` } -func (this *QueryContractsByCodeIdResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*QueryContractsByCodeIdResponse) - if !ok { - that2, ok := that.(QueryContractsByCodeIdResponse) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.ContractInfos) != len(that1.ContractInfos) { - return false - } - for i := range this.ContractInfos { - if !this.ContractInfos[i].Equal(&that1.ContractInfos[i]) { - return false +func (m *QueryEncryptedSeedRequest) Reset() { *m = QueryEncryptedSeedRequest{} } +func (m *QueryEncryptedSeedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEncryptedSeedRequest) ProtoMessage() {} +func (*QueryEncryptedSeedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{30} +} +func (m *QueryEncryptedSeedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEncryptedSeedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEncryptedSeedRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - return true } -func (this *CodeInfoResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEncryptedSeedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEncryptedSeedRequest.Merge(m, src) +} +func (m *QueryEncryptedSeedRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEncryptedSeedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEncryptedSeedRequest.DiscardUnknown(m) +} - that1, ok := that.(*CodeInfoResponse) - if !ok { - that2, ok := that.(CodeInfoResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEncryptedSeedRequest proto.InternalMessageInfo + +// QueryEncryptedSeedResponse is the response type for the Query/EncryptedSeed RPC method +type QueryEncryptedSeedResponse struct { + // Encrypted seed data + EncryptedSeed []byte `protobuf:"bytes,1,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` +} + +func (m *QueryEncryptedSeedResponse) Reset() { *m = QueryEncryptedSeedResponse{} } +func (m *QueryEncryptedSeedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEncryptedSeedResponse) ProtoMessage() {} +func (*QueryEncryptedSeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{31} +} +func (m *QueryEncryptedSeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEncryptedSeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEncryptedSeedResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.CodeId != that1.CodeId { - return false - } - if this.Creator != that1.Creator { - return false - } - if this.CodeHash != that1.CodeHash { - return false - } - if this.Source != that1.Source { - return false - } - if this.Builder != that1.Builder { - return false - } - return true } -func (this *QueryCodeResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEncryptedSeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEncryptedSeedResponse.Merge(m, src) +} +func (m *QueryEncryptedSeedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEncryptedSeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEncryptedSeedResponse.DiscardUnknown(m) +} - that1, ok := that.(*QueryCodeResponse) - if !ok { - that2, ok := that.(QueryCodeResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEncryptedSeedResponse proto.InternalMessageInfo + +// StorageOp represents a single storage operation (Set or Delete) +type StorageOp struct { + // True if this is a delete operation, false for set + IsDelete bool `protobuf:"varint,1,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` + // Storage key + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // Storage value (empty for delete operations) + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *StorageOp) Reset() { *m = StorageOp{} } +func (m *StorageOp) String() string { return proto.CompactTextString(m) } +func (*StorageOp) ProtoMessage() {} +func (*StorageOp) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{32} +} +func (m *StorageOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StorageOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StorageOp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CodeInfoResponse.Equal(that1.CodeInfoResponse) { - return false - } - if !bytes.Equal(this.Wasm, that1.Wasm) { - return false - } - return true } -func (this *QueryCodesResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *StorageOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageOp.Merge(m, src) +} +func (m *StorageOp) XXX_Size() int { + return m.Size() +} +func (m *StorageOp) XXX_DiscardUnknown() { + xxx_messageInfo_StorageOp.DiscardUnknown(m) +} - that1, ok := that.(*QueryCodesResponse) - if !ok { - that2, ok := that.(QueryCodesResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_StorageOp proto.InternalMessageInfo + +// CrossModuleOp represents a storage operation on a different module's store +type CrossModuleOp struct { + // The store key identifying the module (e.g., "bank", "staking") + StoreKey string `protobuf:"bytes,1,opt,name=store_key,json=storeKey,proto3" json:"store_key,omitempty"` + // Storage key within the module's store + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // Storage value (empty for delete operations) + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + // True if this is a delete operation, false for set + IsDelete bool `protobuf:"varint,4,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` +} + +func (m *CrossModuleOp) Reset() { *m = CrossModuleOp{} } +func (m *CrossModuleOp) String() string { return proto.CompactTextString(m) } +func (*CrossModuleOp) ProtoMessage() {} +func (*CrossModuleOp) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{33} +} +func (m *CrossModuleOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CrossModuleOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CrossModuleOp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.CodeInfos) != len(that1.CodeInfos) { - return false - } - for i := range this.CodeInfos { - if !this.CodeInfos[i].Equal(&that1.CodeInfos[i]) { - return false +} +func (m *CrossModuleOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_CrossModuleOp.Merge(m, src) +} +func (m *CrossModuleOp) XXX_Size() int { + return m.Size() +} +func (m *CrossModuleOp) XXX_DiscardUnknown() { + xxx_messageInfo_CrossModuleOp.DiscardUnknown(m) +} + +var xxx_messageInfo_CrossModuleOp proto.InternalMessageInfo + +// ExecutionTraceData is a single execution trace with its index +type ExecutionTraceData struct { + // Execution index within the block + Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + // List of storage operations performed during execution + Ops []StorageOp `protobuf:"bytes,2,rep,name=ops,proto3" json:"ops"` + // Return value from the contract execution + Result []byte `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` + // Gas used during execution (compute gas from WASM) + GasUsed uint64 `protobuf:"varint,4,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + // Gas consumed by callbacks (store operations) during execution + CallbackGas uint64 `protobuf:"varint,7,opt,name=callback_gas,json=callbackGas,proto3" json:"callback_gas,omitempty"` + // Whether the execution resulted in an error + HasError bool `protobuf:"varint,5,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + // Error message (if has_error is true) + ErrorMsg string `protobuf:"bytes,6,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` + // List of cross-module storage operations (e.g., bank balance changes) + CrossOps []CrossModuleOp `protobuf:"bytes,8,rep,name=cross_ops,json=crossOps,proto3" json:"cross_ops"` +} + +func (m *ExecutionTraceData) Reset() { *m = ExecutionTraceData{} } +func (m *ExecutionTraceData) String() string { return proto.CompactTextString(m) } +func (*ExecutionTraceData) ProtoMessage() {} +func (*ExecutionTraceData) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{34} +} +func (m *ExecutionTraceData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExecutionTraceData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExecutionTraceData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - return true } -func (this *QueryContractAddressResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *ExecutionTraceData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExecutionTraceData.Merge(m, src) +} +func (m *ExecutionTraceData) XXX_Size() int { + return m.Size() +} +func (m *ExecutionTraceData) XXX_DiscardUnknown() { + xxx_messageInfo_ExecutionTraceData.DiscardUnknown(m) +} - that1, ok := that.(*QueryContractAddressResponse) - if !ok { - that2, ok := that.(QueryContractAddressResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_ExecutionTraceData proto.InternalMessageInfo + +// QueryBlockTracesRequest is the request type for the Query/BlockTraces RPC method +type QueryBlockTracesRequest struct { + // Block height to query traces for + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryBlockTracesRequest) Reset() { *m = QueryBlockTracesRequest{} } +func (m *QueryBlockTracesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlockTracesRequest) ProtoMessage() {} +func (*QueryBlockTracesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{35} +} +func (m *QueryBlockTracesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockTracesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockTracesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - return true } -func (this *QueryContractLabelResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil +func (m *QueryBlockTracesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockTracesRequest.Merge(m, src) +} +func (m *QueryBlockTracesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockTracesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockTracesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlockTracesRequest proto.InternalMessageInfo + +// QueryBlockTracesResponse is the response type for the Query/BlockTraces RPC method +type QueryBlockTracesResponse struct { + // All execution traces for the block + Traces []ExecutionTraceData `protobuf:"bytes,1,rep,name=traces,proto3" json:"traces"` +} + +func (m *QueryBlockTracesResponse) Reset() { *m = QueryBlockTracesResponse{} } +func (m *QueryBlockTracesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlockTracesResponse) ProtoMessage() {} +func (*QueryBlockTracesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{36} +} +func (m *QueryBlockTracesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockTracesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockTracesResponse.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 *QueryBlockTracesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockTracesResponse.Merge(m, src) +} +func (m *QueryBlockTracesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockTracesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockTracesResponse.DiscardUnknown(m) +} - that1, ok := that.(*QueryContractLabelResponse) - if !ok { - that2, ok := that.(QueryContractLabelResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryBlockTracesResponse proto.InternalMessageInfo + +// QueryMachineIDProofRequest is the request type for the Query/MachineIDProof RPC method +type QueryMachineIDProofRequest struct { + // Block height where the machine ID was approved + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // Machine ID (hex encoded) + MachineId string `protobuf:"bytes,2,opt,name=machine_id,json=machineId,proto3" json:"machine_id,omitempty"` +} + +func (m *QueryMachineIDProofRequest) Reset() { *m = QueryMachineIDProofRequest{} } +func (m *QueryMachineIDProofRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMachineIDProofRequest) ProtoMessage() {} +func (*QueryMachineIDProofRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{37} +} +func (m *QueryMachineIDProofRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMachineIDProofRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMachineIDProofRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false +} +func (m *QueryMachineIDProofRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMachineIDProofRequest.Merge(m, src) +} +func (m *QueryMachineIDProofRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryMachineIDProofRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMachineIDProofRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMachineIDProofRequest proto.InternalMessageInfo + +// QueryMachineIDProofResponse is the response type for the Query/MachineIDProof RPC method +type QueryMachineIDProofResponse struct { + // Proof bytes (32 bytes) + Proof []byte `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (m *QueryMachineIDProofResponse) Reset() { *m = QueryMachineIDProofResponse{} } +func (m *QueryMachineIDProofResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMachineIDProofResponse) ProtoMessage() {} +func (*QueryMachineIDProofResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{38} +} +func (m *QueryMachineIDProofResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMachineIDProofResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMachineIDProofResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - if this.Label != that1.Label { - return false +} +func (m *QueryMachineIDProofResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMachineIDProofResponse.Merge(m, src) +} +func (m *QueryMachineIDProofResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryMachineIDProofResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMachineIDProofResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMachineIDProofResponse proto.InternalMessageInfo + +// QueryAnalyzeCodeRequest is the request type for the Query/AnalyzeCode RPC method +type QueryAnalyzeCodeRequest struct { + // Code hash (raw bytes, typically 32 bytes SHA256) + CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` +} + +func (m *QueryAnalyzeCodeRequest) Reset() { *m = QueryAnalyzeCodeRequest{} } +func (m *QueryAnalyzeCodeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAnalyzeCodeRequest) ProtoMessage() {} +func (*QueryAnalyzeCodeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{39} +} +func (m *QueryAnalyzeCodeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAnalyzeCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAnalyzeCodeRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return true } -func (this *QueryCodeHashResponse) Equal(that interface{}) bool { +func (m *QueryAnalyzeCodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAnalyzeCodeRequest.Merge(m, src) +} +func (m *QueryAnalyzeCodeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAnalyzeCodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAnalyzeCodeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAnalyzeCodeRequest proto.InternalMessageInfo + +// QueryAnalyzeCodeResponse is the response type for the Query/AnalyzeCode RPC method +type QueryAnalyzeCodeResponse struct { + // Whether the code has IBC entry points (ibc_channel_open, ibc_channel_connect, etc.) + HasIbcEntryPoints bool `protobuf:"varint,1,opt,name=has_ibc_entry_points,json=hasIbcEntryPoints,proto3" json:"has_ibc_entry_points,omitempty"` + // Comma-separated list of required features (e.g., "staking", "stargate") + RequiredFeatures string `protobuf:"bytes,2,opt,name=required_features,json=requiredFeatures,proto3" json:"required_features,omitempty"` +} + +func (m *QueryAnalyzeCodeResponse) Reset() { *m = QueryAnalyzeCodeResponse{} } +func (m *QueryAnalyzeCodeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAnalyzeCodeResponse) ProtoMessage() {} +func (*QueryAnalyzeCodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{40} +} +func (m *QueryAnalyzeCodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAnalyzeCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAnalyzeCodeResponse.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 *QueryAnalyzeCodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAnalyzeCodeResponse.Merge(m, src) +} +func (m *QueryAnalyzeCodeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAnalyzeCodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAnalyzeCodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAnalyzeCodeResponse proto.InternalMessageInfo + +// CreateResultData stores the outcome of a single MsgStoreCode execution +type CreateResultData struct { + // SHA256 of the original WASM bytecode + WasmHash []byte `protobuf:"bytes,1,opt,name=wasm_hash,json=wasmHash,proto3" json:"wasm_hash,omitempty"` + // Code hash computed by the enclave (empty on error) + CodeHash []byte `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` + // Whether the enclave rejected the code + HasError bool `protobuf:"varint,3,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + // Error message (if has_error is true) + ErrorMsg string `protobuf:"bytes,4,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` +} + +func (m *CreateResultData) Reset() { *m = CreateResultData{} } +func (m *CreateResultData) String() string { return proto.CompactTextString(m) } +func (*CreateResultData) ProtoMessage() {} +func (*CreateResultData) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{41} +} +func (m *CreateResultData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateResultData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateResultData.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 *CreateResultData) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateResultData.Merge(m, src) +} +func (m *CreateResultData) XXX_Size() int { + return m.Size() +} +func (m *CreateResultData) XXX_DiscardUnknown() { + xxx_messageInfo_CreateResultData.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateResultData proto.InternalMessageInfo + +// QueryBlockCreateResultsRequest is the request type for the Query/BlockCreateResults RPC method +type QueryBlockCreateResultsRequest struct { + // Block height to query Create results for + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryBlockCreateResultsRequest) Reset() { *m = QueryBlockCreateResultsRequest{} } +func (m *QueryBlockCreateResultsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlockCreateResultsRequest) ProtoMessage() {} +func (*QueryBlockCreateResultsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{42} +} +func (m *QueryBlockCreateResultsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockCreateResultsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockCreateResultsRequest.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 *QueryBlockCreateResultsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockCreateResultsRequest.Merge(m, src) +} +func (m *QueryBlockCreateResultsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockCreateResultsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockCreateResultsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlockCreateResultsRequest proto.InternalMessageInfo + +// QueryBlockCreateResultsResponse is the response type for the Query/BlockCreateResults RPC method +type QueryBlockCreateResultsResponse struct { + // All Create results for the block + Results []CreateResultData `protobuf:"bytes,1,rep,name=results,proto3" json:"results"` +} + +func (m *QueryBlockCreateResultsResponse) Reset() { *m = QueryBlockCreateResultsResponse{} } +func (m *QueryBlockCreateResultsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlockCreateResultsResponse) ProtoMessage() {} +func (*QueryBlockCreateResultsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{43} +} +func (m *QueryBlockCreateResultsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockCreateResultsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockCreateResultsResponse.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 *QueryBlockCreateResultsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockCreateResultsResponse.Merge(m, src) +} +func (m *QueryBlockCreateResultsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockCreateResultsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockCreateResultsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlockCreateResultsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ParamsRequest)(nil), "secret.compute.v1beta1.ParamsRequest") + proto.RegisterType((*ParamsResponse)(nil), "secret.compute.v1beta1.ParamsResponse") + proto.RegisterType((*QuerySecretContractRequest)(nil), "secret.compute.v1beta1.QuerySecretContractRequest") + proto.RegisterType((*QueryByLabelRequest)(nil), "secret.compute.v1beta1.QueryByLabelRequest") + proto.RegisterType((*QueryByContractAddressRequest)(nil), "secret.compute.v1beta1.QueryByContractAddressRequest") + proto.RegisterType((*QueryByCodeIdRequest)(nil), "secret.compute.v1beta1.QueryByCodeIdRequest") + proto.RegisterType((*QuerySecretContractResponse)(nil), "secret.compute.v1beta1.QuerySecretContractResponse") + proto.RegisterType((*QueryContractInfoResponse)(nil), "secret.compute.v1beta1.QueryContractInfoResponse") + proto.RegisterType((*ContractInfoWithAddress)(nil), "secret.compute.v1beta1.ContractInfoWithAddress") + proto.RegisterType((*QueryContractsByCodeIdResponse)(nil), "secret.compute.v1beta1.QueryContractsByCodeIdResponse") + proto.RegisterType((*CodeInfoResponse)(nil), "secret.compute.v1beta1.CodeInfoResponse") + proto.RegisterType((*QueryCodeResponse)(nil), "secret.compute.v1beta1.QueryCodeResponse") + proto.RegisterType((*QueryCodesResponse)(nil), "secret.compute.v1beta1.QueryCodesResponse") + proto.RegisterType((*QueryContractAddressResponse)(nil), "secret.compute.v1beta1.QueryContractAddressResponse") + proto.RegisterType((*QueryContractLabelResponse)(nil), "secret.compute.v1beta1.QueryContractLabelResponse") + proto.RegisterType((*QueryCodeHashResponse)(nil), "secret.compute.v1beta1.QueryCodeHashResponse") + proto.RegisterType((*DecryptedAnswer)(nil), "secret.compute.v1beta1.DecryptedAnswer") + proto.RegisterType((*DecryptedAnswers)(nil), "secret.compute.v1beta1.DecryptedAnswers") + proto.RegisterType((*QueryContractHistoryRequest)(nil), "secret.compute.v1beta1.QueryContractHistoryRequest") + proto.RegisterType((*QueryContractHistoryResponse)(nil), "secret.compute.v1beta1.QueryContractHistoryResponse") + proto.RegisterType((*QueryAuthorizedMigrationRequest)(nil), "secret.compute.v1beta1.QueryAuthorizedMigrationRequest") + proto.RegisterType((*QueryAuthorizedMigrationResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedMigrationResponse") + proto.RegisterType((*QueryAuthorizedAdminUpdateRequest)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateRequest") + proto.RegisterType((*QueryAuthorizedAdminUpdateResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateResponse") + proto.RegisterType((*QueryEcallRecordRequest)(nil), "secret.compute.v1beta1.QueryEcallRecordRequest") + proto.RegisterType((*QueryEcallRecordResponse)(nil), "secret.compute.v1beta1.QueryEcallRecordResponse") + proto.RegisterType((*QueryNetworkPubkeyRequest)(nil), "secret.compute.v1beta1.QueryNetworkPubkeyRequest") + proto.RegisterType((*QueryNetworkPubkeyResponse)(nil), "secret.compute.v1beta1.QueryNetworkPubkeyResponse") + proto.RegisterType((*QueryEcallRecordsRequest)(nil), "secret.compute.v1beta1.QueryEcallRecordsRequest") + proto.RegisterType((*QueryEcallRecordsResponse)(nil), "secret.compute.v1beta1.QueryEcallRecordsResponse") + proto.RegisterType((*QueryEncryptedSeedRequest)(nil), "secret.compute.v1beta1.QueryEncryptedSeedRequest") + proto.RegisterType((*QueryEncryptedSeedResponse)(nil), "secret.compute.v1beta1.QueryEncryptedSeedResponse") + proto.RegisterType((*StorageOp)(nil), "secret.compute.v1beta1.StorageOp") + proto.RegisterType((*CrossModuleOp)(nil), "secret.compute.v1beta1.CrossModuleOp") + proto.RegisterType((*ExecutionTraceData)(nil), "secret.compute.v1beta1.ExecutionTraceData") + proto.RegisterType((*QueryBlockTracesRequest)(nil), "secret.compute.v1beta1.QueryBlockTracesRequest") + proto.RegisterType((*QueryBlockTracesResponse)(nil), "secret.compute.v1beta1.QueryBlockTracesResponse") + proto.RegisterType((*QueryMachineIDProofRequest)(nil), "secret.compute.v1beta1.QueryMachineIDProofRequest") + proto.RegisterType((*QueryMachineIDProofResponse)(nil), "secret.compute.v1beta1.QueryMachineIDProofResponse") + proto.RegisterType((*QueryAnalyzeCodeRequest)(nil), "secret.compute.v1beta1.QueryAnalyzeCodeRequest") + proto.RegisterType((*QueryAnalyzeCodeResponse)(nil), "secret.compute.v1beta1.QueryAnalyzeCodeResponse") + proto.RegisterType((*CreateResultData)(nil), "secret.compute.v1beta1.CreateResultData") + proto.RegisterType((*QueryBlockCreateResultsRequest)(nil), "secret.compute.v1beta1.QueryBlockCreateResultsRequest") + proto.RegisterType((*QueryBlockCreateResultsResponse)(nil), "secret.compute.v1beta1.QueryBlockCreateResultsResponse") +} + +func init() { + proto.RegisterFile("secret/compute/v1beta1/query.proto", fileDescriptor_7735281c5fa969d4) +} + +var fileDescriptor_7735281c5fa969d4 = []byte{ + // 2453 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4b, 0x6c, 0x1c, 0x49, + 0x19, 0x76, 0xfb, 0x3d, 0xbf, 0x1f, 0x49, 0x6a, 0x1d, 0xc7, 0x99, 0x6c, 0xc6, 0x9b, 0x62, 0xb3, + 0x71, 0x92, 0xcd, 0x74, 0x6c, 0x87, 0xbc, 0x58, 0x04, 0xb6, 0x63, 0x88, 0x97, 0x3c, 0xbc, 0xe3, + 0x5d, 0x21, 0xad, 0x82, 0x5a, 0x35, 0xdd, 0x95, 0x99, 0x96, 0x67, 0xba, 0x27, 0x5d, 0x35, 0xb6, + 0x67, 0x23, 0x73, 0xe0, 0xc0, 0xe3, 0x86, 0xc4, 0x22, 0xb4, 0xe2, 0xb2, 0x27, 0x58, 0x81, 0x84, + 0xc4, 0x75, 0x25, 0xc4, 0x35, 0x42, 0x1c, 0x22, 0xed, 0x85, 0x53, 0x04, 0x09, 0x07, 0xc4, 0x9d, + 0x3b, 0xaa, 0x47, 0xf7, 0x74, 0xcf, 0xf4, 0x4c, 0x8f, 0xc3, 0x81, 0xdb, 0x74, 0xd5, 0xff, 0xf8, + 0xfe, 0x47, 0xfd, 0x55, 0xff, 0x6f, 0x03, 0x66, 0xd4, 0x0e, 0x28, 0x37, 0x6d, 0xbf, 0xde, 0x68, + 0x72, 0x6a, 0xee, 0x2d, 0x97, 0x29, 0x27, 0xcb, 0xe6, 0x93, 0x26, 0x0d, 0x5a, 0xc5, 0x46, 0xe0, + 0x73, 0x1f, 0xcd, 0x2b, 0x9a, 0xa2, 0xa6, 0x29, 0x6a, 0x9a, 0xfc, 0x5c, 0xc5, 0xaf, 0xf8, 0x92, + 0xc4, 0x14, 0xbf, 0x14, 0x75, 0xbe, 0x97, 0x44, 0xde, 0x6a, 0x50, 0xa6, 0x69, 0xbe, 0xd6, 0x83, + 0xa6, 0x41, 0x02, 0x52, 0x0f, 0x89, 0xce, 0x54, 0x7c, 0xbf, 0x52, 0xa3, 0xa6, 0xfc, 0x2a, 0x37, + 0x1f, 0x9b, 0xb4, 0xde, 0xe0, 0x1a, 0x53, 0xfe, 0x4d, 0xbd, 0x49, 0x1a, 0xae, 0x49, 0x3c, 0xcf, + 0xe7, 0x84, 0xbb, 0xbe, 0x17, 0xc9, 0xb7, 0x7d, 0x56, 0xf7, 0x99, 0x59, 0x26, 0x8c, 0x9a, 0xa4, + 0x6c, 0xbb, 0x91, 0x06, 0xf1, 0xa1, 0x89, 0x2e, 0xc5, 0x89, 0xa4, 0xbd, 0x31, 0x1c, 0x15, 0xd7, + 0x93, 0x12, 0x15, 0x2d, 0x3e, 0x06, 0x33, 0xdb, 0x12, 0x5b, 0x89, 0x3e, 0x69, 0x52, 0xc6, 0xf1, + 0x87, 0x30, 0x1b, 0x2e, 0xb0, 0x86, 0xef, 0x31, 0x8a, 0xde, 0x83, 0x71, 0x05, 0x7f, 0xc1, 0x78, + 0xcb, 0x58, 0x9a, 0x5a, 0x29, 0x14, 0xd3, 0xdd, 0x56, 0x54, 0x7c, 0xeb, 0xa3, 0xcf, 0x5e, 0x2c, + 0x0e, 0x95, 0x34, 0xcf, 0xed, 0xd1, 0x7f, 0x7d, 0xbe, 0x38, 0x84, 0x7f, 0x00, 0xf9, 0x0f, 0x04, + 0x90, 0x1d, 0xc9, 0xb9, 0xe1, 0x7b, 0x3c, 0x20, 0x36, 0xd7, 0x3a, 0xd1, 0x45, 0x38, 0x6e, 0xeb, + 0x25, 0x8b, 0x38, 0x4e, 0x40, 0x99, 0xd2, 0x95, 0x2b, 0x1d, 0x0b, 0xd7, 0xd7, 0xd4, 0x32, 0x9a, + 0x83, 0x31, 0x69, 0xd1, 0xc2, 0xf0, 0x5b, 0xc6, 0xd2, 0x74, 0x49, 0x7d, 0xe0, 0xcb, 0xf0, 0x86, + 0x14, 0xbf, 0xde, 0xba, 0x47, 0xca, 0xb4, 0x16, 0xca, 0x9d, 0x83, 0xb1, 0x9a, 0xf8, 0xd6, 0xc2, + 0xd4, 0x07, 0x7e, 0x1f, 0xce, 0x6a, 0xe2, 0x8d, 0xa4, 0xf0, 0xa3, 0xc3, 0xc1, 0x26, 0xcc, 0x45, + 0xb2, 0x1c, 0xba, 0xe5, 0x84, 0x22, 0x4e, 0xc1, 0x84, 0xed, 0x3b, 0xd4, 0x72, 0x1d, 0xc9, 0x39, + 0x5a, 0x1a, 0xb7, 0xe5, 0x3e, 0x5e, 0x86, 0x33, 0xa9, 0x8e, 0xd0, 0xbe, 0x46, 0x30, 0xea, 0x10, + 0x4e, 0x24, 0xd3, 0x74, 0x49, 0xfe, 0xc6, 0xbf, 0x36, 0xe0, 0xb4, 0xe4, 0x09, 0xa9, 0xb7, 0xbc, + 0xc7, 0x7e, 0xc4, 0x71, 0x04, 0xdf, 0xed, 0xc0, 0x4c, 0x44, 0xea, 0x7a, 0x8f, 0x7d, 0xe9, 0xc3, + 0xa9, 0x95, 0xb7, 0x7b, 0xc5, 0x33, 0xae, 0x6f, 0x7d, 0xf2, 0xf9, 0x8b, 0x45, 0xe3, 0xdf, 0x22, + 0xb2, 0xd3, 0x76, 0x6c, 0x1d, 0x7f, 0x66, 0xc0, 0xa9, 0x38, 0xe1, 0xf7, 0x5d, 0x5e, 0x0d, 0x15, + 0xfe, 0xbf, 0xb1, 0xfd, 0x10, 0x0a, 0x09, 0xc7, 0xb1, 0x76, 0x98, 0xb4, 0xf7, 0x1e, 0xc1, 0x6c, + 0x42, 0xad, 0xc0, 0x37, 0xb2, 0x34, 0xb5, 0x62, 0x0e, 0xa2, 0x37, 0x66, 0xaa, 0x4e, 0xfa, 0x99, + 0xb8, 0x7a, 0x86, 0x3f, 0x35, 0xe0, 0xb8, 0x54, 0x18, 0x0f, 0x58, 0xaf, 0xd4, 0x40, 0x0b, 0x30, + 0x61, 0x07, 0x94, 0x70, 0x3f, 0x90, 0xc6, 0xe7, 0x4a, 0xe1, 0x27, 0x3a, 0x03, 0x39, 0xc9, 0x52, + 0x25, 0xac, 0xba, 0x30, 0x22, 0xf7, 0x26, 0xc5, 0xc2, 0x5d, 0xc2, 0xaa, 0x68, 0x1e, 0xc6, 0x99, + 0xdf, 0x0c, 0x6c, 0xba, 0x30, 0x2a, 0x77, 0xf4, 0x97, 0x10, 0x57, 0x6e, 0xba, 0x35, 0x87, 0x06, + 0x0b, 0x63, 0x4a, 0x9c, 0xfe, 0xc4, 0x07, 0x70, 0x42, 0xbb, 0xc5, 0xa1, 0x11, 0xac, 0x87, 0x5a, + 0x87, 0x74, 0xbe, 0x3a, 0xe8, 0x4b, 0xbd, 0x9d, 0x90, 0xb4, 0x29, 0x16, 0x00, 0x89, 0x4b, 0xec, + 0x89, 0x54, 0xde, 0x27, 0xac, 0xae, 0x0f, 0xaa, 0xfc, 0x8d, 0x6d, 0x40, 0x91, 0xe6, 0x76, 0x81, + 0xb9, 0x0f, 0x10, 0xa9, 0x0e, 0x03, 0x30, 0xb8, 0x6e, 0xe5, 0xf9, 0x5c, 0xa8, 0x97, 0xe1, 0x2d, + 0x78, 0x33, 0x11, 0xf5, 0xe8, 0x74, 0x1f, 0xf9, 0xc4, 0xe0, 0x15, 0x5d, 0xb6, 0x42, 0x51, 0xba, + 0xba, 0x68, 0x41, 0xe9, 0xe5, 0xe5, 0x1a, 0x9c, 0x8c, 0x6c, 0x14, 0x01, 0x8a, 0xc8, 0x13, 0x51, + 0x34, 0x92, 0x51, 0xc4, 0xbf, 0x34, 0xe0, 0xd8, 0x1d, 0x6a, 0x07, 0xad, 0x06, 0xa7, 0xce, 0x9a, + 0xc7, 0xf6, 0x69, 0x20, 0x3c, 0x28, 0xee, 0x16, 0x4d, 0x2b, 0x7f, 0x0b, 0x9d, 0xae, 0xd7, 0x68, + 0x72, 0x9d, 0x22, 0xea, 0x03, 0x2d, 0xc2, 0x94, 0xdf, 0xe4, 0x8d, 0x26, 0xb7, 0x64, 0xf5, 0x50, + 0x29, 0x02, 0x6a, 0xe9, 0x0e, 0xe1, 0x04, 0x2d, 0xc3, 0xc9, 0x18, 0x81, 0x45, 0x98, 0xc5, 0x78, + 0xe0, 0x7a, 0x15, 0x9d, 0x33, 0xa8, 0x4d, 0xba, 0xc6, 0x76, 0xe4, 0x8e, 0x2e, 0xdc, 0xff, 0x31, + 0xe0, 0x78, 0x07, 0x2e, 0x86, 0xd6, 0x60, 0x82, 0xa8, 0x9f, 0x3a, 0x5a, 0x17, 0x7a, 0x45, 0xab, + 0x83, 0xb5, 0x14, 0xf2, 0xa1, 0x7b, 0x11, 0xe2, 0x9a, 0x5f, 0x61, 0x0b, 0xc3, 0x52, 0xcc, 0xf9, + 0xa2, 0xba, 0xb9, 0x8a, 0xe2, 0xe6, 0x2a, 0xca, 0x1b, 0x2d, 0x14, 0xa4, 0x40, 0x6d, 0xee, 0x51, + 0x8f, 0xeb, 0x88, 0x6b, 0xf3, 0xee, 0xf9, 0x15, 0x86, 0xce, 0xc1, 0xb4, 0x96, 0x46, 0x83, 0xc0, + 0x0f, 0xb4, 0x03, 0xb4, 0x86, 0x4d, 0xb1, 0x84, 0x2e, 0xc0, 0xb1, 0x46, 0x8d, 0xb8, 0x1e, 0xa7, + 0x07, 0x21, 0x95, 0xb2, 0x7d, 0x36, 0x5a, 0x96, 0x84, 0xda, 0xee, 0x07, 0xba, 0x4e, 0x87, 0x91, + 0xbf, 0xeb, 0x32, 0xee, 0x07, 0xad, 0xa3, 0x5f, 0x11, 0x5a, 0xde, 0x5e, 0x47, 0x52, 0x46, 0xf2, + 0x74, 0x72, 0x6c, 0xc3, 0x04, 0xf5, 0x78, 0xe0, 0xd2, 0xd0, 0xa5, 0x57, 0xb3, 0x2a, 0x90, 0xcc, + 0x2f, 0x25, 0x65, 0xd3, 0xe3, 0x41, 0x4b, 0xbb, 0x25, 0x14, 0xa3, 0xf5, 0xde, 0x83, 0x45, 0xa9, + 0x77, 0xad, 0xc9, 0xab, 0x7e, 0xe0, 0x7e, 0x42, 0x9d, 0xfb, 0x6e, 0x25, 0x90, 0x2f, 0x80, 0xd7, + 0xb8, 0xee, 0x3e, 0x80, 0xb7, 0x7a, 0x4b, 0xd3, 0x96, 0x5c, 0x81, 0x29, 0x8f, 0xee, 0x5b, 0x89, + 0x1a, 0xb7, 0x3e, 0xf3, 0xf2, 0xc5, 0x62, 0xee, 0x01, 0xdd, 0x97, 0xa7, 0xf7, 0x4e, 0x29, 0xe7, + 0xe9, 0x9f, 0x0e, 0x7e, 0x00, 0xe7, 0x3a, 0x44, 0xae, 0x39, 0x75, 0xd7, 0xfb, 0xa8, 0xe1, 0x10, + 0x4e, 0x5f, 0x03, 0xe2, 0x1a, 0xe0, 0x7e, 0xf2, 0xda, 0x67, 0x51, 0x80, 0x24, 0x62, 0x2b, 0x3c, + 0x8b, 0x1e, 0xdd, 0x97, 0xa4, 0x78, 0x19, 0x4e, 0x49, 0x11, 0x9b, 0x36, 0xa9, 0xd5, 0x4a, 0xd4, + 0xf6, 0x83, 0xe8, 0x5e, 0x9f, 0x87, 0xf1, 0x2a, 0x75, 0x2b, 0x55, 0x2e, 0x99, 0x46, 0x4a, 0xfa, + 0x0b, 0xff, 0xcc, 0x80, 0x85, 0x6e, 0x1e, 0xad, 0xac, 0x07, 0x93, 0x38, 0xb5, 0x01, 0xf1, 0x1c, + 0xbf, 0x6e, 0x31, 0x4a, 0x1d, 0x5d, 0x28, 0x41, 0x2d, 0xed, 0x50, 0xea, 0xa0, 0x6b, 0x30, 0xbf, + 0x47, 0x6a, 0xae, 0x23, 0x2e, 0x01, 0x8b, 0x51, 0x6e, 0xd1, 0x3d, 0xd7, 0xa1, 0x9e, 0x4d, 0x65, + 0x82, 0x4f, 0x97, 0xe6, 0xa2, 0xdd, 0x1d, 0xca, 0x37, 0xf5, 0x1e, 0x7e, 0x5f, 0x3f, 0x17, 0x1e, + 0x50, 0xbe, 0xef, 0x07, 0xbb, 0xdb, 0xcd, 0xf2, 0x2e, 0x6d, 0x65, 0x18, 0x80, 0x4e, 0xc2, 0xb8, + 0xdb, 0x86, 0x31, 0x53, 0x1a, 0x73, 0x05, 0x02, 0xfc, 0xb1, 0x2e, 0x80, 0x1d, 0xb2, 0xb4, 0x61, + 0x8b, 0x30, 0xe5, 0x89, 0x30, 0x37, 0xe4, 0xb2, 0x7e, 0xb4, 0x80, 0x58, 0x52, 0x84, 0xc2, 0xcd, + 0xae, 0x1f, 0x6e, 0x2b, 0xfb, 0x26, 0x5d, 0x5f, 0x6d, 0xe2, 0x47, 0xdd, 0x2e, 0x8b, 0x9e, 0x60, + 0xe7, 0x60, 0x9a, 0x71, 0x12, 0x70, 0x2b, 0x01, 0x76, 0x4a, 0xae, 0xdd, 0x55, 0x88, 0xcf, 0x02, + 0x50, 0xcf, 0x09, 0x09, 0x86, 0x25, 0x41, 0x8e, 0x7a, 0x8e, 0xda, 0xc6, 0x75, 0xed, 0x85, 0xa4, + 0xf4, 0xf6, 0x69, 0x0b, 0xd4, 0x52, 0xd6, 0x69, 0xeb, 0x15, 0xd4, 0xf0, 0xb4, 0x69, 0x31, 0x78, + 0x3b, 0x54, 0xe7, 0xe9, 0x82, 0x27, 0xdc, 0x17, 0x5a, 0x23, 0x2a, 0x3f, 0x15, 0xc6, 0xc4, 0x2b, + 0x3f, 0x0d, 0x78, 0x78, 0x7f, 0x27, 0x6c, 0x08, 0x53, 0x6a, 0x43, 0xbb, 0xbe, 0x43, 0xa2, 0xb6, + 0xe0, 0x3c, 0xcc, 0xd2, 0x70, 0x43, 0xc5, 0x4d, 0x79, 0x7f, 0x86, 0xc6, 0xc9, 0xf1, 0x36, 0xe4, + 0x76, 0xb8, 0x1f, 0x90, 0x0a, 0x7d, 0xd8, 0x90, 0xd1, 0x60, 0x96, 0x43, 0x6b, 0x94, 0xab, 0x4b, + 0x65, 0xb2, 0x34, 0xe9, 0xb2, 0x3b, 0xf2, 0x1b, 0x1d, 0x87, 0x91, 0x76, 0x90, 0xc4, 0x4f, 0x71, + 0xd5, 0xec, 0x91, 0x5a, 0x33, 0x4c, 0x36, 0xf5, 0x81, 0x9f, 0xc0, 0xcc, 0x46, 0xe0, 0x33, 0x76, + 0xdf, 0x77, 0x9a, 0x35, 0x2d, 0x55, 0x14, 0x21, 0x6a, 0x85, 0x29, 0x90, 0x2b, 0x4d, 0xca, 0x85, + 0xef, 0xd1, 0xd6, 0xa0, 0x52, 0x93, 0xd0, 0x46, 0x93, 0xd0, 0xf0, 0x9f, 0x87, 0x01, 0x6d, 0x1e, + 0x50, 0xbb, 0x29, 0xea, 0xcc, 0x87, 0x01, 0xb1, 0xa9, 0xbc, 0xd3, 0xe4, 0x55, 0xe8, 0xd0, 0x03, + 0x9d, 0x1c, 0xea, 0x03, 0xdd, 0x82, 0x11, 0xbf, 0x11, 0x5e, 0x28, 0xe7, 0x7a, 0x85, 0x35, 0x72, + 0x8a, 0x8e, 0xa3, 0xe0, 0x11, 0x91, 0x08, 0x28, 0x6b, 0xd6, 0xb8, 0xc6, 0xa6, 0xbf, 0xd0, 0x69, + 0x98, 0xac, 0x10, 0x66, 0x35, 0x19, 0x75, 0x24, 0xb6, 0xd1, 0xd2, 0x44, 0x85, 0xb0, 0x8f, 0x18, + 0x75, 0x44, 0x9e, 0x8a, 0xdc, 0x28, 0x13, 0x7b, 0xd7, 0xaa, 0x10, 0xb6, 0x30, 0x21, 0xb7, 0xa7, + 0xc2, 0xb5, 0xef, 0x12, 0x26, 0x4c, 0xab, 0x12, 0xa6, 0xaf, 0x9c, 0x31, 0x65, 0x5a, 0x95, 0x30, + 0x75, 0x2b, 0x9d, 0x81, 0x9c, 0xdc, 0xb0, 0xea, 0xac, 0xb2, 0x30, 0xae, 0x9c, 0x27, 0x17, 0xee, + 0xb3, 0x0a, 0xba, 0x0b, 0x39, 0x5b, 0xb8, 0xda, 0x12, 0x06, 0x4d, 0xea, 0x1b, 0xb2, 0xd7, 0xad, + 0x10, 0x8f, 0x89, 0x36, 0x6a, 0x52, 0x72, 0x3f, 0x6c, 0xb0, 0xa8, 0xa2, 0xad, 0xd7, 0x7c, 0x7b, + 0x57, 0x7a, 0x90, 0x65, 0x55, 0x34, 0x47, 0x9f, 0xce, 0x04, 0x8b, 0x4e, 0xbe, 0xbb, 0x30, 0xce, + 0xe5, 0x8a, 0x3e, 0x3d, 0x97, 0x7a, 0xa1, 0xea, 0x8e, 0x5a, 0xd8, 0x1d, 0x2a, 0x7e, 0xbc, 0xa3, + 0x93, 0xfc, 0x3e, 0xb1, 0xab, 0xae, 0x47, 0xb7, 0xee, 0x6c, 0x07, 0xbe, 0xff, 0x38, 0xab, 0x58, + 0x9d, 0x05, 0xa8, 0x2b, 0x06, 0x71, 0xc3, 0xa8, 0x97, 0x50, 0x4e, 0xaf, 0x6c, 0x39, 0x78, 0x55, + 0xdf, 0xdd, 0x9d, 0x42, 0xdb, 0xcf, 0xb6, 0x86, 0x58, 0xd0, 0x27, 0x46, 0x7d, 0xe0, 0xeb, 0xda, + 0x45, 0x6b, 0x1e, 0xa9, 0xb5, 0x3e, 0xa1, 0xea, 0x6d, 0xdc, 0x3e, 0xbe, 0x89, 0x87, 0xdb, 0x74, + 0xec, 0xe1, 0x76, 0xa0, 0xfd, 0x94, 0xe0, 0xd3, 0x9a, 0x4c, 0x98, 0x13, 0xa1, 0x77, 0xcb, 0xb6, + 0x25, 0x6e, 0xe5, 0x96, 0xd5, 0xf0, 0x5d, 0x8f, 0x33, 0x7d, 0xf6, 0x4e, 0x54, 0x09, 0xdb, 0x2a, + 0xdb, 0xf2, 0xf2, 0xde, 0x96, 0x1b, 0xe8, 0x32, 0x9c, 0x08, 0xe8, 0x93, 0xa6, 0x1b, 0x50, 0xc7, + 0x7a, 0x4c, 0x09, 0x6f, 0x06, 0x94, 0x69, 0xfb, 0x8e, 0x87, 0x1b, 0xdf, 0xd1, 0xeb, 0xf8, 0xc7, + 0xa2, 0xbb, 0x10, 0x1d, 0x82, 0x50, 0xd8, 0xac, 0xa9, 0x87, 0xde, 0x19, 0xc8, 0x89, 0x97, 0x76, + 0x02, 0xab, 0x58, 0x90, 0xa5, 0x26, 0x61, 0xc8, 0x70, 0xd2, 0x90, 0x64, 0x9e, 0x8e, 0xf4, 0xcb, + 0xd3, 0xd1, 0x64, 0x9e, 0xe2, 0x9b, 0xba, 0xcd, 0x92, 0xa9, 0x12, 0x47, 0x94, 0x99, 0x64, 0xbb, + 0xfa, 0x75, 0x92, 0xc6, 0x19, 0xe5, 0xda, 0x84, 0x3a, 0x86, 0xd9, 0x9d, 0x41, 0x87, 0x2f, 0xda, + 0x25, 0x5a, 0xb2, 0xaf, 0xfc, 0xe4, 0x4d, 0x18, 0x93, 0xda, 0xd0, 0xef, 0x0c, 0x98, 0x8e, 0x37, + 0x72, 0xe8, 0xeb, 0x7d, 0xcb, 0x7f, 0xaf, 0x41, 0x41, 0x7e, 0xb9, 0x2f, 0x5b, 0x5a, 0xbb, 0x8e, + 0xaf, 0xfe, 0xe8, 0xab, 0x7f, 0xfe, 0x62, 0xf8, 0x12, 0x5a, 0xea, 0x1a, 0x11, 0x89, 0xee, 0xc7, + 0x7c, 0xda, 0xf9, 0xcc, 0x39, 0x44, 0xbf, 0x35, 0xe0, 0x44, 0x57, 0x03, 0x8b, 0xde, 0xcd, 0x44, + 0x1c, 0x1b, 0x47, 0xe4, 0xaf, 0x0f, 0x04, 0xb4, 0xab, 0x3d, 0xc6, 0xef, 0x4a, 0xb4, 0xef, 0xa0, + 0xb7, 0xbb, 0xd0, 0x86, 0x38, 0x99, 0x80, 0x2c, 0x5f, 0x7a, 0x87, 0xe8, 0x8f, 0x86, 0x1e, 0xc3, + 0x24, 0x87, 0x1b, 0x68, 0xa5, 0xaf, 0xf6, 0xd4, 0x91, 0x50, 0x7e, 0xf5, 0x48, 0x3c, 0x1a, 0xee, + 0xb2, 0x84, 0x7b, 0x19, 0x5d, 0x4c, 0x9f, 0xfa, 0xa5, 0x79, 0xf7, 0xa7, 0x06, 0x8c, 0x0a, 0xa3, + 0x8f, 0xe8, 0xd0, 0x8b, 0x19, 0x0e, 0x6d, 0x17, 0x01, 0x7c, 0x41, 0x82, 0x3a, 0x87, 0x16, 0x53, + 0x7c, 0xe8, 0xd0, 0x98, 0xfb, 0x76, 0x61, 0x4c, 0xf6, 0xc5, 0x68, 0xbe, 0xa8, 0x66, 0x80, 0xc5, + 0x70, 0x40, 0x58, 0xdc, 0xac, 0x37, 0x78, 0x2b, 0x7f, 0x29, 0x53, 0x69, 0x74, 0x6c, 0x70, 0x41, + 0x6a, 0x5d, 0x40, 0xf3, 0xa9, 0x5a, 0x19, 0xfa, 0xab, 0x01, 0xa7, 0xc3, 0x0e, 0xb5, 0x2b, 0xbf, + 0x5f, 0xf7, 0x3c, 0x5c, 0xc9, 0x04, 0x18, 0x6f, 0x88, 0xf1, 0x96, 0xc4, 0xb8, 0x81, 0xd6, 0x52, + 0x31, 0xca, 0x2a, 0x65, 0x96, 0x5b, 0x56, 0x67, 0xd0, 0xd2, 0xc2, 0xf8, 0x85, 0x9e, 0xb4, 0x84, + 0xe6, 0xbc, 0xc6, 0x19, 0x39, 0x22, 0xf8, 0x1b, 0x12, 0xfc, 0x32, 0x32, 0xb3, 0xc0, 0xcb, 0xe8, + 0xc6, 0xc2, 0xfc, 0x07, 0x03, 0x66, 0xe5, 0x1c, 0x61, 0xbd, 0xf5, 0x3f, 0xba, 0x7b, 0x65, 0xa0, + 0x53, 0x9d, 0x98, 0x59, 0xf4, 0x39, 0x22, 0x72, 0x7a, 0x91, 0xe6, 0xdb, 0xdf, 0x18, 0x30, 0x1b, + 0x8e, 0xb9, 0xd4, 0x7c, 0x15, 0x5d, 0xce, 0x00, 0x1c, 0x9f, 0xc2, 0xe6, 0xaf, 0x0d, 0x04, 0xb3, + 0x63, 0x4a, 0xd3, 0x07, 0x68, 0x77, 0x3e, 0x48, 0xe8, 0x87, 0xe8, 0x4b, 0x03, 0x8e, 0x75, 0xf4, + 0xd7, 0x68, 0x75, 0x20, 0xe5, 0xc9, 0xee, 0x7e, 0x40, 0xc4, 0x1d, 0x2d, 0x3c, 0x7e, 0x4f, 0x22, + 0xbe, 0x8e, 0xae, 0xf5, 0x46, 0x5c, 0x55, 0x2c, 0x69, 0x5e, 0x3e, 0x80, 0x71, 0x35, 0x3f, 0x47, + 0xe7, 0xfb, 0xcf, 0xd7, 0x43, 0x90, 0xef, 0x64, 0x91, 0x69, 0x58, 0x8b, 0x12, 0xd6, 0x69, 0x74, + 0xaa, 0xc7, 0x1f, 0x25, 0xd0, 0x5f, 0x0c, 0x78, 0x23, 0xa5, 0xa1, 0x47, 0x37, 0xfa, 0x7a, 0xa1, + 0xf7, 0x40, 0x21, 0x7f, 0xf3, 0xe8, 0x8c, 0x1a, 0xeb, 0xb7, 0x25, 0xd6, 0xdb, 0xe8, 0x66, 0x17, + 0x56, 0x12, 0x71, 0x59, 0xf5, 0x90, 0x2d, 0xcd, 0x8d, 0x5f, 0x19, 0x70, 0x32, 0xb5, 0xf5, 0x47, + 0xb7, 0x06, 0x44, 0xd5, 0x3d, 0x7e, 0xc8, 0xdf, 0x7e, 0x1d, 0x56, 0x6d, 0xd2, 0x86, 0x34, 0xe9, + 0x9b, 0xe8, 0x1b, 0xfd, 0x4c, 0x92, 0x73, 0x08, 0xab, 0x29, 0x39, 0xd3, 0xac, 0xfa, 0xcc, 0x80, + 0xa9, 0x58, 0x13, 0x8a, 0xcc, 0xc1, 0xdb, 0x55, 0x65, 0xc1, 0x91, 0xfb, 0xdb, 0x3e, 0xd7, 0x16, + 0x15, 0xd4, 0xe6, 0x53, 0xf5, 0x84, 0x3b, 0x44, 0x9f, 0x1a, 0x30, 0x1d, 0x6f, 0xb2, 0xd1, 0xc0, + 0xba, 0x06, 0x7c, 0x47, 0xa5, 0x75, 0xf0, 0x7d, 0xb2, 0x5a, 0xc2, 0x63, 0xe2, 0x31, 0x32, 0x93, + 0x98, 0x5a, 0xa0, 0xfe, 0x5a, 0xd2, 0xa6, 0x25, 0x19, 0x15, 0x36, 0x75, 0x28, 0x82, 0x6f, 0x49, + 0x64, 0xab, 0x68, 0xb9, 0x0b, 0x99, 0xa7, 0xe8, 0xf5, 0x3c, 0x24, 0xf2, 0xa0, 0xf9, 0x54, 0x4d, + 0x5e, 0x0e, 0xd1, 0xef, 0x0d, 0x98, 0x49, 0xb4, 0xfb, 0x19, 0x98, 0xd3, 0x86, 0x0d, 0x19, 0x98, + 0x53, 0xa7, 0x09, 0x78, 0x55, 0x62, 0xbe, 0x82, 0x2e, 0x77, 0x7b, 0x33, 0x31, 0x64, 0x30, 0x9f, + 0x46, 0x73, 0x8c, 0x43, 0xf4, 0xb9, 0x01, 0x53, 0xb1, 0xee, 0x30, 0x23, 0x29, 0xbb, 0x5b, 0xcf, + 0x8c, 0xa4, 0x4c, 0x69, 0x3c, 0x71, 0x51, 0xe2, 0x5c, 0x42, 0xef, 0x74, 0xe1, 0x2c, 0x0b, 0x6a, + 0x4b, 0x75, 0x95, 0xed, 0xdc, 0xfc, 0xd2, 0x80, 0xd9, 0x64, 0x17, 0x98, 0xf1, 0x18, 0x4d, 0xed, + 0x43, 0x33, 0x1e, 0xa3, 0xe9, 0x6d, 0x26, 0xfe, 0x96, 0xc4, 0x7a, 0x0b, 0xdd, 0xe8, 0xc2, 0xda, + 0xee, 0x5d, 0x2d, 0xd9, 0x7b, 0xc6, 0x32, 0xa1, 0xbd, 0x75, 0x88, 0x7e, 0x65, 0xc0, 0x54, 0xac, + 0xab, 0xcc, 0xf0, 0x6f, 0x77, 0xdf, 0x9a, 0xe1, 0xdf, 0x94, 0x86, 0x15, 0x9f, 0x97, 0x98, 0x17, + 0xd1, 0xd9, 0xee, 0x62, 0xa5, 0xa8, 0xe5, 0x7b, 0x06, 0xfd, 0xc9, 0x00, 0xd4, 0xdd, 0xb2, 0xa1, + 0xeb, 0xd9, 0xf1, 0x4c, 0xeb, 0x0e, 0xf3, 0x37, 0x8e, 0xcc, 0xa7, 0xe1, 0x5e, 0x97, 0x70, 0xaf, + 0xa2, 0x62, 0x8f, 0x74, 0x90, 0x7f, 0x3f, 0xa3, 0x96, 0x6e, 0x00, 0x23, 0x37, 0xaf, 0x3f, 0x7a, + 0xf6, 0x8f, 0xc2, 0xd0, 0x17, 0x2f, 0x0b, 0xc6, 0xb3, 0x97, 0x05, 0xe3, 0xf9, 0xcb, 0x82, 0xf1, + 0xf7, 0x97, 0x05, 0xe3, 0xe7, 0xaf, 0x0a, 0x43, 0xcf, 0x5f, 0x15, 0x86, 0xfe, 0xf6, 0xaa, 0x30, + 0xf4, 0xf1, 0xed, 0x8a, 0xcb, 0xab, 0xcd, 0xb2, 0x40, 0x64, 0x32, 0x3b, 0xe0, 0x35, 0x52, 0x66, + 0xa6, 0xea, 0x3a, 0xf4, 0xa9, 0x37, 0x0f, 0x22, 0xa5, 0xae, 0xc7, 0x69, 0xe0, 0x91, 0x9a, 0xfa, + 0x4f, 0x80, 0xf2, 0xb8, 0x7c, 0xb6, 0xaf, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x24, 0x31, + 0x57, 0x82, 0x20, 0x00, 0x00, +} + +func (this *ParamsRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryCodeHashResponse) + that1, ok := that.(*ParamsRequest) if !ok { - that2, ok := that.(QueryCodeHashResponse) + that2, ok := that.(ParamsRequest) if ok { that1 = &that2 } else { @@ -1471,19 +2009,16 @@ func (this *QueryCodeHashResponse) Equal(that interface{}) bool { } else if this == nil { return false } - if this.CodeHash != that1.CodeHash { - return false - } return true } -func (this *QueryAuthorizedMigrationRequest) Equal(that interface{}) bool { +func (this *QuerySecretContractRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryAuthorizedMigrationRequest) + that1, ok := that.(*QuerySecretContractRequest) if !ok { - that2, ok := that.(QueryAuthorizedMigrationRequest) + that2, ok := that.(QuerySecretContractRequest) if ok { that1 = &that2 } else { @@ -1498,16 +2033,19 @@ func (this *QueryAuthorizedMigrationRequest) Equal(that interface{}) bool { if this.ContractAddress != that1.ContractAddress { return false } + if !bytes.Equal(this.Query, that1.Query) { + return false + } return true } -func (this *QueryAuthorizedMigrationResponse) Equal(that interface{}) bool { +func (this *QueryByLabelRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryAuthorizedMigrationResponse) + that1, ok := that.(*QueryByLabelRequest) if !ok { - that2, ok := that.(QueryAuthorizedMigrationResponse) + that2, ok := that.(QueryByLabelRequest) if ok { that1 = &that2 } else { @@ -1519,19 +2057,19 @@ func (this *QueryAuthorizedMigrationResponse) Equal(that interface{}) bool { } else if this == nil { return false } - if this.NewCodeID != that1.NewCodeID { + if this.Label != that1.Label { return false } return true } -func (this *QueryAuthorizedAdminUpdateRequest) Equal(that interface{}) bool { +func (this *QueryByContractAddressRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryAuthorizedAdminUpdateRequest) + that1, ok := that.(*QueryByContractAddressRequest) if !ok { - that2, ok := that.(QueryAuthorizedAdminUpdateRequest) + that2, ok := that.(QueryByContractAddressRequest) if ok { that1 = &that2 } else { @@ -1548,14 +2086,14 @@ func (this *QueryAuthorizedAdminUpdateRequest) Equal(that interface{}) bool { } return true } -func (this *QueryAuthorizedAdminUpdateResponse) Equal(that interface{}) bool { +func (this *QueryByCodeIdRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryAuthorizedAdminUpdateResponse) + that1, ok := that.(*QueryByCodeIdRequest) if !ok { - that2, ok := that.(QueryAuthorizedAdminUpdateResponse) + that2, ok := that.(QueryByCodeIdRequest) if ok { that1 = &that2 } else { @@ -1567,1797 +2105,6064 @@ func (this *QueryAuthorizedAdminUpdateResponse) Equal(that interface{}) bool { } else if this == nil { return false } - if this.NewAdmin != that1.NewAdmin { + if this.CodeId != that1.CodeId { return false } return true } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Query contract info by address - ContractInfo(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) - // Query code info by id - ContractsByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryContractsByCodeIdResponse, error) - // Query secret contract - QuerySecretContract(ctx context.Context, in *QuerySecretContractRequest, opts ...grpc.CallOption) (*QuerySecretContractResponse, error) - // Query a specific contract code by id - Code(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) - // Query all contract codes on-chain - Codes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) - // Query code hash by contract address - CodeHashByContractAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) - // Query code hash by code id - CodeHashByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) - // Query contract label by address - LabelByAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractLabelResponse, error) - // Query contract address by label - AddressByLabel(ctx context.Context, in *QueryByLabelRequest, opts ...grpc.CallOption) (*QueryContractAddressResponse, error) - // ContractHistory gets the contract code history - ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) - // Params defines a gRPC query method that returns the compute - // module's parameters. - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) - // Query authorized migration for a contract - AuthorizedMigration(ctx context.Context, in *QueryAuthorizedMigrationRequest, opts ...grpc.CallOption) (*QueryAuthorizedMigrationResponse, error) - // Query authorized admin update for a contract - AuthorizedAdminUpdate(ctx context.Context, in *QueryAuthorizedAdminUpdateRequest, opts ...grpc.CallOption) (*QueryAuthorizedAdminUpdateResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) ContractInfo(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) { - out := new(QueryContractInfoResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractInfo", in, out, opts...) - if err != nil { - return nil, err +func (this *QuerySecretContractResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return out, nil -} -func (c *queryClient) ContractsByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryContractsByCodeIdResponse, error) { - out := new(QueryContractsByCodeIdResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractsByCodeId", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*QuerySecretContractResponse) + if !ok { + that2, ok := that.(QuerySecretContractResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil -} - -func (c *queryClient) QuerySecretContract(ctx context.Context, in *QuerySecretContractRequest, opts ...grpc.CallOption) (*QuerySecretContractResponse, error) { - out := new(QuerySecretContractResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/QuerySecretContract", in, out, opts...) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return out, nil -} - -func (c *queryClient) Code(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) { - out := new(QueryCodeResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Code", in, out, opts...) - if err != nil { - return nil, err + if !bytes.Equal(this.Data, that1.Data) { + return false } - return out, nil + return true } - -func (c *queryClient) Codes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) { - out := new(QueryCodesResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Codes", in, out, opts...) - if err != nil { - return nil, err +func (this *QueryContractInfoResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return out, nil -} -func (c *queryClient) CodeHashByContractAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { - out := new(QueryCodeHashResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/CodeHashByContractAddress", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*QueryContractInfoResponse) + if !ok { + that2, ok := that.(QueryContractInfoResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil -} - -func (c *queryClient) CodeHashByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { - out := new(QueryCodeHashResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/CodeHashByCodeId", in, out, opts...) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return out, nil -} - -func (c *queryClient) LabelByAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractLabelResponse, error) { - out := new(QueryContractLabelResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/LabelByAddress", in, out, opts...) - if err != nil { - return nil, err + if this.ContractAddress != that1.ContractAddress { + return false } - return out, nil -} - -func (c *queryClient) AddressByLabel(ctx context.Context, in *QueryByLabelRequest, opts ...grpc.CallOption) (*QueryContractAddressResponse, error) { - out := new(QueryContractAddressResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AddressByLabel", in, out, opts...) - if err != nil { - return nil, err + if !this.ContractInfo.Equal(that1.ContractInfo) { + return false } - return out, nil + return true } - -func (c *queryClient) ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) { - out := new(QueryContractHistoryResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractHistory", in, out, opts...) - if err != nil { - return nil, err +func (this *ContractInfoWithAddress) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return out, nil -} -func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*ContractInfoWithAddress) + if !ok { + that2, ok := that.(ContractInfoWithAddress) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil -} - -func (c *queryClient) AuthorizedMigration(ctx context.Context, in *QueryAuthorizedMigrationRequest, opts ...grpc.CallOption) (*QueryAuthorizedMigrationResponse, error) { - out := new(QueryAuthorizedMigrationResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AuthorizedMigration", in, out, opts...) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return out, nil + if this.ContractAddress != that1.ContractAddress { + return false + } + if !this.ContractInfo.Equal(that1.ContractInfo) { + return false + } + return true } +func (this *QueryContractsByCodeIdResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (c *queryClient) AuthorizedAdminUpdate(ctx context.Context, in *QueryAuthorizedAdminUpdateRequest, opts ...grpc.CallOption) (*QueryAuthorizedAdminUpdateResponse, error) { - out := new(QueryAuthorizedAdminUpdateResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AuthorizedAdminUpdate", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*QueryContractsByCodeIdResponse) + if !ok { + that2, ok := that.(QueryContractsByCodeIdResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.ContractInfos) != len(that1.ContractInfos) { + return false + } + for i := range this.ContractInfos { + if !this.ContractInfos[i].Equal(&that1.ContractInfos[i]) { + return false + } + } + return true } +func (this *CodeInfoResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Query contract info by address - ContractInfo(context.Context, *QueryByContractAddressRequest) (*QueryContractInfoResponse, error) - // Query code info by id - ContractsByCodeId(context.Context, *QueryByCodeIdRequest) (*QueryContractsByCodeIdResponse, error) - // Query secret contract - QuerySecretContract(context.Context, *QuerySecretContractRequest) (*QuerySecretContractResponse, error) - // Query a specific contract code by id - Code(context.Context, *QueryByCodeIdRequest) (*QueryCodeResponse, error) - // Query all contract codes on-chain - Codes(context.Context, *emptypb.Empty) (*QueryCodesResponse, error) - // Query code hash by contract address - CodeHashByContractAddress(context.Context, *QueryByContractAddressRequest) (*QueryCodeHashResponse, error) - // Query code hash by code id - CodeHashByCodeId(context.Context, *QueryByCodeIdRequest) (*QueryCodeHashResponse, error) - // Query contract label by address - LabelByAddress(context.Context, *QueryByContractAddressRequest) (*QueryContractLabelResponse, error) - // Query contract address by label - AddressByLabel(context.Context, *QueryByLabelRequest) (*QueryContractAddressResponse, error) - // ContractHistory gets the contract code history - ContractHistory(context.Context, *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) - // Params defines a gRPC query method that returns the compute - // module's parameters. - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) - // Query authorized migration for a contract - AuthorizedMigration(context.Context, *QueryAuthorizedMigrationRequest) (*QueryAuthorizedMigrationResponse, error) - // Query authorized admin update for a contract - AuthorizedAdminUpdate(context.Context, *QueryAuthorizedAdminUpdateRequest) (*QueryAuthorizedAdminUpdateResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryByContractAddressRequest) (*QueryContractInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented") -} -func (*UnimplementedQueryServer) ContractsByCodeId(ctx context.Context, req *QueryByCodeIdRequest) (*QueryContractsByCodeIdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ContractsByCodeId not implemented") -} -func (*UnimplementedQueryServer) QuerySecretContract(ctx context.Context, req *QuerySecretContractRequest) (*QuerySecretContractResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QuerySecretContract not implemented") -} -func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryByCodeIdRequest) (*QueryCodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") -} -func (*UnimplementedQueryServer) Codes(ctx context.Context, req *emptypb.Empty) (*QueryCodesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented") -} -func (*UnimplementedQueryServer) CodeHashByContractAddress(ctx context.Context, req *QueryByContractAddressRequest) (*QueryCodeHashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CodeHashByContractAddress not implemented") -} -func (*UnimplementedQueryServer) CodeHashByCodeId(ctx context.Context, req *QueryByCodeIdRequest) (*QueryCodeHashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CodeHashByCodeId not implemented") -} -func (*UnimplementedQueryServer) LabelByAddress(ctx context.Context, req *QueryByContractAddressRequest) (*QueryContractLabelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LabelByAddress not implemented") -} -func (*UnimplementedQueryServer) AddressByLabel(ctx context.Context, req *QueryByLabelRequest) (*QueryContractAddressResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddressByLabel not implemented") -} -func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) AuthorizedMigration(ctx context.Context, req *QueryAuthorizedMigrationRequest) (*QueryAuthorizedMigrationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthorizedMigration not implemented") -} -func (*UnimplementedQueryServer) AuthorizedAdminUpdate(ctx context.Context, req *QueryAuthorizedAdminUpdateRequest) (*QueryAuthorizedAdminUpdateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthorizedAdminUpdate not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_ContractInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByContractAddressRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ContractInfo(ctx, in) + that1, ok := that.(*CodeInfoResponse) + if !ok { + that2, ok := that.(CodeInfoResponse) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/ContractInfo", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ContractInfo(ctx, req.(*QueryByContractAddressRequest)) + if this.CodeId != that1.CodeId { + return false } - return interceptor(ctx, in, info, handler) -} - -func _Query_ContractsByCodeId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByCodeIdRequest) - if err := dec(in); err != nil { - return nil, err + if this.Creator != that1.Creator { + return false } - if interceptor == nil { - return srv.(QueryServer).ContractsByCodeId(ctx, in) + if this.CodeHash != that1.CodeHash { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/ContractsByCodeId", + if this.Source != that1.Source { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ContractsByCodeId(ctx, req.(*QueryByCodeIdRequest)) + if this.Builder != that1.Builder { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryCodeResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_QuerySecretContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySecretContractRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryCodeResponse) + if !ok { + that2, ok := that.(QueryCodeResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).QuerySecretContract(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/QuerySecretContract", + if !this.CodeInfoResponse.Equal(that1.CodeInfoResponse) { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QuerySecretContract(ctx, req.(*QuerySecretContractRequest)) + if !bytes.Equal(this.Wasm, that1.Wasm) { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryCodesResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_Code_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByCodeIdRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryCodesResponse) + if !ok { + that2, ok := that.(QueryCodesResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).Code(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/Code", + if len(this.CodeInfos) != len(that1.CodeInfos) { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Code(ctx, req.(*QueryByCodeIdRequest)) + for i := range this.CodeInfos { + if !this.CodeInfos[i].Equal(&that1.CodeInfos[i]) { + return false + } } - return interceptor(ctx, in, info, handler) + return true } - -func _Query_Codes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err +func (this *QueryContractAddressResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if interceptor == nil { - return srv.(QueryServer).Codes(ctx, in) + + that1, ok := that.(*QueryContractAddressResponse) + if !ok { + that2, ok := that.(QueryContractAddressResponse) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/Codes", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Codes(ctx, req.(*emptypb.Empty)) + if this.ContractAddress != that1.ContractAddress { + return false } - return interceptor(ctx, in, info, handler) + return true } - -func _Query_CodeHashByContractAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByContractAddressRequest) - if err := dec(in); err != nil { - return nil, err +func (this *QueryContractLabelResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if interceptor == nil { - return srv.(QueryServer).CodeHashByContractAddress(ctx, in) + + that1, ok := that.(*QueryContractLabelResponse) + if !ok { + that2, ok := that.(QueryContractLabelResponse) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/CodeHashByContractAddress", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CodeHashByContractAddress(ctx, req.(*QueryByContractAddressRequest)) + if this.Label != that1.Label { + return false } - return interceptor(ctx, in, info, handler) + return true } - -func _Query_CodeHashByCodeId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByCodeIdRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).CodeHashByCodeId(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/CodeHashByCodeId", +func (this *QueryCodeHashResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CodeHashByCodeId(ctx, req.(*QueryByCodeIdRequest)) + + that1, ok := that.(*QueryCodeHashResponse) + if !ok { + that2, ok := that.(QueryCodeHashResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return interceptor(ctx, in, info, handler) + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.CodeHash != that1.CodeHash { + return false + } + return true } - -func _Query_LabelByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByContractAddressRequest) - if err := dec(in); err != nil { - return nil, err +func (this *QueryAuthorizedMigrationRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if interceptor == nil { - return srv.(QueryServer).LabelByAddress(ctx, in) + + that1, ok := that.(*QueryAuthorizedMigrationRequest) + if !ok { + that2, ok := that.(QueryAuthorizedMigrationRequest) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/LabelByAddress", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LabelByAddress(ctx, req.(*QueryByContractAddressRequest)) + if this.ContractAddress != that1.ContractAddress { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryAuthorizedMigrationResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_AddressByLabel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByLabelRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryAuthorizedMigrationResponse) + if !ok { + that2, ok := that.(QueryAuthorizedMigrationResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).AddressByLabel(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/AddressByLabel", + if this.NewCodeID != that1.NewCodeID { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AddressByLabel(ctx, req.(*QueryByLabelRequest)) + return true +} +func (this *QueryAuthorizedAdminUpdateRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return interceptor(ctx, in, info, handler) + + that1, ok := that.(*QueryAuthorizedAdminUpdateRequest) + if !ok { + that2, ok := that.(QueryAuthorizedAdminUpdateRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ContractAddress != that1.ContractAddress { + return false + } + return true } +func (this *QueryAuthorizedAdminUpdateResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_ContractHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryContractHistoryRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryAuthorizedAdminUpdateResponse) + if !ok { + that2, ok := that.(QueryAuthorizedAdminUpdateResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).ContractHistory(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/ContractHistory", + if this.NewAdmin != that1.NewAdmin { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ContractHistory(ctx, req.(*QueryContractHistoryRequest)) + return true +} +func (this *QueryEcallRecordRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return interceptor(ctx, in, info, handler) + + that1, ok := that.(*QueryEcallRecordRequest) + if !ok { + that2, ok := that.(QueryEcallRecordRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Height != that1.Height { + return false + } + return true } +func (this *QueryEcallRecordResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryEcallRecordResponse) + if !ok { + that2, ok := that.(QueryEcallRecordResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/Params", + if this.Height != that1.Height { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + if !bytes.Equal(this.RandomSeed, that1.RandomSeed) { + return false } - return interceptor(ctx, in, info, handler) + if !bytes.Equal(this.ValidatorSetEvidence, that1.ValidatorSetEvidence) { + return false + } + return true } +func (this *QueryNetworkPubkeyRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_AuthorizedMigration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAuthorizedMigrationRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryNetworkPubkeyRequest) + if !ok { + that2, ok := that.(QueryNetworkPubkeyRequest) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).AuthorizedMigration(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/AuthorizedMigration", + if this.Height != that1.Height { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AuthorizedMigration(ctx, req.(*QueryAuthorizedMigrationRequest)) + if this.ISeed != that1.ISeed { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryNetworkPubkeyResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_AuthorizedAdminUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAuthorizedAdminUpdateRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryNetworkPubkeyResponse) + if !ok { + that2, ok := that.(QueryNetworkPubkeyResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).AuthorizedAdminUpdate(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/AuthorizedAdminUpdate", + if !bytes.Equal(this.NodePubkey, that1.NodePubkey) { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AuthorizedAdminUpdate(ctx, req.(*QueryAuthorizedAdminUpdateRequest)) + if !bytes.Equal(this.IoPubkey, that1.IoPubkey) { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryEcallRecordsRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "secret.compute.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ContractInfo", - Handler: _Query_ContractInfo_Handler, - }, - { - MethodName: "ContractsByCodeId", - Handler: _Query_ContractsByCodeId_Handler, - }, - { - MethodName: "QuerySecretContract", - Handler: _Query_QuerySecretContract_Handler, - }, - { - MethodName: "Code", - Handler: _Query_Code_Handler, - }, - { - MethodName: "Codes", - Handler: _Query_Codes_Handler, - }, - { - MethodName: "CodeHashByContractAddress", - Handler: _Query_CodeHashByContractAddress_Handler, - }, - { - MethodName: "CodeHashByCodeId", - Handler: _Query_CodeHashByCodeId_Handler, - }, - { - MethodName: "LabelByAddress", - Handler: _Query_LabelByAddress_Handler, - }, - { - MethodName: "AddressByLabel", - Handler: _Query_AddressByLabel_Handler, - }, - { - MethodName: "ContractHistory", - Handler: _Query_ContractHistory_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "AuthorizedMigration", - Handler: _Query_AuthorizedMigration_Handler, - }, - { - MethodName: "AuthorizedAdminUpdate", - Handler: _Query_AuthorizedAdminUpdate_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "secret/compute/v1beta1/query.proto", -} - -func (m *ParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*QueryEcallRecordsRequest) + if !ok { + that2, ok := that.(QueryEcallRecordsRequest) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil -} - -func (m *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return dAtA[:n], nil -} - -func (m *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if this.StartHeight != that1.StartHeight { + return false + } + if this.EndHeight != that1.EndHeight { + return false + } + return true } +func (this *QueryEcallRecordsResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + that1, ok := that.(*QueryEcallRecordsResponse) + if !ok { + that2, ok := that.(QueryEcallRecordsResponse) + if ok { + that1 = &that2 + } else { + return false } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QuerySecretContractRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return dAtA[:n], nil -} - -func (m *QuerySecretContractRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySecretContractRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Query) > 0 { - i -= len(m.Query) - copy(dAtA[i:], m.Query) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Query))) - i-- - dAtA[i] = 0x12 + if len(this.Records) != len(that1.Records) { + return false } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa + for i := range this.Records { + if !this.Records[i].Equal(&that1.Records[i]) { + return false + } } - return len(dAtA) - i, nil + return true } - -func (m *QueryByLabelRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (this *QueryEncryptedSeedRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return dAtA[:n], nil -} -func (m *QueryByLabelRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + that1, ok := that.(*QueryEncryptedSeedRequest) + if !ok { + that2, ok := that.(QueryEncryptedSeedRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.CertHash != that1.CertHash { + return false + } + if this.Height != that1.Height { + return false + } + return true } +func (this *QueryEncryptedSeedResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByLabelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Label) > 0 { - i -= len(m.Label) - copy(dAtA[i:], m.Label) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Label))) - i-- - dAtA[i] = 0xa + that1, ok := that.(*QueryEncryptedSeedResponse) + if !ok { + that2, ok := that.(QueryEncryptedSeedResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return len(dAtA) - i, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.EncryptedSeed, that1.EncryptedSeed) { + return false + } + return true } +func (this *StorageOp) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByContractAddressRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*StorageOp) + if !ok { + that2, ok := that.(StorageOp) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.IsDelete != that1.IsDelete { + return false + } + if !bytes.Equal(this.Key, that1.Key) { + return false + } + if !bytes.Equal(this.Value, that1.Value) { + return false + } + return true } +func (this *CrossModuleOp) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByContractAddressRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryByContractAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa + that1, ok := that.(*CrossModuleOp) + if !ok { + that2, ok := that.(CrossModuleOp) + if ok { + that1 = &that2 + } else { + return false + } } - return len(dAtA) - i, nil -} - -func (m *QueryByCodeIdRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return dAtA[:n], nil -} - -func (m *QueryByCodeIdRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryByCodeIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CodeId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) - i-- - dAtA[i] = 0x8 + if this.StoreKey != that1.StoreKey { + return false } - return len(dAtA) - i, nil -} - -func (m *QuerySecretContractResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if !bytes.Equal(this.Key, that1.Key) { + return false } - return dAtA[:n], nil -} - -func (m *QuerySecretContractResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySecretContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa + if !bytes.Equal(this.Value, that1.Value) { + return false } - return len(dAtA) - i, nil -} - -func (m *QueryContractInfoResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if this.IsDelete != that1.IsDelete { + return false } - return dAtA[:n], nil -} - -func (m *QueryContractInfoResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return true } +func (this *ExecutionTraceData) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryContractInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ContractInfo != nil { - { - size, err := m.ContractInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + that1, ok := that.(*ExecutionTraceData) + if !ok { + that2, ok := that.(ExecutionTraceData) + if ok { + that1 = &that2 + } else { + return false } - i-- - dAtA[i] = 0x12 } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return len(dAtA) - i, nil -} - -func (m *ContractInfoWithAddress) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if this.Index != that1.Index { + return false } - return dAtA[:n], nil + if len(this.Ops) != len(that1.Ops) { + return false + } + for i := range this.Ops { + if !this.Ops[i].Equal(&that1.Ops[i]) { + return false + } + } + if !bytes.Equal(this.Result, that1.Result) { + return false + } + if this.GasUsed != that1.GasUsed { + return false + } + if this.CallbackGas != that1.CallbackGas { + return false + } + if this.HasError != that1.HasError { + return false + } + if this.ErrorMsg != that1.ErrorMsg { + return false + } + if len(this.CrossOps) != len(that1.CrossOps) { + return false + } + for i := range this.CrossOps { + if !this.CrossOps[i].Equal(&that1.CrossOps[i]) { + return false + } + } + return true } +func (this *QueryBlockTracesRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *ContractInfoWithAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + that1, ok := that.(*QueryBlockTracesRequest) + if !ok { + that2, ok := that.(QueryBlockTracesRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Height != that1.Height { + return false + } + return true } +func (this *QueryBlockTracesResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *ContractInfoWithAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ContractInfo != nil { - { - size, err := m.ContractInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + that1, ok := that.(*QueryBlockTracesResponse) + if !ok { + that2, ok := that.(QueryBlockTracesResponse) + if ok { + that1 = &that2 + } else { + return false } - i-- - dAtA[i] = 0x12 } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return len(dAtA) - i, nil + if len(this.Traces) != len(that1.Traces) { + return false + } + for i := range this.Traces { + if !this.Traces[i].Equal(&that1.Traces[i]) { + return false + } + } + return true } +func (this *QueryMachineIDProofRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryContractsByCodeIdResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*QueryMachineIDProofRequest) + if !ok { + that2, ok := that.(QueryMachineIDProofRequest) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Height != that1.Height { + return false + } + if this.MachineId != that1.MachineId { + return false + } + return true } +func (this *QueryMachineIDProofResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryContractsByCodeIdResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryContractsByCodeIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractInfos) > 0 { - for iNdEx := len(m.ContractInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ContractInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + that1, ok := that.(*QueryMachineIDProofResponse) + if !ok { + that2, ok := that.(QueryMachineIDProofResponse) + if ok { + that1 = &that2 + } else { + return false } } - return len(dAtA) - i, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Proof, that1.Proof) { + return false + } + return true } +func (this *QueryAnalyzeCodeRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *CodeInfoResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*QueryAnalyzeCodeRequest) + if !ok { + that2, ok := that.(QueryAnalyzeCodeRequest) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.CodeHash, that1.CodeHash) { + return false + } + return true } +func (this *QueryAnalyzeCodeResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *CodeInfoResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + that1, ok := that.(*QueryAnalyzeCodeResponse) + if !ok { + that2, ok := that.(QueryAnalyzeCodeResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.HasIbcEntryPoints != that1.HasIbcEntryPoints { + return false + } + if this.RequiredFeatures != that1.RequiredFeatures { + return false + } + return true } +func (this *CreateResultData) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *CodeInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Builder) > 0 { - i -= len(m.Builder) - copy(dAtA[i:], m.Builder) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Builder))) - i-- - dAtA[i] = 0x2a + that1, ok := that.(*CreateResultData) + if !ok { + that2, ok := that.(CreateResultData) + if ok { + that1 = &that2 + } else { + return false + } } - if len(m.Source) > 0 { - i -= len(m.Source) - copy(dAtA[i:], m.Source) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Source))) - i-- - dAtA[i] = 0x22 + if that1 == nil { + return this == nil + } else if this == nil { + return false } - if len(m.CodeHash) > 0 { - i -= len(m.CodeHash) - copy(dAtA[i:], m.CodeHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) - i-- - dAtA[i] = 0x1a + if !bytes.Equal(this.WasmHash, that1.WasmHash) { + return false } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0x12 + if !bytes.Equal(this.CodeHash, that1.CodeHash) { + return false } - if m.CodeId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) - i-- - dAtA[i] = 0x8 + if this.HasError != that1.HasError { + return false } - return len(dAtA) - i, nil -} - -func (m *QueryCodeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if this.ErrorMsg != that1.ErrorMsg { + return false } - return dAtA[:n], nil -} - -func (m *QueryCodeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return true } - -func (m *QueryCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Wasm) > 0 { - i -= len(m.Wasm) - copy(dAtA[i:], m.Wasm) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Wasm))) - i-- - dAtA[i] = 0x12 +func (this *QueryBlockCreateResultsRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if m.CodeInfoResponse != nil { - { - size, err := m.CodeInfoResponse.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + + that1, ok := that.(*QueryBlockCreateResultsRequest) + if !ok { + that2, ok := that.(QueryBlockCreateResultsRequest) + if ok { + that1 = &that2 + } else { + return false } - i-- - dAtA[i] = 0xa } - return len(dAtA) - i, nil -} - -func (m *QueryCodesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return dAtA[:n], nil -} - -func (m *QueryCodesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if this.Height != that1.Height { + return false + } + return true } +func (this *QueryBlockCreateResultsResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CodeInfos) > 0 { - for iNdEx := len(m.CodeInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CodeInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + that1, ok := that.(*QueryBlockCreateResultsResponse) + if !ok { + that2, ok := that.(QueryBlockCreateResultsResponse) + if ok { + that1 = &that2 + } else { + return false } } - return len(dAtA) - i, nil -} - -func (m *QueryContractAddressResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return dAtA[:n], nil + if len(this.Results) != len(that1.Results) { + return false + } + for i := range this.Results { + if !this.Results[i].Equal(&that1.Results[i]) { + return false + } + } + return true } -func (m *QueryContractAddressResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn -func (m *QueryContractAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Query contract info by address + ContractInfo(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) + // Query code info by id + ContractsByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryContractsByCodeIdResponse, error) + // Query secret contract + QuerySecretContract(ctx context.Context, in *QuerySecretContractRequest, opts ...grpc.CallOption) (*QuerySecretContractResponse, error) + // Query a specific contract code by id + Code(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) + // Query all contract codes on-chain + Codes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) + // Query code hash by contract address + CodeHashByContractAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) + // Query code hash by code id + CodeHashByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) + // Query contract label by address + LabelByAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractLabelResponse, error) + // Query contract address by label + AddressByLabel(ctx context.Context, in *QueryByLabelRequest, opts ...grpc.CallOption) (*QueryContractAddressResponse, error) + // ContractHistory gets the contract code history + ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) + // Params defines a gRPC query method that returns the compute + // module's parameters. + Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) + // Query authorized migration for a contract + AuthorizedMigration(ctx context.Context, in *QueryAuthorizedMigrationRequest, opts ...grpc.CallOption) (*QueryAuthorizedMigrationResponse, error) + // Query authorized admin update for a contract + AuthorizedAdminUpdate(ctx context.Context, in *QueryAuthorizedAdminUpdateRequest, opts ...grpc.CallOption) (*QueryAuthorizedAdminUpdateResponse, error) + // Query ecall record for a specific block height (for non-SGX node sync) + EcallRecord(ctx context.Context, in *QueryEcallRecordRequest, opts ...grpc.CallOption) (*QueryEcallRecordResponse, error) + // Query ecall records for a range of block heights (batch sync) + EcallRecords(ctx context.Context, in *QueryEcallRecordsRequest, opts ...grpc.CallOption) (*QueryEcallRecordsResponse, error) + // Query network pubkey by block height and seed index (for non-SGX node sync) + NetworkPubkey(ctx context.Context, in *QueryNetworkPubkeyRequest, opts ...grpc.CallOption) (*QueryNetworkPubkeyResponse, error) + // Query encrypted seed by certificate hash (for non-SGX node sync) + EncryptedSeed(ctx context.Context, in *QueryEncryptedSeedRequest, opts ...grpc.CallOption) (*QueryEncryptedSeedResponse, error) + // Query all execution traces for a block (batch fetch for non-SGX node sync) + BlockTraces(ctx context.Context, in *QueryBlockTracesRequest, opts ...grpc.CallOption) (*QueryBlockTracesResponse, error) + // Query machine ID proof for a specific block height and machine ID (for non-SGX node sync) + MachineIDProof(ctx context.Context, in *QueryMachineIDProofRequest, opts ...grpc.CallOption) (*QueryMachineIDProofResponse, error) + // Analyze code to determine IBC entry points and required features + AnalyzeCode(ctx context.Context, in *QueryAnalyzeCodeRequest, opts ...grpc.CallOption) (*QueryAnalyzeCodeResponse, error) + // Query all Create (MsgStoreCode) results for a block (for non-SGX node sync) + BlockCreateResults(ctx context.Context, in *QueryBlockCreateResultsRequest, opts ...grpc.CallOption) (*QueryBlockCreateResultsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) ContractInfo(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) { + out := new(QueryContractInfoResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractInfo", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryContractLabelResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ContractsByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryContractsByCodeIdResponse, error) { + out := new(QueryContractsByCodeIdResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractsByCodeId", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryContractLabelResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QuerySecretContract(ctx context.Context, in *QuerySecretContractRequest, opts ...grpc.CallOption) (*QuerySecretContractResponse, error) { + out := new(QuerySecretContractResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/QuerySecretContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryContractLabelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Label) > 0 { - i -= len(m.Label) - copy(dAtA[i:], m.Label) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Label))) - i-- - dAtA[i] = 0xa +func (c *queryClient) Code(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) { + out := new(QueryCodeResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Code", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryCodeHashResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Codes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) { + out := new(QueryCodesResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Codes", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryCodeHashResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) CodeHashByContractAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { + out := new(QueryCodeHashResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/CodeHashByContractAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryCodeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CodeHash) > 0 { - i -= len(m.CodeHash) - copy(dAtA[i:], m.CodeHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) - i-- - dAtA[i] = 0xa +func (c *queryClient) CodeHashByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { + out := new(QueryCodeHashResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/CodeHashByCodeId", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *DecryptedAnswer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) LabelByAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractLabelResponse, error) { + out := new(QueryContractLabelResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/LabelByAddress", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *DecryptedAnswer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) AddressByLabel(ctx context.Context, in *QueryByLabelRequest, opts ...grpc.CallOption) (*QueryContractAddressResponse, error) { + out := new(QueryContractAddressResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AddressByLabel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *DecryptedAnswer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OutputDataAsString) > 0 { - i -= len(m.OutputDataAsString) - copy(dAtA[i:], m.OutputDataAsString) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputDataAsString))) - i-- - dAtA[i] = 0x22 +func (c *queryClient) ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) { + out := new(QueryContractHistoryResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractHistory", in, out, opts...) + if err != nil { + return nil, err } - if len(m.OutputData) > 0 { - i -= len(m.OutputData) - copy(dAtA[i:], m.OutputData) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputData))) - i-- - dAtA[i] = 0x1a + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { + out := new(ParamsResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err } - if len(m.Input) > 0 { - i -= len(m.Input) - copy(dAtA[i:], m.Input) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Input))) - i-- - dAtA[i] = 0x12 + return out, nil +} + +func (c *queryClient) AuthorizedMigration(ctx context.Context, in *QueryAuthorizedMigrationRequest, opts ...grpc.CallOption) (*QueryAuthorizedMigrationResponse, error) { + out := new(QueryAuthorizedMigrationResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AuthorizedMigration", in, out, opts...) + if err != nil { + return nil, err } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa + return out, nil +} + +func (c *queryClient) AuthorizedAdminUpdate(ctx context.Context, in *QueryAuthorizedAdminUpdateRequest, opts ...grpc.CallOption) (*QueryAuthorizedAdminUpdateResponse, error) { + out := new(QueryAuthorizedAdminUpdateResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AuthorizedAdminUpdate", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *DecryptedAnswers) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) EcallRecord(ctx context.Context, in *QueryEcallRecordRequest, opts ...grpc.CallOption) (*QueryEcallRecordResponse, error) { + out := new(QueryEcallRecordResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/EcallRecord", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *DecryptedAnswers) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) EcallRecords(ctx context.Context, in *QueryEcallRecordsRequest, opts ...grpc.CallOption) (*QueryEcallRecordsResponse, error) { + out := new(QueryEcallRecordsResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/EcallRecords", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *DecryptedAnswers) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PlaintextError) > 0 { - i -= len(m.PlaintextError) - copy(dAtA[i:], m.PlaintextError) - i = encodeVarintQuery(dAtA, i, uint64(len(m.PlaintextError))) - i-- - dAtA[i] = 0x22 +func (c *queryClient) NetworkPubkey(ctx context.Context, in *QueryNetworkPubkeyRequest, opts ...grpc.CallOption) (*QueryNetworkPubkeyResponse, error) { + out := new(QueryNetworkPubkeyResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/NetworkPubkey", in, out, opts...) + if err != nil { + return nil, err } - if len(m.OutputError) > 0 { - i -= len(m.OutputError) - copy(dAtA[i:], m.OutputError) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputError))) - i-- - dAtA[i] = 0x1a + return out, nil +} + +func (c *queryClient) EncryptedSeed(ctx context.Context, in *QueryEncryptedSeedRequest, opts ...grpc.CallOption) (*QueryEncryptedSeedResponse, error) { + out := new(QueryEncryptedSeedResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/EncryptedSeed", in, out, opts...) + if err != nil { + return nil, err } - if len(m.OutputLogs) > 0 { - for iNdEx := len(m.OutputLogs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.OutputLogs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Answers) > 0 { - for iNdEx := len(m.Answers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Answers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryContractHistoryRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) BlockTraces(ctx context.Context, in *QueryBlockTracesRequest, opts ...grpc.CallOption) (*QueryBlockTracesResponse, error) { + out := new(QueryBlockTracesResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/BlockTraces", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryContractHistoryRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) MachineIDProof(ctx context.Context, in *QueryMachineIDProofRequest, opts ...grpc.CallOption) (*QueryMachineIDProofResponse, error) { + out := new(QueryMachineIDProofResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/MachineIDProof", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryContractHistoryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa +func (c *queryClient) AnalyzeCode(ctx context.Context, in *QueryAnalyzeCodeRequest, opts ...grpc.CallOption) (*QueryAnalyzeCodeResponse, error) { + out := new(QueryAnalyzeCodeResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AnalyzeCode", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryContractHistoryResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) BlockCreateResults(ctx context.Context, in *QueryBlockCreateResultsRequest, opts ...grpc.CallOption) (*QueryBlockCreateResultsResponse, error) { + out := new(QueryBlockCreateResultsResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/BlockCreateResults", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryContractHistoryResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// QueryServer is the server API for Query service. +type QueryServer interface { + // Query contract info by address + ContractInfo(context.Context, *QueryByContractAddressRequest) (*QueryContractInfoResponse, error) + // Query code info by id + ContractsByCodeId(context.Context, *QueryByCodeIdRequest) (*QueryContractsByCodeIdResponse, error) + // Query secret contract + QuerySecretContract(context.Context, *QuerySecretContractRequest) (*QuerySecretContractResponse, error) + // Query a specific contract code by id + Code(context.Context, *QueryByCodeIdRequest) (*QueryCodeResponse, error) + // Query all contract codes on-chain + Codes(context.Context, *emptypb.Empty) (*QueryCodesResponse, error) + // Query code hash by contract address + CodeHashByContractAddress(context.Context, *QueryByContractAddressRequest) (*QueryCodeHashResponse, error) + // Query code hash by code id + CodeHashByCodeId(context.Context, *QueryByCodeIdRequest) (*QueryCodeHashResponse, error) + // Query contract label by address + LabelByAddress(context.Context, *QueryByContractAddressRequest) (*QueryContractLabelResponse, error) + // Query contract address by label + AddressByLabel(context.Context, *QueryByLabelRequest) (*QueryContractAddressResponse, error) + // ContractHistory gets the contract code history + ContractHistory(context.Context, *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) + // Params defines a gRPC query method that returns the compute + // module's parameters. + Params(context.Context, *ParamsRequest) (*ParamsResponse, error) + // Query authorized migration for a contract + AuthorizedMigration(context.Context, *QueryAuthorizedMigrationRequest) (*QueryAuthorizedMigrationResponse, error) + // Query authorized admin update for a contract + AuthorizedAdminUpdate(context.Context, *QueryAuthorizedAdminUpdateRequest) (*QueryAuthorizedAdminUpdateResponse, error) + // Query ecall record for a specific block height (for non-SGX node sync) + EcallRecord(context.Context, *QueryEcallRecordRequest) (*QueryEcallRecordResponse, error) + // Query ecall records for a range of block heights (batch sync) + EcallRecords(context.Context, *QueryEcallRecordsRequest) (*QueryEcallRecordsResponse, error) + // Query network pubkey by block height and seed index (for non-SGX node sync) + NetworkPubkey(context.Context, *QueryNetworkPubkeyRequest) (*QueryNetworkPubkeyResponse, error) + // Query encrypted seed by certificate hash (for non-SGX node sync) + EncryptedSeed(context.Context, *QueryEncryptedSeedRequest) (*QueryEncryptedSeedResponse, error) + // Query all execution traces for a block (batch fetch for non-SGX node sync) + BlockTraces(context.Context, *QueryBlockTracesRequest) (*QueryBlockTracesResponse, error) + // Query machine ID proof for a specific block height and machine ID (for non-SGX node sync) + MachineIDProof(context.Context, *QueryMachineIDProofRequest) (*QueryMachineIDProofResponse, error) + // Analyze code to determine IBC entry points and required features + AnalyzeCode(context.Context, *QueryAnalyzeCodeRequest) (*QueryAnalyzeCodeResponse, error) + // Query all Create (MsgStoreCode) results for a block (for non-SGX node sync) + BlockCreateResults(context.Context, *QueryBlockCreateResultsRequest) (*QueryBlockCreateResultsResponse, error) } -func (m *QueryContractHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { } -func (m *QueryAuthorizedMigrationRequest) 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 (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryByContractAddressRequest) (*QueryContractInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented") } - -func (m *QueryAuthorizedMigrationRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) ContractsByCodeId(ctx context.Context, req *QueryByCodeIdRequest) (*QueryContractsByCodeIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ContractsByCodeId not implemented") +} +func (*UnimplementedQueryServer) QuerySecretContract(ctx context.Context, req *QuerySecretContractRequest) (*QuerySecretContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QuerySecretContract not implemented") +} +func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryByCodeIdRequest) (*QueryCodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") +} +func (*UnimplementedQueryServer) Codes(ctx context.Context, req *emptypb.Empty) (*QueryCodesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented") +} +func (*UnimplementedQueryServer) CodeHashByContractAddress(ctx context.Context, req *QueryByContractAddressRequest) (*QueryCodeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CodeHashByContractAddress not implemented") +} +func (*UnimplementedQueryServer) CodeHashByCodeId(ctx context.Context, req *QueryByCodeIdRequest) (*QueryCodeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CodeHashByCodeId not implemented") +} +func (*UnimplementedQueryServer) LabelByAddress(ctx context.Context, req *QueryByContractAddressRequest) (*QueryContractLabelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LabelByAddress not implemented") +} +func (*UnimplementedQueryServer) AddressByLabel(ctx context.Context, req *QueryByLabelRequest) (*QueryContractAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddressByLabel not implemented") +} +func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) AuthorizedMigration(ctx context.Context, req *QueryAuthorizedMigrationRequest) (*QueryAuthorizedMigrationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthorizedMigration not implemented") +} +func (*UnimplementedQueryServer) AuthorizedAdminUpdate(ctx context.Context, req *QueryAuthorizedAdminUpdateRequest) (*QueryAuthorizedAdminUpdateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthorizedAdminUpdate not implemented") +} +func (*UnimplementedQueryServer) EcallRecord(ctx context.Context, req *QueryEcallRecordRequest) (*QueryEcallRecordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EcallRecord not implemented") +} +func (*UnimplementedQueryServer) EcallRecords(ctx context.Context, req *QueryEcallRecordsRequest) (*QueryEcallRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EcallRecords not implemented") +} +func (*UnimplementedQueryServer) NetworkPubkey(ctx context.Context, req *QueryNetworkPubkeyRequest) (*QueryNetworkPubkeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NetworkPubkey not implemented") +} +func (*UnimplementedQueryServer) EncryptedSeed(ctx context.Context, req *QueryEncryptedSeedRequest) (*QueryEncryptedSeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EncryptedSeed not implemented") +} +func (*UnimplementedQueryServer) BlockTraces(ctx context.Context, req *QueryBlockTracesRequest) (*QueryBlockTracesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlockTraces not implemented") +} +func (*UnimplementedQueryServer) MachineIDProof(ctx context.Context, req *QueryMachineIDProofRequest) (*QueryMachineIDProofResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MachineIDProof not implemented") +} +func (*UnimplementedQueryServer) AnalyzeCode(ctx context.Context, req *QueryAnalyzeCodeRequest) (*QueryAnalyzeCodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnalyzeCode not implemented") +} +func (*UnimplementedQueryServer) BlockCreateResults(ctx context.Context, req *QueryBlockCreateResultsRequest) (*QueryBlockCreateResultsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlockCreateResults not implemented") } -func (m *QueryAuthorizedMigrationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) } -func (m *QueryAuthorizedMigrationResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_ContractInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByContractAddressRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryAuthorizedMigrationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if interceptor == nil { + return srv.(QueryServer).ContractInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/ContractInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ContractInfo(ctx, req.(*QueryByContractAddressRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedMigrationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NewCodeID != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.NewCodeID)) - i-- - dAtA[i] = 0x8 +func _Query_ContractsByCodeId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByCodeIdRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).ContractsByCodeId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/ContractsByCodeId", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ContractsByCodeId(ctx, req.(*QueryByCodeIdRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedAdminUpdateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_QuerySecretContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySecretContractRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).QuerySecretContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/QuerySecretContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QuerySecretContract(ctx, req.(*QuerySecretContractRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedAdminUpdateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAuthorizedAdminUpdateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa +func _Query_Code_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByCodeIdRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).Code(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/Code", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Code(ctx, req.(*QueryByCodeIdRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedAdminUpdateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Codes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryAuthorizedAdminUpdateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAuthorizedAdminUpdateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NewAdmin) > 0 { - i -= len(m.NewAdmin) - copy(dAtA[i:], m.NewAdmin) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NewAdmin))) - i-- - dAtA[i] = 0xa + if interceptor == nil { + return srv.(QueryServer).Codes(ctx, in) } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/Codes", } - dAtA[offset] = uint8(v) - return base -} -func (m *ParamsRequest) Size() (n int) { - if m == nil { - return 0 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Codes(ctx, req.(*emptypb.Empty)) } - var l int - _ = l - return n + return interceptor(ctx, in, info, handler) } -func (m *ParamsResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_CodeHashByContractAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByContractAddressRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QuerySecretContractRequest) Size() (n int) { - if m == nil { - return 0 + if interceptor == nil { + return srv.(QueryServer).CodeHashByContractAddress(ctx, in) } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/CodeHashByContractAddress", } - l = len(m.Query) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CodeHashByContractAddress(ctx, req.(*QueryByContractAddressRequest)) } - return n + return interceptor(ctx, in, info, handler) } -func (m *QueryByLabelRequest) Size() (n int) { - if m == nil { - return 0 +func _Query_CodeHashByCodeId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByCodeIdRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - l = len(m.Label) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).CodeHashByCodeId(ctx, in) } - return n -} - -func (m *QueryByContractAddressRequest) Size() (n int) { - if m == nil { - return 0 + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/CodeHashByCodeId", } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CodeHashByCodeId(ctx, req.(*QueryByCodeIdRequest)) } - return n + return interceptor(ctx, in, info, handler) } -func (m *QueryByCodeIdRequest) Size() (n int) { - if m == nil { - return 0 +func _Query_LabelByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByContractAddressRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - if m.CodeId != 0 { - n += 1 + sovQuery(uint64(m.CodeId)) + if interceptor == nil { + return srv.(QueryServer).LabelByAddress(ctx, in) } - return n -} - -func (m *QuerySecretContractResponse) Size() (n int) { - if m == nil { - return 0 + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/LabelByAddress", } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LabelByAddress(ctx, req.(*QueryByContractAddressRequest)) } - return n + return interceptor(ctx, in, info, handler) } -func (m *QueryContractInfoResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_AddressByLabel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByLabelRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).AddressByLabel(ctx, in) } - if m.ContractInfo != nil { - l = m.ContractInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/AddressByLabel", } - return n + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AddressByLabel(ctx, req.(*QueryByLabelRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *ContractInfoWithAddress) Size() (n int) { - if m == nil { - return 0 +func _Query_ContractHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryContractHistoryRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).ContractHistory(ctx, in) } - if m.ContractInfo != nil { - l = m.ContractInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/ContractHistory", } - return n + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ContractHistory(ctx, req.(*QueryContractHistoryRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryContractsByCodeIdResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ParamsRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - if len(m.ContractInfos) > 0 { - for _, e := range m.ContractInfos { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) } - return n + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *CodeInfoResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_AuthorizedMigration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuthorizedMigrationRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - if m.CodeId != 0 { - n += 1 + sovQuery(uint64(m.CodeId)) + if interceptor == nil { + return srv.(QueryServer).AuthorizedMigration(ctx, in) } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/AuthorizedMigration", } - l = len(m.CodeHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuthorizedMigration(ctx, req.(*QueryAuthorizedMigrationRequest)) } - l = len(m.Source) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + return interceptor(ctx, in, info, handler) +} + +func _Query_AuthorizedAdminUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuthorizedAdminUpdateRequest) + if err := dec(in); err != nil { + return nil, err } - l = len(m.Builder) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).AuthorizedAdminUpdate(ctx, in) } - return n + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/AuthorizedAdminUpdate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuthorizedAdminUpdate(ctx, req.(*QueryAuthorizedAdminUpdateRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryCodeResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_EcallRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEcallRecordRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - if m.CodeInfoResponse != nil { - l = m.CodeInfoResponse.Size() - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).EcallRecord(ctx, in) } - l = len(m.Wasm) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/EcallRecord", } - return n + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EcallRecord(ctx, req.(*QueryEcallRecordRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryCodesResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_EcallRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEcallRecordsRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - if len(m.CodeInfos) > 0 { - for _, e := range m.CodeInfos { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if interceptor == nil { + return srv.(QueryServer).EcallRecords(ctx, in) } - return n + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/EcallRecords", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EcallRecords(ctx, req.(*QueryEcallRecordsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryContractAddressResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_NetworkPubkey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryNetworkPubkeyRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).NetworkPubkey(ctx, in) } - return n + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/NetworkPubkey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NetworkPubkey(ctx, req.(*QueryNetworkPubkeyRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryContractLabelResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_EncryptedSeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEncryptedSeedRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - l = len(m.Label) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).EncryptedSeed(ctx, in) } - return n + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/EncryptedSeed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EncryptedSeed(ctx, req.(*QueryEncryptedSeedRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryCodeHashResponse) Size() (n int) { - if m == nil { - return 0 +func _Query_BlockTraces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlockTracesRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - l = len(m.CodeHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).BlockTraces(ctx, in) } - return n + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/BlockTraces", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BlockTraces(ctx, req.(*QueryBlockTracesRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *DecryptedAnswer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func _Query_MachineIDProof_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMachineIDProofRequest) + if err := dec(in); err != nil { + return nil, err } - l = len(m.Input) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).MachineIDProof(ctx, in) } - l = len(m.OutputData) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/MachineIDProof", } - l = len(m.OutputDataAsString) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MachineIDProof(ctx, req.(*QueryMachineIDProofRequest)) } - return n + return interceptor(ctx, in, info, handler) } -func (m *DecryptedAnswers) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Answers) > 0 { - for _, e := range m.Answers { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } +func _Query_AnalyzeCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAnalyzeCodeRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.OutputLogs) > 0 { - for _, e := range m.OutputLogs { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if interceptor == nil { + return srv.(QueryServer).AnalyzeCode(ctx, in) } - l = len(m.OutputError) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/AnalyzeCode", } - l = len(m.PlaintextError) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AnalyzeCode(ctx, req.(*QueryAnalyzeCodeRequest)) } - return n + return interceptor(ctx, in, info, handler) } -func (m *QueryContractHistoryRequest) Size() (n int) { - if m == nil { - return 0 +func _Query_BlockCreateResults_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlockCreateResultsRequest) + if err := dec(in); err != nil { + return nil, err } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if interceptor == nil { + return srv.(QueryServer).BlockCreateResults(ctx, in) } - return n + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/BlockCreateResults", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BlockCreateResults(ctx, req.(*QueryBlockCreateResultsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryContractHistoryResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "secret.compute.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ContractInfo", + Handler: _Query_ContractInfo_Handler, + }, + { + MethodName: "ContractsByCodeId", + Handler: _Query_ContractsByCodeId_Handler, + }, + { + MethodName: "QuerySecretContract", + Handler: _Query_QuerySecretContract_Handler, + }, + { + MethodName: "Code", + Handler: _Query_Code_Handler, + }, + { + MethodName: "Codes", + Handler: _Query_Codes_Handler, + }, + { + MethodName: "CodeHashByContractAddress", + Handler: _Query_CodeHashByContractAddress_Handler, + }, + { + MethodName: "CodeHashByCodeId", + Handler: _Query_CodeHashByCodeId_Handler, + }, + { + MethodName: "LabelByAddress", + Handler: _Query_LabelByAddress_Handler, + }, + { + MethodName: "AddressByLabel", + Handler: _Query_AddressByLabel_Handler, + }, + { + MethodName: "ContractHistory", + Handler: _Query_ContractHistory_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "AuthorizedMigration", + Handler: _Query_AuthorizedMigration_Handler, + }, + { + MethodName: "AuthorizedAdminUpdate", + Handler: _Query_AuthorizedAdminUpdate_Handler, + }, + { + MethodName: "EcallRecord", + Handler: _Query_EcallRecord_Handler, + }, + { + MethodName: "EcallRecords", + Handler: _Query_EcallRecords_Handler, + }, + { + MethodName: "NetworkPubkey", + Handler: _Query_NetworkPubkey_Handler, + }, + { + MethodName: "EncryptedSeed", + Handler: _Query_EncryptedSeed_Handler, + }, + { + MethodName: "BlockTraces", + Handler: _Query_BlockTraces_Handler, + }, + { + MethodName: "MachineIDProof", + Handler: _Query_MachineIDProof_Handler, + }, + { + MethodName: "AnalyzeCode", + Handler: _Query_AnalyzeCode_Handler, + }, + { + MethodName: "BlockCreateResults", + Handler: _Query_BlockCreateResults_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "secret/compute/v1beta1/query.proto", +} + +func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QuerySecretContractRequest) 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 *QuerySecretContractRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySecretContractRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0x12 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryByLabelRequest) 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 *QueryByLabelRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryByLabelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Label) > 0 { + i -= len(m.Label) + copy(dAtA[i:], m.Label) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Label))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryByContractAddressRequest) 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 *QueryByContractAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryByContractAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryByCodeIdRequest) 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 *QueryByCodeIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryByCodeIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CodeId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QuerySecretContractResponse) 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 *QuerySecretContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySecretContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryContractInfoResponse) 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 *QueryContractInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ContractInfo != nil { + { + size, err := m.ContractInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ContractInfoWithAddress) 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 *ContractInfoWithAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContractInfoWithAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ContractInfo != nil { + { + size, err := m.ContractInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryContractsByCodeIdResponse) 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 *QueryContractsByCodeIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractsByCodeIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractInfos) > 0 { + for iNdEx := len(m.ContractInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ContractInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *CodeInfoResponse) 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 *CodeInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CodeInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Builder) > 0 { + i -= len(m.Builder) + copy(dAtA[i:], m.Builder) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Builder))) + i-- + dAtA[i] = 0x2a + } + if len(m.Source) > 0 { + i -= len(m.Source) + copy(dAtA[i:], m.Source) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Source))) + i-- + dAtA[i] = 0x22 + } + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x12 + } + if m.CodeId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryCodeResponse) 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 *QueryCodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Wasm) > 0 { + i -= len(m.Wasm) + copy(dAtA[i:], m.Wasm) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Wasm))) + i-- + dAtA[i] = 0x12 + } + if m.CodeInfoResponse != nil { + { + size, err := m.CodeInfoResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCodesResponse) 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 *QueryCodesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CodeInfos) > 0 { + for iNdEx := len(m.CodeInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CodeInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryContractAddressResponse) 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 *QueryContractAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryContractLabelResponse) 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 *QueryContractLabelResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractLabelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Label) > 0 { + i -= len(m.Label) + copy(dAtA[i:], m.Label) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Label))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCodeHashResponse) 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 *QueryCodeHashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DecryptedAnswer) 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 *DecryptedAnswer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DecryptedAnswer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OutputDataAsString) > 0 { + i -= len(m.OutputDataAsString) + copy(dAtA[i:], m.OutputDataAsString) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputDataAsString))) + i-- + dAtA[i] = 0x22 + } + if len(m.OutputData) > 0 { + i -= len(m.OutputData) + copy(dAtA[i:], m.OutputData) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputData))) + i-- + dAtA[i] = 0x1a + } + if len(m.Input) > 0 { + i -= len(m.Input) + copy(dAtA[i:], m.Input) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Input))) + i-- + dAtA[i] = 0x12 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DecryptedAnswers) 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 *DecryptedAnswers) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DecryptedAnswers) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PlaintextError) > 0 { + i -= len(m.PlaintextError) + copy(dAtA[i:], m.PlaintextError) + i = encodeVarintQuery(dAtA, i, uint64(len(m.PlaintextError))) + i-- + dAtA[i] = 0x22 + } + if len(m.OutputError) > 0 { + i -= len(m.OutputError) + copy(dAtA[i:], m.OutputError) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputError))) + i-- + dAtA[i] = 0x1a + } + if len(m.OutputLogs) > 0 { + for iNdEx := len(m.OutputLogs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OutputLogs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Answers) > 0 { + for iNdEx := len(m.Answers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Answers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryContractHistoryRequest) 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 *QueryContractHistoryRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractHistoryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryContractHistoryResponse) 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 *QueryContractHistoryResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAuthorizedMigrationRequest) 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 *QueryAuthorizedMigrationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizedMigrationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAuthorizedMigrationResponse) 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 *QueryAuthorizedMigrationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizedMigrationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NewCodeID != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.NewCodeID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryAuthorizedAdminUpdateRequest) 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 *QueryAuthorizedAdminUpdateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizedAdminUpdateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAuthorizedAdminUpdateResponse) 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 *QueryAuthorizedAdminUpdateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizedAdminUpdateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NewAdmin) > 0 { + i -= len(m.NewAdmin) + copy(dAtA[i:], m.NewAdmin) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NewAdmin))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryEcallRecordRequest) 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 *QueryEcallRecordRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEcallRecordRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEcallRecordResponse) 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 *QueryEcallRecordResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEcallRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorSetEvidence) > 0 { + i -= len(m.ValidatorSetEvidence) + copy(dAtA[i:], m.ValidatorSetEvidence) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorSetEvidence))) + i-- + dAtA[i] = 0x1a + } + if len(m.RandomSeed) > 0 { + i -= len(m.RandomSeed) + copy(dAtA[i:], m.RandomSeed) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RandomSeed))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryNetworkPubkeyRequest) 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 *QueryNetworkPubkeyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNetworkPubkeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ISeed != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ISeed)) + i-- + dAtA[i] = 0x10 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryNetworkPubkeyResponse) 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 *QueryNetworkPubkeyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNetworkPubkeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.IoPubkey) > 0 { + i -= len(m.IoPubkey) + copy(dAtA[i:], m.IoPubkey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.IoPubkey))) + i-- + dAtA[i] = 0x12 + } + if len(m.NodePubkey) > 0 { + i -= len(m.NodePubkey) + copy(dAtA[i:], m.NodePubkey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NodePubkey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryEcallRecordsRequest) 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 *QueryEcallRecordsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEcallRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EndHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EndHeight)) + i-- + dAtA[i] = 0x10 + } + if m.StartHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEcallRecordsResponse) 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 *QueryEcallRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEcallRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryEncryptedSeedRequest) 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 *QueryEncryptedSeedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEncryptedSeedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.CertHash) > 0 { + i -= len(m.CertHash) + copy(dAtA[i:], m.CertHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CertHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryEncryptedSeedResponse) 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 *QueryEncryptedSeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEncryptedSeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EncryptedSeed) > 0 { + i -= len(m.EncryptedSeed) + copy(dAtA[i:], m.EncryptedSeed) + i = encodeVarintQuery(dAtA, i, uint64(len(m.EncryptedSeed))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StorageOp) 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 *StorageOp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if m.IsDelete { + i-- + if m.IsDelete { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CrossModuleOp) 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 *CrossModuleOp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CrossModuleOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsDelete { + i-- + if m.IsDelete { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if len(m.StoreKey) > 0 { + i -= len(m.StoreKey) + copy(dAtA[i:], m.StoreKey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StoreKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ExecutionTraceData) 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 *ExecutionTraceData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExecutionTraceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CrossOps) > 0 { + for iNdEx := len(m.CrossOps) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CrossOps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if m.CallbackGas != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.CallbackGas)) + i-- + dAtA[i] = 0x38 + } + if len(m.ErrorMsg) > 0 { + i -= len(m.ErrorMsg) + copy(dAtA[i:], m.ErrorMsg) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ErrorMsg))) + i-- + dAtA[i] = 0x32 + } + if m.HasError { + i-- + if m.HasError { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.GasUsed != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x20 + } + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x1a + } + if len(m.Ops) > 0 { + for iNdEx := len(m.Ops) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Index != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockTracesRequest) 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 *QueryBlockTracesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockTracesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockTracesResponse) 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 *QueryBlockTracesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockTracesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Traces) > 0 { + for iNdEx := len(m.Traces) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Traces[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryMachineIDProofRequest) 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 *QueryMachineIDProofRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMachineIDProofRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MachineId) > 0 { + i -= len(m.MachineId) + copy(dAtA[i:], m.MachineId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.MachineId))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryMachineIDProofResponse) 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 *QueryMachineIDProofResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMachineIDProofResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Proof) > 0 { + i -= len(m.Proof) + copy(dAtA[i:], m.Proof) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Proof))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAnalyzeCodeRequest) 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 *QueryAnalyzeCodeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAnalyzeCodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAnalyzeCodeResponse) 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 *QueryAnalyzeCodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAnalyzeCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequiredFeatures) > 0 { + i -= len(m.RequiredFeatures) + copy(dAtA[i:], m.RequiredFeatures) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RequiredFeatures))) + i-- + dAtA[i] = 0x12 + } + if m.HasIbcEntryPoints { + i-- + if m.HasIbcEntryPoints { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CreateResultData) 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 *CreateResultData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateResultData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ErrorMsg) > 0 { + i -= len(m.ErrorMsg) + copy(dAtA[i:], m.ErrorMsg) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ErrorMsg))) + i-- + dAtA[i] = 0x22 + } + if m.HasError { + i-- + if m.HasError { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0x12 + } + if len(m.WasmHash) > 0 { + i -= len(m.WasmHash) + copy(dAtA[i:], m.WasmHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.WasmHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockCreateResultsRequest) 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 *QueryBlockCreateResultsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockCreateResultsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockCreateResultsResponse) 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 *QueryBlockCreateResultsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockCreateResultsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Results) > 0 { + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QuerySecretContractRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Query) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryByLabelRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Label) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryByContractAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryByCodeIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeId != 0 { + n += 1 + sovQuery(uint64(m.CodeId)) + } + return n +} + +func (m *QuerySecretContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ContractInfo != nil { + l = m.ContractInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *ContractInfoWithAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ContractInfo != nil { + l = m.ContractInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractsByCodeIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ContractInfos) > 0 { + for _, e := range m.ContractInfos { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *CodeInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeId != 0 { + n += 1 + sovQuery(uint64(m.CodeId)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Source) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Builder) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeInfoResponse != nil { + l = m.CodeInfoResponse.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Wasm) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.CodeInfos) > 0 { + for _, e := range m.CodeInfos { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryContractAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractLabelResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Label) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodeHashResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *DecryptedAnswer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Input) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OutputData) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OutputDataAsString) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *DecryptedAnswers) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Answers) > 0 { + for _, e := range m.Answers { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.OutputLogs) > 0 { + for _, e := range m.OutputLogs { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + l = len(m.OutputError) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.PlaintextError) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractHistoryRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractHistoryResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAuthorizedMigrationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAuthorizedMigrationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NewCodeID != 0 { + n += 1 + sovQuery(uint64(m.NewCodeID)) + } + return n +} + +func (m *QueryAuthorizedAdminUpdateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAuthorizedAdminUpdateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NewAdmin) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryEcallRecordRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryEcallRecordResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + l = len(m.RandomSeed) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorSetEvidence) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryNetworkPubkeyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + if m.ISeed != 0 { + n += 1 + sovQuery(uint64(m.ISeed)) + } + return n +} + +func (m *QueryNetworkPubkeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NodePubkey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.IoPubkey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryEcallRecordsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StartHeight != 0 { + n += 1 + sovQuery(uint64(m.StartHeight)) + } + if m.EndHeight != 0 { + n += 1 + sovQuery(uint64(m.EndHeight)) + } + return n +} + +func (m *QueryEcallRecordsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryEncryptedSeedRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CertHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryEncryptedSeedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.EncryptedSeed) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *StorageOp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsDelete { + n += 2 + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *CrossModuleOp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StoreKey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.IsDelete { + n += 2 + } + return n +} + +func (m *ExecutionTraceData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovQuery(uint64(m.Index)) + } + if len(m.Ops) > 0 { + for _, e := range m.Ops { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.GasUsed != 0 { + n += 1 + sovQuery(uint64(m.GasUsed)) + } + if m.HasError { + n += 2 + } + l = len(m.ErrorMsg) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.CallbackGas != 0 { + n += 1 + sovQuery(uint64(m.CallbackGas)) + } + if len(m.CrossOps) > 0 { + for _, e := range m.CrossOps { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryBlockTracesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryBlockTracesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Traces) > 0 { + for _, e := range m.Traces { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryMachineIDProofRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + l = len(m.MachineId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryMachineIDProofResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Proof) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAnalyzeCodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAnalyzeCodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HasIbcEntryPoints { + n += 2 + } + l = len(m.RequiredFeatures) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *CreateResultData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WasmHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.HasError { + n += 2 + } + l = len(m.ErrorMsg) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBlockCreateResultsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryBlockCreateResultsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySecretContractRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySecretContractRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = append(m.Query[:0], dAtA[iNdEx:postIndex]...) + if m.Query == nil { + m.Query = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryByLabelRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryByLabelRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryByContractAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryByContractAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryByCodeIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryByCodeIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + } + m.CodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySecretContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySecretContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContractInfo == nil { + m.ContractInfo = &ContractInfo{} + } + if err := m.ContractInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContractInfoWithAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContractInfoWithAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContractInfo == nil { + m.ContractInfo = &ContractInfo{} + } + if err := m.ContractInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractsByCodeIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractsByCodeIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractInfos = append(m.ContractInfos, ContractInfoWithAddress{}) + if err := m.ContractInfos[len(m.ContractInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CodeInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CodeInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + } + m.CodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Source = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Builder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Builder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeInfoResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CodeInfoResponse == nil { + m.CodeInfoResponse = &CodeInfoResponse{} + } + if err := m.CodeInfoResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Wasm", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Wasm = append(m.Wasm[:0], dAtA[iNdEx:postIndex]...) + if m.Wasm == nil { + m.Wasm = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCodesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeInfos = append(m.CodeInfos, CodeInfoResponse{}) + if err := m.CodeInfos[len(m.CodeInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractLabelResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractLabelResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCodeHashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DecryptedAnswer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DecryptedAnswer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Input = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutputData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutputData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutputDataAsString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutputDataAsString = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DecryptedAnswers: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DecryptedAnswers: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Answers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Answers = append(m.Answers, &DecryptedAnswer{}) + if err := m.Answers[len(m.Answers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutputLogs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutputLogs = append(m.OutputLogs, types.StringEvent{}) + if err := m.OutputLogs[len(m.OutputLogs)-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 OutputError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutputError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PlaintextError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PlaintextError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - return n -} - -func (m *QueryAuthorizedMigrationRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAuthorizedMigrationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NewCodeID != 0 { - n += 1 + sovQuery(uint64(m.NewCodeID)) - } - return n -} - -func (m *QueryAuthorizedAdminUpdateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} -func (m *QueryAuthorizedAdminUpdateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NewAdmin) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *ParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3380,12 +8185,44 @@ func (m *ParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryContractHistoryRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryContractHistoryRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3407,7 +8244,7 @@ func (m *ParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3430,15 +8267,15 @@ func (m *ParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryContractHistoryResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryContractHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3465,7 +8302,8 @@ func (m *ParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Entries = append(m.Entries, ContractCodeHistoryEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3490,7 +8328,7 @@ func (m *ParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3513,10 +8351,10 @@ func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySecretContractRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAuthorizedMigrationRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySecretContractRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAuthorizedMigrationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3551,40 +8389,6 @@ func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { } m.ContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Query = append(m.Query[:0], dAtA[iNdEx:postIndex]...) - if m.Query == nil { - m.Query = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3606,7 +8410,7 @@ func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3629,17 +8433,17 @@ func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryByLabelRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAuthorizedMigrationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryByLabelRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAuthorizedMigrationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewCodeID", wireType) } - var stringLen uint64 + m.NewCodeID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3649,24 +8453,11 @@ func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.NewCodeID |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3688,7 +8479,7 @@ func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3711,10 +8502,10 @@ func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryByContractAddressRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAuthorizedAdminUpdateRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryByContractAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAuthorizedAdminUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3770,7 +8561,7 @@ func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAuthorizedAdminUpdateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3793,17 +8584,17 @@ func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryByCodeIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAuthorizedAdminUpdateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryByCodeIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAuthorizedAdminUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) } - m.CodeId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3813,11 +8604,24 @@ func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CodeId |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewAdmin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3839,7 +8643,7 @@ func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEcallRecordRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3862,17 +8666,17 @@ func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySecretContractResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEcallRecordRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySecretContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEcallRecordRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var byteLen int + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3882,26 +8686,11 @@ func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3923,7 +8712,7 @@ func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEcallRecordResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3946,17 +8735,36 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEcallRecordResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEcallRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RandomSeed", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3966,29 +8774,31 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.RandomSeed = append(m.RandomSeed[:0], dAtA[iNdEx:postIndex]...) + if m.RandomSeed == nil { + m.RandomSeed = []byte{} + } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetEvidence", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3998,26 +8808,24 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.ContractInfo == nil { - m.ContractInfo = &ContractInfo{} - } - if err := m.ContractInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.ValidatorSetEvidence = append(m.ValidatorSetEvidence[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorSetEvidence == nil { + m.ValidatorSetEvidence = []byte{} } iNdEx = postIndex default: @@ -4041,7 +8849,7 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { +func (m *QueryNetworkPubkeyRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4064,17 +8872,17 @@ func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ContractInfoWithAddress: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNetworkPubkeyRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ContractInfoWithAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNetworkPubkeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var stringLen uint64 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4084,29 +8892,16 @@ func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractInfo", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ISeed", wireType) } - var msglen int + m.ISeed = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4116,28 +8911,11 @@ func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ISeed |= uint32(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContractInfo == nil { - m.ContractInfo = &ContractInfo{} - } - if err := m.ContractInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4159,7 +8937,7 @@ func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { +func (m *QueryNetworkPubkeyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4182,17 +8960,17 @@ func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractsByCodeIdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNetworkPubkeyResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractsByCodeIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNetworkPubkeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractInfos", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodePubkey", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4202,24 +8980,58 @@ func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractInfos = append(m.ContractInfos, ContractInfoWithAddress{}) - if err := m.ContractInfos[len(m.ContractInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.NodePubkey = append(m.NodePubkey[:0], dAtA[iNdEx:postIndex]...) + if m.NodePubkey == nil { + m.NodePubkey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoPubkey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IoPubkey = append(m.IoPubkey[:0], dAtA[iNdEx:postIndex]...) + if m.IoPubkey == nil { + m.IoPubkey = []byte{} } iNdEx = postIndex default: @@ -4243,7 +9055,7 @@ func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEcallRecordsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4266,17 +9078,17 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CodeInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEcallRecordsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CodeInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEcallRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) } - m.CodeId = 0 + m.StartHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4286,48 +9098,16 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CodeId |= uint64(b&0x7F) << shift + m.StartHeight |= int64(b&0x7F) << shift if b < 0x80 { break } } case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EndHeight", wireType) } - var stringLen uint64 + m.EndHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4337,61 +9117,66 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.EndHeight |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CodeHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEcallRecordsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Source = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: + 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: QueryEcallRecordsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEcallRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Builder", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4401,23 +9186,25 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Builder = string(dAtA[iNdEx:postIndex]) + m.Records = append(m.Records, QueryEcallRecordResponse{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -4440,7 +9227,7 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEncryptedSeedRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4463,17 +9250,17 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEncryptedSeedRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEncryptedSeedRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeInfoResponse", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CertHash", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4483,33 +9270,29 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.CodeInfoResponse == nil { - m.CodeInfoResponse = &CodeInfoResponse{} - } - if err := m.CodeInfoResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.CertHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Wasm", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var byteLen int + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4519,26 +9302,11 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Wasm = append(m.Wasm[:0], dAtA[iNdEx:postIndex]...) - if m.Wasm == nil { - m.Wasm = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4560,7 +9328,7 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEncryptedSeedResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4583,17 +9351,17 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCodesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEncryptedSeedResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCodesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEncryptedSeedResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeInfos", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EncryptedSeed", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4603,24 +9371,24 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeInfos = append(m.CodeInfos, CodeInfoResponse{}) - if err := m.CodeInfos[len(m.CodeInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.EncryptedSeed = append(m.EncryptedSeed[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptedSeed == nil { + m.EncryptedSeed = []byte{} } iNdEx = postIndex default: @@ -4644,7 +9412,7 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { +func (m *StorageOp) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4667,17 +9435,37 @@ func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractAddressResponse: wiretype end group for non-group") + return fmt.Errorf("proto: StorageOp: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StorageOp: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsDelete", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsDelete = bool(v != 0) + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4687,23 +9475,59 @@ func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -4726,7 +9550,7 @@ func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { +func (m *CrossModuleOp) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4749,17 +9573,117 @@ func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractLabelResponse: wiretype end group for non-group") + return fmt.Errorf("proto: CrossModuleOp: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractLabelResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CrossModuleOp: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StoreKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StoreKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF } - var stringLen uint64 + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsDelete", wireType) + } + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4769,24 +9693,12 @@ func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex + m.IsDelete = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4808,7 +9720,7 @@ func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { +func (m *ExecutionTraceData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4831,17 +9743,36 @@ func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCodeHashResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ExecutionTraceData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCodeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExecutionTraceData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Ops", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4851,79 +9782,31 @@ func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { + m.Ops = append(m.Ops, StorageOp{}) + if err := m.Ops[len(m.Ops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DecryptedAnswer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DecryptedAnswer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4933,29 +9816,31 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Type = string(dAtA[iNdEx:postIndex]) + m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) + if m.Result == nil { + m.Result = []byte{} + } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) } - var stringLen uint64 + m.GasUsed = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4965,27 +9850,34 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.GasUsed |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasError", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Input = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: + m.HasError = bool(v != 0) + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMsg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5013,13 +9905,32 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OutputData = string(dAtA[iNdEx:postIndex]) + m.ErrorMsg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CallbackGas", wireType) + } + m.CallbackGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CallbackGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputDataAsString", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CrossOps", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5029,23 +9940,25 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.OutputDataAsString = string(dAtA[iNdEx:postIndex]) + m.CrossOps = append(m.CrossOps, CrossModuleOp{}) + if err := m.CrossOps[len(m.CrossOps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -5068,7 +9981,7 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { } return nil } -func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { +func (m *QueryBlockTracesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5091,17 +10004,17 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DecryptedAnswers: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlockTracesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DecryptedAnswers: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlockTracesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Answers", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var msglen int + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5111,29 +10024,64 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Answers = append(m.Answers, &DecryptedAnswer{}) - if err := m.Answers[len(m.Answers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBlockTracesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery } - iNdEx = postIndex - case 2: + 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: QueryBlockTracesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBlockTracesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputLogs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Traces", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5150,26 +10098,76 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { break } } - if msglen < 0 { + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Traces = append(m.Traces, ExecutionTraceData{}) + if err := m.Traces[len(m.Traces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMachineIDProofRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.OutputLogs = append(m.OutputLogs, types.StringEvent{}) - if err := m.OutputLogs[len(m.OutputLogs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputError", wireType) + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryMachineIDProofRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMachineIDProofRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var stringLen uint64 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5179,27 +10177,14 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutputError = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PlaintextError", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MachineId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5227,7 +10212,7 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PlaintextError = string(dAtA[iNdEx:postIndex]) + m.MachineId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5250,7 +10235,7 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { +func (m *QueryMachineIDProofResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5273,17 +10258,17 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractHistoryRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMachineIDProofResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractHistoryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMachineIDProofResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5293,23 +10278,25 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...) + if m.Proof == nil { + m.Proof = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -5332,7 +10319,7 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAnalyzeCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5355,17 +10342,17 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractHistoryResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAnalyzeCodeRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAnalyzeCodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5375,24 +10362,24 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Entries = append(m.Entries, ContractCodeHistoryEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.CodeHash = append(m.CodeHash[:0], dAtA[iNdEx:postIndex]...) + if m.CodeHash == nil { + m.CodeHash = []byte{} } iNdEx = postIndex default: @@ -5416,7 +10403,7 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAnalyzeCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5439,15 +10426,35 @@ func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAuthorizedMigrationRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAnalyzeCodeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAuthorizedMigrationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAnalyzeCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasIbcEntryPoints", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasIbcEntryPoints = bool(v != 0) + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RequiredFeatures", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5475,7 +10482,7 @@ func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.RequiredFeatures = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5498,7 +10505,7 @@ func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { +func (m *CreateResultData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5521,17 +10528,85 @@ func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAuthorizedMigrationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: CreateResultData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAuthorizedMigrationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CreateResultData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WasmHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WasmHash = append(m.WasmHash[:0], dAtA[iNdEx:postIndex]...) + if m.WasmHash == nil { + m.WasmHash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = append(m.CodeHash[:0], dAtA[iNdEx:postIndex]...) + if m.CodeHash == nil { + m.CodeHash = []byte{} + } + iNdEx = postIndex + case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NewCodeID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HasError", wireType) } - m.NewCodeID = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5541,11 +10616,44 @@ func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NewCodeID |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasError = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMsg", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorMsg = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5567,7 +10675,7 @@ func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBlockCreateResultsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5590,17 +10698,17 @@ func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAuthorizedAdminUpdateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlockCreateResultsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAuthorizedAdminUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlockCreateResultsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var stringLen uint64 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5610,24 +10718,11 @@ func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5649,7 +10744,7 @@ func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAuthorizedAdminUpdateResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBlockCreateResultsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5672,17 +10767,17 @@ func (m *QueryAuthorizedAdminUpdateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAuthorizedAdminUpdateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlockCreateResultsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAuthorizedAdminUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlockCreateResultsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5692,23 +10787,25 @@ func (m *QueryAuthorizedAdminUpdateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.NewAdmin = string(dAtA[iNdEx:postIndex]) + m.Results = append(m.Results, CreateResultData{}) + if err := m.Results[len(m.Results)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/compute/internal/types/query.pb.gw.go b/x/compute/internal/types/query.pb.gw.go index 77c481b20d..069cb3df9c 100644 --- a/x/compute/internal/types/query.pb.gw.go +++ b/x/compute/internal/types/query.pb.gw.go @@ -682,13 +682,609 @@ func local_request_Query_AuthorizedAdminUpdate_0(ctx context.Context, marshaler } +func request_Query_EcallRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEcallRecordRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := client.EcallRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EcallRecord_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEcallRecordRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := server.EcallRecord(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EcallRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_EcallRecords_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEcallRecordsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EcallRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EcallRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EcallRecords_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEcallRecordsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EcallRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EcallRecords(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_NetworkPubkey_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNetworkPubkeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + val, ok = pathParams["i_seed"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "i_seed") + } + + protoReq.ISeed, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "i_seed", err) + } + + msg, err := client.NetworkPubkey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NetworkPubkey_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNetworkPubkeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + val, ok = pathParams["i_seed"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "i_seed") + } + + protoReq.ISeed, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "i_seed", err) + } + + msg, err := server.NetworkPubkey(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EncryptedSeed_0 = &utilities.DoubleArray{Encoding: map[string]int{"cert_hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_EncryptedSeed_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEncryptedSeedRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["cert_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cert_hash") + } + + protoReq.CertHash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cert_hash", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EncryptedSeed_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EncryptedSeed(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EncryptedSeed_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEncryptedSeedRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["cert_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cert_hash") + } + + protoReq.CertHash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cert_hash", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EncryptedSeed_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EncryptedSeed(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BlockTraces_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockTracesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := client.BlockTraces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BlockTraces_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockTracesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := server.BlockTraces(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_MachineIDProof_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMachineIDProofRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + val, ok = pathParams["machine_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "machine_id") + } + + protoReq.MachineId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "machine_id", err) + } + + msg, err := client.MachineIDProof(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_MachineIDProof_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMachineIDProofRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + val, ok = pathParams["machine_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "machine_id") + } + + protoReq.MachineId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "machine_id", err) + } + + msg, err := server.MachineIDProof(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_AnalyzeCode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_AnalyzeCode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAnalyzeCodeRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AnalyzeCode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AnalyzeCode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AnalyzeCode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAnalyzeCodeRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AnalyzeCode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AnalyzeCode(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BlockCreateResults_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockCreateResultsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := client.BlockCreateResults(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BlockCreateResults_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockCreateResultsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := server.BlockCreateResults(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ContractInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ContractsByCodeId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ContractsByCodeId_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ContractsByCodeId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QuerySecretContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QuerySecretContract_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QuerySecretContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Codes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CodeHashByContractAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_CodeHashByContractAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_CodeHashByContractAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CodeHashByCodeId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -699,7 +1295,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ContractInfo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CodeHashByCodeId_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -707,11 +1303,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CodeHashByCodeId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ContractsByCodeId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LabelByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -722,7 +1318,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ContractsByCodeId_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_LabelByAddress_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -730,11 +1326,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ContractsByCodeId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LabelByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QuerySecretContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AddressByLabel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -745,7 +1341,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QuerySecretContract_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_AddressByLabel_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -753,11 +1349,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QuerySecretContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AddressByLabel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -768,7 +1364,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ContractHistory_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -776,11 +1372,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -791,7 +1387,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Codes_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -799,11 +1395,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_CodeHashByContractAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AuthorizedMigration_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -814,7 +1410,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_CodeHashByContractAddress_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_AuthorizedMigration_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -822,11 +1418,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_CodeHashByContractAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AuthorizedMigration_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_CodeHashByCodeId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AuthorizedAdminUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -837,7 +1433,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_CodeHashByCodeId_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_AuthorizedAdminUpdate_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -845,11 +1441,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_CodeHashByCodeId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AuthorizedAdminUpdate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_LabelByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EcallRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -860,7 +1456,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_LabelByAddress_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EcallRecord_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -868,11 +1464,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_LabelByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EcallRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AddressByLabel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EcallRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -883,7 +1479,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_AddressByLabel_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EcallRecords_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -891,11 +1487,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AddressByLabel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EcallRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_NetworkPubkey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -906,7 +1502,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ContractHistory_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_NetworkPubkey_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -914,11 +1510,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_NetworkPubkey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EncryptedSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -929,7 +1525,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EncryptedSeed_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -937,11 +1533,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EncryptedSeed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AuthorizedMigration_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlockTraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -952,7 +1548,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_AuthorizedMigration_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_BlockTraces_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -960,11 +1556,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AuthorizedMigration_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlockTraces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AuthorizedAdminUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_MachineIDProof_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -975,7 +1571,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_AuthorizedAdminUpdate_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_MachineIDProof_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -983,7 +1579,53 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AuthorizedAdminUpdate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_MachineIDProof_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AnalyzeCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AnalyzeCode_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AnalyzeCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlockCreateResults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BlockCreateResults_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlockCreateResults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1288,6 +1930,166 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_EcallRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EcallRecord_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EcallRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EcallRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EcallRecords_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EcallRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NetworkPubkey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_NetworkPubkey_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NetworkPubkey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EncryptedSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EncryptedSeed_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EncryptedSeed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlockTraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BlockTraces_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlockTraces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_MachineIDProof_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_MachineIDProof_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MachineIDProof_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AnalyzeCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AnalyzeCode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AnalyzeCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlockCreateResults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BlockCreateResults_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlockCreateResults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1317,6 +2119,22 @@ var ( pattern_Query_AuthorizedMigration_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "authorized_migration", "contract_address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_AuthorizedAdminUpdate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "authorized_admin_update", "contract_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EcallRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "ecall", "height"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EcallRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"compute", "v1beta1", "ecalls"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NetworkPubkey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"compute", "v1beta1", "network_pubkey", "height", "i_seed"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EncryptedSeed_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "encrypted_seed", "cert_hash"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BlockTraces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "block_traces", "height"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_MachineIDProof_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"compute", "v1beta1", "machine_id_proof", "height", "machine_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AnalyzeCode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"compute", "v1beta1", "analyze_code"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BlockCreateResults_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "block_create_results", "height"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1345,4 +2163,20 @@ var ( forward_Query_AuthorizedMigration_0 = runtime.ForwardResponseMessage forward_Query_AuthorizedAdminUpdate_0 = runtime.ForwardResponseMessage + + forward_Query_EcallRecord_0 = runtime.ForwardResponseMessage + + forward_Query_EcallRecords_0 = runtime.ForwardResponseMessage + + forward_Query_NetworkPubkey_0 = runtime.ForwardResponseMessage + + forward_Query_EncryptedSeed_0 = runtime.ForwardResponseMessage + + forward_Query_BlockTraces_0 = runtime.ForwardResponseMessage + + forward_Query_MachineIDProof_0 = runtime.ForwardResponseMessage + + forward_Query_AnalyzeCode_0 = runtime.ForwardResponseMessage + + forward_Query_BlockCreateResults_0 = runtime.ForwardResponseMessage ) diff --git a/x/compute/internal/types/types.go b/x/compute/internal/types/types.go index 2a6f0478a6..55851eb4a2 100644 --- a/x/compute/internal/types/types.go +++ b/x/compute/internal/types/types.go @@ -248,6 +248,10 @@ type WasmConfig struct { // It must always be true except the case when we create temporary app to // extract autoCLIOpts from it InitEnclave bool + // StoreSGXData enables storing SGX ecall data (ecall records and execution traces) + // for non-SGX node sync. When enabled, this node will store data that can be + // queried by non-SGX nodes via gRPC. Default: false (opt-in) + StoreSGXData bool } // DefaultWasmConfig returns the default settings for WasmConfig @@ -257,6 +261,7 @@ func DefaultWasmConfig() *WasmConfig { CacheSize: defaultLRUCacheSize, EnclaveCacheSize: defaultEnclaveLRUCacheSize, InitEnclave: true, + StoreSGXData: false, // Opt-in: validators choose to store/serve SGX data } } @@ -310,6 +315,10 @@ func GetConfig(appOpts servertypes.AppOptions) *WasmConfig { config.EnclaveCacheSize = enclaveCacheSize } + // Read store-sgx-data config (defaults to false if not set) + storeSGXData := cast.ToBool(appOpts.Get("wasm.store-sgx-data")) + config.StoreSGXData = storeSGXData + return config } @@ -326,6 +335,13 @@ contract-memory-cache-size = "{{ .WASMConfig.CacheSize }}" # The WASM VM memory cache size in number of cached modules. Can safely go up to 15, but not recommended for validators contract-memory-enclave-cache-size = "{{ .WASMConfig.EnclaveCacheSize }}" + +# Enable storing SGX ecall data for non-SGX node sync. +# When enabled, this node will store ecall records and execution traces +# that can be queried by non-SGX nodes via gRPC (port 9090). +# Validators who enable this should also open gRPC port 9090 in their firewall. +# Default: false (opt-in) +store-sgx-data = {{ .WASMConfig.StoreSGXData }} ` // ZeroSender is a valid 20 byte canonical address that's used to bypass the x/compute checks diff --git a/x/compute/module.go b/x/compute/module.go index 08f73e60be..b27f9c5d1b 100644 --- a/x/compute/module.go +++ b/x/compute/module.go @@ -3,6 +3,7 @@ package compute import ( "context" "encoding/json" + "time" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -162,6 +163,7 @@ func (am AppModule) BeginBlock(c context.Context) error { // Note: as of tendermint v0.38.0 block begin request info is no longer available ctx := c.(sdk.Context) block_header := ctx.BlockHeader() + height := ctx.BlockHeight() header, err := block_header.Marshal() if err != nil { @@ -176,24 +178,69 @@ func (am AppModule) BeginBlock(c context.Context) error { return err } + // Initialize block-scoped execution tracking + recorder := api.GetRecorder() + recorder.StartBlock(height) + // Note: Traces are fetched on-demand in replayExecution when needed, + // since they are created during execution on the SGX node + x2_data := scrt.UnFlatten(ctx.TxBytes()) - tm_data := tm_type.Data{Txs: x2_data} - data, err := tm_data.Marshal() - if err != nil { - ctx.Logger().Error("Failed to marshal tx data") - return err - } + if block_header.EncryptedRandom != nil { - randomAndProof := append(block_header.EncryptedRandom.Random, block_header.EncryptedRandom.Proof...) - random, validator_set_evidence, err := api.SubmitBlockSignatures(header, b_commit, data, randomAndProof) - if err != nil { - ctx.Logger().Error("Failed to submit block signatures") - return err + var random, validator_set_evidence []byte + + if recorder.IsReplayMode() { + // REPLAY MODE: Try to get from local DB first, then fetch from remote SGX node + var found bool + random, validator_set_evidence, found = recorder.ReplaySubmitBlockSignatures(height) + if !found { + // Try to fetch from remote SGX node. + // When non-SGX is in consensus processing the same block as SGX validators, + // the SGX node rejects with "height must be less than current height" until + // it commits the block. Wait and retry indefinitely — the data will eventually + // become available once the SGX node commits. + client := api.GetEcallClient() + const retryInterval = 2 * time.Second + var record *api.EcallRecordData + var err error + for { + record, err = client.FetchEcallRecord(height) + if err == nil { + break + } + ctx.Logger().Info("Waiting for SGX node ecall record, retrying...", "height", height, "error", err) + time.Sleep(retryInterval) + } + random = record.RandomSeed + validator_set_evidence = record.ValidatorSetEvidence + } + // else: found in local DB + } else { + // SGX MODE: Call enclave and record the result + tm_data := tm_type.Data{Txs: x2_data} + data, err := tm_data.Marshal() + if err != nil { + ctx.Logger().Error("Failed to marshal tx data") + return err + } + + randomAndProof := append(block_header.EncryptedRandom.Random, block_header.EncryptedRandom.Proof...) + random, validator_set_evidence, err = api.SubmitBlockSignatures(header, b_commit, data, randomAndProof) + if err != nil { + ctx.Logger().Error("Failed to submit block signatures") + return err + } + + // Record the result for non-SGX nodes + if err := recorder.RecordSubmitBlockSignatures(height, random, validator_set_evidence); err != nil { + ctx.Logger().Error("Failed to record SubmitBlockSignatures", "error", err) + // Don't fail the block for recording errors + } } am.keeper.SetRandomSeed(ctx, random, validator_set_evidence) } else { - ctx.Logger().Debug("Non-encrypted block", "Block_hash", block_header.LastBlockId.Hash, "Height", ctx.BlockHeight(), "Txs", len(x2_data)) + ctx.Logger().Debug("Non-encrypted block", "Block_hash", block_header.LastBlockId.Hash, "Height", height, "Txs", len(x2_data)) } return nil } @@ -220,6 +267,9 @@ func (am AppModule) EndBlock(c context.Context) error { ctx.Logger().Error("Failed to set scheduled txs %+v", err) // return err } + + // Prune old ecall records periodically + api.GetRecorder().PruneOldRecords(ctx.BlockHeight()) return nil }