Post rebase fix

This commit is contained in:
zenground0 2022-04-07 17:36:27 -06:00 committed by vyzo
parent 124fe26492
commit 7163fe61a0
9 changed files with 205 additions and 268 deletions

View File

@ -189,34 +189,8 @@ func (s *dealStates{{.v}}) array() adt.Array {
return s.Array
}
func fromV{{.v}}DealState(v{{.v}} market{{.v}}.DealState) (DealState, error) {
{{if (le .v 7)}}
label, err := labelFromGoString(v{{.v}}.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
{{else}}
label := v{{.v}}.Label
{{end}}
return DealProposal{
PieceCID : v{{.v}}.PieceCID,
PieceSize : v{{.v}}.PieceSize,
VerifiedDeal :v{{.v}}.VerifiedDeal,
Client :v{{.v}}.Client,
Provider :v{{.v}}.Provider,
Label: label,
StartEpoch : v{{.v}}.StartEpoch,
EndEpoch :v{{.v}}.EndEpoch,
StoragePricePerEpoch :v{{.v}}.StoragePricePerEpoch,
ProviderCollateral :v{{.v}}.ProviderCollateral,
ClientCollateral :v{{.v}}.ClientCollateral,
}, nil
func fromV{{.v}}DealState(v{{.v}} market{{.v}}.DealState) DealState {
return (DealState)(v{{.v}})
}
type dealProposals{{.v}} struct {
@ -271,31 +245,35 @@ func (s *dealProposals{{.v}}) array() adt.Array {
return s.Array
}
func fromV{{.v}}DealProposal(v{{.v}} market{{.v}}.DealProposal) DealProposal {
{{if .isv8 }}
label, err := v8.Label.ToString()
if err != nil {
bs, _ := v8.Label.ToBytes()
label = string(bs)
}
func fromV{{.v}}DealProposal(v{{.v}} market{{.v}}.DealProposal) (DealProposal, error) {
{{if (le .v 7)}}
label, err := labelFromGoString(v{{.v}}.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
{{else}}
label := v{{.v}}.Label
{{end}}
return DealProposal{
PieceCID: v8.PieceCID,
PieceSize: v8.PieceSize,
VerifiedDeal: v8.VerifiedDeal,
Client: v8.Client,
Provider: v8.Provider,
Label: label,
StartEpoch: v8.StartEpoch,
EndEpoch: v8.EndEpoch,
StoragePricePerEpoch: v8.StoragePricePerEpoch,
ProviderCollateral: v8.ProviderCollateral,
ClientCollateral: v8.ClientCollateral,
}
{{else}}
return (DealProposal)(v{{.v}})
{{end}}
PieceCID : v{{.v}}.PieceCID,
PieceSize : v{{.v}}.PieceSize,
VerifiedDeal :v{{.v}}.VerifiedDeal,
Client :v{{.v}}.Client,
Provider :v{{.v}}.Provider,
Label: label,
StartEpoch : v{{.v}}.StartEpoch,
EndEpoch :v{{.v}}.EndEpoch,
StoragePricePerEpoch :v{{.v}}.StoragePricePerEpoch,
ProviderCollateral :v{{.v}}.ProviderCollateral,
ClientCollateral :v{{.v}}.ClientCollateral,
}, nil
}
func (s *state{{.v}}) GetState() interface{} {
return &s.State
}

View File

@ -182,30 +182,8 @@ func (s *dealStates0) array() adt.Array {
return s.Array
}
func fromV0DealState(v0 market0.DealState) (DealState, error) {
label, err := labelFromGoString(v0.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v0.PieceCID,
PieceSize: v0.PieceSize,
VerifiedDeal: v0.VerifiedDeal,
Client: v0.Client,
Provider: v0.Provider,
Label: label,
StartEpoch: v0.StartEpoch,
EndEpoch: v0.EndEpoch,
StoragePricePerEpoch: v0.StoragePricePerEpoch,
ProviderCollateral: v0.ProviderCollateral,
ClientCollateral: v0.ClientCollateral,
}, nil
func fromV0DealState(v0 market0.DealState) DealState {
return (DealState)(v0)
}
type dealProposals0 struct {
@ -260,10 +238,29 @@ func (s *dealProposals0) array() adt.Array {
return s.Array
}
func fromV0DealProposal(v0 market0.DealProposal) DealProposal {
func fromV0DealProposal(v0 market0.DealProposal) (DealProposal, error) {
return (DealProposal)(v0)
label, err := labelFromGoString(v0.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v0.PieceCID,
PieceSize: v0.PieceSize,
VerifiedDeal: v0.VerifiedDeal,
Client: v0.Client,
Provider: v0.Provider,
Label: label,
StartEpoch: v0.StartEpoch,
EndEpoch: v0.EndEpoch,
StoragePricePerEpoch: v0.StoragePricePerEpoch,
ProviderCollateral: v0.ProviderCollateral,
ClientCollateral: v0.ClientCollateral,
}, nil
}
func (s *state0) GetState() interface{} {

View File

@ -182,30 +182,8 @@ func (s *dealStates2) array() adt.Array {
return s.Array
}
func fromV2DealState(v2 market2.DealState) (DealState, error) {
label, err := labelFromGoString(v2.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v2.PieceCID,
PieceSize: v2.PieceSize,
VerifiedDeal: v2.VerifiedDeal,
Client: v2.Client,
Provider: v2.Provider,
Label: label,
StartEpoch: v2.StartEpoch,
EndEpoch: v2.EndEpoch,
StoragePricePerEpoch: v2.StoragePricePerEpoch,
ProviderCollateral: v2.ProviderCollateral,
ClientCollateral: v2.ClientCollateral,
}, nil
func fromV2DealState(v2 market2.DealState) DealState {
return (DealState)(v2)
}
type dealProposals2 struct {
@ -260,10 +238,29 @@ func (s *dealProposals2) array() adt.Array {
return s.Array
}
func fromV2DealProposal(v2 market2.DealProposal) DealProposal {
func fromV2DealProposal(v2 market2.DealProposal) (DealProposal, error) {
return (DealProposal)(v2)
label, err := labelFromGoString(v2.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v2.PieceCID,
PieceSize: v2.PieceSize,
VerifiedDeal: v2.VerifiedDeal,
Client: v2.Client,
Provider: v2.Provider,
Label: label,
StartEpoch: v2.StartEpoch,
EndEpoch: v2.EndEpoch,
StoragePricePerEpoch: v2.StoragePricePerEpoch,
ProviderCollateral: v2.ProviderCollateral,
ClientCollateral: v2.ClientCollateral,
}, nil
}
func (s *state2) GetState() interface{} {

View File

@ -177,30 +177,8 @@ func (s *dealStates3) array() adt.Array {
return s.Array
}
func fromV3DealState(v3 market3.DealState) (DealState, error) {
label, err := labelFromGoString(v3.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v3.PieceCID,
PieceSize: v3.PieceSize,
VerifiedDeal: v3.VerifiedDeal,
Client: v3.Client,
Provider: v3.Provider,
Label: label,
StartEpoch: v3.StartEpoch,
EndEpoch: v3.EndEpoch,
StoragePricePerEpoch: v3.StoragePricePerEpoch,
ProviderCollateral: v3.ProviderCollateral,
ClientCollateral: v3.ClientCollateral,
}, nil
func fromV3DealState(v3 market3.DealState) DealState {
return (DealState)(v3)
}
type dealProposals3 struct {
@ -255,10 +233,29 @@ func (s *dealProposals3) array() adt.Array {
return s.Array
}
func fromV3DealProposal(v3 market3.DealProposal) DealProposal {
func fromV3DealProposal(v3 market3.DealProposal) (DealProposal, error) {
return (DealProposal)(v3)
label, err := labelFromGoString(v3.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v3.PieceCID,
PieceSize: v3.PieceSize,
VerifiedDeal: v3.VerifiedDeal,
Client: v3.Client,
Provider: v3.Provider,
Label: label,
StartEpoch: v3.StartEpoch,
EndEpoch: v3.EndEpoch,
StoragePricePerEpoch: v3.StoragePricePerEpoch,
ProviderCollateral: v3.ProviderCollateral,
ClientCollateral: v3.ClientCollateral,
}, nil
}
func (s *state3) GetState() interface{} {

View File

@ -177,30 +177,8 @@ func (s *dealStates4) array() adt.Array {
return s.Array
}
func fromV4DealState(v4 market4.DealState) (DealState, error) {
label, err := labelFromGoString(v4.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v4.PieceCID,
PieceSize: v4.PieceSize,
VerifiedDeal: v4.VerifiedDeal,
Client: v4.Client,
Provider: v4.Provider,
Label: label,
StartEpoch: v4.StartEpoch,
EndEpoch: v4.EndEpoch,
StoragePricePerEpoch: v4.StoragePricePerEpoch,
ProviderCollateral: v4.ProviderCollateral,
ClientCollateral: v4.ClientCollateral,
}, nil
func fromV4DealState(v4 market4.DealState) DealState {
return (DealState)(v4)
}
type dealProposals4 struct {
@ -255,10 +233,29 @@ func (s *dealProposals4) array() adt.Array {
return s.Array
}
func fromV4DealProposal(v4 market4.DealProposal) DealProposal {
func fromV4DealProposal(v4 market4.DealProposal) (DealProposal, error) {
return (DealProposal)(v4)
label, err := labelFromGoString(v4.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v4.PieceCID,
PieceSize: v4.PieceSize,
VerifiedDeal: v4.VerifiedDeal,
Client: v4.Client,
Provider: v4.Provider,
Label: label,
StartEpoch: v4.StartEpoch,
EndEpoch: v4.EndEpoch,
StoragePricePerEpoch: v4.StoragePricePerEpoch,
ProviderCollateral: v4.ProviderCollateral,
ClientCollateral: v4.ClientCollateral,
}, nil
}
func (s *state4) GetState() interface{} {

View File

@ -177,30 +177,8 @@ func (s *dealStates5) array() adt.Array {
return s.Array
}
func fromV5DealState(v5 market5.DealState) (DealState, error) {
label, err := labelFromGoString(v5.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v5.PieceCID,
PieceSize: v5.PieceSize,
VerifiedDeal: v5.VerifiedDeal,
Client: v5.Client,
Provider: v5.Provider,
Label: label,
StartEpoch: v5.StartEpoch,
EndEpoch: v5.EndEpoch,
StoragePricePerEpoch: v5.StoragePricePerEpoch,
ProviderCollateral: v5.ProviderCollateral,
ClientCollateral: v5.ClientCollateral,
}, nil
func fromV5DealState(v5 market5.DealState) DealState {
return (DealState)(v5)
}
type dealProposals5 struct {
@ -255,10 +233,29 @@ func (s *dealProposals5) array() adt.Array {
return s.Array
}
func fromV5DealProposal(v5 market5.DealProposal) DealProposal {
func fromV5DealProposal(v5 market5.DealProposal) (DealProposal, error) {
return (DealProposal)(v5)
label, err := labelFromGoString(v5.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v5.PieceCID,
PieceSize: v5.PieceSize,
VerifiedDeal: v5.VerifiedDeal,
Client: v5.Client,
Provider: v5.Provider,
Label: label,
StartEpoch: v5.StartEpoch,
EndEpoch: v5.EndEpoch,
StoragePricePerEpoch: v5.StoragePricePerEpoch,
ProviderCollateral: v5.ProviderCollateral,
ClientCollateral: v5.ClientCollateral,
}, nil
}
func (s *state5) GetState() interface{} {

View File

@ -177,30 +177,8 @@ func (s *dealStates6) array() adt.Array {
return s.Array
}
func fromV6DealState(v6 market6.DealState) (DealState, error) {
label, err := labelFromGoString(v6.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v6.PieceCID,
PieceSize: v6.PieceSize,
VerifiedDeal: v6.VerifiedDeal,
Client: v6.Client,
Provider: v6.Provider,
Label: label,
StartEpoch: v6.StartEpoch,
EndEpoch: v6.EndEpoch,
StoragePricePerEpoch: v6.StoragePricePerEpoch,
ProviderCollateral: v6.ProviderCollateral,
ClientCollateral: v6.ClientCollateral,
}, nil
func fromV6DealState(v6 market6.DealState) DealState {
return (DealState)(v6)
}
type dealProposals6 struct {
@ -255,10 +233,29 @@ func (s *dealProposals6) array() adt.Array {
return s.Array
}
func fromV6DealProposal(v6 market6.DealProposal) DealProposal {
func fromV6DealProposal(v6 market6.DealProposal) (DealProposal, error) {
return (DealProposal)(v6)
label, err := labelFromGoString(v6.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v6.PieceCID,
PieceSize: v6.PieceSize,
VerifiedDeal: v6.VerifiedDeal,
Client: v6.Client,
Provider: v6.Provider,
Label: label,
StartEpoch: v6.StartEpoch,
EndEpoch: v6.EndEpoch,
StoragePricePerEpoch: v6.StoragePricePerEpoch,
ProviderCollateral: v6.ProviderCollateral,
ClientCollateral: v6.ClientCollateral,
}, nil
}
func (s *state6) GetState() interface{} {

View File

@ -177,30 +177,8 @@ func (s *dealStates7) array() adt.Array {
return s.Array
}
func fromV7DealState(v7 market7.DealState) (DealState, error) {
label, err := labelFromGoString(v7.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v7.PieceCID,
PieceSize: v7.PieceSize,
VerifiedDeal: v7.VerifiedDeal,
Client: v7.Client,
Provider: v7.Provider,
Label: label,
StartEpoch: v7.StartEpoch,
EndEpoch: v7.EndEpoch,
StoragePricePerEpoch: v7.StoragePricePerEpoch,
ProviderCollateral: v7.ProviderCollateral,
ClientCollateral: v7.ClientCollateral,
}, nil
func fromV7DealState(v7 market7.DealState) DealState {
return (DealState)(v7)
}
type dealProposals7 struct {
@ -255,10 +233,29 @@ func (s *dealProposals7) array() adt.Array {
return s.Array
}
func fromV7DealProposal(v7 market7.DealProposal) DealProposal {
func fromV7DealProposal(v7 market7.DealProposal) (DealProposal, error) {
return (DealProposal)(v7)
label, err := labelFromGoString(v7.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v7.PieceCID,
PieceSize: v7.PieceSize,
VerifiedDeal: v7.VerifiedDeal,
Client: v7.Client,
Provider: v7.Provider,
Label: label,
StartEpoch: v7.StartEpoch,
EndEpoch: v7.EndEpoch,
StoragePricePerEpoch: v7.StoragePricePerEpoch,
ProviderCollateral: v7.ProviderCollateral,
ClientCollateral: v7.ClientCollateral,
}, nil
}
func (s *state7) GetState() interface{} {

View File

@ -177,27 +177,8 @@ func (s *dealStates8) array() adt.Array {
return s.Array
}
func fromV8DealState(v8 market8.DealState) (DealState, error) {
label := v8.Label
return DealProposal{
PieceCID: v8.PieceCID,
PieceSize: v8.PieceSize,
VerifiedDeal: v8.VerifiedDeal,
Client: v8.Client,
Provider: v8.Provider,
Label: label,
StartEpoch: v8.StartEpoch,
EndEpoch: v8.EndEpoch,
StoragePricePerEpoch: v8.StoragePricePerEpoch,
ProviderCollateral: v8.ProviderCollateral,
ClientCollateral: v8.ClientCollateral,
}, nil
func fromV8DealState(v8 market8.DealState) DealState {
return (DealState)(v8)
}
type dealProposals8 struct {
@ -252,27 +233,26 @@ func (s *dealProposals8) array() adt.Array {
return s.Array
}
func fromV8DealProposal(v8 market8.DealProposal) DealProposal {
func fromV8DealProposal(v8 market8.DealProposal) (DealProposal, error) {
label := v8.Label
label, err := v8.Label.ToString()
if err != nil {
bs, _ := v8.Label.ToBytes()
label = string(bs)
}
return DealProposal{
PieceCID: v8.PieceCID,
PieceSize: v8.PieceSize,
VerifiedDeal: v8.VerifiedDeal,
Client: v8.Client,
Provider: v8.Provider,
Label: label,
PieceCID: v8.PieceCID,
PieceSize: v8.PieceSize,
VerifiedDeal: v8.VerifiedDeal,
Client: v8.Client,
Provider: v8.Provider,
Label: label,
StartEpoch: v8.StartEpoch,
EndEpoch: v8.EndEpoch,
StoragePricePerEpoch: v8.StoragePricePerEpoch,
ProviderCollateral: v8.ProviderCollateral,
ClientCollateral: v8.ClientCollateral,
}
ProviderCollateral: v8.ProviderCollateral,
ClientCollateral: v8.ClientCollateral,
}, nil
}
func (s *state8) GetState() interface{} {