Skip to content

Commit

Permalink
store the evm call timeout in rosetta object
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxMustermann2 authored and ONECasey committed Feb 27, 2023
1 parent 832d09d commit afdbd44
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion rosetta/rosetta.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ func getRouter(asserter *asserter.Asserter, hmy *hmy.Harmony, limiterEnable bool
server.NewNetworkAPIController(services.NewNetworkAPI(hmy), asserter),
server.NewConstructionAPIController(services.NewConstructionAPI(hmy), asserter),
server.NewCallAPIController(
services.NewCallAPIService(hmy, limiterEnable, rateLimit, hmy.NodeAPI.GetConfig().NodeConfig.RPCServer.EvmCallTimeout),
services.NewCallAPIService(hmy, limiterEnable, rateLimit,
hmy.NodeAPI.GetConfig().NodeConfig.RPCServer.EvmCallTimeout),
asserter,
),
server.NewEventsAPIController(services.NewEventAPI(hmy), asserter),
Expand Down
15 changes: 9 additions & 6 deletions rosetta/services/construction.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"math/big"
"time"

"github.com/coinbase/rosetta-sdk-go/server"
"github.com/coinbase/rosetta-sdk-go/types"
Expand All @@ -24,17 +25,19 @@ const (

// ConstructAPI implements the server.ConstructAPIServicer interface.
type ConstructAPI struct {
hmy *hmy.Harmony
signer hmyTypes.Signer
stakingSigner stakingTypes.Signer
hmy *hmy.Harmony
signer hmyTypes.Signer
stakingSigner stakingTypes.Signer
evmCallTimeout time.Duration
}

// NewConstructionAPI creates a new instance of a ConstructAPI.
func NewConstructionAPI(hmy *hmy.Harmony) server.ConstructionAPIServicer {
return &ConstructAPI{
hmy: hmy,
signer: hmyTypes.NewEIP155Signer(new(big.Int).SetUint64(hmy.ChainID)),
stakingSigner: stakingTypes.NewEIP155Signer(new(big.Int).SetUint64(hmy.ChainID)),
hmy: hmy,
signer: hmyTypes.NewEIP155Signer(new(big.Int).SetUint64(hmy.ChainID)),
stakingSigner: stakingTypes.NewEIP155Signer(new(big.Int).SetUint64(hmy.ChainID)),
evmCallTimeout: hmy.NodeAPI.GetConfig().NodeConfig.RPCServer.EvmCallTimeout,
}
}

Expand Down
2 changes: 1 addition & 1 deletion rosetta/services/construction_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (s *ConstructAPI) ConstructionMetadata(
callArgs.To = &contractAddress
}
evmExe, err := rpc.DoEVMCall(
ctx, s.hmy, callArgs, latest, s.hmy.NodeAPI.GetConfig().NodeConfig.RPCServer.EvmCallTimeout,
ctx, s.hmy, callArgs, latest, s.evmCallTimeout,
)
if err != nil {
return nil, common.NewError(common.CatchAllError, map[string]interface{}{
Expand Down

0 comments on commit afdbd44

Please sign in to comment.