Merge branch 'release/v1.18.0' into asr/merge-release-into-master
This commit is contained in:
commit
c0b7343e60
@ -941,6 +941,11 @@ workflows:
|
||||
suite: itest-mempool
|
||||
target: "./itests/mempool_test.go"
|
||||
|
||||
- test:
|
||||
name: test-itest-migration_nv17
|
||||
suite: itest-migration_nv17
|
||||
target: "./itests/migration_nv17_test.go"
|
||||
|
||||
- test:
|
||||
name: test-itest-mpool_msg_uuid
|
||||
suite: itest-mpool_msg_uuid
|
||||
@ -981,6 +986,16 @@ workflows:
|
||||
suite: itest-paych_cli
|
||||
target: "./itests/paych_cli_test.go"
|
||||
|
||||
- test:
|
||||
name: test-itest-pending_deal_allocation
|
||||
suite: itest-pending_deal_allocation
|
||||
target: "./itests/pending_deal_allocation_test.go"
|
||||
|
||||
- test:
|
||||
name: test-itest-remove_verifreg_datacap
|
||||
suite: itest-remove_verifreg_datacap
|
||||
target: "./itests/remove_verifreg_datacap_test.go"
|
||||
|
||||
- test:
|
||||
name: test-itest-sdr_upgrade
|
||||
suite: itest-sdr_upgrade
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,7 +9,6 @@
|
||||
/lotus-chainwatch
|
||||
/lotus-shed
|
||||
/lotus-sim
|
||||
/lotus-pond
|
||||
/lotus-townhall
|
||||
/lotus-fountain
|
||||
/lotus-stats
|
||||
@ -21,8 +20,6 @@
|
||||
/docgen-md
|
||||
/docgen-openrpc
|
||||
/bench.json
|
||||
/lotuspond/front/node_modules
|
||||
/lotuspond/front/build
|
||||
/cmd/lotus-townhall/townhall/node_modules
|
||||
/cmd/lotus-townhall/townhall/build
|
||||
/cmd/lotus-townhall/townhall/package-lock.json
|
||||
|
@ -43,9 +43,6 @@ issues:
|
||||
|
||||
exclude-use-default: false
|
||||
exclude-rules:
|
||||
- path: lotuspond
|
||||
linters:
|
||||
- errcheck
|
||||
|
||||
- path: node/modules/lp2p
|
||||
linters:
|
||||
|
89
CHANGELOG.md
89
CHANGELOG.md
@ -1,5 +1,92 @@
|
||||
# Lotus changelog
|
||||
|
||||
# 1.18.0-rc5 / 2022-11-1
|
||||
|
||||
> ⚠️ **Please note that from Lotus v1.17.2&^ will require a Go-version of v1.18.1&^**
|
||||
|
||||
This is the fifth release canadiate of the upcoming MANDATORY release of Lotus that introduces [Filecoin network v17,
|
||||
codenamed the Shark upgrade](https://github.com/filecoin-project/community/discussions/74?sort=top#discussioncomment-3825422). Shark upgrade delivers a wave of protocol refinements that will allow for useful smart contracts to be written using the FVM (eg. programmable markets, lending contracts, etc.).
|
||||
|
||||
A full changelog will be published upon final release.
|
||||
|
||||
The Shark upgrade introduces the following FIPs, delivered in [actors v9](https://github.com/filecoin-project/specs-actors/releases/tag/v9.0.1):
|
||||
- [FIP0029 Beneficiary Address for Storage Providers](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0029.md): step towards better lending market for SP
|
||||
- [FIP0034 Fix PreCommit Deposit Independent of Sector Content](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0034.md): resolves a significant weakening of Filecoin PoRep’s security guarantees
|
||||
- ❗Pre-commit deposit will be calculated as the 20-day projection of expected reward earned by a sector with a sector quality of 10 (i.e. full of verified deals), regardless of sector content. Leave the initial pledge value, due when the sector is proven, unchanged.
|
||||
- [FIP0041 Forward Compatibility for PreCommit](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0041.md): enables a cleaner and easier transition to Programmable Storage Markets
|
||||
- [FIP0044 Standard Message Authentication](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0044.md): enable metadata authentication for user defined actor
|
||||
- [FIP0045 Decoupling Fil+ from Marketplace](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0045.md): DataCap and the QAP it brings is now associated with DATA. DataCap for the data many have terms where anyone who cares about that piece of data may extend the term, which incentives SPs to store the data longer on the network
|
||||
- HUGE step towards user programmable storage market
|
||||
- ⭐️ First Fungible Token Contract - Datacap Actor, on Filecoin! ([fungible token standard](https://github.com/filecoin-project/FIPs/blob/master/FRCs/frc-0046.md), [token contract library](https://github.com/helix-onchain/filecoin/tree/5455f4f831e0f3f20005a9a789623d7ad6dada15/frc46_token))
|
||||
|
||||
|
||||
## Calibration-net Upgrade
|
||||
|
||||
This release candidate sets the calibration-net upgrade at epoch 16800. The bundle the network will be using is [v9.0.3](https://github.com/filecoin-project/builtin-actors/releases/tag/v9.0.3)(located at `build/actors/v9.tar.zst` ). Upon the migration, the manifest CID should be `bafy2bzacedbedgynklc4dgpyxippkxmba2mgtw7ecntoneclsvvl4klqwuyyy`.
|
||||
|
||||
## Snapshots
|
||||
|
||||
The [#fil-infra](https://filecoinproject.slack.com/archives/C039RBG3RPC) team at PL has launched a brand new Lightweight Filecoin Chain Snapshots Service to support chain management needs for the node operators, check [here](https://www.notion.so/pl-strflt/Lightweight-Filecoin-Chain-Snapshots-17e4c386f35c44548f5863afb7b5e024) for the full detail.
|
||||
We are planning to switch [the snapshot service listed in lotus docs](https://lotus.filecoin.io/lotus/manage/chain-management/#lightweight-snapshot) to the new Lightweight Filecoin Chain Snapshots Service by EOY, and deprecate public support of the current snapshots production. We recommend all users to test and switch the new service ASAP, and if you run into any issue, please report them [here](https://github.com/filecoin-project/filecoin-chain-archiver/discussions/new?category=feedback) and the team would be happy to support you! For the main differences between the old & the new service, checkout the FAQ section [here](https://www.notion.so/pl-strflt/Lightweight-Filecoin-Chain-Snapshots-17e4c386f35c44548f5863afb7b5e024)
|
||||
|
||||
## Migration
|
||||
|
||||
(TBC)
|
||||
|
||||
## New Features
|
||||
- Integrate actor v9:
|
||||
- test: Add invariance checks to v17 migration test ([filecoin-project/lotus#9454](https://github.com/filecoin-project/lotus/pull/9454))
|
||||
- Implement and support [FIP0045 Decoupling Fil+ from Marketplace](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0045.md):
|
||||
- fix: state: add datacap actor to actors registry ([filecoin-project/lotus#9476](https://github.com/filecoin-project/lotus/pull/9476))
|
||||
- feat: actors: Integrate builtin-actors changes for FIP-0045 ([filecoin-project/lotus#9355](https://github.com/filecoin-project/lotus/pull/9355))
|
||||
- feat: actors: Integrate datacap actor into lotus (#9348) ([filecoin-project/lotus#9348](https://github.com/filecoin-project/lotus/pull/9348))
|
||||
- feat: cli: Add commands for listing allocations and removing expired allocations ([filecoin-project/lotus#9468](https://github.com/filecoin-project/lotus/pull/9468))
|
||||
- feat: sealing pipeline: Prepare deal assigning logic for FIP-45 ([filecoin-project/lotus#9412](https://github.com/filecoin-project/lotus/pull/9412))
|
||||
- feat: add API methods to get allocations and claims ([filecoin-project/lotus#9437](https://github.com/filecoin-project/lotus/pull/9437))
|
||||
- Implement and support [FIP0029 Beneficiary Address for Storage Providers](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0029.md)
|
||||
- feat: api/cli: beneficiary withdraw api and cli #9296
|
||||
- feat: api/cli: change beneficiary propose and confirm for actors and multisigs. #9307
|
||||
|
||||
## Improvements
|
||||
- feat: wdpost: Add ability to only have single partition per msg for partitions with recovery sectors ([filecoin-project/lotus#9427](https://github.com/filecoin-project/lotus/pull/9427))
|
||||
- feat: API: support typed errors over RPC ([filecoin-project/lotus#9061](https://github.com/filecoin-project/lotus/pull/9061))
|
||||
- feat: refactor: remove NewestNetworkVersion ([filecoin-project/lotus#9351](https://github.com/filecoin-project/lotus/pull/9351))
|
||||
- chore: actors: Allow builtin-actors to return a map of methods (#9342) ([filecoin-project/lotus#9342](https://github.com/filecoin-project/lotus/pull/9342))
|
||||
|
||||
## Dependencies
|
||||
- Update FFI ([filecoin-project/lotus#9484](https://github.com/filecoin-project/lotus/pull/9484))
|
||||
- chore: deps: update go-state-types and builtin-actors for v9 release ([filecoin-project/lotus#9485](https://github.com/filecoin-project/lotus/pull/9485))
|
||||
- deps: backport: #9455 ([filecoin-project/lotus#9463](https://github.com/filecoin-project/lotus/pull/9463))
|
||||
- Deps: Update go-fil-markets to 1.24.0-v17 ([filecoin-project/lotus#9450](https://github.com/filecoin-project/lotus/pull/9450))
|
||||
- github.com/filecoin-project/go-jsonrpc (v0.1.7 -> v0.1.8)
|
||||
- github.com/filecoin-project/go-state-types (v0.1.12-beta -> v0.9.0):
|
||||
|
||||
|
||||
## Others
|
||||
- fix: upgrade: no splash banner for nv17 :( ([filecoin-project/lotus#9486](https://github.com/filecoin-project/lotus/pull/9486))
|
||||
- chore: build: add calib upgrade param for shark ([filecoin-project/lotus#9483](https://github.com/filecoin-project/lotus/pull/9483))
|
||||
- chore: update butterfly artifacts ([filecoin-project/lotus#9467](https://github.com/filecoin-project/lotus/pull/9467))
|
||||
- chore: butterfly: update assets ([filecoin-project/lotus#9462](https://github.com/filecoin-project/lotus/pull/9462))
|
||||
- Delete lotus-pond (#9352) ([filecoin-project/lotus#9352](https://github.com/filecoin-project/lotus/pull/9352))
|
||||
- build: set version to v1.18.0-dev
|
||||
|
||||
## Contributors
|
||||
|
||||
| Contributor | Commits | Lines ± | Files Changed |
|
||||
|-------------|---------|---------|---------------|
|
||||
| Geoff Stuart | 51 | +8677/-19320 | 401 |
|
||||
| Aayush Rajasekaran | 5 | +1452/-166 | 34 |
|
||||
| Łukasz Magiera | 5 | +429/-135 | 45 |
|
||||
| Aayush | 19 | +281/-157 | 72 |
|
||||
| Shrenuj Bansal | 3 | +176/-61 | 10 |
|
||||
| Jennifer Wang | 7 | +19/-18 | 15 |
|
||||
| simlecode | 1 | +5/-5 | 4 |
|
||||
| Kevin Li | 1 | +7/-0 | 1 |
|
||||
| Rod Vagg | 1 | +3/-2 | 2 |
|
||||
| Peter Rabbitson | 1 | +3/-0 | 1 |
|
||||
| ZenGround0 | 1 | +2/-0 | 1 |
|
||||
|
||||
|
||||
# v1.17.2 / 2022-10-05
|
||||
|
||||
This is an OPTIONAL release of Lotus. This feature release introduces new sector number management APIs in Lotus that enables all the Sealing-as-a-Service and Lotus interactions needed to function. The default propagation delay setting for storage providers has also been changed, as well as numerous other features and enhancements. Check out the sub-bullet points in the feature and enhancement section to get a short description about each feature and enhancements.
|
||||
@ -3876,4 +3963,4 @@ We are grateful for every contribution!
|
||||
|
||||
We are very excited to release **lotus** 0.1.0. This is our testnet release. To install lotus and join the testnet, please visit [lotu.sh](lotu.sh). Please file bug reports as [issues](https://github.com/filecoin-project/lotus/issues).
|
||||
|
||||
A huge thank you to all contributors for this testnet release!
|
||||
A huge thank you to all contributors for this testnet release!
|
||||
|
17
Makefile
17
Makefile
@ -162,18 +162,6 @@ benchmarks:
|
||||
@curl -X POST 'http://benchmark.kittyhawk.wtf/benchmark' -d '@bench.json' -u "${benchmark_http_cred}"
|
||||
.PHONY: benchmarks
|
||||
|
||||
lotus-pond: 2k
|
||||
$(GOCC) build -o lotus-pond ./lotuspond
|
||||
.PHONY: lotus-pond
|
||||
BINS+=lotus-pond
|
||||
|
||||
lotus-pond-front:
|
||||
(cd lotuspond/front && npm i && CI=false npm run build)
|
||||
.PHONY: lotus-pond-front
|
||||
|
||||
lotus-pond-app: lotus-pond-front lotus-pond
|
||||
.PHONY: lotus-pond-app
|
||||
|
||||
lotus-fountain:
|
||||
rm -f lotus-fountain
|
||||
$(GOCC) build $(GOFLAGS) -o lotus-fountain ./cmd/lotus-fountain
|
||||
@ -301,9 +289,6 @@ type-gen: api-gen
|
||||
$(GOCC) generate -x ./...
|
||||
goimports -w api/
|
||||
|
||||
method-gen: api-gen
|
||||
(cd ./lotuspond/front/src/chain && $(GOCC) run ./methodgen.go)
|
||||
|
||||
actors-code-gen:
|
||||
$(GOCC) run ./gen/inline-gen . gen/inlinegen-data.json
|
||||
$(GOCC) run ./chain/actors/agen
|
||||
@ -369,7 +354,7 @@ docsgen-openrpc-gateway: docsgen-openrpc-bin
|
||||
fiximports:
|
||||
./scripts/fiximports
|
||||
|
||||
gen: actors-code-gen type-gen method-gen cfgdoc-gen docsgen api-gen circleci bundle-gen fiximports
|
||||
gen: actors-code-gen type-gen cfgdoc-gen docsgen api-gen circleci bundle-gen fiximports
|
||||
@echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO MAKE docsgen-cli"
|
||||
.PHONY: gen
|
||||
|
||||
|
@ -17,9 +17,10 @@ import (
|
||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||
@ -527,6 +528,17 @@ type FullNode interface {
|
||||
StateMarketDeals(context.Context, types.TipSetKey) (map[string]*MarketDeal, error) //perm:read
|
||||
// StateMarketStorageDeal returns information about the indicated deal
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*MarketDeal, error) //perm:read
|
||||
// StateGetAllocationForPendingDeal returns the allocation for a given deal ID of a pending deal. Returns nil if
|
||||
// pending allocation is not found.
|
||||
StateGetAllocationForPendingDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*verifregtypes.Allocation, error) //perm:read
|
||||
// StateGetAllocation returns the allocation for a given address and allocation ID.
|
||||
StateGetAllocation(ctx context.Context, clientAddr address.Address, allocationId verifregtypes.AllocationId, tsk types.TipSetKey) (*verifregtypes.Allocation, error) //perm:read
|
||||
// StateGetAllocations returns the all the allocations for a given client.
|
||||
StateGetAllocations(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error) //perm:read
|
||||
// StateGetClaim returns the claim for a given address and claim ID.
|
||||
StateGetClaim(ctx context.Context, providerAddr address.Address, claimId verifregtypes.ClaimId, tsk types.TipSetKey) (*verifregtypes.Claim, error) //perm:read
|
||||
// StateGetClaims returns the all the claims for a given provider.
|
||||
StateGetClaims(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error) //perm:read
|
||||
// StateComputeDataCID computes DataCID from a set of on-chain deals
|
||||
StateComputeDataCID(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) //perm:read
|
||||
// StateLookupID retrieves the ID address of the given address
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
||||
abi "github.com/filecoin-project/go-state-types/abi"
|
||||
market "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
market "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
)
|
||||
|
||||
var _ = xerrors.Errorf
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
|
||||
@ -137,7 +138,15 @@ func init() {
|
||||
addExample(&textSelExample)
|
||||
addExample(&apiSelExample)
|
||||
addExample(network.ReachabilityPublic)
|
||||
addExample(build.NewestNetworkVersion)
|
||||
addExample(build.TestNetworkVersion)
|
||||
allocationId := verifreg.AllocationId(0)
|
||||
addExample(allocationId)
|
||||
addExample(&allocationId)
|
||||
addExample(map[verifreg.AllocationId]verifreg.Allocation{})
|
||||
claimId := verifreg.ClaimId(0)
|
||||
addExample(claimId)
|
||||
addExample(&claimId)
|
||||
addExample(map[verifreg.ClaimId]verifreg.Claim{})
|
||||
addExample(map[string]int{"name": 42})
|
||||
addExample(map[string]time.Time{"name": time.Unix(1615243938, 0).UTC()})
|
||||
addExample(&types.ExecutionTrace{
|
||||
|
@ -28,6 +28,7 @@ import (
|
||||
big "github.com/filecoin-project/go-state-types/big"
|
||||
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
miner "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
verifreg "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
crypto "github.com/filecoin-project/go-state-types/crypto"
|
||||
dline "github.com/filecoin-project/go-state-types/dline"
|
||||
network "github.com/filecoin-project/go-state-types/network"
|
||||
@ -2482,6 +2483,51 @@ func (mr *MockFullNodeMockRecorder) StateGetActor(arg0, arg1, arg2 interface{})
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetActor", reflect.TypeOf((*MockFullNode)(nil).StateGetActor), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetAllocation mocks base method.
|
||||
func (m *MockFullNode) StateGetAllocation(arg0 context.Context, arg1 address.Address, arg2 verifreg.AllocationId, arg3 types.TipSetKey) (*verifreg.Allocation, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetAllocation", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*verifreg.Allocation)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetAllocation indicates an expected call of StateGetAllocation.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetAllocation(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetAllocation", reflect.TypeOf((*MockFullNode)(nil).StateGetAllocation), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// StateGetAllocationForPendingDeal mocks base method.
|
||||
func (m *MockFullNode) StateGetAllocationForPendingDeal(arg0 context.Context, arg1 abi.DealID, arg2 types.TipSetKey) (*verifreg.Allocation, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetAllocationForPendingDeal", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*verifreg.Allocation)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetAllocationForPendingDeal indicates an expected call of StateGetAllocationForPendingDeal.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetAllocationForPendingDeal(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetAllocationForPendingDeal", reflect.TypeOf((*MockFullNode)(nil).StateGetAllocationForPendingDeal), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetAllocations mocks base method.
|
||||
func (m *MockFullNode) StateGetAllocations(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (map[verifreg.AllocationId]verifreg.Allocation, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetAllocations", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(map[verifreg.AllocationId]verifreg.Allocation)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetAllocations indicates an expected call of StateGetAllocations.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetAllocations(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetAllocations", reflect.TypeOf((*MockFullNode)(nil).StateGetAllocations), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetBeaconEntry mocks base method.
|
||||
func (m *MockFullNode) StateGetBeaconEntry(arg0 context.Context, arg1 abi.ChainEpoch) (*types.BeaconEntry, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -2497,6 +2543,36 @@ func (mr *MockFullNodeMockRecorder) StateGetBeaconEntry(arg0, arg1 interface{})
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetBeaconEntry", reflect.TypeOf((*MockFullNode)(nil).StateGetBeaconEntry), arg0, arg1)
|
||||
}
|
||||
|
||||
// StateGetClaim mocks base method.
|
||||
func (m *MockFullNode) StateGetClaim(arg0 context.Context, arg1 address.Address, arg2 verifreg.ClaimId, arg3 types.TipSetKey) (*verifreg.Claim, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetClaim", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*verifreg.Claim)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetClaim indicates an expected call of StateGetClaim.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetClaim(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetClaim", reflect.TypeOf((*MockFullNode)(nil).StateGetClaim), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// StateGetClaims mocks base method.
|
||||
func (m *MockFullNode) StateGetClaims(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (map[verifreg.ClaimId]verifreg.Claim, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetClaims", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(map[verifreg.ClaimId]verifreg.Claim)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetClaims indicates an expected call of StateGetClaims.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetClaims(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetClaims", reflect.TypeOf((*MockFullNode)(nil).StateGetClaims), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetNetworkParams mocks base method.
|
||||
func (m *MockFullNode) StateGetNetworkParams(arg0 context.Context) (*api.NetworkParams, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -26,6 +26,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||
@ -367,8 +368,18 @@ type FullNodeStruct struct {
|
||||
|
||||
StateGetActor func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*types.Actor, error) `perm:"read"`
|
||||
|
||||
StateGetAllocation func(p0 context.Context, p1 address.Address, p2 verifregtypes.AllocationId, p3 types.TipSetKey) (*verifregtypes.Allocation, error) `perm:"read"`
|
||||
|
||||
StateGetAllocationForPendingDeal func(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*verifregtypes.Allocation, error) `perm:"read"`
|
||||
|
||||
StateGetAllocations func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error) `perm:"read"`
|
||||
|
||||
StateGetBeaconEntry func(p0 context.Context, p1 abi.ChainEpoch) (*types.BeaconEntry, error) `perm:"read"`
|
||||
|
||||
StateGetClaim func(p0 context.Context, p1 address.Address, p2 verifregtypes.ClaimId, p3 types.TipSetKey) (*verifregtypes.Claim, error) `perm:"read"`
|
||||
|
||||
StateGetClaims func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error) `perm:"read"`
|
||||
|
||||
StateGetNetworkParams func(p0 context.Context) (*NetworkParams, error) `perm:"read"`
|
||||
|
||||
StateGetRandomnessFromBeacon func(p0 context.Context, p1 crypto.DomainSeparationTag, p2 abi.ChainEpoch, p3 []byte, p4 types.TipSetKey) (abi.Randomness, error) `perm:"read"`
|
||||
@ -2605,6 +2616,39 @@ func (s *FullNodeStub) StateGetActor(p0 context.Context, p1 address.Address, p2
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetAllocation(p0 context.Context, p1 address.Address, p2 verifregtypes.AllocationId, p3 types.TipSetKey) (*verifregtypes.Allocation, error) {
|
||||
if s.Internal.StateGetAllocation == nil {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetAllocation(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetAllocation(p0 context.Context, p1 address.Address, p2 verifregtypes.AllocationId, p3 types.TipSetKey) (*verifregtypes.Allocation, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetAllocationForPendingDeal(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*verifregtypes.Allocation, error) {
|
||||
if s.Internal.StateGetAllocationForPendingDeal == nil {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetAllocationForPendingDeal(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetAllocationForPendingDeal(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*verifregtypes.Allocation, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetAllocations(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error) {
|
||||
if s.Internal.StateGetAllocations == nil {
|
||||
return *new(map[verifregtypes.AllocationId]verifregtypes.Allocation), ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetAllocations(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetAllocations(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error) {
|
||||
return *new(map[verifregtypes.AllocationId]verifregtypes.Allocation), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetBeaconEntry(p0 context.Context, p1 abi.ChainEpoch) (*types.BeaconEntry, error) {
|
||||
if s.Internal.StateGetBeaconEntry == nil {
|
||||
return nil, ErrNotSupported
|
||||
@ -2616,6 +2660,28 @@ func (s *FullNodeStub) StateGetBeaconEntry(p0 context.Context, p1 abi.ChainEpoch
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetClaim(p0 context.Context, p1 address.Address, p2 verifregtypes.ClaimId, p3 types.TipSetKey) (*verifregtypes.Claim, error) {
|
||||
if s.Internal.StateGetClaim == nil {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetClaim(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetClaim(p0 context.Context, p1 address.Address, p2 verifregtypes.ClaimId, p3 types.TipSetKey) (*verifregtypes.Claim, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetClaims(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error) {
|
||||
if s.Internal.StateGetClaims == nil {
|
||||
return *new(map[verifregtypes.ClaimId]verifregtypes.Claim), ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetClaims(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetClaims(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error) {
|
||||
return *new(map[verifregtypes.ClaimId]verifregtypes.Claim), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetNetworkParams(p0 context.Context) (*NetworkParams, error) {
|
||||
if s.Internal.StateGetNetworkParams == nil {
|
||||
return nil, ErrNotSupported
|
||||
|
@ -331,4 +331,6 @@ type ForkUpgradeParams struct {
|
||||
UpgradeHyperdriveHeight abi.ChainEpoch
|
||||
UpgradeChocolateHeight abi.ChainEpoch
|
||||
UpgradeOhSnapHeight abi.ChainEpoch
|
||||
UpgradeSkyrHeight abi.ChainEpoch
|
||||
UpgradeSharkHeight abi.ChainEpoch
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||
@ -531,6 +532,16 @@ type FullNode interface {
|
||||
StateMarketDeals(context.Context, types.TipSetKey) (map[string]*api.MarketDeal, error) //perm:read
|
||||
// StateMarketStorageDeal returns information about the indicated deal
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error) //perm:read
|
||||
// StateGetAllocationForPendingDeal returns the allocation for a given deal ID of a pending deal.
|
||||
StateGetAllocationForPendingDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*verifregtypes.Allocation, error) //perm:read
|
||||
// StateGetAllocation returns the allocation for a given address and allocation ID.
|
||||
StateGetAllocation(ctx context.Context, clientAddr address.Address, allocationId verifregtypes.AllocationId, tsk types.TipSetKey) (*verifregtypes.Allocation, error) //perm:read
|
||||
// StateGetAllocations returns the all the allocations for a given client.
|
||||
StateGetAllocations(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error) //perm:read
|
||||
// StateGetClaim returns the claim for a given address and claim ID.
|
||||
StateGetClaim(ctx context.Context, providerAddr address.Address, claimId verifregtypes.ClaimId, tsk types.TipSetKey) (*verifregtypes.Claim, error) //perm:read
|
||||
// StateGetClaims returns the all the claims for a given provider.
|
||||
StateGetClaims(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error) //perm:read
|
||||
// StateLookupID retrieves the ID address of the given address
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error) //perm:read
|
||||
// StateAccountKey returns the public key address of the given ID address
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||
@ -277,6 +278,16 @@ type FullNodeStruct struct {
|
||||
|
||||
StateGetActor func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*types.Actor, error) `perm:"read"`
|
||||
|
||||
StateGetAllocation func(p0 context.Context, p1 address.Address, p2 verifregtypes.AllocationId, p3 types.TipSetKey) (*verifregtypes.Allocation, error) `perm:"read"`
|
||||
|
||||
StateGetAllocationForPendingDeal func(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*verifregtypes.Allocation, error) `perm:"read"`
|
||||
|
||||
StateGetAllocations func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error) `perm:"read"`
|
||||
|
||||
StateGetClaim func(p0 context.Context, p1 address.Address, p2 verifregtypes.ClaimId, p3 types.TipSetKey) (*verifregtypes.Claim, error) `perm:"read"`
|
||||
|
||||
StateGetClaims func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error) `perm:"read"`
|
||||
|
||||
StateGetNetworkParams func(p0 context.Context) (*api.NetworkParams, error) `perm:"read"`
|
||||
|
||||
StateGetRandomnessFromBeacon func(p0 context.Context, p1 crypto.DomainSeparationTag, p2 abi.ChainEpoch, p3 []byte, p4 types.TipSetKey) (abi.Randomness, error) `perm:"read"`
|
||||
@ -1793,6 +1804,61 @@ func (s *FullNodeStub) StateGetActor(p0 context.Context, p1 address.Address, p2
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetAllocation(p0 context.Context, p1 address.Address, p2 verifregtypes.AllocationId, p3 types.TipSetKey) (*verifregtypes.Allocation, error) {
|
||||
if s.Internal.StateGetAllocation == nil {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetAllocation(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetAllocation(p0 context.Context, p1 address.Address, p2 verifregtypes.AllocationId, p3 types.TipSetKey) (*verifregtypes.Allocation, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetAllocationForPendingDeal(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*verifregtypes.Allocation, error) {
|
||||
if s.Internal.StateGetAllocationForPendingDeal == nil {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetAllocationForPendingDeal(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetAllocationForPendingDeal(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*verifregtypes.Allocation, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetAllocations(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error) {
|
||||
if s.Internal.StateGetAllocations == nil {
|
||||
return *new(map[verifregtypes.AllocationId]verifregtypes.Allocation), ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetAllocations(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetAllocations(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error) {
|
||||
return *new(map[verifregtypes.AllocationId]verifregtypes.Allocation), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetClaim(p0 context.Context, p1 address.Address, p2 verifregtypes.ClaimId, p3 types.TipSetKey) (*verifregtypes.Claim, error) {
|
||||
if s.Internal.StateGetClaim == nil {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetClaim(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetClaim(p0 context.Context, p1 address.Address, p2 verifregtypes.ClaimId, p3 types.TipSetKey) (*verifregtypes.Claim, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetClaims(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error) {
|
||||
if s.Internal.StateGetClaims == nil {
|
||||
return *new(map[verifregtypes.ClaimId]verifregtypes.Claim), ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateGetClaims(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateGetClaims(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error) {
|
||||
return *new(map[verifregtypes.ClaimId]verifregtypes.Claim), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateGetNetworkParams(p0 context.Context) (*api.NetworkParams, error) {
|
||||
if s.Internal.StateGetNetworkParams == nil {
|
||||
return nil, ErrNotSupported
|
||||
|
@ -28,6 +28,7 @@ import (
|
||||
big "github.com/filecoin-project/go-state-types/big"
|
||||
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
miner "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
verifreg "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
crypto "github.com/filecoin-project/go-state-types/crypto"
|
||||
dline "github.com/filecoin-project/go-state-types/dline"
|
||||
network "github.com/filecoin-project/go-state-types/network"
|
||||
@ -2337,6 +2338,81 @@ func (mr *MockFullNodeMockRecorder) StateGetActor(arg0, arg1, arg2 interface{})
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetActor", reflect.TypeOf((*MockFullNode)(nil).StateGetActor), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetAllocation mocks base method.
|
||||
func (m *MockFullNode) StateGetAllocation(arg0 context.Context, arg1 address.Address, arg2 verifreg.AllocationId, arg3 types.TipSetKey) (*verifreg.Allocation, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetAllocation", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*verifreg.Allocation)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetAllocation indicates an expected call of StateGetAllocation.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetAllocation(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetAllocation", reflect.TypeOf((*MockFullNode)(nil).StateGetAllocation), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// StateGetAllocationForPendingDeal mocks base method.
|
||||
func (m *MockFullNode) StateGetAllocationForPendingDeal(arg0 context.Context, arg1 abi.DealID, arg2 types.TipSetKey) (*verifreg.Allocation, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetAllocationForPendingDeal", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*verifreg.Allocation)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetAllocationForPendingDeal indicates an expected call of StateGetAllocationForPendingDeal.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetAllocationForPendingDeal(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetAllocationForPendingDeal", reflect.TypeOf((*MockFullNode)(nil).StateGetAllocationForPendingDeal), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetAllocations mocks base method.
|
||||
func (m *MockFullNode) StateGetAllocations(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (map[verifreg.AllocationId]verifreg.Allocation, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetAllocations", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(map[verifreg.AllocationId]verifreg.Allocation)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetAllocations indicates an expected call of StateGetAllocations.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetAllocations(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetAllocations", reflect.TypeOf((*MockFullNode)(nil).StateGetAllocations), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetClaim mocks base method.
|
||||
func (m *MockFullNode) StateGetClaim(arg0 context.Context, arg1 address.Address, arg2 verifreg.ClaimId, arg3 types.TipSetKey) (*verifreg.Claim, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetClaim", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*verifreg.Claim)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetClaim indicates an expected call of StateGetClaim.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetClaim(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetClaim", reflect.TypeOf((*MockFullNode)(nil).StateGetClaim), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// StateGetClaims mocks base method.
|
||||
func (m *MockFullNode) StateGetClaims(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (map[verifreg.ClaimId]verifreg.Claim, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetClaims", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(map[verifreg.ClaimId]verifreg.Claim)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetClaims indicates an expected call of StateGetClaims.
|
||||
func (mr *MockFullNodeMockRecorder) StateGetClaims(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetClaims", reflect.TypeOf((*MockFullNode)(nil).StateGetClaims), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetNetworkParams mocks base method.
|
||||
func (m *MockFullNode) StateGetNetworkParams(arg0 context.Context) (*api.NetworkParams, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -192,7 +192,7 @@ func (bs *AutobatchBlockstore) Get(ctx context.Context, c cid.Cid) (block.Block,
|
||||
return v, nil
|
||||
}
|
||||
|
||||
return bs.Get(ctx, c)
|
||||
return nil, ipld.ErrNotFound{Cid: c}
|
||||
}
|
||||
|
||||
func (bs *AutobatchBlockstore) DeleteBlock(context.Context, cid.Cid) error {
|
||||
|
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWHc8xB2S1wFeF9ar9bVdXoEEaBPGLqfKxVQH55c4nNmxs
|
||||
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWPcNcwS3cKarWrN7MfANWNpzXmZA9Ag6eH9FHFdLQ3LFQ
|
||||
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWKeDMuJbouvypr1nL2qRruhNVXzv4QiLsZRh6gnvLkc7p
|
||||
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWSsACNHLGoJbPqeitNY7tom19Nxq8x5ag36eTwmgcAeLo
|
||||
|
@ -1,4 +1,4 @@
|
||||
/dns4/bootstrap-0.calibration.fildev.network/tcp/1347/p2p/12D3KooWJkikQQkxS58spo76BYzFt4fotaT5NpV2zngvrqm4u5ow
|
||||
/dns4/bootstrap-1.calibration.fildev.network/tcp/1347/p2p/12D3KooWLce5FDHR4EX4CrYavphA5xS3uDsX6aoowXh5tzDUxJav
|
||||
/dns4/bootstrap-2.calibration.fildev.network/tcp/1347/p2p/12D3KooWA9hFfQG9GjP6bHeuQQbMD3FDtZLdW1NayxKXUT26PQZu
|
||||
/dns4/bootstrap-3.calibration.fildev.network/tcp/1347/p2p/12D3KooWMHDi3LVTFG8Szqogt7RkNXvonbQYqSazxBx41A5aeuVz
|
||||
/dns4/bootstrap-0.calibration.fildev.network/tcp/1347/p2p/12D3KooWCi2w8U4DDB9xqrejb5KYHaQv2iA2AJJ6uzG3iQxNLBMy
|
||||
/dns4/bootstrap-1.calibration.fildev.network/tcp/1347/p2p/12D3KooWDTayrBojBn9jWNNUih4nNQQBGJD7Zo3gQCKgBkUsS6dp
|
||||
/dns4/bootstrap-2.calibration.fildev.network/tcp/1347/p2p/12D3KooWNRxTHUn8bf7jz1KEUPMc2dMgGfa4f8ZJTsquVSn3vHCG
|
||||
/dns4/bootstrap-3.calibration.fildev.network/tcp/1347/p2p/12D3KooWFWUqE9jgXvcKHWieYs9nhyp6NF4ftwLGAHm4sCv73jjK
|
||||
|
@ -26,19 +26,20 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
}, {
|
||||
Network: "butterflynet",
|
||||
Version: 9,
|
||||
ManifestCid: MustParseCid("bafy2bzacebor5miojgkvov7gtiirg7hqxgm54x3hxytbho3qloqryg2r67qaq"),
|
||||
ManifestCid: MustParseCid("bafy2bzacec35by4erhcdgcsgzp7yb3j57utydlxxfc73m3k5pep67ehvvyv6i"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecd7kgfzbyu4sylskgf7wjqabo43y3d7xqgvz7r67pzr3ovn3sj7y"),
|
||||
"cron": MustParseCid("bafk2bzacea6dc2a6skmp7saa43dcofp7zvtklvya75bai2k4k6qnkpcfzklug"),
|
||||
"init": MustParseCid("bafk2bzacean5v7lbsspxmdkcwhac44sk332uwyfteibtxyhgoeabwbzbh736c"),
|
||||
"multisig": MustParseCid("bafk2bzacea43lypvbof5kwnk2flzrwdrqqvzypom5xyheeuaab6dmuiafngae"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacecsdimcgztl4tfodnqc35jojoy4mzaqqidubialqmqaa3zpv4h3rw"),
|
||||
"reward": MustParseCid("bafk2bzacedy3utj67mewe7rpieaex3sf7qxfkgiwtlgg4wlqyl74la65njbn2"),
|
||||
"storagemarket": MustParseCid("bafk2bzacec4xpazf3l2p5qkknjsku2sd3skqevk7gxryumbelwhfbs7mgjnpa"),
|
||||
"storageminer": MustParseCid("bafk2bzaceb5scwcdcou56vyhxq3c7vcefjau44v2h6nvsus45wqopt3hadzae"),
|
||||
"storagepower": MustParseCid("bafk2bzacebxl4ssugntkckifkq6sydczcas463bmonwi2m5hddurzzcukdzyg"),
|
||||
"system": MustParseCid("bafk2bzacedtw2ebtl3uccbqfcm6jd7teinlpktcglopuaxa6ev334jhs46hso"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceds62ys6rpbtjjsemohalxnkr3jtqhflifabn3xlhpi45mvi757po"),
|
||||
"account": MustParseCid("bafk2bzaceajsdln7v4chxqoukiw7lxw6aexg5qdsaex2hgelz2sbu24iblhzg"),
|
||||
"cron": MustParseCid("bafk2bzacecgrwmgnqhybn3l23uvwf2n2vrcfjrprfzgd44uxers2pgr5mhsue"),
|
||||
"datacap": MustParseCid("bafk2bzacebyier2ceh27acbrq2ccv4efvzotl6qntnlrxdsrik6i4tembz6qw"),
|
||||
"init": MustParseCid("bafk2bzaceberhto43wnf4pklkd4c7d36kzslngyzyms4op7shxuswv3dtvfxu"),
|
||||
"multisig": MustParseCid("bafk2bzaceaclpbrhoqdruvsuqqgknvy2k5dywzmjoehk4uarce3uvt3w2rewu"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacedzp56g5cg73oilloak3kf7u667rdkd5pgnhe2cljmr3o7ykcrzuk"),
|
||||
"reward": MustParseCid("bafk2bzacebczbwfbbi6mvppbjcozatasjiaohvjjiqcy65ccuuyyw3xiixhk2"),
|
||||
"storagemarket": MustParseCid("bafk2bzaceawqexy6t2ybzh3jjwhbs7icbg5vqnedbbge4e4r4pfp7spkcadsu"),
|
||||
"storageminer": MustParseCid("bafk2bzacearemd7pn2jj26fdtqd4di27lfhpng3vp5chepm7qnmdzgiqr6wfi"),
|
||||
"storagepower": MustParseCid("bafk2bzaceddc7fiaxfobfegqaobf5xinjgmhsa5iu4yi6klvc3jmjimcdvgyg"),
|
||||
"system": MustParseCid("bafk2bzacedylltr57b2n6zpadh4i2c2kis4fzzvhao3kgvfaggrrbqyacew7q"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecjkesz766626ab4svnzpq3jfs26a75vfktlfaku5fjdao2eyiqyq"),
|
||||
},
|
||||
}, {
|
||||
Network: "calibrationnet",
|
||||
@ -60,19 +61,20 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
}, {
|
||||
Network: "calibrationnet",
|
||||
Version: 9,
|
||||
ManifestCid: MustParseCid("bafy2bzacectdlm3f5m252s6ken3ncnndvwj4a7hqyev2m7iba4lubkt72r2rm"),
|
||||
ManifestCid: MustParseCid("bafy2bzacedbedgynklc4dgpyxippkxmba2mgtw7ecntoneclsvvl4klqwuyyy"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzaceag3pkyy5youg2i4qyrhqms2jobycddkhd4eebtlkeqj4wu4sw7ji"),
|
||||
"cron": MustParseCid("bafk2bzaceaii7ryi4sjqqrrwyqaxulzqgiigkjqfa3f3ghhisleaqrinyal4o"),
|
||||
"init": MustParseCid("bafk2bzacebpi37hcleu7cpqgs5zdg4zsw7qpydt5w25jny2dyyscsyidquvcw"),
|
||||
"multisig": MustParseCid("bafk2bzacebt522zme5n3q25mecukjvomfyyzduxormgnprl73mdb5ekda2ywy"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacebdxmtmloxfyhxkoj4p4ze5gojqohvqjmdmv2t54xyrgfnjs52p26"),
|
||||
"reward": MustParseCid("bafk2bzacebt7vup2pdxie67goc5ourij32z4ofejlrbv7styzm47ytvmmxx5a"),
|
||||
"storagemarket": MustParseCid("bafk2bzacebeohybortft5jiihfvfly5oiygvf2hulnuif7vivklind32hbr3c"),
|
||||
"storageminer": MustParseCid("bafk2bzaceallhekg5fhibexjurqcwrx6uzacbyq5eofic6jbdiu3vhepq6xsw"),
|
||||
"storagepower": MustParseCid("bafk2bzaceassqqdljvblivbcrkv62a36gxjwf7dmkgez6ezq2oydx3dv2b3z2"),
|
||||
"system": MustParseCid("bafk2bzacebxsecqifqvqxavnmsuwigmnc5rcuxoezspmykeqinkbgrkfukmgs"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacedrmxfk5qifi7ujcb7mm73mwoy5e7nbndxhbqauuyol6cunf6popm"),
|
||||
"account": MustParseCid("bafk2bzaceavfgpiw6whqigmskk74z4blm22nwjfnzxb4unlqz2e4wg3c5ujpw"),
|
||||
"cron": MustParseCid("bafk2bzaceb7hxmudhvkizszbmmf2ur2qfnfxfkok3xmbrlifylx6huw4bb3s4"),
|
||||
"datacap": MustParseCid("bafk2bzaceanmwcfjfj65xy275rrfqqgoblnuqirdg6zwhc6qhbfhpphomvceu"),
|
||||
"init": MustParseCid("bafk2bzaceczqxpivlxifdo5ohr2rx5ny4uyvssm6tkf7am357xm47x472yxu2"),
|
||||
"multisig": MustParseCid("bafk2bzacec6gmi7ucukr3bk67akaxwngohw3lsg3obvdazhmfhdzflkszk3tg"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacec4kg3bfjtssvv2b4wizlbdk3pdtrg5aknzgeb3a6rmksgurpynca"),
|
||||
"reward": MustParseCid("bafk2bzacebpptqhcw6mcwdj576dgpryapdd2zfexxvqzlh3aoc24mabwgmcss"),
|
||||
"storagemarket": MustParseCid("bafk2bzacebkfcnc27d3agm2bhzzbvvtbqahmvy2b2nf5xyj4aoxehow3bules"),
|
||||
"storageminer": MustParseCid("bafk2bzacebz4na3nq4gmumghegtkaofrv4nffiihd7sxntrryfneusqkuqodm"),
|
||||
"storagepower": MustParseCid("bafk2bzaceburxajojmywawjudovqvigmos4dlu4ifdikogumhso2ca2ccaleo"),
|
||||
"system": MustParseCid("bafk2bzaceaue3nzucbom3tcclgyaahy3iwvbqejsxrohiquakvvsjgbw3shac"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacebh7dj6j7yi5vadh7lgqjtq42qi2uq4n6zy2g5vjeathacwn2tscu"),
|
||||
},
|
||||
}, {
|
||||
Network: "caterpillarnet",
|
||||
@ -94,19 +96,20 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
}, {
|
||||
Network: "caterpillarnet",
|
||||
Version: 9,
|
||||
ManifestCid: MustParseCid("bafy2bzaceaknnblpmv3qqeqlgdycpps2vkgbgkflugbqz47k6zwrqte54hqy2"),
|
||||
ManifestCid: MustParseCid("bafy2bzacedo6tmei6rzjaaddh2yffe5xgr6w4smnadofjhomc3saiv3ubplqe"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzaceckajm6tcdpvfsrvagduv6cuefuo3modkpfupum6ibspulgvporrw"),
|
||||
"cron": MustParseCid("bafk2bzacea74zhlldpihms2ohp3wvefojifvudbblmeju3izwrpcpxemp43fo"),
|
||||
"init": MustParseCid("bafk2bzacea5nqh4l76vm4ys6vgrqyt77tquk66il3w5ho3zxugka22fipdkdw"),
|
||||
"multisig": MustParseCid("bafk2bzacea3ftmx2roav4psh63r5n2sol6x3kwpmfwe473pexhj6lg7pruu2k"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacea2gqhnycejjfuinywoz4j7pmsvxn3i2y5epdx5vqpo23phx6jeac"),
|
||||
"reward": MustParseCid("bafk2bzaceamdxogvus7zawqtju3vesmj6ffpf3ta6dlwvvstyfbf23sow2tes"),
|
||||
"storagemarket": MustParseCid("bafk2bzacecvh6qhfe3ityehpibxmmw43l7recwtru3l4n3yrdj5bmnv4efnrc"),
|
||||
"storageminer": MustParseCid("bafk2bzaced6ya5wlvplkvnvmhuc2uh5zq7oft6pyyoouwouuoreuk6grn6vsw"),
|
||||
"storagepower": MustParseCid("bafk2bzacedbfoblr65vbqwx37cym6v3zhbgrau46vma4c2lbh6toz6q5dyrtc"),
|
||||
"system": MustParseCid("bafk2bzaced7z2lu5hp4qpsesbmubq3chrad3sl6kgveldafksh4w252ijjaw2"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacec6fdlcvlnaiktdptogae3bgofhzo24lhn4hs6rsa2zbnknfpsct6"),
|
||||
"account": MustParseCid("bafk2bzacebb32htqlwcwiotyvtbeehfmluu2ubjnepo57gelelwitudrstwba"),
|
||||
"cron": MustParseCid("bafk2bzaceatvkww7soy4a6onu6xhe7pzkdzkqw46ywuu56yv3ncl76xpotzqu"),
|
||||
"datacap": MustParseCid("bafk2bzaced57nk7i7w6qmbosy4gd6atme6yppesdgjllou6nppbti5yw6glcg"),
|
||||
"init": MustParseCid("bafk2bzacedtoputbtz573ytg4yo5wbbg7fbhrzplux4uknxrb2jarifcuxxou"),
|
||||
"multisig": MustParseCid("bafk2bzacec22z3xz45mbwgtliwkj7ngc43bervnt557c6dqsg6aesatpd5isy"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacedym7xnaxr2igfq72rttj2adqyqqfxk3j4qovp2bcwqk5paoe4t7e"),
|
||||
"reward": MustParseCid("bafk2bzacedemsmbmbtk5toprmm6jivjq3wkxumavc65vpvm6ngspgjfkth7z6"),
|
||||
"storagemarket": MustParseCid("bafk2bzacecb53mmklf4rbv263dvufqj3nsf7mi6zk2tjlgwmzbr633kw3ds3w"),
|
||||
"storageminer": MustParseCid("bafk2bzacea3wljpn2ixgnd4lovr6yckiwd652ytcrz5amgj47lg6drjhgggqa"),
|
||||
"storagepower": MustParseCid("bafk2bzaceakvohgvovpeldb6hjfg7readxo37a5h4qauis4nz6pte7mcll6c2"),
|
||||
"system": MustParseCid("bafk2bzacecisuqj2ln7ep72xaejvs2lrgh2logc7retxxpd3qvobymwyz7bxo"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacebyjosiripwqyf56yhjfs5hg26mch7totsqth4rgpt5j32hqg6ric"),
|
||||
},
|
||||
}, {
|
||||
Network: "devnet",
|
||||
@ -128,19 +131,20 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
}, {
|
||||
Network: "devnet",
|
||||
Version: 9,
|
||||
ManifestCid: MustParseCid("bafy2bzacecogd7hb3dap7d4abyikdgt6b2zs46s4qyilsgxk4rsienbvvstp4"),
|
||||
ManifestCid: MustParseCid("bafy2bzacedozk3jh2j4nobqotkbofodq4chbrabioxbfrygpldgoxs3zwgggk"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecrgqcwn2j6c44tnfx32om4upg56b7gdwslfgeuyfsm6iwkiuhm2w"),
|
||||
"cron": MustParseCid("bafk2bzaceblepwha5i5cpac37arpcxjcebm5k7p4e5ed7bwcq7ie6fryxgno4"),
|
||||
"init": MustParseCid("bafk2bzacebjr3xwsdzfie47rtffibt3irr7a5qqstt7fsbwnolzz3z6oy5frw"),
|
||||
"multisig": MustParseCid("bafk2bzacec66uf5u7o7q3u3pufrtufya6ntwrreysrwwlzqdjbtj36ajuamz4"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacebouukxeahifxfoymmvibngg6abftd7luiq5x2c7zxulvqyerwoeg"),
|
||||
"reward": MustParseCid("bafk2bzacecj4pry2xb6w4kd4xxvs3dqd2endfynnwrkf66zakmt376tafy6ym"),
|
||||
"storagemarket": MustParseCid("bafk2bzacecmij6fgaasgu7zm354fltmvhwmepzwadhl4euxhb64yg4pgfkxgw"),
|
||||
"storageminer": MustParseCid("bafk2bzaceb5qyhchlvqvcq5cvrc5tuyjrrz6qkgbbxx4vr4wxhtoa4bfp56bg"),
|
||||
"storagepower": MustParseCid("bafk2bzaced377v52henedhmudi2isuxe73mp2lrv2zyyxfp4r4uppz3sy2ipw"),
|
||||
"system": MustParseCid("bafk2bzacebb3gdmg2fqexijivo7dkxj6g6gu7ou2jsw6opszr5gfmwt4fvorw"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacec5xfb3a56mlclymhvs2br3qzx7sagqda4dvl4xz3fgiymkkbz5tk"),
|
||||
"account": MustParseCid("bafk2bzaced5llqnqqhypolyuogz3h2wjomugqkrhyhocvly3aoib4c5xiush6"),
|
||||
"cron": MustParseCid("bafk2bzaceahwdt32ji53mo5yz6imvztz3s3g2ra5uz3jdfa77j7hqcnq6r4l2"),
|
||||
"datacap": MustParseCid("bafk2bzaceabcxoy5iscdierasorjoj6xzqgnnb5pmrr7prkuibw4yggx3v2d2"),
|
||||
"init": MustParseCid("bafk2bzaceastwn42kqyztz7uzej7l4lemp5nakqqsfvksry7k75q5ombhprme"),
|
||||
"multisig": MustParseCid("bafk2bzacebeiygkjupkpfxcrsidci4bvn6afkvx4lsj3ut3ywhsj654pzfgk4"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacedhsdoo4ww47rm44pizu5qqpho753cizzbbvnd5yz3nm3347su5cy"),
|
||||
"reward": MustParseCid("bafk2bzacebzqvisqe3iaodtxq7l2lgzwfkxznrnp676ddpllqcpvuae5i33le"),
|
||||
"storagemarket": MustParseCid("bafk2bzaceduauegz4nniegh667btjhg2anipwpxeb664s4ossq2ifvuqwqlso"),
|
||||
"storageminer": MustParseCid("bafk2bzacec23wjdmbm5pt6pqsbjb3w6j7vyrolijz2mysvp6clllfgpmhb6ge"),
|
||||
"storagepower": MustParseCid("bafk2bzacebnyywv46n2ghg62inllwpmnyuwtoz57fn5lpgpf436mahajg4qrg"),
|
||||
"system": MustParseCid("bafk2bzacebgafb6h2o2g5whrujc2uvsttrussyc5t56rvhrjqkqhzdu4jopwa"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacednorhcy446agy7ecpmfms2u4aoa3mj2eqomffuoerbik5yavrxyi"),
|
||||
},
|
||||
}, {
|
||||
Network: "mainnet",
|
||||
@ -162,19 +166,20 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
}, {
|
||||
Network: "mainnet",
|
||||
Version: 9,
|
||||
ManifestCid: MustParseCid("bafy2bzaceb7nrn4icde3yt7s2kpllliodblq2i3iuslh3l6swgjqyusual72u"),
|
||||
ManifestCid: MustParseCid("bafy2bzaceb6j6666h36xnhksu3ww4kxb6e25niayfgkdnifaqi6m6ooc66i6i"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacedchhykcbvptlrnts62xa2h7fewsyvb4imktudll7tbogkwj4ccpy"),
|
||||
"cron": MustParseCid("bafk2bzaced2e2ivtglevf5tnqay6eqdl3m5ilx4az766ojbhmy2kbxmkogbni"),
|
||||
"init": MustParseCid("bafk2bzaceapzqn6e3cfpf4ntln4dkyrqe5egygmjczefduy7fuabxh2npqq6o"),
|
||||
"multisig": MustParseCid("bafk2bzacebxihi4x4lzelmmdtxiz5gub3cjgthrgxuj5mxl2ihxaz6qhp5qbu"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacecv34ahs6k552won2vj4r62gur5i7inqnycg7y4dg27ktlq76stlk"),
|
||||
"reward": MustParseCid("bafk2bzacea4er76nlnzz3muuvdxs4dbygejztezanpafi42idj57n75sumu7o"),
|
||||
"storagemarket": MustParseCid("bafk2bzacedd3pjxcwgxfli4a5udw3ebbo4gom43epizbldvto7ovduqk6udj6"),
|
||||
"storageminer": MustParseCid("bafk2bzacebtuopxp2464fxulzfyr4iw7bj4pelfxlatudaf6q5qtahokeo3lo"),
|
||||
"storagepower": MustParseCid("bafk2bzacec3dmcwtizgy6qhxg6fgb4ykc2pamxxh2n5oyeqvebjf3ikzd2sui"),
|
||||
"system": MustParseCid("bafk2bzacecrm36gf2gusruvhfc6ukf36qflsr5pdbquvfyysprdyudsatoufm"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceah3mwu6tb4jmffohpoz6nyoxpgno2hmxz455rycw4o2hrat3yg3u"),
|
||||
"account": MustParseCid("bafk2bzacect2p7urje3pylrrrjy3tngn6yaih4gtzauuatf2jllk3ksgfiw2y"),
|
||||
"cron": MustParseCid("bafk2bzacebcec3lffmos3nawm5cvwehssxeqwxixoyyfvejy7viszzsxzyu26"),
|
||||
"datacap": MustParseCid("bafk2bzacebb6uy2ys7tapekmtj7apnjg7oyj4ia5t7tlkvbmwtxwv74lb2pug"),
|
||||
"init": MustParseCid("bafk2bzacebtdq4zyuxk2fzbdkva6kc4mx75mkbfmldplfntayhbl5wkqou33i"),
|
||||
"multisig": MustParseCid("bafk2bzacec4va3nmugyqjqrs3lqyr2ij67jhjia5frvx7omnh2isha6abxzya"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacebhdvjbjcgupklddfavzef4e4gnkt3xk3rbmgfmk7xhecszhfxeds"),
|
||||
"reward": MustParseCid("bafk2bzacebezgbbmcm2gbcqwisus5fjvpj7hhmu5ubd37phuku3hmkfulxm2o"),
|
||||
"storagemarket": MustParseCid("bafk2bzacec3j7p6gklk64stax5px3xxd7hdtejaepnd4nw7s2adihde6emkcu"),
|
||||
"storageminer": MustParseCid("bafk2bzacedyux5hlrildwutvvjdcsvjtwsoc5xnqdjl73ouiukgklekeuyfl4"),
|
||||
"storagepower": MustParseCid("bafk2bzacedsetphfajgne4qy3vdrpyd6ekcmtfs2zkjut4r34cvnuoqemdrtw"),
|
||||
"system": MustParseCid("bafk2bzaceagvlo2jtahj7dloshrmwfulrd6e2izqev32qm46eumf754weec6c"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecf3yodlyudzukumehbuabgqljyhjt5ifiv4vetcfohnvsxzynwga"),
|
||||
},
|
||||
}, {
|
||||
Network: "testing",
|
||||
@ -196,19 +201,20 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
}, {
|
||||
Network: "testing",
|
||||
Version: 9,
|
||||
ManifestCid: MustParseCid("bafy2bzaceas5fka4rtyvnqwvvwdi2qqhbnu7hnyz37chhpflh4rdbwnoupols"),
|
||||
ManifestCid: MustParseCid("bafy2bzacecnnrmekqw2xvud46g3vo6x26cogh3ydgljqajlxqxzzbuxsjlwjm"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecsmbmd42fsg33wd3u5vxyp4n4a4mac423fduauishjhiyv2bqz7w"),
|
||||
"cron": MustParseCid("bafk2bzacedajlwnkefucjxzasudkfojrz3bnhnnirebvacxrtly5y2kfb7qiu"),
|
||||
"init": MustParseCid("bafk2bzaceat7cvf7s2vnmqoldzafkpjygi6wv3sfnclenfbahk4htsgu4aqsa"),
|
||||
"multisig": MustParseCid("bafk2bzacebh7pwb7eoyigwgjs2r32ebtxwbwgxqd4cvou4katq4axmhd7lxsq"),
|
||||
"paymentchannel": MustParseCid("bafk2bzaceb6nbmyo2girdpnwywby7yzelx7g6s4snbq3kb3mmd2pp33qefkww"),
|
||||
"reward": MustParseCid("bafk2bzacedttgmuddtlrp2ie4i2vzuueury455knof5muqtqlslscxrk7ucl6"),
|
||||
"storagemarket": MustParseCid("bafk2bzacebjtz7fg5n2sm4wg464fyg5vcvux5hqrsdwki675hsquhh3rpe5rg"),
|
||||
"storageminer": MustParseCid("bafk2bzacea2c2genvtsktr3f6yjlny57gwqyt5dbqrfws56wn5ssyl2tevjjg"),
|
||||
"storagepower": MustParseCid("bafk2bzaceasmr5xc3c7jgihqcb5pdv557kfor72wlmzmh4syvedknelebhsve"),
|
||||
"system": MustParseCid("bafk2bzaceabj3whuno364pjqn7sphwquiqpl2w5le6aa6quwytgyxshvelcwq"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceamn6gzihkytyqym4dqs7wqmo2fz6kpge4tphumvutsp2ys4bwaha"),
|
||||
"account": MustParseCid("bafk2bzaceaiebfiuu76zoywzltelio2zuvsavirka27ur6kspn7scvcl5cuiy"),
|
||||
"cron": MustParseCid("bafk2bzacecla36w3tbwap5jgdtooxsud25mdpc75kgtjs34mi4xhwygph2gki"),
|
||||
"datacap": MustParseCid("bafk2bzaced5h3ct6i7oqpyimkj3hwdywmux5tslu5vs2ywbzruqmxjtqczygs"),
|
||||
"init": MustParseCid("bafk2bzaceauxqpspnvui7dryuvfgzoogatbkbahp4ovaih734blwi4bassnlm"),
|
||||
"multisig": MustParseCid("bafk2bzaceddfagxfpsihjxq7yt4ditv2tcoou5w4hzbsapadlw3v44cxfcqpi"),
|
||||
"paymentchannel": MustParseCid("bafk2bzaced4nc4ofrbqevpwrt7fnf3beshi5ccrecq3zojt2sxgrkz7ebnbh4"),
|
||||
"reward": MustParseCid("bafk2bzacedxleepeg4ei3jnayzcfz6shi25rrvoyhr6fxmkdezq4owrazi7rq"),
|
||||
"storagemarket": MustParseCid("bafk2bzaceakqcjpppg3exrr7dru7jglvno2xyw4hsuebxay4lvrzvmwmv5kvu"),
|
||||
"storageminer": MustParseCid("bafk2bzacealfvphicwnysmmyyerseppyvydy2reisvbft46vdprp2lnfvlgqc"),
|
||||
"storagepower": MustParseCid("bafk2bzaceageil5b5mr5uwo6vqs4nnnmpiwe3fkjffzyngcicuu7gruuwapjm"),
|
||||
"system": MustParseCid("bafk2bzacedo4pu3iwx2gu72hinsstpiokhl5iicnb3rumzffsnhy7zhmnxhyy"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceatmqip2o3ausbntvdhj7yemu6hb3b5yqv6hm42gylbbmz7geocpm"),
|
||||
},
|
||||
}, {
|
||||
Network: "testing-fake-proofs",
|
||||
@ -230,18 +236,19 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
}, {
|
||||
Network: "testing-fake-proofs",
|
||||
Version: 9,
|
||||
ManifestCid: MustParseCid("bafy2bzacebr7bo4shotwq4cct3ablt6hlcozg4h2e52av2q3md5di7sibrqj2"),
|
||||
ManifestCid: MustParseCid("bafy2bzacecql2gj2tri4fnbznmldue73qzt6zszvugw4exd64mwb52zrhv7k2"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecsmbmd42fsg33wd3u5vxyp4n4a4mac423fduauishjhiyv2bqz7w"),
|
||||
"cron": MustParseCid("bafk2bzacedajlwnkefucjxzasudkfojrz3bnhnnirebvacxrtly5y2kfb7qiu"),
|
||||
"init": MustParseCid("bafk2bzaceat7cvf7s2vnmqoldzafkpjygi6wv3sfnclenfbahk4htsgu4aqsa"),
|
||||
"multisig": MustParseCid("bafk2bzacebh7pwb7eoyigwgjs2r32ebtxwbwgxqd4cvou4katq4axmhd7lxsq"),
|
||||
"paymentchannel": MustParseCid("bafk2bzaceb6nbmyo2girdpnwywby7yzelx7g6s4snbq3kb3mmd2pp33qefkww"),
|
||||
"reward": MustParseCid("bafk2bzacedttgmuddtlrp2ie4i2vzuueury455knof5muqtqlslscxrk7ucl6"),
|
||||
"storagemarket": MustParseCid("bafk2bzacebjtz7fg5n2sm4wg464fyg5vcvux5hqrsdwki675hsquhh3rpe5rg"),
|
||||
"storageminer": MustParseCid("bafk2bzacedaxvye4reegpy2fecjuzwt4nly2myhplnvkzhssquo2jjw7vfmuy"),
|
||||
"storagepower": MustParseCid("bafk2bzaceaoteuuvld3bzy3t3kzjp5iabgkvxjc5cxq2ziwankpxqqixkqqjw"),
|
||||
"system": MustParseCid("bafk2bzaceabj3whuno364pjqn7sphwquiqpl2w5le6aa6quwytgyxshvelcwq"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceamn6gzihkytyqym4dqs7wqmo2fz6kpge4tphumvutsp2ys4bwaha"),
|
||||
"account": MustParseCid("bafk2bzaceaiebfiuu76zoywzltelio2zuvsavirka27ur6kspn7scvcl5cuiy"),
|
||||
"cron": MustParseCid("bafk2bzacecla36w3tbwap5jgdtooxsud25mdpc75kgtjs34mi4xhwygph2gki"),
|
||||
"datacap": MustParseCid("bafk2bzaced5h3ct6i7oqpyimkj3hwdywmux5tslu5vs2ywbzruqmxjtqczygs"),
|
||||
"init": MustParseCid("bafk2bzaceauxqpspnvui7dryuvfgzoogatbkbahp4ovaih734blwi4bassnlm"),
|
||||
"multisig": MustParseCid("bafk2bzaceddfagxfpsihjxq7yt4ditv2tcoou5w4hzbsapadlw3v44cxfcqpi"),
|
||||
"paymentchannel": MustParseCid("bafk2bzaced4nc4ofrbqevpwrt7fnf3beshi5ccrecq3zojt2sxgrkz7ebnbh4"),
|
||||
"reward": MustParseCid("bafk2bzacedxleepeg4ei3jnayzcfz6shi25rrvoyhr6fxmkdezq4owrazi7rq"),
|
||||
"storagemarket": MustParseCid("bafk2bzaceakqcjpppg3exrr7dru7jglvno2xyw4hsuebxay4lvrzvmwmv5kvu"),
|
||||
"storageminer": MustParseCid("bafk2bzaceab3cjrwwwfemyc5lw73w6tibpgxtx3wuzjhami6tvhcvetygdm7m"),
|
||||
"storagepower": MustParseCid("bafk2bzaceafemwhsy3e7ueqsrn3f7n53vdqkvfbig3hgbw7eohsefnfvgq7yc"),
|
||||
"system": MustParseCid("bafk2bzacedo4pu3iwx2gu72hinsstpiokhl5iicnb3rumzffsnhy7zhmnxhyy"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceatmqip2o3ausbntvdhj7yemu6hb3b5yqv6hm42gylbbmz7geocpm"),
|
||||
},
|
||||
}}
|
||||
|
@ -25,7 +25,7 @@ func TestRegistration(t *testing.T) {
|
||||
require.True(t, found)
|
||||
require.True(t, manifestCid.Defined())
|
||||
|
||||
for _, key := range actors.GetBuiltinActorsKeys() {
|
||||
for _, key := range actors.GetBuiltinActorsKeys(actorstypes.Version8) {
|
||||
actorCid, found := actors.GetActorCodeID(actorstypes.Version8, key)
|
||||
require.True(t, found)
|
||||
name, version, found := actors.GetActorMetaByCode(actorCid)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -56,7 +56,7 @@ var UpgradeOhSnapHeight = abi.ChainEpoch(-18)
|
||||
|
||||
var UpgradeSkyrHeight = abi.ChainEpoch(-19)
|
||||
|
||||
var UpgradeV17Height = abi.ChainEpoch(99999999999999)
|
||||
var UpgradeSharkHeight = abi.ChainEpoch(100)
|
||||
|
||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
@ -109,7 +109,7 @@ func init() {
|
||||
UpgradeChocolateHeight = getUpgradeHeight("LOTUS_CHOCOLATE_HEIGHT", UpgradeChocolateHeight)
|
||||
UpgradeOhSnapHeight = getUpgradeHeight("LOTUS_OHSNAP_HEIGHT", UpgradeOhSnapHeight)
|
||||
UpgradeSkyrHeight = getUpgradeHeight("LOTUS_SKYR_HEIGHT", UpgradeSkyrHeight)
|
||||
UpgradeV17Height = getUpgradeHeight("LOTUS_V17_HEIGHT", UpgradeV17Height)
|
||||
UpgradeSharkHeight = getUpgradeHeight("LOTUS_SHARK_HEIGHT", UpgradeSharkHeight)
|
||||
|
||||
BuildType |= Build2k
|
||||
|
||||
|
@ -49,7 +49,7 @@ const UpgradeHyperdriveHeight = -16
|
||||
const UpgradeChocolateHeight = -17
|
||||
const UpgradeOhSnapHeight = -18
|
||||
const UpgradeSkyrHeight = -19
|
||||
const UpgradeV17Height = abi.ChainEpoch(99999999999999)
|
||||
const UpgradeSharkHeight = abi.ChainEpoch(600)
|
||||
|
||||
var SupportedProofTypes = []abi.RegisteredSealProof{
|
||||
abi.RegisteredSealProof_StackedDrg512MiBV1,
|
||||
|
@ -61,15 +61,13 @@ const UpgradeTurboHeight = 390
|
||||
|
||||
const UpgradeHyperdriveHeight = 420
|
||||
|
||||
const UpgradeChocolateHeight = 312746
|
||||
const UpgradeChocolateHeight = 450
|
||||
|
||||
// 2022-02-10T19:23:00Z
|
||||
const UpgradeOhSnapHeight = 682006
|
||||
const UpgradeOhSnapHeight = 480
|
||||
|
||||
// 2022-06-16T17:30:00Z
|
||||
const UpgradeSkyrHeight = 1044660
|
||||
const UpgradeSkyrHeight = 510
|
||||
|
||||
var UpgradeV17Height = abi.ChainEpoch(99999999999999)
|
||||
const UpgradeSharkHeight = 16800 // 6 days after genesis
|
||||
|
||||
var SupportedProofTypes = []abi.RegisteredSealProof{
|
||||
abi.RegisteredSealProof_StackedDrg32GiBV1,
|
||||
|
@ -49,7 +49,7 @@ var UpgradeChocolateHeight = abi.ChainEpoch(-17)
|
||||
var UpgradeOhSnapHeight = abi.ChainEpoch(-18)
|
||||
var UpgradeSkyrHeight = abi.ChainEpoch(-19)
|
||||
|
||||
const UpgradeV17Height = abi.ChainEpoch(99999999999999)
|
||||
const UpgradeSharkHeight = abi.ChainEpoch(99999999999999)
|
||||
|
||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
@ -103,7 +103,7 @@ func init() {
|
||||
UpgradeChocolateHeight = getUpgradeHeight("LOTUS_CHOCOLATE_HEIGHT", UpgradeChocolateHeight)
|
||||
UpgradeOhSnapHeight = getUpgradeHeight("LOTUS_OHSNAP_HEIGHT", UpgradeOhSnapHeight)
|
||||
UpgradeSkyrHeight = getUpgradeHeight("LOTUS_SKYR_HEIGHT", UpgradeSkyrHeight)
|
||||
UpgradeV17Height = getUpgradeHeight("LOTUS_V17_HEIGHT", UpgradeV17Height)
|
||||
UpgradeSharkHeight = getUpgradeHeight("LOTUS_SHARK_HEIGHT", UpgradeSharkHeight)
|
||||
|
||||
BuildType |= BuildInteropnet
|
||||
SetAddressNetwork(address.Testnet)
|
||||
|
@ -79,7 +79,7 @@ const UpgradeOhSnapHeight = 1594680
|
||||
// 2022-07-06T14:00:00Z
|
||||
const UpgradeSkyrHeight = 1960320
|
||||
|
||||
var UpgradeV17Height = abi.ChainEpoch(99999999999999)
|
||||
var UpgradeSharkHeight = abi.ChainEpoch(99999999999999)
|
||||
|
||||
var SupportedProofTypes = []abi.RegisteredSealProof{
|
||||
abi.RegisteredSealProof_StackedDrg32GiBV1,
|
||||
@ -95,8 +95,8 @@ func init() {
|
||||
SetAddressNetwork(address.Mainnet)
|
||||
}
|
||||
|
||||
if os.Getenv("LOTUS_DISABLE_V17") == "1" {
|
||||
UpgradeV17Height = math.MaxInt64
|
||||
if os.Getenv("LOTUS_DISABLE_SHARK") == "1" {
|
||||
UpgradeSharkHeight = math.MaxInt64
|
||||
}
|
||||
|
||||
// NOTE: DO NOT change this unless you REALLY know what you're doing. This is not consensus critical, however,
|
||||
|
@ -26,14 +26,14 @@ const UnixfsLinksPerLevel = 1024
|
||||
|
||||
const AllowableClockDriftSecs = uint64(1)
|
||||
|
||||
// TODO: This is still terrible...What's the impact of updating this before mainnet actually upgrades
|
||||
// Used by tests and some obscure tooling
|
||||
/* inline-gen template
|
||||
|
||||
const NewestNetworkVersion = network.Version{{.latestNetworkVersion}}
|
||||
const TestNetworkVersion = network.Version{{.latestNetworkVersion}}
|
||||
|
||||
/* inline-gen start */
|
||||
|
||||
const NewestNetworkVersion = network.Version17
|
||||
const TestNetworkVersion = network.Version17
|
||||
|
||||
/* inline-gen end */
|
||||
|
||||
|
@ -107,7 +107,7 @@ var (
|
||||
UpgradeChocolateHeight abi.ChainEpoch = -16
|
||||
UpgradeOhSnapHeight abi.ChainEpoch = -17
|
||||
UpgradeSkyrHeight abi.ChainEpoch = -18
|
||||
UpgradeV17Height abi.ChainEpoch = -19
|
||||
UpgradeSharkHeight abi.ChainEpoch = -19
|
||||
|
||||
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
|
@ -37,7 +37,7 @@ func BuildTypeString() string {
|
||||
}
|
||||
|
||||
// BuildVersion is the local build version
|
||||
const BuildVersion = "1.17.3-dev"
|
||||
const BuildVersion = "1.19.0-dev"
|
||||
|
||||
func UserVersion() string {
|
||||
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
||||
|
@ -314,7 +314,7 @@ func GetActorCodeIDs(av actorstypes.Version) (map[string]cid.Cid, error) {
|
||||
return cids, nil
|
||||
}
|
||||
|
||||
actorsKeys := GetBuiltinActorsKeys()
|
||||
actorsKeys := GetBuiltinActorsKeys(av)
|
||||
synthCids := make(map[string]cid.Cid)
|
||||
|
||||
for _, key := range actorsKeys {
|
||||
|
@ -27,6 +27,7 @@ var actors = map[string][]int{
|
||||
"system": lotusactors.Versions,
|
||||
"reward": lotusactors.Versions,
|
||||
"verifreg": lotusactors.Versions,
|
||||
"datacap": lotusactors.Versions[8:],
|
||||
}
|
||||
|
||||
func main() {
|
||||
@ -55,7 +56,7 @@ func generateAdapters() error {
|
||||
for act, versions := range actors {
|
||||
actDir := filepath.Join("chain/actors/builtin", act)
|
||||
|
||||
if err := generateState(actDir); err != nil {
|
||||
if err := generateState(actDir, versions); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -97,7 +98,7 @@ func generateAdapters() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateState(actDir string) error {
|
||||
func generateState(actDir string, versions []int) error {
|
||||
af, err := ioutil.ReadFile(filepath.Join(actDir, "state.go.template"))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
@ -107,7 +108,7 @@ func generateState(actDir string) error {
|
||||
return xerrors.Errorf("loading state adapter template: %w", err)
|
||||
}
|
||||
|
||||
for _, version := range lotusactors.Versions {
|
||||
for _, version := range versions {
|
||||
tpl := template.Must(template.New("").Funcs(template.FuncMap{}).Parse(string(af)))
|
||||
|
||||
var b bytes.Buffer
|
||||
|
57
chain/actors/builtin/datacap/actor.go.template
Normal file
57
chain/actors/builtin/datacap/actor.go.template
Normal file
@ -0,0 +1,57 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var (
|
||||
Address = builtin9.DatacapActorAddr
|
||||
Methods = builtin9.MethodsDatacap
|
||||
)
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||
if name != actors.DatacapKey {
|
||||
return nil, xerrors.Errorf("actor code is not datacap: %s", name)
|
||||
}
|
||||
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actorstypes.Version{{.}}:
|
||||
return load{{.}}(store, act.Head)
|
||||
{{end}}
|
||||
}
|
||||
}
|
||||
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actorstypes.Version, governor address.Address, bitwidth uint64) (State, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actorstypes.Version{{.}}:
|
||||
return make{{.}}(store, governor, bitwidth)
|
||||
|
||||
default: return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av)
|
||||
{{end}}
|
||||
}
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
|
||||
VerifiedClientDataCap(address.Address) (bool, abi.StoragePower, error)
|
||||
Governor() (address.Address, error)
|
||||
GetState() interface{}
|
||||
}
|
58
chain/actors/builtin/datacap/datacap.go
Normal file
58
chain/actors/builtin/datacap/datacap.go
Normal file
@ -0,0 +1,58 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var (
|
||||
Address = builtin9.DatacapActorAddr
|
||||
Methods = builtin9.MethodsDatacap
|
||||
)
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||
if name != actors.DatacapKey {
|
||||
return nil, xerrors.Errorf("actor code is not datacap: %s", name)
|
||||
}
|
||||
|
||||
switch av {
|
||||
|
||||
case actorstypes.Version9:
|
||||
return load9(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actorstypes.Version, governor address.Address, bitwidth uint64) (State, error) {
|
||||
switch av {
|
||||
|
||||
case actorstypes.Version9:
|
||||
return make9(store, governor, bitwidth)
|
||||
|
||||
default:
|
||||
return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
|
||||
VerifiedClientDataCap(address.Address) (bool, abi.StoragePower, error)
|
||||
Governor() (address.Address, error)
|
||||
GetState() interface{}
|
||||
}
|
61
chain/actors/builtin/datacap/state.go.template
Normal file
61
chain/actors/builtin/datacap/state.go.template
Normal file
@ -0,0 +1,61 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
|
||||
datacap{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}datacap"
|
||||
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state{{.v}})(nil)
|
||||
|
||||
func load{{.v}}(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make{{.v}}(store adt.Store, governor address.Address, bitwidth uint64) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
s, err := datacap{{.v}}.ConstructState(store, governor, bitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state{{.v}} struct {
|
||||
datacap{{.v}}.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Governor() (address.Address, error) {
|
||||
return s.State.Governor, nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
return forEachClient(s.store, actors.Version{{.v}}, s.verifiedClients, cb)
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) verifiedClients() (adt.Map, error) {
|
||||
return adt{{.v}}.AsMap(s.store, s.Token.Balances, int(s.Token.HamtBitWidth))
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
return getDataCap(s.store, actors.Version{{.v}}, s.verifiedClients, addr)
|
||||
}
|
60
chain/actors/builtin/datacap/util.go
Normal file
60
chain/actors/builtin/datacap/util.go
Normal file
@ -0,0 +1,60 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"github.com/multiformats/go-varint"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
// taking this as a function instead of asking the caller to call it helps reduce some of the error
|
||||
// checking boilerplate.
|
||||
//
|
||||
// "go made me do it"
|
||||
type rootFunc func() (adt.Map, error)
|
||||
|
||||
func getDataCap(store adt.Store, ver actors.Version, root rootFunc, addr address.Address) (bool, abi.StoragePower, error) {
|
||||
if addr.Protocol() != address.ID {
|
||||
return false, big.Zero(), xerrors.Errorf("can only look up ID addresses")
|
||||
}
|
||||
vh, err := root()
|
||||
if err != nil {
|
||||
return false, big.Zero(), xerrors.Errorf("loading datacap actor: %w", err)
|
||||
}
|
||||
|
||||
var dcap abi.StoragePower
|
||||
if found, err := vh.Get(abi.IdAddrKey(addr), &dcap); err != nil {
|
||||
return false, big.Zero(), xerrors.Errorf("looking up addr: %w", err)
|
||||
} else if !found {
|
||||
return false, big.Zero(), nil
|
||||
}
|
||||
|
||||
return true, big.Div(dcap, verifreg.DataCapGranularity), nil
|
||||
}
|
||||
|
||||
func forEachClient(store adt.Store, ver actors.Version, root rootFunc, cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
vh, err := root()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("loading verified clients: %w", err)
|
||||
}
|
||||
var dcap abi.StoragePower
|
||||
return vh.ForEach(&dcap, func(key string) error {
|
||||
id, n, err := varint.FromUvarint([]byte(key))
|
||||
if n != len([]byte(key)) {
|
||||
return xerrors.Errorf("could not get varint from address string")
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
a, err := address.NewIDAddress(id)
|
||||
|
||||
return cb(a, big.Div(dcap, verifreg.DataCapGranularity))
|
||||
})
|
||||
}
|
61
chain/actors/builtin/datacap/v9.go
Normal file
61
chain/actors/builtin/datacap/v9.go
Normal file
@ -0,0 +1,61 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
datacap9 "github.com/filecoin-project/go-state-types/builtin/v9/datacap"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state9)(nil)
|
||||
|
||||
func load9(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state9{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make9(store adt.Store, governor address.Address, bitwidth uint64) (State, error) {
|
||||
out := state9{store: store}
|
||||
s, err := datacap9.ConstructState(store, governor, bitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state9 struct {
|
||||
datacap9.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state9) Governor() (address.Address, error) {
|
||||
return s.State.Governor, nil
|
||||
}
|
||||
|
||||
func (s *state9) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state9) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
return forEachClient(s.store, actors.Version9, s.verifiedClients, cb)
|
||||
}
|
||||
|
||||
func (s *state9) verifiedClients() (adt.Map, error) {
|
||||
return adt9.AsMap(s.store, s.Token.Balances, int(s.Token.HamtBitWidth))
|
||||
}
|
||||
|
||||
func (s *state9) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
return getDataCap(s.store, actors.Version9, s.verifiedClients, addr)
|
||||
}
|
@ -13,7 +13,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
{{range .versions}}
|
||||
{{if (le . 7)}}
|
||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||
@ -85,6 +86,7 @@ type State interface {
|
||||
) (weight, verifiedWeight abi.DealWeight, err error)
|
||||
NextID() (abi.DealID, error)
|
||||
GetState() interface{}
|
||||
GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error)
|
||||
}
|
||||
|
||||
type BalanceTable interface {
|
||||
|
@ -11,7 +11,8 @@ import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
@ -126,6 +127,7 @@ type State interface {
|
||||
) (weight, verifiedWeight abi.DealWeight, err error)
|
||||
NextID() (abi.DealID, error)
|
||||
GetState() interface{}
|
||||
GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error)
|
||||
}
|
||||
|
||||
type BalanceTable interface {
|
||||
|
@ -16,15 +16,19 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
|
||||
{{if (le .v 7)}}
|
||||
market{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/market"
|
||||
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
||||
{{else}}
|
||||
market{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||
{{end}}
|
||||
{{if (ge .v 9)}}
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
{{end}}
|
||||
)
|
||||
|
||||
var _ State = (*state{{.v}})(nil)
|
||||
@ -201,7 +205,16 @@ func (s *dealStates{{.v}}) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV{{.v}}DealState(v{{.v}} market{{.v}}.DealState) DealState {
|
||||
return (DealState)(v{{.v}})
|
||||
{{if (le .v 8)}}
|
||||
return DealState{
|
||||
SectorStartEpoch: v{{.v}}.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v{{.v}}.LastUpdatedEpoch,
|
||||
SlashEpoch: v{{.v}}.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
{{else}}
|
||||
return (DealState)(v{{.v}})
|
||||
{{end}}
|
||||
}
|
||||
|
||||
type dealProposals{{.v}} struct {
|
||||
@ -352,3 +365,25 @@ func (r *publishStorageDealsReturn{{.v}}) IsDealValid(index uint64) (bool, int,
|
||||
func (r *publishStorageDealsReturn{{.v}}) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
{{if (le .v 8)}}
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
{{else}}
|
||||
allocations, err := adt9.AsMap(s.store, s.PendingDealAllocationIds, builtin.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
|
||||
}
|
||||
|
||||
var allocationId cbg.CborInt
|
||||
found, err := allocations.Get(abi.UIntKey(uint64(dealId)), &allocationId)
|
||||
if err != nil {
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
|
||||
}
|
||||
if !found {
|
||||
return verifregtypes.NoAllocationID, nil
|
||||
}
|
||||
|
||||
return verifregtypes.AllocationId(allocationId), nil
|
||||
{{end}}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
@ -183,7 +184,14 @@ func (s *dealStates0) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV0DealState(v0 market0.DealState) DealState {
|
||||
return (DealState)(v0)
|
||||
|
||||
return DealState{
|
||||
SectorStartEpoch: v0.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v0.LastUpdatedEpoch,
|
||||
SlashEpoch: v0.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type dealProposals0 struct {
|
||||
@ -293,3 +301,9 @@ func (r *publishStorageDealsReturn0) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn0) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state0) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||
|
||||
@ -183,7 +184,14 @@ func (s *dealStates2) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV2DealState(v2 market2.DealState) DealState {
|
||||
return (DealState)(v2)
|
||||
|
||||
return DealState{
|
||||
SectorStartEpoch: v2.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v2.LastUpdatedEpoch,
|
||||
SlashEpoch: v2.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type dealProposals2 struct {
|
||||
@ -293,3 +301,9 @@ func (r *publishStorageDealsReturn2) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn2) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state2) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
|
||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||
|
||||
@ -178,7 +179,14 @@ func (s *dealStates3) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV3DealState(v3 market3.DealState) DealState {
|
||||
return (DealState)(v3)
|
||||
|
||||
return DealState{
|
||||
SectorStartEpoch: v3.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v3.LastUpdatedEpoch,
|
||||
SlashEpoch: v3.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type dealProposals3 struct {
|
||||
@ -288,3 +296,9 @@ func (r *publishStorageDealsReturn3) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn3) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state3) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market"
|
||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||
|
||||
@ -178,7 +179,14 @@ func (s *dealStates4) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV4DealState(v4 market4.DealState) DealState {
|
||||
return (DealState)(v4)
|
||||
|
||||
return DealState{
|
||||
SectorStartEpoch: v4.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v4.LastUpdatedEpoch,
|
||||
SlashEpoch: v4.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type dealProposals4 struct {
|
||||
@ -288,3 +296,9 @@ func (r *publishStorageDealsReturn4) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn4) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state4) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
|
||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||
|
||||
@ -178,7 +179,14 @@ func (s *dealStates5) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV5DealState(v5 market5.DealState) DealState {
|
||||
return (DealState)(v5)
|
||||
|
||||
return DealState{
|
||||
SectorStartEpoch: v5.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v5.LastUpdatedEpoch,
|
||||
SlashEpoch: v5.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type dealProposals5 struct {
|
||||
@ -288,3 +296,9 @@ func (r *publishStorageDealsReturn5) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn5) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state5) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market"
|
||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||
|
||||
@ -180,7 +181,14 @@ func (s *dealStates6) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV6DealState(v6 market6.DealState) DealState {
|
||||
return (DealState)(v6)
|
||||
|
||||
return DealState{
|
||||
SectorStartEpoch: v6.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v6.LastUpdatedEpoch,
|
||||
SlashEpoch: v6.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type dealProposals6 struct {
|
||||
@ -306,3 +314,9 @@ func (r *publishStorageDealsReturn6) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn6) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state6) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||
|
||||
@ -180,7 +181,14 @@ func (s *dealStates7) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV7DealState(v7 market7.DealState) DealState {
|
||||
return (DealState)(v7)
|
||||
|
||||
return DealState{
|
||||
SectorStartEpoch: v7.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v7.LastUpdatedEpoch,
|
||||
SlashEpoch: v7.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type dealProposals7 struct {
|
||||
@ -306,3 +314,9 @@ func (r *publishStorageDealsReturn7) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn7) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state7) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
@ -12,8 +12,9 @@ import (
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -181,7 +182,14 @@ func (s *dealStates8) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV8DealState(v8 market8.DealState) DealState {
|
||||
return (DealState)(v8)
|
||||
|
||||
return DealState{
|
||||
SectorStartEpoch: v8.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v8.LastUpdatedEpoch,
|
||||
SlashEpoch: v8.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type dealProposals8 struct {
|
||||
@ -323,3 +331,9 @@ func (r *publishStorageDealsReturn8) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn8) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state8) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
@ -11,9 +11,11 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -181,7 +183,9 @@ func (s *dealStates9) array() adt.Array {
|
||||
}
|
||||
|
||||
func fromV9DealState(v9 market9.DealState) DealState {
|
||||
|
||||
return (DealState)(v9)
|
||||
|
||||
}
|
||||
|
||||
type dealProposals9 struct {
|
||||
@ -323,3 +327,23 @@ func (r *publishStorageDealsReturn9) IsDealValid(index uint64) (bool, int, error
|
||||
func (r *publishStorageDealsReturn9) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state9) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
allocations, err := adt9.AsMap(s.store, s.PendingDealAllocationIds, builtin.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
|
||||
}
|
||||
|
||||
var allocationId cbg.CborInt
|
||||
found, err := allocations.Get(abi.UIntKey(uint64(dealId)), &allocationId)
|
||||
if err != nil {
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
|
||||
}
|
||||
if !found {
|
||||
return verifregtypes.NoAllocationID, nil
|
||||
}
|
||||
|
||||
return verifregtypes.AllocationId(allocationId), nil
|
||||
|
||||
}
|
||||
|
@ -413,6 +413,10 @@ func (s *state{{.v}}) Info() (MinerInfo, error) {
|
||||
SectorSize: info.SectorSize,
|
||||
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
||||
ConsensusFaultElapsed: {{if (ge .v 2)}}info.ConsensusFaultElapsed{{else}}-1{{end}},
|
||||
{{if (ge .v 9)}}
|
||||
Beneficiary: info.Beneficiary,
|
||||
BeneficiaryTerm: info.BeneficiaryTerm,
|
||||
PendingBeneficiaryTerm: info.PendingBeneficiaryTerm,{{end}}
|
||||
}
|
||||
|
||||
return mi, nil
|
||||
@ -580,7 +584,7 @@ func fromV{{.v}}SectorOnChainInfo(v{{.v}} miner{{.v}}.SectorOnChainInfo) SectorO
|
||||
}
|
||||
|
||||
func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||
return minertypes.SectorPreCommitOnChainInfo{
|
||||
{{if (le .v 8)}}return minertypes.SectorPreCommitOnChainInfo{
|
||||
Info: minertypes.SectorPreCommitInfo{
|
||||
SealProof: v{{.v}}.Info.SealProof,
|
||||
SectorNumber: v{{.v}}.Info.SectorNumber,
|
||||
@ -592,7 +596,7 @@ func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOn
|
||||
},
|
||||
PreCommitDeposit: v{{.v}}.PreCommitDeposit,
|
||||
PreCommitEpoch: v{{.v}}.PreCommitEpoch,
|
||||
}
|
||||
}{{else}}return v{{.v}}{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
|
@ -382,6 +382,10 @@ func (s *state9) Info() (MinerInfo, error) {
|
||||
SectorSize: info.SectorSize,
|
||||
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||
|
||||
Beneficiary: info.Beneficiary,
|
||||
BeneficiaryTerm: info.BeneficiaryTerm,
|
||||
PendingBeneficiaryTerm: info.PendingBeneficiaryTerm,
|
||||
}
|
||||
|
||||
return mi, nil
|
||||
@ -542,19 +546,7 @@ func fromV9SectorOnChainInfo(v9 miner9.SectorOnChainInfo) SectorOnChainInfo {
|
||||
}
|
||||
|
||||
func fromV9SectorPreCommitOnChainInfo(v9 miner9.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||
return minertypes.SectorPreCommitOnChainInfo{
|
||||
Info: minertypes.SectorPreCommitInfo{
|
||||
SealProof: v9.Info.SealProof,
|
||||
SectorNumber: v9.Info.SectorNumber,
|
||||
SealedCID: v9.Info.SealedCID,
|
||||
SealRandEpoch: v9.Info.SealRandEpoch,
|
||||
DealIDs: v9.Info.DealIDs,
|
||||
Expiration: v9.Info.Expiration,
|
||||
UnsealedCid: nil,
|
||||
},
|
||||
PreCommitDeposit: v9.PreCommitDeposit,
|
||||
PreCommitEpoch: v9.PreCommitEpoch,
|
||||
}
|
||||
return v9
|
||||
}
|
||||
|
||||
func (s *state9) GetState() interface{} {
|
||||
|
@ -1,9 +1,14 @@
|
||||
package builtin
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
|
||||
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
|
||||
_init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||
@ -17,6 +22,7 @@ import (
|
||||
verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
|
||||
account9 "github.com/filecoin-project/go-state-types/builtin/v9/account"
|
||||
cron9 "github.com/filecoin-project/go-state-types/builtin/v9/cron"
|
||||
datacap9 "github.com/filecoin-project/go-state-types/builtin/v9/datacap"
|
||||
_init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
|
||||
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
@ -32,19 +38,17 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
)
|
||||
|
||||
var _ rtt.VMActor = (*RegistryEntry)(nil)
|
||||
|
||||
type RegistryEntry struct {
|
||||
state cbor.Er
|
||||
code cid.Cid
|
||||
methods []interface{}
|
||||
methods map[uint64]builtin.MethodMeta
|
||||
}
|
||||
|
||||
func (r RegistryEntry) State() cbor.Er {
|
||||
return r.state
|
||||
}
|
||||
|
||||
func (r RegistryEntry) Exports() []interface{} {
|
||||
func (r RegistryEntry) Exports() map[uint64]builtin.MethodMeta {
|
||||
return r.methods
|
||||
}
|
||||
|
||||
@ -52,11 +56,45 @@ func (r RegistryEntry) Code() cid.Cid {
|
||||
return r.code
|
||||
}
|
||||
|
||||
func MakeRegistry(av actorstypes.Version) []rtt.VMActor {
|
||||
func MakeRegistryLegacy(actors []rtt.VMActor) []RegistryEntry {
|
||||
registry := make([]RegistryEntry, 0)
|
||||
|
||||
for _, actor := range actors {
|
||||
methodMap := make(map[uint64]builtin.MethodMeta)
|
||||
for methodNum, method := range actor.Exports() {
|
||||
if method != nil {
|
||||
methodMap[uint64(methodNum)] = makeMethodMeta(method)
|
||||
}
|
||||
}
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: actor.Code(),
|
||||
methods: methodMap,
|
||||
state: actor.State(),
|
||||
})
|
||||
}
|
||||
|
||||
return registry
|
||||
}
|
||||
|
||||
func makeMethodMeta(method interface{}) builtin.MethodMeta {
|
||||
ev := reflect.ValueOf(method)
|
||||
// Extract the method names using reflection. These
|
||||
// method names always match the field names in the
|
||||
// `builtin.Method*` structs (tested in the specs-actors
|
||||
// tests).
|
||||
fnName := runtime.FuncForPC(ev.Pointer()).Name()
|
||||
fnName = strings.TrimSuffix(fnName[strings.LastIndexByte(fnName, '.')+1:], "-fm")
|
||||
return builtin.MethodMeta{
|
||||
Name: fnName,
|
||||
Method: method,
|
||||
}
|
||||
}
|
||||
|
||||
func MakeRegistry(av actorstypes.Version) []RegistryEntry {
|
||||
if av < actorstypes.Version8 {
|
||||
panic("expected version v8 and up only, use specs-actors for v0-7")
|
||||
}
|
||||
registry := make([]rtt.VMActor, 0)
|
||||
registry := make([]RegistryEntry, 0)
|
||||
|
||||
codeIDs, err := actors.GetActorCodeIDs(av)
|
||||
if err != nil {
|
||||
@ -134,6 +172,7 @@ func MakeRegistry(av actorstypes.Version) []rtt.VMActor {
|
||||
methods: verifreg8.Methods,
|
||||
state: new(verifreg8.State),
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,6 +245,12 @@ func MakeRegistry(av actorstypes.Version) []rtt.VMActor {
|
||||
methods: verifreg9.Methods,
|
||||
state: new(verifreg9.State),
|
||||
})
|
||||
case actors.DatacapKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: datacap9.Methods,
|
||||
state: new(datacap9.State),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,11 @@ package builtin
|
||||
import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/ipfs/go-cid"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
{{range .versions}}
|
||||
{{if (ge . 8)}}
|
||||
account{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/account"
|
||||
@ -17,25 +22,26 @@ import (
|
||||
system{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/system"
|
||||
verifreg{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/verifreg"
|
||||
{{end}}
|
||||
{{if (ge . 9)}}
|
||||
datacap{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/datacap"
|
||||
{{end}}
|
||||
{{end}}
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
rtt "github.com/filecoin-project/go-state-types/rt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
)
|
||||
|
||||
var _ rtt.VMActor = (*RegistryEntry)(nil)
|
||||
|
||||
type RegistryEntry struct {
|
||||
state cbor.Er
|
||||
code cid.Cid
|
||||
methods []interface{}
|
||||
methods map[uint64]builtin.MethodMeta
|
||||
}
|
||||
|
||||
func (r RegistryEntry) State() cbor.Er {
|
||||
return r.state
|
||||
}
|
||||
|
||||
func (r RegistryEntry) Exports() []interface{} {
|
||||
func (r RegistryEntry) Exports() map[uint64]builtin.MethodMeta {
|
||||
return r.methods
|
||||
}
|
||||
|
||||
@ -43,11 +49,45 @@ func (r RegistryEntry) Code() cid.Cid {
|
||||
return r.code
|
||||
}
|
||||
|
||||
func MakeRegistry(av actorstypes.Version) []rtt.VMActor {
|
||||
func MakeRegistryLegacy(actors []rtt.VMActor) []RegistryEntry {
|
||||
registry := make([]RegistryEntry, 0)
|
||||
|
||||
for _, actor := range actors {
|
||||
methodMap := make(map[uint64]builtin.MethodMeta)
|
||||
for methodNum, method := range actor.Exports() {
|
||||
if method != nil {
|
||||
methodMap[uint64(methodNum)] = makeMethodMeta(method)
|
||||
}
|
||||
}
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: actor.Code(),
|
||||
methods: methodMap,
|
||||
state: actor.State(),
|
||||
})
|
||||
}
|
||||
|
||||
return registry
|
||||
}
|
||||
|
||||
func makeMethodMeta(method interface{}) builtin.MethodMeta {
|
||||
ev := reflect.ValueOf(method)
|
||||
// Extract the method names using reflection. These
|
||||
// method names always match the field names in the
|
||||
// `builtin.Method*` structs (tested in the specs-actors
|
||||
// tests).
|
||||
fnName := runtime.FuncForPC(ev.Pointer()).Name()
|
||||
fnName = strings.TrimSuffix(fnName[strings.LastIndexByte(fnName, '.')+1:], "-fm")
|
||||
return builtin.MethodMeta{
|
||||
Name: fnName,
|
||||
Method: method,
|
||||
}
|
||||
}
|
||||
|
||||
func MakeRegistry(av actorstypes.Version) []RegistryEntry {
|
||||
if av < actorstypes.Version8 {
|
||||
panic("expected version v8 and up only, use specs-actors for v0-7")
|
||||
}
|
||||
registry := make([]rtt.VMActor, 0)
|
||||
registry := make([]RegistryEntry, 0)
|
||||
|
||||
codeIDs, err := actors.GetActorCodeIDs(av)
|
||||
if err != nil {
|
||||
@ -126,6 +166,12 @@ func MakeRegistry(av actorstypes.Version) []rtt.VMActor {
|
||||
methods: verifreg{{.}}.Methods,
|
||||
state: new(verifreg{{.}}.State),
|
||||
})
|
||||
{{if (ge . 9)}}case actors.DatacapKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: datacap{{.}}.Methods,
|
||||
state: new(datacap{{.}}.State),
|
||||
}){{end}}
|
||||
}
|
||||
}
|
||||
{{end}}
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -72,5 +73,9 @@ type State interface {
|
||||
RemoveDataCapProposalID(verifier address.Address, client address.Address) (bool, uint64, error)
|
||||
ForEachVerifier(func(addr address.Address, dcap abi.StoragePower) error) error
|
||||
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
|
||||
GetAllocation(clientIdAddr address.Address, allocationId verifregtypes.AllocationId) (*verifregtypes.Allocation, bool, error)
|
||||
GetAllocations(clientIdAddr address.Address) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error)
|
||||
GetClaim(providerIdAddr address.Address, claimId verifregtypes.ClaimId) (*verifregtypes.Claim, bool, error)
|
||||
GetClaims(providerIdAddr address.Address) (map[verifregtypes.ClaimId]verifregtypes.Claim, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
{{if (le .v 7)}}
|
||||
{{if (ge .v 3)}}
|
||||
@ -19,6 +20,11 @@ import (
|
||||
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||
{{end}}
|
||||
{{if (ge .v 9)}}
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
{{else}}
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
{{end}}
|
||||
)
|
||||
|
||||
var _ State = (*state{{.v}})(nil)
|
||||
@ -62,7 +68,11 @@ func (s *state{{.v}}) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
{{if (le .v 8)}}
|
||||
return getDataCap(s.store, actors.Version{{.v}}, s.verifiedClients, addr)
|
||||
{{else}}
|
||||
return false, big.Zero(), xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -78,11 +88,19 @@ func (s *state{{.v}}) ForEachVerifier(cb func(addr address.Address, dcap abi.Sto
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
{{if (le .v 8)}}
|
||||
return forEachCap(s.store, actors.Version{{.v}}, s.verifiedClients, cb)
|
||||
{{else}}
|
||||
return xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) verifiedClients() (adt.Map, error) {
|
||||
{{if (le .v 8)}}
|
||||
return adt{{.v}}.AsMap(s.store, s.VerifiedClients{{if (ge .v 3)}}, builtin{{.v}}.DefaultHamtBitwidth{{end}})
|
||||
{{else}}
|
||||
return nil, xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) verifiers() (adt.Map, error) {
|
||||
@ -96,4 +114,36 @@ func (s *state{{.v}}) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
{{if (le .v 8)}}
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{else}}
|
||||
return s.FindAllocation(s.store, clientIdAddr, allocationId)
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
{{if (le .v 8)}}
|
||||
return nil, xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{else}}
|
||||
return s.LoadAllocationsToMap(s.store, clientIdAddr)
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
{{if (le .v 8)}}
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{else}}
|
||||
return s.FindClaim(s.store, providerIdAddr, claimId)
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
{{if (le .v 8)}}
|
||||
return nil, xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{else}}
|
||||
return s.LoadClaimsToMap(s.store, providerIdAddr)
|
||||
{{end}}
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
@ -46,7 +48,9 @@ func (s *state0) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state0) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version0, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -62,11 +66,15 @@ func (s *state0) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state0) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version0, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt0.AsMap(s.store, s.VerifiedClients)
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) verifiers() (adt.Map, error) {
|
||||
@ -81,3 +89,27 @@ func (s *state0) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state0) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v0")
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v0")
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v0")
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v0")
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
|
||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||
|
||||
@ -46,7 +48,9 @@ func (s *state2) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state2) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version2, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -62,11 +66,15 @@ func (s *state2) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state2) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version2, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt2.AsMap(s.store, s.VerifiedClients)
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) verifiers() (adt.Map, error) {
|
||||
@ -81,3 +89,27 @@ func (s *state2) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state2) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v2")
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v2")
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v2")
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v2")
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||
verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg"
|
||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||
@ -47,7 +49,9 @@ func (s *state3) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state3) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version3, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +67,15 @@ func (s *state3) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state3) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version3, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt3.AsMap(s.store, s.VerifiedClients, builtin3.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) verifiers() (adt.Map, error) {
|
||||
@ -82,3 +90,27 @@ func (s *state3) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state3) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v3")
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v3")
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v3")
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v3")
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||
verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg"
|
||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||
@ -47,7 +49,9 @@ func (s *state4) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state4) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version4, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +67,15 @@ func (s *state4) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state4) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version4, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt4.AsMap(s.store, s.VerifiedClients, builtin4.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) verifiers() (adt.Map, error) {
|
||||
@ -82,3 +90,27 @@ func (s *state4) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state4) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v4")
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v4")
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v4")
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v4")
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||
verifreg5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/verifreg"
|
||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||
@ -47,7 +49,9 @@ func (s *state5) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state5) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version5, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +67,15 @@ func (s *state5) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state5) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version5, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt5.AsMap(s.store, s.VerifiedClients, builtin5.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) verifiers() (adt.Map, error) {
|
||||
@ -82,3 +90,27 @@ func (s *state5) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state5) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v5")
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v5")
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v5")
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v5")
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||
verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg"
|
||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||
@ -47,7 +49,9 @@ func (s *state6) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state6) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version6, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +67,15 @@ func (s *state6) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state6) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version6, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt6.AsMap(s.store, s.VerifiedClients, builtin6.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) verifiers() (adt.Map, error) {
|
||||
@ -82,3 +90,27 @@ func (s *state6) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state6) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state6) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v6")
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v6")
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v6")
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v6")
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||
verifreg7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
|
||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||
@ -47,7 +49,9 @@ func (s *state7) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state7) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version7, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +67,15 @@ func (s *state7) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state7) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version7, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt7.AsMap(s.store, s.VerifiedClients, builtin7.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) verifiers() (adt.Map, error) {
|
||||
@ -81,3 +89,27 @@ func (s *state7) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state7) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state7) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v7")
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v7")
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v7")
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v7")
|
||||
|
||||
}
|
||||
|
@ -2,12 +2,14 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
@ -47,7 +49,9 @@ func (s *state8) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state8) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version8, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +67,15 @@ func (s *state8) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state8) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version8, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt8.AsMap(s.store, s.VerifiedClients, builtin8.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) verifiers() (adt.Map, error) {
|
||||
@ -81,3 +89,27 @@ func (s *state8) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state8) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state8) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v8")
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v8")
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return nil, false, xerrors.Errorf("unsupported in actors v8")
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v8")
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
@ -47,7 +49,9 @@ func (s *state9) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state9) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
return getDataCap(s.store, actors.Version9, s.verifiedClients, addr)
|
||||
|
||||
return false, big.Zero(), xerrors.Errorf("unsupported in actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +67,15 @@ func (s *state9) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state9) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
return forEachCap(s.store, actors.Version9, s.verifiedClients, cb)
|
||||
|
||||
return xerrors.Errorf("unsupported in actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) verifiedClients() (adt.Map, error) {
|
||||
return adt9.AsMap(s.store, s.VerifiedClients, builtin9.DefaultHamtBitwidth)
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) verifiers() (adt.Map, error) {
|
||||
@ -81,3 +89,27 @@ func (s *state9) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
func (s *state9) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state9) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
|
||||
|
||||
return s.FindAllocation(s.store, clientIdAddr, allocationId)
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
|
||||
|
||||
return s.LoadAllocationsToMap(s.store, clientIdAddr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
|
||||
|
||||
return s.FindClaim(s.store, providerIdAddr, claimId)
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
|
||||
|
||||
return s.LoadClaimsToMap(s.store, providerIdAddr)
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
@ -114,5 +115,9 @@ type State interface {
|
||||
RemoveDataCapProposalID(verifier address.Address, client address.Address) (bool, uint64, error)
|
||||
ForEachVerifier(func(addr address.Address, dcap abi.StoragePower) error) error
|
||||
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
|
||||
GetAllocation(clientIdAddr address.Address, allocationId verifregtypes.AllocationId) (*verifregtypes.Allocation, bool, error)
|
||||
GetAllocations(clientIdAddr address.Address) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error)
|
||||
GetClaim(providerIdAddr address.Address, claimId verifregtypes.ClaimId) (*verifregtypes.Claim, bool, error)
|
||||
GetClaims(providerIdAddr address.Address) (map[verifregtypes.ClaimId]verifregtypes.Claim, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
@ -31,10 +31,11 @@ const (
|
||||
RewardKey = "reward"
|
||||
SystemKey = "system"
|
||||
VerifregKey = "verifiedregistry"
|
||||
DatacapKey = "datacap"
|
||||
)
|
||||
|
||||
func GetBuiltinActorsKeys() []string {
|
||||
return []string{
|
||||
func GetBuiltinActorsKeys(av actorstypes.Version) []string {
|
||||
keys := []string{
|
||||
AccountKey,
|
||||
CronKey,
|
||||
InitKey,
|
||||
@ -47,6 +48,10 @@ func GetBuiltinActorsKeys() []string {
|
||||
SystemKey,
|
||||
VerifregKey,
|
||||
}
|
||||
if av >= 9 {
|
||||
keys = append(keys, DatacapKey)
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
var (
|
||||
@ -58,7 +63,7 @@ type actorEntry struct {
|
||||
version actorstypes.Version
|
||||
}
|
||||
|
||||
// ClearManifest clears all known manifests. This is usually used in tests that need to switch networks.
|
||||
// ClearManifests clears all known manifests. This is usually used in tests that need to switch networks.
|
||||
func ClearManifests() {
|
||||
manifestMx.Lock()
|
||||
defer manifestMx.Unlock()
|
||||
@ -103,12 +108,14 @@ func ReadManifest(ctx context.Context, store cbor.IpldStore, mfCid cid.Cid) (map
|
||||
return nil, xerrors.Errorf("error loading manifest (cid: %s): %w", mfCid, err)
|
||||
}
|
||||
|
||||
actorKeys := GetBuiltinActorsKeys() // TODO: we should be able to enumerate manifests directly.
|
||||
metadata := make(map[string]cid.Cid, len(actorKeys))
|
||||
for _, name := range actorKeys {
|
||||
if c, ok := mf.Get(name); ok {
|
||||
metadata[name] = c
|
||||
}
|
||||
var manifestData manifest.ManifestData
|
||||
if err := store.Get(ctx, mf.Data, &manifestData); err != nil {
|
||||
return nil, xerrors.Errorf("error loading manifest data: %w", err)
|
||||
}
|
||||
|
||||
metadata := make(map[string]cid.Cid)
|
||||
for _, entry := range manifestData.Entries {
|
||||
metadata[entry.Name] = entry.Code
|
||||
}
|
||||
|
||||
return metadata, nil
|
||||
|
@ -39,15 +39,15 @@ import (
|
||||
func NewActorRegistry() *vm.ActorRegistry {
|
||||
inv := vm.NewActorRegistry()
|
||||
|
||||
inv.Register(actorstypes.Version0, vm.ActorsVersionPredicate(actorstypes.Version0), exported0.BuiltinActors()...)
|
||||
inv.Register(actorstypes.Version2, vm.ActorsVersionPredicate(actorstypes.Version2), exported2.BuiltinActors()...)
|
||||
inv.Register(actorstypes.Version3, vm.ActorsVersionPredicate(actorstypes.Version3), exported3.BuiltinActors()...)
|
||||
inv.Register(actorstypes.Version4, vm.ActorsVersionPredicate(actorstypes.Version4), exported4.BuiltinActors()...)
|
||||
inv.Register(actorstypes.Version5, vm.ActorsVersionPredicate(actorstypes.Version5), exported5.BuiltinActors()...)
|
||||
inv.Register(actorstypes.Version6, vm.ActorsVersionPredicate(actorstypes.Version6), exported6.BuiltinActors()...)
|
||||
inv.Register(actorstypes.Version7, vm.ActorsVersionPredicate(actorstypes.Version7), exported7.BuiltinActors()...)
|
||||
inv.Register(actorstypes.Version8, vm.ActorsVersionPredicate(actorstypes.Version8), builtin.MakeRegistry(actorstypes.Version8)...)
|
||||
inv.Register(actorstypes.Version9, vm.ActorsVersionPredicate(actorstypes.Version9), builtin.MakeRegistry(actorstypes.Version9)...)
|
||||
inv.Register(actorstypes.Version0, vm.ActorsVersionPredicate(actorstypes.Version0), builtin.MakeRegistryLegacy(exported0.BuiltinActors()))
|
||||
inv.Register(actorstypes.Version2, vm.ActorsVersionPredicate(actorstypes.Version2), builtin.MakeRegistryLegacy(exported2.BuiltinActors()))
|
||||
inv.Register(actorstypes.Version3, vm.ActorsVersionPredicate(actorstypes.Version3), builtin.MakeRegistryLegacy(exported3.BuiltinActors()))
|
||||
inv.Register(actorstypes.Version4, vm.ActorsVersionPredicate(actorstypes.Version4), builtin.MakeRegistryLegacy(exported4.BuiltinActors()))
|
||||
inv.Register(actorstypes.Version5, vm.ActorsVersionPredicate(actorstypes.Version5), builtin.MakeRegistryLegacy(exported5.BuiltinActors()))
|
||||
inv.Register(actorstypes.Version6, vm.ActorsVersionPredicate(actorstypes.Version6), builtin.MakeRegistryLegacy(exported6.BuiltinActors()))
|
||||
inv.Register(actorstypes.Version7, vm.ActorsVersionPredicate(actorstypes.Version7), builtin.MakeRegistryLegacy(exported7.BuiltinActors()))
|
||||
inv.Register(actorstypes.Version8, vm.ActorsVersionPredicate(actorstypes.Version8), builtin.MakeRegistry(actorstypes.Version8))
|
||||
inv.Register(actorstypes.Version9, vm.ActorsVersionPredicate(actorstypes.Version9), builtin.MakeRegistry(actorstypes.Version9))
|
||||
|
||||
return inv
|
||||
}
|
||||
|
@ -192,13 +192,18 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule {
|
||||
}},
|
||||
Expensive: true,
|
||||
}, {
|
||||
Height: build.UpgradeV17Height,
|
||||
Height: build.UpgradeSharkHeight,
|
||||
Network: network.Version17,
|
||||
Migration: UpgradeActorsV9,
|
||||
PreMigrations: []stmgr.PreMigration{{
|
||||
PreMigration: PreUpgradeActorsV9,
|
||||
StartWithin: 180,
|
||||
StartWithin: 240,
|
||||
DontStartWithin: 60,
|
||||
StopWithin: 20,
|
||||
}, {
|
||||
PreMigration: PreUpgradeActorsV9,
|
||||
StartWithin: 15,
|
||||
DontStartWithin: 10,
|
||||
StopWithin: 5,
|
||||
}},
|
||||
Expensive: true,
|
||||
@ -1462,8 +1467,6 @@ func UpgradeActorsV9(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi
|
||||
return cid.Undef, xerrors.Errorf("migrating actors v8 state: %w", err)
|
||||
}
|
||||
|
||||
fmt.Print(fvmLiftoffBanner)
|
||||
|
||||
return newRoot, nil
|
||||
}
|
||||
|
||||
@ -1494,11 +1497,11 @@ func upgradeActorsV9Common(
|
||||
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet,
|
||||
config nv17.Config,
|
||||
) (cid.Cid, error) {
|
||||
buf := blockstore.NewTieredBstore(sm.ChainStore().StateBlockstore(), blockstore.NewMemorySync())
|
||||
store := store.ActorStore(ctx, buf)
|
||||
writeStore := blockstore.NewAutobatch(ctx, sm.ChainStore().StateBlockstore(), units.GiB/4)
|
||||
store := store.ActorStore(ctx, writeStore)
|
||||
|
||||
// ensure that the manifest is loaded in the blockstore
|
||||
if err := bundle.LoadBundles(ctx, buf, actorstypes.Version9); err != nil {
|
||||
if err := bundle.LoadBundles(ctx, sm.ChainStore().StateBlockstore(), actorstypes.Version9); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to load manifest bundle: %w", err)
|
||||
}
|
||||
|
||||
@ -1537,15 +1540,13 @@ func upgradeActorsV9Common(
|
||||
return cid.Undef, xerrors.Errorf("failed to persist new state root: %w", err)
|
||||
}
|
||||
|
||||
// Persist the new tree.
|
||||
// Persists the new tree and shuts down the flush worker
|
||||
if err := writeStore.Flush(ctx); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("writeStore flush failed: %w", err)
|
||||
}
|
||||
|
||||
{
|
||||
from := buf
|
||||
to := buf.Read()
|
||||
|
||||
if err := vm.Copy(ctx, from, to, newRoot); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("copying migrated tree: %w", err)
|
||||
}
|
||||
if err := writeStore.Shutdown(ctx); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("writeStore shutdown failed: %w", err)
|
||||
}
|
||||
|
||||
return newRoot, nil
|
||||
@ -1575,7 +1576,7 @@ func upgradeActorsV9Common(
|
||||
// return LiteMigration(ctx, bstore, newActorsManifestCid, root, av, types.StateTreeVersion4, newStateTreeVersion)
|
||||
//}
|
||||
|
||||
func LiteMigration(ctx context.Context, bstore blockstore.Blockstore, newActorsManifestCid cid.Cid, root cid.Cid, av actorstypes.Version, oldStateTreeVersion types.StateTreeVersion, newStateTreeVersion types.StateTreeVersion) (cid.Cid, error) {
|
||||
func LiteMigration(ctx context.Context, bstore blockstore.Blockstore, newActorsManifestCid cid.Cid, root cid.Cid, oldAv actorstypes.Version, newAv actorstypes.Version, oldStateTreeVersion types.StateTreeVersion, newStateTreeVersion types.StateTreeVersion) (cid.Cid, error) {
|
||||
buf := blockstore.NewTieredBstore(bstore, blockstore.NewMemorySync())
|
||||
store := store.ActorStore(ctx, buf)
|
||||
adtStore := gstStore.WrapStore(ctx, store)
|
||||
@ -1615,10 +1616,10 @@ func LiteMigration(ctx context.Context, bstore blockstore.Blockstore, newActorsM
|
||||
return cid.Undef, xerrors.Errorf("error loading new manifest data: %w", err)
|
||||
}
|
||||
|
||||
if len(oldManifestData.Entries) != len(actors.GetBuiltinActorsKeys()) {
|
||||
if len(oldManifestData.Entries) != len(actors.GetBuiltinActorsKeys(oldAv)) {
|
||||
return cid.Undef, xerrors.Errorf("incomplete old manifest with %d code CIDs", len(oldManifestData.Entries))
|
||||
}
|
||||
if len(newManifestData.Entries) != len(actors.GetBuiltinActorsKeys()) {
|
||||
if len(newManifestData.Entries) != len(actors.GetBuiltinActorsKeys(newAv)) {
|
||||
return cid.Undef, xerrors.Errorf("incomplete new manifest with %d code CIDs", len(newManifestData.Entries))
|
||||
}
|
||||
|
||||
@ -1650,7 +1651,7 @@ func LiteMigration(ctx context.Context, bstore blockstore.Blockstore, newActorsM
|
||||
}
|
||||
var head cid.Cid
|
||||
if addr == system.Address {
|
||||
newSystemState, err := system.MakeState(store, av, newManifest.Data)
|
||||
newSystemState, err := system.MakeState(store, newAv, newManifest.Data)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("could not make system actor state: %w", err)
|
||||
}
|
||||
|
56
chain/gen/genesis/f07_dcap.go
Normal file
56
chain/gen/genesis/f07_dcap.go
Normal file
@ -0,0 +1,56 @@
|
||||
package genesis
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
bstore "github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/datacap"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var GovernorId address.Address
|
||||
|
||||
func init() {
|
||||
idk, err := address.NewFromString("t06")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
GovernorId = idk
|
||||
}
|
||||
|
||||
func SetupDatacapActor(ctx context.Context, bs bstore.Blockstore, av actorstypes.Version) (*types.Actor, error) {
|
||||
cst := cbor.NewCborStore(bs)
|
||||
dst, err := datacap.MakeState(adt.WrapStore(ctx, cbor.NewCborStore(bs)), av, GovernorId, builtin.DefaultTokenActorBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
statecid, err := cst.Put(ctx, dst.GetState())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
actcid, ok := actors.GetActorCodeID(av, actors.DatacapKey)
|
||||
if !ok {
|
||||
return nil, xerrors.Errorf("failed to get datacap actor code ID for actors version %d", av)
|
||||
}
|
||||
|
||||
act := &types.Actor{
|
||||
Code: actcid,
|
||||
Head: statecid,
|
||||
Balance: big.Zero(),
|
||||
}
|
||||
|
||||
return act, nil
|
||||
}
|
@ -29,6 +29,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/account"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/cron"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/datacap"
|
||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/multisig"
|
||||
@ -215,6 +216,17 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
return nil, nil, xerrors.Errorf("set verified registry actor: %w", err)
|
||||
}
|
||||
|
||||
// Create datacap actor
|
||||
if av >= 9 {
|
||||
dcapact, err := SetupDatacapActor(ctx, bs, av)
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("setup datacap actor: %w", err)
|
||||
}
|
||||
if err := state.SetActor(datacap.Address, dcapact); err != nil {
|
||||
return nil, nil, xerrors.Errorf("set datacap actor: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
bact, err := MakeAccountActor(ctx, cst, av, builtin.BurntFundsActorAddr, big.Zero())
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("setup burnt funds actor state: %w", err)
|
||||
|
@ -17,8 +17,8 @@ import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
smoothing9 "github.com/filecoin-project/go-state-types/builtin/v9/util/smoothing"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
@ -227,7 +227,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
||||
|
||||
params := &markettypes.PublishStorageDealsParams{}
|
||||
for _, preseal := range m.Sectors {
|
||||
fmt.Println("presealing ", preseal.SectorID)
|
||||
preseal.Deal.VerifiedDeal = true
|
||||
preseal.Deal.EndEpoch = minerInfos[i].presealExp
|
||||
p := markettypes.ClientDealProposal{
|
||||
@ -438,7 +437,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
||||
|
||||
pledge = big.Add(pcd, pledge)
|
||||
|
||||
fmt.Println(types.FIL(pledge))
|
||||
_, err = doExecValue(ctx, genesisVm, minerInfos[i].maddr, m.Worker, pledge, builtintypes.MethodsMiner.PreCommitSector, mustEnc(params))
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
|
@ -624,11 +624,11 @@ func (mp *MessagePool) addLocal(ctx context.Context, m *types.SignedMessage) err
|
||||
// sufficiently.
|
||||
// For non local messages, if the message cannot be included in the next 20 blocks it returns
|
||||
// a (soft) validation error.
|
||||
func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.TipSet, local bool) (bool, error) {
|
||||
func (mp *MessagePool) verifyMsgBeforeAdd(ctx context.Context, m *types.SignedMessage, curTs *types.TipSet, local bool) (bool, error) {
|
||||
epoch := curTs.Height() + 1
|
||||
minGas := vm.PricelistByEpoch(epoch).OnChainMessage(m.ChainLength())
|
||||
|
||||
if err := m.VMMessage().ValidForBlockInclusion(minGas.Total(), build.NewestNetworkVersion); err != nil {
|
||||
if err := m.VMMessage().ValidForBlockInclusion(minGas.Total(), mp.api.StateNetworkVersion(ctx, epoch)); err != nil {
|
||||
return false, xerrors.Errorf("message will not be included in a block: %w", err)
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage) (cid.Ci
|
||||
done := metrics.Timer(ctx, metrics.MpoolPushDuration)
|
||||
defer done()
|
||||
|
||||
err := mp.checkMessage(m)
|
||||
err := mp.checkMessage(ctx, m)
|
||||
if err != nil {
|
||||
return cid.Undef, err
|
||||
}
|
||||
@ -705,14 +705,14 @@ func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage) (cid.Ci
|
||||
return m.Cid(), nil
|
||||
}
|
||||
|
||||
func (mp *MessagePool) checkMessage(m *types.SignedMessage) error {
|
||||
func (mp *MessagePool) checkMessage(ctx context.Context, m *types.SignedMessage) error {
|
||||
// big messages are bad, anti DOS
|
||||
if m.Size() > MaxMessageSize {
|
||||
return xerrors.Errorf("mpool message too large (%dB): %w", m.Size(), ErrMessageTooBig)
|
||||
}
|
||||
|
||||
// Perform syntactic validation, minGas=0 as we check the actual mingas before we add it
|
||||
if err := m.Message.ValidForBlockInclusion(0, build.NewestNetworkVersion); err != nil {
|
||||
if err := m.Message.ValidForBlockInclusion(0, mp.api.StateNetworkVersion(ctx, mp.curTs.Height())); err != nil {
|
||||
return xerrors.Errorf("message not valid for block inclusion: %w", err)
|
||||
}
|
||||
|
||||
@ -740,7 +740,7 @@ func (mp *MessagePool) Add(ctx context.Context, m *types.SignedMessage) error {
|
||||
done := metrics.Timer(ctx, metrics.MpoolAddDuration)
|
||||
defer done()
|
||||
|
||||
err := mp.checkMessage(m)
|
||||
err := mp.checkMessage(ctx, m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -845,7 +845,7 @@ func (mp *MessagePool) addTs(ctx context.Context, m *types.SignedMessage, curTs
|
||||
mp.lk.Lock()
|
||||
defer mp.lk.Unlock()
|
||||
|
||||
publish, err := mp.verifyMsgBeforeAdd(m, curTs, local)
|
||||
publish, err := mp.verifyMsgBeforeAdd(ctx, m, curTs, local)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -870,7 +870,7 @@ func (mp *MessagePool) addTs(ctx context.Context, m *types.SignedMessage, curTs
|
||||
}
|
||||
|
||||
func (mp *MessagePool) addLoaded(ctx context.Context, m *types.SignedMessage) error {
|
||||
err := mp.checkMessage(m)
|
||||
err := mp.checkMessage(ctx, m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -890,7 +890,7 @@ func (mp *MessagePool) addLoaded(ctx context.Context, m *types.SignedMessage) er
|
||||
return xerrors.Errorf("minimum expected nonce is %d: %w", snonce, ErrNonceTooLow)
|
||||
}
|
||||
|
||||
_, err = mp.verifyMsgBeforeAdd(m, curTs, true)
|
||||
_, err = mp.verifyMsgBeforeAdd(ctx, m, curTs, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1060,7 +1060,7 @@ func (mp *MessagePool) getStateBalance(ctx context.Context, addr address.Address
|
||||
// - extra strict add checks are used when adding the messages to the msgSet
|
||||
// that means: no nonce gaps, at most 10 pending messages for the actor
|
||||
func (mp *MessagePool) PushUntrusted(ctx context.Context, m *types.SignedMessage) (cid.Cid, error) {
|
||||
err := mp.checkMessage(m)
|
||||
err := mp.checkMessage(ctx, m)
|
||||
if err != nil {
|
||||
return cid.Undef, err
|
||||
}
|
||||
|
@ -15,9 +15,11 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||
"github.com/filecoin-project/lotus/chain/messagepool/gasguess"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -166,6 +168,10 @@ func (tma *testMpoolAPI) StateAccountKeyAtFinality(ctx context.Context, addr add
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
func (tma *testMpoolAPI) StateNetworkVersion(ctx context.Context, h abi.ChainEpoch) network.Version {
|
||||
return build.TestNetworkVersion
|
||||
}
|
||||
|
||||
func (tma *testMpoolAPI) MessagesForBlock(ctx context.Context, h *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error) {
|
||||
return nil, tma.bmsgs[h.Cid()], nil
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/messagesigner"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
@ -28,6 +30,7 @@ type Provider interface {
|
||||
PubSubPublish(string, []byte) error
|
||||
GetActorAfter(address.Address, *types.TipSet) (*types.Actor, error)
|
||||
StateAccountKeyAtFinality(context.Context, address.Address, *types.TipSet) (address.Address, error)
|
||||
StateNetworkVersion(context.Context, abi.ChainEpoch) network.Version
|
||||
MessagesForBlock(context.Context, *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error)
|
||||
MessagesForTipset(context.Context, *types.TipSet) ([]types.ChainMsg, error)
|
||||
LoadTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
|
||||
@ -104,6 +107,10 @@ func (mpp *mpoolProvider) StateAccountKeyAtFinality(ctx context.Context, addr ad
|
||||
return mpp.sm.ResolveToKeyAddressAtFinality(ctx, addr, ts)
|
||||
}
|
||||
|
||||
func (mpp *mpoolProvider) StateNetworkVersion(ctx context.Context, height abi.ChainEpoch) network.Version {
|
||||
return mpp.sm.GetNetworkVersion(ctx, height)
|
||||
}
|
||||
|
||||
func (mpp *mpoolProvider) MessagesForBlock(ctx context.Context, h *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error) {
|
||||
return mpp.sm.ChainStore().MessagesForBlock(ctx, h)
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ func BenchmarkStateTreeSet(b *testing.B) {
|
||||
func BenchmarkStateTreeSetFlush(b *testing.B) {
|
||||
//stm: @CHAIN_STATETREE_SET_ACTOR_001
|
||||
cst := cbor.NewMemCborStore()
|
||||
sv, err := VersionForNetwork(build.NewestNetworkVersion)
|
||||
sv, err := VersionForNetwork(build.TestNetworkVersion)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
@ -85,7 +85,7 @@ func TestResolveCache(t *testing.T) {
|
||||
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
|
||||
//stm: @CHAIN_STATETREE_SNAPSHOT_001, @CHAIN_STATETREE_SNAPSHOT_CLEAR_001
|
||||
cst := cbor.NewMemCborStore()
|
||||
sv, err := VersionForNetwork(build.NewestNetworkVersion)
|
||||
sv, err := VersionForNetwork(build.TestNetworkVersion)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -189,7 +189,7 @@ func BenchmarkStateTree10kGetActor(b *testing.B) {
|
||||
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
|
||||
//stm: @CHAIN_STATETREE_FLUSH_001
|
||||
cst := cbor.NewMemCborStore()
|
||||
sv, err := VersionForNetwork(build.NewestNetworkVersion)
|
||||
sv, err := VersionForNetwork(build.TestNetworkVersion)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
@ -237,7 +237,7 @@ func BenchmarkStateTree10kGetActor(b *testing.B) {
|
||||
func TestSetCache(t *testing.T) {
|
||||
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
|
||||
cst := cbor.NewMemCborStore()
|
||||
sv, err := VersionForNetwork(build.NewestNetworkVersion)
|
||||
sv, err := VersionForNetwork(build.TestNetworkVersion)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -282,7 +282,7 @@ func TestSnapshots(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
cst := cbor.NewMemCborStore()
|
||||
|
||||
sv, err := VersionForNetwork(build.NewestNetworkVersion)
|
||||
sv, err := VersionForNetwork(build.TestNetworkVersion)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
|
||||
"github.com/filecoin-project/lotus/chain/beacon"
|
||||
"github.com/filecoin-project/lotus/chain/rand"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -251,13 +252,13 @@ func GetStorageDeal(ctx context.Context, sm *StateManager, dealID abi.DealID, ts
|
||||
|
||||
proposals, err := state.Proposals()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, xerrors.Errorf("failed to get proposals from state : %w", err)
|
||||
}
|
||||
|
||||
proposal, found, err := proposals.Get(dealID)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, xerrors.Errorf("failed to get proposal : %w", err)
|
||||
} else if !found {
|
||||
return nil, xerrors.Errorf(
|
||||
"deal %d not found "+
|
||||
@ -268,12 +269,12 @@ func GetStorageDeal(ctx context.Context, sm *StateManager, dealID abi.DealID, ts
|
||||
|
||||
states, err := state.States()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, xerrors.Errorf("failed to get states : %w", err)
|
||||
}
|
||||
|
||||
st, found, err := states.Get(dealID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, xerrors.Errorf("failed to get state : %w", err)
|
||||
}
|
||||
|
||||
if !found {
|
||||
@ -516,6 +517,24 @@ func (sm *StateManager) GetMarketState(ctx context.Context, ts *types.TipSet) (m
|
||||
return actState, nil
|
||||
}
|
||||
|
||||
func (sm *StateManager) GetVerifregState(ctx context.Context, ts *types.TipSet) (verifreg.State, error) {
|
||||
st, err := sm.ParentState(ts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
act, err := st.GetActor(verifreg.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
actState, err := verifreg.Load(sm.cs.ActorStore(ctx), act)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return actState, nil
|
||||
}
|
||||
|
||||
func (sm *StateManager) MarketBalance(ctx context.Context, addr address.Address, ts *types.TipSet) (api.MarketBalance, error) {
|
||||
mstate, err := sm.GetMarketState(ctx, ts)
|
||||
if err != nil {
|
||||
|
@ -133,7 +133,7 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types.
|
||||
|
||||
// TODO: maybe just use the invoker directly?
|
||||
ret, err := vmi.ApplyImplicitMessage(ctx, msg)
|
||||
if err != nil {
|
||||
if err != nil && ret == nil {
|
||||
return nil, xerrors.Errorf("apply message failed: %w", err)
|
||||
}
|
||||
|
||||
@ -150,8 +150,7 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types.
|
||||
ExecutionTrace: ret.ExecutionTrace,
|
||||
Error: errs,
|
||||
Duration: ret.Duration,
|
||||
}, nil
|
||||
|
||||
}, err
|
||||
}
|
||||
|
||||
func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, priorMsgs []types.ChainMsg, ts *types.TipSet) (*api.InvocResult, error) {
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
rtt "github.com/filecoin-project/go-state-types/rt"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
|
||||
rt2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
|
||||
@ -27,6 +28,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
_init "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||
@ -168,7 +170,8 @@ func TestForkHeightTriggers(t *testing.T) {
|
||||
}
|
||||
|
||||
inv := filcns.NewActorRegistry()
|
||||
inv.Register(actorstypes.Version0, nil, testActor{})
|
||||
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
||||
inv.Register(actorstypes.Version0, nil, registry)
|
||||
|
||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||
@ -285,7 +288,8 @@ func testForkRefuseCall(t *testing.T, nullsBefore, nullsAfter int) {
|
||||
}
|
||||
|
||||
inv := filcns.NewActorRegistry()
|
||||
inv.Register(actorstypes.Version0, nil, testActor{})
|
||||
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
||||
inv.Register(actorstypes.Version0, nil, registry)
|
||||
|
||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||
@ -506,7 +510,8 @@ func TestForkPreMigration(t *testing.T) {
|
||||
}()
|
||||
|
||||
inv := filcns.NewActorRegistry()
|
||||
inv.Register(actorstypes.Version0, nil, testActor{})
|
||||
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
||||
inv.Register(actorstypes.Version0, nil, registry)
|
||||
|
||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||
|
@ -38,7 +38,6 @@ func GetReturnType(ctx context.Context, sm *StateManager, to address.Address, me
|
||||
return nil, fmt.Errorf("unknown method %d for actor %s", method, act.Code)
|
||||
}
|
||||
|
||||
fmt.Println("found ", m.Ret, " and ", m.Params, " for ", m.Num)
|
||||
return reflect.New(m.Ret.Elem()).Interface().(cbg.CBORUnmarshaler), nil
|
||||
}
|
||||
|
||||
|
@ -383,10 +383,15 @@ func NewDebugFVM(ctx context.Context, opts *VMOpts) (*FVM, error) {
|
||||
return xerrors.Errorf("loading debug manifest: %w", err)
|
||||
}
|
||||
|
||||
av, err := actorstypes.VersionForNetwork(opts.NetworkVersion)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting actors version: %w", err)
|
||||
}
|
||||
|
||||
// create actor redirect mapping
|
||||
actorRedirect := make(map[cid.Cid]cid.Cid)
|
||||
for _, key := range actors.GetBuiltinActorsKeys() {
|
||||
from, ok := actors.GetActorCodeID(actorstypes.Version8, key)
|
||||
for _, key := range actors.GetBuiltinActorsKeys(av) {
|
||||
from, ok := actors.GetActorCodeID(av, key)
|
||||
if !ok {
|
||||
log.Warnf("actor missing in the from manifest %s", key)
|
||||
continue
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -13,9 +12,9 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtinst "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
rtt "github.com/filecoin-project/go-state-types/rt"
|
||||
vmr "github.com/filecoin-project/specs-actors/v7/actors/runtime"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
@ -25,7 +24,7 @@ import (
|
||||
)
|
||||
|
||||
type MethodMeta struct {
|
||||
Num string
|
||||
Name string
|
||||
|
||||
Params reflect.Type
|
||||
Ret reflect.Type
|
||||
@ -38,27 +37,27 @@ type ActorRegistry struct {
|
||||
}
|
||||
|
||||
// An ActorPredicate returns an error if the given actor is not valid for the given runtime environment (e.g., chain height, version, etc.).
|
||||
type ActorPredicate func(vmr.Runtime, rtt.VMActor) error
|
||||
type ActorPredicate func(vmr.Runtime, cid.Cid) error
|
||||
|
||||
func ActorsVersionPredicate(ver actorstypes.Version) ActorPredicate {
|
||||
return func(rt vmr.Runtime, v rtt.VMActor) error {
|
||||
return func(rt vmr.Runtime, codeCid cid.Cid) error {
|
||||
aver, err := actorstypes.VersionForNetwork(rt.NetworkVersion())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("unsupported network version: %w", err)
|
||||
}
|
||||
if aver != ver {
|
||||
return xerrors.Errorf("actor %s is a version %d actor; chain only supports actor version %d at height %d and nver %d", v.Code(), ver, aver, rt.CurrEpoch(), rt.NetworkVersion())
|
||||
return xerrors.Errorf("actor %s is a version %d actor; chain only supports actor version %d at height %d and nver %d", codeCid, ver, aver, rt.CurrEpoch(), rt.NetworkVersion())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
type invokeFunc func(rt vmr.Runtime, params []byte) ([]byte, aerrors.ActorError)
|
||||
type nativeCode []invokeFunc
|
||||
type nativeCode map[uint64]invokeFunc
|
||||
|
||||
type actorInfo struct {
|
||||
methods nativeCode
|
||||
vmActor rtt.VMActor
|
||||
vmActor builtin.RegistryEntry
|
||||
// TODO: consider making this a network version range?
|
||||
predicate ActorPredicate
|
||||
}
|
||||
@ -76,25 +75,30 @@ func (ar *ActorRegistry) Invoke(codeCid cid.Cid, rt vmr.Runtime, method abi.Meth
|
||||
log.Errorf("no code for actor %s (Addr: %s)", codeCid, rt.Receiver())
|
||||
return nil, aerrors.Newf(exitcode.SysErrorIllegalActor, "no code for actor %s(%d)(%s)", codeCid, method, hex.EncodeToString(params))
|
||||
}
|
||||
if err := act.predicate(rt, act.vmActor); err != nil {
|
||||
if err := act.predicate(rt, codeCid); err != nil {
|
||||
return nil, aerrors.Newf(exitcode.SysErrorIllegalActor, "unsupported actor: %s", err)
|
||||
}
|
||||
if method >= abi.MethodNum(len(act.methods)) || act.methods[method] == nil {
|
||||
if act.methods[uint64(method)] == nil {
|
||||
return nil, aerrors.Newf(exitcode.SysErrInvalidMethod, "no method %d on actor", method)
|
||||
}
|
||||
return act.methods[method](rt, params)
|
||||
return act.methods[uint64(method)](rt, params)
|
||||
|
||||
}
|
||||
|
||||
func (ar *ActorRegistry) Register(av actorstypes.Version, pred ActorPredicate, vmactors ...rtt.VMActor) {
|
||||
func (ar *ActorRegistry) Register(av actorstypes.Version, pred ActorPredicate, vmactors []builtin.RegistryEntry) {
|
||||
if pred == nil {
|
||||
pred = func(vmr.Runtime, rtt.VMActor) error { return nil }
|
||||
pred = func(vmr.Runtime, cid.Cid) error { return nil }
|
||||
}
|
||||
for _, a := range vmactors {
|
||||
// register in the `actors` map (for the invoker)
|
||||
code, err := ar.transform(a)
|
||||
if err != nil {
|
||||
panic(xerrors.Errorf("%s: %w", string(a.Code().Hash()), err))
|
||||
|
||||
var code nativeCode
|
||||
var err error
|
||||
if av <= actorstypes.Version7 {
|
||||
// register in the `actors` map (for the invoker)
|
||||
code, err = ar.transform(a)
|
||||
if err != nil {
|
||||
panic(xerrors.Errorf("%s: %w", string(a.Code().Hash()), err))
|
||||
}
|
||||
}
|
||||
|
||||
ai := &actorInfo{
|
||||
@ -124,7 +128,7 @@ func (ar *ActorRegistry) Register(av actorstypes.Version, pred ActorPredicate, v
|
||||
|
||||
// Explicitly add send, it's special.
|
||||
methods[builtin.MethodSend] = MethodMeta{
|
||||
Num: "0",
|
||||
Name: "Send",
|
||||
Params: reflect.TypeOf(new(abi.EmptyValue)),
|
||||
Ret: reflect.TypeOf(new(abi.EmptyValue)),
|
||||
}
|
||||
@ -132,18 +136,27 @@ func (ar *ActorRegistry) Register(av actorstypes.Version, pred ActorPredicate, v
|
||||
// Iterate over exported methods. Some of these _may_ be nil and
|
||||
// must be skipped.
|
||||
for number, export := range exports {
|
||||
if export == nil {
|
||||
if export.Method == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
ev := reflect.ValueOf(export)
|
||||
ev := reflect.ValueOf(export.Method)
|
||||
et := ev.Type()
|
||||
|
||||
methods[abi.MethodNum(number)] = MethodMeta{
|
||||
Num: strconv.Itoa(number),
|
||||
Params: et.In(1),
|
||||
Ret: et.Out(0),
|
||||
mm := MethodMeta{
|
||||
Name: export.Name,
|
||||
Ret: et.Out(0),
|
||||
}
|
||||
|
||||
if av <= actorstypes.Version7 {
|
||||
// methods exported from specs-actors have the runtime as the first param, so we want et.In(1)
|
||||
mm.Params = et.In(1)
|
||||
} else {
|
||||
// methods exported from go-state-types do not, so we want et.In(0)
|
||||
mm.Params = et.In(0)
|
||||
}
|
||||
|
||||
methods[abi.MethodNum(number)] = mm
|
||||
}
|
||||
if realCode.Defined() {
|
||||
ar.Methods[realCode] = methods
|
||||
@ -159,13 +172,10 @@ func (ar *ActorRegistry) Create(codeCid cid.Cid, rt vmr.Runtime) (*types.Actor,
|
||||
return nil, aerrors.Newf(exitcode.SysErrorIllegalArgument, "Can only create built-in actors.")
|
||||
}
|
||||
|
||||
if err := act.predicate(rt, act.vmActor); err != nil {
|
||||
if err := act.predicate(rt, codeCid); err != nil {
|
||||
return nil, aerrors.Newf(exitcode.SysErrorIllegalArgument, "Cannot create actor: %w", err)
|
||||
}
|
||||
|
||||
if rtt.IsSingletonActor(act.vmActor) {
|
||||
return nil, aerrors.Newf(exitcode.SysErrorIllegalArgument, "Can only have one instance of singleton actors.")
|
||||
}
|
||||
return &types.Actor{
|
||||
Code: codeCid,
|
||||
Head: EmptyObjectCid,
|
||||
@ -175,15 +185,16 @@ func (ar *ActorRegistry) Create(codeCid cid.Cid, rt vmr.Runtime) (*types.Actor,
|
||||
}
|
||||
|
||||
type invokee interface {
|
||||
Exports() []interface{}
|
||||
Exports() map[uint64]builtinst.MethodMeta
|
||||
}
|
||||
|
||||
func (*ActorRegistry) transform(instance invokee) (nativeCode, error) {
|
||||
itype := reflect.TypeOf(instance)
|
||||
exports := instance.Exports()
|
||||
runtimeType := reflect.TypeOf((*vmr.Runtime)(nil)).Elem()
|
||||
for i, m := range exports {
|
||||
for i, e := range exports {
|
||||
i := i
|
||||
m := e.Method
|
||||
newErr := func(format string, args ...interface{}) error {
|
||||
str := fmt.Sprintf(format, args...)
|
||||
return fmt.Errorf("transform(%s) export(%d): %s", itype.Name(), i, str)
|
||||
@ -219,7 +230,8 @@ func (*ActorRegistry) transform(instance invokee) (nativeCode, error) {
|
||||
}
|
||||
}
|
||||
code := make(nativeCode, len(exports))
|
||||
for id, m := range exports {
|
||||
for id, e := range exports {
|
||||
m := e.Method
|
||||
if m == nil {
|
||||
continue
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
"github.com/stretchr/testify/assert"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -13,15 +14,28 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
cbor2 "github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/go-state-types/rt"
|
||||
runtime2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
|
||||
type basicContract struct{}
|
||||
|
||||
func (b basicContract) Code() cid.Cid {
|
||||
return cid.Undef
|
||||
}
|
||||
|
||||
func (b basicContract) State() cbor2.Er {
|
||||
// works well enough as a dummy state
|
||||
return new(basicParams)
|
||||
}
|
||||
|
||||
type basicParams struct {
|
||||
B byte
|
||||
}
|
||||
@ -107,7 +121,8 @@ func (*basicRtMessage) ValueReceived() abi.TokenAmount {
|
||||
func TestInvokerBasic(t *testing.T) {
|
||||
//stm: @INVOKER_TRANSFORM_001
|
||||
inv := ActorRegistry{}
|
||||
code, err := inv.transform(basicContract{})
|
||||
registry := builtin.MakeRegistryLegacy([]rt.VMActor{basicContract{}})
|
||||
code, err := inv.transform(registry[0])
|
||||
assert.NoError(t, err)
|
||||
|
||||
{
|
||||
|
@ -495,8 +495,8 @@ var ChainInspectUsage = &cli.Command{
|
||||
|
||||
mm := filcns.NewActorRegistry().Methods[code][m.Message.Method] // TODO: use remote map
|
||||
|
||||
byMethod[mm.Num] += m.Message.GasLimit
|
||||
byMethodC[mm.Num]++
|
||||
byMethod[mm.Name] += m.Message.GasLimit
|
||||
byMethodC[mm.Name]++
|
||||
}
|
||||
|
||||
type keyGasPair struct {
|
||||
|
@ -327,8 +327,7 @@ func TestInspectUsage(t *testing.T) {
|
||||
// check for gas by sender
|
||||
assert.Contains(t, out, "By Sender")
|
||||
// check for gas by method
|
||||
methodStr := fmt.Sprintf("By Method:\n%d", builtin.MethodSend)
|
||||
assert.Contains(t, out, methodStr)
|
||||
assert.Contains(t, out, "By Method:\nSend")
|
||||
})
|
||||
}
|
||||
|
||||
|
250
cli/filplus.go
250
cli/filplus.go
@ -5,6 +5,8 @@ import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
"github.com/urfave/cli/v2"
|
||||
@ -12,6 +14,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
verifregtypes8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
|
||||
verifregtypes9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
@ -22,8 +25,10 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/datacap"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/tablewriter"
|
||||
)
|
||||
|
||||
var filplusCmd = &cli.Command{
|
||||
@ -37,12 +42,15 @@ var filplusCmd = &cli.Command{
|
||||
filplusCheckClientCmd,
|
||||
filplusCheckNotaryCmd,
|
||||
filplusSignRemoveDataCapProposal,
|
||||
filplusListAllocationsCmd,
|
||||
filplusRemoveExpiredAllocationsCmd,
|
||||
},
|
||||
}
|
||||
|
||||
var filplusVerifyClientCmd = &cli.Command{
|
||||
Name: "grant-datacap",
|
||||
Usage: "give allowance to the specified verified client address",
|
||||
Name: "grant-datacap",
|
||||
Usage: "give allowance to the specified verified client address",
|
||||
ArgsUsage: "[clientAddress datacap]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "from",
|
||||
@ -132,6 +140,10 @@ var filplusListNotariesCmd = &cli.Command{
|
||||
Name: "list-notaries",
|
||||
Usage: "list all notaries",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.NArg() != 0 {
|
||||
return IncorrectNumArgs(cctx)
|
||||
}
|
||||
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -162,6 +174,10 @@ var filplusListClientsCmd = &cli.Command{
|
||||
Name: "list-clients",
|
||||
Usage: "list all verified clients",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.NArg() != 0 {
|
||||
return IncorrectNumArgs(cctx)
|
||||
}
|
||||
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -169,15 +185,40 @@ var filplusListClientsCmd = &cli.Command{
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
act, err := api.StateGetActor(ctx, verifreg.Address, types.EmptyTSK)
|
||||
apibs := blockstore.NewAPIBlockstore(api)
|
||||
store := adt.WrapStore(ctx, cbor.NewCborStore(apibs))
|
||||
|
||||
nv, err := api.StateNetworkVersion(ctx, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
apibs := blockstore.NewAPIBlockstore(api)
|
||||
store := adt.WrapStore(ctx, cbor.NewCborStore(apibs))
|
||||
av, err := actorstypes.VersionForNetwork(nv)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st, err := verifreg.Load(store, act)
|
||||
if av <= 8 {
|
||||
act, err := api.StateGetActor(ctx, verifreg.Address, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st, err := verifreg.Load(store, act)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return st.ForEachClient(func(addr address.Address, dcap abi.StoragePower) error {
|
||||
_, err := fmt.Printf("%s: %s\n", addr, dcap)
|
||||
return err
|
||||
})
|
||||
}
|
||||
act, err := api.StateGetActor(ctx, datacap.Address, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st, err := datacap.Load(store, act)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -188,11 +229,186 @@ var filplusListClientsCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var filplusCheckClientCmd = &cli.Command{
|
||||
Name: "check-client-datacap",
|
||||
Usage: "check verified client remaining bytes",
|
||||
var filplusListAllocationsCmd = &cli.Command{
|
||||
Name: "list-allocations",
|
||||
Usage: "List allocations made by client",
|
||||
ArgsUsage: "clientAddress",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "expired",
|
||||
Usage: "list only expired allocations",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if !cctx.Args().Present() {
|
||||
if cctx.NArg() != 1 {
|
||||
return IncorrectNumArgs(cctx)
|
||||
}
|
||||
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
clientAddr, err := address.NewFromString(cctx.Args().Get(0))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
clientIdAddr, err := api.StateLookupID(ctx, clientAddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
store := adt.WrapStore(ctx, cbor.NewCborStore(blockstore.NewAPIBlockstore(api)))
|
||||
|
||||
verifregActor, err := api.StateGetActor(ctx, verifreg.Address, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
verifregState, err := verifreg.Load(store, verifregActor)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ts, err := api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
allocationsMap, err := verifregState.GetAllocations(clientIdAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tw := tablewriter.New(
|
||||
tablewriter.Col("ID"),
|
||||
tablewriter.Col("Provider"),
|
||||
tablewriter.Col("Data"),
|
||||
tablewriter.Col("Size"),
|
||||
tablewriter.Col("TermMin"),
|
||||
tablewriter.Col("TermMax"),
|
||||
tablewriter.Col("Expiration"),
|
||||
)
|
||||
|
||||
for allocationId, allocation := range allocationsMap {
|
||||
if ts.Height() > allocation.Expiration || !cctx.IsSet("expired") {
|
||||
tw.Write(map[string]interface{}{
|
||||
"ID": allocationId,
|
||||
"Provider": allocation.Provider,
|
||||
"Data": allocation.Data,
|
||||
"Size": allocation.Size,
|
||||
"TermMin": allocation.TermMin,
|
||||
"TermMax": allocation.TermMax,
|
||||
"Expiration": allocation.Expiration,
|
||||
})
|
||||
}
|
||||
}
|
||||
return tw.Flush(os.Stdout)
|
||||
},
|
||||
}
|
||||
|
||||
var filplusRemoveExpiredAllocationsCmd = &cli.Command{
|
||||
Name: "remove-expired-allocations",
|
||||
Usage: "remove expired allocations (if no allocations are specified all eligible allocations are removed)",
|
||||
ArgsUsage: "clientAddress Optional[...allocationId]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "from",
|
||||
Usage: "optionally specify the account to send the message from",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.NArg() < 1 {
|
||||
return IncorrectNumArgs(cctx)
|
||||
}
|
||||
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
args := cctx.Args().Slice()
|
||||
|
||||
clientAddr, err := address.NewFromString(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
clientIdAddr, err := api.StateLookupID(ctx, clientAddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
clientId, err := address.IDFromAddress(clientIdAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fromAddr := clientIdAddr
|
||||
if from := cctx.String("from"); from != "" {
|
||||
addr, err := address.NewFromString(from)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fromAddr = addr
|
||||
}
|
||||
|
||||
allocationIDs := make([]verifregtypes9.AllocationId, len(args)-1)
|
||||
for i, allocationString := range args[1:] {
|
||||
id, err := strconv.ParseUint(allocationString, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
allocationIDs[i] = verifregtypes9.AllocationId(id)
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&verifregtypes9.RemoveExpiredAllocationsParams{
|
||||
Client: abi.ActorID(clientId),
|
||||
AllocationIds: allocationIDs,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg := &types.Message{
|
||||
To: verifreg.Address,
|
||||
From: fromAddr,
|
||||
Method: verifreg.Methods.RemoveExpiredAllocations,
|
||||
Params: params,
|
||||
}
|
||||
|
||||
smsg, err := api.MpoolPushMessage(ctx, msg, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("message sent, now waiting on cid: %s\n", smsg.Cid())
|
||||
|
||||
mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if mwait.Receipt.ExitCode.IsError() {
|
||||
return fmt.Errorf("failed to remove expired allocations: %d", mwait.Receipt.ExitCode)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var filplusCheckClientCmd = &cli.Command{
|
||||
Name: "check-client-datacap",
|
||||
Usage: "check verified client remaining bytes",
|
||||
ArgsUsage: "clientAddress",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must specify client address to check")
|
||||
}
|
||||
|
||||
@ -223,10 +439,11 @@ var filplusCheckClientCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var filplusCheckNotaryCmd = &cli.Command{
|
||||
Name: "check-notary-datacap",
|
||||
Usage: "check a notary's remaining bytes",
|
||||
Name: "check-notary-datacap",
|
||||
Usage: "check a notary's remaining bytes",
|
||||
ArgsUsage: "notaryAddress",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if !cctx.Args().Present() {
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must specify notary address to check")
|
||||
}
|
||||
|
||||
@ -279,8 +496,9 @@ func checkNotary(ctx context.Context, api v0api.FullNode, vaddr address.Address)
|
||||
}
|
||||
|
||||
var filplusSignRemoveDataCapProposal = &cli.Command{
|
||||
Name: "sign-remove-data-cap-proposal",
|
||||
Usage: "allows a notary to sign a Remove Data Cap Proposal",
|
||||
Name: "sign-remove-data-cap-proposal",
|
||||
Usage: "allows a notary to sign a Remove Data Cap Proposal",
|
||||
ArgsUsage: "[verifierAddress clientAddress allowanceToRemove]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.Int64Flag{
|
||||
Name: "id",
|
||||
@ -336,7 +554,7 @@ var filplusSignRemoveDataCapProposal = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
_, dataCap, err := st.VerifiedClientDataCap(clientIdAddr)
|
||||
dataCap, err := api.StateVerifiedClientStatus(ctx, clientIdAddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to find verified client data cap: %w", err)
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ var msigInspectCmd = &cli.Command{
|
||||
paramStr = string(b)
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "%d\t%s\t%d\t%s\t%s\t%s(%d)\t%s\n", txid, "pending", len(tx.Approved), target, types.FIL(tx.Value), method.Num, tx.Method, paramStr)
|
||||
fmt.Fprintf(w, "%d\t%s\t%d\t%s\t%s\t%s(%d)\t%s\n", txid, "pending", len(tx.Approved), target, types.FIL(tx.Value), method.Name, tx.Method, paramStr)
|
||||
}
|
||||
}
|
||||
if err := w.Flush(); err != nil {
|
||||
|
@ -1407,7 +1407,7 @@ func codeStr(c cid.Cid) string {
|
||||
}
|
||||
|
||||
func getMethod(code cid.Cid, method abi.MethodNum) string {
|
||||
return filcns.NewActorRegistry().Methods[code][method].Num // todo: use remote
|
||||
return filcns.NewActorRegistry().Methods[code][method].Name // todo: use remote
|
||||
}
|
||||
|
||||
func toFil(f types.BigInt) types.FIL {
|
||||
|
@ -816,7 +816,7 @@ func bps(sectorSize abi.SectorSize, sectorNum int, d time.Duration) string {
|
||||
}
|
||||
|
||||
func spt(ssize abi.SectorSize) abi.RegisteredSealProof {
|
||||
spt, err := miner.SealProofTypeFromSectorSize(ssize, build.NewestNetworkVersion)
|
||||
spt, err := miner.SealProofTypeFromSectorSize(ssize, build.TestNetworkVersion)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
"github.com/filecoin-project/go-statestore"
|
||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
||||
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
|
||||
@ -395,7 +395,7 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string
|
||||
return mds.Put(ctx, datastore.NewKey(pipeline.StorageCounterDSPrefix), buf[:size])
|
||||
}
|
||||
|
||||
func findMarketDealID(ctx context.Context, api v1api.FullNode, deal market8.DealProposal) (abi.DealID, error) {
|
||||
func findMarketDealID(ctx context.Context, api v1api.FullNode, deal markettypes.DealProposal) (abi.DealID, error) {
|
||||
// TODO: find a better way
|
||||
// (this is only used by genesis miners)
|
||||
|
||||
|
@ -539,7 +539,7 @@ var genesisSetActorVersionCmd = &cli.Command{
|
||||
}
|
||||
|
||||
nv := network.Version(cctx.Int("network-version"))
|
||||
if nv > build.NewestNetworkVersion {
|
||||
if nv > build.TestNetworkVersion {
|
||||
return xerrors.Errorf("invalid network version: %d", nv)
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"github.com/filecoin-project/go-commp-utils/zerocomm"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
||||
@ -250,12 +250,12 @@ func WriteGenesisMiner(maddr address.Address, sbroot string, gm *genesis.Miner,
|
||||
|
||||
func createDeals(m *genesis.Miner, k *key.Key, maddr address.Address, ssize abi.SectorSize) error {
|
||||
for i, sector := range m.Sectors {
|
||||
label, err := market8.NewLabelFromString(fmt.Sprintf("%d", i))
|
||||
label, err := markettypes.NewLabelFromString(fmt.Sprintf("%d", i))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error creating deal label: %w", err)
|
||||
}
|
||||
|
||||
proposal := &market8.DealProposal{
|
||||
proposal := &markettypes.DealProposal{
|
||||
PieceCID: sector.CommD,
|
||||
PieceSize: abi.PaddedPieceSize(ssize),
|
||||
Client: k.Address,
|
||||
@ -268,7 +268,7 @@ func createDeals(m *genesis.Miner, k *key.Key, maddr address.Address, ssize abi.
|
||||
ClientCollateral: big.Zero(),
|
||||
}
|
||||
|
||||
sector.DealClientKey = k
|
||||
sector.DealClientKey = k.KeyInfo
|
||||
sector.Deal = *proposal
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,177 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/urfave/cli/v2"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
)
|
||||
|
||||
var diffCmd = &cli.Command{
|
||||
Name: "diff",
|
||||
Usage: "diff state objects",
|
||||
Subcommands: []*cli.Command{diffStateTrees},
|
||||
Name: "diff",
|
||||
Usage: "diff state objects",
|
||||
Subcommands: []*cli.Command{
|
||||
diffStateTrees,
|
||||
diffMinerStates,
|
||||
},
|
||||
}
|
||||
|
||||
var diffMinerStates = &cli.Command{
|
||||
Name: "miner-states",
|
||||
Usage: "diff two miner-states",
|
||||
ArgsUsage: "<stateCidA> <stateCidB>",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "repo",
|
||||
Value: "~/.lotus",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
ctx := context.TODO()
|
||||
|
||||
if cctx.NArg() != 2 {
|
||||
return lcli.IncorrectNumArgs(cctx)
|
||||
}
|
||||
|
||||
stCidA, err := cid.Decode(cctx.Args().First())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse input: %w", err)
|
||||
}
|
||||
|
||||
stCidB, err := cid.Decode(cctx.Args().Get(1))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse input: %w", err)
|
||||
}
|
||||
|
||||
fsrepo, err := repo.NewFS(cctx.String("repo"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
lkrepo, err := fsrepo.Lock(repo.FullNode)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer lkrepo.Close() //nolint:errcheck
|
||||
|
||||
bs, err := lkrepo.Blockstore(ctx, repo.UniversalBlockstore)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open blockstore: %w", err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if c, ok := bs.(io.Closer); ok {
|
||||
if err := c.Close(); err != nil {
|
||||
log.Warnf("failed to close blockstore: %s", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
actorStore := store.ActorStore(ctx, bs)
|
||||
|
||||
var minerStA miner9.State
|
||||
if err = actorStore.Get(ctx, stCidA, &minerStA); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var minerStB miner9.State
|
||||
if err = actorStore.Get(ctx, stCidB, &minerStB); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println(minerStA.Deadlines)
|
||||
fmt.Println(minerStB.Deadlines)
|
||||
|
||||
minerDeadlinesA, err := minerStA.LoadDeadlines(actorStore)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
minerDeadlinesB, err := minerStB.LoadDeadlines(actorStore)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i, dACid := range minerDeadlinesA.Due {
|
||||
dBCid := minerDeadlinesB.Due[i]
|
||||
if dACid != dBCid {
|
||||
fmt.Println("Difference at index ", i, dACid, " != ", dBCid)
|
||||
dA, err := minerDeadlinesA.LoadDeadline(actorStore, uint64(i))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dB, err := minerDeadlinesB.LoadDeadline(actorStore, uint64(i))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if dA.SectorsSnapshot != dB.SectorsSnapshot {
|
||||
fmt.Println("They differ at Sectors snapshot ", dA.SectorsSnapshot, " != ", dB.SectorsSnapshot)
|
||||
|
||||
sectorsSnapshotA, err := miner9.LoadSectors(actorStore, dA.SectorsSnapshot)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sectorsSnapshotB, err := miner9.LoadSectors(actorStore, dB.SectorsSnapshot)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if sectorsSnapshotA.Length() != sectorsSnapshotB.Length() {
|
||||
fmt.Println("sector snapshots have different lengts!")
|
||||
}
|
||||
|
||||
var infoA miner9.SectorOnChainInfo
|
||||
err = sectorsSnapshotA.ForEach(&infoA, func(i int64) error {
|
||||
infoB, ok, err := sectorsSnapshotB.Get(abi.SectorNumber(i))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !ok {
|
||||
fmt.Println(i, "isn't found in infoB!!")
|
||||
}
|
||||
|
||||
if !infoA.DealWeight.Equals(infoB.DealWeight) {
|
||||
fmt.Println("Deal Weights differ! ", infoA.DealWeight, infoB.DealWeight)
|
||||
}
|
||||
|
||||
if !infoA.VerifiedDealWeight.Equals(infoB.VerifiedDealWeight) {
|
||||
fmt.Println("Verified Deal Weights differ! ", infoA.VerifiedDealWeight, infoB.VerifiedDealWeight)
|
||||
}
|
||||
|
||||
infoStrA := fmt.Sprint(infoA)
|
||||
infoStrB := fmt.Sprint(*infoB)
|
||||
if infoStrA != infoStrB {
|
||||
fmt.Println(infoStrA)
|
||||
fmt.Println(infoStrB)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var diffStateTrees = &cli.Command{
|
||||
|
142
cmd/lotus-shed/invariants.go
Normal file
142
cmd/lotus-shed/invariants.go
Normal file
@ -0,0 +1,142 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/urfave/cli/v2"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
v8 "github.com/filecoin-project/go-state-types/builtin/v8"
|
||||
v9 "github.com/filecoin-project/go-state-types/builtin/v9"
|
||||
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
)
|
||||
|
||||
var invariantsCmd = &cli.Command{
|
||||
Name: "check-invariants",
|
||||
Description: "Check state invariants",
|
||||
ArgsUsage: "[StateRootCid, height]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "repo",
|
||||
Value: "~/.lotus",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
ctx := context.TODO()
|
||||
|
||||
if cctx.NArg() != 2 {
|
||||
return lcli.IncorrectNumArgs(cctx)
|
||||
}
|
||||
|
||||
stateRootCid, err := cid.Decode(cctx.Args().Get(0))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse state root cid: %w", err)
|
||||
}
|
||||
|
||||
epoch, err := strconv.ParseInt(cctx.Args().Get(1), 10, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse epoch: %w", err)
|
||||
}
|
||||
|
||||
fsrepo, err := repo.NewFS(cctx.String("repo"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
lkrepo, err := fsrepo.Lock(repo.FullNode)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer lkrepo.Close() //nolint:errcheck
|
||||
|
||||
bs, err := lkrepo.Blockstore(ctx, repo.UniversalBlockstore)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open blockstore: %w", err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if c, ok := bs.(io.Closer); ok {
|
||||
if err := c.Close(); err != nil {
|
||||
log.Warnf("failed to close blockstore: %s", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
mds, err := lkrepo.Datastore(context.Background(), "/metadata")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cs := store.NewChainStore(bs, bs, mds, filcns.Weight, nil)
|
||||
defer cs.Close() //nolint:errcheck
|
||||
|
||||
sm, err := stmgr.NewStateManager(cs, filcns.NewTipSetExecutor(), vm.Syscalls(ffiwrapper.ProofVerifier), filcns.DefaultUpgradeSchedule(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nv := sm.GetNetworkVersion(ctx, abi.ChainEpoch(epoch))
|
||||
fmt.Println("Network Version ", nv)
|
||||
|
||||
av, err := actorstypes.VersionForNetwork(nv)
|
||||
fmt.Println("Actors Version ", av)
|
||||
|
||||
actorCodeCids, err := actors.GetActorCodeIDs(av)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
actorStore := store.ActorStore(ctx, blockstore.NewTieredBstore(bs, blockstore.NewMemorySync()))
|
||||
|
||||
// Load the state root.
|
||||
var stateRoot types.StateRoot
|
||||
if err := actorStore.Get(ctx, stateRootCid, &stateRoot); err != nil {
|
||||
return xerrors.Errorf("failed to decode state root: %w", err)
|
||||
}
|
||||
|
||||
actorTree, err := builtin.LoadTree(actorStore, stateRoot.Actors)
|
||||
|
||||
startTime := time.Now()
|
||||
|
||||
var messages *builtin.MessageAccumulator
|
||||
switch av {
|
||||
case actorstypes.Version8:
|
||||
messages, err = v8.CheckStateInvariants(actorTree, abi.ChainEpoch(epoch), actorCodeCids)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("checking state invariants: %w", err)
|
||||
}
|
||||
case actorstypes.Version9:
|
||||
messages, err = v9.CheckStateInvariants(actorTree, abi.ChainEpoch(epoch), actorCodeCids)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("checking state invariants: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("completed, took ", time.Since(startTime))
|
||||
|
||||
for _, message := range messages.Messages() {
|
||||
fmt.Println("got the following error: ", message)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user