Merge pull request #10223 from filecoin-project/feat/ethtx-fixes

fix: ethrpc: Add missing fields to EthTx
This commit is contained in:
Jiaying Wang 2023-02-09 13:13:26 -05:00 committed by GitHub
commit 1c13a591e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 13 deletions

Binary file not shown.

Binary file not shown.

View File

@ -37,7 +37,8 @@ type EthTx struct {
Gas EthUint64 `json:"gas"`
MaxFeePerGas EthBigInt `json:"maxFeePerGas"`
MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"`
V EthBigInt `json:"v"`
AccessList []EthHash `json:"accessList"`
V EthBigInt `json:"yParity"`
R EthBigInt `json:"r"`
S EthBigInt `json:"s"`
}
@ -86,6 +87,7 @@ func EthTxFromSignedEthMessage(smsg *types.SignedMessage) (EthTx, error) {
Gas: EthUint64(txArgs.GasLimit),
MaxFeePerGas: EthBigInt(txArgs.MaxFeePerGas),
MaxPriorityFeePerGas: EthBigInt(txArgs.MaxPriorityFeePerGas),
AccessList: []EthHash{},
V: v,
R: r,
S: s,

View File

@ -2644,7 +2644,10 @@ Response:
"gas": "0x5",
"maxFeePerGas": "0x0",
"maxPriorityFeePerGas": "0x0",
"v": "0x0",
"accessList": [
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
],
"yParity": "0x0",
"r": "0x0",
"s": "0x0"
}
@ -2680,7 +2683,10 @@ Response:
"gas": "0x5",
"maxFeePerGas": "0x0",
"maxPriorityFeePerGas": "0x0",
"v": "0x0",
"accessList": [
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
],
"yParity": "0x0",
"r": "0x0",
"s": "0x0"
}
@ -2715,7 +2721,10 @@ Response:
"gas": "0x5",
"maxFeePerGas": "0x0",
"maxPriorityFeePerGas": "0x0",
"v": "0x0",
"accessList": [
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
],
"yParity": "0x0",
"r": "0x0",
"s": "0x0"
}

View File

@ -139,8 +139,6 @@ func TestEthOpenRPCConformance(t *testing.T) {
require.NoError(t, err)
defer closer()
const skipUntilIssue10106 = "Skipped until EthTx is updated, see https://github.com/filecoin-project/lotus/issues/10106"
testCases := []struct {
method string
variant string // suffix applied to the test name to distinguish different variants of a method call
@ -227,7 +225,6 @@ func TestEthOpenRPCConformance(t *testing.T) {
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByHash(context.Background(), blockHashWithMessage, true)
},
skipReason: skipUntilIssue10106,
},
{
@ -236,7 +233,7 @@ func TestEthOpenRPCConformance(t *testing.T) {
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), "earliest", true)
},
skipReason: skipUntilIssue10106,
skipReason: "earliest block is not supported",
},
{
@ -245,7 +242,6 @@ func TestEthOpenRPCConformance(t *testing.T) {
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), "pending", true)
},
skipReason: skipUntilIssue10106,
},
{
@ -253,7 +249,6 @@ func TestEthOpenRPCConformance(t *testing.T) {
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), blockNumberWithMessage.Hex(), true)
},
skipReason: skipUntilIssue10106,
},
{
@ -329,7 +324,7 @@ func TestEthOpenRPCConformance(t *testing.T) {
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByBlockHashAndIndex(context.Background(), blockHashWithMessage, ethtypes.EthUint64(0))
},
skipReason: skipUntilIssue10106,
skipReason: "unimplemented",
},
{
@ -337,7 +332,7 @@ func TestEthOpenRPCConformance(t *testing.T) {
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByBlockNumberAndIndex(context.Background(), blockNumberWithMessage, ethtypes.EthUint64(0))
},
skipReason: skipUntilIssue10106,
skipReason: "unimplemented",
},
{
@ -345,7 +340,6 @@ func TestEthOpenRPCConformance(t *testing.T) {
call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByHash(context.Background(), &messageWithEvents)
},
skipReason: skipUntilIssue10106,
},
{

View File

@ -1762,6 +1762,7 @@ func ethTxFromNativeMessage(ctx context.Context, msg *types.Message, sa StateAPI
Gas: ethtypes.EthUint64(msg.GasLimit),
MaxFeePerGas: ethtypes.EthBigInt(msg.GasFeeCap),
MaxPriorityFeePerGas: ethtypes.EthBigInt(msg.GasPremium),
AccessList: []ethtypes.EthHash{},
}
}