Skip to content

Commit

Permalink
Merge pull request #6296 from filecoin-project/chore/transport
Browse files Browse the repository at this point in the history
chore: update builtin actor
  • Loading branch information
LinZexiao authored Mar 22, 2024
2 parents 7ca52f4 + 9123335 commit 5c500ab
Show file tree
Hide file tree
Showing 19 changed files with 326 additions and 476 deletions.
4 changes: 2 additions & 2 deletions app/submodule/actorevent/actor_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func NewActorEventHandlerWithClock(
}
}

func (a *ActorEventHandler) GetActorEvents(ctx context.Context, evtFilter *types.ActorEventFilter) ([]*types.ActorEvent, error) {
func (a *ActorEventHandler) GetActorEventsRaw(ctx context.Context, evtFilter *types.ActorEventFilter) ([]*types.ActorEvent, error) {
if a.eventFilterManager == nil {
return nil, api.ErrNotSupported
}
Expand Down Expand Up @@ -188,7 +188,7 @@ func parseHeightRange(heaviest abi.ChainEpoch, fromHeight, toHeight *abi.ChainEp
return minHeight, maxHeight, nil
}

func (a *ActorEventHandler) SubscribeActorEvents(ctx context.Context, evtFilter *types.ActorEventFilter) (<-chan *types.ActorEvent, error) {
func (a *ActorEventHandler) SubscribeActorEventsRaw(ctx context.Context, evtFilter *types.ActorEventFilter) (<-chan *types.ActorEvent, error) {
if a.eventFilterManager == nil {
return nil, api.ErrNotSupported
}
Expand Down
14 changes: 7 additions & 7 deletions app/submodule/actorevent/actor_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestParseHeightRange(t *testing.T) {
}
}

func TestGetActorEvents(t *testing.T) {
func TestGetActorEventsRaw(t *testing.T) {
ctx := context.Background()
req := require.New(t)

Expand Down Expand Up @@ -231,7 +231,7 @@ func TestGetActorEvents(t *testing.T) {

handler := NewActorEventHandler(chain, efm, 50*time.Millisecond, maxFilterHeightRange)

gotEvents, err := handler.GetActorEvents(ctx, tc.filter)
gotEvents, err := handler.GetActorEventsRaw(ctx, tc.filter)
if tc.expectErr != "" {
req.Error(err)
req.Contains(err.Error(), tc.expectErr)
Expand All @@ -245,7 +245,7 @@ func TestGetActorEvents(t *testing.T) {
}
}

func TestSubscribeActorEvents(t *testing.T) {
func TestSubscribeActorEventsRaw(t *testing.T) {
const (
seed = 984651320
maxFilterHeightRange = 100
Expand Down Expand Up @@ -300,7 +300,7 @@ func TestSubscribeActorEvents(t *testing.T) {
if tc.endEpoch >= 0 {
aef.ToHeight = epochPtr(tc.endEpoch)
}
eventChan, err := handler.SubscribeActorEvents(ctx, aef)
eventChan, err := handler.SubscribeActorEventsRaw(ctx, aef)
req.NoError(err)

// assume we can cleanly pick up all historical events in one go
Expand Down Expand Up @@ -411,8 +411,8 @@ func TestSubscribeActorEvents(t *testing.T) {
}
}

func TestSubscribeActorEvents_OnlyHistorical(t *testing.T) {
// Similar to TestSubscribeActorEvents but we set an explicit end that caps out at the current height
func TestSubscribeActorEventsRaw_OnlyHistorical(t *testing.T) {
// Similar to TestSubscribeActorEventsRaw but we set an explicit end that caps out at the current height
const (
seed = 984651320
maxFilterHeightRange = 100
Expand Down Expand Up @@ -458,7 +458,7 @@ func TestSubscribeActorEvents_OnlyHistorical(t *testing.T) {
handler := NewActorEventHandlerWithClock(mockChain, mockFilterManager, blockDelay, maxFilterHeightRange, mockClock)

aef := &types.ActorEventFilter{FromHeight: epochPtr(0), ToHeight: epochPtr(currentHeight)}
eventChan, err := handler.SubscribeActorEvents(ctx, aef)
eventChan, err := handler.SubscribeActorEventsRaw(ctx, aef)
req.NoError(err)

var gotEvents []*types.ActorEvent
Expand Down
4 changes: 2 additions & 2 deletions app/submodule/actorevent/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ var ErrActorEventModuleDisabled = errors.New("module disabled, enable with Fevm.

type ActorEventDummy struct{} // nolint

func (a *ActorEventDummy) GetActorEvents(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error) {
func (a *ActorEventDummy) GetActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error) {
return nil, ErrActorEventModuleDisabled
}

func (a *ActorEventDummy) SubscribeActorEvents(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error) {
func (a *ActorEventDummy) SubscribeActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error) {
return nil, ErrActorEventModuleDisabled
}

Expand Down
5 changes: 1 addition & 4 deletions app/submodule/eth/eth_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (a *ethAPI) FilecoinAddressToEthAddress(ctx context.Context, filecoinAddres
return types.EthAddressFromFilecoinAddress(filecoinAddress)
}

func (a *ethAPI) countTipsetMsgs(ctx context.Context, ts *types.TipSet) (int, error) {
func (a *ethAPI) countTipsetMsgs(_ context.Context, ts *types.TipSet) (int, error) {
msgs, err := a.em.chainModule.MessageStore.MessagesForTipset(ts)
if err != nil {
return 0, fmt.Errorf("error loading messages for tipset: %v: %w", ts, err)
Expand Down Expand Up @@ -881,9 +881,6 @@ func (a *ethAPI) EthEstimateGas(ctx context.Context, p jsonrpc.RawParams) (types
}
}
gassedMsg, err := a.mpool.GasEstimateMessageGas(ctx, msg, nil, ts.Key())
if err != nil {
return types.EthUint64(0), fmt.Errorf("failed to estimate gas: %w", err)
}
if err != nil {
// On failure, GasEstimateMessageGas doesn't actually return the invocation result,
// it just returns an error. That means we can't get the revert reason.
Expand Down
8 changes: 4 additions & 4 deletions app/submodule/eth/eth_event_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ func ethLogFromEvent(entries []types.EventEntry) (data []byte, topics []types.Et
)
topics = make([]types.EthHash, 0, 4)
for _, entry := range entries {
// Drop events with non-raw topics to avoid mistakes.
// Drop events with non-raw topics. Built-in actors emit CBOR, and anything else would be
// invalid anyway.
if entry.Codec != cid.Raw {
log.Warnw("did not expect an event entry with a non-raw codec", "codec", entry.Codec, "key", entry.Key)
return nil, nil, false
}
// Check if the key is t1..t4
Expand Down Expand Up @@ -783,7 +783,7 @@ type ethSubscription struct {
sendCond chan struct{}
}

func (e *ethSubscription) addFilter(ctx context.Context, f filter.Filter) {
func (e *ethSubscription) addFilter(_ context.Context, f filter.Filter) {
e.mu.Lock()
defer e.mu.Unlock()

Expand Down Expand Up @@ -821,7 +821,7 @@ func (e *ethSubscription) startOut(ctx context.Context) {
}
}

func (e *ethSubscription) send(ctx context.Context, v interface{}) {
func (e *ethSubscription) send(_ context.Context, v interface{}) {
resp := types.EthSubscriptionResponse{
SubscriptionID: e.id,
Result: v,
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/eth/eth_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func getTipsetByEthBlockNumberOrHash(ctx context.Context, store *chain.Store, bl
return nil, errors.New("invalid block param")
}

func ethCallToFilecoinMessage(ctx context.Context, tx types.EthCall) (*types.Message, error) {
func ethCallToFilecoinMessage(_ context.Context, tx types.EthCall) (*types.Message, error) {
var from address.Address
if tx.From == nil || *tx.From == (types.EthAddress{}) {
var err error
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/eth/txhashmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func waitForMpoolUpdates(ctx context.Context, ch <-chan types.MpoolUpdate, manag
}
}

func ethTxHashGC(ctx context.Context, retentionDays int, manager *ethTxHashManager) {
func ethTxHashGC(_ context.Context, retentionDays int, manager *ethTxHashManager) {
if retentionDays == 0 {
return
}
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,7 +70,7 @@ func Mainnet() *NetworkConf {
UpgradeWatermelonHeight: 3469380, // 2023-12-12T13:30:00Z
UpgradeWatermelonFixHeight: -100, // This fix upgrade only ran on calibrationnet
UpgradeWatermelonFix2Height: -101, // This fix upgrade only ran on calibrationnet
UpgradeDragonHeight: 3792000, // 2024-04-02T14:00:00Z
UpgradeDragonHeight: 3817920, // 2024-04-11T14:00:00Z
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 5, 51000: 1},
AddressNetwork: address.Mainnet,
Expand All @@ -82,7 +82,7 @@ func Mainnet() *NetworkConf {
}

// This epoch, 120 epochs after the "rest" of the nv22 upgrade, is when we switch to Drand quicknet
// 2024-04-02T15:00:00Z
// 2024-04-11T15:00:00Z
nc.Network.ForkUpgradeParam.UpgradePhoenixHeight = nc.Network.ForkUpgradeParam.UpgradeDragonHeight + 120
nc.Network.DrandSchedule[nc.Network.ForkUpgradeParam.UpgradePhoenixHeight] = config.DrandQuicknet

Expand Down
4 changes: 2 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ var DefaultForkUpgradeParam = &ForkUpgradeConfig{
UpgradeWatermelonFixHeight: -1,
// This fix upgrade only ran on calibrationnet
UpgradeWatermelonFix2Height: -2,
UpgradeDragonHeight: 3792000,
UpgradePhoenixHeight: 3792000 + 120,
UpgradeDragonHeight: 3817920,
UpgradePhoenixHeight: 3817920 + 120,
}

func newDefaultNetworkParamsConfig() *NetworkParamsConfig {
Expand Down
Loading

0 comments on commit 5c500ab

Please sign in to comment.