Skip to content

Commit

Permalink
Merge pull request #627 from CosmWasm/feat/ibc_eureka
Browse files Browse the repository at this point in the history
Merge feat/ibc_eureka
  • Loading branch information
chipshort authored Mar 6, 2025
2 parents 190b18b + 9282112 commit 9739022
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion internal/api/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"path/filepath"
"runtime"
"slices"
"strings"
"syscall"

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

res := types.AnalysisReport{
HasIBCEntryPoints: bool(report.has_ibc_entry_points),
HasEurekaEntryPoints: hasEurekaEntryPoints,
RequiredCapabilities: requiredCapabilities,
Entrypoints: strings.Split(entrypoints, ","),
Entrypoints: entrypoints_array,
ContractMigrateVersion: optionalU64ToPtr(report.contract_migrate_version),
}
return &res, nil
Expand Down
2 changes: 2 additions & 0 deletions types/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ type ContractInfoResponse struct {
Pinned bool `json:"pinned"`
// Set if the contract is IBC enabled
IBCPort string `json:"ibc_port,omitempty"`
// Set if the contract is Eureka enabled
EurekaPort string `json:"eureka_port,omitempty"`
}

type CodeInfoQuery struct {
Expand Down
13 changes: 7 additions & 6 deletions types/queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,18 @@ func TestWasmQuerySerialization(t *testing.T) {
}

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

require.Equal(t, ContractInfoResponse{
CodeID: uint64(67),
Creator: "jane",
Admin: "king",
Pinned: true,
IBCPort: "wasm.123",
CodeID: uint64(67),
Creator: "jane",
Admin: "king",
Pinned: true,
IBCPort: "wasm.123",
EurekaPort: "wasm.123",
}, res)
}

Expand Down
1 change: 1 addition & 0 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ func EmptyGasReport(limit uint64) GasReport {
// This type is returned by VM.AnalyzeCode().
type AnalysisReport struct {
HasIBCEntryPoints bool
HasEurekaEntryPoints bool
RequiredCapabilities string
Entrypoints []string
// ContractMigrateVersion is the migrate version of the contract
Expand Down

0 comments on commit 9739022

Please sign in to comment.