Skip to content

Commit

Permalink
Merge pull request #6209 from filecoin-project/chore/transport
Browse files Browse the repository at this point in the history
Chore/transport
  • Loading branch information
LinZexiao authored Nov 2, 2023
2 parents bbcd425 + 88ed330 commit f3a5c63
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/submodule/eth/eth_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,10 +711,13 @@ func (a *ethAPI) EthFeeHistory(ctx context.Context, p jsonrpc.RawParams) (types.
}

rewards, totalGasUsed := calculateRewardsAndGasUsed(rewardPercentiles, txGasRewards)
maxGas := constants.BlockGasLimit * int64(len(ts.Blocks()))

// arrays should be reversed at the end
baseFeeArray = append(baseFeeArray, types.EthBigInt(basefee))
gasUsedRatioArray = append(gasUsedRatioArray, float64(totalGasUsed)/float64(constants.BlockGasLimit))
gasUsedRatioArray = append(gasUsedRatioArray, float64(totalGasUsed)/float64(maxGas))

rewardsArray = append(rewardsArray, rewards)
oldestBlkHeight = uint64(ts.Height())
blocksIncluded++
Expand Down
8 changes: 7 additions & 1 deletion app/submodule/eth/eth_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,13 @@ func newEthTxReceipt(ctx context.Context, tx types.EthTx, lookup *types.MsgLooku
return types.EthTxReceipt{}, fmt.Errorf("failed to lookup tipset %s when constructing the eth txn receipt: %w", lookup.TipSet, err)
}

baseFee := ts.Blocks()[0].ParentBaseFee
// The tx is located in the parent tipset
parentTS, err := ca.ChainGetTipSet(ctx, ts.Parents())
if err != nil {
return types.EthTxReceipt{}, fmt.Errorf("failed to lookup tipset %s when constructing the eth txn receipt: %w", ts.Parents(), err)
}

baseFee := parentTS.Blocks()[0].ParentBaseFee
gasOutputs := gas.ComputeGasOutputs(lookup.Receipt.GasUsed, int64(tx.Gas), baseFee, big.Int(tx.MaxFeePerGas), big.Int(tx.MaxPriorityFeePerGas), true)
totalSpent := big.Sum(gasOutputs.BaseFeeBurn, gasOutputs.MinerTip, gasOutputs.OverEstimationBurn)

Expand Down
2 changes: 1 addition & 1 deletion fixtures/networks/integrationtestnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func IntegrationNet() *NetworkConf {
UpgradeHyggeHeight: 2683348,
UpgradeLightningHeight: 2809800,
UpgradeThunderHeight: 2809800 + 2880*21,
UpgradeWatermelonHeight: 999999999999999,
UpgradeWatermelonHeight: 3431940,
UpgradeWatermelonFixHeight: -25, // This fix upgrade only ran on calibrationnet
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 5, 51000: 1},
Expand Down
4 changes: 2 additions & 2 deletions fixtures/networks/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func Mainnet() *NetworkConf {
UpgradeHyggeHeight: 2683348, // 2023-03-14T15:14:00Z
UpgradeLightningHeight: 2809800, // 2023-04-27T13:00:00Z
UpgradeThunderHeight: 2809800 + 2880*21, // 2023-05-18T13:00:00Z
UpgradeWatermelonHeight: 999999999999999,
UpgradeWatermelonFixHeight: -1, // This fix upgrade only ran on calibrationnet
UpgradeWatermelonHeight: 3431940, // 2023-11-29T13:30:00Z
UpgradeWatermelonFixHeight: -1, // This fix upgrade only ran on calibrationnet
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 5, 51000: 1},
AddressNetwork: address.Mainnet,
Expand Down
3 changes: 2 additions & 1 deletion pkg/chainsync/syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,8 @@ func (syncer *Syncer) fetchSegMessage(ctx context.Context, segTipset []*types.Ti
return nil, err
}

for index, tip := range leftChain {
for index := range messages {
tip := leftChain[index]
fts, err := zipTipSetAndMessages(bs, tip, messages[index].Bls, messages[index].Secpk, messages[index].BlsIncludes, messages[index].SecpkIncludes)
if err != nil {
return nil, fmt.Errorf("message processing failed: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ var DefaultForkUpgradeParam = &ForkUpgradeConfig{
UpgradeHyggeHeight: 2683348,
UpgradeLightningHeight: 2809800,
UpgradeThunderHeight: 2809800 + 2880*21,
UpgradeWatermelonHeight: 999999999999999,
UpgradeWatermelonHeight: 3431940,
// This fix upgrade only ran on calibrationnet
UpgradeWatermelonFixHeight: -1,
}
Expand Down

0 comments on commit f3a5c63

Please sign in to comment.