Refund gas fees if concurrent TX fails#444
Conversation
3404038 to
661be14
Compare
661be14 to
d1d4f79
Compare
app/app.go
Outdated
|
|
||
| ctx.Logger().Error("Concurrent Execution failed, retrying with Synchronous") | ||
| // Clear the memcache context from the previous state as it failed, we no longer need to commit the data | ||
| ctx = ctx.WithContextMemCache(sdk.NewContextMemCache()) |
There was a problem hiding this comment.
just to confirm, is this the step that we need in order to reset the in memory state prior to rerunning txs synchronously?
There was a problem hiding this comment.
Yes, this resets the state for the rerun of TXs synchronously
| ctx sdk.Context, | ||
| txs [][]byte, | ||
| dependencyDag *acltypes.Dag, | ||
| processBlockConcurrentFunction ProcessBlockConcurrentFunction, |
There was a problem hiding this comment.
why do we pass the the function instead of directly calling the ProcessBlockConcurrent? is it primarily for the mocking purposes in testing? if so, isn't that an antipattern? (I don't have strong feelings one way or the other on whether we keep it this way, just looking to better understand this & golang best practices.
There was a problem hiding this comment.
Yeah, this is mainly for testing, I was following this: https://www.myhatchpad.com/insight/mocking-techniques-for-go/
app/app_test.go
Outdated
| Denom: "test", | ||
| Amount: sdk.NewInt(1), | ||
| })) | ||
| // It should be reset if it fails to prevent any values from being written |
There was a problem hiding this comment.
is this comment correct? i think the function succeeds?
## Describe your changes and provide context Adds a method for us to reset the cache instead of creating a new one. Makes it easier for testing ## Testing performed to validate your change For this PR: sei-protocol/sei-chain#444
|
## Describe your changes and provide context Adds a method for us to reset the cache instead of creating a new one. Makes it easier for testing ## Testing performed to validate your change For this PR: #444
## Describe your changes and provide context This adds CI to seiv2 branch ## Testing performed to validate your change CI
## Describe your changes and provide context Adds a method for us to reset the cache instead of creating a new one. Makes it easier for testing ## Testing performed to validate your change For this PR: #444
## Describe your changes and provide context This adds CI to seiv2 branch ## Testing performed to validate your change CI
Describe your changes and provide context
We already reset the cacheKv (by not writing it) if the transactions fail, but we also need to reset the in-mem values to as those are different from the store
Previously we didn't clear the state so the deferred sends from the previous call carried over
Testing performed to validate your change
Unit tests