Skip to content

Commit

Permalink
fix warp RPC service
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Sukach committed Jan 13, 2025
1 parent c8e3acb commit 612e009
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,11 @@ func (vm *LandslideVM) Initialize(_ context.Context, req *vmpb.InitializeRequest
}
rpcClients := make(map[ids.NodeID]warp.Client)
for id, nodeURI := range vm.config.AddressBook {
nodeID, err := ids.ToNodeID([]byte(id))
nodeID, err := ids.NodeIDFromString(id)
if err != nil {
return nil, fmt.Errorf("failed to parse node ID: %w", err)
}
rpcClient, err := warp.NewClient(fmt.Sprintf("%s/ext/bc/%s/rpc", nodeURI, string(req.ChainId)))
rpcClient, err := warp.NewClient(fmt.Sprintf("%s/ext/bc/%s/rpc", nodeURI, chainID.String()))
if err != nil {
return nil, fmt.Errorf("failed to create warp client: %w", err)
}
Expand Down
8 changes: 6 additions & 2 deletions vm/warp_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ type ResultGetMessageSignature struct {
Signature []byte `json:"signature"`
}

type ResultGetBlockSignature struct {
Signature []byte `json:"signature"`
}

// API introduces snowman specific functionality to the evm
type API struct {
vm *LandslideVM
Expand Down Expand Up @@ -123,12 +127,12 @@ func (a *API) GetMessageAggregateSignature(ctx context.Context, messageID ids.ID
}

// GetBlockSignature returns the BLS signature associated with a blockID.
func (a *API) GetBlockSignature(ctx context.Context, blockID ids.ID) (tmbytes.HexBytes, error) {
func (a *API) GetBlockSignature(ctx context.Context, blockID ids.ID) (*ResultGetBlockSignature, error) {
signature, err := a.backend.GetBlockSignature(blockID)
if err != nil {
return nil, fmt.Errorf("failed to get signature for block %s with error %w", blockID, err)
}
return signature, nil
return &ResultGetBlockSignature{Signature: signature}, nil
}

// GetBlockAggregateSignature fetches the aggregate signature for the requested [blockID]
Expand Down

0 comments on commit 612e009

Please sign in to comment.