Skip to content

Commit

Permalink
log json receipt of failed txes
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Sep 3, 2023
1 parent 1a98f54 commit 01d1756
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions ethergo/backends/base/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Check warning on line 163 in ethergo/backends/base/base.go

View check run for this annotation

Codecov / codecov/patch

ethergo/backends/base/base.go#L156-L163

Added lines #L156 - L163 were not covered by tests
require.NotEmpty(b.T(), code, "contract of type %s (metadata %s) not found", contractType.ContractName(), contract.String())
}
}()
Expand Down
2 changes: 1 addition & 1 deletion ethergo/deployer/deployed_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

0 comments on commit 01d1756

Please sign in to comment.