Skip to content

Eureka/contract info eureka port #622

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this also needs to be added in cosmwasm-std.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Thanks for pointing this out

}

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 @@ -169,6 +169,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