store the evm call timeout in rosetta object

pull/4377/head
MaxMustermann2 2 years ago committed by Casey Gardiner
parent 2bd16b8df6
commit 77563d6974
  1. 3
      rosetta/rosetta.go
  2. 15
      rosetta/services/construction.go
  3. 2
      rosetta/services/construction_check.go

@ -85,7 +85,8 @@ func getRouter(asserter *asserter.Asserter, hmy *hmy.Harmony, limiterEnable bool
server.NewNetworkAPIController(services.NewNetworkAPI(hmy), asserter), server.NewNetworkAPIController(services.NewNetworkAPI(hmy), asserter),
server.NewConstructionAPIController(services.NewConstructionAPI(hmy), asserter), server.NewConstructionAPIController(services.NewConstructionAPI(hmy), asserter),
server.NewCallAPIController( 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, asserter,
), ),
server.NewEventsAPIController(services.NewEventAPI(hmy), asserter), server.NewEventsAPIController(services.NewEventAPI(hmy), asserter),

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"math/big" "math/big"
"time"
"github.com/coinbase/rosetta-sdk-go/server" "github.com/coinbase/rosetta-sdk-go/server"
"github.com/coinbase/rosetta-sdk-go/types" "github.com/coinbase/rosetta-sdk-go/types"
@ -24,17 +25,19 @@ const (
// ConstructAPI implements the server.ConstructAPIServicer interface. // ConstructAPI implements the server.ConstructAPIServicer interface.
type ConstructAPI struct { type ConstructAPI struct {
hmy *hmy.Harmony hmy *hmy.Harmony
signer hmyTypes.Signer signer hmyTypes.Signer
stakingSigner stakingTypes.Signer stakingSigner stakingTypes.Signer
evmCallTimeout time.Duration
} }
// NewConstructionAPI creates a new instance of a ConstructAPI. // NewConstructionAPI creates a new instance of a ConstructAPI.
func NewConstructionAPI(hmy *hmy.Harmony) server.ConstructionAPIServicer { func NewConstructionAPI(hmy *hmy.Harmony) server.ConstructionAPIServicer {
return &ConstructAPI{ return &ConstructAPI{
hmy: hmy, hmy: hmy,
signer: hmyTypes.NewEIP155Signer(new(big.Int).SetUint64(hmy.ChainID)), signer: hmyTypes.NewEIP155Signer(new(big.Int).SetUint64(hmy.ChainID)),
stakingSigner: stakingTypes.NewEIP155Signer(new(big.Int).SetUint64(hmy.ChainID)), stakingSigner: stakingTypes.NewEIP155Signer(new(big.Int).SetUint64(hmy.ChainID)),
evmCallTimeout: hmy.NodeAPI.GetConfig().NodeConfig.RPCServer.EvmCallTimeout,
} }
} }

@ -270,7 +270,7 @@ func (s *ConstructAPI) ConstructionMetadata(
callArgs.To = &contractAddress callArgs.To = &contractAddress
} }
evmExe, err := rpc.DoEVMCall( 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 { if err != nil {
return nil, common.NewError(common.CatchAllError, map[string]interface{}{ return nil, common.NewError(common.CatchAllError, map[string]interface{}{

Loading…
Cancel
Save