parent
3ef32395f3
commit
014d95454b
@ -372,12 +372,13 @@ func init() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
ethint := ethtypes.EthUint64(5)
|
ethint := ethtypes.EthUint64(5)
|
||||||
|
|
||||||
addExample(ethint)
|
addExample(ethint)
|
||||||
addExample(ðint)
|
addExample(ðint)
|
||||||
|
|
||||||
ethaddr, _ := ethtypes.ParseEthAddress("0x5CbEeCF99d3fDB3f25E309Cc264f240bb0664031")
|
ethaddr, _ := ethtypes.ParseEthAddress("0x5CbEeCF99d3fDB3f25E309Cc264f240bb0664031")
|
||||||
addExample(ethaddr)
|
addExample(ethaddr)
|
||||||
addExample(ðaddr)
|
addExample(ðaddr)
|
||||||
|
|
||||||
ethhash, _ := ethtypes.EthHashFromCid(c)
|
ethhash, _ := ethtypes.EthHashFromCid(c)
|
||||||
addExample(ethhash)
|
addExample(ethhash)
|
||||||
addExample(ðhash)
|
addExample(ðhash)
|
||||||
@ -387,11 +388,13 @@ func init() {
|
|||||||
|
|
||||||
addExample(&uuid.UUID{})
|
addExample(&uuid.UUID{})
|
||||||
|
|
||||||
filterid, _ := ethtypes.ParseEthHash("0x5CbEeC012345673f25E309Cc264f240bb0664031")
|
filterid := ethtypes.EthFilterID(ethhash)
|
||||||
addExample(ethtypes.EthFilterID(filterid))
|
addExample(filterid)
|
||||||
|
addExample(&filterid)
|
||||||
|
|
||||||
subid, _ := ethtypes.ParseEthHash("0x5CbEeCF99d3fDB301234567c264f240bb0664031")
|
subid := ethtypes.EthSubscriptionID(ethhash)
|
||||||
addExample(ethtypes.EthSubscriptionID(subid))
|
addExample(subid)
|
||||||
|
addExample(&subid)
|
||||||
|
|
||||||
pstring := func(s string) *string { return &s }
|
pstring := func(s string) *string { return &s }
|
||||||
addExample(ðtypes.EthFilterSpec{
|
addExample(ðtypes.EthFilterSpec{
|
||||||
|
Binary file not shown.
@ -386,8 +386,8 @@ func parseEip1559Tx(data []byte) (*EthTxArgs, error) {
|
|||||||
return nil, fmt.Errorf("not an EIP-1559 transaction: decoded data is not a list")
|
return nil, fmt.Errorf("not an EIP-1559 transaction: decoded data is not a list")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(decoded) != 9 && len(decoded) != 12 {
|
if len(decoded) != 12 {
|
||||||
return nil, fmt.Errorf("not an EIP-1559 transaction: should have 6 or 9 elements in the list")
|
return nil, fmt.Errorf("not an EIP-1559 transaction: should have 12 elements in the rlp list")
|
||||||
}
|
}
|
||||||
|
|
||||||
chainId, err := parseInt(decoded[0])
|
chainId, err := parseInt(decoded[0])
|
||||||
|
@ -369,11 +369,11 @@ func decodeHexString(s string, expectedLen int) ([]byte, error) {
|
|||||||
s = "0" + s
|
s = "0" + s
|
||||||
}
|
}
|
||||||
if len(s) != expectedLen*2 {
|
if len(s) != expectedLen*2 {
|
||||||
return []byte{}, xerrors.Errorf("expected length %d, got %d", expectedLen, len(s))
|
return nil, xerrors.Errorf("expected hex string length sans prefix %d, got %d", expectedLen*2, len(s))
|
||||||
}
|
}
|
||||||
b, err := hex.DecodeString(s)
|
b, err := hex.DecodeString(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []byte{}, xerrors.Errorf("cannot parse hex value: %w", err)
|
return nil, xerrors.Errorf("cannot parse hex value: %w", err)
|
||||||
}
|
}
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
@ -8,15 +8,17 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// set a limit to make sure it doesn't loop infinitely
|
// maxListElements restricts the amount of RLP list elements we'll read.
|
||||||
const maxListElements = 500
|
// The ETH API only ever reads EIP-1559 transactions, which are bounded by
|
||||||
|
// 12 elements exactly, so we play it safe and set exactly that limit here.
|
||||||
|
const maxListElements = 12
|
||||||
|
|
||||||
func EncodeRLP(val interface{}) ([]byte, error) {
|
func EncodeRLP(val interface{}) ([]byte, error) {
|
||||||
return encodeRLP(val)
|
return encodeRLP(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeRLPListItems(list []interface{}) (result []byte, err error) {
|
func encodeRLPListItems(list []interface{}) (result []byte, err error) {
|
||||||
res := []byte{}
|
var res []byte
|
||||||
for _, elem := range list {
|
for _, elem := range list {
|
||||||
encoded, err := encodeRLP(elem)
|
encoded, err := encodeRLP(elem)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -163,7 +165,7 @@ func decodeLength(data []byte, lenInBytes int) (length int, err error) {
|
|||||||
|
|
||||||
func decodeListElems(data []byte, length int) (res []interface{}, err error) {
|
func decodeListElems(data []byte, length int) (res []interface{}, err error) {
|
||||||
totalConsumed := 0
|
totalConsumed := 0
|
||||||
result := []interface{}{}
|
var result []interface{}
|
||||||
|
|
||||||
for i := 0; totalConsumed < length && i < maxListElements; i++ {
|
for i := 0; totalConsumed < length && i < maxListElements; i++ {
|
||||||
elem, consumed, err := decodeRLP(data[totalConsumed:])
|
elem, consumed, err := decodeRLP(data[totalConsumed:])
|
||||||
|
@ -52,7 +52,7 @@ func NewKey(keyinfo types.KeyInfo) (*Key, error) {
|
|||||||
return nil, xerrors.Errorf("converting Secp256k1 to address: %w", err)
|
return nil, xerrors.Errorf("converting Secp256k1 to address: %w", err)
|
||||||
}
|
}
|
||||||
case types.KTDelegated:
|
case types.KTDelegated:
|
||||||
// Assume eth for now
|
// Transitory Delegated signature verification as per FIP-0055
|
||||||
ethAddr, err := ethtypes.EthAddressFromPubKey(k.PublicKey)
|
ethAddr, err := ethtypes.EthAddressFromPubKey(k.PublicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to calculate Eth address from public key: %w", err)
|
return nil, xerrors.Errorf("failed to calculate Eth address from public key: %w", err)
|
||||||
|
@ -81,7 +81,7 @@ var Commands = []*cli.Command{
|
|||||||
WithCategory("developer", LogCmd),
|
WithCategory("developer", LogCmd),
|
||||||
WithCategory("developer", WaitApiCmd),
|
WithCategory("developer", WaitApiCmd),
|
||||||
WithCategory("developer", FetchParamCmd),
|
WithCategory("developer", FetchParamCmd),
|
||||||
WithCategory("developer", EthCmd),
|
WithCategory("developer", EvmCmd),
|
||||||
WithCategory("network", NetCmd),
|
WithCategory("network", NetCmd),
|
||||||
WithCategory("network", SyncCmd),
|
WithCategory("network", SyncCmd),
|
||||||
WithCategory("status", StatusCmd),
|
WithCategory("status", StatusCmd),
|
||||||
|
@ -25,19 +25,19 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
||||||
)
|
)
|
||||||
|
|
||||||
var EthCmd = &cli.Command{
|
var EvmCmd = &cli.Command{
|
||||||
Name: "eth",
|
Name: "evm",
|
||||||
Usage: "Ethereum operations",
|
Usage: "Commands related to the Filecoin EVM runtime",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
EthDeployCmd,
|
EvmDeployCmd,
|
||||||
EthInvokeCmd,
|
EvmInvokeCmd,
|
||||||
EthGetInfoCmd,
|
EvmGetInfoCmd,
|
||||||
EthCallSimulateCmd,
|
EvmCallSimulateCmd,
|
||||||
EthGetContractAddress,
|
EvmGetContractAddress,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var EthGetInfoCmd = &cli.Command{
|
var EvmGetInfoCmd = &cli.Command{
|
||||||
Name: "stat",
|
Name: "stat",
|
||||||
Usage: "Print eth/filecoin addrs and code cid",
|
Usage: "Print eth/filecoin addrs and code cid",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
@ -101,7 +101,7 @@ var EthGetInfoCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var EthCallSimulateCmd = &cli.Command{
|
var EvmCallSimulateCmd = &cli.Command{
|
||||||
Name: "call",
|
Name: "call",
|
||||||
Usage: "Simulate an eth contract call",
|
Usage: "Simulate an eth contract call",
|
||||||
ArgsUsage: "[from] [to] [params]",
|
ArgsUsage: "[from] [to] [params]",
|
||||||
@ -150,7 +150,7 @@ var EthCallSimulateCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var EthGetContractAddress = &cli.Command{
|
var EvmGetContractAddress = &cli.Command{
|
||||||
Name: "contract-address",
|
Name: "contract-address",
|
||||||
Usage: "Generate contract address from smart contract code",
|
Usage: "Generate contract address from smart contract code",
|
||||||
ArgsUsage: "[senderEthAddr] [salt] [contractHexPath]",
|
ArgsUsage: "[senderEthAddr] [salt] [contractHexPath]",
|
||||||
@ -200,7 +200,7 @@ var EthGetContractAddress = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var EthDeployCmd = &cli.Command{
|
var EvmDeployCmd = &cli.Command{
|
||||||
Name: "deploy",
|
Name: "deploy",
|
||||||
Usage: "Deploy an EVM smart contract and return its address",
|
Usage: "Deploy an EVM smart contract and return its address",
|
||||||
ArgsUsage: "contract",
|
ArgsUsage: "contract",
|
||||||
@ -329,7 +329,7 @@ var EthDeployCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var EthInvokeCmd = &cli.Command{
|
var EvmInvokeCmd = &cli.Command{
|
||||||
Name: "invoke",
|
Name: "invoke",
|
||||||
Usage: "Invoke an EVM smart contract using the specified CALLDATA",
|
Usage: "Invoke an EVM smart contract using the specified CALLDATA",
|
||||||
ArgsUsage: "address calldata",
|
ArgsUsage: "address calldata",
|
@ -2517,38 +2517,38 @@ Inputs:
|
|||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
0,
|
55,
|
||||||
0,
|
105,
|
||||||
0,
|
12,
|
||||||
0,
|
254,
|
||||||
0,
|
198,
|
||||||
0,
|
193,
|
||||||
0,
|
191,
|
||||||
0,
|
76,
|
||||||
0,
|
59,
|
||||||
0,
|
146,
|
||||||
0,
|
136,
|
||||||
0,
|
199,
|
||||||
0,
|
165,
|
||||||
0,
|
215,
|
||||||
0,
|
131,
|
||||||
0,
|
233,
|
||||||
0,
|
135,
|
||||||
0,
|
49,
|
||||||
0,
|
233,
|
||||||
0,
|
11,
|
||||||
0,
|
10,
|
||||||
0,
|
76,
|
||||||
0,
|
23,
|
||||||
0,
|
124,
|
||||||
0,
|
42,
|
||||||
0,
|
55,
|
||||||
0,
|
76,
|
||||||
0,
|
122,
|
||||||
0,
|
148,
|
||||||
0,
|
39,
|
||||||
0,
|
53,
|
||||||
0
|
94
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@ -2571,38 +2571,38 @@ Inputs:
|
|||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
0,
|
55,
|
||||||
0,
|
105,
|
||||||
0,
|
12,
|
||||||
0,
|
254,
|
||||||
0,
|
198,
|
||||||
0,
|
193,
|
||||||
0,
|
191,
|
||||||
0,
|
76,
|
||||||
0,
|
59,
|
||||||
0,
|
146,
|
||||||
0,
|
136,
|
||||||
0,
|
199,
|
||||||
0,
|
165,
|
||||||
0,
|
215,
|
||||||
0,
|
131,
|
||||||
0,
|
233,
|
||||||
0,
|
135,
|
||||||
0,
|
49,
|
||||||
0,
|
233,
|
||||||
0,
|
11,
|
||||||
0,
|
10,
|
||||||
0,
|
76,
|
||||||
0,
|
23,
|
||||||
0,
|
124,
|
||||||
0,
|
42,
|
||||||
0,
|
55,
|
||||||
0,
|
76,
|
||||||
0,
|
122,
|
||||||
0,
|
148,
|
||||||
0,
|
39,
|
||||||
0,
|
53,
|
||||||
0
|
94
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@ -2845,38 +2845,38 @@ Inputs: `null`
|
|||||||
Response:
|
Response:
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
0,
|
55,
|
||||||
0,
|
105,
|
||||||
0,
|
12,
|
||||||
0,
|
254,
|
||||||
0,
|
198,
|
||||||
0,
|
193,
|
||||||
0,
|
191,
|
||||||
0,
|
76,
|
||||||
0,
|
59,
|
||||||
0,
|
146,
|
||||||
0,
|
136,
|
||||||
0,
|
199,
|
||||||
0,
|
165,
|
||||||
0,
|
215,
|
||||||
0,
|
131,
|
||||||
0,
|
233,
|
||||||
0,
|
135,
|
||||||
0,
|
49,
|
||||||
0,
|
233,
|
||||||
0,
|
11,
|
||||||
0,
|
10,
|
||||||
0,
|
76,
|
||||||
0,
|
23,
|
||||||
0,
|
124,
|
||||||
0,
|
42,
|
||||||
0,
|
55,
|
||||||
0,
|
76,
|
||||||
0,
|
122,
|
||||||
0,
|
148,
|
||||||
0,
|
39,
|
||||||
0,
|
53,
|
||||||
0
|
94
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -2902,38 +2902,38 @@ Inputs:
|
|||||||
Response:
|
Response:
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
0,
|
55,
|
||||||
0,
|
105,
|
||||||
0,
|
12,
|
||||||
0,
|
254,
|
||||||
0,
|
198,
|
||||||
0,
|
193,
|
||||||
0,
|
191,
|
||||||
0,
|
76,
|
||||||
0,
|
59,
|
||||||
0,
|
146,
|
||||||
0,
|
136,
|
||||||
0,
|
199,
|
||||||
0,
|
165,
|
||||||
0,
|
215,
|
||||||
0,
|
131,
|
||||||
0,
|
233,
|
||||||
0,
|
135,
|
||||||
0,
|
49,
|
||||||
0,
|
233,
|
||||||
0,
|
11,
|
||||||
0,
|
10,
|
||||||
0,
|
76,
|
||||||
0,
|
23,
|
||||||
0,
|
124,
|
||||||
0,
|
42,
|
||||||
0,
|
55,
|
||||||
0,
|
76,
|
||||||
0,
|
122,
|
||||||
0,
|
148,
|
||||||
0,
|
39,
|
||||||
0,
|
53,
|
||||||
0
|
94
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -2948,38 +2948,38 @@ Inputs: `null`
|
|||||||
Response:
|
Response:
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
0,
|
55,
|
||||||
0,
|
105,
|
||||||
0,
|
12,
|
||||||
0,
|
254,
|
||||||
0,
|
198,
|
||||||
0,
|
193,
|
||||||
0,
|
191,
|
||||||
0,
|
76,
|
||||||
0,
|
59,
|
||||||
0,
|
146,
|
||||||
0,
|
136,
|
||||||
0,
|
199,
|
||||||
0,
|
165,
|
||||||
0,
|
215,
|
||||||
0,
|
131,
|
||||||
0,
|
233,
|
||||||
0,
|
135,
|
||||||
0,
|
49,
|
||||||
0,
|
233,
|
||||||
0,
|
11,
|
||||||
0,
|
10,
|
||||||
0,
|
76,
|
||||||
0,
|
23,
|
||||||
0,
|
124,
|
||||||
0,
|
42,
|
||||||
0,
|
55,
|
||||||
0,
|
76,
|
||||||
0,
|
122,
|
||||||
0,
|
148,
|
||||||
0,
|
39,
|
||||||
0,
|
53,
|
||||||
0
|
94
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -3036,38 +3036,38 @@ Response:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"subscription": [
|
"subscription": [
|
||||||
0,
|
55,
|
||||||
0,
|
105,
|
||||||
0,
|
12,
|
||||||
0,
|
254,
|
||||||
0,
|
198,
|
||||||
0,
|
193,
|
||||||
0,
|
191,
|
||||||
0,
|
76,
|
||||||
0,
|
59,
|
||||||
0,
|
146,
|
||||||
0,
|
136,
|
||||||
0,
|
199,
|
||||||
0,
|
165,
|
||||||
0,
|
215,
|
||||||
0,
|
131,
|
||||||
0,
|
233,
|
||||||
0,
|
135,
|
||||||
0,
|
49,
|
||||||
0,
|
233,
|
||||||
0,
|
11,
|
||||||
0,
|
10,
|
||||||
0,
|
76,
|
||||||
0,
|
23,
|
||||||
0,
|
124,
|
||||||
0,
|
42,
|
||||||
0,
|
55,
|
||||||
0,
|
76,
|
||||||
0,
|
122,
|
||||||
0,
|
148,
|
||||||
0,
|
39,
|
||||||
0,
|
53,
|
||||||
0
|
94
|
||||||
],
|
],
|
||||||
"result": {}
|
"result": {}
|
||||||
}
|
}
|
||||||
@ -3083,38 +3083,38 @@ Inputs:
|
|||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
0,
|
55,
|
||||||
0,
|
105,
|
||||||
0,
|
12,
|
||||||
0,
|
254,
|
||||||
0,
|
198,
|
||||||
0,
|
193,
|
||||||
0,
|
191,
|
||||||
0,
|
76,
|
||||||
0,
|
59,
|
||||||
0,
|
146,
|
||||||
0,
|
136,
|
||||||
0,
|
199,
|
||||||
0,
|
165,
|
||||||
0,
|
215,
|
||||||
0,
|
131,
|
||||||
0,
|
233,
|
||||||
0,
|
135,
|
||||||
0,
|
49,
|
||||||
0,
|
233,
|
||||||
0,
|
11,
|
||||||
0,
|
10,
|
||||||
0,
|
76,
|
||||||
0,
|
23,
|
||||||
0,
|
124,
|
||||||
0,
|
42,
|
||||||
0,
|
55,
|
||||||
0,
|
76,
|
||||||
0,
|
122,
|
||||||
0,
|
148,
|
||||||
0,
|
39,
|
||||||
0,
|
53,
|
||||||
0
|
94
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@ -3131,38 +3131,38 @@ Inputs:
|
|||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
0,
|
55,
|
||||||
0,
|
105,
|
||||||
0,
|
12,
|
||||||
0,
|
254,
|
||||||
0,
|
198,
|
||||||
0,
|
193,
|
||||||
0,
|
191,
|
||||||
0,
|
76,
|
||||||
0,
|
59,
|
||||||
0,
|
146,
|
||||||
0,
|
136,
|
||||||
0,
|
199,
|
||||||
0,
|
165,
|
||||||
0,
|
215,
|
||||||
0,
|
131,
|
||||||
0,
|
233,
|
||||||
0,
|
135,
|
||||||
0,
|
49,
|
||||||
0,
|
233,
|
||||||
0,
|
11,
|
||||||
0,
|
10,
|
||||||
0,
|
76,
|
||||||
0,
|
23,
|
||||||
0,
|
124,
|
||||||
0,
|
42,
|
||||||
0,
|
55,
|
||||||
0,
|
76,
|
||||||
0,
|
122,
|
||||||
0,
|
148,
|
||||||
0,
|
39,
|
||||||
0,
|
53,
|
||||||
0
|
94
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
@ -31,7 +31,7 @@ COMMANDS:
|
|||||||
log Manage logging
|
log Manage logging
|
||||||
wait-api Wait for lotus api to come online
|
wait-api Wait for lotus api to come online
|
||||||
fetch-params Fetch proving parameters
|
fetch-params Fetch proving parameters
|
||||||
eth Ethereum operations
|
evm Commands related to the Filecoin EVM runtime
|
||||||
NETWORK:
|
NETWORK:
|
||||||
net Manage P2P Network
|
net Manage P2P Network
|
||||||
sync Inspect or interact with the chain syncer
|
sync Inspect or interact with the chain syncer
|
||||||
@ -2540,13 +2540,13 @@ OPTIONS:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## lotus eth
|
## lotus evm
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
lotus eth - Ethereum operations
|
lotus evm - Commands related to the Filecoin EVM runtime
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
lotus eth command [command options] [arguments...]
|
lotus evm command [command options] [arguments...]
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
deploy Deploy an EVM smart contract and return its address
|
deploy Deploy an EVM smart contract and return its address
|
||||||
@ -2561,13 +2561,13 @@ OPTIONS:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### lotus eth deploy
|
### lotus evm deploy
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
lotus eth deploy - Deploy an EVM smart contract and return its address
|
lotus evm deploy - Deploy an EVM smart contract and return its address
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
lotus eth deploy [command options] contract
|
lotus evm deploy [command options] contract
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--from value optionally specify the account to use for sending the creation message
|
--from value optionally specify the account to use for sending the creation message
|
||||||
@ -2575,13 +2575,13 @@ OPTIONS:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### lotus eth invoke
|
### lotus evm invoke
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
lotus eth invoke - Invoke an EVM smart contract using the specified CALLDATA
|
lotus evm invoke - Invoke an EVM smart contract using the specified CALLDATA
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
lotus eth invoke [command options] address calldata
|
lotus evm invoke [command options] address calldata
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--from value optionally specify the account to use for sending the exec message
|
--from value optionally specify the account to use for sending the exec message
|
||||||
@ -2589,13 +2589,13 @@ OPTIONS:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### lotus eth stat
|
### lotus evm stat
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
lotus eth stat - Print eth/filecoin addrs and code cid
|
lotus evm stat - Print eth/filecoin addrs and code cid
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
lotus eth stat [command options] [arguments...]
|
lotus evm stat [command options] [arguments...]
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--ethAddr value Ethereum address
|
--ethAddr value Ethereum address
|
||||||
@ -2603,26 +2603,26 @@ OPTIONS:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### lotus eth call
|
### lotus evm call
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
lotus eth call - Simulate an eth contract call
|
lotus evm call - Simulate an eth contract call
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
lotus eth call [command options] [from] [to] [params]
|
lotus evm call [command options] [from] [to] [params]
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--help, -h show help (default: false)
|
--help, -h show help (default: false)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### lotus eth contract-address
|
### lotus evm contract-address
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
lotus eth contract-address - Generate contract address from smart contract code
|
lotus evm contract-address - Generate contract address from smart contract code
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
lotus eth contract-address [command options] [senderEthAddr] [salt] [contractHexPath]
|
lotus evm contract-address [command options] [senderEthAddr] [salt] [contractHexPath]
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--help, -h show help (default: false)
|
--help, -h show help (default: false)
|
||||||
|
@ -48,7 +48,7 @@ func TestDeployment(t *testing.T) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// install contract
|
// install contract
|
||||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.bin")
|
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
contract, err := hex.DecodeString(string(contractHex))
|
contract, err := hex.DecodeString(string(contractHex))
|
||||||
|
@ -29,7 +29,7 @@ func TestValueTransferValidSignature(t *testing.T) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// install contract
|
// install contract
|
||||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.bin")
|
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
contract, err := hex.DecodeString(string(contractHex))
|
contract, err := hex.DecodeString(string(contractHex))
|
||||||
@ -114,7 +114,7 @@ func TestContractDeploymentValidSignature(t *testing.T) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// install contract
|
// install contract
|
||||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.bin")
|
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
contract, err := hex.DecodeString(string(contractHex))
|
contract, err := hex.DecodeString(string(contractHex))
|
||||||
@ -175,7 +175,7 @@ func TestContractInvocation(t *testing.T) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// install contract
|
// install contract
|
||||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.bin")
|
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
contract, err := hex.DecodeString(string(contractHex))
|
contract, err := hex.DecodeString(string(contractHex))
|
||||||
|
@ -35,7 +35,7 @@ func TestAddressCreationBeforeDeploy(t *testing.T) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// install contract
|
// install contract
|
||||||
contractHex, err := os.ReadFile("contracts/SimpleCoin.bin")
|
contractHex, err := os.ReadFile("contracts/SimpleCoin.hex")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
contract, err := hex.DecodeString(string(contractHex))
|
contract, err := hex.DecodeString(string(contractHex))
|
||||||
|
@ -33,7 +33,7 @@ func TestFEVMBasic(t *testing.T) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// install contract
|
// install contract
|
||||||
contractHex, err := os.ReadFile("contracts/SimpleCoin.bin")
|
contractHex, err := os.ReadFile("contracts/SimpleCoin.hex")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
contract, err := hex.DecodeString(string(contractHex))
|
contract, err := hex.DecodeString(string(contractHex))
|
||||||
|
@ -73,9 +73,10 @@ the entire chain)`,
|
|||||||
Name: "ActorEventDatabasePath",
|
Name: "ActorEventDatabasePath",
|
||||||
Type: "string",
|
Type: "string",
|
||||||
|
|
||||||
Comment: `EventHistoryDatabasePath is the full path to a sqlite database that will be used to index actor events to
|
Comment: `ActorEventDatabasePath is the full path to a sqlite database that will be used to index actor events to
|
||||||
support the historic filter APIs. If the database does not exist it will be created. The directory containing
|
support the historic filter APIs. If the database does not exist it will be created. The directory containing
|
||||||
the database must already exist and be writeable.`,
|
the database must already exist and be writeable. If a relative path is provided here, sqlite treats it as
|
||||||
|
relative to the CWD (current working directory).`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"Backup": []DocField{
|
"Backup": []DocField{
|
||||||
|
@ -681,9 +681,10 @@ type ActorEventConfig struct {
|
|||||||
// the entire chain)
|
// the entire chain)
|
||||||
MaxFilterHeightRange uint64
|
MaxFilterHeightRange uint64
|
||||||
|
|
||||||
// EventHistoryDatabasePath is the full path to a sqlite database that will be used to index actor events to
|
// ActorEventDatabasePath is the full path to a sqlite database that will be used to index actor events to
|
||||||
// support the historic filter APIs. If the database does not exist it will be created. The directory containing
|
// support the historic filter APIs. If the database does not exist it will be created. The directory containing
|
||||||
// the database must already exist and be writeable.
|
// the database must already exist and be writeable. If a relative path is provided here, sqlite treats it as
|
||||||
|
// relative to the CWD (current working directory).
|
||||||
ActorEventDatabasePath string
|
ActorEventDatabasePath string
|
||||||
|
|
||||||
// Others, not implemented yet:
|
// Others, not implemented yet:
|
||||||
|
@ -616,19 +616,17 @@ func (m *StateModule) StateWaitMsg(ctx context.Context, msg cid.Cid, confidence
|
|||||||
|
|
||||||
vmsg := cmsg.VMMessage()
|
vmsg := cmsg.VMMessage()
|
||||||
|
|
||||||
t, err := stmgr.GetReturnType(ctx, m.StateManager, vmsg.To, vmsg.Method, ts)
|
switch t, err := stmgr.GetReturnType(ctx, m.StateManager, vmsg.To, vmsg.Method, ts); {
|
||||||
if err != nil {
|
case errors.Is(err, stmgr.ErrMetadataNotFound):
|
||||||
if errors.Is(err, stmgr.ErrMetadataNotFound) {
|
// This is not necessarily an error -- EVM methods (and in the future native actors) may
|
||||||
// This is not necessarily an error -- EVM methods (and in the future native actors) may
|
// return just bytes, and in the not so distant future we'll have native wasm actors
|
||||||
// return just bytes, and in the not so distant future we'll have native wasm actors
|
// that are by definition not in the registry.
|
||||||
// that are by definition not in the registry.
|
// So in this case, log a debug message and retun the raw bytes.
|
||||||
// So in this case, log a debug message and retun the raw bytes.
|
log.Debugf("failed to get return type: %s", err)
|
||||||
log.Debugf("failed to get return type: %s", err)
|
returndec = recpt.Return
|
||||||
returndec = recpt.Return
|
case err != nil:
|
||||||
} else {
|
return nil, xerrors.Errorf("failed to get return type: %w", err)
|
||||||
return nil, xerrors.Errorf("failed to get return type: %w", err)
|
default:
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if err := t.UnmarshalCBOR(bytes.NewReader(recpt.Return)); err != nil {
|
if err := t.UnmarshalCBOR(bytes.NewReader(recpt.Return)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,8 @@ var _ events.EventAPI = &EventAPI{}
|
|||||||
|
|
||||||
func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecycle, *store.ChainStore, *stmgr.StateManager, EventAPI, *messagepool.MessagePool, full.StateAPI, full.ChainAPI) (*full.EthEvent, error) {
|
func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecycle, *store.ChainStore, *stmgr.StateManager, EventAPI, *messagepool.MessagePool, full.StateAPI, full.ChainAPI) (*full.EthEvent, error) {
|
||||||
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, cs *store.ChainStore, sm *stmgr.StateManager, evapi EventAPI, mp *messagepool.MessagePool, stateapi full.StateAPI, chainapi full.ChainAPI) (*full.EthEvent, error) {
|
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, cs *store.ChainStore, sm *stmgr.StateManager, evapi EventAPI, mp *messagepool.MessagePool, stateapi full.StateAPI, chainapi full.ChainAPI) (*full.EthEvent, error) {
|
||||||
|
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||||
|
|
||||||
ee := &full.EthEvent{
|
ee := &full.EthEvent{
|
||||||
Chain: cs,
|
Chain: cs,
|
||||||
MaxFilterHeightRange: abi.ChainEpoch(cfg.MaxFilterHeightRange),
|
MaxFilterHeightRange: abi.ChainEpoch(cfg.MaxFilterHeightRange),
|
||||||
@ -53,7 +55,7 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy
|
|||||||
|
|
||||||
// Start garbage collection for filters
|
// Start garbage collection for filters
|
||||||
lc.Append(fx.Hook{
|
lc.Append(fx.Hook{
|
||||||
OnStart: func(ctx context.Context) error {
|
OnStart: func(context.Context) error {
|
||||||
go ee.GC(ctx, time.Duration(cfg.FilterTTL))
|
go ee.GC(ctx, time.Duration(cfg.FilterTTL))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
@ -69,7 +71,7 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy
|
|||||||
}
|
}
|
||||||
|
|
||||||
lc.Append(fx.Hook{
|
lc.Append(fx.Hook{
|
||||||
OnStop: func(ctx context.Context) error {
|
OnStop: func(context.Context) error {
|
||||||
return eventIndex.Close()
|
return eventIndex.Close()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -112,7 +114,6 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy
|
|||||||
|
|
||||||
const ChainHeadConfidence = 1
|
const ChainHeadConfidence = 1
|
||||||
|
|
||||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
|
||||||
lc.Append(fx.Hook{
|
lc.Append(fx.Hook{
|
||||||
OnStart: func(context.Context) error {
|
OnStart: func(context.Context) error {
|
||||||
ev, err := events.NewEventsWithConfidence(ctx, &evapi, ChainHeadConfidence)
|
ev, err := events.NewEventsWithConfidence(ctx, &evapi, ChainHeadConfidence)
|
||||||
|
Loading…
Reference in New Issue
Block a user