Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up and clearify some ContractCostTypes #133

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 29 additions & 32 deletions Stellar-contract-config-setting.x
Original file line number Diff line number Diff line change
Expand Up @@ -100,59 +100,56 @@ enum ContractCostType {
HostMemCpy = 3,
// Cost of comparing two slices of host memory
HostMemCmp = 4,
// Cost of a host function invocation, not including the actual work done by the function
InvokeHostFunction = 5,
// Cost of visiting a host object from the host object storage
// Only thing to make sure is the guest can't visitObject repeatly without incurring some charges elsewhere.
// Cost of a host function dispatch, not including the actual work done by
// the function nor the cost of VM invocation machinary
DispatchHostFunction = 5,
// Cost of visiting a host object from the host object storage. Exists to
// make sure some baseline cost coverage, i.e. repeatly visiting objects
// by the guest will always incur some charges.
VisitObject = 6,
// Tracks a single Val (RawVal or primative Object like U64) <=> ScVal
// conversion cost. Most of these Val counterparts in ScVal (except e.g.
// Symbol) consumes a single int64 and therefore is a constant overhead.
ValXdrConv = 7,
// Cost of serializing an xdr object to bytes
ValSer = 8,
ValSer = 7,
// Cost of deserializing an xdr object from bytes
ValDeser = 9,
ValDeser = 8,
// Cost of computing the sha256 hash from bytes
ComputeSha256Hash = 10,
ComputeSha256Hash = 9,
// Cost of computing the ed25519 pubkey from bytes
ComputeEd25519PubKey = 11,
ComputeEd25519PubKey = 10,
// Cost of accessing an entry in a Map.
MapEntry = 12,
MapEntry = 11,
// Cost of accessing an entry in a Vec
VecEntry = 13,
VecEntry = 12,
// Cost of verifying ed25519 signature of a payload.
VerifyEd25519Sig = 14,
VerifyEd25519Sig = 13,
// Cost of reading a slice of vm linear memory
VmMemRead = 15,
VmMemRead = 14,
// Cost of writing to a slice of vm linear memory
VmMemWrite = 16,
VmMemWrite = 15,
// Cost of instantiation a VM from wasm bytes code.
VmInstantiation = 17,
VmInstantiation = 16,
// Cost of instantiation a VM from a cached state.
VmCachedInstantiation = 18,
// Roundtrip cost of invoking a VM function from the host.
InvokeVmFunction = 19,
// Cost of charging a value to the budgeting system.
ChargeBudget = 20,
VmCachedInstantiation = 17,
// Cost of invoking a function on the VM. If the function is a host function,
// additional cost will be covered by `DispatchHostFunction`.
InvokeVmFunction = 18,
// Cost of computing a keccak256 hash from bytes.
ComputeKeccak256Hash = 21,
ComputeKeccak256Hash = 19,
// Cost of computing an ECDSA secp256k1 pubkey from bytes.
ComputeEcdsaSecp256k1Key = 22,
ComputeEcdsaSecp256k1Key = 20,
// Cost of computing an ECDSA secp256k1 signature from bytes.
ComputeEcdsaSecp256k1Sig = 23,
ComputeEcdsaSecp256k1Sig = 21,
// Cost of recovering an ECDSA secp256k1 key from a signature.
RecoverEcdsaSecp256k1Key = 24,
RecoverEcdsaSecp256k1Key = 22,
// Cost of int256 addition (`+`) and subtraction (`-`) operations
Int256AddSub = 25,
Int256AddSub = 23,
// Cost of int256 multiplication (`*`) operation
Int256Mul = 26,
Int256Mul = 24,
// Cost of int256 division (`/`) operation
Int256Div = 27,
Int256Div = 25,
// Cost of int256 power (`exp`) operation
Int256Pow = 28,
Int256Pow = 26,
// Cost of int256 shift (`shl`, `shr`) operation
Int256Shift = 29
Int256Shift = 27
};

struct ContractCostParamEntry {
Expand Down