diff --git a/.ci/integration_test.sh b/.ci/integration_test.sh index 924a8f32..cd2895ad 100755 --- a/.ci/integration_test.sh +++ b/.ci/integration_test.sh @@ -2,7 +2,8 @@ set -e -c_sdk_version="v3.5.0" +c_sdk_version="v3.7.0" +chain_version="v3.7.1" start_time=15 macOS= ldflags="-ldflags=\"-r /usr/local/lib/\"" @@ -296,7 +297,7 @@ get_build_chain() # else # latest_version="${latest_release}" # fi - latest_version="${c_sdk_version}" + latest_version="${chain_version}" echo "download build_chain.sh from https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/${latest_version}/build_chain.sh" curl -#LO "https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/${latest_version}/build_chain.sh" chmod u+x build_chain.sh diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 01e39d92..498feca1 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -22,8 +22,10 @@ jobs: - name: generate code coverage report run: bash .ci/generate_coverage.sh - name: upload code coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 with: file: ./v3/coverage.txt name: go-sdk code coverage - fail_ci_if_error: true \ No newline at end of file + fail_ci_if_error: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index d8c128c4..d12aa010 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - go: ["1.21"] + go: ["1.21", "1.22"] steps: - uses: actions/checkout@v2 with: diff --git a/tools/download_csdk_lib.sh b/tools/download_csdk_lib.sh index d59b594e..62114519 100755 --- a/tools/download_csdk_lib.sh +++ b/tools/download_csdk_lib.sh @@ -4,7 +4,7 @@ set -e install_path="/usr/local/lib/" version="3.6.0" OS="linux" -versions=(3.2.0 3.4.0 3.5.0 3.6.0) +versions=(3.2.0 3.4.0 3.5.0 3.6.0 3.7.0) LOG_WARN() { diff --git a/v3/abi/bind/base.go b/v3/abi/bind/base.go index 91e71f52..0872ba90 100755 --- a/v3/abi/bind/base.go +++ b/v3/abi/bind/base.go @@ -192,6 +192,9 @@ func (c *BoundContract) TransactWithResult(opts *TransactOpts, result interface{ if err != nil { return tx, receipt, err } + if receipt.Status != types.Success { + return tx, receipt, fmt.Errorf("transact failed, receipt status: %d, message: %s", receipt.Status, receipt.GetErrorMessage()) + } err = c.abi.Unpack(result, method, common.FromHex(receipt.GetOutput())) if err != nil { return tx, receipt, err diff --git a/v3/precompiled/auth/auth_manager_service_test.go b/v3/precompiled/auth/auth_manager_service_test.go index 7b33b6a1..392ed547 100644 --- a/v3/precompiled/auth/auth_manager_service_test.go +++ b/v3/precompiled/auth/auth_manager_service_test.go @@ -10,6 +10,7 @@ import ( "testing" "github.com/FISCO-BCOS/go-sdk/v3/client" + "github.com/FISCO-BCOS/go-sdk/v3/types" // "github.com/FISCO-BCOS/go-sdk/v3/types" // "github.com/FISCO-BCOS/go-sdk/v3/precompiled" @@ -38,7 +39,7 @@ var ( func getClient(t *testing.T) *client.Client { // privatekey of 0x83309d045a19c44dc3722d15a6abd472f95866ac privateKey, _ := hex.DecodeString("b89d42f12290070f235fb8fb61dcf96e3b11516c5d4f6333f26e49bb955f8b62") - config := &client.Config{IsSMCrypto: false, GroupID: "group0", + config := &client.Config{IsSMCrypto: false, GroupID: "group0", DisableSsl: false, PrivateKey: privateKey, Host: "127.0.0.1", Port: 20200, TLSCaFile: "./ca.crt", TLSKeyFile: "./sdk.key", TLSCertFile: "./sdk.crt"} c, err := client.DialContext(context.Background(), config) @@ -433,21 +434,22 @@ func TestVoteProposal(t *testing.T) { service.UpdateGovernor(accountAddress_common, weight) lastProposalNum, _ := service.ProposalCount() - lastProposalStatus, _ := service.GetProposalStatus(lastProposalNum) + // lastProposalStatus, _ := service.GetProposalStatus(lastProposalNum) agree := false - _, err := service.VoteProposal(*lastProposalNum, agree) - if err != nil { - t.Fatalf("TestVoteProposal failed: %v", err) + receipt, err := service.VoteProposal(*lastProposalNum, agree) + + if err == nil || receipt == nil || receipt.GetStatus() != types.RevertInstruction { + t.Fatalf("TestVoteProposal failed, %v, receipt message: %v", err, receipt.GetErrorMessage()) } - proposalInfo, err := service.GetProposalInfo(lastProposalNum) - againstVoters := proposalInfo.AgainstVoters + // proposalInfo, err := service.GetProposalInfo(lastProposalNum) + // againstVoters := proposalInfo.AgainstVoters - lastProposalNewStatus, _ := service.GetProposalStatus(lastProposalNum) + // lastProposalNewStatus, _ := service.GetProposalStatus(lastProposalNum) - t.Logf("lastProposalNum: %v\n", lastProposalNum) - t.Logf("lastProposalStatus: %v\n", lastProposalStatus) - t.Logf("againstVoters: %v\n", againstVoters) - t.Logf("lastProposalNewStatus: %v\n", lastProposalNewStatus) + // t.Logf("lastProposalNum: %v\n", lastProposalNum) + // t.Logf("lastProposalStatus: %v\n", lastProposalStatus) + // t.Logf("againstVoters: %v\n", againstVoters) + // t.Logf("lastProposalNewStatus: %v\n", lastProposalNewStatus) }