parent
3ef32395f3
commit
014d95454b
@ -372,12 +372,13 @@ func init() {
|
||||
})
|
||||
|
||||
ethint := ethtypes.EthUint64(5)
|
||||
|
||||
addExample(ethint)
|
||||
addExample(ðint)
|
||||
|
||||
ethaddr, _ := ethtypes.ParseEthAddress("0x5CbEeCF99d3fDB3f25E309Cc264f240bb0664031")
|
||||
addExample(ethaddr)
|
||||
addExample(ðaddr)
|
||||
|
||||
ethhash, _ := ethtypes.EthHashFromCid(c)
|
||||
addExample(ethhash)
|
||||
addExample(ðhash)
|
||||
@ -387,11 +388,13 @@ func init() {
|
||||
|
||||
addExample(&uuid.UUID{})
|
||||
|
||||
filterid, _ := ethtypes.ParseEthHash("0x5CbEeC012345673f25E309Cc264f240bb0664031")
|
||||
addExample(ethtypes.EthFilterID(filterid))
|
||||
filterid := ethtypes.EthFilterID(ethhash)
|
||||
addExample(filterid)
|
||||
addExample(&filterid)
|
||||
|
||||
subid, _ := ethtypes.ParseEthHash("0x5CbEeCF99d3fDB301234567c264f240bb0664031")
|
||||
addExample(ethtypes.EthSubscriptionID(subid))
|
||||
subid := ethtypes.EthSubscriptionID(ethhash)
|
||||
addExample(subid)
|
||||
addExample(&subid)
|
||||
|
||||
pstring := func(s string) *string { return &s }
|
||||
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")
|
||||
}
|
||||
|
||||
if len(decoded) != 9 && len(decoded) != 12 {
|
||||
return nil, fmt.Errorf("not an EIP-1559 transaction: should have 6 or 9 elements in the list")
|
||||
if len(decoded) != 12 {
|
||||
return nil, fmt.Errorf("not an EIP-1559 transaction: should have 12 elements in the rlp list")
|
||||
}
|
||||
|
||||
chainId, err := parseInt(decoded[0])
|
||||
|
@ -369,11 +369,11 @@ func decodeHexString(s string, expectedLen int) ([]byte, error) {
|
||||
s = "0" + s
|
||||
}
|
||||
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)
|
||||
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
|
||||
}
|
||||
|
@ -8,15 +8,17 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
// set a limit to make sure it doesn't loop infinitely
|
||||
const maxListElements = 500
|
||||
// maxListElements restricts the amount of RLP list elements we'll read.
|
||||
// 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) {
|
||||
return encodeRLP(val)
|
||||
}
|
||||
|
||||
func encodeRLPListItems(list []interface{}) (result []byte, err error) {
|
||||
res := []byte{}
|
||||
var res []byte
|
||||
for _, elem := range list {
|
||||
encoded, err := encodeRLP(elem)
|
||||
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) {
|
||||
totalConsumed := 0
|
||||
result := []interface{}{}
|
||||
var result []interface{}
|
||||
|
||||
for i := 0; totalConsumed < length && i < maxListElements; i++ {
|
||||
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)
|
||||
}
|
||||
case types.KTDelegated:
|
||||
// Assume eth for now
|
||||
// Transitory Delegated signature verification as per FIP-0055
|
||||
ethAddr, err := ethtypes.EthAddressFromPubKey(k.PublicKey)
|
||||
if err != nil {
|
||||
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", WaitApiCmd),
|
||||
WithCategory("developer", FetchParamCmd),
|
||||
WithCategory("developer", EthCmd),
|
||||
WithCategory("developer", EvmCmd),
|
||||
WithCategory("network", NetCmd),
|
||||
WithCategory("network", SyncCmd),
|
||||
WithCategory("status", StatusCmd),
|
||||
|
@ -25,19 +25,19 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
||||
)
|
||||
|
||||
var EthCmd = &cli.Command{
|
||||
Name: "eth",
|
||||
Usage: "Ethereum operations",
|
||||
var EvmCmd = &cli.Command{
|
||||
Name: "evm",
|
||||
Usage: "Commands related to the Filecoin EVM runtime",
|
||||
Subcommands: []*cli.Command{
|
||||
EthDeployCmd,
|
||||
EthInvokeCmd,
|
||||
EthGetInfoCmd,
|
||||
EthCallSimulateCmd,
|
||||
EthGetContractAddress,
|
||||
EvmDeployCmd,
|
||||
EvmInvokeCmd,
|
||||
EvmGetInfoCmd,
|
||||
EvmCallSimulateCmd,
|
||||
EvmGetContractAddress,
|
||||
},
|
||||
}
|
||||
|
||||
var EthGetInfoCmd = &cli.Command{
|
||||
var EvmGetInfoCmd = &cli.Command{
|
||||
Name: "stat",
|
||||
Usage: "Print eth/filecoin addrs and code cid",
|
||||
Flags: []cli.Flag{
|
||||
@ -101,7 +101,7 @@ var EthGetInfoCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var EthCallSimulateCmd = &cli.Command{
|
||||
var EvmCallSimulateCmd = &cli.Command{
|
||||
Name: "call",
|
||||
Usage: "Simulate an eth contract call",
|
||||
ArgsUsage: "[from] [to] [params]",
|
||||
@ -150,7 +150,7 @@ var EthCallSimulateCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var EthGetContractAddress = &cli.Command{
|
||||
var EvmGetContractAddress = &cli.Command{
|
||||
Name: "contract-address",
|
||||
Usage: "Generate contract address from smart contract code",
|
||||
ArgsUsage: "[senderEthAddr] [salt] [contractHexPath]",
|
||||
@ -200,7 +200,7 @@ var EthGetContractAddress = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var EthDeployCmd = &cli.Command{
|
||||
var EvmDeployCmd = &cli.Command{
|
||||
Name: "deploy",
|
||||
Usage: "Deploy an EVM smart contract and return its address",
|
||||
ArgsUsage: "contract",
|
||||
@ -329,7 +329,7 @@ var EthDeployCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var EthInvokeCmd = &cli.Command{
|
||||
var EvmInvokeCmd = &cli.Command{
|
||||
Name: "invoke",
|
||||
Usage: "Invoke an EVM smart contract using the specified CALLDATA",
|
||||
ArgsUsage: "address calldata",
|
@ -2517,38 +2517,38 @@ Inputs:
|
||||
```json
|
||||
[
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
55,
|
||||
105,
|
||||
12,
|
||||
254,
|
||||
198,
|
||||
193,
|
||||
191,
|
||||
76,
|
||||
59,
|
||||
146,
|
||||
136,
|
||||
199,
|
||||
165,
|
||||
215,
|
||||
131,
|
||||
233,
|
||||
135,
|
||||
49,
|
||||
233,
|
||||
11,
|
||||
10,
|
||||
76,
|
||||
23,
|
||||
124,
|
||||
42,
|
||||
55,
|
||||
76,
|
||||
122,
|
||||
148,
|
||||
39,
|
||||
53,
|
||||
94
|
||||
]
|
||||
]
|
||||
```
|
||||
@ -2571,38 +2571,38 @@ Inputs:
|
||||
```json
|
||||
[
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
55,
|
||||
105,
|
||||
12,
|
||||
254,
|
||||
198,
|
||||
193,
|
||||
191,
|
||||
76,
|
||||
59,
|
||||
146,
|
||||
136,
|
||||
199,
|
||||
165,
|
||||
215,
|
||||
131,
|
||||
233,
|
||||
135,
|
||||
49,
|
||||
233,
|
||||
11,
|
||||
10,
|
||||
76,
|
||||
23,
|
||||
124,
|
||||
42,
|
||||
55,
|
||||
76,
|
||||
122,
|
||||
148,
|
||||
39,
|
||||
53,
|
||||
94
|
||||
]
|
||||
]
|
||||
```
|
||||
@ -2845,38 +2845,38 @@ Inputs: `null`
|
||||
Response:
|
||||
```json
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
55,
|
||||
105,
|
||||
12,
|
||||
254,
|
||||
198,
|
||||
193,
|
||||
191,
|
||||
76,
|
||||
59,
|
||||
146,
|
||||
136,
|
||||
199,
|
||||
165,
|
||||
215,
|
||||
131,
|
||||
233,
|
||||
135,
|
||||
49,
|
||||
233,
|
||||
11,
|
||||
10,
|
||||
76,
|
||||
23,
|
||||
124,
|
||||
42,
|
||||
55,
|
||||
76,
|
||||
122,
|
||||
148,
|
||||
39,
|
||||
53,
|
||||
94
|
||||
]
|
||||
```
|
||||
|
||||
@ -2902,38 +2902,38 @@ Inputs:
|
||||
Response:
|
||||
```json
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
55,
|
||||
105,
|
||||
12,
|
||||
254,
|
||||
198,
|
||||
193,
|
||||
191,
|
||||
76,
|
||||
59,
|
||||
146,
|
||||
136,
|
||||
199,
|
||||
165,
|
||||
215,
|
||||
131,
|
||||
233,
|
||||
135,
|
||||
49,
|
||||
233,
|
||||
11,
|
||||
10,
|
||||
76,
|
||||
23,
|
||||
124,
|
||||
42,
|
||||
55,
|
||||
76,
|
||||
122,
|
||||
148,
|
||||
39,
|
||||
53,
|
||||
94
|
||||
]
|
||||
```
|
||||
|
||||
@ -2948,38 +2948,38 @@ Inputs: `null`
|
||||
Response:
|
||||
```json
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
55,
|
||||
105,
|
||||
12,
|
||||
254,
|
||||
198,
|
||||
193,
|
||||
191,
|
||||
76,
|
||||
59,
|
||||
146,
|
||||
136,
|
||||
199,
|
||||
165,
|
||||
215,
|
||||
131,
|
||||
233,
|
||||
135,
|
||||
49,
|
||||
233,
|
||||
11,
|
||||
10,
|
||||
76,
|
||||
23,
|
||||
124,
|
||||
42,
|
||||
55,
|
||||
76,
|
||||
122,
|
||||
148,
|
||||
39,
|
||||
53,
|
||||
94
|
||||
]
|
||||
```
|
||||
|
||||
@ -3036,38 +3036,38 @@ Response:
|
||||
```json
|
||||
{
|
||||
"subscription": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
55,
|
||||
105,
|
||||
12,
|
||||
254,
|
||||
198,
|
||||
193,
|
||||
191,
|
||||
76,
|
||||
59,
|
||||
146,
|
||||
136,
|
||||
199,
|
||||
165,
|
||||
215,
|
||||
131,
|
||||
233,
|
||||
135,
|
||||
49,
|
||||
233,
|
||||
11,
|
||||
10,
|
||||
76,
|
||||
23,
|
||||
124,
|
||||
42,
|
||||
55,
|
||||
76,
|
||||
122,
|
||||
148,
|
||||
39,
|
||||
53,
|
||||
94
|
||||
],
|
||||
"result": {}
|
||||
}
|
||||
@ -3083,38 +3083,38 @@ Inputs:
|
||||
```json
|
||||
[
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
55,
|
||||
105,
|
||||
12,
|
||||
254,
|
||||
198,
|
||||
193,
|
||||
191,
|
||||
76,
|
||||
59,
|
||||
146,
|
||||
136,
|
||||
199,
|
||||
165,
|
||||
215,
|
||||
131,
|
||||
233,
|
||||
135,
|
||||
49,
|
||||
233,
|
||||
11,
|
||||
10,
|
||||
76,
|
||||
23,
|
||||
124,
|
||||
42,
|
||||
55,
|
||||
76,
|
||||
122,
|
||||
148,
|
||||
39,
|
||||
53,
|
||||
94
|
||||
]
|
||||
]
|
||||
```
|
||||
@ -3131,38 +3131,38 @@ Inputs:
|
||||
```json
|
||||
[
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
55,
|
||||
105,
|
||||
12,
|
||||
254,
|
||||
198,
|
||||
193,
|
||||
191,
|
||||
76,
|
||||
59,
|
||||
146,
|
||||
136,
|
||||
199,
|
||||
165,
|
||||
215,
|
||||
131,
|
||||
233,
|
||||
135,
|
||||
49,
|
||||
233,
|
||||
11,
|
||||
10,
|
||||
76,
|
||||
23,
|
||||
124,
|
||||
42,
|
||||
55,
|
||||
76,
|
||||
122,
|
||||
148,
|
||||
39,
|
||||
53,
|
||||
94
|
||||
]
|
||||
]
|
||||
```
|
||||
|
@ -31,7 +31,7 @@ COMMANDS:
|
||||
log Manage logging
|
||||
wait-api Wait for lotus api to come online
|
||||
fetch-params Fetch proving parameters
|
||||
eth Ethereum operations
|
||||
evm Commands related to the Filecoin EVM runtime
|
||||
NETWORK:
|
||||
net Manage P2P Network
|
||||
sync Inspect or interact with the chain syncer
|
||||
@ -2540,13 +2540,13 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
## lotus eth
|
||||
## lotus evm
|
||||
```
|
||||
NAME:
|
||||
lotus eth - Ethereum operations
|
||||
lotus evm - Commands related to the Filecoin EVM runtime
|
||||
|
||||
USAGE:
|
||||
lotus eth command [command options] [arguments...]
|
||||
lotus evm command [command options] [arguments...]
|
||||
|
||||
COMMANDS:
|
||||
deploy Deploy an EVM smart contract and return its address
|
||||
@ -2561,13 +2561,13 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
### lotus eth deploy
|
||||
### lotus evm deploy
|
||||
```
|
||||
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:
|
||||
lotus eth deploy [command options] contract
|
||||
lotus evm deploy [command options] contract
|
||||
|
||||
OPTIONS:
|
||||
--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:
|
||||
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:
|
||||
lotus eth invoke [command options] address calldata
|
||||
lotus evm invoke [command options] address calldata
|
||||
|
||||
OPTIONS:
|
||||
--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:
|
||||
lotus eth stat - Print eth/filecoin addrs and code cid
|
||||
lotus evm stat - Print eth/filecoin addrs and code cid
|
||||
|
||||
USAGE:
|
||||
lotus eth stat [command options] [arguments...]
|
||||
lotus evm stat [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--ethAddr value Ethereum address
|
||||
@ -2603,26 +2603,26 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
### lotus eth call
|
||||
### lotus evm call
|
||||
```
|
||||
NAME:
|
||||
lotus eth call - Simulate an eth contract call
|
||||
lotus evm call - Simulate an eth contract call
|
||||
|
||||
USAGE:
|
||||
lotus eth call [command options] [from] [to] [params]
|
||||
lotus evm call [command options] [from] [to] [params]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus eth contract-address
|
||||
### lotus evm contract-address
|
||||
```
|
||||
NAME:
|
||||
lotus eth contract-address - Generate contract address from smart contract code
|
||||
lotus evm contract-address - Generate contract address from smart contract code
|
||||
|
||||
USAGE:
|
||||
lotus eth contract-address [command options] [senderEthAddr] [salt] [contractHexPath]
|
||||
lotus evm contract-address [command options] [senderEthAddr] [salt] [contractHexPath]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
@ -48,7 +48,7 @@ func TestDeployment(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
// install contract
|
||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.bin")
|
||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
||||
require.NoError(t, err)
|
||||
|
||||
contract, err := hex.DecodeString(string(contractHex))
|
||||
|
@ -29,7 +29,7 @@ func TestValueTransferValidSignature(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
// install contract
|
||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.bin")
|
||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
||||
require.NoError(t, err)
|
||||
|
||||
contract, err := hex.DecodeString(string(contractHex))
|
||||
@ -114,7 +114,7 @@ func TestContractDeploymentValidSignature(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
// install contract
|
||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.bin")
|
||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
||||
require.NoError(t, err)
|
||||
|
||||
contract, err := hex.DecodeString(string(contractHex))
|
||||
@ -175,7 +175,7 @@ func TestContractInvocation(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
// install contract
|
||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.bin")
|
||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
||||
require.NoError(t, err)
|
||||
|
||||
contract, err := hex.DecodeString(string(contractHex))
|
||||
|
@ -35,7 +35,7 @@ func TestAddressCreationBeforeDeploy(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
// install contract
|
||||
contractHex, err := os.ReadFile("contracts/SimpleCoin.bin")
|
||||
contractHex, err := os.ReadFile("contracts/SimpleCoin.hex")
|
||||
require.NoError(t, err)
|
||||
|
||||
contract, err := hex.DecodeString(string(contractHex))
|
||||
|
@ -33,7 +33,7 @@ func TestFEVMBasic(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
// install contract
|
||||
contractHex, err := os.ReadFile("contracts/SimpleCoin.bin")
|
||||
contractHex, err := os.ReadFile("contracts/SimpleCoin.hex")
|
||||
require.NoError(t, err)
|
||||
|
||||
contract, err := hex.DecodeString(string(contractHex))
|
||||
|
@ -73,9 +73,10 @@ the entire chain)`,
|
||||
Name: "ActorEventDatabasePath",
|
||||
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
|
||||
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{
|
||||
|
@ -681,9 +681,10 @@ type ActorEventConfig struct {
|
||||
// the entire chain)
|
||||
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
|
||||
// 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
|
||||
|
||||
// Others, not implemented yet:
|
||||
|
@ -616,19 +616,17 @@ func (m *StateModule) StateWaitMsg(ctx context.Context, msg cid.Cid, confidence
|
||||
|
||||
vmsg := cmsg.VMMessage()
|
||||
|
||||
t, err := stmgr.GetReturnType(ctx, m.StateManager, vmsg.To, vmsg.Method, ts)
|
||||
if err != nil {
|
||||
if errors.Is(err, stmgr.ErrMetadataNotFound) {
|
||||
// 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
|
||||
// that are by definition not in the registry.
|
||||
// So in this case, log a debug message and retun the raw bytes.
|
||||
log.Debugf("failed to get return type: %s", err)
|
||||
returndec = recpt.Return
|
||||
} else {
|
||||
return nil, xerrors.Errorf("failed to get return type: %w", err)
|
||||
}
|
||||
} else {
|
||||
switch t, err := stmgr.GetReturnType(ctx, m.StateManager, vmsg.To, vmsg.Method, ts); {
|
||||
case errors.Is(err, stmgr.ErrMetadataNotFound):
|
||||
// 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
|
||||
// that are by definition not in the registry.
|
||||
// So in this case, log a debug message and retun the raw bytes.
|
||||
log.Debugf("failed to get return type: %s", err)
|
||||
returndec = recpt.Return
|
||||
case err != nil:
|
||||
return nil, xerrors.Errorf("failed to get return type: %w", err)
|
||||
default:
|
||||
if err := t.UnmarshalCBOR(bytes.NewReader(recpt.Return)); err != nil {
|
||||
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) {
|
||||
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{
|
||||
Chain: cs,
|
||||
MaxFilterHeightRange: abi.ChainEpoch(cfg.MaxFilterHeightRange),
|
||||
@ -53,7 +55,7 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy
|
||||
|
||||
// Start garbage collection for filters
|
||||
lc.Append(fx.Hook{
|
||||
OnStart: func(ctx context.Context) error {
|
||||
OnStart: func(context.Context) error {
|
||||
go ee.GC(ctx, time.Duration(cfg.FilterTTL))
|
||||
return nil
|
||||
},
|
||||
@ -69,7 +71,7 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy
|
||||
}
|
||||
|
||||
lc.Append(fx.Hook{
|
||||
OnStop: func(ctx context.Context) error {
|
||||
OnStop: func(context.Context) error {
|
||||
return eventIndex.Close()
|
||||
},
|
||||
})
|
||||
@ -112,7 +114,6 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy
|
||||
|
||||
const ChainHeadConfidence = 1
|
||||
|
||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||
lc.Append(fx.Hook{
|
||||
OnStart: func(context.Context) error {
|
||||
ev, err := events.NewEventsWithConfidence(ctx, &evapi, ChainHeadConfidence)
|
||||
|
Loading…
Reference in New Issue
Block a user