@@ -73,7 +73,7 @@ func (e *EthUint64) UnmarshalJSON(b []byte) error {
73
73
* e = EthUint64 (eint )
74
74
return nil
75
75
}
76
- return fmt .Errorf ("cannot interpret %s as a hex-encoded uint64, or a number" , string (b ))
76
+ return xerrors .Errorf ("cannot interpret %s as a hex-encoded uint64, or a number" , string (b ))
77
77
}
78
78
79
79
func EthUint64FromHex (s string ) (EthUint64 , error ) {
@@ -257,17 +257,17 @@ func (c *EthCall) ToFilecoinMessage() (*types.Message, error) {
257
257
var err error
258
258
from , err = (EthAddress {}).ToFilecoinAddress ()
259
259
if err != nil {
260
- return nil , fmt .Errorf ("failed to construct the ethereum system address: %w" , err )
260
+ return nil , xerrors .Errorf ("failed to construct the ethereum system address: %w" , err )
261
261
}
262
262
} else {
263
263
// The from address must be translatable to an f4 address.
264
264
var err error
265
265
from , err = c .From .ToFilecoinAddress ()
266
266
if err != nil {
267
- return nil , fmt .Errorf ("failed to translate sender address (%s): %w" , c .From .String (), err )
267
+ return nil , xerrors .Errorf ("failed to translate sender address (%s): %w" , c .From .String (), err )
268
268
}
269
269
if p := from .Protocol (); p != address .Delegated {
270
- return nil , fmt .Errorf ("expected a class 4 address, got: %d: %w " , p , err )
270
+ return nil , xerrors .Errorf ("expected a class 4 address, got: %d" , p )
271
271
}
272
272
}
273
273
@@ -276,7 +276,7 @@ func (c *EthCall) ToFilecoinMessage() (*types.Message, error) {
276
276
initcode := abi .CborBytes (c .Data )
277
277
params2 , err := actors .SerializeParams (& initcode )
278
278
if err != nil {
279
- return nil , fmt .Errorf ("failed to serialize params: %w" , err )
279
+ return nil , xerrors .Errorf ("failed to serialize params: %w" , err )
280
280
}
281
281
params = params2
282
282
}
@@ -398,10 +398,10 @@ func EthAddressFromPubKey(pubk []byte) ([]byte, error) {
398
398
// but putting this check here for defensiveness), strip the prefix
399
399
const pubKeyLen = 65
400
400
if len (pubk ) != pubKeyLen {
401
- return nil , fmt .Errorf ("public key should have %d in length, but got %d" , pubKeyLen , len (pubk ))
401
+ return nil , xerrors .Errorf ("public key should have %d in length, but got %d" , pubKeyLen , len (pubk ))
402
402
}
403
403
if pubk [0 ] != 0x04 {
404
- return nil , fmt .Errorf ("expected first byte of secp256k1 to be 0x04 (uncompressed)" )
404
+ return nil , xerrors .Errorf ("expected first byte of secp256k1 to be 0x04 (uncompressed)" )
405
405
}
406
406
pubk = pubk [1 :]
407
407
@@ -523,7 +523,7 @@ func (ea EthAddress) ToFilecoinAddress() (address.Address, error) {
523
523
// Ethereum Address Manager.
524
524
addr , err := address .NewDelegatedAddress (builtintypes .EthereumAddressManagerActorID , ea [:])
525
525
if err != nil {
526
- return address .Undef , fmt .Errorf ("failed to translate supplied address (%s) into a " +
526
+ return address .Undef , xerrors .Errorf ("failed to translate supplied address (%s) into a " +
527
527
"Filecoin f4 address: %w" , hex .EncodeToString (ea [:]), err )
528
528
}
529
529
return addr , nil
@@ -600,12 +600,12 @@ func handleHexStringPrefix(s string) string {
600
600
func EthHashFromCid (c cid.Cid ) (EthHash , error ) {
601
601
hash , found := bytes .CutPrefix (c .Bytes (), expectedHashPrefix )
602
602
if ! found {
603
- return EthHash {}, fmt .Errorf ("CID does not have the expected prefix" )
603
+ return EthHash {}, xerrors .Errorf ("CID does not have the expected prefix" )
604
604
}
605
605
606
606
if len (hash ) != EthHashLength {
607
607
// this shouldn't be possible since the prefix has the length, but just in case
608
- return EthHash {}, fmt .Errorf ("CID hash length is not 32 bytes" )
608
+ return EthHash {}, xerrors .Errorf ("CID hash length is not 32 bytes" )
609
609
}
610
610
611
611
var h EthHash
@@ -1101,7 +1101,7 @@ func (e *EthBlockNumberOrHash) UnmarshalJSON(b []byte) error {
1101
1101
if err != nil {
1102
1102
return err
1103
1103
}
1104
- if str == "earliest" || str == "pending" || str == "latest" {
1104
+ if str == "earliest" || str == "pending" || str == "latest" || str == "finalized" {
1105
1105
e .PredefinedBlock = & str
1106
1106
return nil
1107
1107
}
0 commit comments