Skip to content

Commit

Permalink
Fix some vesting-related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lrettig committed Apr 6, 2024
1 parent 4eeee04 commit fabb4a9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion genvm/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (v *VM) addRewards(
log.Uint64("subsidy estimated", subsidy),
log.Uint64("fee", fees),
log.Uint64("total estimated", total),
log.Uint64("total transffered", transferred),
log.Uint64("total transferred", transferred),
log.Uint64("total burnt", total-transferred),
)
feesCount.Add(float64(fees))
Expand Down
5 changes: 3 additions & 2 deletions genvm/templates/vault/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ func (h *handler) New(args any) (core.Template, error) {
spawn.VestingEnd, spawn.VestingStart)
}
return &Vault{
Owner: spawn.Owner,
TotalAmount: spawn.TotalAmount,
Owner: spawn.Owner,
TotalAmount: spawn.TotalAmount,
// InitialUnlockAmount is no longer used per SMIP-0002
InitialUnlockAmount: spawn.InitialUnlockAmount,
VestingStart: spawn.VestingStart,
VestingEnd: spawn.VestingEnd,
Expand Down
13 changes: 7 additions & 6 deletions genvm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1430,12 +1430,12 @@ func runTestCases(t *testing.T, tcs []templateTestCase, genTester func(t *testin
t,
types.TransactionSuccess.String(),
rst.Status.String(),
"layer=%s ith=%d",
"layer=%s txnum=%d",
lid,
i,
)
} else {
require.Equal(t, types.TransactionFailure, rst.Status, "layer=%s ith=%d", lid, i)
require.Equal(t, types.TransactionFailure.String(), rst.Status.String(), "layer=%s ith=%d", lid, i)

Check failure on line 1438 in genvm/vm_test.go

View workflow job for this annotation

GitHub Actions / lint

line is 123 characters (lll)
require.Equal(t, expected.Error(), rst.Message)
}
}
Expand Down Expand Up @@ -1790,6 +1790,7 @@ func TestVestingWithVault(t *testing.T) {
20: spawned{template: vaultTemplate},
},
},
{}, // note empty layer, wait for vesting to start, initial is actually zero
{
txs: []testTx{
&drainVault{0, 20, 11, 500},
Expand Down Expand Up @@ -1857,19 +1858,20 @@ func TestVestingWithVault(t *testing.T) {
20: spawned{template: vaultTemplate},
},
},
{}, // note the layer without transactions
{
txs: []testTx{
&drainVault{
owner: 0, vault: 20, recipient: 11,
amount: 1001,
amount: 5501, // only 5500 available
},
&drainVault{
owner: 0, vault: 20, recipient: 11,
amount: 1000,
},
&drainVault{
owner: 0, vault: 20, recipient: 11,
amount: 1000,
amount: 4501, // only 4500 available
},
},
failed: map[int]error{
Expand All @@ -1890,7 +1892,7 @@ func TestVestingWithVault(t *testing.T) {
txs: []testTx{
&drainVault{
owner: 0, vault: 20, recipient: 10,
amount: 10000,
amount: 10001, // only 10000 available, 4500 from before + 5500 new
},
&drainVault{
owner: 0, vault: 20, recipient: 10,
Expand All @@ -1907,7 +1909,6 @@ func TestVestingWithVault(t *testing.T) {
20: spent{amount: 5000},
},
},
{}, // note the layer without transactions
{
txs: []testTx{
&drainVault{
Expand Down

0 comments on commit fabb4a9

Please sign in to comment.