-
Notifications
You must be signed in to change notification settings - Fork 4
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
Emerald: import parsing from nexus #141
Conversation
5b7321d
to
06ef29e
Compare
big, chunky todos
|
Nice!
Do you intend to address these in a follow-up PR or in this one? I'm in favor of the former, but either way. Just so long as the scope of reviewing is clear. |
yeah I'll work on them in this pr
…On Fri, Sep 30, 2022, 2:45 PM mitjat ***@***.***> wrote:
Nice!
big, chunky todos
Do you intend to address these in a follow-up PR or in this one? I'm in
favor of the former, but either way. Just so long as the scope of reviewing
is clear.
—
Reply to this email directly, view it on GitHub
<#141 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJDVILUVHID2ESSFYSC4SFDWA5NRBANCNFSM6AAAAAAQWD3IBM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Disclaimer: This e-mail and any attachments may contain confidential
information. If you are not the intended recipient, any disclosure,
copying, distribution or use of any information contained herein is
strictly prohibited. If you have received this transmission in error,
please immediately notify the sender and destroy the original transmission
and any attachments without reading or saving.
|
clerical note: moved to https://docs.google.com/document/d/1moqmGcHosdnVUHfYT6M4mpQbWsWEnmHIOpFAfcosZdY/edit#heading=h.imth7ku5x6is here's my plan for integrating nexus db table/indexes: db unification
|
oh I read that wrong, you prefer to address these in separate PRs? that may be fine, as long as we have an understanding that we'll be editing the 0011 migration instead of doing further migrations on top. it's just too rough right now imo |
Oh that's a good writeup on table migrations 👌 . I copy-pasted it into https://docs.google.com/document/d/1moqmGcHosdnVUHfYT6M4mpQbWsWEnmHIOpFAfcosZdY/edit#heading=h.imth7ku5x6is (because github is not great for commenting on comments piecemeal), and added comments. Not 100% done yet but dinner calls; will wrap up probably Monday. If you prefer to make all (or some of) the changes in this PR, that's fine with me also. I was thinking that submitting early is more for your benefit -- PRs that drag out forever and need to be rebased a thousand times are no fun. They're also no fun for reviewing; though in this particular case, probably the easiest thing for reviewing would be to first get in a baseline PR that changes the indexer where it should conform to nexus (I left some suggestions to that effect, mostly around data types; see if you agree), then submitting this PR neatly cleaned up. But I think you should prioritize your time/sanity with this one. It's small enough that it won't be too huge a pain to review no matter what. Either way, don't worry about migrations. There are no clients for the indexer yet, so it's trivial to take it offline in prod and have it reindex everything. Just check let the indexer team know before you nuke the db so we all expect the outage. Also, I can help with all ops-related stuff like this. |
ok let's do this in separate PRs |
06ef29e
to
a4e7754
Compare
BEGIN; | ||
|
||
CREATE TABLE block_extra ( | ||
chain_alias VARCHAR(32), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weirdness indeed.
Assuming you used an autoformatter and you're not happy with it: I looked around and tested a few; sqlfmt by Cockroach Labs looks best. See writeup, demo (increase max width with non-obvious GUI slider), binary.
I don't feel motivated enough to integrate it into our CI, but it's where we should head eventually, probably.
I sunk a good chunk of time into this before realizing that contrary to their docs, they can ingest only some postgres-style SQL, and they cannot emit it. For example, TEXT
is consistently changed to STRING
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't have to worry about this in this PR, gonna address in #147
We did agree (verbally I believe) to squash current migrations. |
a4e7754
to
6461517
Compare
reviewers, can we merge this? |
6461517
to
44dcdae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for letting this one sit unattended; I thought it was blocked on #147, not the other way around.
// TODO(ennsharma): Process Emerald transaction data in accordance with | ||
// https://github.com/oasisprotocol/emerald-web3-gateway/blob/main/indexer/utils.go#L225 | ||
var rtid ocCommon.Namespace | ||
if err := rtid.UnmarshalHex("000000000000000000000000000000000000000000000000e2eaa99fc008f87f"); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Extract to top-level constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doing this in #158
if err := rtid.UnmarshalHex("000000000000000000000000000000000000000000000000e2eaa99fc008f87f"); err != nil { | ||
return err | ||
} | ||
sigContext := signature.DeriveChainContext(rtid, "b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fetch this from the node instead of hardcoding? This same emerald parser will run for emerald v1 (or whatever the current version is) on oasis-4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unhardcoded in #158
tx, err := common.VerifyUtx(sigContext, &txr.Tx) | ||
if err != nil { | ||
err = fmt.Errorf("tx %d: %w", i, err) | ||
fmt.Println(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should pull in and use the logger
, like other modules do. I'm fine to do it in a follow-up PR, though in that case let's create a doc/issue/whatever where we can track those "to do later" tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do this in #158
blockData.NumTransactions = len(txrs) | ||
blockData.TransactionData = make([]*BlockTransactionData, 0, len(txrs)) | ||
blockData.AddressPreimages = map[string]*AddressPreimageData{} | ||
for i, txr := range txrs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: i
is good for a short-lived local variable, but this one lives over ~200 lines. Let's call it tx_idx
or something that still makes sense (and is not in danger of being shadowed) 100 lines lower.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do this in #158
func decodeExpectCall( | ||
t *testing.T, | ||
raw string, | ||
expectedChainID uint64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The high number of args makes tests hard to read. Can we introduce a type Call struct {...}
, then having expected Call
here and Call { ChainId: ..., To:, ..., ... }
in tests?
Same for decodeExpectCreate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya that'd be good. let's do that in #158
bb2ee02
to
540f441
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for responding to all the comments! I left the threads unresolved for easier tracking, but I see you've nicely documented them in the description of #158 already, so do with the threads here as you please :)
540f441
to
e1b4d3a
Compare
Error: cannot use batch (variable of type *storage.QueryBatch) as *pgx.Batch value in argument to emitRoundBatch (typecheck) ugh what's going on in main |
e1b4d3a
to
209444c
Compare
#154 changed the batch type |
import from https://github.com/oasisprotocol/oasis-nexus/pull/1
archival note: backed up at #644