Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.

Do not charge gas for interface methods #265

Merged
merged 1 commit into from
May 27, 2018
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
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ exports.evm2wast = function (evmCode, opts = {
if (opts.chargePerOp) {
segment += `(call $useGas (i64.const ${op.fee})) `
}
gasCount += op.fee
// do not charge gas for interface methods
// TODO: implement proper gas charging and enable this here
if (opint < 0x30 || (opint > 0x45 && opint < 0xa0)) {
Copy link
Collaborator

@cdetrio cdetrio May 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better to have an explicit list of opcodes which translate to interface methods and opcodes that don't

Copy link
Collaborator

@cdetrio cdetrio May 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relevant doc is here ewasm/design#81

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is an option which came up (add a field to opcodes.js), but this was a quick and dirty way to progress.

gasCount += op.fee
}

segmentStackDeta += op.on
if (segmentStackDeta > segmentStackHigh) {
Expand Down