question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deduplication of `Message.gas_price` and `Message.origin`

See original GitHub issue

What is wrong?

The Message.gas_price and Message.origin are copied for every level of computation during VM execution, despite them remaining constant for the entire context of the VM execution.

It would be nice to remove this duplication in favor of having these values stored in one location.

Also see: sighash from https://github.com/ethereum/py-evm/pull/259/files

How can it be fixed

Implement a TransactionContext object, similar to the ExecutionContext object introduced in #273

This would be an object that we treat as immutable which houses information like gas_price, and sighash for the in-progress sharding work.

Since the info for this object will change over time with changes to the VM rules we should use the following API to allow for changing out the class which contains this data.

# vm_state.py

class VMState:
    transaction_context_class = None  # must be set in individual VMState classes

    @classmethod
    def get_transaction_context_class(cls):
        # error check to be sure it's set
        return self.transaction_context_class

Then, within the VMState.execute_transaction implementation, after the message instance is created, we should also generate the transaction context instance.

Then, we modify vm_state.get_computation to take both message and transaction_context as arguments. The transaction_context should be stored on the Computation object. When child computations are spawned, this object should be passed into those instances.

Any opcodes which previously accessed values from the Message which now reside on the TransactionContext object will need to be updated.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pipermerriamcommented, Jan 26, 2018

@lrettig this would be a good issue for you to look into.

0reactions
lrettigcommented, Feb 10, 2018

Do we want to include message.is_static here as well? Per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-214.md, this appears to be static in sub-calls.

Update: @pipermerriam says: “Should not be included. It’s included in sub calls only once set so while it can’t toggle back and forth, it can change from one computation to the next. Check out the static call opcode.”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Message delivery and deduplication strategies - SoftwareMill
With the at-least-once, all messages will be delivered one or more times. And exactly-once delivery does not exist. Ok, that's not entirely true ......
Read more >
Using the Amazon SQS message deduplication ID
The message deduplication ID is the token used for deduplication of sent messages. If a message with a particular message deduplication ID is...
Read more >
Delivering billions of messages exactly once - Segment
Incoming messages are assigned a unique ID and logged to Kafka, while a Go program functions as the deduplication “worker:" reading new ...
Read more >
Handling duplicate data in streaming pipeline using Pub/Sub ...
Deduplication options for source generated duplicates and publisher generated duplicates. 1. Use Pub/Sub message attributes. Each message ...
Read more >
Kafka Deduplication Patterns - Part 1 of 2 - Lydtech Consulting
Managing duplicate events is an inevitable aspect of distributed messaging using Kafka. This article looks at the patterns that can be applied in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found