Merge pull request #10398 from filecoin-project/release/v1.20.1
build:release: v1.20.1
This commit is contained in:
commit
8a510e68e0
@ -1,5 +1,14 @@
|
|||||||
# Lotus changelog
|
# Lotus changelog
|
||||||
|
|
||||||
|
# v1.20.1 / 2023-03-06
|
||||||
|
|
||||||
|
This an optional patch releases for node operators/API service providers that run ETH RPC service.
|
||||||
|
|
||||||
|
## Bug fixes
|
||||||
|
- fix: EthAPI: Correctly get parent hash #10389
|
||||||
|
- fix: EthAPI: Make newEthBlockFromFilecoinTipSet faster and correct #10380
|
||||||
|
- fix: state: short-circuit genesis state computation
|
||||||
|
|
||||||
# 1.20.0 / 2023-02-28
|
# 1.20.0 / 2023-02-28
|
||||||
|
|
||||||
This is a MANDATORY release of Lotus that delivers the [Hygge network upgrade](https://github.com/filecoin-project/community/discussions/74?sort=top#discussioncomment-4313888), introducing Filecoin network version 18. The centerpiece of the upgrade is the introduction of the [Filecoin Virtual Machine (FVM)’s Milestone 2.1](https://fvm.filecoin.io/), which will allow for EVM-compatible contracts to be deployed on the Filecoin network. This upgrade delivers user-programmablity to the Filecoin network for the first time!
|
This is a MANDATORY release of Lotus that delivers the [Hygge network upgrade](https://github.com/filecoin-project/community/discussions/74?sort=top#discussioncomment-4313888), introducing Filecoin network version 18. The centerpiece of the upgrade is the introduction of the [Filecoin Virtual Machine (FVM)’s Milestone 2.1](https://fvm.filecoin.io/), which will allow for EVM-compatible contracts to be deployed on the Filecoin network. This upgrade delivers user-programmablity to the Filecoin network for the first time!
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -37,7 +37,7 @@ func BuildTypeString() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BuildVersion is the local build version
|
// BuildVersion is the local build version
|
||||||
const BuildVersion = "1.20.0"
|
const BuildVersion = "1.20.1"
|
||||||
|
|
||||||
func UserVersion() string {
|
func UserVersion() string {
|
||||||
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
||||||
|
@ -331,6 +331,14 @@ func (t *TipSetExecutor) ExecuteTipSet(ctx context.Context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ts.Height() == 0 {
|
||||||
|
// NB: This is here because the process that executes blocks requires that the
|
||||||
|
// block miner reference a valid miner in the state tree. Unless we create some
|
||||||
|
// magical genesis miner, this won't work properly, so we short circuit here
|
||||||
|
// This avoids the question of 'who gets paid the genesis block reward'
|
||||||
|
return blks[0].ParentStateRoot, blks[0].ParentMessageReceipts, nil
|
||||||
|
}
|
||||||
|
|
||||||
var parentEpoch abi.ChainEpoch
|
var parentEpoch abi.ChainEpoch
|
||||||
pstate := blks[0].ParentStateRoot
|
pstate := blks[0].ParentStateRoot
|
||||||
if blks[0].Height > 0 {
|
if blks[0].Height > 0 {
|
||||||
|
@ -52,14 +52,6 @@ func (sm *StateManager) TipSetState(ctx context.Context, ts *types.TipSet) (st c
|
|||||||
|
|
||||||
sm.stlk.Unlock()
|
sm.stlk.Unlock()
|
||||||
|
|
||||||
if ts.Height() == 0 {
|
|
||||||
// NB: This is here because the process that executes blocks requires that the
|
|
||||||
// block miner reference a valid miner in the state tree. Unless we create some
|
|
||||||
// magical genesis miner, this won't work properly, so we short circuit here
|
|
||||||
// This avoids the question of 'who gets paid the genesis block reward'
|
|
||||||
return ts.Blocks()[0].ParentStateRoot, ts.Blocks()[0].ParentMessageReceipts, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
st, rec, err = sm.tsExec.ExecuteTipSet(ctx, sm, ts, sm.tsExecMonitor, false)
|
st, rec, err = sm.tsExec.ExecuteTipSet(ctx, sm, ts, sm.tsExecMonitor, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, cid.Undef, err
|
return cid.Undef, cid.Undef, err
|
||||||
|
@ -7,7 +7,7 @@ USAGE:
|
|||||||
lotus-miner [global options] command [command options] [arguments...]
|
lotus-miner [global options] command [command options] [arguments...]
|
||||||
|
|
||||||
VERSION:
|
VERSION:
|
||||||
1.20.0
|
1.20.1
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
init Initialize a lotus miner repo
|
init Initialize a lotus miner repo
|
||||||
|
@ -7,7 +7,7 @@ USAGE:
|
|||||||
lotus-worker [global options] command [command options] [arguments...]
|
lotus-worker [global options] command [command options] [arguments...]
|
||||||
|
|
||||||
VERSION:
|
VERSION:
|
||||||
1.20.0
|
1.20.1
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
run Start lotus worker
|
run Start lotus worker
|
||||||
|
@ -7,7 +7,7 @@ USAGE:
|
|||||||
lotus [global options] command [command options] [arguments...]
|
lotus [global options] command [command options] [arguments...]
|
||||||
|
|
||||||
VERSION:
|
VERSION:
|
||||||
1.20.0
|
1.20.1
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
daemon Start a lotus daemon process
|
daemon Start a lotus daemon process
|
||||||
|
@ -87,3 +87,25 @@ func TestFilecoinAddressToEthAddress(t *testing.T) {
|
|||||||
|
|
||||||
require.ErrorContains(t, err, ethtypes.ErrInvalidAddress.Error())
|
require.ErrorContains(t, err, ethtypes.ErrInvalidAddress.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEthGetGenesis(t *testing.T) {
|
||||||
|
blockTime := 100 * time.Millisecond
|
||||||
|
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
|
||||||
|
ens.InterconnectAll().BeginMining(blockTime)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
ethBlk, err := client.EVM().EthGetBlockByNumber(ctx, "0x0", true)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
genesis, err := client.ChainGetGenesis(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
genesisCid, err := genesis.Key().Cid()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
genesisHash, err := ethtypes.EthHashFromCid(genesisCid)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, ethBlk.Hash, genesisHash)
|
||||||
|
}
|
||||||
|
@ -1763,11 +1763,7 @@ func (e *ethSubscription) stop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTxInfo bool, cs *store.ChainStore, sa StateAPI) (ethtypes.EthBlock, error) {
|
func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTxInfo bool, cs *store.ChainStore, sa StateAPI) (ethtypes.EthBlock, error) {
|
||||||
parent, err := cs.LoadTipSet(ctx, ts.Parents())
|
parentKeyCid, err := ts.Parents().Cid()
|
||||||
if err != nil {
|
|
||||||
return ethtypes.EthBlock{}, err
|
|
||||||
}
|
|
||||||
parentKeyCid, err := parent.Key().Cid()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ethtypes.EthBlock{}, err
|
return ethtypes.EthBlock{}, err
|
||||||
}
|
}
|
||||||
@ -1776,6 +1772,8 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx
|
|||||||
return ethtypes.EthBlock{}, err
|
return ethtypes.EthBlock{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bn := ethtypes.EthUint64(ts.Height())
|
||||||
|
|
||||||
blkCid, err := ts.Key().Cid()
|
blkCid, err := ts.Key().Cid()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ethtypes.EthBlock{}, err
|
return ethtypes.EthBlock{}, err
|
||||||
@ -1792,20 +1790,35 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx
|
|||||||
|
|
||||||
block := ethtypes.NewEthBlock(len(msgs) > 0)
|
block := ethtypes.NewEthBlock(len(msgs) > 0)
|
||||||
|
|
||||||
// this seems to be a very expensive way to get gasUsed of the block. may need to find an efficient way to do it
|
|
||||||
gasUsed := int64(0)
|
gasUsed := int64(0)
|
||||||
for txIdx, msg := range msgs {
|
compOutput, err := sa.StateCompute(ctx, ts.Height(), nil, ts.Key())
|
||||||
msgLookup, err := sa.StateSearchMsg(ctx, types.EmptyTSK, msg.Cid(), api.LookbackNoLimit, false)
|
if err != nil {
|
||||||
if err != nil || msgLookup == nil {
|
return ethtypes.EthBlock{}, xerrors.Errorf("failed to compute state: %w", err)
|
||||||
return ethtypes.EthBlock{}, nil
|
}
|
||||||
}
|
|
||||||
gasUsed += msgLookup.Receipt.GasUsed
|
|
||||||
|
|
||||||
tx, err := newEthTxFromMessageLookup(ctx, msgLookup, txIdx, cs, sa)
|
for txIdx, msg := range compOutput.Trace {
|
||||||
if err != nil {
|
// skip system messages like reward application and cron
|
||||||
return ethtypes.EthBlock{}, nil
|
if msg.Msg.From == builtintypes.SystemActorAddr {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gasUsed += msg.MsgRct.GasUsed
|
||||||
|
smsgCid, err := getSignedMessage(ctx, cs, msg.MsgCid)
|
||||||
|
if err != nil {
|
||||||
|
return ethtypes.EthBlock{}, xerrors.Errorf("failed to get signed msg %s: %w", msg.MsgCid, err)
|
||||||
|
}
|
||||||
|
tx, err := newEthTxFromSignedMessage(ctx, smsgCid, sa)
|
||||||
|
if err != nil {
|
||||||
|
return ethtypes.EthBlock{}, xerrors.Errorf("failed to convert msg to ethTx: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ti := ethtypes.EthUint64(txIdx)
|
||||||
|
|
||||||
|
tx.ChainID = ethtypes.EthUint64(build.Eip155ChainId)
|
||||||
|
tx.BlockHash = &blkHash
|
||||||
|
tx.BlockNumber = &bn
|
||||||
|
tx.TransactionIndex = &ti
|
||||||
|
|
||||||
if fullTxInfo {
|
if fullTxInfo {
|
||||||
block.Transactions = append(block.Transactions, tx)
|
block.Transactions = append(block.Transactions, tx)
|
||||||
} else {
|
} else {
|
||||||
@ -1814,7 +1827,7 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx
|
|||||||
}
|
}
|
||||||
|
|
||||||
block.Hash = blkHash
|
block.Hash = blkHash
|
||||||
block.Number = ethtypes.EthUint64(ts.Height())
|
block.Number = bn
|
||||||
block.ParentHash = parentBlkHash
|
block.ParentHash = parentBlkHash
|
||||||
block.Timestamp = ethtypes.EthUint64(ts.Blocks()[0].Timestamp)
|
block.Timestamp = ethtypes.EthUint64(ts.Blocks()[0].Timestamp)
|
||||||
block.BaseFeePerGas = ethtypes.EthBigInt{Int: ts.Blocks()[0].ParentBaseFee.Int}
|
block.BaseFeePerGas = ethtypes.EthBigInt{Int: ts.Blocks()[0].ParentBaseFee.Int}
|
||||||
@ -1995,20 +2008,9 @@ func newEthTxFromMessageLookup(ctx context.Context, msgLookup *api.MsgLookup, tx
|
|||||||
return ethtypes.EthTx{}, err
|
return ethtypes.EthTx{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
smsg, err := cs.GetSignedMessage(ctx, msgLookup.Message)
|
smsg, err := getSignedMessage(ctx, cs, msgLookup.Message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// We couldn't find the signed message, it might be a BLS message, so search for a regular message.
|
return ethtypes.EthTx{}, xerrors.Errorf("failed to get signed msg: %w", err)
|
||||||
msg, err := cs.GetMessage(ctx, msgLookup.Message)
|
|
||||||
if err != nil {
|
|
||||||
return ethtypes.EthTx{}, err
|
|
||||||
}
|
|
||||||
smsg = &types.SignedMessage{
|
|
||||||
Message: *msg,
|
|
||||||
Signature: crypto.Signature{
|
|
||||||
Type: crypto.SigTypeBLS,
|
|
||||||
Data: nil,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tx, err := newEthTxFromSignedMessage(ctx, smsg, sa)
|
tx, err := newEthTxFromSignedMessage(ctx, smsg, sa)
|
||||||
@ -2364,6 +2366,25 @@ func calculateRewardsAndGasUsed(rewardPercentiles []float64, txGasRewards gasRew
|
|||||||
return rewards, totalGasUsed
|
return rewards, totalGasUsed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getSignedMessage(ctx context.Context, cs *store.ChainStore, msgCid cid.Cid) (*types.SignedMessage, error) {
|
||||||
|
smsg, err := cs.GetSignedMessage(ctx, msgCid)
|
||||||
|
if err != nil {
|
||||||
|
// We couldn't find the signed message, it might be a BLS message, so search for a regular message.
|
||||||
|
msg, err := cs.GetMessage(ctx, msgCid)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to find msg %s: %w", msgCid, err)
|
||||||
|
}
|
||||||
|
smsg = &types.SignedMessage{
|
||||||
|
Message: *msg,
|
||||||
|
Signature: crypto.Signature{
|
||||||
|
Type: crypto.SigTypeBLS,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return smsg, nil
|
||||||
|
}
|
||||||
|
|
||||||
type gasRewardTuple struct {
|
type gasRewardTuple struct {
|
||||||
gas uint64
|
gas uint64
|
||||||
reward ethtypes.EthBigInt
|
reward ethtypes.EthBigInt
|
||||||
|
Loading…
Reference in New Issue
Block a user