Skip to content

Commit

Permalink
fix: Universal Receiver method for account and verifreg take abi.Empt…
Browse files Browse the repository at this point in the history
…yValue (#119)

* Universal Receiver method for account and verifreg take abi.EmptyValue

* Update v10 actors
  • Loading branch information
geoff-vball authored Nov 23, 2022
1 parent 3ee9fb7 commit 374ac11
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
20 changes: 20 additions & 0 deletions abi/cbor_bytes_transparent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package abi

import (
"io"
)

// CborBytesTransparent NOTE This struct does not create a valid cbor-encoded byte slice. It just passes the bytes through as-is.
type CborBytesTransparent []byte

// MarshalCBOR Does NOT marshall to a cbor-encoding. This is just syntactic sugar to let us pass bytes transparently through lotus which requires a cbor-marshallable object.
func (t *CborBytesTransparent) MarshalCBOR(w io.Writer) error {
_, err := w.Write(*t)
return err
}

// UnmarshalCBOR CANNOT read a cbor-encoded byte slice. This will just transparently pass the underlying bytes.
func (t *CborBytesTransparent) UnmarshalCBOR(r io.Reader) error {
_, err := r.Read(*t)
return err
}
2 changes: 1 addition & 1 deletion builtin/v10/account/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ var Methods = map[uint64]builtin.MethodMeta{
1: {"Constructor", *new(func(*address.Address) *abi.EmptyValue)}, // Constructor
2: {"PubkeyAddress", *new(func(*abi.EmptyValue) *address.Address)}, // PubkeyAddress
3: {"AuthenticateMessage", *new(func(*AuthenticateMessageParams) *abi.EmptyValue)}, // AuthenticateMessage
uint64(builtin.UniversalReceiverHookMethodNum): {"UniversalReceiverHook", *new(func(*[]byte) *abi.EmptyValue)}, // UniversalReceiverHook
uint64(builtin.UniversalReceiverHookMethodNum): {"UniversalReceiverHook", *new(func(*abi.CborBytesTransparent) *abi.EmptyValue)}, // UniversalReceiverHook
}
2 changes: 1 addition & 1 deletion builtin/v10/multisig/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ var Methods = map[uint64]builtin.MethodMeta{
7: {"SwapSigner", *new(func(*SwapSignerParams) *abi.EmptyValue)}, // SwapSigner
8: {"ChangeNumApprovalsThreshold", *new(func(*ChangeNumApprovalsThresholdParams) *abi.EmptyValue)}, // ChangeNumApprovalsThreshold
9: {"LockBalance", *new(func(*LockBalanceParams) *abi.EmptyValue)}, // LockBalance
uint64(builtin.UniversalReceiverHookMethodNum): {"UniversalReceiverHook", *new(func(*[]byte) *abi.EmptyValue)}, // UniversalReceiverHook
uint64(builtin.UniversalReceiverHookMethodNum): {"UniversalReceiverHook", *new(func(*abi.CborBytesTransparent) *abi.EmptyValue)}, // UniversalReceiverHook
}
2 changes: 1 addition & 1 deletion builtin/v9/account/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ var Methods = map[uint64]builtin.MethodMeta{
1: {"Constructor", *new(func(*address.Address) *abi.EmptyValue)}, // Constructor
2: {"PubkeyAddress", *new(func(*abi.EmptyValue) *address.Address)}, // PubkeyAddress
3: {"AuthenticateMessage", *new(func(*AuthenticateMessageParams) *abi.EmptyValue)}, // AuthenticateMessage
uint64(builtin.UniversalReceiverHookMethodNum): {"UniversalReceiverHook", *new(func(*[]byte) *abi.EmptyValue)}, // UniversalReceiverHook
uint64(builtin.UniversalReceiverHookMethodNum): {"UniversalReceiverHook", *new(func(*abi.CborBytesTransparent) *abi.EmptyValue)}, // UniversalReceiverHook
}
2 changes: 1 addition & 1 deletion builtin/v9/multisig/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ var Methods = map[uint64]builtin.MethodMeta{
7: {"SwapSigner", *new(func(*SwapSignerParams) *abi.EmptyValue)}, // SwapSigner
8: {"ChangeNumApprovalsThreshold", *new(func(*ChangeNumApprovalsThresholdParams) *abi.EmptyValue)}, // ChangeNumApprovalsThreshold
9: {"LockBalance", *new(func(*LockBalanceParams) *abi.EmptyValue)}, // LockBalance
uint64(builtin.UniversalReceiverHookMethodNum): {"UniversalReceiverHook", *new(func(*[]byte) *abi.EmptyValue)}, // UniversalReceiverHook
uint64(builtin.UniversalReceiverHookMethodNum): {"UniversalReceiverHook", *new(func(*abi.CborBytesTransparent) *abi.EmptyValue)}, // UniversalReceiverHook
}

0 comments on commit 374ac11

Please sign in to comment.