From 6bc56c549a16b470f2019c743393fdf818cd2e47 Mon Sep 17 00:00:00 2001
From: whyrusleeping <why@ipfs.io>
Date: Tue, 20 Oct 2020 10:04:51 -0700
Subject: [PATCH 1/2] add some methods that oni needs

---
 cmd/lotus-gateway/api.go | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/cmd/lotus-gateway/api.go b/cmd/lotus-gateway/api.go
index 105f8881e..a0febef2c 100644
--- a/cmd/lotus-gateway/api.go
+++ b/cmd/lotus-gateway/api.go
@@ -10,6 +10,7 @@ import (
 	"github.com/filecoin-project/go-state-types/abi"
 	"github.com/filecoin-project/go-state-types/crypto"
 	"github.com/filecoin-project/go-state-types/dline"
+	"github.com/filecoin-project/go-state-types/network"
 	"github.com/filecoin-project/lotus/api"
 	"github.com/filecoin-project/lotus/build"
 	"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
@@ -33,6 +34,8 @@ var (
 // gatewayDepsAPI defines the API methods that the GatewayAPI depends on
 // (to make it easy to mock for tests)
 type gatewayDepsAPI interface {
+	Version(context.Context) (api.Version, error)
+
 	ChainHasObj(context.Context, cid.Cid) (bool, error)
 	ChainHead(ctx context.Context) (*types.TipSet, error)
 	ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
@@ -57,6 +60,7 @@ type gatewayDepsAPI interface {
 	StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
 	StateCirculatingSupply(context.Context, types.TipSetKey) (abi.TokenAmount, error)
 	StateVMCirculatingSupplyInternal(context.Context, types.TipSetKey) (api.CirculatingSupply, error)
+	StateNetworkVersion(context.Context, types.TipSetKey) (network.Version, error)
 }
 
 type GatewayAPI struct {
@@ -114,6 +118,10 @@ func (a *GatewayAPI) checkTimestamp(at time.Time) error {
 	return nil
 }
 
+func (a *GatewayAPI) Version(ctx context.Context) (api.Version, error) {
+	return a.api.Version(ctx)
+}
+
 func (a *GatewayAPI) ChainHasObj(ctx context.Context, c cid.Cid) (bool, error) {
 	return a.api.ChainHasObj(ctx, c)
 }
@@ -295,6 +303,13 @@ func (a *GatewayAPI) StateVMCirculatingSupplyInternal(ctx context.Context, tsk t
 	return a.api.StateVMCirculatingSupplyInternal(ctx, tsk)
 }
 
+func (a *GatewayAPI) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
+	if err := a.checkTipsetKey(ctx, tsk); err != nil {
+		return 0, err
+	}
+	return a.api.StateNetworkVersion(ctx, tsk)
+}
+
 func (a *GatewayAPI) WalletVerify(ctx context.Context, k address.Address, msg []byte, sig *crypto.Signature) (bool, error) {
 	return sigs.Verify(sig, k, msg) == nil, nil
 }

From abc3e783ffc3cdf04dc9c2b4748930829e31e898 Mon Sep 17 00:00:00 2001
From: whyrusleeping <why@ipfs.io>
Date: Tue, 20 Oct 2020 10:09:21 -0700
Subject: [PATCH 2/2] bump lookback cap to 24 hours

---
 cmd/lotus-gateway/api.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/lotus-gateway/api.go b/cmd/lotus-gateway/api.go
index a0febef2c..7fc004327 100644
--- a/cmd/lotus-gateway/api.go
+++ b/cmd/lotus-gateway/api.go
@@ -23,7 +23,7 @@ import (
 )
 
 const (
-	LookbackCap            = time.Hour * 12
+	LookbackCap            = time.Hour * 24
 	stateWaitLookbackLimit = abi.ChainEpoch(20)
 )