Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test contract and contract backfill to get logs #137

Merged
merged 6 commits into from
Aug 25, 2022

Conversation

CryptoMaxPlanck
Copy link
Contributor

@CryptoMaxPlanck CryptoMaxPlanck commented Aug 25, 2022

Description
For the scribe (#114), there is a need for backlogging logs from transactions that occurred. This is going to eventually pair with a live watcher that will add logs and receipts to the database in real time. Right now, this PR merely gets logs from a certain blockheight to another blockheight.

- add test contract
- add support for test contract with deploying
- add filter
- add contract backfill
@github-actions github-actions bot added the go Pull requests that update Go code label Aug 25, 2022
@codecov
Copy link

codecov bot commented Aug 25, 2022

Codecov Report

Merging #137 (8216f7a) into master (5e4668d) will increase coverage by 1.36751%.
The diff coverage is 68.71508%.

@@                 Coverage Diff                 @@
##              master        #137         +/-   ##
===================================================
+ Coverage   51.45197%   52.81948%   +1.36750%     
===================================================
  Files            132         134          +2     
  Lines           5372        5462         +90     
  Branches          73          73                 
===================================================
+ Hits            2764        2885        +121     
+ Misses          2337        2298         -39     
- Partials         271         279          +8     
Impacted Files Coverage Δ
agents/testutil/contracttype.go 34.78261% <0.00000%> (-1.58103%) ⬇️
agents/testutil/typecast.go 91.30435% <0.00000%> (-8.69566%) ⬇️
scribe/db/datastore/sql/base/model.go 100.00000% <ø> (ø)
scribe/db/datastore/sql/base/transaction.go 0.00000% <0.00000%> (ø)
scribe/backfill/filter.go 64.19753% <64.19753%> (ø)
scribe/backfill/contract.go 80.26316% <80.26316%> (ø)
agents/testutil/deployers.go 74.46809% <100.00000%> (+2.37507%) ⬆️
agents/testutil/manager.go 100.00000% <100.00000%> (ø)
scribe/db/datastore/sql/base/base_store.go 55.55556% <100.00000%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@trajan0x trajan0x self-requested a review August 25, 2022 23:46

// TestGetLogsMock tests the GetLogs function using a mocked blockchain for errors.
func (b BackfillSuite) TestGetLogsMock() {
// TODO: do this with mocks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make this comment a little clearer - "for error handling in GetLogs methods"

return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?parseTime=true", common.GetEnv("MYSQL_USER", "root"), os.Getenv("MYSQL_PASSWORD"), common.GetEnv("MYSQL_HOST", "127.0.0.1"), common.GetEnvInt("MYSQL_PORT", 3306), dbname)
}

func (b *BackfillSuite) setupMysqlDB() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to test against multiple dbs here

@trajan0x trajan0x merged commit 2fcf58b into master Aug 25, 2022
@trajan0x trajan0x deleted the feature/scribe_contract_watcher branch August 25, 2022 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants