-
Notifications
You must be signed in to change notification settings - Fork 19
/
fixture.go
25 lines (22 loc) · 1.12 KB
/
fixture.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package evm
import (
"github.com/oasisprotocol/oasis-core/go/common/quantity"
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/oasis"
staking "github.com/oasisprotocol/oasis-core/go/staking/api"
)
// RuntimeFixture prepares the runtime fixture for the EVM tests.
func RuntimeFixture(ff *oasis.NetworkFixture) {
// The EVM runtime has 110_000 TEST tokens already minted internally. Since we connect it to the
// consensus layer (via the consensus module), we should make sure that the runtime's account in
// the consensus layer also has a similar amount as otherwise the delegation tests will fail.
runtimeAddress := staking.NewRuntimeAddress(ff.Runtimes[1].ID)
_ = ff.Network.StakingGenesis.TotalSupply.Add(quantity.NewFromUint64(110_000))
ff.Network.StakingGenesis.Ledger[runtimeAddress] = &staking.Account{
General: staking.GeneralAccount{
Balance: *quantity.NewFromUint64(110_000),
},
}
// Make sure debonding period is at least 2 epochs as otherwise the undelegation can start and
// complete in the same epoch, making the test miss some events.
ff.Network.StakingGenesis.Parameters.DebondingInterval = 2
}