Skip to content

Commit

Permalink
Fix formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
cabrador committed Sep 20, 2024
1 parent a45eff2 commit e345a83
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 118 deletions.
4 changes: 1 addition & 3 deletions cmd/aida-sdb/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ func TestSdbRecord_AllDbEventsAreIssuedInOrder(t *testing.T) {
Run(10, 12, gomock.Any()).
DoAndReturn(func(from int, to int, consumer executor.Consumer[txcontext.TxContext]) error {
for i := from; i < to; i++ {
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: i, Transaction: 3, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: i, Transaction: 3, Data: substatecontext.NewTxContext(emptyTx)})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: i, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx)})
}
return nil
Expand Down
48 changes: 12 additions & 36 deletions cmd/aida-vm-adb/run_vm_adb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,12 @@ func TestVmAdb_AllDbEventsAreIssuedInOrder_Sequential(t *testing.T) {
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
// Block 2
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx)})
// Block 3
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
// Block 4
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx)})
return nil
})

Expand Down Expand Up @@ -144,20 +136,12 @@ func TestVmAdb_AllDbEventsAreIssuedInOrder_Parallel(t *testing.T) {
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
// Block 2
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx)})
// Block 3
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
// Block 4
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx)})
return nil
})

Expand Down Expand Up @@ -403,9 +387,7 @@ func TestVmAdb_ValidationDoesNotFailOnValidTransaction_Sequential(t *testing.T)
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down Expand Up @@ -456,9 +438,7 @@ func TestVmAdb_ValidationDoesNotFailOnValidTransaction_Parallel(t *testing.T) {
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down Expand Up @@ -507,9 +487,7 @@ func TestVmAdb_ValidationFailsOnInvalidTransaction_Sequential(t *testing.T) {
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down Expand Up @@ -551,9 +529,7 @@ func TestVmAdb_ValidationFailsOnInvalidTransaction_Parallel(t *testing.T) {
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down
40 changes: 10 additions & 30 deletions cmd/aida-vm-sdb/run_substate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,12 @@ func TestVmSdb_Substate_AllDbEventsAreIssuedInOrder(t *testing.T) {
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
// Block 2
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx)})
// Block 3
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
// Block 4
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx)})
return nil
})

Expand Down Expand Up @@ -143,20 +135,12 @@ func TestVmSdb_Substate_AllTransactionsAreProcessedInOrder(t *testing.T) {
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
// Block 2
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx)})
// Block 3
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
// Block 4
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx)})
return nil
})

Expand Down Expand Up @@ -228,9 +212,7 @@ func TestVmSdb_Substate_ValidationDoesNotFailOnValidTransaction(t *testing.T) {
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down Expand Up @@ -280,9 +262,7 @@ func TestVmSdb_Substate_ValidationFailsOnInvalidTransaction(t *testing.T) {
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down
64 changes: 16 additions & 48 deletions cmd/aida-vm/run_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,12 @@ func TestVm_AllDbEventsAreIssuedInOrder_Sequential(t *testing.T) {
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
// Block 2
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx)})
// Block 3
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
// Block 4
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx)})
return nil
})

Expand Down Expand Up @@ -122,20 +114,12 @@ func TestVm_AllTransactionsAreProcessedInOrder_Sequential(t *testing.T) {
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
// Block 2
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx)})
// Block 3
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
// Block 4
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx)})
return nil
})

Expand Down Expand Up @@ -187,20 +171,12 @@ func TestVm_AllTransactionsAreProcessedInOrder_Parallel(t *testing.T) {
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
// Block 2
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 2, Data: substatecontext.NewTxContext(emptyTx)})
// Block 3
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 3, Transaction: 1, Data: substatecontext.NewTxContext(emptyTx)})
// Block 4
consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx),
})
consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 4, Transaction: utils.PseudoTx, Data: substatecontext.NewTxContext(emptyTx)})
return nil
})

Expand Down Expand Up @@ -265,9 +241,7 @@ func TestVmAdb_ValidationDoesNotFailOnValidTransaction_Sequential(t *testing.T)
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down Expand Up @@ -316,9 +290,7 @@ func TestVmAdb_ValidationDoesNotFailOnValidTransaction_Parallel(t *testing.T) {
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down Expand Up @@ -366,9 +338,7 @@ func TestVm_ValidationFailsOnInvalidTransaction_Sequential(t *testing.T) {
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down Expand Up @@ -407,9 +377,7 @@ func TestVm_ValidationFailsOnInvalidTransaction_Parallel(t *testing.T) {
provider.EXPECT().
Run(2, 5, gomock.Any()).
DoAndReturn(func(_ int, _ int, consumer executor.Consumer[txcontext.TxContext]) error {
return consumer(executor.TransactionInfo[txcontext.TxContext]{
Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx),
})
return consumer(executor.TransactionInfo[txcontext.TxContext]{Block: 2, Transaction: 1, Data: substatecontext.NewTxContext(testTx)})
})

gomock.InOrder(
Expand Down
1 change: 0 additions & 1 deletion rpc/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func newEvmExecutor(blockID uint64, archive state.NonCommittableStateDB, cfg *ut
if err != nil {
return nil, fmt.Errorf("cannot get interpreter factory: %w", err)
}

chainCfg, err := cfg.GetChainConfig("")
if err != nil {
return nil, fmt.Errorf("cannot get chain config: %w", err)
Expand Down

0 comments on commit e345a83

Please sign in to comment.