@@ -3748,7 +3748,15 @@ async function burnTestBaseCase<
37483748
37493749 // Check total issuance decreased by burn amount (fees are not included)
37503750 const totalIssuanceAfterBurn = await client . api . query . balances . totalIssuance ( )
3751- expect ( totalIssuanceAfterBurn . toBigInt ( ) ) . toBe ( initialTotalIssuance . toBigInt ( ) - burnAmount )
3751+ const tiDelta = initialTotalIssuance . toBigInt ( ) - totalIssuanceAfterBurn . toBigInt ( )
3752+ if ( client . config . isRelayChain ) {
3753+ // On relay chains the block author may be below ED; if so, the fee credit is dropped and
3754+ // TI shrinks by an extra authorShare on top of the burn (polkadot-sdk#9986).
3755+ const authorShare = burnFee - ( burnFee * 4n ) / 5n
3756+ expect ( tiDelta === burnAmount || tiDelta === burnAmount + authorShare ) . toBe ( true )
3757+ } else {
3758+ expect ( tiDelta ) . toBe ( burnAmount )
3759+ }
37523760
37533761 // Check burn event
37543762 const eventsAfterBurn = await client . api . query . system . events ( )
@@ -3845,8 +3853,17 @@ async function burnTestWithReaping<
38453853 // 4. Verify that the total issuance is decreased by the amount burned
38463854 const totalIssuanceAfterBurn = await client . api . query . balances . totalIssuance ( )
38473855 const isBifrost = chain . name . includes ( 'bifrost' )
3856+ const reapingFee = cumulativeFees . get ( encodeAddress ( alice . address , client . config . properties . addressEncoding ) ) !
38483857 const expectedDecrease = isBifrost ? burnAmount : burnAmount + ( existentialDeposit - 1n )
3849- expect ( totalIssuanceAfterBurn . toBigInt ( ) ) . toBe ( initialTotalIssuance . toBigInt ( ) - expectedDecrease )
3858+ const tiAfter = totalIssuanceAfterBurn . toBigInt ( )
3859+ const tiExpect = initialTotalIssuance . toBigInt ( ) - expectedDecrease
3860+ if ( client . config . isRelayChain ) {
3861+ // Block author may be below ED; fee credit may be dropped, shrinking TI further (polkadot-sdk#9986).
3862+ const reapingAuthorShare = reapingFee - ( reapingFee * 4n ) / 5n
3863+ expect ( tiAfter === tiExpect || tiAfter === tiExpect - reapingAuthorShare ) . toBe ( true )
3864+ } else {
3865+ expect ( tiAfter ) . toBe ( tiExpect )
3866+ }
38503867}
38513868
38523869/**
@@ -3928,10 +3945,21 @@ async function burnKeepAliveTest<
39283945 expect ( aliceFinalBalance ) . toBe ( aliceInitialBalance - transactionFee )
39293946 expect ( await isAccountReaped ( client , alice . address ) ) . toBe ( false )
39303947
3931- // 6. Verify that total issuance is unchanged
3948+ // 6. Verify that total issuance is unchanged (see polkadot-sdk#9986 for relay-chain author-drop case)
39323949
39333950 const finalTotalIssuance = await client . api . query . balances . totalIssuance ( )
3934- expect ( finalTotalIssuance . toBigInt ( ) ) . toBe ( initialTotalIssuance . toBigInt ( ) )
3951+ const keepAliveFee = cumulativeFees . get ( encodeAddress ( alice . address , client . config . properties . addressEncoding ) ) !
3952+ const keepAliveTI = finalTotalIssuance . toBigInt ( )
3953+ if ( client . config . isRelayChain ) {
3954+ // Block author may be below ED; fee credit may be dropped, shrinking TI (polkadot-sdk#9986).
3955+ const keepAliveAuthorShare = keepAliveFee - ( keepAliveFee * 4n ) / 5n
3956+ expect (
3957+ keepAliveTI === initialTotalIssuance . toBigInt ( ) ||
3958+ keepAliveTI === initialTotalIssuance . toBigInt ( ) - keepAliveAuthorShare ,
3959+ ) . toBe ( true )
3960+ } else {
3961+ expect ( keepAliveTI ) . toBe ( initialTotalIssuance . toBigInt ( ) )
3962+ }
39353963
39363964 // Verify no explicit Burned event for Alice (on Bifrost, fee-related Burned events are expected)
39373965 const explicitBurns = findExplicitBurnEventsForAccount ( systemEvents , client , alice . address , chain )
@@ -4041,10 +4069,21 @@ async function burnWithDepositTest<
40414069 const expectedFreeBalance = aliceFreeBefore - totalFees
40424070 expect ( aliceAccountAfterBurn . data . free . toBigInt ( ) ) . toBe ( expectedFreeBalance )
40434071
4044- // 5. Verify that total issuance is unchanged
4072+ // 5. Verify that total issuance is unchanged (see polkadot-sdk#9986 for relay-chain author-drop case)
40454073
40464074 const finalTotalIssuance = await client . api . query . balances . totalIssuance ( )
4047- expect ( finalTotalIssuance . toBigInt ( ) ) . toBe ( initialTotalIssuance . toBigInt ( ) )
4075+ const depositFee = cumulativeFees . get ( encodeAddress ( alice . address , client . config . properties . addressEncoding ) ) !
4076+ const depositTI = finalTotalIssuance . toBigInt ( )
4077+ if ( client . config . isRelayChain ) {
4078+ // Block author may be below ED; fee credit may be dropped, shrinking TI (polkadot-sdk#9986).
4079+ const depositAuthorShare = depositFee - ( depositFee * 4n ) / 5n
4080+ expect (
4081+ depositTI === initialTotalIssuance . toBigInt ( ) ||
4082+ depositTI === initialTotalIssuance . toBigInt ( ) - depositAuthorShare ,
4083+ ) . toBe ( true )
4084+ } else {
4085+ expect ( depositTI ) . toBe ( initialTotalIssuance . toBigInt ( ) )
4086+ }
40484087
40494088 // Verify no explicit Burned event for Alice
40504089 const systemEvents = await client . api . query . system . events ( )
@@ -4157,10 +4196,23 @@ async function burnDoubleAttemptTest<
41574196 expect ( aliceFinalBalance ) . toBe ( aliceInitialBalance - transactionFees )
41584197 expect ( await isAccountReaped ( client , alice . address ) ) . toBe ( false )
41594198
4160- // 5. Verify total issuance is unchanged
4199+ // 5. Verify total issuance is unchanged (see polkadot-sdk#9986 for relay-chain author-drop case)
4200+ // Two transactions: each fee goes through ration(80,20) independently, so we check per-fee drops.
41614201
41624202 const finalTotalIssuance = await client . api . query . balances . totalIssuance ( )
4163- expect ( finalTotalIssuance . toBigInt ( ) ) . toBe ( initialTotalIssuance . toBigInt ( ) )
4203+ const doubleFee = cumulativeFees . get ( encodeAddress ( alice . address , client . config . properties . addressEncoding ) ) !
4204+ const singleFee = doubleFee / 2n
4205+ const singleAuthorShare = singleFee - ( singleFee * 4n ) / 5n
4206+ const doubleTI = finalTotalIssuance . toBigInt ( )
4207+ const ti0 = initialTotalIssuance . toBigInt ( )
4208+ if ( client . config . isRelayChain ) {
4209+ // Block author is either consistently above or below ED for both txs in the same context;
4210+ // either both fee credits are dropped or neither is (polkadot-sdk#9986).
4211+ const doubleAuthorShare = singleAuthorShare * 2n
4212+ expect ( doubleTI === ti0 || doubleTI === ti0 - doubleAuthorShare ) . toBe ( true )
4213+ } else {
4214+ expect ( doubleTI ) . toBe ( ti0 )
4215+ }
41644216
41654217 // Verify no explicit Burned event for Alice
41664218 const explicitBurns = findExplicitBurnEventsForAccount ( systemEvents , client , alice . address , chain )
0 commit comments