Merge branch 'master' into feat/sturdypost
This commit is contained in:
33 files changed
+451
-128
No files matched your search
@@ -3,6 +3,7 @@ package itests
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -272,10 +273,13 @@ func TestEthAccountAbstractionFailsFromEvmActor(t *testing.T) {
|
||||
contract, err := hex.DecodeString(string(contractHex))
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
Data: contract,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
||||
|
||||
@@ -35,7 +35,7 @@ type ethAPIRaw struct {
|
||||
EthBlockNumber func(context.Context) (json.RawMessage, error)
|
||||
EthCall func(context.Context, ethtypes.EthCall, ethtypes.EthBlockNumberOrHash) (json.RawMessage, error)
|
||||
EthChainId func(context.Context) (json.RawMessage, error)
|
||||
EthEstimateGas func(context.Context, ethtypes.EthCall) (json.RawMessage, error)
|
||||
EthEstimateGas func(context.Context, jsonrpc.RawParams) (json.RawMessage, error)
|
||||
EthFeeHistory func(context.Context, ethtypes.EthUint64, string, []float64) (json.RawMessage, error)
|
||||
EthGasPrice func(context.Context) (json.RawMessage, error)
|
||||
EthGetBalance func(context.Context, ethtypes.EthAddress, ethtypes.EthBlockNumberOrHash) (json.RawMessage, error)
|
||||
@@ -182,10 +182,13 @@ func TestEthOpenRPCConformance(t *testing.T) {
|
||||
{
|
||||
method: "eth_estimateGas",
|
||||
call: func(a *ethAPIRaw) (json.RawMessage, error) {
|
||||
return ethapi.EthEstimateGas(context.Background(), ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: &senderEthAddr,
|
||||
Data: contractBin,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
return ethapi.EthEstimateGas(ctx, gasParams)
|
||||
},
|
||||
},
|
||||
|
||||
@@ -448,10 +451,13 @@ func TestEthOpenRPCConformance(t *testing.T) {
|
||||
}
|
||||
|
||||
func createRawSignedEthTx(ctx context.Context, t *testing.T, client *kit.TestFullNode, senderEthAddr ethtypes.EthAddress, receiverEthAddr ethtypes.EthAddress, senderKey *key.Key, contractBin []byte) []byte {
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: &senderEthAddr,
|
||||
Data: contractBin,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
||||
|
||||
@@ -60,10 +60,13 @@ func TestDeployment(t *testing.T) {
|
||||
// verify the deployer address is an Placeholder.
|
||||
client.AssertActorType(ctx, deployer, manifest.PlaceholderKey)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
Data: contract,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
||||
|
||||
@@ -3,6 +3,7 @@ package itests
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -47,10 +48,13 @@ func TestTransactionHashLookup(t *testing.T) {
|
||||
// send some funds to the f410 address
|
||||
kit.SendFunds(ctx, t, client, deployer, types.FromFil(10))
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
Data: contract,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
||||
@@ -350,10 +354,13 @@ func TestEthGetMessageCidByTransactionHashEthTx(t *testing.T) {
|
||||
// send some funds to the f410 address
|
||||
kit.SendFunds(ctx, t, client, deployer, types.FromFil(10))
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
Data: contract,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
||||
|
||||
+167
-43
@@ -3,17 +3,21 @@ package itests
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtin2 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
@@ -44,12 +48,19 @@ func TestValueTransferValidSignature(t *testing.T) {
|
||||
|
||||
kit.SendFunds(ctx, t, client, deployer, types.FromFil(1000))
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
Data: contract,
|
||||
blkParam := ethtypes.NewEthBlockNumberOrHashFromPredefined("latest")
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{
|
||||
Tx: ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
Data: contract,
|
||||
},
|
||||
BlkParam: &blkParam,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -231,11 +242,14 @@ func TestContractInvocation(t *testing.T) {
|
||||
params, err := hex.DecodeString("f8b2cb4f000000000000000000000000ff00000000000000000000000000000000000064")
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
To: &contractAddr,
|
||||
Data: params,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
||||
@@ -350,10 +364,15 @@ func TestGetBlockByNumber(t *testing.T) {
|
||||
}
|
||||
|
||||
func deployContractTx(ctx context.Context, client *kit.TestFullNode, ethAddr ethtypes.EthAddress, contract []byte) (*ethtypes.EthTxArgs, error) {
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
Data: contract,
|
||||
})
|
||||
}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -378,7 +397,54 @@ func deployContractTx(ctx context.Context, client *kit.TestFullNode, ethAddr eth
|
||||
}, nil
|
||||
}
|
||||
|
||||
func TestEthTxFromNativeAccount(t *testing.T) {
|
||||
// Invoke a contract with empty input.
|
||||
func TestEthTxFromNativeAccount_EmptyInput(t *testing.T) {
|
||||
blockTime := 10 * 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()
|
||||
|
||||
secpAddr, err := address.NewSecp256k1Address([]byte("foobar"))
|
||||
require.NoError(t, err)
|
||||
|
||||
msg := &types.Message{
|
||||
From: client.DefaultKey.Address,
|
||||
To: secpAddr,
|
||||
Value: abi.TokenAmount(types.MustParseFIL("100")),
|
||||
Method: builtin2.MethodsEVM.InvokeContract,
|
||||
}
|
||||
|
||||
sMsg, err := client.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
client.WaitMsg(ctx, sMsg.Cid())
|
||||
|
||||
hash, err := client.EthGetTransactionHashByCid(ctx, sMsg.Cid())
|
||||
require.NoError(t, err)
|
||||
tx, err := client.EthGetTransactionByHash(ctx, hash)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Expect empty input params given that we "invoked" the contract (well, invoked ourselves).
|
||||
require.Equal(t, ethtypes.EthBytes{}, tx.Input)
|
||||
|
||||
// Validate the to/from addresses.
|
||||
toId, err := client.StateLookupID(ctx, msg.To, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
fromId, err := client.StateLookupID(ctx, msg.From, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
expectedTo, err := ethtypes.EthAddressFromFilecoinAddress(toId)
|
||||
require.NoError(t, err)
|
||||
expectedFrom, err := ethtypes.EthAddressFromFilecoinAddress(fromId)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &expectedTo, tx.To)
|
||||
require.Equal(t, expectedFrom, tx.From)
|
||||
}
|
||||
|
||||
// Invoke a contract with non-empty input.
|
||||
func TestEthTxFromNativeAccount_NonEmptyInput(t *testing.T) {
|
||||
blockTime := 10 * time.Millisecond
|
||||
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
|
||||
|
||||
@@ -394,49 +460,48 @@ func TestEthTxFromNativeAccount(t *testing.T) {
|
||||
Method: builtin2.MethodsEVM.InvokeContract,
|
||||
}
|
||||
|
||||
// Send a message with no input.
|
||||
var err error
|
||||
input := abi.CborBytes([]byte{0x1, 0x2, 0x3, 0x4})
|
||||
msg.Params, err = actors.SerializeParams(&input)
|
||||
require.NoError(t, err)
|
||||
|
||||
sMsg, err := client.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
client.WaitMsg(ctx, sMsg.Cid())
|
||||
|
||||
hash, err := client.EthGetTransactionHashByCid(ctx, sMsg.Cid())
|
||||
require.NoError(t, err)
|
||||
tx, err := client.EthGetTransactionByHash(ctx, hash)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Expect empty input params given that we "invoked" the contract (well, invoked ourselves).
|
||||
require.Equal(t, ethtypes.EthBytes{}, tx.Input)
|
||||
|
||||
// Send a message with some input.
|
||||
|
||||
input := abi.CborBytes([]byte{0x1, 0x2, 0x3, 0x4})
|
||||
msg.Params, err = actors.SerializeParams(&input)
|
||||
require.NoError(t, err)
|
||||
|
||||
sMsg, err = client.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
client.WaitMsg(ctx, sMsg.Cid())
|
||||
hash, err = client.EthGetTransactionHashByCid(ctx, sMsg.Cid())
|
||||
require.NoError(t, err)
|
||||
tx, err = client.EthGetTransactionByHash(ctx, hash)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Expect the decoded input.
|
||||
require.EqualValues(t, input, tx.Input)
|
||||
}
|
||||
|
||||
// Invoke the contract, but with incorrectly encoded input. We expect this to be abi-encoded
|
||||
// as if it were any other method call.
|
||||
// Invoke a contract, but with incorrectly encoded input. We expect this to be abi-encoded as if it
|
||||
// were any other method call.
|
||||
func TestEthTxFromNativeAccount_BadInput(t *testing.T) {
|
||||
blockTime := 10 * time.Millisecond
|
||||
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
|
||||
|
||||
msg.Params = input
|
||||
require.NoError(t, err)
|
||||
ens.InterconnectAll().BeginMining(blockTime)
|
||||
|
||||
sMsg, err = client.MpoolPushMessage(ctx, msg, nil)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
defer cancel()
|
||||
|
||||
msg := &types.Message{
|
||||
From: client.DefaultKey.Address,
|
||||
To: client.DefaultKey.Address,
|
||||
Value: abi.TokenAmount(types.MustParseFIL("100")),
|
||||
Method: builtin2.MethodsEVM.InvokeContract,
|
||||
Params: []byte{0x1, 0x2, 0x3, 0x4},
|
||||
}
|
||||
|
||||
sMsg, err := client.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
client.WaitMsg(ctx, sMsg.Cid())
|
||||
hash, err = client.EthGetTransactionHashByCid(ctx, sMsg.Cid())
|
||||
hash, err := client.EthGetTransactionHashByCid(ctx, sMsg.Cid())
|
||||
require.NoError(t, err)
|
||||
tx, err = client.EthGetTransactionByHash(ctx, hash)
|
||||
tx, err := client.EthGetTransactionByHash(ctx, hash)
|
||||
require.NoError(t, err)
|
||||
|
||||
const expectedHex1 = "868e10c4" + // "handle filecoin method" function selector
|
||||
@@ -451,24 +516,39 @@ func TestEthTxFromNativeAccount(t *testing.T) {
|
||||
// Input: 1, 2, 3, 4
|
||||
"0102030400000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
input, err = hex.DecodeString(expectedHex1)
|
||||
input, err := hex.DecodeString(expectedHex1)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, input, tx.Input)
|
||||
|
||||
// Invoke a random method with the same input. We expect the same result as above, but with
|
||||
// a different method number.
|
||||
}
|
||||
|
||||
msg.Method++
|
||||
// Invoke a native method.
|
||||
func TestEthTxFromNativeAccount_NativeMethod(t *testing.T) {
|
||||
blockTime := 10 * time.Millisecond
|
||||
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
|
||||
|
||||
sMsg, err = client.MpoolPushMessage(ctx, msg, nil)
|
||||
ens.InterconnectAll().BeginMining(blockTime)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
defer cancel()
|
||||
|
||||
msg := &types.Message{
|
||||
From: client.DefaultKey.Address,
|
||||
To: client.DefaultKey.Address,
|
||||
Value: abi.TokenAmount(types.MustParseFIL("100")),
|
||||
Method: builtin2.MethodsEVM.InvokeContract + 1,
|
||||
Params: []byte{0x1, 0x2, 0x3, 0x4},
|
||||
}
|
||||
|
||||
sMsg, err := client.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
client.WaitMsg(ctx, sMsg.Cid())
|
||||
hash, err = client.EthGetTransactionHashByCid(ctx, sMsg.Cid())
|
||||
hash, err := client.EthGetTransactionHashByCid(ctx, sMsg.Cid())
|
||||
require.NoError(t, err)
|
||||
tx, err = client.EthGetTransactionByHash(ctx, hash)
|
||||
tx, err := client.EthGetTransactionByHash(ctx, hash)
|
||||
require.NoError(t, err)
|
||||
|
||||
const expectedHex2 = "868e10c4" + // "handle filecoin method" function selector
|
||||
const expectedHex = "868e10c4" + // "handle filecoin method" function selector
|
||||
// InvokeEVM+1
|
||||
"00000000000000000000000000000000000000000000000000000000e525aa16" +
|
||||
// CBOR multicodec (0x51)
|
||||
@@ -479,7 +559,51 @@ func TestEthTxFromNativeAccount(t *testing.T) {
|
||||
"0000000000000000000000000000000000000000000000000000000000000004" +
|
||||
// Input: 1, 2, 3, 4
|
||||
"0102030400000000000000000000000000000000000000000000000000000000"
|
||||
input, err = hex.DecodeString(expectedHex2)
|
||||
input, err := hex.DecodeString(expectedHex)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, input, tx.Input)
|
||||
}
|
||||
|
||||
// Send to an invalid receiver. We're checking to make sure we correctly set `txn.To` to the special
|
||||
// "reverted" eth addr.
|
||||
func TestEthTxFromNativeAccount_InvalidReceiver(t *testing.T) {
|
||||
blockTime := 10 * 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()
|
||||
|
||||
to, err := address.NewActorAddress([]byte("foobar"))
|
||||
require.NoError(t, err)
|
||||
|
||||
msg := &types.Message{
|
||||
From: client.DefaultKey.Address,
|
||||
To: to,
|
||||
Value: abi.TokenAmount(types.MustParseFIL("100")),
|
||||
Method: builtin2.MethodsEVM.InvokeContract + 1,
|
||||
Params: []byte{0x1, 0x2, 0x3, 0x4},
|
||||
// We can't estimate gas for a failed message, so we hard-code these values.
|
||||
GasLimit: 10_000_000,
|
||||
GasFeeCap: abi.NewTokenAmount(10000),
|
||||
}
|
||||
|
||||
// We expect the "to" address to be the special "reverted" eth address.
|
||||
expectedTo, err := ethtypes.ParseEthAddress("ff0000000000000000000000ffffffffffffffff")
|
||||
require.NoError(t, err)
|
||||
|
||||
sMsg, err := client.WalletSignMessage(ctx, client.DefaultKey.Address, msg)
|
||||
require.NoError(t, err)
|
||||
k, err := client.MpoolPush(ctx, sMsg)
|
||||
require.NoError(t, err)
|
||||
res, err := client.StateWaitMsg(ctx, k, 3, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res.Receipt.ExitCode, exitcode.SysErrInvalidReceiver)
|
||||
|
||||
hash, err := client.EthGetTransactionHashByCid(ctx, k)
|
||||
require.NoError(t, err)
|
||||
tx, err := client.EthGetTransactionByHash(ctx, hash)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, &expectedTo, tx.To)
|
||||
}
|
||||
+17
-6
@@ -6,6 +6,7 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -657,11 +658,15 @@ func TestFEVMRecursiveActorCallEstimate(t *testing.T) {
|
||||
t.Logf("running with %d recursive calls", r)
|
||||
|
||||
params := makeParams(r)
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: ðAddr,
|
||||
To: &contractAddr,
|
||||
Data: params,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
require.LessOrEqual(t, int64(gaslimit), build.BlockGasLimit)
|
||||
|
||||
@@ -816,11 +821,14 @@ func TestFEVMBareTransferTriggersSmartContractLogic(t *testing.T) {
|
||||
contractEth, err := ethtypes.EthAddressFromFilecoinAddress(contractAddr)
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
From: &accntEth,
|
||||
To: &contractEth,
|
||||
Value: ethtypes.EthBigInt(big.NewInt(100)),
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
gaslimit, err := client.EthEstimateGas(ctx, gasParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
||||
@@ -1034,10 +1042,13 @@ func TestFEVMErrorParsing(t *testing.T) {
|
||||
require.ErrorContains(t, err, expected)
|
||||
})
|
||||
t.Run("EthEstimateGas", func(t *testing.T) {
|
||||
_, err := e.EthEstimateGas(ctx, ethtypes.EthCall{
|
||||
gasParams, err := json.Marshal(ethtypes.EthEstimateGasParams{Tx: ethtypes.EthCall{
|
||||
To: &contractAddrEth,
|
||||
Data: entryPoint,
|
||||
})
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = e.EthEstimateGas(ctx, gasParams)
|
||||
require.ErrorContains(t, err, expected)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -223,3 +223,29 @@ func TestPledgeSynth(t *testing.T) {
|
||||
runTest(t, 3)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSectorsSummary(t *testing.T) {
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
blockTime := 50 * time.Millisecond
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
nPreseal := 2
|
||||
|
||||
_, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.PresealSectors(nPreseal))
|
||||
ens.InterconnectAll().BeginMining(blockTime)
|
||||
|
||||
miner.PledgeSectors(ctx, 1, 0, nil)
|
||||
|
||||
ms, err := miner.SectorsSummary(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Len(t, ms, 1) // all proving
|
||||
|
||||
for st, n := range ms {
|
||||
require.Equal(t, api.SectorState(sealing.Proving), st)
|
||||
require.Equal(t, 1+nPreseal, n)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user