diff --git a/.github/workflows/builtin-actor-tests.yml b/.github/workflows/builtin-actor-tests.yml index c24d8db1f9c..29746c583e4 100644 --- a/.github/workflows/builtin-actor-tests.yml +++ b/.github/workflows/builtin-actor-tests.yml @@ -19,5 +19,5 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.22 - run: go test -tags=release ./build diff --git a/CHANGELOG.md b/CHANGELOG.md index 007e47f7b22..2b22fba42ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,12 @@ This is the first release candidate for Lotus node v1.29.2. Key updates in this release include: - **New API Support:** Added support for `EthGetBlockReceipts` RPC method to retrieve transaction receipts for a specified block. This method allows users to obtain Ethereum format receipts of all transactions included in a given tipset as specified by its Ethereum block equivalent. ([filecoin-project/lotus#12478](https://github.com/filecoin-project/lotus/pull/12478)) -- **Dependency Update:** Upgraded go-libp2p to version v0.35.5 ([filecoin-project/lotus#12511](https://github.com/filecoin-project/lotus/pull/12511)) +- **Dependency Update:** Upgraded go-libp2p to version v0.35.5 ([filecoin-project/lotus#12511](https://github.com/filecoin-project/lotus/pull/12511)), and go-multiaddr-dns to v0.4.0 ([filecoin-project/lotus#12540](https://github.com/filecoin-project/lotus/pull/12540)). - **Bug Fix:** Legacy/historical Drand lookups via `StateGetBeaconEntry` now work again for all historical epochs. `StateGetBeaconEntry` now uses the on-chain beacon entries and follows the same rules for historical Drand round matching as `StateGetRandomnessFromBeacon` and the `get_beacon_randomness` FVM syscall. Be aware that there will be some some variance in matching Filecoin epochs to Drand rounds where null Filecoin rounds are involved prior to network version 14. ([filecoin-project/lotus#12428](https://github.com/filecoin-project/lotus/pull/12428)). +## ☢️ Upgrade Warnings ☢️ +- This release requires a minimum Go version of v1.22.7 or higher ([filecoin-project/lotus#12459](https://github.com/filecoin-project/lotus/pull/12459)) + ## 📝 Changelog See https://github.com/filecoin-project/lotus/compare/v1.29.1...release/v1.29.2-rc1 for the set of changes since the last release. diff --git a/Dockerfile b/Dockerfile index 51a39ed0395..cc41a084be0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ##################################### -FROM golang:1.21.7-bullseye AS lotus-builder +FROM golang:1.22.7-bullseye AS lotus-builder MAINTAINER Lotus Development Team RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev diff --git a/GO_VERSION_MIN b/GO_VERSION_MIN index 8819d012cee..87b26e8b1aa 100644 --- a/GO_VERSION_MIN +++ b/GO_VERSION_MIN @@ -1 +1 @@ -1.21.7 +1.22.7 diff --git a/README.md b/README.md index 5c088bf706e..99997bcf5e2 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,10 @@ For other distributions you can find the required dependencies [here.](https://l #### Go -To build Lotus, you need a working installation of [Go 1.21.7 or higher](https://golang.org/dl/): +To build Lotus, you need a working installation of [Go 1.22.7 or higher](https://golang.org/dl/): ```bash -wget -c https://golang.org/dl/go1.21.7.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local +wget -c https://golang.org/dl/go1.22.7.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local ``` **TIP:** diff --git a/chain/types/ethtypes/eth_types.go b/chain/types/ethtypes/eth_types.go index 48cef83f1f0..08c3fe45d1b 100644 --- a/chain/types/ethtypes/eth_types.go +++ b/chain/types/ethtypes/eth_types.go @@ -1025,6 +1025,16 @@ func (e *EthBlockNumberOrHash) UnmarshalJSON(b []byte) error { return nil } + // check if input is a block hash (66 characters long) + if len(str) == 66 && strings.HasPrefix(str, "0x") { + hash, err := ParseEthHash(str) + if err != nil { + return err + } + e.BlockHash = &hash + return nil + } + // check if block param is a number (decimal or hex) var num EthUint64 if err := num.UnmarshalJSON(b); err == nil { diff --git a/chain/types/ethtypes/eth_types_test.go b/chain/types/ethtypes/eth_types_test.go index 78cd760c999..5d2b4975c13 100644 --- a/chain/types/ethtypes/eth_types_test.go +++ b/chain/types/ethtypes/eth_types_test.go @@ -2,6 +2,7 @@ package ethtypes import ( "encoding/json" + "fmt" "strings" "testing" @@ -522,6 +523,103 @@ func TestFilecoinAddressToEthAddressParams(t *testing.T) { } } +func TestEthBlockNumberOrHashUnmarshalJSON(t *testing.T) { + testCases := []struct { + name string + input string + expected func() EthBlockNumberOrHash + wantErr bool + }{ + { + name: "Valid block number", + input: `{"blockNumber": "0x1234"}`, + expected: func() EthBlockNumberOrHash { + v := uint64(0x1234) + return EthBlockNumberOrHash{BlockNumber: (*EthUint64)(&v)} + }, + }, + { + name: "Valid block hash", + input: `{"blockHash": "0x1234567890123456789012345678901234567890123456789012345678901234"}`, + expected: func() EthBlockNumberOrHash { + h, _ := ParseEthHash("0x1234567890123456789012345678901234567890123456789012345678901234") + return EthBlockNumberOrHash{BlockHash: &h} + }, + }, + { + name: "Valid block number as string", + input: `"0x1234"`, + expected: func() EthBlockNumberOrHash { + v := uint64(0x1234) + return EthBlockNumberOrHash{BlockNumber: (*EthUint64)(&v)} + }, + }, + { + name: "Valid block hash as string", + input: `"0x1234567890123456789012345678901234567890123456789012345678901234"`, + expected: func() EthBlockNumberOrHash { + h, _ := ParseEthHash("0x1234567890123456789012345678901234567890123456789012345678901234") + return EthBlockNumberOrHash{BlockHash: &h} + }, + }, + { + name: "Valid 'latest' string", + input: `"latest"`, + expected: func() EthBlockNumberOrHash { + return EthBlockNumberOrHash{PredefinedBlock: stringPtr("latest")} + }, + }, + { + name: "Valid 'earliest' string", + input: `"earliest"`, + expected: func() EthBlockNumberOrHash { + return EthBlockNumberOrHash{PredefinedBlock: stringPtr("earliest")} + }, + }, + { + name: "Valid 'pending' string", + input: `"pending"`, + expected: func() EthBlockNumberOrHash { + return EthBlockNumberOrHash{PredefinedBlock: stringPtr("pending")} + }, + }, + { + name: "Invalid: both block number and hash", + input: `{"blockNumber": "0x1234", "blockHash": "0x1234567890123456789012345678901234567890123456789012345678901234"}`, + wantErr: true, + }, + { + name: "Invalid block number", + input: `{"blockNumber": "invalid"}`, + wantErr: true, + }, + { + name: "Invalid block hash", + input: `{"blockHash": "invalid"}`, + wantErr: true, + }, + { + name: "Invalid string", + input: `"invalid"`, + wantErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + var got EthBlockNumberOrHash + err := got.UnmarshalJSON([]byte(tc.input)) + + if tc.wantErr { + require.Error(t, err) + } else { + require.NoError(t, err, fmt.Sprintf("did not expect error but got %s", err)) + require.Equal(t, tc.expected(), got) + } + }) + } +} + func stringPtr(s string) *string { return &s } diff --git a/go.mod b/go.mod index 1a4626b6d8f..f66432c395a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/filecoin-project/lotus -go 1.21 +go 1.22 retract v1.14.0 // Accidentally force-pushed tag, use v1.14.1+ instead. @@ -119,8 +119,8 @@ require ( github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-base32 v0.1.0 - github.com/multiformats/go-multiaddr v0.12.4 - github.com/multiformats/go-multiaddr-dns v0.3.1 + github.com/multiformats/go-multiaddr v0.13.0 + github.com/multiformats/go-multiaddr-dns v0.4.0 github.com/multiformats/go-multicodec v0.9.0 github.com/multiformats/go-multihash v0.2.3 github.com/multiformats/go-varint v0.0.7 diff --git a/go.sum b/go.sum index e2b4242708c..9c696333731 100644 --- a/go.sum +++ b/go.sum @@ -913,7 +913,6 @@ github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.59 h1:C9EXc/UToRwKLhK5wKU/I4QVsBUc8kE6MkHBkeypWZs= github.com/miekg/dns v1.1.59/go.mod h1:nZpewl5p6IvctfgrckopVx2OlSEHPRO/U4SYkRklrEk= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= @@ -956,14 +955,13 @@ github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lg github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= -github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= -github.com/multiformats/go-multiaddr v0.12.4 h1:rrKqpY9h+n80EwhhC/kkcunCZZ7URIF8yN1WEUt2Hvc= -github.com/multiformats/go-multiaddr v0.12.4/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= +github.com/multiformats/go-multiaddr v0.13.0 h1:BCBzs61E3AGHcYYTv8dqRH43ZfyrqM8RXVPT8t13tLQ= +github.com/multiformats/go-multiaddr v0.13.0/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= -github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= +github.com/multiformats/go-multiaddr-dns v0.4.0 h1:P76EJ3qzBXpUXZ3twdCDx/kvagMsNo0LMFXpyms/zgU= +github.com/multiformats/go-multiaddr-dns v0.4.0/go.mod h1:7hfthtB4E4pQwirrz+J0CcDUfbWzTqEzVyYKKIKpgkc= github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= @@ -987,7 +985,6 @@ github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsC github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf/QGkvOGQAyiE= github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= -github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= @@ -1626,7 +1623,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/itests/fevm_test.go b/itests/fevm_test.go index 78bac325d20..171037b75cf 100644 --- a/itests/fevm_test.go +++ b/itests/fevm_test.go @@ -1162,6 +1162,16 @@ func TestEthGetBlockReceipts(t *testing.T) { require.NoError(t, err) require.Equal(t, txReceipt, receipt) } + + // try with the geth request format for `EthBlockNumberOrHash` + var req ethtypes.EthBlockNumberOrHash + reqStr := fmt.Sprintf(`"%s"`, lastReceipt.BlockHash.String()) + err = req.UnmarshalJSON([]byte(reqStr)) + require.NoError(t, err) + + gethBlockReceipts, err := client.EthGetBlockReceipts(ctx, req) + require.NoError(t, err) + require.Len(t, gethBlockReceipts, 3) } func deployContractWithEth(ctx context.Context, t *testing.T, client *kit.TestFullNode, ethAddr ethtypes.EthAddress,