Skip to content

Commit

Permalink
Merge pull request #12321 from smartcontractkit/pg_extraction_tx_store
Browse files Browse the repository at this point in the history
Pg extraction tx store
  • Loading branch information
DylanTinianov authored Mar 12, 2024
2 parents 65dc6b6 + c5e881c commit 63a77d5
Show file tree
Hide file tree
Showing 36 changed files with 718 additions and 734 deletions.
131 changes: 67 additions & 64 deletions core/chains/evm/txmgr/broadcaster_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/chains/evm/txmgr/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewTxm(
checker := &CheckerFactory{Client: client}
// create tx attempt builder
txAttemptBuilder := NewEvmTxAttemptBuilder(*client.ConfiguredChainID(), fCfg, keyStore, estimator)
txStore := NewTxStore(db, lggr, dbConfig)
txStore := NewTxStore(db, lggr)
txNonceSyncer := NewNonceSyncer(txStore, lggr, client)

txmCfg := NewEvmTxmConfig(chainConfig) // wrap Evm specific config
Expand Down
253 changes: 130 additions & 123 deletions core/chains/evm/txmgr/confirmer_test.go

Large diffs are not rendered by default.

475 changes: 214 additions & 261 deletions core/chains/evm/txmgr/evm_tx_store.go

Large diffs are not rendered by default.

230 changes: 126 additions & 104 deletions core/chains/evm/txmgr/evm_tx_store_test.go

Large diffs are not rendered by default.

138 changes: 69 additions & 69 deletions core/chains/evm/txmgr/mocks/evm_tx_store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions core/chains/evm/txmgr/nonce_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func Test_NonceSyncer_Sync(t *testing.T) {
t.Run("returns error if PendingNonceAt fails", func(t *testing.T) {
db := pgtest.NewSqlxDB(t)
cfg := configtest.NewTestGeneralConfig(t)
txStore := cltest.NewTestTxStore(t, db, cfg.Database())
txStore := cltest.NewTestTxStore(t, db)
ethClient := evmtest.NewEthClientMockWithDefaultChain(t)
ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth()

Expand All @@ -44,7 +44,7 @@ func Test_NonceSyncer_Sync(t *testing.T) {
t.Run("does nothing if chain nonce reflects local nonce", func(t *testing.T) {
db := pgtest.NewSqlxDB(t)
cfg := configtest.NewTestGeneralConfig(t)
txStore := cltest.NewTestTxStore(t, db, cfg.Database())
txStore := cltest.NewTestTxStore(t, db)
ethClient := evmtest.NewEthClientMockWithDefaultChain(t)
ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth()

Expand All @@ -65,7 +65,7 @@ func Test_NonceSyncer_Sync(t *testing.T) {
t.Run("does nothing if chain nonce is behind local nonce", func(t *testing.T) {
db := pgtest.NewSqlxDB(t)
cfg := configtest.NewTestGeneralConfig(t)
txStore := cltest.NewTestTxStore(t, db, cfg.Database())
txStore := cltest.NewTestTxStore(t, db)
ks := cltest.NewKeyStore(t, db, cfg.Database()).Eth()

ethClient := evmtest.NewEthClientMockWithDefaultChain(t)
Expand All @@ -87,7 +87,7 @@ func Test_NonceSyncer_Sync(t *testing.T) {
t.Run("fast forwards if chain nonce is ahead of local nonce", func(t *testing.T) {
db := pgtest.NewSqlxDB(t)
cfg := configtest.NewTestGeneralConfig(t)
txStore := cltest.NewTestTxStore(t, db, cfg.Database())
txStore := cltest.NewTestTxStore(t, db)
ethClient := evmtest.NewEthClientMockWithDefaultChain(t)
ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth()

Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/txmgr/reaper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestReaper_ReapTxes(t *testing.T) {

db := pgtest.NewSqlxDB(t)
cfg := configtest.NewGeneralConfig(t, nil)
txStore := cltest.NewTestTxStore(t, db, cfg.Database())
txStore := cltest.NewTestTxStore(t, db)
ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth()

_, from := cltest.MustInsertRandomKey(t, ethKeyStore)
Expand Down
6 changes: 3 additions & 3 deletions core/chains/evm/txmgr/resender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Test_EthResender_resendUnconfirmed(t *testing.T) {
_, fromAddress2 := cltest.MustInsertRandomKey(t, ethKeyStore)
_, fromAddress3 := cltest.MustInsertRandomKey(t, ethKeyStore)

txStore := cltest.NewTestTxStore(t, db, logCfg)
txStore := cltest.NewTestTxStore(t, db)

originalBroadcastAt := time.Unix(1616509100, 0)

Expand Down Expand Up @@ -118,7 +118,7 @@ func Test_EthResender_alertUnconfirmed(t *testing.T) {

_, fromAddress := cltest.MustInsertRandomKey(t, ethKeyStore)

txStore := cltest.NewTestTxStore(t, db, logCfg)
txStore := cltest.NewTestTxStore(t, db)

originalBroadcastAt := time.Unix(1616509100, 0)
er := txmgr.NewEvmResender(lggr, txStore, txmgr.NewEvmTxmClient(ethClient), txmgr.NewEvmTracker(txStore, ethKeyStore, big.NewInt(0), lggr), ethKeyStore, 100*time.Millisecond, ccfg.EVM(), ccfg.EVM().Transactions())
Expand Down Expand Up @@ -148,7 +148,7 @@ func Test_EthResender_Start(t *testing.T) {
// Set batch size low to test batching
c.EVM[0].RPCDefaultBatchSize = ptr[uint32](1)
})
txStore := cltest.NewTestTxStore(t, db, cfg.Database())
txStore := cltest.NewTestTxStore(t, db)
ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth()
ccfg := evmtest.NewChainScopedConfig(t, cfg)
_, fromAddress := cltest.MustInsertRandomKey(t, ethKeyStore)
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/txmgr/tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const waitTime = 5 * time.Millisecond
func newTestEvmTrackerSetup(t *testing.T) (*txmgr.Tracker, txmgr.TestEvmTxStore, keystore.Eth, []common.Address) {
db := pgtest.NewSqlxDB(t)
cfg := newTestChainScopedConfig(t)
txStore := cltest.NewTestTxStore(t, db, cfg.Database())
txStore := cltest.NewTestTxStore(t, db)
ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth()
chainID := big.NewInt(0)
enabledAddresses := generateEnabledAddresses(t, ethKeyStore, chainID)
Expand Down
Loading

0 comments on commit 63a77d5

Please sign in to comment.