Fix TxProcessor TokenID use &updates at Til&Common

- Til
  - tests that were using `til.SetBlockchainMinimumFlow0` have been
updated, as now the L1CoordinatorTxs are placed simulating TxSelector
creation (when needed, not before)
  - Add `EthSk` to `tc.User` to allow to sign `AccoutCreationAuths` at
the tests flows
- TxProcessor
  - for L2Txs get TokenID from tx.FromIdx Account.TokenID instead than
  - update tests vectors for new values
from tx.TokenID (which not always is set)
- Common
  - move TxIDsFromL2Txs & TxIDsFromPoolL2Txs from `coordinator` to
`common` to allow usage from other packages
This commit is contained in:
arnaucube
2021-01-02 20:54:08 +01:00
parent 926943cb71
commit 48bdec1397
8 changed files with 57 additions and 43 deletions

View File

@@ -215,19 +215,14 @@ Type: Blockchain
AddToken(1)
// Coordinator accounts, Idxs: 256, 257
CreateAccountCoordinator(0) Coord
CreateAccountCoordinator(1) Coord
// close Block:0, Batch:0
> batch // forge L1Coord{2}
> batch
CreateAccountDeposit(0) A: 500
CreateAccountDeposit(1) C: 0
CreateAccountCoordinator(0) C
// close Block:0, Batch:1
> batchL1 // freeze L1User{2}, forge L1Coord{1}
> batchL1 // freeze L1User{2}, forge L1Coord{0}
// Expected balances:
// Coord(0): 0, Coord(1): 0
// C(0): 0
@@ -263,13 +258,19 @@ CreateAccountDeposit(0) D: 800
// B(0): 400
// C(0): 0
// Coordinator creates needed accounts to receive Fees
CreateAccountCoordinator(1) Coord
CreateAccountCoordinator(0) Coord
// Coordinator creates needed 'To' accounts for the L2Txs
CreateAccountCoordinator(1) B
CreateAccountCoordinator(0) C
Transfer(1) A-B: 200 (126)
Transfer(0) B-C: 100 (126)
// close Block:0, Batch:6
> batchL1 // forge L1User{1}, forge L1Coord{2}, forge L2{2}
> batchL1 // forge L1User{1}, forge L1Coord{4}, forge L2{2}
// Expected balances:
// Coord(0): 10, Coord(1): 20
// A(0): 600, A(1): 280

View File

@@ -123,6 +123,7 @@ type Account struct {
type User struct {
Name string
BJJ *babyjub.PrivateKey
EthSk *ecdsa.PrivateKey
Addr ethCommon.Address
Accounts map[common.TokenID]*Account
}
@@ -696,6 +697,7 @@ func (tc *Context) generateKeys(userNames []string) {
u := User{
Name: userNames[i-1],
BJJ: &sk,
EthSk: &key,
Addr: addr,
Accounts: make(map[common.TokenID]*Account),
}