Skip to content

Commit

Permalink
Update v22 cost types for rolling back wasmi change (stellar#4495)
Browse files Browse the repository at this point in the history
# Description

Here is a gist with the diff of budget.rs between v21.0.0 and
v22.0.0-rc.2 -
https://gist.github.com/sisuresh/7c89270bab9ab2fb09a43beb98aaeab7.

Command used for the gist - `git diff
v21.0.0:soroban-env-host/src/budget.rs
v22.0.0-rc.2:soroban-env-host/src/budget.rs`

<!---

Describe what this pull request does, which issue it's resolving
(usually applicable for code changes).

--->

# Checklist
- [ ] Reviewed the
[contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes)
document
- [ ] Rebased on top of master (no merge commits)
- [ ] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio
extension)
- [ ] Compiles
- [ ] Ran all tests
- [ ] If change impacts performance, include supporting evidence per the
[performance
document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
  • Loading branch information
sisuresh authored Oct 3, 2024
2 parents 906aff0 + 903a1f2 commit 3007c59
Show file tree
Hide file tree
Showing 5 changed files with 680 additions and 794 deletions.
114 changes: 0 additions & 114 deletions src/ledger/NetworkConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,72 +461,6 @@ updateCpuCostParamsEntryForV22(AbstractLedgerTxn& ltxRoot)
{
switch (val)
{
// updating existing parameters changed in p22
case VmInstantiation:
params[val] =
ContractCostParamEntry(ExtensionPoint{0}, 31271, 57504);
break;
case VmCachedInstantiation:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 40828, 680);
break;
case InvokeVmFunction:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 2149, 0);
break;
case ParseWasmInstructions:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 37421, 32);
break;
case ParseWasmFunctions:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 84156);
break;
case ParseWasmGlobals:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 163415);
break;
case ParseWasmTableEntries:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 29644);
break;
case ParseWasmTypes:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 893113);
break;
case ParseWasmDataSegments:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 184921);
break;
case ParseWasmElemSegments:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 312369);
break;
case ParseWasmImports:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 529255);
break;
case ParseWasmExports:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 361665);
break;
case ParseWasmDataSegmentBytes:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 14);
break;
case InstantiateWasmInstructions:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 43208, 0);
break;
case InstantiateWasmFunctions:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 8050);
break;
case InstantiateWasmGlobals:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 10647);
break;
case InstantiateWasmTableEntries:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 1933);
break;
case InstantiateWasmDataSegments:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 17164);
break;
case InstantiateWasmElemSegments:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 34261);
break;
case InstantiateWasmImports:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 746142);
break;
case InstantiateWasmExports:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 0, 296177);
break;

// adding new cost types introduced in p22
case Bls12381EncodeFp:
params[val] = ContractCostParamEntry(ExtensionPoint{0}, 661, 0);
Expand Down Expand Up @@ -889,54 +823,6 @@ updateMemCostParamsEntryForV22(AbstractLedgerTxn& ltxRoot)
{
switch (val)
{
// updating existing parameters changed in p22
case VmCachedInstantiation:
params[val] =
ContractCostParamEntry{ExtensionPoint{0}, 69472, 1478};
break;
case InvokeVmFunction:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 15, 0};
break;
case ParseWasmInstructions:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 13980, 215};
break;
case ParseWasmFunctions:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 23056};
break;
case ParseWasmGlobals:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 11924};
break;
case ParseWasmTableEntries:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 6121};
break;
case ParseWasmTypes:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 49554};
break;
case ParseWasmDataSegments:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 5525};
break;
case ParseWasmElemSegments:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 47034};
break;
case ParseWasmImports:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 101762};
break;
case ParseWasmExports:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 35491};
break;
case ParseWasmDataSegmentBytes:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 129};
break;
case InstantiateWasmInstructions:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 70792, 0};
break;
case InstantiateWasmFunctions:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 17749};
break;
case InstantiateWasmImports:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 98578};
break;

// adding new cost types introduced in p22
case Bls12381EncodeFp:
params[val] = ContractCostParamEntry{ExtensionPoint{0}, 0, 0};
Expand Down
12 changes: 6 additions & 6 deletions src/testdata/ledger-close-meta-v1-protocol-22-soroban.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
"v": 0
},
"ledgerHeader": {
"hash": "823cfdd8857bce214b9d00f8c58fe586318867c01ae4b2ec2fe64459de4f2e00",
"hash": "731c4791022bd35ba864642a7a1366ef37a2b7cb39ac2b23c1f9d0a3b6c0157d",
"header": {
"ledgerVersion": 22,
"previousLedgerHash": "d10889ce521eefaa0d52b01e6bdd874bf9b642a196e0ec848902c6ecdc64ab29",
"previousLedgerHash": "7b4668bf68d1c677cfa80cfe3e3aac5def6035a6033897eb63107df8198128b7",
"scpValue": {
"txSetHash": "a54305ab82979a63eb45c8f5774514d75ce47f4838a5c661cf36a299807d11f3",
"txSetHash": "8198019d94ed679aea6b1097ba9b9dee32002f9568b7a6b23e1cf2b14d83bd54",
"closeTime": 1451692800,
"upgrades": [],
"ext": {
"v": "STELLAR_VALUE_SIGNED",
"lcValueSignature": {
"nodeID": "GDDOUW25MRFLNXQMN3OODP6JQEXSGLMHAFZV4XPQ2D3GA4QFIDMEJG2O",
"signature": "38827a5a4922ae983f698bdc5b3c6cade71a620335530170af1cac6ab53f4cca6f2aece0b6ea64c413b9ba88ded7e827cbc60bddac74760fde5d52376a829e0f"
"signature": "a8e0f4e2153e0f492d65d8b44c0f8911f7c7eeefdb6affd3626e2eaec7ae2cda3e38019912ef1602b9f7fc2c5325ed792a72eef1276f098e5680a7d9a9308a08"
}
}
},
"txSetResultHash": "c1f2e605905ad744b9dc6ac2cf506d00f08799f7a55f55e5bc0316ed1391773a",
"bucketListHash": "2497184ac85be1638a6275d9f0483c8d3dfc4ee988b0cf4dbedad8707ae6a8ec",
"bucketListHash": "183ca6ee7121692a6e8acc672e8fcc66c4787c7353191fc3879bd7adbc1b3717",
"ledgerSeq": 28,
"totalCoins": 1000000000000000000,
"feePool": 804520,
Expand All @@ -49,7 +49,7 @@
"txSet": {
"v": 1,
"v1TxSet": {
"previousLedgerHash": "d10889ce521eefaa0d52b01e6bdd874bf9b642a196e0ec848902c6ecdc64ab29",
"previousLedgerHash": "7b4668bf68d1c677cfa80cfe3e3aac5def6035a6033897eb63107df8198128b7",
"phases": [
{
"v": 0,
Expand Down
Loading

0 comments on commit 3007c59

Please sign in to comment.