-
Notifications
You must be signed in to change notification settings - Fork 15
Added retry logic to minaTransactionSender #360
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
base: develop
Are you sure you want to change the base?
Conversation
|
So what I just discovered: When we setFee(), o1js erases all previous signatures in order for the tx to be signed again. And this makes sense - for the feepayer and some accountupdates, o1js uses the so-called "full commitment". This is simply just the hash of the whole transaction, including all accountupdates and the feepayer, whereas the non-full commitment would just the be hash of the current accountupdate. |
rpanic
left a comment
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.
This is great! I have a few minor requests and questions, but I like it generally
| messages IncomingMessageBatchTransaction[] | ||
| } | ||
|
|
||
| model PendingL1Transaction { |
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.
You forgot to create a migration for this new schema change - do this by cd-ing into the persistence pkg, then run prisma migrate dev and it'll you for a name and migrate
| const currentFee = tx.transaction.feePayer.body.fee; | ||
| const newFee = UInt64.from(this.bumpFee(Number(currentFee.toBigInt()))); | ||
| tx.setFee(newFee); | ||
| // Delay if needed |
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 you explain what this delay here accomplishes? I'd expect this function to only craft the new transaction and return it...
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.
This is used to add a delay between retries, like retrying a transaction every 5 minutes.
packages/sequencer/src/storage/repositories/PendingL1TransactionStorage.ts
Outdated
Show resolved
Hide resolved
| lastError String? | ||
| sentAt DateTime? | ||
| @@id([sender, nonce]) |
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.
I'm not against this schema, but I think for the reorg support we'll have to change this - but that will happen when we tackle that piece of work.
| lastError String? | ||
| sentAt DateTime? | ||
| @@id([sender, nonce]) |
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 I'd love to see would be if we could add foreign-key out of settlement here. So in the Settlement entity, add a reference to the PendingTransaction so that we can establish that link
packages/persistance/src/services/prisma/PrismaPendingL1TransactionStorage.ts
Show resolved
Hide resolved
| const tx = Transaction.fromJSON(JSON.parse(record.transactionJson)); | ||
| const currentFee = tx.transaction.feePayer.body.fee; | ||
| const newFee = UInt64.from(this.bumpFee(Number(currentFee.toBigInt()))); | ||
| tx.setFee(newFee); |
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.
As mentioned in the comment earlier, we need to figure something out to prevent re-proving
packages/sequencer/src/settlement/transactions/DefaultL1TransactionRetryStrategy.ts
Show resolved
Hide resolved
packages/sequencer/src/settlement/transactions/MinaTransactionSender.ts
Outdated
Show resolved
Hide resolved
…endingL1TransactionStorage
…nId instead of transactionHash, PendingL1TransactionStorage to use id as the primary identifier.
87ebda9 to
2fe0464
Compare
closes #340