Skip to content

Commit

Permalink
it's v11 now
Browse files Browse the repository at this point in the history
  • Loading branch information
jannotti committed Jan 10, 2024
1 parent de07ba9 commit 55917b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ledger/apptxn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestPayAction(t *testing.T) {
dl.txns(&payout1)
vb := dl.endBlock(proposer)
// First MiningPct > 0
if ver >= 39 {
if ver >= 40 {
require.True(t, dl.generator.GenesisProto().EnableMining)
require.EqualValues(t, proposer, vb.Block().BlockHeader.Proposer)
require.EqualValues(t, 2000, vb.Block().BlockHeader.FeesCollected.Raw)
Expand All @@ -110,7 +110,7 @@ func TestPayAction(t *testing.T) {
postsink = micros(dl.t, dl.generator, genBalances.FeeSink)
postprop = micros(dl.t, dl.generator, proposer)
// First MiningPct > 0
if ver >= 39 {
if ver >= 40 {
require.EqualValues(t, 500, postsink-presink) // based on 75% in config/consensus.go
require.EqualValues(t, 1500, postprop-preprop)
} else {
Expand Down
17 changes: 8 additions & 9 deletions ledger/eval_simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,15 @@ func TestBlockEvaluator(t *testing.T) {
require.Equal(t, bal2new.MicroAlgos.Raw, bal2.MicroAlgos.Raw-minFee.Raw)
}

// TestMiningFees ensures that the proper portion of tx fees go to the proposer,
// starting in v39.
// TestMiningFees ensures that the proper portion of tx fees go to the proposer
func TestMiningFees(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

// Lots of balance checks that would be messed up by rewards
genBalances, addrs, _ := ledgertesting.NewTestGenesis(ledgertesting.TurnOffRewards)
// Mining begins in v39. Start checking in v38 to test that is unchanged.
ledgertesting.TestConsensusRange(t, 38, 0, func(t *testing.T, ver int, cv protocol.ConsensusVersion, cfg config.Local) {
miningBegins := 40
ledgertesting.TestConsensusRange(t, miningBegins-1, 0, func(t *testing.T, ver int, cv protocol.ConsensusVersion, cfg config.Local) {
dl := NewDoubleLedger(t, genBalances, cv, cfg)
defer dl.Close()

Expand Down Expand Up @@ -271,7 +270,7 @@ func TestMiningFees(t *testing.T) {
dl.txns(&pay, pay.Args("again"))
vb := dl.endBlock(proposer)

if ver >= 39 {
if ver >= miningBegins {
require.True(t, dl.generator.GenesisProto().EnableMining) // version sanity check
require.NotZero(t, dl.generator.GenesisProto().MiningPercent) // version sanity check
// new fields are in the header
Expand Down Expand Up @@ -299,7 +298,7 @@ func TestMiningFees(t *testing.T) {
postsink = micros(dl.t, dl.generator, genBalances.FeeSink)
postprop = micros(dl.t, dl.generator, proposer)

if ver >= 39 && (proposer == smallest || proposer == biggest) {
if ver >= miningBegins && (proposer == smallest || proposer == biggest) {
require.EqualValues(t, 500, postsink-presink) // based on 75% in config/consensus.go
require.EqualValues(t, 1500, postprop-preprop)
} else {
Expand All @@ -317,8 +316,8 @@ func TestIncentiveEligible(t *testing.T) {
t.Parallel()

genBalances, addrs, _ := ledgertesting.NewTestGenesis()
// Incentive-eligible appears in v39. Start checking in v38 to test that is unchanged.
ledgertesting.TestConsensusRange(t, 38, 0, func(t *testing.T, ver int, cv protocol.ConsensusVersion, cfg config.Local) {
miningBegins := 40
ledgertesting.TestConsensusRange(t, miningBegins-1, 0, func(t *testing.T, ver int, cv protocol.ConsensusVersion, cfg config.Local) {
dl := NewDoubleLedger(t, genBalances, cv, cfg)
defer dl.Close()

Expand Down Expand Up @@ -369,7 +368,7 @@ func TestIncentiveEligible(t *testing.T) {
require.False(t, a.IncentiveEligible)
a, _, _, err = dl.generator.LookupLatest(smallest)
require.NoError(t, err)
require.Equal(t, a.IncentiveEligible, ver > 38)
require.Equal(t, a.IncentiveEligible, ver >= miningBegins)
})
}

Expand Down
2 changes: 1 addition & 1 deletion test/scripts/e2e_subs/mining.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
assert not err, err

get_proposer = """
#pragma version 10
#pragma version 11
txn ApplicationArgs 0; btoi
block BlkProposer; global ZeroAddress; !=; assert
Expand Down

0 comments on commit 55917b8

Please sign in to comment.