From 01d1756e2703c92e282f384082dec8965ffe1c19 Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Sun, 3 Sep 2023 17:15:48 -0400 Subject: [PATCH] log json receipt of failed txes --- .github/workflows/go.yml | 14 ++++++-------- ethergo/backends/base/base.go | 9 +++++++++ ethergo/deployer/deployed_contract.go | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 60dfc6590c..8ade81dc0a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -160,14 +160,12 @@ jobs: PYROSCOPE_PATH: '${{ steps.pyroscope-path.outputs.PYROSCOPE_PATH }}' APPLICATION_NAME: ${{ steps.coverage.outputs.flag }} -# - name: Test -# uses: nick-fields/retry@v2 -# with: -# command: cd ${{matrix.package}} && $PYROSCOPE_PATH exec --apiKey=${{ secrets.PYROSCOPE_CLOUD_TOKEN }} -- go test -parallel 1 -coverpkg=./... ./... -coverprofile=profile.cov -# max_attempts: 2 -# timeout_minutes: 20 - - name: Setup upterm session - uses: lhotari/action-upterm@v1 + - name: Test + uses: nick-fields/retry@v2 + with: + command: cd ${{matrix.package}} && $PYROSCOPE_PATH exec --apiKey=${{ secrets.PYROSCOPE_CLOUD_TOKEN }} -- go test -parallel 1 -coverpkg=./... ./... -coverprofile=profile.cov + max_attempts: 2 + timeout_minutes: 20 env: PYROSCOPE_PATH: '${{ steps.pyroscope-path.outputs.PYROSCOPE_PATH }}' ENABLE_MYSQL_TEST: true diff --git a/ethergo/backends/base/base.go b/ethergo/backends/base/base.go index d85be12bb8..aa258df7ef 100644 --- a/ethergo/backends/base/base.go +++ b/ethergo/backends/base/base.go @@ -152,6 +152,15 @@ func (b *Backend) VerifyContract(contractType contracts.ContractType, contract c code, err := b.Client().CodeAt(b.ctx, contract.Address(), nil) if !errors.Is(err, context.Canceled) { require.Nil(b.T(), err) + if len(code) == 0 { + receipt, err := b.Client().TransactionReceipt(b.ctx, contract.DeployTx().Hash()) + require.Nil(b.T(), err) + + jsonReceipt, err := receipt.MarshalJSON() + require.Nil(b.T(), err) + + fmt.Println(jsonReceipt) + } require.NotEmpty(b.T(), code, "contract of type %s (metadata %s) not found", contractType.ContractName(), contract.String()) } }() diff --git a/ethergo/deployer/deployed_contract.go b/ethergo/deployer/deployed_contract.go index 19709e51e8..599ffb3b2d 100644 --- a/ethergo/deployer/deployed_contract.go +++ b/ethergo/deployer/deployed_contract.go @@ -75,7 +75,7 @@ func (d DeployedContract) ChainID() *big.Int { // String returns a string representation of the contract metadata. func (d DeployedContract) String() string { - return fmt.Sprintf("address: %s, owner: %s, chainID: %s", d.address.String(), d.owner.String(), d.chainID.String()) + return fmt.Sprintf("address: %s, owner: %s, chainID: %s, deployTX: %s", d.address.String(), d.owner.String(), d.chainID.String(), d.deployTx.Hash()) } var _ contracts.DeployedContract = DeployedContract{}