Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@gavofyork
Copy link
Member

@gavofyork gavofyork commented Jan 30, 2018

This API only works with our in-memory stuff, but that's fine for PoC-1. We'll need to rethink this for PoC-2 when we have a more serious backend.

Closes #37
Closes #39

@gavofyork gavofyork added the A0-please_review Pull request needs code review. label Jan 30, 2018
@gavofyork gavofyork changed the title Verify the storage root as part of runtime Verify the storage root and tx trie root in runtime Jan 31, 2018
ext_enumerated_trie_root(values_data: *const u8, values_len: u32, lens_data: *const u32, lens_len: u32, result: *mut u8) => {
let values = (0..lens_len)
.map(|i| this.memory.read_primitive(lens_data + i * 4))
.collect::<::std::result::Result<Vec<u32>, DummyUserError>>()?
Copy link
Member Author

Choose a reason for hiding this comment

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

anyone know of any better way of shortcircuiting a Result than .collect()?.into_iter()?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

It is unstable though

}
})()
let mut sig = [0u8; 64];
this.memory.get_into(sig_data, &mut sig[..]).map_err(|_| DummyUserError)?;
Copy link
Member

Choose a reason for hiding this comment

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

Previous version preserved error code here. Is it intentionally discarded now?

Copy link
Member Author

Choose a reason for hiding this comment

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

yup - any attempt to read out of bounds memory is now a strict runtime error.

@arkpar arkpar self-requested a review January 31, 2018 07:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants