Skip to content

Commit 2b03740

Browse files
committed
Merge remote-tracking branch 'origin/main' into 21209-block-state-proofs
2 parents bc58bd4 + e44b3b5 commit 2b03740

File tree

149 files changed

+510
-11688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+510
-11688
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
/platform-sdk/swirlds-common/ @hiero-ledger/hiero-consensus-node-consensus-codeowners @hiero-ledger/hiero-consensus-node-foundation-codeowners
7272
/platform-sdk/swirlds-component-framework/ @hiero-ledger/hiero-consensus-node-consensus-codeowners
7373
/platform-sdk/swirlds-config-*/ @hiero-ledger/hiero-consensus-node-foundation-codeowners
74-
/platform-sdk/swirlds-fchashmap/ @hiero-ledger/hiero-consensus-node-foundation-codeowners
7574
/platform-sdk/swirlds-fcqueue/ @hiero-ledger/hiero-consensus-node-foundation-codeowners
7675
/platform-sdk/swirlds-logging/ @hiero-ledger/hiero-consensus-node-foundation-codeowners
7776
/platform-sdk/swirlds-logging-*/ @hiero-ledger/hiero-consensus-node-foundation-codeowners

hapi/hedera-protobuf-java-api/src/main/proto/fees/fee_schedule.proto

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@ enum Extra {
9797
CRYPTO_TRANSFER_BASE_FUNGIBLE_CUSTOM_FEES=19;
9898
CRYPTO_TRANSFER_BASE_NFT_CUSTOM_FEES=20;
9999
HOOK_EXECUTION=21;
100-
TOKEN_CREATE_FUNGIBLE=22;
101-
TOKEN_CREATE_NFT=23;
102-
TOKEN_MINT_FUNGIBLE=24;
103-
TOKEN_MINT_NFT=25;
104-
CONSENSUS_CREATE_TOPIC_WITH_CUSTOM_FEE=26;
105-
CONSENSUS_SUBMIT_MESSAGE_WITH_CUSTOM_FEE=27;
100+
TOKEN_CREATE_WITH_CUSTOM_FEE=22;
101+
TOKEN_MINT_NFT=23;
102+
CONSENSUS_CREATE_TOPIC_WITH_CUSTOM_FEE=24;
103+
CONSENSUS_SUBMIT_MESSAGE_WITH_CUSTOM_FEE=25;
106104
}
107105

108106
/**

hedera-node/docs/design/app/states.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ state between nodes.
99
The state of the system is, ultimately, stored in a Merkle tree using an API defined by the hashgraph platform. However,
1010
this implementation reality is not a detail that any of the service implementations need to be aware of! Instead, all
1111
state stored in the system can ultimately be broken down into simple singleton or key/value data structures. Indeed,
12-
the hashgraph platform makes this easy with an API for in-memory k/v storage (MerkleMap) and on-disk k/v storage
13-
(VirtualMap).
12+
the hashgraph platform makes this easy with an API for k/v storage (VirtualMap).
1413

1514
The `com.hedera.node.app.spi.state` package contains APIs for a service module to interact with state. It was our
1615
objective to eliminate the need for a service module to interact directly with the merkle tree. This was done for four
@@ -87,9 +86,7 @@ or mutable and immutable states. It is simply given, by the application, the `Re
8786

8887
There are two "state" interfaces for k/v maps: `ReadableKVState` and `WritableKVState`. `WritableKVState` extends from
8988
`ReadableKVState`, so a `WritableKVState` is read/write. The application module implements these interfaces on top of
90-
`MerkleMap`s or `VirtualMap`s, depending on whether the application's `Schema` declares the state to be in-memory
91-
or on-disk (more on this later). The service module only declares whether the state should be in-memory or on-disk,
92-
it does not ever get exposed to either the `MerkleMap` or `VirtualMap` directly.
89+
a `VirtualMap`. The service module does not ever get exposed to `VirtualMap` directly.
9390

9491
Each state is scoped to a particular service implementation. They are never shared across service implementations.
9592
In fact, the state of a service **MUST NOT** be exposed as public API by any service API. The state of a service

hedera-node/hedera-app/src/test/resources/signedState/MHS/settingsUsed.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ data/threadDump = threadDumpLogDir
101101
10 = reconnect.maxAckDelayMilliseconds
102102
10 = reconnect.maximumReconnectFailuresBeforeShutdown
103103
PT10M = reconnect.minimumTimeBetweenReconnects
104-
200 = fcHashMap.maximumGCQueueSize
105-
PT1M = fcHashMap.gcQueueThresholdPeriod
106-
true = fcHashMap.archiveEnabled
107-
7 = fcHashMap.rebuildSplitFactor
108-
10 = fcHashMap.rebuildThreadCount
109104
-1 = virtualMap.numHashThreads
110105
50.0 = virtualMap.percentHashThreads
111106
-1 = virtualMap.numCleanerThreads

hedera-node/hedera-file-service-impl/src/main/resources/genesis/simpleFeesSchedules.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
{ "name": "CUSTOM_FEE", "fee": 0 },
2929
{ "name": "GAS", "fee": 1 },
3030
{ "name": "ALLOWANCES", "fee": 500000000 },
31-
{ "name": "TOKEN_CREATE_FUNGIBLE", "fee": 9999000000 },
32-
{ "name": "TOKEN_CREATE_NFT", "fee": 19999000000 },
33-
{ "name": "TOKEN_MINT_FUNGIBLE", "fee": 0 },
31+
{ "name": "TOKEN_CREATE_WITH_CUSTOM_FEE", "fee": 10000000000 },
3432
{ "name": "TOKEN_MINT_NFT", "fee": 199000000 },
3533
{ "name": "AIRDROPS", "fee": 8800 },
3634
{ "name": "HOOK_UPDATES", "fee": 10000000000 },
@@ -185,18 +183,16 @@
185183
"schedule": [
186184
{
187185
"name": "TokenCreate",
188-
"baseFee": 0,
186+
"baseFee": 9999000000,
189187
"extras": [
190188
{"name": "KEYS", "includedCount": 1},
191-
{"name": "TOKEN_CREATE_FUNGIBLE", "includedCount": 0 },
192-
{"name": "TOKEN_CREATE_NFT", "includedCount": 0 }
189+
{"name": "TOKEN_CREATE_WITH_CUSTOM_FEE", "includedCount": 0 }
193190
]
194191
},
195192
{
196193
"name": "TokenMint",
197194
"baseFee": 9000000,
198195
"extras": [
199-
{"name": "TOKEN_MINT_FUNGIBLE", "includedCount": 0 },
200196
{"name": "TOKEN_MINT_NFT", "includedCount": 0 }
201197
]
202198
},

hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/calculator/TokenCreateFeeCalculator.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import static org.hiero.hapi.fees.FeeScheduleUtils.lookupServiceFee;
66

77
import com.hedera.hapi.node.base.HederaFunctionality;
8-
import com.hedera.hapi.node.base.TokenType;
98
import com.hedera.hapi.node.transaction.TransactionBody;
109
import com.hedera.node.app.spi.fees.FeeContext;
1110
import com.hedera.node.app.spi.fees.ServiceFeeCalculator;
@@ -55,11 +54,8 @@ public void accumulateServiceFee(
5554
}
5655
addExtraFee(feeResult, serviceDef, Extra.KEYS, feeSchedule, keys);
5756

58-
if (op.tokenType() == TokenType.FUNGIBLE_COMMON) {
59-
addExtraFee(feeResult, serviceDef, Extra.TOKEN_CREATE_FUNGIBLE, feeSchedule, 1);
60-
}
61-
if (op.tokenType() == TokenType.NON_FUNGIBLE_UNIQUE) {
62-
addExtraFee(feeResult, serviceDef, Extra.TOKEN_CREATE_NFT, feeSchedule, 1);
57+
if (!op.customFees().isEmpty()) {
58+
addExtraFee(feeResult, serviceDef, Extra.TOKEN_CREATE_WITH_CUSTOM_FEE, feeSchedule, 1);
6359
}
6460
}
6561

hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/calculator/TokenMintFeeCalculator.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ public void accumulateServiceFee(
2727
feeResult.addServiceFee(1, serviceDef.baseFee());
2828
var op = txnBody.tokenMintOrThrow();
2929
if (op.amount() > 0) {
30-
addExtraFee(feeResult, serviceDef, Extra.TOKEN_MINT_FUNGIBLE, feeSchedule, op.amount());
3130
addExtraFee(feeResult, serviceDef, Extra.TOKEN_MINT_NFT, feeSchedule, 0);
3231
} else {
33-
addExtraFee(feeResult, serviceDef, Extra.TOKEN_MINT_FUNGIBLE, feeSchedule, 0);
3432
addExtraFee(
3533
feeResult,
3634
serviceDef,

hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenServiceFeeCalculatorTests.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void createCommonToken() {
106106
.build();
107107
final var result = feeCalculator.calculateTxFee(body, calculatorState);
108108
assertNotNull(result);
109-
assertEquals(TOKEN_CREATE_BASE_FEE + COMMON_TOKEN_FEE, result.total());
109+
assertEquals(TOKEN_CREATE_BASE_FEE, result.total());
110110
}
111111

112112
@Test
@@ -118,7 +118,7 @@ void createUniqueToken() {
118118
final var result = feeCalculator.calculateTxFee(txBody2, calculatorState);
119119

120120
assertNotNull(result);
121-
assertEquals(TOKEN_CREATE_BASE_FEE + UNIQUE_TOKEN_FEE, result.total());
121+
assertEquals(TOKEN_CREATE_BASE_FEE, result.total());
122122
}
123123

124124
@Test
@@ -133,7 +133,7 @@ void mintCommonToken() {
133133
.build();
134134
final var result = feeCalculator.calculateTxFee(body, calculatorState);
135135
assertNotNull(result);
136-
assertEquals(TOKEN_MINT_BASE_FEE + COMMON_TOKEN_FEE * 10, result.total());
136+
assertEquals(TOKEN_MINT_BASE_FEE, result.total());
137137
}
138138

139139
@Test
@@ -242,25 +242,16 @@ private FeeSchedule createTestFeeSchedule() {
242242
makeExtraDef(Extra.BYTES, 1),
243243
makeExtraDef(Extra.KEYS, 2),
244244
makeExtraDef(Extra.SIGNATURES, 3),
245-
makeExtraDef(Extra.TOKEN_CREATE_FUNGIBLE, COMMON_TOKEN_FEE),
246-
makeExtraDef(Extra.TOKEN_CREATE_NFT, UNIQUE_TOKEN_FEE),
247-
makeExtraDef(Extra.TOKEN_MINT_FUNGIBLE, COMMON_TOKEN_FEE),
248245
makeExtraDef(Extra.TOKEN_MINT_NFT, UNIQUE_TOKEN_FEE),
249246
makeExtraDef(Extra.CUSTOM_FEE, 500))
250247
.network(NetworkFee.DEFAULT.copyBuilder().multiplier(2).build())
251248
.services(makeService(
252249
"Token",
253-
makeServiceFee(
254-
TOKEN_CREATE,
255-
TOKEN_CREATE_BASE_FEE,
256-
makeExtraIncluded(Extra.KEYS, 1),
257-
makeExtraIncluded(Extra.TOKEN_CREATE_FUNGIBLE, 0),
258-
makeExtraIncluded(Extra.TOKEN_CREATE_NFT, 0)),
250+
makeServiceFee(TOKEN_CREATE, TOKEN_CREATE_BASE_FEE, makeExtraIncluded(Extra.KEYS, 1)),
259251
makeServiceFee(
260252
TOKEN_MINT,
261253
TOKEN_MINT_BASE_FEE,
262254
makeExtraIncluded(Extra.KEYS, 1),
263-
makeExtraIncluded(Extra.TOKEN_MINT_FUNGIBLE, 0),
264255
makeExtraIncluded(Extra.TOKEN_MINT_NFT, 0)),
265256
makeServiceFee(TOKEN_BURN, TOKEN_BURN_BASE_FEE),
266257
makeServiceFee(TOKEN_DELETE, TOKEN_DELETE_BASE_FEE),

hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/fees/TokenServiceSimpleFeesSuite.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import static com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenPause;
1414
import static com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenUnfreeze;
1515
import static com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenUnpause;
16+
import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fixedHbarFee;
1617
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.compareSimpleToOld;
1718
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed;
1819
import static com.hedera.services.bdd.suites.HapiSuite.ONE_BILLION_HBARS;
@@ -45,6 +46,7 @@ public class TokenServiceSimpleFeesSuite {
4546
private static final String PAYER = "payer";
4647
private static final String ADMIN = "admin";
4748
private static final String OTHER = "other";
49+
private static final String HBAR_COLLECTOR = "hbarCollector";
4850

4951
@LeakyHapiTest(overrides = {"fees.simpleFeesEnabled"})
5052
@DisplayName("compare create fungible token")
@@ -101,6 +103,36 @@ final Stream<DynamicTest> compareCreateNonFungibleToken() {
101103
// fungible = 19999000000,
102104
// node+network = 1000000
103105
// total = 20000000000 = 2.0
106+
1,
107+
1,
108+
1,
109+
1);
110+
}
111+
112+
@LeakyHapiTest(overrides = {"fees.simpleFeesEnabled"})
113+
@DisplayName("compare create fungible token with custom fees")
114+
final Stream<DynamicTest> compareCreateFungibleTokenWithCustomFees() {
115+
return compareSimpleToOld(
116+
() -> Arrays.asList(
117+
newKeyNamed(SUPPLY_KEY),
118+
cryptoCreate(ADMIN).balance(ONE_BILLION_HBARS),
119+
cryptoCreate(PAYER).balance(ONE_BILLION_HBARS),
120+
cryptoCreate(HBAR_COLLECTOR).balance(0L),
121+
tokenCreate("commonCustomFees")
122+
.blankMemo()
123+
.payingWith(PAYER)
124+
.fee(ONE_HUNDRED_HBARS)
125+
.treasury(ADMIN)
126+
.tokenType(NON_FUNGIBLE_UNIQUE)
127+
.initialSupply(0L)
128+
.supplyKey(SUPPLY_KEY)
129+
.autoRenewAccount(ADMIN)
130+
.autoRenewPeriod(THREE_MONTHS_IN_SECONDS)
131+
.withCustom(fixedHbarFee(1L, HBAR_COLLECTOR))
132+
.logged()
133+
.hasKnownStatus(SUCCESS)
134+
.via("create-token-txn")),
135+
"create-token-txn",
104136
2,
105137
1,
106138
2,
@@ -240,6 +272,8 @@ final Stream<DynamicTest> compareMintMultipleUniqueToken() {
240272
.hasKnownStatus(SUCCESS)
241273
.via("non-fungible-multiple-mint-txn")),
242274
"non-fungible-multiple-mint-txn",
275+
// TODO: we need a better way to represent the cost of minting NFTs.
276+
// with this current system the cost of node+network will be double counted
243277
// base = 9000000,
244278
// tokens = 199000000*3,
245279
// node+network = 1000000

platform-sdk/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ val cleanRun =
3636

3737
tasks.clean { dependsOn(cleanRun) }
3838

39-
tasks.checkModuleDirectivesScope { this.enabled = false }
39+
// Disable checkModuleDirectivesScope task if it exists
40+
afterEvaluate { tasks.findByName("checkModuleDirectivesScope")?.enabled = false }

0 commit comments

Comments
 (0)