Merge pull request #8530 from filecoin-project/fix/nv16-itests-paych

NV16: fix paych
This commit is contained in:
vyzo 2022-04-21 20:05:03 +03:00 committed by GitHub
commit bc32eec051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 51 additions and 9 deletions

View File

@ -1,6 +1,10 @@
package paych
import (
{{if (ge .v 8)}}
"golang.org/x/xerrors"
{{end}}
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
@ -16,12 +20,21 @@ import (
type message{{.v}} struct{ from address.Address }
func (m message{{.v}}) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
{{if (le .v 7)}}
actorCodeID := builtin{{.v}}.PaymentChannelActorCodeID
{{else}}
actorCodeID, ok := actors.GetActorCodeID(actors.Version{{.v}}, "paymentchannel")
if !ok {
return nil, xerrors.Errorf("error getting actor paymentchannel code id for actor version %d", {{.v}})
}
{{end}}
params, aerr := actors.SerializeParams(&paych{{.v}}.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init{{.v}}.ExecParams{
CodeCID: builtin{{.v}}.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {

View File

@ -16,12 +16,15 @@ import (
type message0 struct{ from address.Address }
func (m message0) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID := builtin0.PaymentChannelActorCodeID
params, aerr := actors.SerializeParams(&paych0.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init0.ExecParams{
CodeCID: builtin0.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {

View File

@ -16,12 +16,15 @@ import (
type message2 struct{ from address.Address }
func (m message2) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID := builtin2.PaymentChannelActorCodeID
params, aerr := actors.SerializeParams(&paych2.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init2.ExecParams{
CodeCID: builtin2.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {

View File

@ -16,12 +16,15 @@ import (
type message3 struct{ from address.Address }
func (m message3) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID := builtin3.PaymentChannelActorCodeID
params, aerr := actors.SerializeParams(&paych3.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init3.ExecParams{
CodeCID: builtin3.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {

View File

@ -16,12 +16,15 @@ import (
type message4 struct{ from address.Address }
func (m message4) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID := builtin4.PaymentChannelActorCodeID
params, aerr := actors.SerializeParams(&paych4.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init4.ExecParams{
CodeCID: builtin4.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {

View File

@ -16,12 +16,15 @@ import (
type message5 struct{ from address.Address }
func (m message5) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID := builtin5.PaymentChannelActorCodeID
params, aerr := actors.SerializeParams(&paych5.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init5.ExecParams{
CodeCID: builtin5.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {

View File

@ -16,12 +16,15 @@ import (
type message6 struct{ from address.Address }
func (m message6) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID := builtin6.PaymentChannelActorCodeID
params, aerr := actors.SerializeParams(&paych6.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init6.ExecParams{
CodeCID: builtin6.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {

View File

@ -16,12 +16,15 @@ import (
type message7 struct{ from address.Address }
func (m message7) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID := builtin7.PaymentChannelActorCodeID
params, aerr := actors.SerializeParams(&paych7.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init7.ExecParams{
CodeCID: builtin7.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {

View File

@ -1,6 +1,8 @@
package paych
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
@ -16,12 +18,18 @@ import (
type message8 struct{ from address.Address }
func (m message8) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID, ok := actors.GetActorCodeID(actors.Version8, "paymentchannel")
if !ok {
return nil, xerrors.Errorf("error getting actor paymentchannel code id for actor version %d", 8)
}
params, aerr := actors.SerializeParams(&paych8.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init8.ExecParams{
CodeCID: builtin8.PaymentChannelActorCodeID,
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {