Skip to content

Commit 9282112

Browse files
authored
Merge pull request #622 from CosmWasm/eureka/contract-info-eureka-port
Eureka/contract info eureka port
2 parents 98ce9d0 + 4700ce6 commit 9282112

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

internal/api/lib.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"os"
1111
"path/filepath"
1212
"runtime"
13+
"slices"
1314
"strings"
1415
"syscall"
1516

@@ -162,11 +163,14 @@ func AnalyzeCode(cache Cache, checksum []byte) (*types.AnalysisReport, error) {
162163
}
163164
requiredCapabilities := string(copyAndDestroyUnmanagedVector(report.required_capabilities))
164165
entrypoints := string(copyAndDestroyUnmanagedVector(report.entrypoints))
166+
entrypoints_array := strings.Split(entrypoints, ",")
167+
hasEurekaEntryPoints := slices.Contains(entrypoints_array, "eu_recv_packet")
165168

166169
res := types.AnalysisReport{
167170
HasIBCEntryPoints: bool(report.has_ibc_entry_points),
171+
HasEurekaEntryPoints: hasEurekaEntryPoints,
168172
RequiredCapabilities: requiredCapabilities,
169-
Entrypoints: strings.Split(entrypoints, ","),
173+
Entrypoints: entrypoints_array,
170174
ContractMigrateVersion: optionalU64ToPtr(report.contract_migrate_version),
171175
}
172176
return &res, nil

types/queries.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ type ContractInfoResponse struct {
402402
Pinned bool `json:"pinned"`
403403
// Set if the contract is IBC enabled
404404
IBCPort string `json:"ibc_port,omitempty"`
405+
// Set if the contract is Eureka enabled
406+
EurekaPort string `json:"eureka_port,omitempty"`
405407
}
406408

407409
type CodeInfoQuery struct {

types/queries_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,18 @@ func TestWasmQuerySerialization(t *testing.T) {
143143
}
144144

145145
func TestContractInfoResponseSerialization(t *testing.T) {
146-
document := []byte(`{"code_id":67,"creator":"jane","admin":"king","pinned":true,"ibc_port":"wasm.123"}`)
146+
document := []byte(`{"code_id":67,"creator":"jane","admin":"king","pinned":true,"ibc_port":"wasm.123", "eureka_port":"wasm.123"}`)
147147
var res ContractInfoResponse
148148
err := json.Unmarshal(document, &res)
149149
require.NoError(t, err)
150150

151151
require.Equal(t, ContractInfoResponse{
152-
CodeID: uint64(67),
153-
Creator: "jane",
154-
Admin: "king",
155-
Pinned: true,
156-
IBCPort: "wasm.123",
152+
CodeID: uint64(67),
153+
Creator: "jane",
154+
Admin: "king",
155+
Pinned: true,
156+
IBCPort: "wasm.123",
157+
EurekaPort: "wasm.123",
157158
}, res)
158159
}
159160

types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ func EmptyGasReport(limit uint64) GasReport {
169169
// This type is returned by VM.AnalyzeCode().
170170
type AnalysisReport struct {
171171
HasIBCEntryPoints bool
172+
HasEurekaEntryPoints bool
172173
RequiredCapabilities string
173174
Entrypoints []string
174175
// ContractMigrateVersion is the migrate version of the contract

0 commit comments

Comments
 (0)