Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

rust: make ExecutionContext optional in EvmcVm.execute()#350

Merged
axic merged 2 commits intomasterfrom
rust-vm-fields
Nov 5, 2019
Merged

rust: make ExecutionContext optional in EvmcVm.execute()#350
axic merged 2 commits intomasterfrom
rust-vm-fields

Conversation

@axic
Copy link
Copy Markdown
Member

@axic axic commented Jul 4, 2019

Fixes #318.

@axic axic requested a review from jakelang July 4, 2019 20:01
Copy link
Copy Markdown
Contributor

@jakelang jakelang left a comment

Choose a reason for hiding this comment

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

I feel like this would be cleaner if ExecutionContext would make its context member optional instead

@axic axic force-pushed the rust-vm-fields branch 2 times, most recently from 504f0aa to 6fe50b1 Compare July 15, 2019 10:30
@axic axic requested a review from jakelang July 15, 2019 10:30
jakelang
jakelang previously approved these changes Jul 22, 2019
@axic axic changed the title rust: pass ExecutionMessage directly to EvmcVm.execute() and make ExecutionContext optional rust: make ExecutionContext optional in EvmcVm.execute() Jul 23, 2019
@axic
Copy link
Copy Markdown
Member Author

axic commented Jul 23, 2019

I feel like this would be cleaner if ExecutionContext would make its context member optional instead

The problem with that is every single feature of ExecutionContext depends on that field being present.

@axic axic force-pushed the rust-vm-fields branch from 6fe50b1 to eb67ad1 Compare July 23, 2019 11:44
@chfast
Copy link
Copy Markdown
Member

chfast commented Aug 7, 2019

Can this be merged?

@axic
Copy link
Copy Markdown
Member Author

axic commented Aug 9, 2019

@jakelang rebased, but not sure I like it.

@chfast we can also consider precompiles support for 6.4.

@axic axic requested a review from jakelang August 9, 2019 08:57
@axic axic dismissed jakelang’s stale review August 9, 2019 08:57

Old review.

@chfast
Copy link
Copy Markdown
Member

chfast commented Aug 9, 2019

I have to checked what this PR is about. I postponed the C++ API changes for Precompiles.

BTW, there will be no 6.4. The 7.0 is next.

@axic axic force-pushed the rust-vm-fields branch 3 times, most recently from b2068c3 to a273ac9 Compare November 5, 2019 14:06
Copy link
Copy Markdown
Member

@chfast chfast left a comment

Choose a reason for hiding this comment

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

I think this is not correct.

Here the logic is: null host context implies null host interface.
But in reality we have 3 cases:

  • interface not null, context not null (usual case),
  • interface not null, context null (Host does not want to store anything in the context),
  • interface null, context null (precompiles).

)
};
container.execute(revision, code_ref, &execution_message, &mut execution_context)
if context.is_null() {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Forgot to change this one line during rebasing, that's the reason it is broken @chfast.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks good now, but is there an unit test what would detect the issue?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I did run the vmtester on it with precompiles enabled but even the old one passed it.

_context: Option<&'a mut ExecutionContext<'a>>,
) -> ExecutionResult {
if _context.is_none() {
return ExecutionResult::failure();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this is a failure?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because the code needs tx_context which is part of that?

@axic axic merged commit dee9b57 into master Nov 5, 2019
@axic axic deleted the rust-vm-fields branch November 5, 2019 15:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust bindings are incompatible with EIP-2003

3 participants