Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synthetic PoRep #193

Merged
merged 14 commits into from
Aug 2, 2023
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ gen:
$(GO_BIN) run ./builtin/v9/gen/gen.go
$(GO_BIN) run ./builtin/v10/gen/gen.go
$(GO_BIN) run ./builtin/v11/gen/gen.go
$(GO_BIN) run ./builtin/v12/gen/gen.go
.PHONY: gen

lint:
Expand Down
49 changes: 49 additions & 0 deletions abi/sector.go
magik6k marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,22 @@ const (
RegisteredSealProof_StackedDrg512MiBV1_1 = RegisteredSealProof(7)
RegisteredSealProof_StackedDrg32GiBV1_1 = RegisteredSealProof(8)
RegisteredSealProof_StackedDrg64GiBV1_1 = RegisteredSealProof(9)

RegisteredSealProof_StackedDrg2KiBV1_1_Feat_SyntheticPoRep = RegisteredSealProof(10)
RegisteredSealProof_StackedDrg8MiBV1_1_Feat_SyntheticPoRep = RegisteredSealProof(11)
RegisteredSealProof_StackedDrg512MiBV1_1_Feat_SyntheticPoRep = RegisteredSealProof(12)
RegisteredSealProof_StackedDrg32GiBV1_1_Feat_SyntheticPoRep = RegisteredSealProof(13)
RegisteredSealProof_StackedDrg64GiBV1_1_Feat_SyntheticPoRep = RegisteredSealProof(14)
)

var Synthetic = map[RegisteredSealProof]bool{
RegisteredSealProof_StackedDrg2KiBV1_1_Feat_SyntheticPoRep: true,
RegisteredSealProof_StackedDrg8MiBV1_1_Feat_SyntheticPoRep: true,
RegisteredSealProof_StackedDrg512MiBV1_1_Feat_SyntheticPoRep: true,
RegisteredSealProof_StackedDrg32GiBV1_1_Feat_SyntheticPoRep: true,
RegisteredSealProof_StackedDrg64GiBV1_1_Feat_SyntheticPoRep: true,
}

type RegisteredPoStProof int64

const (
Expand Down Expand Up @@ -233,6 +247,41 @@ var SealProofInfos = map[RegisteredSealProof]*SealProofInfo{
WindowPoStProof: RegisteredPoStProof_StackedDrgWindow64GiBV1,
UpdateProof: RegisteredUpdateProof_StackedDrg64GiBV1,
},
RegisteredSealProof_StackedDrg2KiBV1_1_Feat_SyntheticPoRep: {
ProofSize: 192,
SectorSize: ss2KiB,
WinningPoStProof: RegisteredPoStProof_StackedDrgWinning2KiBV1,
WindowPoStProof: RegisteredPoStProof_StackedDrgWindow2KiBV1,
UpdateProof: RegisteredUpdateProof_StackedDrg2KiBV1,
},
RegisteredSealProof_StackedDrg8MiBV1_1_Feat_SyntheticPoRep: {
ProofSize: 192,
SectorSize: ss8MiB,
WinningPoStProof: RegisteredPoStProof_StackedDrgWinning8MiBV1,
WindowPoStProof: RegisteredPoStProof_StackedDrgWindow8MiBV1,
UpdateProof: RegisteredUpdateProof_StackedDrg8MiBV1,
},
RegisteredSealProof_StackedDrg512MiBV1_1_Feat_SyntheticPoRep: {
ProofSize: 192,
SectorSize: ss512MiB,
WinningPoStProof: RegisteredPoStProof_StackedDrgWinning512MiBV1,
WindowPoStProof: RegisteredPoStProof_StackedDrgWindow512MiBV1,
UpdateProof: RegisteredUpdateProof_StackedDrg512MiBV1,
},
RegisteredSealProof_StackedDrg32GiBV1_1_Feat_SyntheticPoRep: {
ProofSize: 1920,
SectorSize: ss32GiB,
WinningPoStProof: RegisteredPoStProof_StackedDrgWinning32GiBV1,
WindowPoStProof: RegisteredPoStProof_StackedDrgWindow32GiBV1,
UpdateProof: RegisteredUpdateProof_StackedDrg32GiBV1,
},
RegisteredSealProof_StackedDrg64GiBV1_1_Feat_SyntheticPoRep: {
ProofSize: 1920,
SectorSize: ss64GiB,
WinningPoStProof: RegisteredPoStProof_StackedDrgWinning64GiBV1,
WindowPoStProof: RegisteredPoStProof_StackedDrgWindow64GiBV1,
UpdateProof: RegisteredUpdateProof_StackedDrg64GiBV1,
},
}

// ProofSize returns the size of seal proofs for the given sector type.
Expand Down
3 changes: 3 additions & 0 deletions actors/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
Version9 Version = 9
Version10 Version = 10
Version11 Version = 11
Version12 Version = 12
)

// Converts a network version into an actors adt version.
Expand Down Expand Up @@ -47,6 +48,8 @@ func VersionForNetwork(version network.Version) (Version, error) {
return Version10, nil
case network.Version19, network.Version20:
return Version11, nil
case network.Version21:
return Version12, nil
default:
return -1, fmt.Errorf("unsupported network version %d", version)
}
Expand Down
9 changes: 9 additions & 0 deletions builtin/v12/account/account_state.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package account

import (
addr "github.com/filecoin-project/go-address"
)

type State struct {
Address addr.Address
}
6 changes: 6 additions & 0 deletions builtin/v12/account/account_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package account

type AuthenticateMessageParams struct {
Signature []byte
Message []byte
}
169 changes: 169 additions & 0 deletions builtin/v12/account/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions builtin/v12/account/invariants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package account

import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/builtin"
)

type StateSummary struct {
PubKeyAddr address.Address
}

// Checks internal invariants of account state.
func CheckStateInvariants(st *State, idAddr address.Address) (*StateSummary, *builtin.MessageAccumulator) {
acc := &builtin.MessageAccumulator{}
accountSummary := &StateSummary{
PubKeyAddr: st.Address,
}

if id, err := address.IDFromAddress(idAddr); err != nil {
acc.Addf("error extracting actor ID from address: %v", err)
} else if id >= builtin.FirstNonSingletonActorId {
acc.Require(st.Address.Protocol() == address.BLS || st.Address.Protocol() == address.SECP256K1,
"actor address %v must be BLS or SECP256K1 protocol", st.Address)
}

return accountSummary, acc
}
15 changes: 15 additions & 0 deletions builtin/v12/account/methods.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package account

import (
typegen "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin"
)

var Methods = map[abi.MethodNum]builtin.MethodMeta{
1: {"Constructor", *new(func(*address.Address) *abi.EmptyValue)}, // Constructor
2: {"PubkeyAddress", *new(func(*abi.EmptyValue) *address.Address)}, // PubkeyAddress
builtin.MustGenerateFRCMethodNum("AuthenticateMessage"): {"AuthenticateMessage", *new(func(*AuthenticateMessageParams) *typegen.CborBool)}, // AuthenticateMessage
}
Loading