Skip to content

Commit

Permalink
Add namespace to contract API database queries
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
  • Loading branch information
awrichar committed Jun 22, 2022
1 parent d598dee commit adc2e48
Show file tree
Hide file tree
Showing 29 changed files with 150 additions and 143 deletions.
2 changes: 1 addition & 1 deletion internal/apiserver/route_get_contract_api_by_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var getContractAPIByName = &ffapi.Route{
JSONOutputCodes: []int{http.StatusOK},
Extensions: &coreExtensions{
CoreJSONHandler: func(r *ffapi.APIRequest, cr *coreRequest) (output interface{}, err error) {
return cr.or.Contracts().GetContractAPI(cr.ctx, cr.apiBaseURL, extractNamespace(r.PP), r.PP["apiName"])
return cr.or.Contracts().GetContractAPI(cr.ctx, cr.apiBaseURL, r.PP["apiName"])
},
},
}
2 changes: 1 addition & 1 deletion internal/apiserver/route_get_contract_api_by_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestGetContractAPIByName(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "ns1", "banana").
mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "banana").
Return(&core.ContractAPI{}, nil)
r.ServeHTTP(res, req)

Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/route_get_contract_api_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var getContractAPIInterface = &ffapi.Route{
JSONOutputCodes: []int{http.StatusOK},
Extensions: &coreExtensions{
CoreJSONHandler: func(r *ffapi.APIRequest, cr *coreRequest) (output interface{}, err error) {
return cr.or.Contracts().GetContractAPIInterface(cr.ctx, extractNamespace(r.PP), r.PP["apiName"])
return cr.or.Contracts().GetContractAPIInterface(cr.ctx, r.PP["apiName"])
},
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestGetContractAPIInterface(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("GetContractAPIInterface", mock.Anything, "ns1", "banana").
mcm.On("GetContractAPIInterface", mock.Anything, "banana").
Return(&core.FFI{}, nil)
r.ServeHTTP(res, req)

Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/route_get_contract_apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var getContractAPIs = &ffapi.Route{
Extensions: &coreExtensions{
FilterFactory: database.ContractAPIQueryFactory,
CoreJSONHandler: func(r *ffapi.APIRequest, cr *coreRequest) (output interface{}, err error) {
return filterResult(cr.or.Contracts().GetContractAPIs(cr.ctx, cr.apiBaseURL, extractNamespace(r.PP), cr.filter))
return filterResult(cr.or.Contracts().GetContractAPIs(cr.ctx, cr.apiBaseURL, cr.filter))
},
},
}
2 changes: 1 addition & 1 deletion internal/apiserver/route_get_contract_apis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestGetContractAPIs(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("GetContractAPIs", mock.Anything, "http://127.0.0.1:5000/api/v1", "ns1", mock.Anything).
mcm.On("GetContractAPIs", mock.Anything, "http://127.0.0.1:5000/api/v1", mock.Anything).
Return([]*core.ContractAPI{}, nil, nil)
r.ServeHTTP(res, req)

Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_contract_api_invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var postContractAPIInvoke = &ffapi.Route{
r.SuccessStatus = syncRetcode(waitConfirm)
req := r.Input.(*core.ContractCallRequest)
req.Type = core.CallTypeInvoke
return cr.or.Contracts().InvokeContractAPI(cr.ctx, extractNamespace(r.PP), r.PP["apiName"], r.PP["methodPath"], req, waitConfirm)
return cr.or.Contracts().InvokeContractAPI(cr.ctx, r.PP["apiName"], r.PP["methodPath"], req, waitConfirm)
},
},
}
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_contract_api_invoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestPostContractAPIInvoke(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("InvokeContractAPI", mock.Anything, "ns1", "banana", "peel", mock.MatchedBy(func(req *core.ContractCallRequest) bool {
mcm.On("InvokeContractAPI", mock.Anything, "banana", "peel", mock.MatchedBy(func(req *core.ContractCallRequest) bool {
return req.Type == core.CallTypeInvoke
}), false).Return("banana", nil)
r.ServeHTTP(res, req)
Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_contract_api_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var postContractAPIQuery = &ffapi.Route{
CoreJSONHandler: func(r *ffapi.APIRequest, cr *coreRequest) (output interface{}, err error) {
req := r.Input.(*core.ContractCallRequest)
req.Type = core.CallTypeQuery
return cr.or.Contracts().InvokeContractAPI(cr.ctx, extractNamespace(r.PP), r.PP["apiName"], r.PP["methodPath"], req, true)
return cr.or.Contracts().InvokeContractAPI(cr.ctx, r.PP["apiName"], r.PP["methodPath"], req, true)
},
},
}
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_contract_api_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestPostContractAPIQuery(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("InvokeContractAPI", mock.Anything, "ns1", "banana", "peel", mock.MatchedBy(func(req *core.ContractCallRequest) bool {
mcm.On("InvokeContractAPI", mock.Anything, "banana", "peel", mock.MatchedBy(func(req *core.ContractCallRequest) bool {
return req.Type == core.CallTypeQuery
}), true).Return("banana", nil)
r.ServeHTTP(res, req)
Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_contract_invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var postContractInvoke = &ffapi.Route{
r.SuccessStatus = syncRetcode(waitConfirm)
req := r.Input.(*core.ContractCallRequest)
req.Type = core.CallTypeInvoke
return cr.or.Contracts().InvokeContract(cr.ctx, extractNamespace(r.PP), req, waitConfirm)
return cr.or.Contracts().InvokeContract(cr.ctx, req, waitConfirm)
},
},
}
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_contract_invoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestPostContractInvoke(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("InvokeContract", mock.Anything, "ns1", mock.MatchedBy(func(req *core.ContractCallRequest) bool {
mcm.On("InvokeContract", mock.Anything, mock.MatchedBy(func(req *core.ContractCallRequest) bool {
return req.Type == core.CallTypeInvoke
}), false).Return("banana", nil)
r.ServeHTTP(res, req)
Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_contract_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var postContractQuery = &ffapi.Route{
CoreJSONHandler: func(r *ffapi.APIRequest, cr *coreRequest) (output interface{}, err error) {
req := r.Input.(*core.ContractCallRequest)
req.Type = core.CallTypeQuery
return cr.or.Contracts().InvokeContract(cr.ctx, extractNamespace(r.PP), req, true)
return cr.or.Contracts().InvokeContract(cr.ctx, req, true)
},
},
}
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_contract_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestPostContractQuery(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("InvokeContract", mock.Anything, "ns1", mock.MatchedBy(func(req *core.ContractCallRequest) bool {
mcm.On("InvokeContract", mock.Anything, mock.MatchedBy(func(req *core.ContractCallRequest) bool {
return req.Type == core.CallTypeQuery
}), true).Return("banana", nil)
r.ServeHTTP(res, req)
Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/route_post_new_contract_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var postNewContractAPI = &ffapi.Route{
CoreJSONHandler: func(r *ffapi.APIRequest, cr *coreRequest) (output interface{}, err error) {
waitConfirm := strings.EqualFold(r.QP["confirm"], "true")
r.SuccessStatus = syncRetcode(waitConfirm)
return cr.or.Contracts().BroadcastContractAPI(cr.ctx, cr.apiBaseURL, extractNamespace(r.PP), r.Input.(*core.ContractAPI), waitConfirm)
return cr.or.Contracts().BroadcastContractAPI(cr.ctx, cr.apiBaseURL, r.Input.(*core.ContractAPI), waitConfirm)
},
},
}
4 changes: 2 additions & 2 deletions internal/apiserver/route_post_new_contract_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestPostNewContractAPI(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("BroadcastContractAPI", mock.Anything, mock.Anything, "ns1", mock.AnythingOfType("*core.ContractAPI"), false).
mcm.On("BroadcastContractAPI", mock.Anything, mock.Anything, mock.AnythingOfType("*core.ContractAPI"), false).
Return(&core.ContractAPI{}, nil)
r.ServeHTTP(res, req)

Expand All @@ -57,7 +57,7 @@ func TestPostNewContractAPISync(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("BroadcastContractAPI", mock.Anything, mock.Anything, "ns1", mock.AnythingOfType("*core.ContractAPI"), true).
mcm.On("BroadcastContractAPI", mock.Anything, mock.Anything, mock.AnythingOfType("*core.ContractAPI"), true).
Return(&core.ContractAPI{}, nil)
r.ServeHTTP(res, req)

Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/route_put_contract_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var putContractAPI = &ffapi.Route{
api.ID, err = fftypes.ParseUUID(cr.ctx, r.PP["id"])
var res interface{}
if err == nil {
res, err = cr.or.Contracts().BroadcastContractAPI(cr.ctx, cr.apiBaseURL, extractNamespace(r.PP), api, waitConfirm)
res, err = cr.or.Contracts().BroadcastContractAPI(cr.ctx, cr.apiBaseURL, api, waitConfirm)
}
return res, err
},
Expand Down
4 changes: 2 additions & 2 deletions internal/apiserver/route_put_contract_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestPutContractAPI(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("BroadcastContractAPI", mock.Anything, mock.Anything, "ns1", mock.AnythingOfType("*core.ContractAPI"), false).
mcm.On("BroadcastContractAPI", mock.Anything, mock.Anything, mock.AnythingOfType("*core.ContractAPI"), false).
Return(&core.ContractAPI{}, nil)
r.ServeHTTP(res, req)

Expand All @@ -57,7 +57,7 @@ func TestPutContractAPISync(t *testing.T) {
req.Header.Set("Content-Type", "application/json; charset=utf-8")
res := httptest.NewRecorder()

mcm.On("BroadcastContractAPI", mock.Anything, mock.Anything, "ns1", mock.AnythingOfType("*core.ContractAPI"), true).
mcm.On("BroadcastContractAPI", mock.Anything, mock.Anything, mock.AnythingOfType("*core.ContractAPI"), true).
Return(&core.ContractAPI{}, nil)
r.ServeHTTP(res, req)

Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (as *apiServer) contractSwaggerGenerator(mgr namespace.Manager, apiBaseURL
return func(req *http.Request) (*openapi3.T, error) {
vars := mux.Vars(req)
cm := mgr.Orchestrator(vars["ns"]).Contracts()
api, err := cm.GetContractAPI(req.Context(), apiBaseURL, vars["ns"], vars["apiName"])
api, err := cm.GetContractAPI(req.Context(), apiBaseURL, vars["apiName"])
if err != nil {
return nil, err
} else if api == nil || api.Interface == nil {
Expand Down
8 changes: 4 additions & 4 deletions internal/apiserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func TestContractAPISwaggerJSON(t *testing.T) {
},
}

mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "default", "my-api").Return(api, nil)
mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "my-api").Return(api, nil)
mcm.On("GetFFIByIDWithChildren", mock.Anything, api.Interface.ID).Return(ffi, nil)
mffi.On("Generate", mock.Anything, "http://127.0.0.1:5000/api/v1/namespaces/default/apis/my-api", api, ffi).Return(&openapi3.T{})

Expand All @@ -278,7 +278,7 @@ func TestContractAPISwaggerJSONGetAPIFail(t *testing.T) {
s := httptest.NewServer(r)
defer s.Close()

mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "default", "my-api").Return(nil, fmt.Errorf("pop"))
mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "my-api").Return(nil, fmt.Errorf("pop"))

res, err := http.Get(fmt.Sprintf("http://%s/api/v1/namespaces/default/apis/my-api/api/swagger.json", s.Listener.Addr()))
assert.NoError(t, err)
Expand All @@ -293,7 +293,7 @@ func TestContractAPISwaggerJSONGetAPINotFound(t *testing.T) {
s := httptest.NewServer(r)
defer s.Close()

mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "default", "my-api").Return(nil, nil)
mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "my-api").Return(nil, nil)

res, err := http.Get(fmt.Sprintf("http://%s/api/v1/namespaces/default/apis/my-api/api/swagger.json", s.Listener.Addr()))
assert.NoError(t, err)
Expand All @@ -314,7 +314,7 @@ func TestContractAPISwaggerJSONGetFFIFail(t *testing.T) {
},
}

mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "default", "my-api").Return(api, nil)
mcm.On("GetContractAPI", mock.Anything, "http://127.0.0.1:5000/api/v1", "my-api").Return(api, nil)
mcm.On("GetFFIByIDWithChildren", mock.Anything, api.Interface.ID).Return(nil, fmt.Errorf("pop"))

res, err := http.Get(fmt.Sprintf("http://%s/api/v1/namespaces/default/apis/my-api/api/swagger.json", s.Listener.Addr()))
Expand Down
45 changes: 22 additions & 23 deletions internal/contracts/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ type Manager interface {
GetFFIByIDWithChildren(ctx context.Context, id *fftypes.UUID) (*core.FFI, error)
GetFFIs(ctx context.Context, filter database.AndFilter) ([]*core.FFI, *database.FilterResult, error)

InvokeContract(ctx context.Context, ns string, req *core.ContractCallRequest, waitConfirm bool) (interface{}, error)
InvokeContractAPI(ctx context.Context, ns, apiName, methodPath string, req *core.ContractCallRequest, waitConfirm bool) (interface{}, error)
GetContractAPI(ctx context.Context, httpServerURL, ns, apiName string) (*core.ContractAPI, error)
GetContractAPIInterface(ctx context.Context, ns, apiName string) (*core.FFI, error)
GetContractAPIs(ctx context.Context, httpServerURL, ns string, filter database.AndFilter) ([]*core.ContractAPI, *database.FilterResult, error)
BroadcastContractAPI(ctx context.Context, httpServerURL, ns string, api *core.ContractAPI, waitConfirm bool) (output *core.ContractAPI, err error)
InvokeContract(ctx context.Context, req *core.ContractCallRequest, waitConfirm bool) (interface{}, error)
InvokeContractAPI(ctx context.Context, apiName, methodPath string, req *core.ContractCallRequest, waitConfirm bool) (interface{}, error)
GetContractAPI(ctx context.Context, httpServerURL, apiName string) (*core.ContractAPI, error)
GetContractAPIInterface(ctx context.Context, apiName string) (*core.FFI, error)
GetContractAPIs(ctx context.Context, httpServerURL string, filter database.AndFilter) ([]*core.ContractAPI, *database.FilterResult, error)
BroadcastContractAPI(ctx context.Context, httpServerURL string, api *core.ContractAPI, waitConfirm bool) (output *core.ContractAPI, err error)

ValidateFFIAndSetPathnames(ctx context.Context, ffi *core.FFI) error

Expand Down Expand Up @@ -218,15 +218,15 @@ func (cm *contractManager) writeInvokeTransaction(ctx context.Context, req *core
return op, err
}

func (cm *contractManager) InvokeContract(ctx context.Context, ns string, req *core.ContractCallRequest, waitConfirm bool) (res interface{}, err error) {
func (cm *contractManager) InvokeContract(ctx context.Context, req *core.ContractCallRequest, waitConfirm bool) (res interface{}, err error) {
req.Key, err = cm.identity.NormalizeSigningKey(ctx, req.Key, identity.KeyNormalizationBlockchainPlugin)
if err != nil {
return nil, err
}

var op *core.Operation
err = cm.database.RunAsGroup(ctx, func(ctx context.Context) (err error) {
if err = cm.resolveInvokeContractRequest(ctx, ns, req); err != nil {
if err = cm.resolveInvokeContractRequest(ctx, req); err != nil {
return err
}
if err := cm.validateInvokeContractRequest(ctx, req); err != nil {
Expand Down Expand Up @@ -262,8 +262,8 @@ func (cm *contractManager) InvokeContract(ctx context.Context, ns string, req *c
}
}

func (cm *contractManager) InvokeContractAPI(ctx context.Context, ns, apiName, methodPath string, req *core.ContractCallRequest, waitConfirm bool) (interface{}, error) {
api, err := cm.database.GetContractAPIByName(ctx, ns, apiName)
func (cm *contractManager) InvokeContractAPI(ctx context.Context, apiName, methodPath string, req *core.ContractCallRequest, waitConfirm bool) (interface{}, error) {
api, err := cm.database.GetContractAPIByName(ctx, cm.namespace, apiName)
if err != nil {
return nil, err
} else if api == nil || api.Interface == nil {
Expand All @@ -274,15 +274,15 @@ func (cm *contractManager) InvokeContractAPI(ctx context.Context, ns, apiName, m
if api.Location != nil {
req.Location = api.Location
}
return cm.InvokeContract(ctx, ns, req, waitConfirm)
return cm.InvokeContract(ctx, req, waitConfirm)
}

func (cm *contractManager) resolveInvokeContractRequest(ctx context.Context, ns string, req *core.ContractCallRequest) (err error) {
func (cm *contractManager) resolveInvokeContractRequest(ctx context.Context, req *core.ContractCallRequest) (err error) {
if req.Method == nil {
if req.MethodPath == "" || req.Interface == nil {
return i18n.NewError(ctx, coremsgs.MsgContractMethodNotSet)
}
req.Method, err = cm.database.GetFFIMethod(ctx, ns, req.Interface, req.MethodPath)
req.Method, err = cm.database.GetFFIMethod(ctx, cm.namespace, req.Interface, req.MethodPath)
if err != nil || req.Method == nil {
return i18n.NewError(ctx, coremsgs.MsgContractMethodResolveError, err)
}
Expand All @@ -299,23 +299,22 @@ func (cm *contractManager) addContractURLs(httpServerURL string, api *core.Contr
}
}

func (cm *contractManager) GetContractAPI(ctx context.Context, httpServerURL, ns, apiName string) (*core.ContractAPI, error) {
api, err := cm.database.GetContractAPIByName(ctx, ns, apiName)
func (cm *contractManager) GetContractAPI(ctx context.Context, httpServerURL, apiName string) (*core.ContractAPI, error) {
api, err := cm.database.GetContractAPIByName(ctx, cm.namespace, apiName)
cm.addContractURLs(httpServerURL, api)
return api, err
}

func (cm *contractManager) GetContractAPIInterface(ctx context.Context, ns, apiName string) (*core.FFI, error) {
api, err := cm.GetContractAPI(ctx, "", ns, apiName)
func (cm *contractManager) GetContractAPIInterface(ctx context.Context, apiName string) (*core.FFI, error) {
api, err := cm.GetContractAPI(ctx, "", apiName)
if err != nil || api == nil {
return nil, err
}
return cm.GetFFIByIDWithChildren(ctx, api.Interface.ID)
}

func (cm *contractManager) GetContractAPIs(ctx context.Context, httpServerURL, ns string, filter database.AndFilter) ([]*core.ContractAPI, *database.FilterResult, error) {
filter = cm.scopeNS(ns, filter)
apis, fr, err := cm.database.GetContractAPIs(ctx, ns, filter)
func (cm *contractManager) GetContractAPIs(ctx context.Context, httpServerURL string, filter database.AndFilter) ([]*core.ContractAPI, *database.FilterResult, error) {
apis, fr, err := cm.database.GetContractAPIs(ctx, cm.namespace, filter)
for _, api := range apis {
cm.addContractURLs(httpServerURL, api)
}
Expand Down Expand Up @@ -351,9 +350,9 @@ func (cm *contractManager) resolveFFIReference(ctx context.Context, ref *core.FF
}
}

func (cm *contractManager) BroadcastContractAPI(ctx context.Context, httpServerURL, ns string, api *core.ContractAPI, waitConfirm bool) (output *core.ContractAPI, err error) {
func (cm *contractManager) BroadcastContractAPI(ctx context.Context, httpServerURL string, api *core.ContractAPI, waitConfirm bool) (output *core.ContractAPI, err error) {
api.ID = fftypes.NewUUID()
api.Namespace = ns
api.Namespace = cm.namespace

if api.Location != nil {
if api.Location, err = cm.blockchain.NormalizeContractLocation(ctx, api.Location); err != nil {
Expand All @@ -378,7 +377,7 @@ func (cm *contractManager) BroadcastContractAPI(ctx context.Context, httpServerU
return nil, err
}

msg, err := cm.broadcast.BroadcastDefinitionAsNode(ctx, ns, api, core.SystemTagDefineContractAPI, waitConfirm)
msg, err := cm.broadcast.BroadcastDefinitionAsNode(ctx, cm.namespace, api, core.SystemTagDefineContractAPI, waitConfirm)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit adc2e48

Please sign in to comment.