Search in sources :

Example 1 with JContractIDKey

use of com.hedera.services.legacy.core.jproto.JContractIDKey in project hedera-services by hashgraph.

the class FeeSchedulesManagerTest method setup.

@BeforeEach
private void setup() {
    attr = new HFileMeta(false, new JContractIDKey(1, 2, 3), Instant.now().getEpochSecond());
    fees = mock(FeeCalculator.class);
    subject = new FeeSchedulesManager(new MockFileNumbers(), fees);
}
Also used : FeeCalculator(com.hedera.services.fees.FeeCalculator) HFileMeta(com.hedera.services.files.HFileMeta) JContractIDKey(com.hedera.services.legacy.core.jproto.JContractIDKey) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with JContractIDKey

use of com.hedera.services.legacy.core.jproto.JContractIDKey in project hedera-services by hashgraph.

the class PlatformSigOpsTest method setup.

@BeforeEach
void setup() throws Throwable {
    pubKeys.clear();
    sigBytes = mock(PubKeyToSigBytes.class);
    sigFactory = mock(TxnScopedPlatformSigFactory.class);
    for (final var kt : kts) {
        pubKeys.add(kt.asJKey());
    }
    pubKeys.add(new JContractIDKey(0, 0, 1234));
    pubKeys.add(new JDelegatableContractIDKey(0, 0, 12345));
}
Also used : TxnScopedPlatformSigFactory(com.hedera.services.sigs.factories.TxnScopedPlatformSigFactory) JDelegatableContractIDKey(com.hedera.services.legacy.core.jproto.JDelegatableContractIDKey) JContractIDKey(com.hedera.services.legacy.core.jproto.JContractIDKey) PubKeyToSigBytes(com.hedera.services.sigs.sourcing.PubKeyToSigBytes) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with JContractIDKey

use of com.hedera.services.legacy.core.jproto.JContractIDKey in project hedera-services by hashgraph.

the class UpdateCustomizerFactory method processAdminKey.

private boolean processAdminKey(final ContractUpdateTransactionBody updateOp, final ContractID cid, final HederaAccountCustomizer customizer) {
    if (IMMUTABILITY_SENTINEL_KEY.equals(updateOp.getAdminKey())) {
        customizer.key(new JContractIDKey(cid.getShardNum(), cid.getRealmNum(), cid.getContractNum()));
    } else {
        var resolution = keyIfAcceptable(updateOp.getAdminKey());
        if (resolution.isEmpty()) {
            // return Pair.of(Optional.empty(), INVALID_ADMIN_KEY);
            return true;
        }
        customizer.key(resolution.get());
    }
    return false;
}
Also used : JContractIDKey(com.hedera.services.legacy.core.jproto.JContractIDKey)

Example 4 with JContractIDKey

use of com.hedera.services.legacy.core.jproto.JContractIDKey in project hedera-services by hashgraph.

the class TxnAwareRatesManagerTest method setup.

@BeforeEach
private void setup() {
    attr = new HFileMeta(false, new JContractIDKey(1, 2, 3), Instant.now().getEpochSecond());
    PlatformTxnAccessor accessor = mock(PlatformTxnAccessor.class);
    given(accessor.getSignedTxnWrapper()).willReturn(Transaction.getDefaultInstance());
    txnCtx = mock(TransactionContext.class);
    given(txnCtx.accessor()).willReturn(accessor);
    midnightRates = mock(ExchangeRates.class);
    postUpdateCb = mock(Consumer.class);
    intradayLimit = mock(BiPredicate.class);
    intradayLimitFactory = mock(IntFunction.class);
    given(intradayLimitFactory.apply(actualLimit)).willReturn(intradayLimit);
    properties = mock(GlobalDynamicProperties.class);
    given(properties.ratesIntradayChangeLimitPercent()).willReturn(actualLimit);
    subject = new TxnAwareRatesManager(new MockFileNumbers(), new MockAccountNumbers(), properties, txnCtx, () -> midnightRates, postUpdateCb, intradayLimitFactory);
}
Also used : PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) Consumer(java.util.function.Consumer) TransactionContext(com.hedera.services.context.TransactionContext) IntFunction(java.util.function.IntFunction) HFileMeta(com.hedera.services.files.HFileMeta) ExchangeRates(com.hedera.services.state.submerkle.ExchangeRates) GlobalDynamicProperties(com.hedera.services.context.properties.GlobalDynamicProperties) JContractIDKey(com.hedera.services.legacy.core.jproto.JContractIDKey) MockAccountNumbers(com.hedera.services.config.MockAccountNumbers) BiPredicate(java.util.function.BiPredicate) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with JContractIDKey

use of com.hedera.services.legacy.core.jproto.JContractIDKey in project hedera-services by hashgraph.

the class ValidatingCallbackInterceptorTest method setup.

@BeforeEach
private void setup() {
    attr = new HFileMeta(false, new JContractIDKey(1, 2, 3), Instant.now().getEpochSecond());
    validator = mock(Predicate.class);
    postUpdateCb = mock(Consumer.class);
    properties = mock(PropertySource.class);
    given(properties.getLongProperty(numProperty)).willReturn(actualNum);
    subject = new ValidatingCallbackInterceptor(applicablePriority, numProperty, properties, postUpdateCb, validator);
}
Also used : Consumer(java.util.function.Consumer) HFileMeta(com.hedera.services.files.HFileMeta) JContractIDKey(com.hedera.services.legacy.core.jproto.JContractIDKey) Predicate(java.util.function.Predicate) PropertySource(com.hedera.services.context.properties.PropertySource) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

JContractIDKey (com.hedera.services.legacy.core.jproto.JContractIDKey)7 BeforeEach (org.junit.jupiter.api.BeforeEach)4 HFileMeta (com.hedera.services.files.HFileMeta)3 HederaAccountCustomizer (com.hedera.services.ledger.accounts.HederaAccountCustomizer)2 Consumer (java.util.function.Consumer)2 MockAccountNumbers (com.hedera.services.config.MockAccountNumbers)1 TransactionContext (com.hedera.services.context.TransactionContext)1 GlobalDynamicProperties (com.hedera.services.context.properties.GlobalDynamicProperties)1 PropertySource (com.hedera.services.context.properties.PropertySource)1 FeeCalculator (com.hedera.services.fees.FeeCalculator)1 JDelegatableContractIDKey (com.hedera.services.legacy.core.jproto.JDelegatableContractIDKey)1 TxnScopedPlatformSigFactory (com.hedera.services.sigs.factories.TxnScopedPlatformSigFactory)1 PubKeyToSigBytes (com.hedera.services.sigs.sourcing.PubKeyToSigBytes)1 MerkleAccount (com.hedera.services.state.merkle.MerkleAccount)1 ExchangeRates (com.hedera.services.state.submerkle.ExchangeRates)1 PlatformTxnAccessor (com.hedera.services.utils.PlatformTxnAccessor)1 BiPredicate (java.util.function.BiPredicate)1 IntFunction (java.util.function.IntFunction)1 Predicate (java.util.function.Predicate)1 Test (org.junit.jupiter.api.Test)1