Search in sources :

Example 1 with TokenMint

use of com.hederahashgraph.api.proto.java.HederaFunctionality.TokenMint in project hedera-services by hashgraph.

the class DeterministicThrottlingTest method managerBehavesAsExpectedForFungibleMint.

@Test
void managerBehavesAsExpectedForFungibleMint() throws IOException {
    // setup:
    var defs = SerdeUtils.pojoDefs("bootstrap/throttles.json");
    givenMintWith(0);
    // when:
    subject.rebuildFor(defs);
    // and:
    var firstAns = subject.shouldThrottleTxn(accessor, consensusNow);
    boolean subsequentAns = false;
    for (int i = 1; i <= 3000; i++) {
        subsequentAns = subject.shouldThrottleTxn(accessor, consensusNow.plusNanos(i));
    }
    var throttlesNow = subject.activeThrottlesFor(TokenMint);
    var aNow = throttlesNow.get(0);
    // then:
    assertFalse(firstAns);
    assertTrue(subsequentAns);
    assertEquals(29999955000000000L, aNow.used());
}
Also used : TokenMint(com.hederahashgraph.api.proto.java.HederaFunctionality.TokenMint) Test(org.junit.jupiter.api.Test)

Example 2 with TokenMint

use of com.hederahashgraph.api.proto.java.HederaFunctionality.TokenMint in project hedera-services by hashgraph.

the class DeterministicThrottlingTest method managerBehavesAsExpectedForNftMint.

@Test
void managerBehavesAsExpectedForNftMint() throws IOException {
    // setup:
    final var numNfts = 3;
    var defs = SerdeUtils.pojoDefs("bootstrap/throttles.json");
    givenMintWith(numNfts);
    given(dynamicProperties.nftMintScaleFactor()).willReturn(nftScaleFactor);
    // when:
    subject.rebuildFor(defs);
    // and:
    var firstAns = subject.shouldThrottleTxn(accessor, consensusNow);
    boolean subsequentAns = false;
    for (int i = 1; i <= 400; i++) {
        subsequentAns = subject.shouldThrottleTxn(accessor, consensusNow.plusNanos(i));
    }
    var throttlesNow = subject.activeThrottlesFor(TokenMint);
    // and:
    var aNow = throttlesNow.get(0);
    // then:
    assertFalse(firstAns);
    assertTrue(subsequentAns);
    assertEquals(29999994000000000L, aNow.used());
}
Also used : TokenMint(com.hederahashgraph.api.proto.java.HederaFunctionality.TokenMint) Test(org.junit.jupiter.api.Test)

Aggregations

TokenMint (com.hederahashgraph.api.proto.java.HederaFunctionality.TokenMint)2 Test (org.junit.jupiter.api.Test)2