ethrpc: Add missing fields to EthTx

This commit is contained in:
Łukasz Magiera 2023-02-09 14:14:48 +01:00
parent 9339267e6e
commit e321761a72
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"` Gas EthUint64 `json:"gas"`
MaxFeePerGas EthBigInt `json:"maxFeePerGas"` MaxFeePerGas EthBigInt `json:"maxFeePerGas"`
MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"` MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"`
V EthBigInt `json:"v"` AccessList []EthHash `json:"accessList"`
V EthBigInt `json:"yParity"`
R EthBigInt `json:"r"` R EthBigInt `json:"r"`
S EthBigInt `json:"s"` S EthBigInt `json:"s"`
} }
@ -86,6 +87,7 @@ func EthTxFromSignedEthMessage(smsg *types.SignedMessage) (EthTx, error) {
Gas: EthUint64(txArgs.GasLimit), Gas: EthUint64(txArgs.GasLimit),
MaxFeePerGas: EthBigInt(txArgs.MaxFeePerGas), MaxFeePerGas: EthBigInt(txArgs.MaxFeePerGas),
MaxPriorityFeePerGas: EthBigInt(txArgs.MaxPriorityFeePerGas), MaxPriorityFeePerGas: EthBigInt(txArgs.MaxPriorityFeePerGas),
AccessList: []EthHash{},
V: v, V: v,
R: r, R: r,
S: s, S: s,

View File

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

View File

@ -139,8 +139,6 @@ func TestEthOpenRPCConformance(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
defer closer() defer closer()
const skipUntilIssue10106 = "Skipped until EthTx is updated, see https://github.com/filecoin-project/lotus/issues/10106"
testCases := []struct { testCases := []struct {
method string method string
variant string // suffix applied to the test name to distinguish different variants of a method call 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) { call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByHash(context.Background(), blockHashWithMessage, true) 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) { call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), "earliest", true) 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) { call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), "pending", true) 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) { call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetBlockByNumber(context.Background(), blockNumberWithMessage.Hex(), true) 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) { call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByBlockHashAndIndex(context.Background(), blockHashWithMessage, ethtypes.EthUint64(0)) 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) { call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByBlockNumberAndIndex(context.Background(), blockNumberWithMessage, ethtypes.EthUint64(0)) 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) { call: func(a *ethAPIRaw) (json.RawMessage, error) {
return ethapi.EthGetTransactionByHash(context.Background(), &messageWithEvents) return ethapi.EthGetTransactionByHash(context.Background(), &messageWithEvents)
}, },
skipReason: skipUntilIssue10106,
}, },
{ {

View File

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