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

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

Merged
merged 2 commits into from
Nov 5, 2019

Conversation

axic
Copy link
Member

@axic axic commented Jul 4, 2019

Fixes #318.

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

@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

bindings/rust/evmc-declare-tests/src/lib.rs Show resolved Hide resolved
examples/example-rust-vm/src/lib.rs Outdated Show resolved Hide resolved
bindings/rust/evmc-vm/src/container.rs Show resolved Hide resolved
@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
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.

@chfast
Copy link
Member

chfast commented Aug 7, 2019

Can this be merged?

@axic
Copy link
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
@chfast
Copy link
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.

Copy link
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
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
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
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.

) -> ExecutionResult {
if _context.is_none() {
return ExecutionResult::failure();
Copy link
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
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 join this conversation on GitHub. Already have an account? Sign in to comment
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